1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69
|
#pragma once
#include "iscript.h"
#include "iscriptinterface.h"
#include "imodel.h"
#include "SceneGraphInterface.h"
class MeshVertex;
namespace model { struct ModelPolygon; }
namespace script
{
// Wrapper around a IModelSurface reference
class ScriptModelSurface
{
const model::IModelSurface& _surface;
public:
ScriptModelSurface(const model::IModelSurface& surface) :
_surface(surface)
{}
int getNumVertices() const;
int getNumTriangles() const;
const MeshVertex& getVertex(int vertexIndex) const;
model::ModelPolygon getPolygon(int polygonIndex) const;
std::string getDefaultMaterial() const;
std::string getActiveMaterial() const;
};
class ScriptModelNode :
public ScriptSceneNode
{
public:
// Constructor, checks if the passed node is actually a model
ScriptModelNode(const scene::INodePtr& node);
// Proxy methods
std::string getFilename();
std::string getModelPath();
//void applySkin(const ModelSkin& skin);
int getSurfaceCount();
int getVertexCount();
int getPolyCount();
model::StringList getActiveMaterials();
ScriptModelSurface getSurface(int surfaceNum);
// Checks if the given SceneNode structure is a ModelNode
static bool isModel(const ScriptSceneNode& node);
// "Cast" service for Python, returns a ScriptModelNode.
// The returned node is non-NULL if the cast succeeded
static ScriptModelNode getModel(const ScriptSceneNode& node);
};
/**
* greebo: This class registers the model interface with the
* scripting system.
*/
class ModelInterface :
public IScriptInterface
{
public:
// IScriptInterface implementation
void registerInterface(py::module& scope, py::dict& globals) override;
};
} // namespace script
|