diff --git a/ecs/render_system.odin b/ecs/render_system.odin index 3c2d1e5..0eb9fef 100644 --- a/ecs/render_system.odin +++ b/ecs/render_system.odin @@ -24,12 +24,8 @@ import program_config "../config" import shaders "../shaders/out" -CubeVertexData :: struct { - pos: Vec3, -} - -OutlineVertexData :: struct { - pos: Vec3, +VertexData :: struct { + x, y, z: f32, } Mesh :: struct { @@ -110,55 +106,49 @@ init_cube_material :: proc(render_system: ^RenderSystem) { @(private="file") init_cube_mesh :: proc (render_system: ^RenderSystem) { - cube_vertices := []CubeVertexData { - { pos = { -0.5, -0.5, 0.5 } }, - { pos = { 0.5, -0.5, 0.5 } }, - { pos = { 0.5, 0.5, 0.5 } }, - { pos = { -0.5, 0.5, 0.5 } }, + cube_vertices := []VertexData { + { -0.5, -0.5, 0.5 }, + { 0.5, -0.5, 0.5 }, + { 0.5, 0.5, 0.5 }, + { -0.5, 0.5, 0.5 }, - { pos = { -0.5, -0.5, -0.5 } }, - { pos = { 0.5, -0.5, -0.5 } }, - { pos = { 0.5, 0.5, -0.5 } }, - { pos = { -0.5, 0.5, -0.5 } }, + { -0.5, -0.5, -0.5 }, + { 0.5, -0.5, -0.5 }, + { 0.5, 0.5, -0.5 }, + { -0.5, 0.5, -0.5 }, - { pos = { -0.5, 0.5, 0.5 } }, - { pos = { 0.5, 0.5, 0.5 } }, - { pos = { 0.5, 0.5, -0.5 } }, - { pos = { -0.5, 0.5, -0.5 } }, + { -0.5, 0.5, 0.5 }, + { 0.5, 0.5, 0.5 }, + { 0.5, 0.5, -0.5 }, + { -0.5, 0.5, -0.5 }, - { pos = { -0.5, -0.5, 0.5 } }, - { pos = { 0.5, -0.5, 0.5 } }, - { pos = { 0.5, -0.5, -0.5 } }, - { pos = { -0.5, -0.5, -0.5 } }, + { -0.5, -0.5, 0.5 }, + { 0.5, -0.5, 0.5 }, + { 0.5, -0.5, -0.5 }, + { -0.5, -0.5, -0.5 }, - { pos = { 0.5, -0.5, 0.5 } }, - { pos = { 0.5, -0.5, -0.5 } }, - { pos = { 0.5, 0.5, -0.5 } }, - { pos = { 0.5, 0.5, 0.5 } }, + { 0.5, -0.5, 0.5 }, + { 0.5, -0.5, -0.5 }, + { 0.5, 0.5, -0.5 }, + { 0.5, 0.5, 0.5 }, - { pos = { -0.5, -0.5, 0.5 } }, - { pos = { -0.5, -0.5, -0.5 } }, - { pos = { -0.5, 0.5, -0.5 } }, - { pos = { -0.5, 0.5, 0.5 } }, + { -0.5, -0.5, 0.5 }, + { -0.5, -0.5, -0.5 }, + { -0.5, 0.5, -0.5 }, + { -0.5, 0.5, 0.5 }, } vertex_buffer := sg.make_buffer({ data = sg_range(cube_vertices) }) cube_indices := []u16 { - 1, 0, 2, - 3, 2, 0, - 7, 4, 6, - 5, 6, 4, - 9, 8, 10, - 11, 10, 8, - 15, 12, 14, - 13, 14, 12, - 17, 16, 18, - 19, 18, 16, - 23, 20, 22, - 21, 22, 20, - } + 0, 1, 2, 0, 2, 3, + 6, 5, 4, 7, 6, 4, + 8, 9, 10, 8, 10, 11, + 14, 13, 12, 15, 14, 12, + 16, 17, 18, 16, 18, 19, + 22, 21, 20, 23, 22, 20, + } index_buffer := sg.make_buffer({ usage = { index_buffer = true },