diff options
| author | DrNuget <drnuget@outlook.com> | 2026-01-04 22:12:24 +0200 |
|---|---|---|
| committer | DrNuget <drnuget@outlook.com> | 2026-01-04 22:12:24 +0200 |
| commit | 510f1bac9b71ba240d30bb5bc5df6501e70fafc9 (patch) | |
| tree | 7bc48763071a8c315b82e638a267411c3453dd09 /src/object.h | |
| download | opengl-test-510f1bac9b71ba240d30bb5bc5df6501e70fafc9.tar.gz | |
Working 3D with .obj file loading
Diffstat (limited to 'src/object.h')
| -rw-r--r-- | src/object.h | 47 |
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); |
