From c531f5fb552a3f002a5ee52c7d128a96047c49ae Mon Sep 17 00:00:00 2001 From: Piotr Krygier Date: Thu, 19 Mar 2026 21:40:40 +0100 Subject: [PATCH] Fixed issue with avocado's seed Turn's out there rendering should be done clockwise, as it was originally. --- graphics/src/pipeline_builder.c | 2 +- graphics/src/rse_graphics.c | 30 +++++++++++++++--------------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/graphics/src/pipeline_builder.c b/graphics/src/pipeline_builder.c index 99911c52..247d14aa 100644 --- a/graphics/src/pipeline_builder.c +++ b/graphics/src/pipeline_builder.c @@ -124,7 +124,7 @@ static rse_err_t pipeline_add_rasterizer(struct pipeline_t* pipeline) pipeline->rasterizer.rasterizerDiscardEnable = VK_FALSE; /* Disable/Enable output to framebuffer*/ pipeline->rasterizer.polygonMode = VK_POLYGON_MODE_FILL; pipeline->rasterizer.cullMode = VK_CULL_MODE_BACK_BIT; - pipeline->rasterizer.frontFace = VK_FRONT_FACE_COUNTER_CLOCKWISE; + pipeline->rasterizer.frontFace = VK_FRONT_FACE_CLOCKWISE; pipeline->rasterizer.depthBiasEnable = VK_FALSE; pipeline->rasterizer.depthBiasConstantFactor = 0.0f; pipeline->rasterizer.depthBiasClamp = 0.0f; diff --git a/graphics/src/rse_graphics.c b/graphics/src/rse_graphics.c index ae38be1c..91a2f7be 100644 --- a/graphics/src/rse_graphics.c +++ b/graphics/src/rse_graphics.c @@ -33,13 +33,13 @@ static void model_view_projection_update(struct graphics_context_t* context) vec3 eye = {0}; vec3 center = {0}; vec3 up = {0}; - vec3 rotation_vec = {0.0f, 0.0f, 1.0f}; + vec3 rotation_vec = {0.0f, 1.0f, 0.0f}; float fovy; float z_near; float z_far; static float rotation = 0.0; - eye[2] = -5.0f; + eye[2] = -4.0f; up[1] = 1.0f; @@ -58,7 +58,7 @@ static void model_view_projection_update(struct graphics_context_t* context) z_far, context->mvp_data.proj); - rotation += time_get_dt() * glm_rad(90.0); + rotation += time_get_dt() * glm_rad(120.0); } static rse_err_t render_static_mesh(struct graphics_context_t* context, uint32_t renderer_id) @@ -142,27 +142,27 @@ rse_err_t rse_graphics_test_function(struct graphics_context_t* context) // FIXME: Temporary array of vertices, for testing purposes struct vertex_t vertices[] = { - {{-0.5f, 0.5f, 0.0f}, {1.0f, 1.0f, 1.0f}, {0.0f, 1.0f}}, {{-0.5f, -0.5f, 0.0f}, {1.0f, 0.0f, 0.0f}, {0.0f, 0.0f}}, - {{0.5f, -0.5f, 0.0f}, {0.0f, 1.0f, 0.0f}, {1.0f, 0.0f}}, + {{-0.5f, 0.5f, 0.0f}, {1.0f, 1.0f, 1.0f}, {0.0f, 1.0f}}, {{0.5f, 0.5f, 0.0f}, {0.0f, 0.0f, 1.0f}, {1.0f, 1.0f}}, + {{0.5f, -0.5f, 0.0f}, {0.0f, 1.0f, 0.0f}, {1.0f, 0.0f}}, }; struct vertex_t vertices_2[] = { - {{-0.5f, 0.5f, 0.0f}, {1.0f, 1.0f, 1.0f}, {0.0f, 1.0f}}, - {{-0.5f, -0.5f, 0.0f}, {1.0f, 0.0f, 0.0f}, {0.0f, 0.0f}}, - {{0.2f, -0.5f, 0.0f}, {0.0f, 1.0f, 0.0f}, {1.0f, 0.0f}}, - {{0.2f, 0.5f, 0.0f}, {0.0f, 0.0f, 1.0f}, {1.0f, 1.0f}}, + {{-0.7f, -0.7f, 0.0f}, {1.0f, 0.0f, 0.0f}, {0.0f, 0.0f}}, + {{-0.7f, 0.7f, 0.0f}, {1.0f, 1.0f, 1.0f}, {0.0f, 1.0f}}, + {{0.1f, 0.7f, 0.0f}, {0.0f, 0.0f, 1.0f}, {1.0f, 1.0f}}, + {{0.1f, -0.7f, 0.0f}, {0.0f, 1.0f, 0.0f}, {1.0f, 0.0f}}, }; // FIXME: Temporary array of vertices, for testing purposes - uint16_t indices[] = {0, 1, 2, 2, 3, 0}; + uint16_t indices[] = {0, 1, 2, 2, 3, 0, 0, 3, 2, 2, 1, 0}; - STATUS_CHECK(mesh_create(context, vertices, indices, 4, 6, &mesh_id_1)); + STATUS_CHECK(mesh_create(context, vertices, indices, 4, 12, &mesh_id_1)); if (RSE_ERROR_NO_ERROR != mesh_create_instance(context, mesh_id_1, - (struct instance_data_t){{0.0f, 1.0f, 0.0f}, {0.0f, 0.0f, 0.0}, 1.0f, textures[0]})) { + (struct instance_data_t){{0.0f, 1.0f, 0.0f}, {0.0f, 0.0f, 0.0}, 0.5f, textures[0]})) { exit(1); } @@ -170,7 +170,7 @@ rse_err_t rse_graphics_test_function(struct graphics_context_t* context) mesh_create_instance( context, mesh_id_1, - (struct instance_data_t){{-0.5f, 0.0f, -1.0f}, {0.0f, 0.0f, glm_rad(10.0f)}, 1.0f, textures[1]})) { + (struct instance_data_t){{-0.5f, 0.0f, -1.0f}, {0.0f, 0.0f, glm_rad(10.0f)}, 0.5f, textures[1]})) { exit(1); } @@ -179,7 +179,7 @@ rse_err_t rse_graphics_test_function(struct graphics_context_t* context) mesh_create_instance( context, mesh_id_2, - (struct instance_data_t){{0.5f, 0.0f, -1.0f}, {0.0f, 0.0f, glm_rad(0.0f)}, 1.0f, textures[1]})) { + (struct instance_data_t){{0.5f, 0.0f, 1.0f}, {0.0f, 0.0f, glm_rad(0.0f)}, 0.5f, textures[1]})) { exit(1); } @@ -188,7 +188,7 @@ rse_err_t rse_graphics_test_function(struct graphics_context_t* context) mesh_create_instance( context, avocado_id, - (struct instance_data_t){{0.0f, 0.0f, -4.0f}, {0.0f, glm_rad(130.0f), 0.0f}, 2.0f, textures[2]})) { + (struct instance_data_t){{0.0f, 0.2f, 0.0f}, {0.0f, 0.0f, glm_rad(180.0f)}, 10.0f, textures[2]})) { exit(1); }