diff --git a/source/OpenGL/DebugRenderer.cpp b/source/OpenGL/DebugRenderer.cpp index 808525e..9142fd0 100644 --- a/source/OpenGL/DebugRenderer.cpp +++ b/source/OpenGL/DebugRenderer.cpp @@ -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()) { @@ -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); } }); @@ -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); } } diff --git a/source/OpenGL/DebugRenderer.hpp b/source/OpenGL/DebugRenderer.hpp index 4f4dc0d..5a5bbc4 100644 --- a/source/OpenGL/DebugRenderer.hpp +++ b/source/OpenGL/DebugRenderer.hpp @@ -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); diff --git a/source/OpenGL/OpenGLRenderer.cpp b/source/OpenGL/OpenGLRenderer.cpp index f6e60d9..c355f44 100644 --- a/source/OpenGL/OpenGLRenderer.cpp +++ b/source/OpenGL/OpenGLRenderer.cpp @@ -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.