summaryrefslogtreecommitdiff
path: root/src/object.h
blob: b4cc06d128ff8124566f7633f5baedb667361f21 (plain)
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
#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);