WARNING: Redesigned model struct for multi-meshes

This is quite a big change, Model struct has been redesigned to support multiple meshes and multiple materials, most 3d fileformats contain multiple meshes and reference multiple materials.

Consequently, multiple functions have been reviewed.

LoadOBJ(), LoadIQM(), LoadGLFT() now return a Model.

Current LoadOBJ() is not valid anymore, actually, tinyobj_loader_c library is considered for replacement.
This commit is contained in:
Ray 2019-03-29 16:48:23 +01:00
parent 876c64b1e5
commit a643dc4ca0
3 changed files with 1684 additions and 73 deletions

View file

@ -339,18 +339,15 @@ typedef struct Material {
// Model type
typedef struct Model {
Mesh mesh; // Vertex data buffers (RAM and VRAM)
Matrix transform; // Local transform matrix
Material material; // Shader and textures data
/*
Mesh *meshes; // Vertex data buffers (RAM and VRAM)
int meshCount;
int meshCount; // Number of meshes
Mesh *meshes; // Meshes array
Material *materials; // Shader and textures data
int materialCount;
int *meshMaterial; // Material assigned to every mesh
*/
int materialCount; // Number of materials
Material *materials; // Materials array
int *meshMaterial; // Mesh material number
} Model;
// Ray type (useful for raycast)
@ -1226,7 +1223,7 @@ RLAPI void DrawGizmo(Vector3 position);
//------------------------------------------------------------------------------------
// Model loading/unloading functions
RLAPI Model LoadModel(const char *fileName); // Load model from files (mesh and material)
RLAPI Model LoadModel(const char *fileName); // Load model from files (meshes and materials)
RLAPI Model LoadModelFromMesh(Mesh mesh); // Load model from generated mesh
RLAPI void UnloadModel(Model model); // Unload model from memory (RAM and/or VRAM)