TDME2  1.9.200
SkyRenderShader.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <string>
4 
5 #include <tdme/tdme.h>
8 #include <tdme/engine/fwd-tdme.h>
9 
10 using std::string;
11 
16 
17 /**
18  * Sky render shader
19  * @author Andreas Drewke
20  */
22 {
23 
24 private:
25  Renderer* renderer { nullptr };
26 
27  int32_t vertexShaderId { -1 };
28  int32_t fragmentShaderId { -1 };
29  int32_t programId { -1 };
31  int32_t uniformTime { -1 };
32  int32_t uniformAspectRatio { -1 };
33  int32_t uniformForwardVector { -1 };
34  int32_t uniformSideVector { -1 };
35  int32_t uniformUpVector { -1 };
36  int32_t uniformLIGHT0_DIRECTION { -1 };
37  int32_t uniformLIGHT0_ENABLED { -1 };
38  int32_t uniformLIGHT1_DIRECTION { -1 };
39  int32_t uniformLIGHT1_ENABLED { -1 };
40  int32_t uniformStarsTexture { -1 };
41 
42  // sky
43  int32_t uniformDayTopColor { -1 };
44  int32_t uniformDayBottomColor { -1 };
45  int32_t uniformSunsetTopColor { -1 };
46  int32_t uniformSunsetBottomColor { -1 };
47  int32_t uniformNightTopColor { -1 };
48  int32_t uniformNightBottomColor { -1 };
49  // horizon
50  int32_t uniformHorizonColor { -1 };
51  int32_t uniformHorizonBlur { -1 };
52  // sun
53  int32_t uniformSunColorFactor { -1 };
54  int32_t uniformSunColor { -1 };
55  int32_t uniformSunSunsetColor { -1 };
56  int32_t uniformSunSize { -1 };
57  int32_t uniformSunBlur { -1 };
58  // moon
59  int32_t uniformMoonColorFactor { -1 };
60  int32_t uniformMoonColor { -1 };
61  int32_t uniformMoonSize { -1 };
62  int32_t uniformMoonBlur { -1 };
63  // clouds
64  int32_t uniformCloudsEdgeColor { -1 };
65  int32_t uniformCloudsTopColor { -1 };
66  int32_t uniformCloudsMiddleColor { -1 };
67  int32_t uniformCloudsBottomColor { -1 };
68  int32_t uniformCloudsSpeed { -1 };
69  int32_t uniformCloudsDirection { -1 };
70  int32_t uniformCloudsScale { -1 };
71  int32_t uniformCloudsCutoff { -1 };
72  int32_t uniformCloudsFuzziness { -1 };
73  int32_t uniformCloudsWeight { -1 };
74  int32_t uniformCloudsBlur { -1 };
75  int32_t uniformStarsSpeed { -1 };
76 
77  Texture* starsTexture { nullptr };
78  int32_t starsTextureId { 0 };
79 
80  bool initialized { false };
81 
82 public:
83  // forbid class copy
85 
86  /**
87  * Public constructor
88  * @param renderer renderer
89  */
91 
92  /**
93  * Public destructor
94  */
96 
97  /**
98  * @return if initialized and ready to use
99  */
100  bool isInitialized();
101 
102  /**
103  * Initialize
104  */
105  void initialize();
106 
107  /**
108  * Dispose
109  */
110  void dispose();
111 
112  /**
113  * Unload textures
114  */
115  void unloadTextures();
116 
117  /**
118  * Load textures
119  * @param pathName path name
120  */
121  void loadTextures(const string& pathName);
122 
123 
124  /**
125  * Render
126  * @param engine engine
127  * @param lightScatteringPass light scattering pass
128  * @param camera camera
129  */
130  void render(Engine* engine, bool lightScatteringPass, Camera* camera = nullptr);
131 
132 };
Engine main class.
Definition: Engine.h:131
Frame buffer class.
Definition: FrameBuffer.h:22
Texture entity.
Definition: Texture.h:24
void render(Engine *engine, bool lightScatteringPass, Camera *camera=nullptr)
Render.
SkyRenderShader(Renderer *renderer)
Public constructor.
void loadTextures(const string &pathName)
Load textures.
#define FORBID_CLASS_COPY(CLASS)
Definition: tdme.h:6