Neo  0.5.0
Developer Documentation
PostProcessor.h
Go to the documentation of this file.
1 
20 #ifndef __POST_PROCESSOR_H__
21 #define __POST_PROCESSOR_H__
22 
23 #include "PointerVariable.h"
24 #include <stdint.h>
25 
26 namespace Neo
27 {
33 class NEO_ENGINE_EXPORT PostProcessor
34 {
35 public:
36  PostProcessor();
37 
44  bool draw(OCamera* camera);
45 
52  bool loadShader(const char* vertShad, const char* fragShad);
53 
60  bool loadShaderFile(const char* vertShad, const char* fragShad);
61 
66  void updateResolution();
67 
72  void eraseTextures();
73 
78  void addFloatUniform(const char* name);
79 
85  void setFloatUniformValue(const char* name, float value);
86 
92  float getFloatUniformValue(int idx);
93 
98  void addIntUniform(const char* name);
99 
105  void setIntUniformValue(const char* name, float value);
106 
112  int getIntUniformValue(int idx);
113 
119  int getNumUniforms() { return m_UniformList.size(); }
120 
126  const char* getUniformName(int idx);
127 
134  M_VARIABLE_TYPE getUniformType(int idx);
135 
139  void clear();
140 
144  const char* getVertexShader() { return m_vertShadPath.getSafeString(); }
145 
149  const char* getFragmentShader() { return m_fragShadPath.getSafeString(); }
150 
158  void setShaderPath(const char* vertPath, const char* fragPath);
159 
163  int getFX() { return m_fx; }
164 
168  float getResolutionMultiplier() { return m_ResolutionMultiplier; }
169 
178  void setResolutionMultiplier(float res) { m_ResolutionMultiplier = res; }
179 
180 protected:
181  void set2D(unsigned int w, unsigned int h);
182  void drawQuad(Vector2 scale);
183 
184  void sendUniforms();
185 
186  unsigned int m_BufferID;
187  unsigned int m_ColourTexID;
188  unsigned int m_DepthTexID;
189 
190  unsigned int m_fx;
191  unsigned int m_fragShad;
192  unsigned int m_vertShad;
193 
196 
199 
200  typedef struct
201  {
203  char name[255];
204  bool dirty;
205  }uniform_t;
206 
207  typedef struct
208  {
210  char name[255];
211  bool dirty;
212  float value;
214 
215  typedef struct
216  {
218  char name[255];
219  bool dirty;
220  int value;
221  }int_uniform_t;
222 
223  vector<uintptr_t> m_UniformList;
224 
225  // Cache texture coordinates for faster rendering
226  Vector2 m_texCoords[4];
227 
228  // Cache vertices for faster rendering
229  Vector2 m_vertices[4];
230 };
231 }
232 #endif
unsigned int m_vertShad
Definition: PostProcessor.h:192
String m_vertShadPath
Definition: PostProcessor.h:197
const char * getFragmentShader()
Definition: PostProcessor.h:149
void setResolutionMultiplier(float res)
Sets the current resolution multiplier.
Definition: PostProcessor.h:178
float getResolutionMultiplier()
Definition: PostProcessor.h:168
Definition: PostProcessor.h:200
int getFX()
Definition: PostProcessor.h:163
int value
Definition: PostProcessor.h:220
unsigned int m_fx
Definition: PostProcessor.h:190
unsigned int m_DepthTexID
Definition: PostProcessor.h:188
bool dirty
Definition: PostProcessor.h:219
Implements a framework for string manipulation that operates directly on C strings.
Definition: NeoString.h:35
vector< uintptr_t > m_UniformList
Definition: PostProcessor.h:223
const char * getVertexShader()
Definition: PostProcessor.h:144
unsigned int m_ColourTexID
Definition: PostProcessor.h:187
int m_Resolution
Definition: PostProcessor.h:194
NeoVariable variable
Definition: PostProcessor.h:217
unsigned int m_fragShad
Definition: PostProcessor.h:191
Definition: PostProcessor.h:207
unsigned int m_BufferID
Definition: PostProcessor.h:186
Definition: Vector2.h:31
Definition: PostProcessor.h:215
The MPostProcessor class contains functionality used to render the current scene to a texture to allo...
Definition: PostProcessor.h:33
int getNumUniforms()
Returns the number of currently registered uniform variables. Increases whenever one of the "add*Unif...
Definition: PostProcessor.h:119
bool dirty
Definition: PostProcessor.h:211
NeoVariable variable
Definition: PostProcessor.h:209
NeoVariable variable
Definition: PostProcessor.h:202
float m_ResolutionMultiplier
Definition: PostProcessor.h:195
float value
Definition: PostProcessor.h:212
bool dirty
Definition: PostProcessor.h:204
Definition: OCamera.h:30
Definition: Color.h:29
The NeoVariable class defines a variable that can be of any type available in M_VARIABLE_TYPE.
Definition: PointerVariable.h:55
String m_fragShadPath
Definition: PostProcessor.h:198
M_VARIABLE_TYPE
The M_VARIABLE_TYPE enum defines all types that are storable in an MVariable object.
Definition: PointerVariable.h:35