1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
package funhalla
import gl "vendor:OpenGL"
Vertex :: struct {
position: Vec3,
normal: Vec3,
tex_coords: Vec2
}
Texture :: struct {
id: u32,
type: string
}
Mesh :: struct {
vertices: [dynamic]Vertex,
indices: [dynamic]u32,
textures: [dynamic]Texture,
vao, vbo, ebo: u32
}
mesh_init :: proc(vertices: [dynamic]Vertex, indices: [dynamic]u32, textures: [dynamic]Texture) -> ^Mesh {
mesh := new(Mesh)
mesh.vertices = vertices
mesh.indices = indices
mesh.textures = textures
_setup_mesh(mesh)
return mesh
}
mesh_draw :: proc() {
}
@(private)
_setup_mesh :: proc(using mesh: ^Mesh) {
using gl
GenVertexArrays(1, &vao)
GenBuffers(1, &vbo)
GenBuffers(1, &ebo)
BindVertexArray(vao)
BindBuffer(ARRAY_BUFFER, vbo)
}
|