TDME2  1.9.200
ObjectNode.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <memory>
4 #include <string>
5 #include <unordered_map>
6 #include <vector>
7 
8 #include <tdme/tdme.h>
9 #include <tdme/engine/fwd-tdme.h>
14 #include <tdme/engine/Engine.h>
15 #include <tdme/math/fwd-tdme.h>
16 #include <tdme/math/Matrix3x3.h>
18 
19 using std::make_unique;
20 using std::string;
21 using std::unique_ptr;
22 using std::unordered_map;
23 using std::vector;
24 
35 
36 /**
37  * Object node specifically for rendering
38  * @author Andreas Drewke
39  */
41 {
42  friend class tdme::engine::Object;
43  friend class ModelUtilitiesInternal;
44  friend class ObjectBase;
46  friend class ObjectNodeMesh;
47  friend class ObjectNodeRenderer;
48  friend class ObjectInternal;
49  friend class EntityRenderer;
53 
54 private:
55  STATIC_DLL_IMPEXT static int64_t counter;
56 
57  static constexpr int32_t TEXTUREID_NONE { -1 };
58  static constexpr int32_t TEXTUREID_NOTUSED { 0 };
59 
60  string id;
61  ObjectBase* object { nullptr };
62  Node* node { nullptr };
63  bool animated { false };
64  vector<Matrix3x3> textureMatricesByEntities;
73  unique_ptr<ObjectNodeRenderer> renderer;
74  ObjectNodeMesh* mesh { nullptr };
76 
77  /**
78  * Creates object nodes from given object base object
79  * @param object object base
80  * @param useManagers use mesh and object renderer node managers
81  * @param animationProcessingTarget animation processing target
82  * @param objectNodes object nodes array
83  * @return object node
84  */
85  static void createNodes(ObjectBase* object, bool useManagers, Engine::AnimationProcessingTarget animationProcessingTarget, vector<ObjectNode*>& objectNodes);
86 
87  /**
88  * Computes animation for given object nodes
89  * @param contextIdx context index
90  * @param objectNodes node render data list
91  */
92  static void computeAnimation(int contextIdx, vector<ObjectNode*>& objectNodes);
93 
94  /**
95  * Set up textures for given object node and faces entity
96  * @param renderer renderer
97  * @param contextIdx context index
98  * @param objectNode object node
99  * @param facesEntityIdx faces entity idx
100  */
101  static void setupTextures(Renderer* renderer, int contextIdx, ObjectNode* objectNode, int32_t facesEntityIdx);
102 
103  /**
104  * Creates a object nodes recursively for given node and it sub nodes
105  * @param object object base
106  * @param nodes nodes
107  * @param animated animated
108  * @param useManagers use mesh and object render node managers
109  * @param animationProcessingTarget animation processing target
110  * @param objectNodes object nodes
111  */
112  static void createNodes(ObjectBase* object, const unordered_map<string, Node*>& nodes, bool animated, bool useManagers, Engine::AnimationProcessingTarget animationProcessingTarget, vector<ObjectNode*>& objectNodes);
113 
114  /**
115  * Dispose
116  */
117  void dispose();
118 
119 public:
120  // forbid class copy
122 
123  /**
124  * Public constructor
125  */
126  ObjectNode();
127 
128  /**
129  * Destructor
130  */
131  ~ObjectNode();
132 
133  /**
134  * Update node transformations matrix
135  */
137 
138 };
Engine main class.
Definition: Engine.h:131
Object to be used with engine class.
Definition: Object.h:60
Model node.
Definition: Node.h:32
Object node mesh specifically for rendering.
Object node specifically for rendering.
Definition: ObjectNode.h:41
static constexpr int32_t TEXTUREID_NOTUSED
Definition: ObjectNode.h:58
vector< int32_t > pbrMaterialBaseColorTextureIdsByEntities
Definition: ObjectNode.h:69
vector< int32_t > specularMaterialDiffuseTextureIdsByEntities
Definition: ObjectNode.h:65
vector< int32_t > specularMaterialDynamicDiffuseTextureIdsByEntities
Definition: ObjectNode.h:66
vector< int32_t > pbrMaterialMetallicRoughnessTextureIdsByEntities
Definition: ObjectNode.h:70
vector< int32_t > specularMaterialNormalTextureIdsByEntities
Definition: ObjectNode.h:68
vector< int32_t > specularMaterialSpecularTextureIdsByEntities
Definition: ObjectNode.h:67
static void computeAnimation(int contextIdx, vector< ObjectNode * > &objectNodes)
Computes animation for given object nodes.
Definition: ObjectNode.cpp:185
static STATIC_DLL_IMPEXT int64_t counter
Definition: ObjectNode.h:55
vector< int32_t > pbrMaterialEmissiveTextureIdsByEntities
Definition: ObjectNode.h:72
static void createNodes(ObjectBase *object, bool useManagers, Engine::AnimationProcessingTarget animationProcessingTarget, vector< ObjectNode * > &objectNodes)
Creates object nodes from given object base object.
Definition: ObjectNode.cpp:80
static void setupTextures(Renderer *renderer, int contextIdx, ObjectNode *objectNode, int32_t facesEntityIdx)
Set up textures for given object node and faces entity.
Definition: ObjectNode.cpp:192
unique_ptr< ObjectNodeRenderer > renderer
Definition: ObjectNode.h:73
void updateNodeTransformationsMatrix()
Update node transformations matrix.
Definition: ObjectNode.cpp:67
Interface to compute shader skinning shader program.
Matrix3x3 class representing matrix3x3 mathematical structure and operations for 2d space.
Definition: Matrix3x3.h:20
Matrix4x4 class representing matrix4x4 mathematical structure and operations for 3d space.
Definition: Matrix4x4.h:23
#define STATIC_DLL_IMPEXT
Definition: tdme.h:15
#define FORBID_CLASS_COPY(CLASS)
Definition: tdme.h:6