File: PatchInterface.h

package info (click to toggle)
darkradiant 3.9.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 41,080 kB
  • sloc: cpp: 264,743; ansic: 10,659; python: 1,852; xml: 1,650; sh: 92; makefile: 21
file content (76 lines) | stat: -rw-r--r-- 1,954 bytes parent folder | download | duplicates (4)
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
70
71
72
73
74
75
76
#pragma once

#include "iscript.h"
#include "iscriptinterface.h"
#include "ipatch.h"

#include "SceneGraphInterface.h"

namespace script
{

class ScriptPatchNode :
	public ScriptSceneNode
{
private:
	static const std::string _emptyShader;
	static PatchControl _emptyPatchControl;
public:
	ScriptPatchNode(const scene::INodePtr& node);

	// Checks if the given SceneNode structure is a PatchNode
	static bool isPatch(const ScriptSceneNode& node);

	// "Cast" service for Python, returns a ScriptPatchNode.
	// The returned node is non-NULL if the cast succeeded
	static ScriptPatchNode getPatch(const ScriptSceneNode& node);

	// Resizes the patch to the given dimensions
	void setDims(std::size_t width, std::size_t height);

	// Get the patch dimensions
	std::size_t getWidth() const;
	std::size_t getHeight() const;

	PatchMesh getTesselatedPatchMesh() const;

	// Return a defined patch control vertex at <row>,<col>
	PatchControl& ctrlAt(std::size_t row, std::size_t col);

	void insertColumns(std::size_t colIndex);
	void insertRows(std::size_t rowIndex);

	void removePoints(int columns, std::size_t index);
	void appendPoints(int columns, int beginning);

	// Check if the patch has invalid control points or width/height are zero
	bool isValid() const;

	// Check whether all control vertices are in the same 3D spot (with minimal tolerance)
	bool isDegenerate() const;

	void controlPointsChanged();

	// Shader handling
	const std::string& getShader() const;
	void setShader(const std::string& name);

	bool hasVisibleMaterial();

	bool subdivisionsFixed() const;
	Subdivisions getSubdivisions() const;
	void setFixedSubdivisions(int isFixed, const Subdivisions& divisions);
};

class PatchInterface :
	public IScriptInterface
{
public:
	ScriptSceneNode createPatchDef2();
	ScriptSceneNode createPatchDef3();

	// IScriptInterface implementation
	void registerInterface(py::module& scope, py::dict& globals) override;
};

} // namespace script