summaryrefslogtreecommitdiff
path: root/indra/newview/llvowater.cpp
diff options
context:
space:
mode:
authorJonathan "Geenz" Goodman <geenz@geenzo.com>2023-07-17 15:06:23 -0700
committerJonathan "Geenz" Goodman <geenz@geenzo.com>2023-07-17 15:06:23 -0700
commit040050af19ff7b5b2f5dc5ce5c4b68cfbb7e492a (patch)
treefcde4fb3af978615315f83204e6d7351f3b5f02c /indra/newview/llvowater.cpp
parentf7f9601567ce089f3335407f1d3c7d32dbb18c60 (diff)
parentf975cfd7361729195f2bb14d874e5eacc6140759 (diff)
Merge branch 'DRTVWR-559' into DRTVWR-583
Diffstat (limited to 'indra/newview/llvowater.cpp')
-rw-r--r--indra/newview/llvowater.cpp41
1 files changed, 21 insertions, 20 deletions
diff --git a/indra/newview/llvowater.cpp b/indra/newview/llvowater.cpp
index 608d2cb799..77ad967cef 100644
--- a/indra/newview/llvowater.cpp
+++ b/indra/newview/llvowater.cpp
@@ -142,9 +142,14 @@ BOOL LLVOWater::updateGeometry(LLDrawable *drawable)
static const unsigned int vertices_per_quad = 4;
static const unsigned int indices_per_quad = 6;
- const S32 size = LLPipeline::sRenderTransparentWater ? 16 : 1;
+ S32 size_x = LLPipeline::sRenderTransparentWater ? 8 : 1;
+ S32 size_y = LLPipeline::sRenderTransparentWater ? 8 : 1;
- const S32 num_quads = size * size;
+ const LLVector3& scale = getScale();
+ size_x *= llmin(llround(scale.mV[0] / 256.f), 8);
+ size_y *= llmin(llround(scale.mV[1] / 256.f), 8);
+
+ const S32 num_quads = size_x * size_y;
face->setSize(vertices_per_quad * num_quads,
indices_per_quad * num_quads);
@@ -175,41 +180,37 @@ BOOL LLVOWater::updateGeometry(LLDrawable *drawable)
face->mCenterLocal = position_agent;
S32 x, y;
- F32 step_x = getScale().mV[0] / size;
- F32 step_y = getScale().mV[1] / size;
+ F32 step_x = getScale().mV[0] / size_x;
+ F32 step_y = getScale().mV[1] / size_y;
const LLVector3 up(0.f, step_y * 0.5f, 0.f);
const LLVector3 right(step_x * 0.5f, 0.f, 0.f);
const LLVector3 normal(0.f, 0.f, 1.f);
- F32 size_inv = 1.f / size;
-
- F32 z_fudge = 0.f;
+ F32 size_inv_x = 1.f / size_x;
+ F32 size_inv_y = 1.f / size_y;
- if (getIsEdgePatch())
- { //bump edge patches down 10 cm to prevent aliasing along edges
- z_fudge = -0.1f;
- }
-
- for (y = 0; y < size; y++)
+ for (y = 0; y < size_y; y++)
{
- for (x = 0; x < size; x++)
+ for (x = 0; x < size_x; x++)
{
- S32 toffset = index_offset + 4*(y*size + x);
+ S32 toffset = index_offset + 4*(y*size_x + x);
position_agent = getPositionAgent() - getScale() * 0.5f;
position_agent.mV[VX] += (x + 0.5f) * step_x;
position_agent.mV[VY] += (y + 0.5f) * step_y;
- position_agent.mV[VZ] += z_fudge;
+
+ position_agent.mV[VX] = llround(position_agent.mV[VX]);
+ position_agent.mV[VY] = llround(position_agent.mV[VY]);
*verticesp++ = position_agent - right + up;
*verticesp++ = position_agent - right - up;
*verticesp++ = position_agent + right + up;
*verticesp++ = position_agent + right - up;
- *texCoordsp++ = LLVector2(x*size_inv, (y+1)*size_inv);
- *texCoordsp++ = LLVector2(x*size_inv, y*size_inv);
- *texCoordsp++ = LLVector2((x+1)*size_inv, (y+1)*size_inv);
- *texCoordsp++ = LLVector2((x+1)*size_inv, y*size_inv);
+ *texCoordsp++ = LLVector2(x*size_inv_x, (y+1)*size_inv_y);
+ *texCoordsp++ = LLVector2(x*size_inv_x, y*size_inv_y);
+ *texCoordsp++ = LLVector2((x+1)*size_inv_x, (y+1)*size_inv_y);
+ *texCoordsp++ = LLVector2((x+1)*size_inv_x, y*size_inv_y);
*normalsp++ = normal;
*normalsp++ = normal;