summaryrefslogtreecommitdiff
path: root/indra/newview/lldrawpoolterrain.cpp
diff options
context:
space:
mode:
authorCosmic Linden <cosmic@lindenlab.com>2023-10-13 09:56:55 -0700
committerCosmic Linden <cosmic@lindenlab.com>2023-10-13 09:56:55 -0700
commit76bf3390eb119a7dfd879bbbc31b4d5e687aac8f (patch)
treec9ffb43b525d5c73915603690fe51c329ef124c6 /indra/newview/lldrawpoolterrain.cpp
parent2d10941459cf66d34073925c136d70bd6dbece3f (diff)
DRTVWR-592: (WIP) Detect when terrain materials are loaded, use as fallback when terrain textures do not load
Diffstat (limited to 'indra/newview/lldrawpoolterrain.cpp')
-rw-r--r--indra/newview/lldrawpoolterrain.cpp32
1 files changed, 30 insertions, 2 deletions
diff --git a/indra/newview/lldrawpoolterrain.cpp b/indra/newview/lldrawpoolterrain.cpp
index 77189dceae..687ff5f462 100644
--- a/indra/newview/lldrawpoolterrain.cpp
+++ b/indra/newview/lldrawpoolterrain.cpp
@@ -121,8 +121,36 @@ void LLDrawPoolTerrain::boostTerrainDetailTextures()
LLVLComposition *compp = regionp->getComposition();
for (S32 i = 0; i < 4; i++)
{
- compp->mDetailTextures[i]->setBoostLevel(LLGLTexture::BOOST_TERRAIN);
- compp->mDetailTextures[i]->addTextureStats(1024.f * 1024.f);
+ constexpr LLGLTexture::EBoostLevel level = LLGLTexture::BOOST_TERRAIN;
+ constexpr float stats = 1024.f * 1024.f;
+
+ LLPointer<LLViewerFetchedTexture>& tex = compp->mDetailTextures[i];
+ llassert(tex.notNull());
+ tex->setBoostLevel(level);
+ tex->addTextureStats(stats);
+
+ LLPointer<LLFetchedGLTFMaterial>& mat = compp->mDetailMaterials[i];
+ llassert(mat.notNull());
+ if (mat->mBaseColorTexture)
+ {
+ mat->mBaseColorTexture->setBoostLevel(level);
+ mat->mBaseColorTexture->addTextureStats(stats);
+ }
+ if (mat->mNormalTexture)
+ {
+ mat->mNormalTexture->setBoostLevel(level);
+ mat->mNormalTexture->addTextureStats(stats);
+ }
+ if (mat->mMetallicRoughnessTexture)
+ {
+ mat->mMetallicRoughnessTexture->setBoostLevel(level);
+ mat->mMetallicRoughnessTexture->addTextureStats(stats);
+ }
+ if (mat->mEmissiveTexture)
+ {
+ mat->mEmissiveTexture->setBoostLevel(level);
+ mat->mEmissiveTexture->addTextureStats(stats);
+ }
}
}