diff options
| author | Ray <[email protected]> | 2018-04-19 20:20:34 +0200 |
|---|---|---|
| committer | Ray <[email protected]> | 2018-04-19 20:20:34 +0200 |
| commit | 847bdaf68287f70fbeb5599361257b6f982e48c5 (patch) | |
| tree | 800aeb61be9c2018d1a048da54d1f6ab746f11f1 /src/models.c | |
| parent | 76a6bf6c52ccef16ce0ba96e5bdb323a91bc8675 (diff) | |
| download | raylib-847bdaf68287f70fbeb5599361257b6f982e48c5.tar.gz raylib-847bdaf68287f70fbeb5599361257b6f982e48c5.zip | |
Implemented default mesh
In case mesh loading fails, a cube is generated instead!
Diffstat (limited to 'src/models.c')
| -rw-r--r-- | src/models.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/models.c b/src/models.c index eadbf658..4793ee0a 100644 --- a/src/models.c +++ b/src/models.c @@ -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; } |
