diff options
-rw-r--r-- | src/vk/graphics_pipeline_3d.cpp | 13 | ||||
-rw-r--r-- | src/vk/renderer.cpp | 17 |
2 files changed, 17 insertions, 13 deletions
diff --git a/src/vk/graphics_pipeline_3d.cpp b/src/vk/graphics_pipeline_3d.cpp index 6639d99..355509e 100644 --- a/src/vk/graphics_pipeline_3d.cpp +++ b/src/vk/graphics_pipeline_3d.cpp @@ -625,19 +625,6 @@ GraphicsPipeline3D::draw( view->ub_3d[image_index].copy_data(&ubo_view_3d); } - - // TODO: Do not update this for each view. All views use the same data. - { // Update world uniform buffer - ODOWorld3D_Vert ubo_world_3d_vert{}; - ubo_world_3d_vert.ambient_light_color = glm::vec4{0.25, 0.25, 0.25, 1.0}; - this->ub_world_vert[image_index].copy_data(&ubo_world_3d_vert); - - ODOWorld3D_Frag ubo_world_3d_frag{}; - ubo_world_3d_frag.directional_light_direction = - glm::vec3{-0.57735, 0.57735, -0.57735}; - ubo_world_3d_frag.directional_light_color = glm::vec4{0.8, 0.8, 0.8, 1.0}; - this->ub_world_frag[image_index].copy_data(&ubo_world_3d_frag); - } } } diff --git a/src/vk/renderer.cpp b/src/vk/renderer.cpp index b240cb9..b886175 100644 --- a/src/vk/renderer.cpp +++ b/src/vk/renderer.cpp @@ -19,6 +19,7 @@ #include <array> #include "../core.hpp" +#include "uniform_data_object.hpp" namespace { @@ -207,6 +208,22 @@ Renderer::draw() clear_values[0].color = {0.12f, 0.12f, 0.18f, 1.0f}; clear_values[1].depthStencil = {1.0f, 0}; + { // Update world uniform buffer + ODOWorld3D_Vert ubo_world_3d_vert{}; + ubo_world_3d_vert.ambient_light_color = + glm::vec4{0.25, 0.25, 0.25, 1.0}; + cg_core.vk_graphics_pipeline_3d->ub_world_vert[image_index].copy_data( + &ubo_world_3d_vert); + + ODOWorld3D_Frag ubo_world_3d_frag{}; + ubo_world_3d_frag.directional_light_direction = + glm::vec3{-0.57735, 0.57735, -0.57735}; + ubo_world_3d_frag.directional_light_color = + glm::vec4{0.8, 0.8, 0.8, 1.0}; + cg_core.vk_graphics_pipeline_3d->ub_world_frag[image_index].copy_data( + &ubo_world_3d_frag); + } + VkRenderPassBeginInfo render_pass_begin{}; render_pass_begin.sType = VK_STRUCTURE_TYPE_RENDER_PASS_BEGIN_INFO; render_pass_begin.pNext = nullptr; |