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 class ResMgr;
12
13 class SGBuffer {
14 public:
15 SGBuffer();
16 ~SGBuffer();
17
18 void GenerateGBuffer(int width, int height);
19 void AttachGeometryFrameBuffer() const;
20 void AttachGeometryFrameBuffer(int target) const;
21 void ResizeGBuffer(int width, int height);
22 void ReleaseGBuffer();
23 void BindLightPass(GLProgramHandle* lightPassHandle);
24 void AttachLightPass() const;
25 void AttachLightPassTexture(int textureLayout = 0) const;
26 void RenderLightPass() const;
27 const std::vector<SIRender*>& GetRendersLayer() const;
28 void PushBackToLayer(SIRender* render);
29 void RemoveToLayer(SIRender* render);
30
31 int GetWidth() const;
32 int GetHeight() const;
33 GLProgramHandle* GetLightPassHandle() const;
34
35 private:
36 SFrameBuffer* m_geometryFrameBuffer = nullptr;
37 std::vector<SIRender*> m_rendersLayer;
38
39 STexture* m_firstTexture = nullptr;
40 STexture* m_secondTexture = nullptr;
41 STexture* m_depthTexture = nullptr;
42
43 GLProgramHandle* m_lightPassHandle = nullptr;
44
45 int m_firstTextureId = -1;
46 int m_secondTextureId = -1;
47 int m_depthTextureId = -1;
48
49 int m_width = -1;
50 int m_height = -1;
51
52 ResMgr* m_resMgr = nullptr;
53 };
54}