]> git.lizzy.rs Git - dragonblocks_alpha.git/blob - src/client/object.h
Rename wetness to humidity
[dragonblocks_alpha.git] / src / client / object.h
1 #ifndef _OBJECT_H_
2 #define _OBJECT_H_
3
4 #include <stddef.h>
5 #include <stdbool.h>
6 #include <GL/glew.h>
7 #include <GL/gl.h>
8 #include <linmath.h/linmath.h>
9 #include "client/mesh.h"
10 #include "client/texture.h"
11 #include "client/vertex.h"
12 #include "array.h"
13 #include "types.h"
14
15 typedef struct {
16         GLfloat x, y, z;
17 } __attribute__((packed)) Vertex3DPosition;
18
19 typedef struct {
20         GLfloat s, t;
21 } __attribute__((packed)) Vertex3DTextureCoordinates;
22
23 typedef struct {
24         GLfloat h, s, v;
25 } __attribute__((packed)) Vertex3DColor;
26
27 typedef struct
28 {
29         Vertex3DPosition position;
30         Vertex3DTextureCoordinates textureCoordinates;
31         Vertex3DColor color;
32 } __attribute__((packed)) Vertex3D;
33
34 typedef struct
35 {
36         GLuint texture;
37         Array vertices;
38 } ObjectFace;
39
40 typedef struct
41 {
42         v3f32 pos, rot, scale;
43         f32 angle;
44         bool remove;
45         Mesh **meshes;
46         size_t meshes_count;
47         mat4x4 transform;
48         bool visible;
49         bool wireframe;
50         ObjectFace *current_face;
51         Array faces;
52 } Object;
53
54 Object *object_create();
55 void object_delete(Object *obj);
56 void object_set_texture(Object *obj, Texture *texture);
57 void object_add_vertex(Object *obj, Vertex3D *vertex);
58 bool object_add_to_scene(Object *obj);
59 void object_transform(Object *obj);
60 void object_render(Object *obj, GLint loc_model);
61
62 #endif