TDME2  1.9.200
ShadowMapCreationShader.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <string>
4 #include <unordered_map>
5 #include <vector>
6 
7 #include <tdme/tdme.h>
8 #include <tdme/engine/fwd-tdme.h>
11 #include <tdme/math/Matrix4x4.h>
12 
13 using std::string;
14 using std::unordered_map;
15 using std::vector;
16 
21 
22 /**
23  * Shadow mapping shader to create a shadow map
24  * @author Andreas Drewke
25  */
27 {
28 private:
31  };
32  unordered_map<string, ShadowMapCreationShaderImplementation*> shaders;
33  bool running { false };
34  Engine* engine { nullptr };
35  Renderer* renderer { nullptr };
36  vector<ShadowMapCreationShaderContext> contexts;
37 
38 public:
39  // forbid class copy
41 
42  /**
43  * Constructor
44  * @param renderer renderer
45  */
47 
48  /**
49  * Destructor
50  */
52 
53  /**
54  * @return if initialized and ready to use
55  */
56  bool isInitialized();
57 
58  /**
59  * Init shadow map creation shader program
60  */
61  void initialize();
62 
63  /**
64  * Use shadow map creation shader program
65  * @param engine engine
66  */
67  void useProgram(Engine* engine);
68 
69  /**
70  * Unuse shadow map creation shader program
71  */
72  void unUseProgram();
73 
74  /**
75  * Set up matrices
76  * @param contextIdx context index
77  */
78  void updateMatrices(int contextIdx);
79 
80  /**
81  * Set up texture matrix
82  * @param contextIdx context index
83  */
84  void updateTextureMatrix(int contextIdx);
85 
86  /**
87  * Update material
88  * @param contextIdx context index
89  */
90  void updateMaterial(int contextIdx);
91 
92  /**
93  * Update shader parameters
94  * @param context
95  */
96  void updateShaderParameters(int contextIdx);
97 
98  /**
99  * Bind texture
100  * @param contextIdx context index
101  * @param textureId texture id
102  */
103  void bindTexture(int contextIdx, int32_t textureId);
104 
105  /**
106  * Set shader
107  * @param context
108  * @param id shader id
109  */
110  void setShader(int contextIdx, const string& id);
111 
112  /**
113  * Load textures
114  * @param pathName path name
115  */
116  void loadTextures(const string& pathName);
117 
118 };
Engine main class.
Definition: Engine.h:131
void useProgram(Engine *engine)
Use shadow map creation shader program.
void setShader(int contextIdx, const string &id)
Set shader.
void updateShaderParameters(int contextIdx)
Update shader parameters.
unordered_map< string, ShadowMapCreationShaderImplementation * > shaders
void bindTexture(int contextIdx, int32_t textureId)
Bind texture.
void unUseProgram()
Unuse shadow map creation shader program.
Matrix4x4 class representing matrix4x4 mathematical structure and operations for 3d space.
Definition: Matrix4x4.h:23
#define FORBID_CLASS_COPY(CLASS)
Definition: tdme.h:6