CSEngine
Loading...
Searching...
No Matches
SGBuffer.h
1#pragma once
2
3#include <vector>
4
5namespace CSE {
6
7 class STexture;
8 class GLProgramHandle;
9 class SFrameBuffer;
10 class SIRender;
11
12 class SGBuffer {
13 public:
14 SGBuffer();
15 ~SGBuffer();
16
17 void GenerateGBuffer(int width, int height);
18 void AttachGeometryFrameBuffer() const;
19 void AttachGeometryFrameBuffer(int target) const;
20 void ResizeGBuffer(int width, int height);
21 void ReleaseGBuffer();
22 void BindLightPass(GLProgramHandle* lightPassHandle);
23 void AttachLightPass() const;
24 void AttachLightPassTexture(int textureLayout = 0) const;
25 void RenderLightPass() const;
26 const std::vector<SIRender*>& GetRendersLayer() const;
27 void PushBackToLayer(SIRender* render);
28 void RemoveToLayer(SIRender* render);
29
30 int GetWidth() const;
31 int GetHeight() const;
32 GLProgramHandle* GetLightPassHandle() const;
33
34 private:
35 SFrameBuffer* m_geometryFrameBuffer = nullptr;
36 std::vector<SIRender*> m_rendersLayer;
37
38 STexture* m_firstTexture = nullptr;
39 STexture* m_secondTexture = nullptr;
40 STexture* m_depthTexture = nullptr;
41
42 GLProgramHandle* m_lightPassHandle = nullptr;
43
44 int m_firstTextureId = -1;
45 int m_secondTextureId = -1;
46 int m_depthTextureId = -1;
47
48 int m_width = -1;
49 int m_height = -1;
50 };
51}