summaryrefslogtreecommitdiff
path: root/indra/newview/lldrawpoolterrain.cpp
diff options
context:
space:
mode:
authorCosmic Linden <cosmic@lindenlab.com>2023-10-13 10:38:48 -0700
committerCosmic Linden <cosmic@lindenlab.com>2023-10-13 10:38:48 -0700
commit35d889f7af9686b79fe0e5255121a444a044beab (patch)
tree957faaf5ba58c0ed392fd62b8d33d561158bcbf7 /indra/newview/lldrawpoolterrain.cpp
parentb9ba57fd0004751dfbcbea90264a6e16c5849e5e (diff)
DRTVWR-592: Create separate config option for terrain repeats. Clean up debug
Diffstat (limited to 'indra/newview/lldrawpoolterrain.cpp')
-rw-r--r--indra/newview/lldrawpoolterrain.cpp13
1 files changed, 7 insertions, 6 deletions
diff --git a/indra/newview/lldrawpoolterrain.cpp b/indra/newview/lldrawpoolterrain.cpp
index b4671963e1..85b4bb3dca 100644
--- a/indra/newview/lldrawpoolterrain.cpp
+++ b/indra/newview/lldrawpoolterrain.cpp
@@ -59,6 +59,7 @@ const S32 PBR_DETAIL_EMISSIVE = 0;
S32 LLDrawPoolTerrain::sDetailMode = 1;
S32 LLDrawPoolTerrain::sPBRDetailMode = 0;
F32 LLDrawPoolTerrain::sDetailScale = DETAIL_SCALE;
+F32 LLDrawPoolTerrain::sPBRDetailScale = DETAIL_SCALE;
static LLGLSLShader* sShader = NULL;
static LLTrace::BlockTimerStatHandle FTM_SHADOW_TERRAIN("Terrain Shadow");
@@ -69,6 +70,7 @@ LLDrawPoolTerrain::LLDrawPoolTerrain(LLViewerTexture *texturep) :
{
// Hack!
sDetailScale = 1.f/gSavedSettings.getF32("RenderTerrainScale");
+ sPBRDetailScale = 1.f/gSavedSettings.getF32("RenderTerrainPBRScale");
// TODO: This is unused. Remove?
sDetailMode = gSavedSettings.getS32("RenderTerrainDetail");
sPBRDetailMode = gSavedSettings.getS32("RenderTerrainPBRDetail");
@@ -385,16 +387,15 @@ void LLDrawPoolTerrain::renderFullShaderPBR(BOOL local_materials)
materials = &gLocalTerrainMaterials.mDetailMaterials;
}
- // *TODO: I'm seeing terrain still jump when switching regions. Might have something to do with the extra repeat factor in the shader. Or is it a numerical precision issue?...
- // *TODO: If we want to change the tiling, we should change this offset modulo to prevent seams
+ // *TODO: Figure out why this offset is *sometimes* producing seams at the region edge, and repeat jumps when crossing regions, when RenderTerrainPBRScale is not a factor of the region scale.
LLVector3d region_origin_global = gAgent.getRegion()->getOriginGlobal();
- F32 offset_x = (F32)fmod(region_origin_global.mdV[VX], 1.0/(F64)sDetailScale)*sDetailScale;
- F32 offset_y = (F32)fmod(region_origin_global.mdV[VY], 1.0/(F64)sDetailScale)*sDetailScale;
+ F32 offset_x = (F32)fmod(region_origin_global.mdV[VX], 1.0/(F64)sPBRDetailScale)*sPBRDetailScale;
+ F32 offset_y = (F32)fmod(region_origin_global.mdV[VY], 1.0/(F64)sPBRDetailScale)*sPBRDetailScale;
LLVector4 tp0, tp1;
- tp0.setVec(sDetailScale, 0.0f, 0.0f, offset_x);
- tp1.setVec(0.0f, sDetailScale, 0.0f, offset_y);
+ tp0.setVec(sPBRDetailScale, 0.0f, 0.0f, offset_x);
+ tp1.setVec(0.0f, sPBRDetailScale, 0.0f, offset_y);
constexpr U32 terrain_material_count = 1 + LLViewerShaderMgr::TERRAIN_DETAIL3_BASE_COLOR - LLViewerShaderMgr::TERRAIN_DETAIL0_BASE_COLOR;
S32 detail_basecolor[terrain_material_count];