Review some warnings
This commit is contained in:
parent
8a73c5d0b4
commit
19debd2b4e
23
src/models.c
23
src/models.c
@ -1811,7 +1811,7 @@ Material LoadMaterial(const char *fileName)
|
|||||||
if (IsFileExtension(fileName, ".mtl"))
|
if (IsFileExtension(fileName, ".mtl"))
|
||||||
{
|
{
|
||||||
tinyobj_material_t *materials;
|
tinyobj_material_t *materials;
|
||||||
int materialCount = 0;
|
unsigned int materialCount = 0;
|
||||||
|
|
||||||
int result = tinyobj_parse_mtl_file(&materials, &materialCount, fileName);
|
int result = tinyobj_parse_mtl_file(&materials, &materialCount, fileName);
|
||||||
|
|
||||||
@ -2369,13 +2369,28 @@ static Model LoadOBJ(const char *fileName)
|
|||||||
|
|
||||||
tinyobj_attrib_t attrib;
|
tinyobj_attrib_t attrib;
|
||||||
tinyobj_shape_t *meshes = NULL;
|
tinyobj_shape_t *meshes = NULL;
|
||||||
int meshCount = 0;
|
unsigned int meshCount = 0;
|
||||||
|
|
||||||
tinyobj_material_t *materials = NULL;
|
tinyobj_material_t *materials = NULL;
|
||||||
int materialCount = 0;
|
unsigned int materialCount = 0;
|
||||||
|
|
||||||
int dataLength = 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)
|
if (data != NULL)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user