diff --git a/src/inferno/application.cpp b/src/inferno/application.cpp index 70b68af..7571fa0 100644 --- a/src/inferno/application.cpp +++ b/src/inferno/application.cpp @@ -178,7 +178,7 @@ int Application::run() render(); RenderCommand::clearColor({ 0.2f, 0.3f, 0.3f, 1.0f }); - RenderCommand::clearColorDepthBit(); + RenderCommand::clearBit(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); std::pair projectionView = m_scene->cameraProjectionView(); RendererCubemap::the().beginScene(projectionView.first, projectionView.second); // camera, lights, environment @@ -200,7 +200,7 @@ int Application::run() // Framebuffer RenderCommand::clearColor({ 1.0f, 1.0f, 1.0f, 1.0f }); - RenderCommand::clearColorBit(); + RenderCommand::clearBit(GL_COLOR_BUFFER_BIT); Renderer2D::the().setEnableDepthBuffer(false); Renderer2D::the().beginScene(matIdentity, matIdentity); @@ -242,7 +242,7 @@ bool Application::onWindowResize(WindowResizeEvent& e) ruc::info("WindowResizeEvent {}x{}", e.getWidth(), e.getHeight()); RenderCommand::setViewport(0, 0, e.getWidth(), e.getHeight()); - m_framebuffer->setSize(e.getWidth(), e.getHeight()); + m_framebuffer->resize(e.getWidth(), e.getHeight()); return true; } diff --git a/src/inferno/render/framebuffer.cpp b/src/inferno/render/framebuffer.cpp index 8f67821..3a9d0b1 100644 --- a/src/inferno/render/framebuffer.cpp +++ b/src/inferno/render/framebuffer.cpp @@ -52,7 +52,7 @@ void Framebuffer::unbind() const glBindFramebuffer(GL_FRAMEBUFFER, 0); } -void Framebuffer::setSize(uint32_t width, uint32_t height) +void Framebuffer::resize(uint32_t width, uint32_t height) { if (m_width == width && m_height == height) { return; diff --git a/src/inferno/render/framebuffer.h b/src/inferno/render/framebuffer.h index c067840..a15623d 100644 --- a/src/inferno/render/framebuffer.h +++ b/src/inferno/render/framebuffer.h @@ -43,7 +43,7 @@ public: void bind() const; void unbind() const; - void setSize(uint32_t width, uint32_t height); + void resize(uint32_t width, uint32_t height); Type type() const { return m_type; } uint32_t width() const { return m_width; } diff --git a/src/inferno/render/render-command.cpp b/src/inferno/render/render-command.cpp index 88fe692..6e77838 100644 --- a/src/inferno/render/render-command.cpp +++ b/src/inferno/render/render-command.cpp @@ -29,14 +29,10 @@ void RenderCommand::destroy() { } -void RenderCommand::clearColorDepthBit() +void RenderCommand::clearBit(uint32_t bits) { - glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); -} - -void RenderCommand::clearColorBit() -{ - glClear(GL_COLOR_BUFFER_BIT); + // GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT + glClear(bits); } void RenderCommand::clearColor(const glm::vec4& color) diff --git a/src/inferno/render/render-command.h b/src/inferno/render/render-command.h index 7c2b934..2430b4c 100644 --- a/src/inferno/render/render-command.h +++ b/src/inferno/render/render-command.h @@ -19,8 +19,7 @@ public: static void initialize(); static void destroy(); - static void clearColorDepthBit(); - static void clearColorBit(); + static void clearBit(uint32_t bits); static void clearColor(const glm::vec4& color); static void drawIndexed(std::shared_ptr vertexArray, uint32_t indexCount = 0);