diff options
| author | Ray <raysan5@gmail.com> | 2019-03-29 17:28:10 +0100 |
|---|---|---|
| committer | Ray <raysan5@gmail.com> | 2019-03-29 17:28:10 +0100 |
| commit | 19debd2b4e44cee494c882cb8d338dc1847ae5b5 (patch) | |
| tree | bbb134d4886b2b10869a8573a0ba55abdbbee6fd | |
| parent | 8a73c5d0b403264ebd66cb5a2e1b21f91f6991b0 (diff) | |
| download | raylib-19debd2b4e44cee494c882cb8d338dc1847ae5b5.tar.gz raylib-19debd2b4e44cee494c882cb8d338dc1847ae5b5.zip | |
Review some warnings
| -rw-r--r-- | src/models.c | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/src/models.c b/src/models.c index ec2713ed..6f3fa73f 100644 --- a/src/models.c +++ b/src/models.c @@ -1811,7 +1811,7 @@ Material LoadMaterial(const char *fileName) if (IsFileExtension(fileName, ".mtl")) { tinyobj_material_t *materials; - int materialCount = 0; + unsigned int materialCount = 0; int result = tinyobj_parse_mtl_file(&materials, &materialCount, fileName); @@ -2369,14 +2369,29 @@ static Model LoadOBJ(const char *fileName) tinyobj_attrib_t attrib; tinyobj_shape_t *meshes = NULL; - int meshCount = 0; + unsigned int meshCount = 0; tinyobj_material_t *materials = NULL; - int materialCount = 0; + unsigned int materialCount = 0; int dataLength = 0; - const char *data = get_file_data(&dataLength, fileName); + char *data = NULL; + // Load model data + FILE *objFile = fopen(fileName, "rb"); + + if (objFile != NULL) + { + fseek(objFile, 0, SEEK_END); + long dataLength = ftell(objFile); // Get file size + fseek(objFile, 0, SEEK_SET); // Reset file pointer + + data = (char *)malloc(dataLength); + + fread(data, dataLength, 1, objFile); + fclose(objFile); + } + if (data != NULL) { unsigned int flags = TINYOBJ_FLAG_TRIANGULATE; |
