diff options
author | Dave Parks <davep@lindenlab.com> | 2012-04-03 16:50:07 -0500 |
---|---|---|
committer | Dave Parks <davep@lindenlab.com> | 2012-04-03 16:50:07 -0500 |
commit | 778aae7846756be06c703b090477d6a6db1e8aea (patch) | |
tree | e45f23d2cd878e1a323668a0e18090c4e1965951 | |
parent | 47da4bc46010f00892bf5070e58d7aefdf5b6ef7 (diff) |
Fix render orders.
-rw-r--r-- | indra/newview/pipeline.cpp | 124 |
1 files changed, 71 insertions, 53 deletions
diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index 4c40c6f12e..dcc3bbbe22 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -4369,77 +4369,95 @@ void LLPipeline::renderDebug() glLineWidth(1.0f); gGL.flush(); } + //User designated path + if ( pathfindingConsole->isRenderPath() ) + { + LLGLEnable blend(GL_BLEND); + llPathingLibInstance->renderPath(); + } //physics/exclusion shapes if ( pathfindingConsole->isRenderAnyShapes() ) { - gGL.flush(); - glPolygonMode( GL_FRONT_AND_BACK, GL_FILL ); + U32 render_order[] = { + 1 << LLPathingLib::LLST_ObstacleObjects, + 1 << LLPathingLib::LLST_WalkableObjects, + 1 << LLPathingLib::LLST_ExclusionPhantoms, + 1 << LLPathingLib::LLST_MaterialPhantoms, + }; + + U32 flags = pathfindingConsole->getRenderShapeFlags(); + + for (U32 i = 0; i < 4; i++) + { + if (!(flags & render_order[i])) + { + continue; + } + + gGL.flush(); + glPolygonMode( GL_FRONT_AND_BACK, GL_FILL ); - //get rid of some z-fighting - LLGLEnable polyOffset(GL_POLYGON_OFFSET_FILL); - glPolygonOffset(1.0f, 1.0f); + //get rid of some z-fighting + LLGLEnable polyOffset(GL_POLYGON_OFFSET_FILL); + glPolygonOffset(1.0f, 1.0f); - //render to depth first to avoid blending artifacts - gGL.setColorMask(false, false); - llPathingLibInstance->renderNavMeshShapesVBO( pathfindingConsole->getRenderShapeFlags() ); - gGL.setColorMask(true, false); + //render to depth first to avoid blending artifacts + gGL.setColorMask(false, false); + llPathingLibInstance->renderNavMeshShapesVBO( render_order[i] ); + gGL.setColorMask(true, false); - //get rid of some z-fighting - glPolygonOffset(0.f, 0.f); + //get rid of some z-fighting + glPolygonOffset(0.f, 0.f); - LLGLEnable blend(GL_BLEND); + LLGLEnable blend(GL_BLEND); - { - F32 ambiance = gSavedSettings.getF32("PathfindingAmbiance"); + { + F32 ambiance = gSavedSettings.getF32("PathfindingAmbiance"); - gPathfindingProgram.uniform1f("ambiance", ambiance); + gPathfindingProgram.uniform1f("ambiance", ambiance); - { //draw solid overlay - LLGLDepthTest depth(GL_TRUE, GL_FALSE, GL_LEQUAL); - llPathingLibInstance->renderNavMeshShapesVBO( pathfindingConsole->getRenderShapeFlags() ); - gGL.flush(); - } + { //draw solid overlay + LLGLDepthTest depth(GL_TRUE, GL_FALSE, GL_LEQUAL); + llPathingLibInstance->renderNavMeshShapesVBO( render_order[i] ); + gGL.flush(); + } - LLGLEnable lineOffset(GL_POLYGON_OFFSET_LINE); - glPolygonMode( GL_FRONT_AND_BACK, GL_LINE ); + LLGLEnable lineOffset(GL_POLYGON_OFFSET_LINE); + glPolygonMode( GL_FRONT_AND_BACK, GL_LINE ); - F32 offset = gSavedSettings.getF32("PathfindingLineOffset"); + F32 offset = gSavedSettings.getF32("PathfindingLineOffset"); - if (pathfindingConsole->isRenderXRay()) - { - { //draw hidden wireframe as darker and less opaque - glPolygonOffset(offset, -offset); - gPathfindingProgram.uniform1f("tint", gSavedSettings.getF32("PathfindingXRayTint")); - gPathfindingProgram.uniform1f("alpha_scale", gSavedSettings.getF32("PathfindingXRayOpacity")); - gPathfindingProgram.uniform1f("ambiance", 1.f); - LLGLEnable blend(GL_BLEND); - LLGLDepthTest depth(GL_TRUE, GL_FALSE, GL_GREATER); - llPathingLibInstance->renderNavMeshShapesVBO( pathfindingConsole->getRenderShapeFlags() ); + if (pathfindingConsole->isRenderXRay()) + { + { //draw hidden wireframe as darker and less opaque + glPolygonOffset(offset, -offset); + gPathfindingProgram.uniform1f("tint", gSavedSettings.getF32("PathfindingXRayTint")); + gPathfindingProgram.uniform1f("alpha_scale", gSavedSettings.getF32("PathfindingXRayOpacity")); + gPathfindingProgram.uniform1f("ambiance", 1.f); + LLGLEnable blend(GL_BLEND); + LLGLDepthTest depth(GL_TRUE, GL_FALSE, GL_GREATER); + llPathingLibInstance->renderNavMeshShapesVBO( render_order[i] ); + } } - } - { //draw visible wireframe as brighter, thicker and more opaque - glPolygonOffset(offset, offset); - gPathfindingProgram.uniform1f("ambiance", 1.f); - gPathfindingProgram.uniform1f("tint", 1.f); - gPathfindingProgram.uniform1f("alpha_scale", 1.f); - - glLineWidth(gSavedSettings.getF32("PathfindingLineWidth")); - LLGLDisable blendOut(GL_BLEND); - llPathingLibInstance->renderNavMeshShapesVBO( pathfindingConsole->getRenderShapeFlags() ); - gGL.flush(); - glLineWidth(1.f); - } + { //draw visible wireframe as brighter, thicker and more opaque + glPolygonOffset(offset, offset); + gPathfindingProgram.uniform1f("ambiance", 1.f); + gPathfindingProgram.uniform1f("tint", 1.f); + gPathfindingProgram.uniform1f("alpha_scale", 1.f); + + glLineWidth(gSavedSettings.getF32("PathfindingLineWidth")); + LLGLDisable blendOut(GL_BLEND); + llPathingLibInstance->renderNavMeshShapesVBO( render_order[i] ); + gGL.flush(); + glLineWidth(1.f); + } - glPolygonMode( GL_FRONT_AND_BACK, GL_FILL ); + glPolygonMode( GL_FRONT_AND_BACK, GL_FILL ); + } } } - //User designated path - if ( pathfindingConsole->isRenderPath() ) - { - LLGLEnable blend(GL_BLEND); - llPathingLibInstance->renderPath(); - } + } } gGL.flush(); |