summaryrefslogtreecommitdiff
path: root/indra/newview/llvlcomposition.cpp
diff options
context:
space:
mode:
authorCosmic Linden <cosmic@lindenlab.com>2024-02-28 15:02:18 -0800
committerCosmic Linden <cosmic@lindenlab.com>2024-02-29 14:52:55 -0800
commitd79498e25991e425510643ecd1303a5675c5fbf6 (patch)
treeb54fadd2f2f208621b32c7b88263b405ca80067a /indra/newview/llvlcomposition.cpp
parent2ca26ad19a00c055abcb7696ef93f091909678fa (diff)
secondlife/viewer#712: More intuitive selection of PBR vs texture terrain, and update dropdown to match
Diffstat (limited to 'indra/newview/llvlcomposition.cpp')
-rw-r--r--indra/newview/llvlcomposition.cpp14
1 files changed, 6 insertions, 8 deletions
diff --git a/indra/newview/llvlcomposition.cpp b/indra/newview/llvlcomposition.cpp
index 09b21e4e0a..9c64381a07 100644
--- a/indra/newview/llvlcomposition.cpp
+++ b/indra/newview/llvlcomposition.cpp
@@ -91,10 +91,10 @@ BOOL LLTerrainMaterials::generateMaterials()
LLUUID LLTerrainMaterials::getDetailAssetID(S32 asset)
{
llassert(mDetailTextures[asset] && mDetailMaterials[asset]);
- // *HACK: Assume both the the material and texture were fetched in the same
- // way using the same UUID. However, we may not know at this point which
- // one will load.
- return mDetailTextures[asset]->getID();
+ // Assume both the the material and texture were fetched in the same way
+ // using the same UUID. However, we may not know at this point which one
+ // will load.
+ return mDetailTextures[asset] ? mDetailTextures[asset]->getID() : LLUUID::null;
}
LLPointer<LLViewerFetchedTexture> fetch_terrain_texture(const LLUUID& id)
@@ -133,7 +133,7 @@ bool LLTerrainMaterials::texturesReady(bool boost, bool strict)
// *NOTE: Calls to textureReady may boost textures. Do not early-return.
for (S32 i = 0; i < ASSET_COUNT; i++)
{
- ready[i] = textureReady(mDetailTextures[i], boost);
+ ready[i] = mDetailTextures[i].notNull() && textureReady(mDetailTextures[i], boost);
}
bool one_ready = false;
@@ -250,6 +250,7 @@ bool LLTerrainMaterials::materialReady(LLPointer<LLFetchedGLTFMaterial> &mat, bo
// Material is loaded, but textures may not be
if (!textures_set)
{
+ textures_set = true;
// *NOTE: These can sometimes be set to to nullptr due to
// updateTEMaterialTextures. For the sake of robustness, we emulate
// that fetching behavior by setting textures of null IDs to nullptr.
@@ -257,9 +258,6 @@ bool LLTerrainMaterials::materialReady(LLPointer<LLFetchedGLTFMaterial> &mat, bo
mat->mNormalTexture = fetch_terrain_texture(mat->mTextureId[LLGLTFMaterial::GLTF_TEXTURE_INFO_NORMAL]);
mat->mMetallicRoughnessTexture = fetch_terrain_texture(mat->mTextureId[LLGLTFMaterial::GLTF_TEXTURE_INFO_METALLIC_ROUGHNESS]);
mat->mEmissiveTexture = fetch_terrain_texture(mat->mTextureId[LLGLTFMaterial::GLTF_TEXTURE_INFO_EMISSIVE]);
- textures_set = true;
-
- return false;
}
// *NOTE: Calls to textureReady may boost textures. Do not early-return.