Successfully rendered a quad!

This commit is contained in:
2025-11-25 04:14:07 +01:00
parent 3c3df9796a
commit 28ca7625b8
6 changed files with 334 additions and 9 deletions

40
mesh.odin Normal file
View File

@@ -0,0 +1,40 @@
package renderer
Mesh :: struct {
amount_of_indices: u32,
backend: Mesh_Backend,
}
Mesh_Handle :: distinct u32
Buffer_Handle :: distinct u32
Vertex :: distinct [3]f32
Index :: distinct u32
create_mesh :: proc(renderer: ^Renderer, vertices: []Vertex, indices: []Index) -> (Mesh, bool) { // TODO: SS - Should probably return a Mesh_Handle.
mesh: Mesh
if len(vertices) == 0 {
return {}, false
}
if len(indices) == 0 {
return {}, false
}
m: Mesh
m.amount_of_indices = u32(len(indices))
when RENDER_BACKEND_OPENGL {
opengl_mesh, ok := opengl_create_mesh(renderer, vertices, indices)
if !ok {
return {}, false
}
m.backend = opengl_mesh
}
else {
#assert(false)
}
return m, true
}