Debian Codegraph @

plugins/script/interfaces/ModelInterface.h

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