Kevin Jerebica
a176afab7e
source code was taken from my project gravity and modified so I can reuse the renderer in other projects. I will also upgrade it, free it from old bugs, put more effort into learning the math behind rendering, etc.
46 lines
911 B
C
46 lines
911 B
C
#ifndef OBJECT_H
|
|
#define OBJECT_H
|
|
|
|
#include <cglm/cglm.h>
|
|
|
|
#define MAX_PATHS 2000
|
|
|
|
struct model {
|
|
float *vertices;
|
|
unsigned int *indices;
|
|
float *normals;
|
|
|
|
long vertices_num;
|
|
long indices_num;
|
|
long normals_num;
|
|
};
|
|
|
|
struct object {
|
|
vec4 translation_force;
|
|
vec4 position;
|
|
vec3 color;
|
|
float mass;
|
|
void *next;
|
|
|
|
float *paths;
|
|
int paths_num;
|
|
int paths_max;
|
|
|
|
struct model *model;
|
|
float scale;
|
|
|
|
unsigned int vao; // array object for the actual object
|
|
unsigned int vbo; // buffer for vertices
|
|
unsigned int ebo; // buffer for indices
|
|
unsigned int nbo; // buffer for normals
|
|
|
|
unsigned int pvao; // array object for paths
|
|
unsigned int pbo; // buffer for paths
|
|
};
|
|
|
|
struct model *load_model(const char *path);
|
|
int record_path(struct object *obj);
|
|
struct object *create_object(struct object **o, float mass, struct model *model);
|
|
|
|
#endif
|