Skip to content

Commit

Permalink
Read int from uvwsrc
Browse files Browse the repository at this point in the history
Previously was reading a uint, which always failed. Since the output was never checked, this
seemed to work, and works fine for most models since they only use UV channel 0.
  • Loading branch information
JulianKnodt authored and kimkulling committed Nov 14, 2023
1 parent 4535e37 commit 9efbbe0
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion code/AssetLib/glTF2/glTF2Exporter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -559,7 +559,11 @@ void glTF2Exporter::GetMatTex(const aiMaterial &mat, Ref<Texture> &texture, unsi
aiString tex;

// Read texcoord (UV map index)
mat.Get(AI_MATKEY_UVWSRC(tt, slot), texCoord);
// Note: must be an int to be successful.
int tmp = 0;
const auto ok = mat.Get(AI_MATKEY_UVWSRC(tt, slot), tmp);
if (ok == aiReturn_SUCCESS) texCoord = tmp;


if (mat.Get(AI_MATKEY_TEXTURE(tt, slot), tex) == AI_SUCCESS) {
std::string path = tex.C_Str();
Expand Down

0 comments on commit 9efbbe0

Please sign in to comment.