Render: Change RenderCommand::clearBit function
This commit is contained in:
@@ -178,7 +178,7 @@ int Application::run()
|
|||||||
render();
|
render();
|
||||||
|
|
||||||
RenderCommand::clearColor({ 0.2f, 0.3f, 0.3f, 1.0f });
|
RenderCommand::clearColor({ 0.2f, 0.3f, 0.3f, 1.0f });
|
||||||
RenderCommand::clearColorDepthBit();
|
RenderCommand::clearBit(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||||
|
|
||||||
std::pair<glm::mat4, glm::mat4> projectionView = m_scene->cameraProjectionView();
|
std::pair<glm::mat4, glm::mat4> projectionView = m_scene->cameraProjectionView();
|
||||||
RendererCubemap::the().beginScene(projectionView.first, projectionView.second); // camera, lights, environment
|
RendererCubemap::the().beginScene(projectionView.first, projectionView.second); // camera, lights, environment
|
||||||
@@ -200,7 +200,7 @@ int Application::run()
|
|||||||
// Framebuffer
|
// Framebuffer
|
||||||
|
|
||||||
RenderCommand::clearColor({ 1.0f, 1.0f, 1.0f, 1.0f });
|
RenderCommand::clearColor({ 1.0f, 1.0f, 1.0f, 1.0f });
|
||||||
RenderCommand::clearColorBit();
|
RenderCommand::clearBit(GL_COLOR_BUFFER_BIT);
|
||||||
|
|
||||||
Renderer2D::the().setEnableDepthBuffer(false);
|
Renderer2D::the().setEnableDepthBuffer(false);
|
||||||
Renderer2D::the().beginScene(matIdentity, matIdentity);
|
Renderer2D::the().beginScene(matIdentity, matIdentity);
|
||||||
@@ -242,7 +242,7 @@ bool Application::onWindowResize(WindowResizeEvent& e)
|
|||||||
ruc::info("WindowResizeEvent {}x{}", e.getWidth(), e.getHeight());
|
ruc::info("WindowResizeEvent {}x{}", e.getWidth(), e.getHeight());
|
||||||
|
|
||||||
RenderCommand::setViewport(0, 0, 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;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ void Framebuffer::unbind() const
|
|||||||
glBindFramebuffer(GL_FRAMEBUFFER, 0);
|
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) {
|
if (m_width == width && m_height == height) {
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ public:
|
|||||||
void bind() const;
|
void bind() const;
|
||||||
void unbind() 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; }
|
Type type() const { return m_type; }
|
||||||
uint32_t width() const { return m_width; }
|
uint32_t width() const { return m_width; }
|
||||||
|
|||||||
@@ -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);
|
// GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT
|
||||||
}
|
glClear(bits);
|
||||||
|
|
||||||
void RenderCommand::clearColorBit()
|
|
||||||
{
|
|
||||||
glClear(GL_COLOR_BUFFER_BIT);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void RenderCommand::clearColor(const glm::vec4& color)
|
void RenderCommand::clearColor(const glm::vec4& color)
|
||||||
|
|||||||
@@ -19,8 +19,7 @@ public:
|
|||||||
static void initialize();
|
static void initialize();
|
||||||
static void destroy();
|
static void destroy();
|
||||||
|
|
||||||
static void clearColorDepthBit();
|
static void clearBit(uint32_t bits);
|
||||||
static void clearColorBit();
|
|
||||||
static void clearColor(const glm::vec4& color);
|
static void clearColor(const glm::vec4& color);
|
||||||
static void drawIndexed(std::shared_ptr<VertexArray> vertexArray, uint32_t indexCount = 0);
|
static void drawIndexed(std::shared_ptr<VertexArray> vertexArray, uint32_t indexCount = 0);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user