diff options
| -rw-r--r-- | indra/newview/app_settings/settings.xml | 84 | ||||
| -rw-r--r-- | indra/newview/app_settings/shaders/class1/interface/pathfindingV.glsl | 18 | ||||
| -rw-r--r-- | indra/newview/llfloaterpathfindingconsole.cpp | 22 | ||||
| -rw-r--r-- | indra/newview/llfloaterpathfindingconsole.h | 5 | ||||
| -rw-r--r-- | indra/newview/pipeline.cpp | 99 | ||||
| -rw-r--r-- | indra/newview/skins/default/xui/en/floater_pathfinding_console.xml | 8 | 
6 files changed, 187 insertions, 49 deletions
| diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 8e2d69ea9b..ed9bcb0380 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -13519,7 +13519,7 @@  	<key>PathfindingNavMeshClear</key>      <map>        <key>Comment</key> -      <string>yay!</string> +      <string>Background color</string>        <key>Persist</key>        <integer>1</integer>        <key>Type</key> @@ -13535,7 +13535,7 @@   <key>PathfindingWalkable</key>      <map>        <key>Comment</key> -      <string>yay!</string> +      <string>Walkable color</string>        <key>Persist</key>        <integer>1</integer>        <key>Type</key> @@ -13551,7 +13551,7 @@   <key>PathfindingObstacle</key>      <map>        <key>Comment</key> -      <string>yay!</string> +      <string>Obstacle color</string>        <key>Persist</key>        <integer>1</integer>        <key>Type</key> @@ -13567,7 +13567,7 @@   <key>PathfindingMaterial</key>      <map>        <key>Comment</key> -      <string>yay!</string> +      <string>Material volume color</string>        <key>Persist</key>        <integer>1</integer>        <key>Type</key> @@ -13583,7 +13583,7 @@   <key>PathfindingExclusion</key>      <map>        <key>Comment</key> -      <string>yay!</string> +      <string>Exclusion volume color</string>        <key>Persist</key>        <integer>1</integer>        <key>Type</key> @@ -13599,7 +13599,7 @@   <key>PathfindingConnectedEdge</key>      <map>        <key>Comment</key> -      <string>yay!</string> +      <string>Connected edge color</string>        <key>Persist</key>        <integer>1</integer>        <key>Type</key> @@ -13615,7 +13615,7 @@   <key>PathfindingBoundaryEdge</key>      <map>        <key>Comment</key> -      <string>yay!</string> +      <string>Boundary edge color</string>        <key>Persist</key>        <integer>1</integer>        <key>Type</key> @@ -13631,7 +13631,7 @@   <key>PathfindingHeatColorBase</key>      <map>        <key>Comment</key> -      <string>yay!</string> +      <string>Least walkable heat map color</string>        <key>Persist</key>        <integer>1</integer>        <key>Type</key> @@ -13647,7 +13647,7 @@   <key>PathfindingHeatColorMax</key>      <map>        <key>Comment</key> -      <string>yay!</string> +      <string>Most walkable heat map color</string>        <key>Persist</key>        <integer>1</integer>        <key>Type</key> @@ -13663,7 +13663,7 @@    <key>PathfindingFaceColor</key>      <map>        <key>Comment</key> -      <string>yay!</string> +      <string>Nav mesh color?</string>        <key>Persist</key>        <integer>1</integer>        <key>Type</key> @@ -13724,6 +13724,66 @@          <real>1.0</real>        </array>      </map> +  <key>PathfindingAmbiance</key> +  <map> +    <key>Comment</key> +    <string>Ambiance of lit pathfinding displays.</string> +    <key>Persist</key> +    <integer>0</integer> +    <key>Type</key> +    <string>F32</string> +    <key>Value</key> +    <real>0.5</real> +  </map> + +  <key>PathfindingXRayTint</key> +  <map> +    <key>Comment</key> +    <string>Amount to darken/lighten x-ray lines in pathfinding display</string> +    <key>Persist</key> +    <integer>0</integer> +    <key>Type</key> +    <string>F32</string> +    <key>Value</key> +    <real>0.8</real> +  </map> + +  <key>PathfindingXRayOpacity</key> +  <map> +    <key>Comment</key> +    <string>Opacity of xray lines in pathfinding display.</string> +    <key>Persist</key> +    <integer>0</integer> +    <key>Type</key> +    <string>F32</string> +    <key>Value</key> +    <real>0.25</real> +  </map> + +  <key>PathfindingLineWidth</key> +  <map> +    <key>Comment</key> +    <string>Width of volume outlines in pathfinding display.</string> +    <key>Persist</key> +    <integer>0</integer> +    <key>Type</key> +    <string>F32</string> +    <key>Value</key> +    <real>2.0</real> +  </map> + +  <key>PathfindingLineOffset</key> +  <map> +    <key>Comment</key> +    <string>Depth offset of volume outlines in pathfinding display.</string> +    <key>Persist</key> +    <integer>0</integer> +    <key>Type</key> +    <string>F32</string> +    <key>Value</key> +    <real>1.6</real> +  </map> +    <key>PathfindingDisablePermanentObjects</key>    <map>      <key>Comment</key> @@ -13746,5 +13806,7 @@      <key>Value</key>      <integer>0</integer>    </map> - </map> +   + +</map>  </llsd> diff --git a/indra/newview/app_settings/shaders/class1/interface/pathfindingV.glsl b/indra/newview/app_settings/shaders/class1/interface/pathfindingV.glsl index dc9fefd156..31e878ebc6 100644 --- a/indra/newview/app_settings/shaders/class1/interface/pathfindingV.glsl +++ b/indra/newview/app_settings/shaders/class1/interface/pathfindingV.glsl @@ -27,14 +27,28 @@ uniform mat4 modelview_projection_matrix;  ATTRIBUTE vec3 position;  ATTRIBUTE vec4 diffuse_color; +ATTRIBUTE vec3 normal;  VARYING vec4 vertex_color;  uniform float tint; - +uniform float ambiance; +uniform float alpha_scale; +   void main()  {  	gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0); -	vertex_color = diffuse_color * tint; + +	vec3 l1 = vec3(-0.75, 1, 1.0); +	vec3 l2 = vec3(0.5, -0.6, 0.4)*0.25; +	vec3 l3 = vec3(0.5, -0.8, 0.3)*0.5; + +	float lit = max(dot(normal, l1), 0.0); +	lit += max(dot(normal, l2), 0.0); +	lit += max(dot(normal, l3), 0.0); + +	lit = clamp(lit, ambiance, 1.0); +	 +	vertex_color = vec4(diffuse_color.rgb * tint * lit, diffuse_color.a*alpha_scale);  } diff --git a/indra/newview/llfloaterpathfindingconsole.cpp b/indra/newview/llfloaterpathfindingconsole.cpp index a274251fb8..c981ca6c5d 100644 --- a/indra/newview/llfloaterpathfindingconsole.cpp +++ b/indra/newview/llfloaterpathfindingconsole.cpp @@ -96,6 +96,10 @@ BOOL LLFloaterPathfindingConsole::postBuild()  	llassert(mShowWorldCheckBox != NULL);  	mShowWorldCheckBox->setCommitCallback(boost::bind(&LLFloaterPathfindingConsole::onShowWorldToggle, this)); +	mShowXRayCheckBox = findChild<LLCheckBoxCtrl>("x-ray"); +	llassert(mShowXRayCheckBox != NULL); +	mShowXRayCheckBox->setCommitCallback(boost::bind(&LLFloaterPathfindingConsole::onShowXRayToggle, this)); +  	mViewCharactersButton = findChild<LLButton>("view_characters_floater");  	llassert(mViewCharactersButton != NULL);  	mViewCharactersButton->setCommitCallback(boost::bind(&LLFloaterPathfindingConsole::onViewCharactersClicked, this)); @@ -219,6 +223,7 @@ void LLFloaterPathfindingConsole::onClose(bool pIsAppQuitting)  	mShowStaticObstaclesCheckBox->set( false );  	mShowExclusionVolumesCheckBox->set( false );  	mShowWorldCheckBox->set( false );	 +	mShowXRayCheckBox->set(false);  }  BOOL LLFloaterPathfindingConsole::handleAnyMouseClick(S32 x, S32 y, MASK mask, EClickType clicktype, BOOL down) @@ -340,6 +345,17 @@ void LLFloaterPathfindingConsole::setRenderWorld(BOOL pIsRenderWorld)  	mShowWorldCheckBox->set(pIsRenderWorld);  } +BOOL LLFloaterPathfindingConsole::isRenderXRay() const +{ +	return mShowXRayCheckBox->get(); +} + +void LLFloaterPathfindingConsole::setRenderXRay(BOOL pIsRenderXRay) +{ +	mShowXRayCheckBox->set(pIsRenderXRay); +} + +  LLFloaterPathfindingConsole::ERenderHeatmapType LLFloaterPathfindingConsole::getRenderHeatmapType() const  {  	ERenderHeatmapType renderHeatmapType; @@ -593,6 +609,12 @@ void LLFloaterPathfindingConsole::onShowWorldToggle()  	}  } +void LLFloaterPathfindingConsole::onShowXRayToggle() +{ +	//nothing to do (xray parameter not stored in pathing lib +} + +  void LLFloaterPathfindingConsole::onCharacterWidthSet()  {  	generatePath(); diff --git a/indra/newview/llfloaterpathfindingconsole.h b/indra/newview/llfloaterpathfindingconsole.h index d63b69abd4..7633bce9be 100644 --- a/indra/newview/llfloaterpathfindingconsole.h +++ b/indra/newview/llfloaterpathfindingconsole.h @@ -96,6 +96,9 @@ public:  	BOOL isRenderWorld() const;  	void setRenderWorld(BOOL pIsRenderWorld); + +	BOOL isRenderXRay() const; +	void setRenderXRay(BOOL pIsRenderXRay);  	BOOL isRenderAnyShapes() const;  	U32  getRenderShapeFlags(); @@ -135,6 +138,7 @@ private:  	void onShowWalkabilitySet();  	void onShowWorldToggle(); +	void onShowXRayToggle();  	void onCharacterWidthSet();  	void onCharacterTypeSwitch();  	void onViewCharactersClicked(); @@ -167,6 +171,7 @@ private:  	LLCheckBoxCtrl                                *mShowMaterialVolumesCheckBox;  	LLCheckBoxCtrl                                *mShowExclusionVolumesCheckBox;  	LLCheckBoxCtrl                                *mShowWorldCheckBox; +	LLCheckBoxCtrl								  *mShowXRayCheckBox;  	LLTextBase                                    *mPathfindingViewerStatus;  	LLTextBase                                    *mPathfindingSimulatorStatus;  	LLButton                                      *mViewCharactersButton; diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index d46dc242be..c1b0e6736f 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -4322,6 +4322,10 @@ void LLPipeline::renderDebug()  		if (LLGLSLShader::sNoFixedFunction)  		{  			gPathfindingProgram.bind(); +			 +			gPathfindingProgram.uniform1f("tint", 1.f); +			gPathfindingProgram.uniform1f("ambiance", 1.f); +			gPathfindingProgram.uniform1f("alpha_scale", 1.f);  		} @@ -4338,11 +4342,10 @@ void LLPipeline::renderDebug()  				LLFloaterPathfindingConsole *pathfindingConsole = pathfindingConsoleHandle.get();  				//NavMesh  				if ( pathfindingConsole->isRenderNavMesh() ) -				{				 -				gPathfindingProgram.uniform1f("tint", 1.f); +				{	gGL.flush();  					glLineWidth(2.0f);	  					LLGLEnable cull(GL_CULL_FACE); -					LLGLEnable blend(GL_BLEND); +					LLGLDisable blend(GL_BLEND);  					if ( pathfindingConsole->isRenderWorld() )  					{					  						glPolygonMode( GL_FRONT_AND_BACK, GL_LINE );	 @@ -4354,54 +4357,78 @@ void LLPipeline::renderDebug()  						glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);					  						glPolygonMode( GL_FRONT_AND_BACK, GL_FILL );	  					} +								  					int materialIndex = pathfindingConsole->getHeatMapType();  					llPathingLibInstance->renderNavMesh( materialIndex ); +					gGL.flush();  					glPolygonMode( GL_FRONT_AND_BACK, GL_FILL );	  					glLineWidth(1.0f);	  					gGL.flush();  				}  				//physics/exclusion shapes  				if ( pathfindingConsole->isRenderAnyShapes() ) -				{					 -				gPathfindingProgram.uniform1f("tint", 1.f); -				gGL.flush(); -				glPolygonMode( GL_FRONT_AND_BACK, GL_FILL );	 -				//render to depth first to avoid blending artifacts -				gGL.setColorMask(false, false); -				llPathingLibInstance->renderNavMeshShapesVBO( pathfindingConsole->getRenderShapeFlags() );		 -				gGL.setColorMask(true, false); - -				LLGLEnable blend(GL_BLEND); +				{	 +					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); +					glPolygonOffset(1.0f, 1.0f); -					{ //draw solid overlay -						LLGLDepthTest depth(GL_TRUE, GL_FALSE, GL_LEQUAL); -						llPathingLibInstance->renderNavMeshShapesVBO( pathfindingConsole->getRenderShapeFlags() );				 -						gGL.flush();				 -					} +					//render to depth first to avoid blending artifacts +					gGL.setColorMask(false, false); +					llPathingLibInstance->renderNavMeshShapesVBO( pathfindingConsole->getRenderShapeFlags() );		 +					gGL.setColorMask(true, false); + +					//get rid of some z-fighting +					glPolygonOffset(0.f, 0.f); + +					LLGLEnable blend(GL_BLEND); -					glPolygonMode( GL_FRONT_AND_BACK, GL_LINE );	 +					{ +						F32 ambiance = gSavedSettings.getF32("PathfindingAmbiance"); -					{ //draw hidden wireframe as darker and less opaque -						gPathfindingProgram.uniform1f("tint", 0.25f); -						LLGLEnable blend(GL_BLEND); -						LLGLDepthTest depth(GL_TRUE, GL_FALSE, GL_GREATER); -						llPathingLibInstance->renderNavMeshShapesVBO( pathfindingConsole->getRenderShapeFlags() );				 -					} +						gPathfindingProgram.uniform1f("ambiance", ambiance); -					{ //draw visible wireframe as brighter and more opaque -						gPathfindingProgram.uniform1f("tint", 1.f); -						LLGLDisable blendOut(GL_BLEND); -						llPathingLibInstance->renderNavMeshShapesVBO( pathfindingConsole->getRenderShapeFlags() );				 -						gGL.flush(); -					} +						{ //draw solid overlay +							LLGLDepthTest depth(GL_TRUE, GL_FALSE, GL_LEQUAL); +							llPathingLibInstance->renderNavMeshShapesVBO( pathfindingConsole->getRenderShapeFlags() );				 +							gGL.flush();				 +						} -					glPolygonMode( GL_FRONT_AND_BACK, GL_FILL ); -				} +						LLGLEnable lineOffset(GL_POLYGON_OFFSET_LINE); +						glPolygonMode( GL_FRONT_AND_BACK, GL_LINE );	 +						 +						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() );				 +							} +						} + +						{ //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); +						} +				 +						glPolygonMode( GL_FRONT_AND_BACK, GL_FILL ); +					}  				}	  				//User designated path  				if ( pathfindingConsole->isRenderPath() ) @@ -4414,7 +4441,7 @@ void LLPipeline::renderDebug()  		gGL.flush();  		if (LLGLSLShader::sNoFixedFunction)  		{ -			gUIProgram.unbind(); +			gPathfindingProgram.unbind();  		}  	} diff --git a/indra/newview/skins/default/xui/en/floater_pathfinding_console.xml b/indra/newview/skins/default/xui/en/floater_pathfinding_console.xml index adcd7f0fbf..f64349f47e 100644 --- a/indra/newview/skins/default/xui/en/floater_pathfinding_console.xml +++ b/indra/newview/skins/default/xui/en/floater_pathfinding_console.xml @@ -139,6 +139,14 @@        name="show_world"        top_pad="4"        width="90" /> +  <check_box +      height="19" +      label="X-Ray" +      layout="topleft" +      left="14" +      name="x-ray" +      top_pad="4" +      width="90" />    <view_border        bevel_style="none"        follows="top|left" | 
