summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDave Parks <davep@lindenlab.com>2023-02-10 14:19:09 -0600
committerDave Parks <davep@lindenlab.com>2023-02-10 14:19:09 -0600
commit579fc82f8a5c3e2a3a7834541f0cb0c3de8d4d91 (patch)
tree1cb43f3947f0ca29571b0e81a91744f4d30a353b
parent94d3493e7b88d22c13570a48179a49f814e647db (diff)
SL-19187 Fix for occlusion and shadow frusta debug displays not working as expected.
-rw-r--r--indra/newview/llspatialpartition.cpp144
-rw-r--r--indra/newview/pipeline.cpp38
2 files changed, 9 insertions, 173 deletions
diff --git a/indra/newview/llspatialpartition.cpp b/indra/newview/llspatialpartition.cpp
index 9f877ab5a9..764131ab79 100644
--- a/indra/newview/llspatialpartition.cpp
+++ b/indra/newview/llspatialpartition.cpp
@@ -1699,8 +1699,6 @@ void renderOctree(LLSpatialGroup* group)
}
face->getVertexBuffer()->setBuffer();
- //drawBox((face->mExtents[0] + face->mExtents[1])*0.5f,
- // (face->mExtents[1]-face->mExtents[0])*0.5f);
face->getVertexBuffer()->draw(LLRender::TRIANGLES, face->getIndicesCount(), face->getIndicesStart());
}
}
@@ -1725,145 +1723,20 @@ void renderOctree(LLSpatialGroup* group)
LLVector4a fudge;
fudge.splat(0.001f);
- //LLVector4a size = group->mObjectBounds[1];
- //size.mul(1.01f);
- //size.add(fudge);
-
- //{
- // LLGLDepthTest depth(GL_TRUE, GL_FALSE);
- // drawBox(group->mObjectBounds[0], fudge);
- //}
-
gGL.setSceneBlendType(LLRender::BT_ALPHA);
- //if (group->mBuilt <= 0.f)
{
//draw opaque outline
- //gGL.diffuseColor4f(col.mV[0], col.mV[1], col.mV[2], 1.f);
- //drawBoxOutline(group->mObjectBounds[0], group->mObjectBounds[1]);
-
gGL.diffuseColor4f(0,1,1,1);
const LLVector4a* bounds = group->getBounds();
drawBoxOutline(bounds[0], bounds[1]);
-
- //draw bounding box for draw info
- /*if (group->getSpatialPartition()->mRenderByGroup)
- {
- gGL.diffuseColor4f(1.0f, 0.75f, 0.25f, 0.6f);
- for (LLSpatialGroup::draw_map_t::iterator i = group->mDrawMap.begin(); i != group->mDrawMap.end(); ++i)
- {
- for (LLSpatialGroup::drawmap_elem_t::iterator j = i->second.begin(); j != i->second.end(); ++j)
- {
- LLDrawInfo* draw_info = *j;
- LLVector4a center;
- center.setAdd(draw_info->mExtents[1], draw_info->mExtents[0]);
- center.mul(0.5f);
- LLVector4a size;
- size.setSub(draw_info->mExtents[1], draw_info->mExtents[0]);
- size.mul(0.5f);
- drawBoxOutline(center, size);
- }
- }
- }*/
}
-
-// LLSpatialGroup::OctreeNode* node = group->mOctreeNode;
-// gGL.diffuseColor4f(0,1,0,1);
-// drawBoxOutline(LLVector3(node->getCenter()), LLVector3(node->getSize()));
}
std::set<LLSpatialGroup*> visible_selected_groups;
-void renderVisibility(LLSpatialGroup* group, LLCamera* camera)
-{
- /*LLGLEnable blend(GL_BLEND);
- gGL.setSceneBlendType(LLRender::BT_ALPHA);
- LLGLEnable cull(GL_CULL_FACE);
- glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);*/
-
- /*BOOL render_objects = (!LLPipeline::sUseOcclusion || !group->isOcclusionState(LLSpatialGroup::OCCLUDED)) && group->isVisible() &&
- !group->isEmpty();
-
-
- if (render_objects)
- {
- LLGLDepthTest depth(GL_TRUE, GL_FALSE);
-
- LLGLDisable blend(GL_BLEND);
- gGL.diffuseColor4f(0.f, 0.75f, 0.f,0.5f);
- pushBufferVerts(group, LLVertexBuffer::MAP_VERTEX, false);
-
- glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
- glLineWidth(4.f);
- gGL.diffuseColor4f(0.f, 0.5f, 0.f, 1.f);
- pushBufferVerts(group, LLVertexBuffer::MAP_VERTEX, false);
- glLineWidth(1.f);
- glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
-
- bool selected = false;
-
- for (LLSpatialGroup::element_iter iter = group->getDataBegin(); iter != group->getDataEnd(); ++iter)
- {
- LLDrawable* drawable = *iter;
- if (drawable->getVObj().notNull() && drawable->getVObj()->isSelected())
- {
- selected = true;
- break;
- }
- }
-
- if (selected)
- { //store for rendering occlusion volume as overlay
- visible_selected_groups.insert(group);
- }
- }*/
-
- /*if (render_objects)
- {
- LLGLDepthTest depth_under(GL_TRUE, GL_FALSE, GL_GREATER);
- gGL.diffuseColor4f(0, 0.5f, 0, 0.5f);
- gGL.diffuseColor4f(0, 0.5f, 0, 0.5f);
- pushBufferVerts(group, LLVertexBuffer::MAP_VERTEX);
- }
-
- {
- LLGLDepthTest depth_over(GL_TRUE, GL_FALSE, GL_LEQUAL);
- if (render_objects)
- {
- gGL.diffuseColor4f(0.f, 0.5f, 0.f,1.f);
- gGL.diffuseColor4f(0.f, 0.5f, 0.f, 1.f);
- pushBufferVerts(group, LLVertexBuffer::MAP_VERTEX);
- }
-
- glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
-
- if (render_objects)
- {
- gGL.diffuseColor4f(0.f, 0.75f, 0.f,0.5f);
- gGL.diffuseColor4f(0.f, 0.75f, 0.f, 0.5f);
- pushBufferVerts(group, LLVertexBuffer::MAP_VERTEX);
-
- bool selected = false;
-
- for (LLSpatialGroup::element_iter iter = group->getDataBegin(); iter != group->getDataEnd(); ++iter)
- {
- LLDrawable* drawable = *iter;
- if (drawable->getVObj().notNull() && drawable->getVObj()->isSelected())
- {
- selected = true;
- break;
- }
- }
-
- if (selected)
- { //store for rendering occlusion volume as overlay
- visible_selected_groups.insert(group);
- }
- }
- }*/
-}
void renderXRay(LLSpatialGroup* group, LLCamera* camera)
{
@@ -3253,23 +3126,6 @@ public:
renderOctree(group);
stop_glerror();
}
-
- //render visibility wireframe
- if (gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_OCCLUSION))
- {
- group->rebuildGeom();
- group->rebuildMesh();
-
- gGL.flush();
- gGL.pushMatrix();
- gGLLastMatrix = NULL;
- gGL.loadMatrix(gGLModelView);
- renderVisibility(group, mCamera);
- stop_glerror();
- gGLLastMatrix = NULL;
- gGL.popMatrix();
- gGL.diffuseColor4f(1,1,1,1);
- }
}
}
diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp
index 65d9d4e060..f911aea9cd 100644
--- a/indra/newview/pipeline.cpp
+++ b/indra/newview/pipeline.cpp
@@ -2438,14 +2438,8 @@ void LLPipeline::doOcclusion(LLCamera& camera)
{
LLVertexBuffer::unbind();
- if (hasRenderDebugMask(LLPipeline::RENDER_DEBUG_OCCLUSION))
- {
- gGL.setColorMask(true, false, false, false);
- }
- else
- {
- gGL.setColorMask(false, false);
- }
+ gGL.setColorMask(false, false);
+
LLGLDisable blend(GL_BLEND);
LLGLDisable test(GL_ALPHA_TEST);
gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
@@ -9417,7 +9411,7 @@ void LLPipeline::generateSunShadow(LLCamera& camera)
if (fp.empty())
{
- if (!hasRenderDebugMask(RENDER_DEBUG_SHADOW_FRUSTA))
+ if (!hasRenderDebugMask(RENDER_DEBUG_SHADOW_FRUSTA) && !gCubeSnapshot)
{
mShadowCamera[0] = main_camera;
mShadowExtents[0][0] = min;
@@ -9497,23 +9491,9 @@ void LLPipeline::generateSunShadow(LLCamera& camera)
}
else
{
- /*if (gCubeSnapshot)
- {
- // do one shadow split for cube snapshots, clear the rest
- mSunClipPlanes.set(64.f, 64.f, 64.f);
- dist[1] = dist[2] = dist[3] = dist[4] = 64.f;
- for (S32 j = 1; j < 4; j++)
- {
- mRT->shadow[j].bindTarget();
- mRT->shadow[j].clear();
- mRT->shadow[j].flush();
- }
- }*/
-
- //for (S32 j = 0; j < (gCubeSnapshot ? 1 : 4); j++)
for (S32 j = 0; j < 4; j++)
{
- if (!hasRenderDebugMask(RENDER_DEBUG_SHADOW_FRUSTA))
+ if (!hasRenderDebugMask(RENDER_DEBUG_SHADOW_FRUSTA) && !gCubeSnapshot)
{
mShadowFrustPoints[j].clear();
}
@@ -9555,7 +9535,7 @@ void LLPipeline::generateSunShadow(LLCamera& camera)
shadow_cam.calcAgentFrustumPlanes(frust);
shadow_cam.mFrustumCornerDist = 0.f;
- if (!gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_SHADOW_FRUSTA))
+ if (!gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_SHADOW_FRUSTA) && !gCubeSnapshot)
{
mShadowCamera[j] = shadow_cam;
}
@@ -9565,7 +9545,7 @@ void LLPipeline::generateSunShadow(LLCamera& camera)
if (!gPipeline.getVisiblePointCloud(shadow_cam, min, max, fp, lightDir))
{
//no possible shadow receivers
- if (!gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_SHADOW_FRUSTA))
+ if (!gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_SHADOW_FRUSTA) && !gCubeSnapshot)
{
mShadowExtents[j][0] = LLVector3();
mShadowExtents[j][1] = LLVector3();
@@ -9585,7 +9565,7 @@ void LLPipeline::generateSunShadow(LLCamera& camera)
continue;
}
- if (!gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_SHADOW_FRUSTA))
+ if (!gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_SHADOW_FRUSTA) && !gCubeSnapshot)
{
mShadowExtents[j][0] = min;
mShadowExtents[j][1] = max;
@@ -9812,7 +9792,7 @@ void LLPipeline::generateSunShadow(LLCamera& camera)
eye = LLVector3(origin_agent.v);
- if (!hasRenderDebugMask(LLPipeline::RENDER_DEBUG_SHADOW_FRUSTA))
+ if (!hasRenderDebugMask(LLPipeline::RENDER_DEBUG_SHADOW_FRUSTA) && !gCubeSnapshot)
{
mShadowFrustOrigin[j] = eye;
}
@@ -9875,7 +9855,7 @@ void LLPipeline::generateSunShadow(LLCamera& camera)
mRT->shadow[j].flush();
- if (!gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_SHADOW_FRUSTA))
+ if (!gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_SHADOW_FRUSTA) && !gCubeSnapshot)
{
mShadowCamera[j+4] = shadow_cam;
}