diff options
| author | Jett <[email protected]> | 2024-06-03 03:03:33 -0400 |
|---|---|---|
| committer | GitHub <[email protected]> | 2024-06-03 09:03:33 +0200 |
| commit | 06f8c4f73318488e5a4bf1f7bd82fe991a66827e (patch) | |
| tree | d74fe8cfa2e1b0693404368fb0f0d1a7dc4421f0 | |
| parent | 0cad25f79878211783ce550b06e20f13cc9176a1 (diff) | |
| download | raylib-06f8c4f73318488e5a4bf1f7bd82fe991a66827e.tar.gz raylib-06f8c4f73318488e5a4bf1f7bd82fe991a66827e.zip | |
LoadIQM: attempt to load texture from IQM at loadtime. (#4029)
tries to load the texture with the base path of the original IQM file, relative paths should work.
| -rw-r--r-- | src/rmodels.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/rmodels.c b/src/rmodels.c index 5cf848b6..24920151 100644 --- a/src/rmodels.c +++ b/src/rmodels.c @@ -4268,6 +4268,8 @@ static Model LoadIQM(const char *fileName) // In case file can not be read, return an empty model if (fileDataPtr == NULL) return model; + const char* basePath = GetDirectoryPath(fileName); + // Read IQM header IQMHeader *iqmHeader = (IQMHeader *)fileDataPtr; @@ -4312,6 +4314,7 @@ static Model LoadIQM(const char *fileName) memcpy(material, fileDataPtr + iqmHeader->ofs_text + imesh[i].material, MATERIAL_NAME_LENGTH*sizeof(char)); model.materials[i] = LoadMaterialDefault(); + model.materials[i].maps[MATERIAL_MAP_ALBEDO].texture = LoadTexture(TextFormat("%s/%s", basePath, material)); TRACELOG(LOG_DEBUG, "MODEL: [%s] mesh name (%s), material (%s)", fileName, name, material); |
