Skip to content
Snippets Groups Projects
Commit 30ca5343 authored by BATON Theau's avatar BATON Theau
Browse files

Remove useless clear and if for optimisation

parent b3f711b1
No related branches found
No related tags found
No related merge requests found
...@@ -27,7 +27,6 @@ namespace megu { ...@@ -27,7 +27,6 @@ namespace megu {
// Merge Textures // Merge Textures
FrameBuffer::BindDefaultFrameBuffer(); FrameBuffer::BindDefaultFrameBuffer();
this->_renderer.clear();
this->_renderer.render(this->_window, this->_group, textures); this->_renderer.render(this->_window, this->_group, textures);
this->_window.swapBuffers(); this->_window.swapBuffers();
} }
......
...@@ -12,15 +12,11 @@ namespace megu { ...@@ -12,15 +12,11 @@ namespace megu {
} }
const Texture & Layer::draw(const Window & window, const TextureArray & textures) const { const Texture & Layer::draw(const Window & window, const TextureArray & textures) const {
if(this->_frameBuffer.usable()) {
this->_renderer.setClearColor(0.f, 0.f, 0.f, 0.f);
this->_renderer.clear();
this->_frameBuffer.bind(); this->_frameBuffer.bind();
for(auto &[priority, group] : this->_objects) { for(auto &[priority, group] : this->_objects) {
this->_renderer.render(window, *group, textures); this->_renderer.render(window, *group, textures);
} }
}
return this->_frameBuffer.texture(); return this->_frameBuffer.texture();
} }
......
...@@ -21,7 +21,6 @@ namespace megu { ...@@ -21,7 +21,6 @@ namespace megu {
} }
void FrameBufferGroup::draw(const Window & window, const Camera & camera, const TextureArray & textures) const { void FrameBufferGroup::draw(const Window & window, const Camera & camera, const TextureArray & textures) const {
if(window.isOpen()) {
this->_program.use(); this->_program.use();
this->_vao.bind(); this->_vao.bind();
...@@ -34,4 +33,3 @@ namespace megu { ...@@ -34,4 +33,3 @@ namespace megu {
glDrawArrays(Plane::Primitive(), 0, static_cast<GLsizei>(Plane::Vertices().size())); glDrawArrays(Plane::Primitive(), 0, static_cast<GLsizei>(Plane::Vertices().size()));
} }
} }
\ No newline at end of file
}
\ No newline at end of file
...@@ -70,8 +70,6 @@ namespace megu { ...@@ -70,8 +70,6 @@ namespace megu {
} }
} }
//std::cout << "---------------" << std::endl;
if(!textures.empty()) { if(!textures.empty()) {
this->_program.setUniform("uProj", camera.projection()); this->_program.setUniform("uProj", camera.projection());
this->_program.setUniform("uView", camera.view()); this->_program.setUniform("uView", camera.view());
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment