From 4abf39c968c31a9da943a53434388102b99d487f Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Tue, 10 Jan 2023 11:42:12 -0600 Subject: SL-18869 Optimizations -- Bring back water plane clipping for above/below water where applicable. --- indra/newview/lldrawpoolalpha.cpp | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'indra/newview/lldrawpoolalpha.cpp') diff --git a/indra/newview/lldrawpoolalpha.cpp b/indra/newview/lldrawpoolalpha.cpp index 3ce2ced255..07381acd25 100644 --- a/indra/newview/lldrawpoolalpha.cpp +++ b/indra/newview/lldrawpoolalpha.cpp @@ -600,6 +600,16 @@ void LLDrawPoolAlpha::renderAlpha(U32 mask, bool depth_only, bool rigged) begin = gPipeline.beginAlphaGroups(); end = gPipeline.endAlphaGroups(); } + + LLEnvironment& env = LLEnvironment::instance(); + F32 water_height = env.getWaterHeight(); + + bool above_water = getType() == LLDrawPool::POOL_ALPHA_POST_WATER; + if (LLPipeline::sUnderWaterRender) + { + above_water = !above_water; + } + for (LLCullResult::sg_iterator i = begin; i != end; ++i) { @@ -611,6 +621,25 @@ void LLDrawPoolAlpha::renderAlpha(U32 mask, bool depth_only, bool rigged) if (group->getSpatialPartition()->mRenderByGroup && !group->isDead()) { + + LLSpatialBridge* bridge = group->getSpatialPartition()->asBridge(); + const LLVector4a* ext = bridge ? bridge->getSpatialExtents() : group->getExtents(); + + if (above_water) + { // reject any spatial groups that have no part above water + if (ext[1].getF32ptr()[2] < water_height) + { + continue; + } + } + else + { // reject any spatial groups that he no part below water + if (ext[0].getF32ptr()[2] > water_height) + { + continue; + } + } + static std::vector emissives; static std::vector rigged_emissives; emissives.resize(0); -- cgit v1.2.3