summaryrefslogtreecommitdiff
path: root/src/vk
diff options
context:
space:
mode:
Diffstat (limited to 'src/vk')
-rw-r--r--src/vk/graphics_pipeline_3d.cpp2
-rw-r--r--src/vk/view_3d.cpp8
-rw-r--r--src/vk/view_3d.hpp1
3 files changed, 3 insertions, 8 deletions
diff --git a/src/vk/graphics_pipeline_3d.cpp b/src/vk/graphics_pipeline_3d.cpp
index d98a27d..6bfd559 100644
--- a/src/vk/graphics_pipeline_3d.cpp
+++ b/src/vk/graphics_pipeline_3d.cpp
@@ -341,7 +341,7 @@ GraphicsPipeline3D::draw(
// Projection matrix.
ubo_view_3d.proj = glm::perspective(
- glm::radians(45.0f),
+ glm::radians(view->field_of_view),
view->region.z / view->region.w,
0.1f, 100.0f);
diff --git a/src/vk/view_3d.cpp b/src/vk/view_3d.cpp
index 9040545..f9cfe5a 100644
--- a/src/vk/view_3d.cpp
+++ b/src/vk/view_3d.cpp
@@ -98,13 +98,6 @@ load_resources_to_descriptor_sets_3d(void *obj)
vkUpdateDescriptorSets(
cg_core.vk_device_with_swapchain->device, write_descriptors.size(),
write_descriptors.data(), 0, nullptr);
-
- VK::UDOView3D ubo_view_3d;
- ubo_view_3d.proj = glm::ortho(
- 0.0f, self->region.z,
- 0.0f, self->region.w,
- 0.0f, 100.0f);
- self->ub_3d[i].copy_data(&ubo_view_3d);
}
}
@@ -125,6 +118,7 @@ namespace VK
View3D::View3D(
glm::vec4 region, float projection_width, float projection_height):
View2D{region, projection_width, projection_height},
+ field_of_view{45.0f},
camera_position{std::make_shared<glm::vec3>(0.0f, 0.0f, 0.0f)},
camera_rotation{std::make_shared<glm::vec3>(0.0f, 0.0f, 0.0f)}
{
diff --git a/src/vk/view_3d.hpp b/src/vk/view_3d.hpp
index 1d51070..52146df 100644
--- a/src/vk/view_3d.hpp
+++ b/src/vk/view_3d.hpp
@@ -24,6 +24,7 @@ namespace VK
struct View3D: public View2D
{
+ float field_of_view;
// FIXME: if this vector get resized, it can cause a segmentation fault!
std::vector<UniformBuffer> ub_3d;