TDME2  1.9.200
ParticlesShader.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <tdme/tdme.h>
4 #include <tdme/engine/fwd-tdme.h>
7 #include <tdme/math/fwd-tdme.h>
8 #include <tdme/math/Matrix4x4.h>
10 
15 
16 /**
17  * Particles shader program
18  * @author Andreas Drewke
19  */
21 {
22 private:
23  static constexpr int ATLASTEXTURE_COUNT { 128 };
24 
25  int32_t programId { -1 };
26  int32_t fragmentShaderId { -1 };
27  int32_t vertexShaderId { -1 };
28  int32_t uniformMVPMatrix { -1 };
29  int32_t uniformViewPortWidth { -1 };
30  int32_t uniformViewPortHeight { -1 };
31  int32_t uniformProjectionMatrixXx { -1 };
32  int32_t uniformProjectionMatrixYy { -1 };
34  array<int32_t, ATLASTEXTURE_COUNT> uniformAtlasTextureOrientation;
35  array<int32_t, ATLASTEXTURE_COUNT> uniformAtlasTexturePosition;
36  array<int32_t, ATLASTEXTURE_COUNT> uniformAtlasTextureDimension;
37  int32_t ppsTextureAtlasTextureId { 0 };
39  bool isRunning;
41  Engine* engine { nullptr };
42  Renderer* renderer { nullptr };
43 
44 public:
45  // forbid class copy
47 
48  /**
49  * Public constructor
50  * @param engine engine
51  * @param renderer renderer
52  */
54 
55  /**
56  * @return initialized and ready to be used
57  */
58  bool isInitialized();
59 
60  /**
61  * Initialize renderer
62  */
63  void initialize();
64 
65  /**
66  * Use lighting program
67  * @param contextIdx context index
68  */
69  void useProgram(int contextIdx);
70 
71  /**
72  * Update effect to program
73  * @param contextIdx context index
74  */
75  void updateEffect(int contextIdx);
76 
77  /**
78  * Unuse particles shader program
79  * @param contextIdx context index
80  */
81  void unUseProgram(int contextIdx);
82 
83  /**
84  * Update matrices to program
85  * @param contextIdx context index
86  */
87  void updateMatrices(int contextIdx);
88 
89  /**
90  * Set texture atlas
91  * @param contextIdx context index
92  * @param textureAtlas texture atlas
93  */
94  void setTextureAtlas(int contextIdx, TextureAtlas* textureAtlas);
95 
96 };
Engine main class.
Definition: Engine.h:131
void updateMatrices(int contextIdx)
Update matrices to program.
void updateEffect(int contextIdx)
Update effect to program.
void unUseProgram(int contextIdx)
Unuse particles shader program.
array< int32_t, ATLASTEXTURE_COUNT > uniformAtlasTextureOrientation
array< int32_t, ATLASTEXTURE_COUNT > uniformAtlasTexturePosition
ParticlesShader(Engine *engine, Renderer *renderer)
Public constructor.
void setTextureAtlas(int contextIdx, TextureAtlas *textureAtlas)
Set texture atlas.
void useProgram(int contextIdx)
Use lighting program.
array< int32_t, ATLASTEXTURE_COUNT > uniformAtlasTextureDimension
Matrix4x4 class representing matrix4x4 mathematical structure and operations for 3d space.
Definition: Matrix4x4.h:23
#define FORBID_CLASS_COPY(CLASS)
Definition: tdme.h:6