diff options
author | Cosmic Linden <cosmic@lindenlab.com> | 2023-09-29 17:19:48 -0700 |
---|---|---|
committer | Cosmic Linden <cosmic@lindenlab.com> | 2024-01-31 14:31:36 -0800 |
commit | 118996225bb588dcaef415dfe18f5e4aca9c35b8 (patch) | |
tree | 8685d290d59a5dddf3bf57ce2a8ab4f9fdcb5d7c /indra/newview/llviewerregion.cpp | |
parent | 00c65b62707f5c30cf2d48c0bd0c975c3bceb513 (diff) |
secondlife/viewer-issues#43: Proof-of-concept PBR terrain normal gen feature flag. Final implementation would likely be very different.
Diffstat (limited to 'indra/newview/llviewerregion.cpp')
-rwxr-xr-x | indra/newview/llviewerregion.cpp | 35 |
1 files changed, 33 insertions, 2 deletions
diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index dae476d9d7..d541bb6647 100755 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -1105,6 +1105,11 @@ void LLViewerRegion::dirtyHeights() } } +void LLViewerRegion::dirtyAllPatches() +{ + getLand().dirtyAllPatches(); +} + //physically delete the cache entry void LLViewerRegion::killCacheEntry(LLVOCacheEntry* entry, bool for_rendering) { @@ -1605,7 +1610,19 @@ void LLViewerRegion::idleUpdate(F32 max_update_time) mLastUpdate = LLViewerOctreeEntryData::getCurrentFrame(); - mImpl->mLandp->idleUpdate(max_update_time); + static bool pbr_terrain_enabled = gSavedSettings.get<bool>("RenderTerrainPBREnabled"); + static LLCachedControl<bool> pbr_terrain_experimental_normals(gSavedSettings, "RenderTerrainPBRNormalsEnabled", FALSE); + bool pbr_material = mImpl->mCompositionp && (mImpl->mCompositionp->getMaterialType() == LLTerrainMaterials::Type::PBR); + bool pbr_land = pbr_material && pbr_terrain_enabled && pbr_terrain_experimental_normals; + + if (!pbr_land) + { + mImpl->mLandp->idleUpdate</*PBR=*/false>(max_update_time); + } + else + { + mImpl->mLandp->idleUpdate</*PBR=*/true>(max_update_time); + } if (mParcelOverlay) { @@ -1906,7 +1923,21 @@ LLViewerObject* LLViewerRegion::updateCacheEntry(U32 local_id, LLViewerObject* o // As above, but forcibly do the update. void LLViewerRegion::forceUpdate() { - mImpl->mLandp->idleUpdate(0.f); + constexpr F32 max_update_time = 0.f; + + static bool pbr_terrain_enabled = gSavedSettings.get<BOOL>("RenderTerrainPBREnabled"); + static LLCachedControl<BOOL> pbr_terrain_experimental_normals(gSavedSettings, "RenderTerrainPBRNormalsEnabled", FALSE); + bool pbr_material = mImpl->mCompositionp && (mImpl->mCompositionp->getMaterialType() == LLTerrainMaterials::Type::PBR); + bool pbr_land = pbr_material && pbr_terrain_enabled && pbr_terrain_experimental_normals; + + if (!pbr_land) + { + mImpl->mLandp->idleUpdate</*PBR=*/false>(max_update_time); + } + else + { + mImpl->mLandp->idleUpdate</*PBR=*/true>(max_update_time); + } if (mParcelOverlay) { |