2021-11-30 21:29:18 -06:00
|
|
|
#ifndef MESH_H
|
|
|
|
#define MESH_H
|
|
|
|
|
|
|
|
#include "mathc.h"
|
|
|
|
#include <stdint.h>
|
|
|
|
|
2022-11-19 17:13:57 -06:00
|
|
|
struct shader;
|
2021-11-30 21:29:18 -06:00
|
|
|
struct Texture;
|
|
|
|
|
|
|
|
#define MAX_BONE_INFLUENCE 4
|
|
|
|
|
|
|
|
struct Vertex {
|
|
|
|
mfloat_t Position[3];
|
|
|
|
mfloat_t Normal[3];
|
|
|
|
mfloat_t TexCoords[2];
|
|
|
|
mfloat_t Tangent[3];
|
|
|
|
mfloat_t Bitangent[3];
|
|
|
|
|
|
|
|
int m_BoneIDs[MAX_BONE_INFLUENCE];
|
|
|
|
|
|
|
|
float m_Weights[MAX_BONE_INFLUENCE];
|
|
|
|
};
|
|
|
|
|
2022-11-19 17:13:57 -06:00
|
|
|
struct mesh {
|
2021-11-30 21:29:18 -06:00
|
|
|
struct Vertex *vertices;
|
|
|
|
struct Vertex *ve;
|
|
|
|
uint32_t *indices;
|
|
|
|
uint32_t *ie;
|
|
|
|
struct Texture *textures;
|
|
|
|
struct Texture *te;
|
|
|
|
uint32_t VAO, VBO, EBO;
|
|
|
|
};
|
|
|
|
|
2022-11-19 17:13:57 -06:00
|
|
|
struct mesh *MakeMesh(struct Vertex *vertices, struct Vertex *ve,
|
2021-11-30 21:29:18 -06:00
|
|
|
uint32_t * indices, uint32_t * ie,
|
|
|
|
struct Texture *textures, struct Texture *te);
|
2022-11-19 17:13:57 -06:00
|
|
|
void setupmesh(struct mesh *mesh); /* Loads mesh into the GPU */
|
|
|
|
void DrawMesh(struct mesh *mesh, struct shader *shader);
|
|
|
|
void DrawMeshAgain(struct mesh *mesh); /* Draws whatever mesh was drawn last */
|
2021-11-30 21:29:18 -06:00
|
|
|
|
|
|
|
#endif
|