summaryrefslogtreecommitdiff
path: root/src/object.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/object.h')
-rw-r--r--src/object.h47
1 files changed, 47 insertions, 0 deletions
diff --git a/src/object.h b/src/object.h
new file mode 100644
index 0000000..b4cc06d
--- /dev/null
+++ b/src/object.h
@@ -0,0 +1,47 @@
+#pragma once
+#include "main.h"
+#include "includes.h"
+
+typedef struct {
+ float angle;
+ vec3 direction;
+} Rotation;
+
+typedef struct {
+ int num_indices;
+
+ unsigned int VAO, VBO, EBO;
+} ViewModel;
+
+typedef struct {
+ ViewModel *model;
+
+ vec3 pos, size;
+
+ Rotation rotation;
+
+ mat4 transform;
+} Object;
+
+void createViewModel(ViewModel *model, int num_vertices, float *vert, int num_indices, unsigned int *indices);
+
+void killViewModel(ViewModel *model);
+
+void bindViewModel(ViewModel *model);
+
+ViewModel loadViewModel(const char* filename);
+
+void createObject(Object *obj, ViewModel *model);
+
+
+void moveObject(Object *obj, vec3 pos);
+
+void scaleObject(Object *obj, vec3 scale);
+
+void rotateObject(Object *obj, float angle, vec3 direction);
+
+
+void updateObjectTransform(Object *obj);
+
+
+void drawObject(Game *game, Object *obj);