Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/mstachowicz/spirit
Browse files Browse the repository at this point in the history
  • Loading branch information
MStachowicz committed Oct 24, 2024
2 parents f13c134 + 411d76d commit 47a4b20
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
7 changes: 6 additions & 1 deletion source/OpenGL/DebugRenderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ namespace OpenGL
m_line_mb.clear();
m_tri_mb.clear();
}
void DebugRenderer::render(System::SceneSystem& p_scene, const Buffer& p_view_properties, const FBO& p_target_FBO)
void DebugRenderer::render(System::SceneSystem& p_scene, const Buffer& p_view_properties, const Buffer& p_point_lights_buffer, const FBO& p_target_FBO)
{
if (!m_line_mb.empty())
{
Expand Down Expand Up @@ -99,17 +99,20 @@ namespace OpenGL
dc.m_polygon_offset_units = opt.m_position_offset_units;
dc.set_uniform("model", model);
dc.set_uniform("colour", p_collider.m_collided ? glm::vec4(opt.m_bounding_box_collided_colour, 1.f) : glm::vec4(opt.m_bounding_box_colour, 1.f));
dc.set_UBO("ViewProperties", p_view_properties);
dc.submit(*m_bound_shader, m_AABB_outline_mesh->get_VAO(), p_target_FBO);
}
if (opt.m_fill_bounding_box)
{
DrawCall dc;
dc.m_blending_enabled = true;
dc.m_cull_face_enabled = false;
dc.m_polygon_offset_enabled = true;
dc.m_polygon_offset_factor = opt.m_position_offset_factor;
dc.m_polygon_offset_units = opt.m_position_offset_units;
dc.set_uniform("model", model);
dc.set_uniform("colour", p_collider.m_collided ? glm::vec4(opt.m_bounding_box_collided_colour, 0.2f) : glm::vec4(opt.m_bounding_box_colour, 0.2f));
dc.set_UBO("ViewProperties", p_view_properties);
dc.submit(*m_bound_shader, m_AABB_filled_mesh->get_VAO(), p_target_FBO);
}
});
Expand All @@ -122,6 +125,8 @@ namespace OpenGL
{
DrawCall dc;
dc.set_uniform("scale", opt.m_light_position_scale);
dc.set_UBO("ViewProperties", p_view_properties);
dc.set_SSBO("PointLightsBuffer", p_point_lights_buffer);
dc.submit_instanced(*m_light_position_shader, m_point_light_mesh->get_VAO(), p_target_FBO, point_light_count);
}
}
Expand Down
2 changes: 1 addition & 1 deletion source/OpenGL/DebugRenderer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ namespace OpenGL
static void init();
static void deinit();
static void clear();
static void render(System::SceneSystem& p_scene, const Buffer& p_view_properties, const FBO& p_target_FBO);
static void render(System::SceneSystem& p_scene, const Buffer& p_view_properties, const Buffer& p_point_lights_buffer, const FBO& p_target_FBO);

static void add(const Geometry::Cone& p_cone, const glm::vec4& p_colour = glm::vec4(1.f), size_t segments = m_debug_options.m_segments);
static void add(const Geometry::Cylinder& p_cylinder, const glm::vec4& p_colour = glm::vec4(1.f), size_t segments = m_debug_options.m_segments);
Expand Down
2 changes: 1 addition & 1 deletion source/OpenGL/OpenGLRenderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ namespace OpenGL

void OpenGLRenderer::end_frame()
{
OpenGL::DebugRenderer::render(m_scene_system, m_view_properties_buffer, m_screen_framebuffer);
OpenGL::DebugRenderer::render(m_scene_system, m_view_properties_buffer, m_phong_renderer.get_point_lights_buffer(), m_screen_framebuffer);

// Draw the colour output from m_screen_framebuffer colour texture to the default FBO as a fullscreen quad.

Expand Down

0 comments on commit 47a4b20

Please sign in to comment.