aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/llspatialpartition.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'linden/indra/newview/llspatialpartition.cpp')
-rw-r--r--linden/indra/newview/llspatialpartition.cpp26
1 files changed, 24 insertions, 2 deletions
diff --git a/linden/indra/newview/llspatialpartition.cpp b/linden/indra/newview/llspatialpartition.cpp
index 31b537c..c1d5ff3 100644
--- a/linden/indra/newview/llspatialpartition.cpp
+++ b/linden/indra/newview/llspatialpartition.cpp
@@ -1302,7 +1302,11 @@ void LLSpatialGroup::doOcclusion(LLCamera* camera)
1302{ 1302{
1303 if (mSpatialPartition->isOcclusionEnabled() && LLPipeline::sUseOcclusion > 1) 1303 if (mSpatialPartition->isOcclusionEnabled() && LLPipeline::sUseOcclusion > 1)
1304 { 1304 {
1305 if (earlyFail(camera, this)) 1305 static LLCachedControl<BOOL> render_water_void_culling("RenderWaterVoidCulling", TRUE);
1306 // Don't cull hole/edge water, unless RenderWaterVoidCulling is set and we have the GL_ARB_depth_clamp extension.
1307 if ((mSpatialPartition->mDrawableType == LLPipeline::RENDER_TYPE_VOIDWATER &&
1308 !(render_water_void_culling && gGLManager.mHasDepthClamp)) ||
1309 earlyFail(camera, this))
1306 { 1310 {
1307 setState(LLSpatialGroup::DISCARD_QUERY); 1311 setState(LLSpatialGroup::DISCARD_QUERY);
1308 assert_states_valid(this); 1312 assert_states_valid(this);
@@ -1324,11 +1328,28 @@ void LLSpatialGroup::doOcclusion(LLCamera* camera)
1324 buildOcclusion(); 1328 buildOcclusion();
1325 } 1329 }
1326 1330
1331 // Depth clamp all water to avoid it being culled as a result of being
1332 // behind the far clip plane, and in the case of edge water to avoid
1333 // it being culled while still visible.
1334 bool const use_depth_clamp =
1335 gGLManager.mHasDepthClamp &&
1336 (mSpatialPartition->mDrawableType == LLPipeline::RENDER_TYPE_WATER ||
1337 mSpatialPartition->mDrawableType == LLPipeline::RENDER_TYPE_VOIDWATER);
1338 if (use_depth_clamp)
1339 {
1340 glEnable(GL_DEPTH_CLAMP);
1341 }
1342
1327 glBeginQueryARB(GL_SAMPLES_PASSED_ARB, mOcclusionQuery); 1343 glBeginQueryARB(GL_SAMPLES_PASSED_ARB, mOcclusionQuery);
1328 glVertexPointer(3, GL_FLOAT, 0, mOcclusionVerts); 1344 glVertexPointer(3, GL_FLOAT, 0, mOcclusionVerts);
1329 glDrawRangeElements(GL_TRIANGLE_FAN, 0, 7, 8, 1345 glDrawRangeElements(GL_TRIANGLE_FAN, 0, 7, 8,
1330 GL_UNSIGNED_BYTE, get_box_fan_indices(camera, mBounds[0])); 1346 GL_UNSIGNED_BYTE, get_box_fan_indices(camera, mBounds[0]));
1331 glEndQueryARB(GL_SAMPLES_PASSED_ARB); 1347 glEndQueryARB(GL_SAMPLES_PASSED_ARB);
1348
1349 if (use_depth_clamp)
1350 {
1351 glDisable(GL_DEPTH_CLAMP);
1352 }
1332 } 1353 }
1333 1354
1334 setState(LLSpatialGroup::QUERY_PENDING); 1355 setState(LLSpatialGroup::QUERY_PENDING);
@@ -2280,9 +2301,10 @@ void renderBoundingBox(LLDrawable* drawable, BOOL set_color = TRUE)
2280 gGL.color4f(0.5f,0.5f,0.5f,1.0f); 2301 gGL.color4f(0.5f,0.5f,0.5f,1.0f);
2281 break; 2302 break;
2282 case LLViewerObject::LL_VO_PART_GROUP: 2303 case LLViewerObject::LL_VO_PART_GROUP:
2283 case LLViewerObject::LL_VO_HUD_PART_GROUP: 2304 case LLViewerObject::LL_VO_HUD_PART_GROUP:
2284 gGL.color4f(0,0,1,1); 2305 gGL.color4f(0,0,1,1);
2285 break; 2306 break;
2307 case LLViewerObject::LL_VO_VOID_WATER:
2286 case LLViewerObject::LL_VO_WATER: 2308 case LLViewerObject::LL_VO_WATER:
2287 gGL.color4f(0,0.5f,1,1); 2309 gGL.color4f(0,0.5f,1,1);
2288 break; 2310 break;