Skip to content

Commit f63e19f

Browse files
JettMonstersGoBoomJayLCypher
authored and
JayLCypher
committed
LoadIQM: attempt to load texture from IQM at loadtime. (raysan5#4029)
tries to load the texture with the base path of the original IQM file, relative paths should work.
1 parent 666f5da commit f63e19f

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/rmodels.c

+3
Original file line numberDiff line numberDiff line change
@@ -4268,6 +4268,8 @@ static Model LoadIQM(const char *fileName)
42684268
// In case file can not be read, return an empty model
42694269
if (fileDataPtr == NULL) return model;
42704270

4271+
const char* basePath = GetDirectoryPath(fileName);
4272+
42714273
// Read IQM header
42724274
IQMHeader *iqmHeader = (IQMHeader *)fileDataPtr;
42734275

@@ -4312,6 +4314,7 @@ static Model LoadIQM(const char *fileName)
43124314
memcpy(material, fileDataPtr + iqmHeader->ofs_text + imesh[i].material, MATERIAL_NAME_LENGTH*sizeof(char));
43134315

43144316
model.materials[i] = LoadMaterialDefault();
4317+
model.materials[i].maps[MATERIAL_MAP_ALBEDO].texture = LoadTexture(TextFormat("%s/%s", basePath, material));
43154318

43164319
TRACELOG(LOG_DEBUG, "MODEL: [%s] mesh name (%s), material (%s)", fileName, name, material);
43174320

0 commit comments

Comments
 (0)