Skip to content

Commit

Permalink
fix : Stack around the variable 'texMapMode' was corrupted
Browse files Browse the repository at this point in the history
fix : Stack around the variable 'texMapMode' was corrupted
  • Loading branch information
yuz1 authored Nov 24, 2023
1 parent 2312f58 commit 46c140b
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/Viewer/ModelLoader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -349,11 +349,11 @@ void ModelLoader::processMaterial(const aiMaterial *ai_material,
return;
}
for (size_t i = 0; i < ai_material->GetTextureCount(textureType); i++) {
aiTextureMapMode texMapMode;
aiTextureMapMode texMapMode[2];
aiString texPath;
aiReturn retStatus = ai_material->GetTexture(textureType, i, &texPath,
nullptr, nullptr, nullptr, nullptr,
&texMapMode);
&texMapMode[0]);
if (retStatus != aiReturn_SUCCESS || texPath.length == 0) {
LOGW("load texture type=%d, index=%d failed with return value=%d", textureType, i, retStatus);
continue;
Expand Down Expand Up @@ -385,7 +385,7 @@ void ModelLoader::processMaterial(const aiMaterial *ai_material,
auto buffer = loadTextureFile(absolutePath);
if (buffer) {
WrapMode mode;
switch (texMapMode) {
switch (texMapMode[0]) {
case aiTextureMapMode_Wrap:
mode = Wrap_REPEAT;
break;
Expand Down Expand Up @@ -492,4 +492,4 @@ std::shared_ptr<Buffer<RGBA>> ModelLoader::loadTextureFile(const std::string &pa
}

}
}
}

0 comments on commit 46c140b

Please sign in to comment.