Update vertex data for cube
This commit is contained in:
parent
2ba1022f79
commit
fe42f2665c
1 changed files with 34 additions and 44 deletions
|
|
@ -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,54 +106,48 @@ 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({
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue