Fixed issue with avocado's seed

Turn's out there rendering should be done clockwise, as it was originally.
This commit is contained in:
Piotr Krygier
2026-03-19 21:40:40 +01:00
parent 99fb36d9fd
commit c531f5fb55
2 changed files with 16 additions and 16 deletions
+1 -1
View File
@@ -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.rasterizerDiscardEnable = VK_FALSE; /* Disable/Enable output to framebuffer*/
pipeline->rasterizer.polygonMode = VK_POLYGON_MODE_FILL; pipeline->rasterizer.polygonMode = VK_POLYGON_MODE_FILL;
pipeline->rasterizer.cullMode = VK_CULL_MODE_BACK_BIT; 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.depthBiasEnable = VK_FALSE;
pipeline->rasterizer.depthBiasConstantFactor = 0.0f; pipeline->rasterizer.depthBiasConstantFactor = 0.0f;
pipeline->rasterizer.depthBiasClamp = 0.0f; pipeline->rasterizer.depthBiasClamp = 0.0f;
+15 -15
View File
@@ -33,13 +33,13 @@ static void model_view_projection_update(struct graphics_context_t* context)
vec3 eye = {0}; vec3 eye = {0};
vec3 center = {0}; vec3 center = {0};
vec3 up = {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 fovy;
float z_near; float z_near;
float z_far; float z_far;
static float rotation = 0.0; static float rotation = 0.0;
eye[2] = -5.0f; eye[2] = -4.0f;
up[1] = 1.0f; up[1] = 1.0f;
@@ -58,7 +58,7 @@ static void model_view_projection_update(struct graphics_context_t* context)
z_far, z_far,
context->mvp_data.proj); 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) 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 // FIXME: Temporary array of vertices, for testing purposes
struct vertex_t vertices[] = { 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}, {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, 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[] = { struct vertex_t vertices_2[] = {
{{-0.5f, 0.5f, 0.0f}, {1.0f, 1.0f, 1.0f}, {0.0f, 1.0f}}, {{-0.7f, -0.7f, 0.0f}, {1.0f, 0.0f, 0.0f}, {0.0f, 0.0f}},
{{-0.5f, -0.5f, 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.2f, -0.5f, 0.0f}, {0.0f, 1.0f, 0.0f}, {1.0f, 0.0f}}, {{0.1f, 0.7f, 0.0f}, {0.0f, 0.0f, 1.0f}, {1.0f, 1.0f}},
{{0.2f, 0.5f, 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 // 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 != if (RSE_ERROR_NO_ERROR !=
mesh_create_instance(context, mesh_create_instance(context,
mesh_id_1, 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); exit(1);
} }
@@ -170,7 +170,7 @@ rse_err_t rse_graphics_test_function(struct graphics_context_t* context)
mesh_create_instance( mesh_create_instance(
context, context,
mesh_id_1, 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); exit(1);
} }
@@ -179,7 +179,7 @@ rse_err_t rse_graphics_test_function(struct graphics_context_t* context)
mesh_create_instance( mesh_create_instance(
context, context,
mesh_id_2, 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); exit(1);
} }
@@ -188,7 +188,7 @@ rse_err_t rse_graphics_test_function(struct graphics_context_t* context)
mesh_create_instance( mesh_create_instance(
context, context,
avocado_id, 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); exit(1);
} }