diff options
| author | Ray <[email protected]> | 2017-03-26 22:49:01 +0200 |
|---|---|---|
| committer | Ray <[email protected]> | 2017-03-26 22:49:01 +0200 |
| commit | b7a8a40e71f6c4467afd260c1f66e2c46891397f (patch) | |
| tree | 107369d1f3c15e9ebf55e7492e2f0a4a4ea19de4 /src/models.c | |
| parent | 5387b4543175bee9d195b24e250a0ef863a63555 (diff) | |
| download | raylib-b7a8a40e71f6c4467afd260c1f66e2c46891397f.tar.gz raylib-b7a8a40e71f6c4467afd260c1f66e2c46891397f.zip | |
Work on configuration flags
Diffstat (limited to 'src/models.c')
| -rw-r--r-- | src/models.c | 26 |
1 files changed, 23 insertions, 3 deletions
diff --git a/src/models.c b/src/models.c index 67e1693c..6aff59c4 100644 --- a/src/models.c +++ b/src/models.c @@ -4,7 +4,7 @@ * * CONFIGURATION: * -* #define SUPPORT_FILEFORMAT_OBJ / SUPPORT_LOAD_OBJ +* #define SUPPORT_FILEFORMAT_OBJ * Selected desired fileformats to be supported for loading. * * #define SUPPORT_FILEFORMAT_MTL @@ -32,6 +32,12 @@ * **********************************************************************************************/ +// Default configuration flags (supported features) +//------------------------------------------------- +#define SUPPORT_FILEFORMAT_OBJ +#define SUPPORT_FILEFORMAT_MTL +//------------------------------------------------- + #include "raylib.h" #if defined(PLATFORM_ANDROID) @@ -63,8 +69,12 @@ //---------------------------------------------------------------------------------- // Module specific Functions Declaration //---------------------------------------------------------------------------------- +#if defined(SUPPORT_FILEFORMAT_OBJ) static Mesh LoadOBJ(const char *fileName); // Load OBJ mesh data +#endif +#if defined(SUPPORT_FILEFORMAT_MTL) static Material LoadMTL(const char *fileName); // Load MTL material data +#endif static Mesh GenMeshHeightmap(Image image, Vector3 size); static Mesh GenMeshCubicmap(Image cubicmap, Vector3 cubeSize); @@ -582,8 +592,11 @@ Mesh LoadMesh(const char *fileName) { Mesh mesh = { 0 }; +#if defined(SUPPORT_FILEFORMAT_OBJ) if (strcmp(GetExtension(fileName), "obj") == 0) mesh = LoadOBJ(fileName); - else TraceLog(WARNING, "[%s] Mesh extension not recognized, it can't be loaded", fileName); +#else + TraceLog(WARNING, "[%s] Mesh fileformat not supported, it can't be loaded", fileName); +#endif if (mesh.vertexCount == 0) TraceLog(WARNING, "Mesh could not be loaded"); else rlglLoadMesh(&mesh, false); // Upload vertex data to GPU (static mesh) @@ -692,8 +705,11 @@ Material LoadMaterial(const char *fileName) { Material material = { 0 }; +#if defined(SUPPORT_FILEFORMAT_MTL) if (strcmp(GetExtension(fileName), "mtl") == 0) material = LoadMTL(fileName); - else TraceLog(WARNING, "[%s] Material extension not recognized, it can't be loaded", fileName); +#else + TraceLog(WARNING, "[%s] Material fileformat not supported, it can't be loaded", fileName); +#endif return material; } @@ -1590,6 +1606,7 @@ BoundingBox CalculateBoundingBox(Mesh mesh) // Module specific Functions Definition //---------------------------------------------------------------------------------- +#if defined(SUPPORT_FILEFORMAT_OBJ) // Load OBJ mesh data static Mesh LoadOBJ(const char *fileName) { @@ -1838,7 +1855,9 @@ static Mesh LoadOBJ(const char *fileName) return mesh; } +#endif +#if defined(SUPPORT_FILEFORMAT_MTL) // Load MTL material data (specs: http://paulbourke.net/dataformats/mtl/) // NOTE: Texture map parameters are not supported static Material LoadMTL(const char *fileName) @@ -2002,3 +2021,4 @@ static Material LoadMTL(const char *fileName) return material; } +#endif |
