Debian Codegraph @

plugins/script/interfaces/PatchInterface.h

raw
1 #pragma once
2
3 #include "iscript.h"
4 #include "iscriptinterface.h"
5 #include "ipatch.h"
6
7 #include "SceneGraphInterface.h"
8
9 namespace script
10 {
11
12 class ScriptPatchNode :
13 public ScriptSceneNode
14 {
15 private:
16 static const std::string _emptyShader;
17 static PatchControl _emptyPatchControl;
18 public:
19 ScriptPatchNode(const scene::INodePtr& node);
20
21 // Checks if the given SceneNode structure is a PatchNode
22 static bool isPatch(const ScriptSceneNode& node);
23
24 // "Cast" service for Python, returns a ScriptPatchNode.
25 // The returned node is non-NULL if the cast succeeded
26 static ScriptPatchNode getPatch(const ScriptSceneNode& node);
27
28 // Resizes the patch to the given dimensions
29 void setDims(std::size_t width, std::size_t height);
30
31 // Get the patch dimensions
32 std::size_t getWidth() const;
33 std::size_t getHeight() const;
34
35 PatchMesh getTesselatedPatchMesh() const;
36
37 // Return a defined patch control vertex at <row>,<col>
38 PatchControl& ctrlAt(std::size_t row, std::size_t col);
39
40 void insertColumns(std::size_t colIndex);
41 void insertRows(std::size_t rowIndex);
42
43 void removePoints(int columns, std::size_t index);
44 void appendPoints(int columns, int beginning);
45
46 // Check if the patch has invalid control points or width/height are zero
47 bool isValid() const;
48
49 // Check whether all control vertices are in the same 3D spot (with minimal tolerance)
50 bool isDegenerate() const;
51
52 void controlPointsChanged();
53
54 // Shader handling
55 const std::string& getShader() const;
56 void setShader(const std::string& name);
57
58 bool hasVisibleMaterial();
59
60 bool subdivisionsFixed() const;
61 Subdivisions getSubdivisions() const;
62 void setFixedSubdivisions(int isFixed, const Subdivisions& divisions);
63 };
64
65 class PatchInterface :
66 public IScriptInterface
67 {
68 public:
69 ScriptSceneNode createPatchDef2();
70 ScriptSceneNode createPatchDef3();
71
72 // IScriptInterface implementation
73 void registerInterface(py::module& scope, py::dict& globals) override;
74 };
75
76 } // namespace script