diff options
author | Jonathan "Geenz" Goodman <geenz@geenzo.com> | 2023-03-13 08:06:17 -0700 |
---|---|---|
committer | Jonathan "Geenz" Goodman <geenz@geenzo.com> | 2023-03-13 08:06:17 -0700 |
commit | 75dea34e3f80b054c56c38c880166d5e610eef88 (patch) | |
tree | 8a8a54cb3e446213b33dcdd64c0c89d3c47369b4 /indra/newview/lllocalgltfmaterials.cpp | |
parent | f3ce17701e8dbbbc7a0e8e73c740b161bb2f36c0 (diff) | |
parent | 0e178e12562b95915a9a775cd40d3bb44729332c (diff) |
Merge branch 'DRTVWR-559' of https://github.com/secondlife/viewer into DRTVWR-559
Diffstat (limited to 'indra/newview/lllocalgltfmaterials.cpp')
-rw-r--r-- | indra/newview/lllocalgltfmaterials.cpp | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/indra/newview/lllocalgltfmaterials.cpp b/indra/newview/lllocalgltfmaterials.cpp index a9099b1ce9..996b168262 100644 --- a/indra/newview/lllocalgltfmaterials.cpp +++ b/indra/newview/lllocalgltfmaterials.cpp @@ -214,12 +214,18 @@ bool LLLocalGLTFMaterial::loadMaterial() LLStringUtil::toLower(filename_lc); std::string material_name; - // Might be a good idea to make these textures into local textures - decode_successful = LLTinyGLTFHelper::getMaterialFromFile( - mFilename, - mMaterialIndex, - this, - material_name); + tinygltf::Model model; + decode_successful = LLTinyGLTFHelper::loadModel(mFilename, model); + if (decode_successful) + { + // Might be a good idea to make these textures into local textures + decode_successful = LLTinyGLTFHelper::getMaterialFromModel( + mFilename, + model, + mMaterialIndex, + this, + material_name); + } if (!material_name.empty()) { @@ -308,7 +314,10 @@ S32 LLLocalGLTFMaterialMgr::addUnit(const std::vector<std::string>& filenames) S32 LLLocalGLTFMaterialMgr::addUnit(const std::string& filename) { - S32 materials_in_file = LLTinyGLTFHelper::getMaterialCountFromFile(filename); + tinygltf::Model model; + LLTinyGLTFHelper::loadModel(filename, model); + + S32 materials_in_file = model.materials.size(); if (materials_in_file <= 0) { return 0; |