TDME2 1.9.121
Object3DNodeMesh.h
Go to the documentation of this file.
1#pragma once
2
3#include <map>
4#include <string>
5#include <vector>
6
7#include <tdme/tdme.h>
13#include <tdme/engine/Engine.h>
14#include <tdme/math/fwd-tdme.h>
15#include <tdme/math/Matrix4x4.h>
16#include <tdme/math/Vector3.h>
18
19using std::map;
20using std::string;
21using std::vector;
22
32
33/**
34 * Object 3D node mesh specifically for rendering
35 * @author Andreas Drewke
36 */
38{
40 friend class Object3DBase;
42 friend class Object3DNode;
44 friend class EntityRenderer;
47
48private:
51 Node* node { nullptr };
52 int32_t faceCount;
53 const vector<Vector3>* vertices { nullptr };
54 const vector<Vector3>* normals { nullptr };
55 const vector<Vector3>* tangents { nullptr };
56 const vector<Vector3>* bitangents { nullptr };
57 const vector<TextureCoordinate>* textureCoordinates { nullptr };
58 vector<int32_t> indices;
59 vector<Vector3> transformedVertices;
60 vector<Vector3> transformedNormals;
61 vector<Vector3> transformedTangents;
62 vector<Vector3> transformedBitangents;
63 vector<TextureCoordinate> transformedTextureCoordinates;
64 vector<map<string, Matrix4x4*>*> skinningMatrices;
65 vector<vector<Matrix4x4*>> jointsSkinningMatrices;
67
69 vector<vector<float>> cSkinningJointWeight;
70
72
73 vector<vector<vector<Matrix4x4*>>> cSkinningJointTransformationsMatrices;
74
77
79
80 /**
81 * Creates a object3d node mesh from node
82 * @param object3DNodeRenderer object 3D node renderer
83 * @param animationProcessingTarget animation processing target
84 * @param node node
85 * @param transformationMatrices instances transformationm matrices
86 * @param skinningMatrices instances skinning matrices
87 * @param instances instances
88 */
89 Object3DNodeMesh(Object3DNodeRenderer* object3DNodeRenderer, Engine::AnimationProcessingTarget animationProcessingTarget, Node* node, const vector<map<string, Matrix4x4*>*>& transformationMatrices, const vector<map<string, Matrix4x4*>*>& skinningMatrices, int instances);
90
91 /**
92 * Computes mesh transformations
93 * @param contextIdx context index
94 * @param object3DBase object 3d base
95 */
96 void computeTransformations(int contextIdx, Object3DBase* object3DBase);
97
98 /**
99 * Recreates node float buffers
100 */
101 void recreateBuffers();
102
103 /**
104 * @return has recreated buffers
105 */
107 return recreatedBuffers == true;
108 }
109
110 /**
111 * @return if buffers has been recreated and unsets state
112 */
113 bool getRecreatedBuffers();
114
115 /**
116 * Set up vertex indices buffer
117 * @param renderer renderer
118 * @param contextIdx context index
119 * @param vboId vbo id
120 */
121 void setupVertexIndicesBuffer(Renderer* renderer, int contextIdx, int32_t vboId);
122
123 /**
124 * Set up texture coordinates buffer
125 * @param renderer renderer
126 * @param contextIdx context index
127 * @param vboId vbo id
128 */
129 void setupTextureCoordinatesBuffer(Renderer* renderer, int contextIdx, int32_t vboId);
130
131 /**
132 * Set up vertices buffer
133 * @param renderer renderer
134 * @param contextIdx context index
135 * @param vboId vbo id
136 */
137 void setupVerticesBuffer(Renderer* renderer, int contextIdx, int32_t vboId);
138
139 /**
140 * Set up normals buffer
141 * @param renderer renderer
142 * @param contextIdx context index
143 * @param vboId vbo id
144 */
145 void setupNormalsBuffer(Renderer* renderer, int contextIdx, int32_t vboId);
146
147 /**
148 * Set up tangents buffer
149 * @param renderer renderer
150 * @param contextIdx context index
151 * @param vboId vbo id
152 */
153 void setupTangentsBuffer(Renderer* renderer, int contextIdx, int32_t vboId);
154
155 /**
156 * Set up bitangents buffer
157 * @param renderer renderer
158 * @param contextIdx context index
159 * @param vboId vbo id
160 */
161 void setupBitangentsBuffer(Renderer* renderer, int contextIdx, int32_t vboId);
162
163 /**
164 * Set up render node object origins data buffer
165 * @param renderer renderer
166 * @param contextIdx context index
167 * @param vboId vbo id
168 */
169 void setupOriginsBuffer(Renderer* renderer, int contextIdx, int32_t vboId);
170
171 /**
172 * Set up render node object lod data buffer
173 * @param renderer renderer
174 * @param contextIdx context index
175 * @param vboId vbo id
176 * @param lodLevel LOD level
177 */
178 void setupLodBuffer(Renderer* renderer, int contextIdx, int32_t vboId, int lodLevel);
179
180};
Engine main class.
Definition: Engine.h:122
Model node.
Definition: Node.h:31
Class representing texture UV coordinates data.
Object 3D node mesh specifically for rendering.
void setupOriginsBuffer(Renderer *renderer, int contextIdx, int32_t vboId)
Set up render node object origins data buffer.
void setupNormalsBuffer(Renderer *renderer, int contextIdx, int32_t vboId)
Set up normals buffer.
void computeTransformations(int contextIdx, Object3DBase *object3DBase)
Computes mesh transformations.
void setupVertexIndicesBuffer(Renderer *renderer, int contextIdx, int32_t vboId)
Set up vertex indices buffer.
Engine::AnimationProcessingTarget animationProcessingTarget
vector< map< string, Matrix4x4 * > * > skinningMatrices
void setupLodBuffer(Renderer *renderer, int contextIdx, int32_t vboId, int lodLevel)
Set up render node object lod data buffer.
void setupTextureCoordinatesBuffer(Renderer *renderer, int contextIdx, int32_t vboId)
Set up texture coordinates buffer.
void recreateBuffers()
Recreates node float buffers.
void setupTangentsBuffer(Renderer *renderer, int contextIdx, int32_t vboId)
Set up tangents buffer.
const vector< TextureCoordinate > * textureCoordinates
Object3DNodeMesh(Object3DNodeRenderer *object3DNodeRenderer, Engine::AnimationProcessingTarget animationProcessingTarget, Node *node, const vector< map< string, Matrix4x4 * > * > &transformationMatrices, const vector< map< string, Matrix4x4 * > * > &skinningMatrices, int instances)
Creates a object3d node mesh from node.
void setupVerticesBuffer(Renderer *renderer, int contextIdx, int32_t vboId)
Set up vertices buffer.
vector< vector< Matrix4x4 * > > jointsSkinningMatrices
void setupBitangentsBuffer(Renderer *renderer, int contextIdx, int32_t vboId)
Set up bitangents buffer.
vector< vector< vector< Matrix4x4 * > > > cSkinningJointTransformationsMatrices
Object 3d node specifically for rendering.
Definition: Object3DNode.h:39
Interface to compute shader skinning shader program.
4x4 3D Matrix class
Definition: Matrix4x4.h:24
3D vector 3 class
Definition: Vector3.h:22
Float buffer class.
Definition: FloatBuffer.h:18
Short buffer class.
Definition: ShortBuffer.h:14