From b022048f8710502cb6c099c134fca64bccbc209f Mon Sep 17 00:00:00 2001
From: prep <prep@lindenlab.com>
Date: Wed, 14 Dec 2011 11:13:55 -0500
Subject: [PATCH] Cleanup

---
 indra/llrender/llrendernavprim.cpp | 25 ++++++--------
 indra/newview/pipeline.cpp         | 54 +++++++++++++++++-------------
 2 files changed, 40 insertions(+), 39 deletions(-)

diff --git a/indra/llrender/llrendernavprim.cpp b/indra/llrender/llrendernavprim.cpp
index 96027ba65b7..ec9ed7f25b6 100644
--- a/indra/llrender/llrendernavprim.cpp
+++ b/indra/llrender/llrendernavprim.cpp
@@ -34,8 +34,7 @@
 LLRenderNavPrim gRenderNav;
 //=============================================================================
 void LLRenderNavPrim::renderSegment( const LLVector3& start, const LLVector3& end, int color ) const
-{	
-	
+{		
 	LLColor4 colorA( color );	
 	glLineWidth(1.5f);	
 	gGL.color3fv( colorA.mV );
@@ -46,18 +45,17 @@ void LLRenderNavPrim::renderSegment( const LLVector3& start, const LLVector3& en
 		gGL.vertex3fv( end.mV );
 	}
 	gGL.end();	
+
 	glLineWidth(1.0f);	
 }
 //=============================================================================
 void LLRenderNavPrim::renderTri( const LLVector3& a, const LLVector3& b, const LLVector3& c, int color ) const
 {
-	glPolygonMode(GL_NONE, GL_FILL);
+	glLineWidth(1.5f);		
+	glPolygonMode( GL_FRONT_AND_BACK, GL_FILL );	
 	LLGLDisable cull(GL_CULL_FACE);
-	//LLGLEnable lighting( GL_LIGHTING );
-	//glEnable(GL_POLYGON_STIPPLE);
-	glLineWidth(1.5f);	
 	LLColor4 colorA( color );	
-	colorA*=2.0f;
+	//colorA*=2.0f;
 	gGL.color4fv( colorA.mV );		
 
 	gGL.begin(LLRender::TRIANGLES);
@@ -67,20 +65,17 @@ void LLRenderNavPrim::renderTri( const LLVector3& a, const LLVector3& b, const L
 		gGL.vertex3fv( c.mV );
 	}
 	gGL.end();	
+	
 	gGL.flush();
 }
 //=============================================================================
 void LLRenderNavPrim::renderNavMeshVB( LLVertexBuffer* pVBO, int vertCnt )
 {
-	glPolygonMode(GL_NONE, GL_FILL);
+	glLineWidth(1.5f);		
+	glPolygonMode( GL_FRONT_AND_BACK, GL_FILL );	
 	LLGLDisable cull(GL_CULL_FACE);
-	glColor3f ( 1.0f, 0.0f, 0.0f ) ;
-	glDisable( GL_COLOR_MATERIAL );
-	
-	pVBO->setBuffer( LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_COLOR );
+	gGL.color4fv( LLColor4::white.mV );		
+	pVBO->setBuffer( LLVertexBuffer::MAP_VERTEX  );
 	pVBO->drawArrays( LLRender::TRIANGLES, 0, vertCnt );
-	gGL.flush();
-	glEnable( GL_COLOR_MATERIAL );
-
 }
 //=============================================================================
diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp
index 8b51d1cd6c2..1db2bb52fbe 100644
--- a/indra/newview/pipeline.cpp
+++ b/indra/newview/pipeline.cpp
@@ -3618,7 +3618,36 @@ void LLPipeline::renderGeom(LLCamera& camera, BOOL forceVBOUpdate)
 	}
 
 	LLAppViewer::instance()->pingMainloopTimeout("Pipeline:ForceVBO");
-	
+	//Render navmesh geometry
+	{
+		if ( LLPathingLib::getInstance() ) 
+		{	
+			//prep#
+			glClearColor(0,0,0,0);
+			glEnable(GL_TEXTURE_2D);                        // Enable Texture Mapping
+			glShadeModel(GL_SMOOTH);                        // Enable Smooth Shading
+			glClearColor(0.0f, 0.0f, 0.0f, 0.5f);                   // Black Background
+			glEnable(GL_DEPTH_TEST);                        // Enables Depth Testing
+			glDepthFunc(GL_LEQUAL);                         
+			GLfloat LightAmbient[]= { 0.5f, 0.5f, 0.5f, 1.0f };     
+			glLightfv(GL_LIGHT1, GL_AMBIENT, LightAmbient);
+			
+			bool exclusiveDraw = false;
+			if ( LLPathingLib::getInstance()->getRenderNavMeshState() )
+			{
+				LLPathingLib::getInstance()->renderNavMesh();
+				exclusiveDraw = true;
+			}
+			if ( LLPathingLib::getInstance()->getRenderShapeState() )
+			{
+				LLPathingLib::getInstance()->renderNavMeshShapesVBO();
+				exclusiveDraw = true;
+			}
+
+			if ( exclusiveDraw ) { return; }
+		}		
+	}	
+
 	// Initialize lots of GL state to "safe" values
 	glMatrixMode(GL_TEXTURE);
 	glLoadIdentity();
@@ -3644,29 +3673,6 @@ void LLPipeline::renderGeom(LLCamera& camera, BOOL forceVBOUpdate)
 	gGL.getTexUnit(0)->bind(LLViewerFetchedTexture::sDefaultImagep);
 	LLViewerFetchedTexture::sDefaultImagep->setAddressMode(LLTexUnit::TAM_WRAP);
 	
-
-	{
-		
-		if ( LLPathingLib::getInstance() ) 
-		{	
-			//prep#
-			enableLightsFullbright(LLColor4(1,1,1,1));
-  
-			bool exclusiveDraw = false;
-			if ( LLPathingLib::getInstance()->getRenderNavMeshState() )
-			{
-				LLPathingLib::getInstance()->renderNavMesh();
-				exclusiveDraw = true;
-			}
-			if ( LLPathingLib::getInstance()->getRenderShapeState() )
-			{
-				LLPathingLib::getInstance()->renderNavMeshShapesVBO();
-				exclusiveDraw = true;
-			}
-
-			if ( exclusiveDraw ) { return; }
-		}		
-	}
 		
 	//////////////////////////////////////////////
 	//
-- 
GitLab