33 virtual void Resize(uint32_t
width, uint32_t
height)
override;
35 virtual bool CreateImGUI()
override;
37 void ApplyMSAAChange()
override;
38 void ApplyVSyncChange()
override;
43 virtual void Draw(uint32_t vertexCount)
override;
44 virtual void Draw(uint32_t vertexCount, uint32_t firstVertex)
override;
45 virtual void DrawIndexed(uint32_t indexCount)
override;
46 virtual void DrawIndexed(uint32_t indexCount, uint32_t firstIndex,
47 int32_t baseVertex)
override;
48 virtual void DrawInstance(uint32_t instanceCount,
49 uint32_t vertexPerInstance)
override;
50 virtual void DrawIndexedInstance(uint32_t instanceCount,
51 uint32_t indexPerInstance)
override;
52 virtual void DrawIndexedInstance(uint32_t instanceCount,
53 uint32_t indexPerInstance,
55 int32_t baseVertex)
override;
57 virtual void SetRenderFace(
RenderFace face)
override;
58 virtual void SetRenderMode(
RenderMode mode)
override;
60 float minDepth = 0.0f,
61 float maxDepth = 1.0f)
override;
64 virtual void ClearDepthStencil(
bool clearDepth,
bool clearStencil,
65 float depth, uint8_t stencil)
override;
67 virtual void SetDepthWrite(
bool enabled)
override;
68 virtual void SetDepthCompare(
DepthCompare compare)
override;
69 virtual void SetCullEnabled(
bool enabled)
override;
73 uint32_t slot = 0)
override;
75 uint32_t slot = 0)
override;
77 uint32_t slot = 0)
override;
80 virtual void BeginDebugLinePass()
override;
81 virtual void EndDebugLinePass()
override;
85 virtual Shader* CreateShader(
const std::string& shaderSource)
override;
86 virtual Texture* CreateTexture(
const std::string& TexturePath)
override;
91 Texture* CreateCubemapTexture(
const std::array<std::string, 6>& facePaths);
93 Texture* CreateCubemapTextureFromPanorama(
const std::string& panoramaPath);
97 SDL_GLContext m_GLContext =
nullptr;
98 bool m_Initialized =
false;
101 bool m_debugLineMode =
false;
104 GLuint m_msaaFBO = 0;
105 GLuint m_msaaColorRBO = 0;
106 GLuint m_msaaDepthRBO = 0;
108 void CreateMSAAFramebuffer();
109 void CleanupMSAAFramebuffer();
111 virtual void ConfigureRenderMode()
override;
112 virtual void ConfigureRenderFace()
override;
115 void SetupVertexLayout();
118 GLuint m_shadowFBO = 0;
119 GLuint m_shadowDepthTex = 0;
120 GLuint m_shadowUBO = 0;
121 bool m_shadowMapCreated =
false;
122 bool m_shadowUBOCreated =
false;
123 float m_lightVP[16] = {};
124 float m_pendingLightVP[16] = {};
125 bool m_hasPendingLightVP =
false;
126 bool m_inShadowPass =
false;
127 GLuint m_shadowTransformUBO = 0;
128 void SetLightVP(
const float* mat)
override;
129 void UpdateShadowLightUBO(
const void* data, uint32_t size)
override;
131 bool CreateShadowMapResources();
133 bool CreateShadowUBO();
135 void RenderShadowPass();
139 virtual bool IsDeferredEnabled()
const override;
140 virtual bool IsInGeometryPass()
const override {
return m_inGeometryPass; }
141 virtual void BindGBufferShader()
override;
142 virtual void BindPBRMaterial(Sleak::Material* material)
override;
143 virtual void ExecuteDeferredLightingPass()
override;
144 virtual void BeginForwardTransparentPass()
override;
145 virtual void EndForwardTransparentPass()
override;
146 virtual void UpdateDeferredCB(
const void* data, uint32_t size)
override;
149 GLuint m_gbufferFBO = 0;
150 GLuint m_gbufferAlbedoAO = 0;
151 GLuint m_gbufferNormalRough = 0;
152 GLuint m_gbufferMetalEmit = 0;
153 GLuint m_gbufferDepth = 0;
154 bool m_gbufferCreated =
false;
155 int m_gbufferWidth = 0;
156 int m_gbufferHeight = 0;
159 class OpenGLShader* m_gbufferShader =
nullptr;
160 class OpenGLShader* m_lightingShader =
nullptr;
161 GLuint m_lightingVAO = 0;
164 GLuint m_deferredCBUBO = 0;
165 bool m_deferredCBCreated =
false;
167 bool m_inGeometryPass =
false;
168 bool m_inForwardTransparentPass =
false;
171 bool CreateGBufferResources();
172 void CleanupGBufferResources();
174 void RecreateGBufferOnResize(
int width,
int height);
177 GLuint m_ssaoFBO = 0;
178 GLuint m_ssaoTexture = 0;
179 GLuint m_ssaoBlurFBO = 0;
180 GLuint m_ssaoBlurTex = 0;
181 GLuint m_ssaoNoiseTex = 0;
182 GLuint m_ssaoSettingsUBO = 0;
183 GLuint m_ssaoKernelUBO = 0;
184 GLuint m_ssaoCameraUBO = 0;
185 class OpenGLShader* m_ssaoShader =
nullptr;
186 class OpenGLShader* m_ssaoBlurShader =
nullptr;
187 bool m_ssaoCreated =
false;
190 bool CreateSSAOResources();
191 void CleanupSSAOResources();
195 void ExecuteSSAOPass();
198 class OpenGLIBL* m_ibl =
nullptr;
199 GLuint m_iblSettingsUBO = 0;
200 GLuint m_iblBoundCubemap = 0;
Abstract interface for high-level graphics command execution and resource management.