]> git.lizzy.rs Git - dragonblocks_alpha.git/blob - src/mesh.h
Fix glBufferData size
[dragonblocks_alpha.git] / src / mesh.h
1 #ifndef _MESH_H_
2 #define _MESH_H_
3
4 #include <GL/glew.h>
5 #include <GL/gl.h>
6 #include <linmath.h/linmath.h>
7 #include <stdbool.h>
8 #include "shaders.h"
9 #include "types.h"
10
11 typedef struct
12 {
13         GLfloat x, y, z;
14         GLfloat r, g, b;
15 } __attribute__((packed, aligned(4))) Vertex;
16
17 typedef struct
18 {
19         v3f pos, rot, scale;
20         float angle;
21         mat4x4 transform;
22         GLuint VAO, VBO;
23         bool remove;
24         Vertex *vertices;
25         GLsizei count;
26 } Mesh;
27
28 Mesh *mesh_create(Vertex *vertices, GLsizei count);
29 void mesh_delete(Mesh *mesh);
30 void mesh_transform(Mesh *mesh);
31 void mesh_render(Mesh *mesh, ShaderProgram *prog);
32
33 #endif