diff options
author | Kyle Ambroff <ambroff@lindenlab.com> | 2010-10-29 19:52:01 -0700 |
---|---|---|
committer | Kyle Ambroff <ambroff@lindenlab.com> | 2010-10-29 19:52:01 -0700 |
commit | fa17864382a64c90e9106a54368386f6e4115d67 (patch) | |
tree | 7883e97e7bd4d3b0a7d9ac7a0096424e71e0c1ad /indra/newview/llspatialpartition.cpp | |
parent | 4b49b0eff79c41060ba53d0d33ff83b4c18e277b (diff) | |
parent | 42b49397d2347b6a97394ce0b35efe5cc2ab44a2 (diff) |
Merge with lindenlab/viewer-development
Diffstat (limited to 'indra/newview/llspatialpartition.cpp')
-rw-r--r-- | indra/newview/llspatialpartition.cpp | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/indra/newview/llspatialpartition.cpp b/indra/newview/llspatialpartition.cpp index fb984a7c62..960e72ee42 100644 --- a/indra/newview/llspatialpartition.cpp +++ b/indra/newview/llspatialpartition.cpp @@ -1555,7 +1555,9 @@ void LLSpatialGroup::doOcclusion(LLCamera* camera) { if (mSpatialPartition->isOcclusionEnabled() && LLPipeline::sUseOcclusion > 1) { - if (earlyFail(camera, this)) + // Don't cull hole/edge water, unless we have the GL_ARB_depth_clamp extension + if ((mSpatialPartition->mDrawableType == LLDrawPool::POOL_VOIDWATER && !gGLManager.mHasDepthClamp) || + earlyFail(camera, this)) { setOcclusionState(LLSpatialGroup::DISCARD_QUERY); assert_states_valid(this); @@ -1576,7 +1578,18 @@ void LLSpatialGroup::doOcclusion(LLCamera* camera) { buildOcclusion(); } - + + // Depth clamp all water to avoid it being culled as a result of being + // behind the far clip plane, and in the case of edge water to avoid + // it being culled while still visible. + bool const use_depth_clamp = gGLManager.mHasDepthClamp && + (mSpatialPartition->mDrawableType == LLDrawPool::POOL_WATER || + mSpatialPartition->mDrawableType == LLDrawPool::POOL_VOIDWATER); + if (use_depth_clamp) + { + glEnable(GL_DEPTH_CLAMP); + } + glBeginQueryARB(GL_SAMPLES_PASSED_ARB, mOcclusionQuery[LLViewerCamera::sCurCameraID]); glVertexPointer(3, GL_FLOAT, 0, mOcclusionVerts); if (camera->getOrigin().isExactlyZero()) @@ -1592,6 +1605,11 @@ void LLSpatialGroup::doOcclusion(LLCamera* camera) GL_UNSIGNED_BYTE, get_box_fan_indices(camera, mBounds[0])); } glEndQueryARB(GL_SAMPLES_PASSED_ARB); + + if (use_depth_clamp) + { + glDisable(GL_DEPTH_CLAMP); + } } setOcclusionState(LLSpatialGroup::QUERY_PENDING); @@ -2591,9 +2609,10 @@ void renderBoundingBox(LLDrawable* drawable, BOOL set_color = TRUE) gGL.color4f(0.5f,0.5f,0.5f,1.0f); break; case LLViewerObject::LL_VO_PART_GROUP: - case LLViewerObject::LL_VO_HUD_PART_GROUP: + case LLViewerObject::LL_VO_HUD_PART_GROUP: gGL.color4f(0,0,1,1); break; + case LLViewerObject::LL_VO_VOID_WATER: case LLViewerObject::LL_VO_WATER: gGL.color4f(0,0.5f,1,1); break; |