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 DrawIndexed(uint32_t indexCount)
override;
45 virtual void DrawInstance(uint32_t instanceCount,
46 uint32_t vertexPerInstance)
override;
47 virtual void DrawIndexedInstance(uint32_t instanceCount,
48 uint32_t indexPerInstance)
override;
50 virtual void SetRenderFace(
RenderFace face)
override;
51 virtual void SetRenderMode(
RenderMode mode)
override;
53 float minDepth = 0.0f,
54 float maxDepth = 1.0f)
override;
57 virtual void ClearDepthStencil(
bool clearDepth,
bool clearStencil,
58 float depth, uint8_t stencil)
override;
60 virtual void SetDepthWrite(
bool enabled)
override;
61 virtual void SetDepthCompare(
DepthCompare compare)
override;
62 virtual void SetCullEnabled(
bool enabled)
override;
66 uint32_t slot = 0)
override;
68 uint32_t slot = 0)
override;
70 uint32_t slot = 0)
override;
73 virtual void BeginDebugLinePass()
override;
74 virtual void EndDebugLinePass()
override;
78 virtual Shader* CreateShader(
const std::string& shaderSource)
override;
79 virtual Texture* CreateTexture(
const std::string& TexturePath)
override;
84 Texture* CreateCubemapTexture(
const std::array<std::string, 6>& facePaths);
86 Texture* CreateCubemapTextureFromPanorama(
const std::string& panoramaPath);
90 SDL_GLContext m_GLContext =
nullptr;
91 bool m_Initialized =
false;
94 bool m_debugLineMode =
false;
98 GLuint m_msaaColorRBO = 0;
99 GLuint m_msaaDepthRBO = 0;
101 void CreateMSAAFramebuffer();
102 void CleanupMSAAFramebuffer();
104 virtual void ConfigureRenderMode()
override;
105 virtual void ConfigureRenderFace()
override;
108 void SetupVertexLayout();
111 GLuint m_shadowFBO = 0;
112 GLuint m_shadowDepthTex = 0;
113 GLuint m_shadowUBO = 0;
114 bool m_shadowMapCreated =
false;
115 bool m_shadowUBOCreated =
false;
116 float m_lightVP[16] = {};
117 float m_pendingLightVP[16] = {};
118 bool m_hasPendingLightVP =
false;
119 bool m_inShadowPass =
false;
120 GLuint m_shadowTransformUBO = 0;
121 void SetLightVP(
const float* mat)
override;
122 void UpdateShadowLightUBO(
const void* data, uint32_t size)
override;
124 bool CreateShadowMapResources();
126 bool CreateShadowUBO();
128 void RenderShadowPass();
132 virtual bool IsDeferredEnabled()
const override;
133 virtual bool IsInGeometryPass()
const override {
return m_inGeometryPass; }
134 virtual void BindGBufferShader()
override;
135 virtual void BindPBRMaterial(Sleak::Material* material)
override;
136 virtual void ExecuteDeferredLightingPass()
override;
137 virtual void BeginForwardTransparentPass()
override;
138 virtual void EndForwardTransparentPass()
override;
139 virtual void UpdateDeferredCB(
const void* data, uint32_t size)
override;
142 GLuint m_gbufferFBO = 0;
143 GLuint m_gbufferAlbedoAO = 0;
144 GLuint m_gbufferNormalRough = 0;
145 GLuint m_gbufferMetalEmit = 0;
146 GLuint m_gbufferDepth = 0;
147 bool m_gbufferCreated =
false;
148 int m_gbufferWidth = 0;
149 int m_gbufferHeight = 0;
152 class OpenGLShader* m_gbufferShader =
nullptr;
153 class OpenGLShader* m_lightingShader =
nullptr;
154 GLuint m_lightingVAO = 0;
157 GLuint m_deferredCBUBO = 0;
158 bool m_deferredCBCreated =
false;
160 bool m_inGeometryPass =
false;
161 bool m_inForwardTransparentPass =
false;
164 bool CreateGBufferResources();
165 void CleanupGBufferResources();
167 void RecreateGBufferOnResize(
int width,
int height);
170 GLuint m_ssaoFBO = 0;
171 GLuint m_ssaoTexture = 0;
172 GLuint m_ssaoBlurFBO = 0;
173 GLuint m_ssaoBlurTex = 0;
174 GLuint m_ssaoNoiseTex = 0;
175 GLuint m_ssaoSettingsUBO = 0;
176 GLuint m_ssaoKernelUBO = 0;
177 GLuint m_ssaoCameraUBO = 0;
178 class OpenGLShader* m_ssaoShader =
nullptr;
179 class OpenGLShader* m_ssaoBlurShader =
nullptr;
180 bool m_ssaoCreated =
false;
183 bool CreateSSAOResources();
184 void CleanupSSAOResources();
188 void ExecuteSSAOPass();
191 class OpenGLIBL* m_ibl =
nullptr;
192 GLuint m_iblSettingsUBO = 0;
193 GLuint m_iblBoundCubemap = 0;
Abstract interface for high-level graphics command execution and resource management.