summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOmniscient <17525998+omnisci3nce@users.noreply.github.com>2024-03-30 17:49:36 +1100
committerOmniscient <17525998+omnisci3nce@users.noreply.github.com>2024-03-30 17:49:36 +1100
commit16237e6499f47d963df35c0f0c4649900ec98d84 (patch)
tree1a3a9e56a8cf2dfc839c6a1772766f15635ee5ae
parentf07e87a86e386ba0f65c5a1e962b6a90cfe26ced (diff)
square boi recedes into the distance.
-rw-r--r--src/renderer/backends/backend_vulkan.c28
1 files changed, 17 insertions, 11 deletions
diff --git a/src/renderer/backends/backend_vulkan.c b/src/renderer/backends/backend_vulkan.c
index 759da2f..7be5918 100644
--- a/src/renderer/backends/backend_vulkan.c
+++ b/src/renderer/backends/backend_vulkan.c
@@ -1040,7 +1040,7 @@ void vulkan_swapchain_create(vulkan_context* context, u32 width, u32 height,
swapchain_create_info.minImageCount = image_count;
swapchain_create_info.imageFormat = out_swapchain->image_format.format;
swapchain_create_info.imageColorSpace = out_swapchain->image_format.colorSpace;
- DEBUG("Image extend %d %d\n", swapchain_extent.width, swapchain_extent.height);
+ DEBUG("Image extent %d %d\n", swapchain_extent.width, swapchain_extent.height);
swapchain_create_info.imageExtent = swapchain_extent;
swapchain_create_info.imageArrayLayers = 1;
swapchain_create_info.imageUsage = VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT;
@@ -1553,17 +1553,19 @@ bool gfx_backend_init(renderer* ren) {
const u32 vert_count = 4;
vertex_pos verts[4] = { 0 };
- verts[0].pos.x = 0.0;
- verts[0].pos.y = -0.5;
+ const f32 s = 10.0;
- verts[1].pos.x = 0.5;
- verts[1].pos.y = 0.5;
+ verts[0].pos.x = 0.0 * s;
+ verts[0].pos.y = -0.5 * s;
- verts[2].pos.x = 0.0;
- verts[2].pos.y = 0.5;
+ verts[1].pos.x = 0.5 * s;
+ verts[1].pos.y = 0.5 * s;
- verts[3].pos.x = 0.5;
- verts[3].pos.y = -0.5;
+ verts[2].pos.x = 0.0 * s;
+ verts[2].pos.y = 0.5 * s;
+
+ verts[3].pos.x = 0.5 * s;
+ verts[3].pos.y = -0.5 * s;
const u32 index_count = 6;
u32 indices[6] = { 0, 1, 2, 0, 3, 1 };
@@ -1689,8 +1691,12 @@ void backend_end_frame(renderer* ren, f32 delta_time) {
void gfx_backend_draw_frame(renderer* ren) {
backend_begin_frame(ren, 16.0);
- gfx_backend_update_global_state(mat4_ident(), mat4_ident(), VEC3_ZERO, vec4(1.0, 1.0, 1.0, 1.0),
- 0);
+ static f32 z = -1.0;
+ z -= 0.2;
+ mat4 proj = mat4_perspective(deg_to_rad(45.0), 1000 / 1000.0, 0.1, 1000.0);
+ mat4 view = mat4_translation(vec3(0, 0, z));
+
+ gfx_backend_update_global_state(proj, view, VEC3_ZERO, vec4(1.0, 1.0, 1.0, 1.0), 0);
backend_end_frame(ren, 16.0);
}