GlistEngine
Loading...
Searching...
No Matches
gDeferredLight.h
Go to the documentation of this file.
1
2#ifndef ENGINE_GRAPHICS_GDEFERREDLIGHT_H_
3#define ENGINE_GRAPHICS_GDEFERREDLIGHT_H_
4
5#include"gRenderObject.h"
6#include"gShader.h"
7
8// Forward declarations
9class gLight;
10class gCamera;
11class gShadowMap;
12
14public:
16 virtual ~gDeferredLight();
17 // Initializes deferred rendering
18 void setup(int screenWidth, int screenHeight);
19 // Recreates the G-buffer for a new render size. Safe to call after setup().
20 void resize(int screenWidth, int screenHeight);
21
22 // Starts geometry pass
23 void enable();
24
25 // Lighting Pass
26 void renderLightingPass(gCamera* camera, gShadowMap* shadowmap);
27
28 // End Deferred
29 void disable();
30
31 gShader* getGeomShader() {return geometryShader;}
32 gShader* getLightShader() {return lightingShader;}
33
34private:
35 // Sets up G-Buffer textures
36 void setupGBuffer();
37 void releaseGBuffer();
38 void restoreRenderTarget();
39
40 // Draws lighting quad
41 void drawFullScreenQuad();
42
43 unsigned int gBufferFBO;
44 unsigned int positionTexture;
45 unsigned int normalTexture;
46 unsigned int albedoTexture;
47 unsigned int rboDepth;
48 unsigned int quadVAO;
49 unsigned int quadVBO;
50
51 int width;
52 int height;
53 unsigned int renderTargetFBO;
54 int renderTargetViewport[4];
55 bool depthTestWasEnabled;
56 bool geometryPassActive;
57
58 gShader* geometryShader;
59 gShader* lightingShader;
60};
61
62#endif /* ENGINE_GRAPHICS_GDEFERREDLIGHT_H_ */
Definition gCamera.h:18
void renderLightingPass(gCamera *camera, gShadowMap *shadowmap)
void setup(int screenWidth, int screenHeight)
gShader * getLightShader()
Definition gDeferredLight.h:32
virtual ~gDeferredLight()
gShader * getGeomShader()
Definition gDeferredLight.h:31
void resize(int screenWidth, int screenHeight)
Definition gLight.h:22
Definition gShader.h:19
Definition gShadowMap.h:22