TDME2  1.9.200
SkinningShader.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>
11 #include <tdme/math/Matrix4x4.h>
13 
14 using std::map;
15 using std::string;
16 using std::vector;
17 
23 
24 /**
25  * Interface to compute shader skinning shader program
26  * @author Andreas Drewke
27  */
29 {
30 private:
31  struct SkinningContext {
32  volatile bool running { false };
33  };
34 
36  string id;
37  vector<int32_t>* vboIds;
38  vector<vector<int32_t>*> matricesVboIds;
39  };
40 
41  int32_t programId { -1 };
42  int32_t shaderId { -1 };
43  int32_t uniformVertexCount { -1 };
44  int32_t uniformMatrixCount { -1 };
45  int32_t uniformInstanceCount { -1 };
46  bool isRunning;
48  Renderer* renderer { nullptr };
49  vector<SkinningContext> contexts;
50  map<string, ModelSkinningCache> cache;
52 
53 public:
54  // forbid class copy
56 
57  /**
58  * Public constructor
59  * @param renderer renderer
60  */
62 
63  /**
64  * @return initialized and ready to be used
65  */
66  bool isInitialized();
67 
68  /**
69  * Initialize renderer
70  */
71  void initialize();
72 
73  /**
74  * Use skinning program
75  */
76  void useProgram();
77 
78  /**
79  * Unuse skinning program
80  */
81  void unUseProgram();
82 
83  /**
84  * Compute skinning
85  * @param contextIdx context index
86  * @param objectBase object base
87  * @param objectNodeMesh object node mesh
88  */
89  void computeSkinning(int contextIdx, ObjectBase* objectBase, ObjectNodeMesh* objectNodeMesh);
90 
91  /**
92  * Reset
93  */
94  void reset();
95 
96 };
Object node mesh specifically for rendering.
Interface to compute shader skinning shader program.
SkinningShader(Renderer *renderer)
Public constructor.
void computeSkinning(int contextIdx, ObjectBase *objectBase, ObjectNodeMesh *objectNodeMesh)
Compute skinning.
map< string, ModelSkinningCache > cache
Matrix4x4 class representing matrix4x4 mathematical structure and operations for 3d space.
Definition: Matrix4x4.h:23
Mutex implementation.
Definition: Mutex.h:19
#define FORBID_CLASS_COPY(CLASS)
Definition: tdme.h:6