1
0
Fork 0
mirror of https://github.com/bjornbytes/lovr.git synced 2024-07-05 13:53:38 +00:00
lovr/src/graphics/model.h

64 lines
1.3 KiB
C
Raw Normal View History

2016-11-19 09:28:01 +00:00
#include "graphics/buffer.h"
#include "graphics/texture.h"
2017-01-18 08:51:09 +00:00
#include "math/mat4.h"
#include "math/vec3.h"
2016-11-19 09:28:01 +00:00
#include "glfw.h"
2016-11-19 07:41:23 +00:00
#include "util.h"
2016-11-26 07:15:04 +00:00
#include "vendor/vec/vec.h"
2016-07-09 05:27:34 +00:00
2016-08-10 06:28:17 +00:00
#ifndef LOVR_MODEL_TYPES
#define LOVR_MODEL_TYPES
2016-11-26 07:15:04 +00:00
typedef struct {
float x;
float y;
float z;
} ModelVertex;
typedef vec_t(ModelVertex) vec_model_vertex_t;
typedef struct {
unsigned int indices[3];
} ModelFace;
typedef vec_t(ModelFace) vec_model_face_t;
typedef struct {
vec_model_face_t faces;
vec_model_vertex_t vertices;
vec_model_vertex_t normals;
vec_model_vertex_t texCoords;
} ModelMesh;
typedef vec_t(ModelMesh*) vec_model_mesh_t;
typedef struct ModelNode {
2017-01-20 02:04:45 +00:00
float transform[16];
2016-11-26 07:15:04 +00:00
vec_uint_t meshes;
vec_void_t children;
} ModelNode;
typedef struct {
Ref ref;
ModelNode* root;
vec_model_mesh_t meshes;
int hasNormals;
int hasTexCoords;
} ModelData;
2016-10-04 04:54:27 +00:00
typedef struct {
2016-11-19 07:41:23 +00:00
Ref ref;
2016-10-04 04:54:27 +00:00
ModelData* modelData;
2016-10-31 20:54:32 +00:00
Buffer* buffer;
2016-11-08 22:51:58 +00:00
Texture* texture;
2016-10-04 04:54:27 +00:00
} Model;
2016-11-26 07:15:04 +00:00
2016-08-10 06:28:17 +00:00
#endif
2016-10-04 04:54:27 +00:00
2016-11-25 08:49:19 +00:00
Model* lovrModelCreate(ModelData* modelData);
2016-11-19 07:41:23 +00:00
void lovrModelDestroy(const Ref* ref);
2016-11-26 07:15:04 +00:00
void lovrModelDataDestroy(ModelData* modelData);
2016-11-02 03:56:29 +00:00
void lovrModelDraw(Model* model, float x, float y, float z, float scale, float angle, float ax, float ay, float az);
2016-11-08 22:51:58 +00:00
Texture* lovrModelGetTexture(Model* model);
void lovrModelSetTexture(Model* model, Texture* texture);