Browse Source

Implemented default mesh

In case mesh loading fails, a cube is generated instead!
pull/531/head
Ray 6 years ago
parent
commit
847bdaf682
1 changed files with 5 additions and 3 deletions
  1. +5
    -3
      src/models.c

+ 5
- 3
src/models.c View File

@ -631,11 +631,13 @@ Mesh LoadMesh(const char *fileName)
TraceLog(LOG_WARNING, "[%s] Mesh fileformat not supported, it can't be loaded", fileName);
#endif
if (mesh.vertexCount == 0) TraceLog(LOG_WARNING, "Mesh could not be loaded");
if (mesh.vertexCount == 0)
{
TraceLog(LOG_WARNING, "Mesh could not be loaded! Let's load a cube to replace it!");
mesh = GenMeshCube(1.0f, 1.0f, 1.0f);
}
else rlLoadMesh(&mesh, false); // Upload vertex data to GPU (static mesh)
// TODO: Initialize default mesh data in case loading fails, maybe a cube?
return mesh;
}

Loading…
Cancel
Save