TDME2  1.9.200
GUIShader.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <array>
4 
5 #include <tdme/tdme.h>
9 
11 
12 using std::array;
13 
15 
16 /**
17  * GUI shader
18  * @author Andreas Drewke
19  */
21 {
22 
23 private:
24  Renderer* renderer { nullptr };
25  int32_t vertexShaderId { -1 };
26  int32_t fragmentShaderId { -1 };
27  int32_t programId { -1 };
28  int32_t uniformDiffuseTextureUnit { -1 };
30  int32_t uniformMaskTextureUnit { -1 };
32  int32_t uniformMaskMaxValue { -1 };
33  int32_t uniformEffectColorMul { -1 };
34  int32_t uniformEffectColorAdd { -1 };
35  int32_t uniformTextureMatrix { -1 };
36  int32_t uniformGradientAvailable { -1 };
37  array<int32_t, 10> uniformGradientColors { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 };
38  int32_t uniformGradientColorCount { -1 };
39  array<int32_t, 10> uniformGradientColorStarts { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 };
42  bool isRunning;
43 
44 public:
45  // forbid class copy
47 
48  /**
49  * Public constructor
50  * @param renderer renderer
51  */
53 
54  /**
55  * @return if initialized and ready to use
56  */
57  bool isInitialized();
58 
59  /**
60  * Init shadow mapping
61  */
62  void initialize();
63 
64  /**
65  * Use render GUI program
66  */
67  void useProgram();
68 
69  /**
70  * Un use render GUI program
71  */
72  void unUseProgram();
73 
74  /**
75  * Bind texture
76  * @param textureId texture id
77  */
78  void bindTexture(int32_t textureId);
79 
80  /**
81  * Update effect to program
82  */
83  void updateEffect();
84 
85  /**
86  * Update texure matrix to program
87  */
88  void updateTextureMatrix();
89 
90  /**
91  * Set gradient properties
92  * @deprecated use rather custom UI shader and parameters
93  * @param count color count
94  * @param colors colors
95  * @param colorStarts color starts
96  * @param rotationAngle rotation angle
97  */
98  void setGradient(int count, array<GUIColor, 10>& colors, array<float, 10>& colorStarts, float rotationAngle);
99 
100  /**
101  * Disable gradient
102  * @deprecated use rather custom UI shader and parameters
103  */
104  void unsetGradient();
105 
106 };
array< int32_t, 10 > uniformGradientColors
Definition: GUIShader.h:37
void updateEffect()
Update effect to program.
Definition: GUIShader.cpp:140
void setGradient(int count, array< GUIColor, 10 > &colors, array< float, 10 > &colorStarts, float rotationAngle)
Set gradient properties.
Definition: GUIShader.cpp:163
void initialize()
Init shadow mapping.
Definition: GUIShader.cpp:35
GUIShader(Renderer *renderer)
Public constructor.
Definition: GUIShader.cpp:23
int32_t uniformInverseGradientTextureMatrix
Definition: GUIShader.h:40
void unsetGradient()
Disable gradient.
Definition: GUIShader.cpp:177
void bindTexture(int32_t textureId)
Bind texture.
Definition: GUIShader.cpp:126
void useProgram()
Use render GUI program.
Definition: GUIShader.cpp:108
void updateTextureMatrix()
Update texure matrix to program.
Definition: GUIShader.cpp:153
array< int32_t, 10 > uniformGradientColorStarts
Definition: GUIShader.h:39
void unUseProgram()
Un use render GUI program.
Definition: GUIShader.cpp:121
#define FORBID_CLASS_COPY(CLASS)
Definition: tdme.h:6