diff --git a/src/main.cpp b/src/main.cpp index f3fe9a1..c22a670 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -113,9 +113,9 @@ struct Vertex { static Vertex vertices[] = { {{ -0.5f, 0.5f }}, - {{ 0.5f, 0.5f }}, - {{ 0.5f, -0.5f }}, {{ -0.5f, -0.5f }}, + {{ 0.5f, -0.5f }}, + {{ 0.5f, 0.5f }}, }; static Uint16 indices[] = { @@ -127,27 +127,27 @@ static Uint16 indices[] = { static Vertex grid_vertices[] = { // LEFT {{ -0.5f, 0.5f }}, - {{ -0.5f + grid_line_size, 0.5f }}, - {{ -0.5f + grid_line_size, -0.5f + grid_line_size }}, {{ -0.5f, -0.5f + grid_line_size }}, + {{ -0.5f + grid_line_size, -0.5f + grid_line_size }}, + {{ -0.5f + grid_line_size, 0.5f }}, // TOP {{ -0.5f + grid_line_size, 0.5f }}, - {{ 0.5f, 0.5f }}, - {{ 0.5f, 0.5f - grid_line_size }}, {{ -0.5f + grid_line_size, 0.5f - grid_line_size }}, + {{ 0.5f, 0.5f - grid_line_size }}, + {{ 0.5f, 0.5f }}, // RIGHT {{ 0.5f - grid_line_size, 0.5f - grid_line_size }}, - {{ 0.5f, 0.5f - grid_line_size }}, - {{ 0.5f, -0.5f }}, {{ 0.5f - grid_line_size, -0.5f }}, + {{ 0.5f, -0.5f }}, + {{ 0.5f, 0.5f - grid_line_size }}, // BOTTOM {{ -0.5f, -0.5f + grid_line_size }}, - {{ 0.5f - grid_line_size, -0.5f + grid_line_size }}, - {{ 0.5f - grid_line_size, -0.5f }}, {{ -0.5f, -0.5f }}, + {{ 0.5f - grid_line_size, -0.5f }}, + {{ 0.5f - grid_line_size, -0.5f + grid_line_size }}, }; static Uint16 grid_indices[] = { @@ -805,7 +805,7 @@ static bool recreate_graphics_pipelines() { .primitive = { .topology = WGPUPrimitiveTopology_TriangleList, .stripIndexFormat = WGPUIndexFormat_Undefined, - .frontFace = WGPUFrontFace_CW, + .frontFace = WGPUFrontFace_CCW, .cullMode = WGPUCullMode_Back, .unclippedDepth = false, }, @@ -958,7 +958,7 @@ static bool recreate_graphics_pipelines() { .primitive = { .topology = WGPUPrimitiveTopology_TriangleList, .stripIndexFormat = WGPUIndexFormat_Undefined, - .frontFace = WGPUFrontFace_CW, + .frontFace = WGPUFrontFace_CCW, .cullMode = WGPUCullMode_Back, .unclippedDepth = false, }, @@ -1051,7 +1051,7 @@ static bool recreate_graphics_pipelines() { .primitive = { .topology = WGPUPrimitiveTopology_TriangleList, .stripIndexFormat = WGPUIndexFormat_Undefined, - .frontFace = WGPUFrontFace_CW, + .frontFace = WGPUFrontFace_CCW, .cullMode = WGPUCullMode_Back, .unclippedDepth = false, }, diff --git a/src/shaders/basic.wgsl b/src/shaders/basic.wgsl index f0ced20..1b8a56e 100644 --- a/src/shaders/basic.wgsl +++ b/src/shaders/basic.wgsl @@ -29,9 +29,9 @@ struct FragmentShaderOutput { switch (input.vertex_index) { case 0: { output.uv = input.uv0uv1.xy; } - case 1: { output.uv = input.uv0uv1.zw; } + case 1: { output.uv = input.uv2uv3.zw; } case 2: { output.uv = input.uv2uv3.xy; } - case 3: { output.uv = input.uv2uv3.zw; } + case 3: { output.uv = input.uv0uv1.zw; } default: {} } diff --git a/src/shaders/world.wgsl b/src/shaders/world.wgsl index d743ee4..a5e56fe 100644 --- a/src/shaders/world.wgsl +++ b/src/shaders/world.wgsl @@ -51,9 +51,9 @@ struct Per_Frame_Data { case 0: { switch (input.vertex_index) { case 0: { output.uv = uv_min_max.xy; } - case 1: { output.uv = uv_min_max.zy; } + case 1: { output.uv = uv_min_max.xw; } case 2: { output.uv = uv_min_max.zw; } - case 3: { output.uv = uv_min_max.xw; } + case 3: { output.uv = uv_min_max.zy; } default: {} } } @@ -61,9 +61,9 @@ struct Per_Frame_Data { case 1: { switch (input.vertex_index) { case 0: { output.uv = uv_min_max.zy; } - case 1: { output.uv = uv_min_max.zw; } + case 1: { output.uv = uv_min_max.xy; } case 2: { output.uv = uv_min_max.xw; } - case 3: { output.uv = uv_min_max.xy; } + case 3: { output.uv = uv_min_max.zw; } default: {} } } @@ -71,9 +71,9 @@ struct Per_Frame_Data { case 2: { switch (input.vertex_index) { case 0: { output.uv = uv_min_max.zw; } - case 1: { output.uv = uv_min_max.xw; } + case 1: { output.uv = uv_min_max.zy; } case 2: { output.uv = uv_min_max.xy; } - case 3: { output.uv = uv_min_max.zy; } + case 3: { output.uv = uv_min_max.xw; } default: {} } } @@ -81,9 +81,9 @@ struct Per_Frame_Data { case 3: { switch (input.vertex_index) { case 0: { output.uv = uv_min_max.xw; } - case 1: { output.uv = uv_min_max.xy; } + case 1: { output.uv = uv_min_max.zw; } case 2: { output.uv = uv_min_max.zy; } - case 3: { output.uv = uv_min_max.zw; } + case 3: { output.uv = uv_min_max.xy; } default: {} } }