summaryrefslogtreecommitdiff
path: root/src/vk
diff options
context:
space:
mode:
Diffstat (limited to 'src/vk')
-rw-r--r--src/vk/view_2d.cpp9
-rw-r--r--src/vk/view_2d.hpp3
-rw-r--r--src/vk/view_3d.cpp5
-rw-r--r--src/vk/view_3d.hpp2
4 files changed, 12 insertions, 7 deletions
diff --git a/src/vk/view_2d.cpp b/src/vk/view_2d.cpp
index a80cc89..b6f208c 100644
--- a/src/vk/view_2d.cpp
+++ b/src/vk/view_2d.cpp
@@ -101,8 +101,8 @@ load_resources_to_descriptor_sets_2d(void *obj)
VK::UBOView2D ubo_view_2d;
ubo_view_2d.proj = glm::ortho(
- 0.0f, self->region.z,
- 0.0f, self->region.w,
+ 0.0f, self->projection_width,
+ 0.0f, self->projection_height,
0.0f, 100.0f);
self->ub_2d[i].copy_data(&ubo_view_2d);
}
@@ -122,7 +122,10 @@ const CommandChain View2D::descriptor_sets_loader{
{&load_resources_to_descriptor_sets_2d, nullptr}
};
-View2D::View2D(glm::vec4 region):
+View2D::View2D(
+ glm::vec4 region, float projection_width, float projection_height):
+ projection_width{projection_width},
+ projection_height{projection_height},
region{region},
descriptor_pool{VK_NULL_HANDLE},
rectangles_to_draw{cg_core.vk_swapchain->images_count},
diff --git a/src/vk/view_2d.hpp b/src/vk/view_2d.hpp
index f49c3be..caa3d0f 100644
--- a/src/vk/view_2d.hpp
+++ b/src/vk/view_2d.hpp
@@ -31,6 +31,7 @@ namespace VK
struct View2D
{
glm::vec4 region;
+ float projection_width, projection_height;
// FIXME: if these vectors get resized, they can cause a segmentation fault!
std::vector<UniformBuffer> ub_2d;
@@ -43,7 +44,7 @@ struct View2D
std::unordered_map<std::shared_ptr<Sprite>, std::vector<glm::vec4>>>
sprites_to_draw;
- View2D(glm::vec4 region);
+ View2D(glm::vec4 region, float projection_width, float projection_height);
virtual ~View2D();
void
diff --git a/src/vk/view_3d.cpp b/src/vk/view_3d.cpp
index 39d1159..d9e9844 100644
--- a/src/vk/view_3d.cpp
+++ b/src/vk/view_3d.cpp
@@ -122,8 +122,9 @@ const CommandChain descriptor_sets_loader{
namespace VK
{
-View3D::View3D(glm::vec4 region):
- View2D{region},
+View3D::View3D(
+ glm::vec4 region, float projection_width, float projection_height):
+ View2D{region, projection_width, projection_height},
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 ba08957..1d51070 100644
--- a/src/vk/view_3d.hpp
+++ b/src/vk/view_3d.hpp
@@ -32,7 +32,7 @@ struct View3D: public View2D
std::shared_ptr<glm::vec3> camera_position;
std::shared_ptr<glm::vec3> camera_rotation;
- View3D(glm::vec4 region);
+ View3D(glm::vec4 region, float projection_width, float projection_height);
~View3D();
void