summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
authorTodd Stinson <stinson@lindenlab.com>2012-04-05 12:16:42 -0700
committerTodd Stinson <stinson@lindenlab.com>2012-04-05 12:16:42 -0700
commit3d9374d1fd766f8724f801056b21651cbc244f69 (patch)
tree2d816b7024c5fb5a49113f7685abed618595dac2 /indra/newview
parent4e9d9ebe8a480ffdd9e069388c1e9845477f5f66 (diff)
parentc1dab242520b20394f9e0c1dd1652c74f925d6eb (diff)
Pull and merge from ssh://hg@bitbucket.org/stinson_linden/viewer-development-pf-xray.
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/app_settings/settings.xml347
-rw-r--r--indra/newview/app_settings/shaders/class1/interface/pathfindingF.glsl35
-rw-r--r--indra/newview/app_settings/shaders/class1/interface/pathfindingNoNormalV.glsl42
-rw-r--r--indra/newview/app_settings/shaders/class1/interface/pathfindingV.glsl54
-rw-r--r--indra/newview/llfloaterpathfindingconsole.cpp87
-rw-r--r--indra/newview/llfloaterpathfindingconsole.h5
-rw-r--r--indra/newview/llviewershadermgr.cpp24
-rw-r--r--indra/newview/llviewershadermgr.h2
-rw-r--r--indra/newview/pipeline.cpp243
-rw-r--r--indra/newview/skins/default/xui/en/floater_pathfinding_console.xml10
10 files changed, 582 insertions, 267 deletions
diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml
index 947561d454..ab119e37fa 100644
--- a/indra/newview/app_settings/settings.xml
+++ b/indra/newview/app_settings/settings.xml
@@ -13536,335 +13536,288 @@
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
- <integer>0</integer>
+ <integer>1</integer>
</map>
- <key>NavMeshClearRGB</key>
+ <key>PathfindingNavMeshClear</key>
<map>
<key>Comment</key>
- <string>yay!</string>
+ <string>Background color</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
- <string>Vector3</string>
+ <string>Color4</string>
<key>Value</key>
<array>
- <real>0.5</real>
- <real>0.5</real>
- <real>0.5</real>
+ <real>0</real>
+ <real>0</real>
+ <real>0</real>
+ <real>1.0</real>
</array>
</map>
- <key>WalkableRGB</key>
+ <key>PathfindingWalkable</key>
<map>
<key>Comment</key>
- <string>yay!</string>
+ <string>Walkable color</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
- <string>Vector3</string>
+ <string>Color4</string>
<key>Value</key>
<array>
- <real>0.0</real>
- <real>255.0</real>
- <real>0.0</real>
+ <real>0.5</real>
+ <real>0.5</real>
+ <real>0.5</real>
+ <real>1.0</real>
</array>
</map>
- <key>WalkableA</key>
+ <key>PathfindingObstacle</key>
<map>
<key>Comment</key>
- <string>yay!</string>
+ <string>Obstacle color</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
- <string>F32</string>
- <key>Value</key>
- <real>75</real>
- </map>
- <key>ObstacleRGB</key>
- <map>
- <key>Comment</key>
- <string>yay!</string>
- <key>Persist</key>
- <integer>1</integer>
- <key>Type</key>
- <string>Vector3</string>
+ <string>Color4</string>
<key>Value</key>
<array>
- <real>255.0</real>
+ <real>1.0</real>
<real>0.0</real>
<real>0.0</real>
+ <real>1.0</real>
</array>
</map>
- <key>ObstacleA</key>
+ <key>PathfindingMaterial</key>
<map>
<key>Comment</key>
- <string>yay!</string>
+ <string>Material volume color</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
- <string>F32</string>
- <key>Value</key>
- <real>75</real>
- </map>
- <key>MaterialRGB</key>
- <map>
- <key>Comment</key>
- <string>yay!</string>
- <key>Persist</key>
- <integer>1</integer>
- <key>Type</key>
- <string>Vector3</string>
+ <string>Color4</string>
<key>Value</key>
<array>
- <real>128.0</real>
+ <real>0.5</real>
<real>0.0</real>
- <real>255.0</real>
+ <real>1.0</real>
+ <real>0.3</real>
</array>
</map>
- <key>MaterialA</key>
+ <key>PathfindingExclusion</key>
<map>
<key>Comment</key>
- <string>yay!</string>
+ <string>Exclusion volume color</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
- <string>F32</string>
- <key>Value</key>
- <real>75</real>
- </map>
- <key>ExclusionRGB</key>
- <map>
- <key>Comment</key>
- <string>yay!</string>
- <key>Persist</key>
- <integer>1</integer>
- <key>Type</key>
- <string>Vector3</string>
+ <string>Color4</string>
<key>Value</key>
<array>
- <real>255.0</real>
- <real>255.0</real>
- <real>0.0</real>
+ <real>1.0</real>
+ <real>0.01</real>
+ <real>0.1</real>
+ <real>0.3</real>
</array>
</map>
- <key>ExclusionA</key>
- <map>
- <key>Comment</key>
- <string>yay!</string>
- <key>Persist</key>
- <integer>1</integer>
- <key>Type</key>
- <string>F32</string>
- <key>Value</key>
- <real>75</real>
- </map>
-<key>ConnectedEdgeRGB</key>
+ <key>PathfindingConnectedEdge</key>
<map>
<key>Comment</key>
- <string>yay!</string>
+ <string>Connected edge color</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
- <string>Vector3</string>
+ <string>Color4</string>
<key>Value</key>
<array>
- <real>220.0</real>
- <real>220.0</real>
- <real>220.0</real>
+ <real>0.86</real>
+ <real>0.86</real>
+ <real>0.86</real>
+ <real>1.0</real>
</array>
</map>
- <key>ConnectedEdgeA</key>
+ <key>PathfindingBoundaryEdge</key>
<map>
<key>Comment</key>
- <string>yay!</string>
+ <string>Boundary edge color</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
- <string>F32</string>
- <key>Value</key>
- <real>255</real>
- </map>
-<key>BoundaryEdgeRGB</key>
- <map>
- <key>Comment</key>
- <string>yay!</string>
- <key>Persist</key>
- <integer>1</integer>
- <key>Type</key>
- <string>Vector3</string>
+ <string>Color4</string>
<key>Value</key>
<array>
- <real>255.0</real>
+ <real>1.0</real>
<real>0.0</real>
<real>0.0</real>
+ <real>1.0</real>
</array>
</map>
- <key>BoundaryEdgeA</key>
+ <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>
- <string>F32</string>
- <key>Value</key>
- <real>255</real>
- </map>
-<key>HeatColorBase</key>
- <map>
- <key>Comment</key>
- <string>yay!</string>
- <key>Persist</key>
- <integer>1</integer>
- <key>Type</key>
- <string>Vector3</string>
+ <string>Color4</string>
<key>Value</key>
<array>
+ <real>1.0</real>
<real>0.0</real>
+ <real>0.07</real>
<real>1.0</real>
- <real>0.5</real>
</array>
</map>
- <key>HeatColorBaseA</key>
- <map>
- <key>Comment</key>
- <string>yay!</string>
- <key>Persist</key>
- <integer>1</integer>
- <key>Type</key>
- <string>F32</string>
- <key>Value</key>
- <real>1.0</real>
- </map>
-<key>HeatColorMax</key>
+ <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>
- <string>Vector3</string>
+ <string>Color4</string>
<key>Value</key>
<array>
- <real>0.0</real>
<real>1.0</real>
+ <real>0.93</real>
+ <real>0.936</real>
<real>1.0</real>
</array>
</map>
- <key>HeatColorMaxA</key>
- <map>
- <key>Comment</key>
- <string>yay!</string>
- <key>Persist</key>
- <integer>1</integer>
- <key>Type</key>
- <string>F32</string>
- <key>Value</key>
- <real>1.0</real>
- </map>
- <key>FaceColorRGB</key>
+ <key>PathfindingFaceColor</key>
<map>
<key>Comment</key>
- <string>yay!</string>
+ <string>Nav mesh color?</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
- <string>Vector3</string>
+ <string>Color4</string>
<key>Value</key>
<array>
- <real>255.0</real>
- <real>255.0</real>
- <real>255.0</real>
+ <real>1.0</real>
+ <real>1.0</real>
+ <real>1.0</real>
+ <real>1.0</real>
</array>
</map>
- <key>FaceColorA</key>
+ <key>PathfindingStarValidColor</key>
<map>
<key>Comment</key>
<string>yay!</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
- <string>F32</string>
- <key>Value</key>
- <real>255</real>
- </map>
- <key>StarValidColorRGB</key>
- <map>
- <key>Comment</key>
- <string>yay!</string>
- <key>Persist</key>
- <integer>1</integer>
- <key>Type</key>
- <string>Vector3</string>
+ <string>Color4</string>
<key>Value</key>
<array>
- <real>200.0</real>
- <real>120.0</real>
+ <real>0.78</real>
+ <real>0.47</real>
<real>0.0</real>
+ <real>1.0</real>
</array>
</map>
- <key>StarValidColorA</key>
+ <key>PathfindingStarInvalidColor</key>
<map>
<key>Comment</key>
<string>yay!</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
- <string>F32</string>
- <key>Value</key>
- <real>255</real>
- </map>
- <key>StarInvalidRGB</key>
- <map>
- <key>Comment</key>
- <string>yay!</string>
- <key>Persist</key>
- <integer>1</integer>
- <key>Type</key>
- <string>Vector3</string>
+ <string>Color4</string>
<key>Value</key>
<array>
- <real>255.0</real>
+ <real>1.0</real>
<real>0.0</real>
- <real>255.0</real>
+ <real>1.0</real>
+ <real>1.0</real>
</array>
</map>
- <key>StarInvalidA</key>
- <map>
- <key>Comment</key>
- <string>yay!</string>
- <key>Persist</key>
- <integer>1</integer>
- <key>Type</key>
- <string>F32</string>
- <key>Value</key>
- <real>255</real>
- </map>
- <key>TestPathColorRGB</key>
+ <key>PathfindingTestPathColor</key>
<map>
<key>Comment</key>
<string>yay!</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
- <string>Vector3</string>
+ <string>Color4</string>
<key>Value</key>
<array>
- <real>255.0</real>
- <real>150.0</real>
+ <real>1.0</real>
+ <real>0.59</real>
<real>0.0</real>
+ <real>1.0</real>
</array>
</map>
- <key>TestPathColorA</key>
- <map>
- <key>Comment</key>
- <string>yay!</string>
- <key>Persist</key>
- <integer>1</integer>
- <key>Type</key>
- <string>F32</string>
- <key>Value</key>
- <real>255</real>
- </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>PathfindingXRayWireframe</key>
+ <map>
+ <key>Comment</key>
+ <string>Render pathfinding xray as a wireframe.</string>
+ <key>Persist</key>
+ <integer>0</integer>
+ <key>Type</key>
+ <string>Boolean</string>
+ <key>Value</key>
+ <integer>0</integer>
+ </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>2.3</real>
+ </map>
+
<key>PathfindingDisablePermanentObjects</key>
<map>
<key>Comment</key>
@@ -13887,5 +13840,7 @@
<key>Value</key>
<integer>0</integer>
</map>
+
+
</map>
</llsd>
diff --git a/indra/newview/app_settings/shaders/class1/interface/pathfindingF.glsl b/indra/newview/app_settings/shaders/class1/interface/pathfindingF.glsl
new file mode 100644
index 0000000000..40605bee78
--- /dev/null
+++ b/indra/newview/app_settings/shaders/class1/interface/pathfindingF.glsl
@@ -0,0 +1,35 @@
+/**
+ * @file pathfindingF.glsl
+ *
+ * $LicenseInfo:firstyear=2007&license=viewerlgpl$
+ * Second Life Viewer Source Code
+ * Copyright (C) 2007, Linden Research, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * version 2.1 of the License only.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
+ * $/LicenseInfo$
+ */
+
+#ifdef DEFINE_GL_FRAGCOLOR
+out vec4 gl_FragColor;
+#endif
+
+VARYING vec4 vertex_color;
+
+void main()
+{
+ gl_FragColor = vertex_color;
+}
diff --git a/indra/newview/app_settings/shaders/class1/interface/pathfindingNoNormalV.glsl b/indra/newview/app_settings/shaders/class1/interface/pathfindingNoNormalV.glsl
new file mode 100644
index 0000000000..19fa607307
--- /dev/null
+++ b/indra/newview/app_settings/shaders/class1/interface/pathfindingNoNormalV.glsl
@@ -0,0 +1,42 @@
+/**
+ * @file pathfindingV.glsl
+ *
+ * $LicenseInfo:firstyear=2007&license=viewerlgpl$
+ * Second Life Viewer Source Code
+ * Copyright (C) 2007, Linden Research, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * version 2.1 of the License only.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
+ * $/LicenseInfo$
+ */
+
+uniform mat4 modelview_projection_matrix;
+
+ATTRIBUTE vec3 position;
+ATTRIBUTE vec4 diffuse_color;
+
+VARYING vec4 vertex_color;
+
+uniform float tint;
+uniform float alpha_scale;
+
+void main()
+{
+ gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0);
+
+ vertex_color = vec4(diffuse_color.rgb * tint, diffuse_color.a*alpha_scale);
+}
+
diff --git a/indra/newview/app_settings/shaders/class1/interface/pathfindingV.glsl b/indra/newview/app_settings/shaders/class1/interface/pathfindingV.glsl
new file mode 100644
index 0000000000..91f252cf1e
--- /dev/null
+++ b/indra/newview/app_settings/shaders/class1/interface/pathfindingV.glsl
@@ -0,0 +1,54 @@
+/**
+ * @file pathfindingV.glsl
+ *
+ * $LicenseInfo:firstyear=2007&license=viewerlgpl$
+ * Second Life Viewer Source Code
+ * Copyright (C) 2007, Linden Research, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * version 2.1 of the License only.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
+ * $/LicenseInfo$
+ */
+
+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);
+
+ vec3 l1 = vec3(-0.75, 1, 1.0)*0.5;
+ 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 d1606cbd49..d0e047d48b 100644
--- a/indra/newview/llfloaterpathfindingconsole.cpp
+++ b/indra/newview/llfloaterpathfindingconsole.cpp
@@ -97,6 +97,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));
@@ -225,6 +229,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)
@@ -346,6 +351,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;
@@ -373,6 +389,7 @@ LLFloaterPathfindingConsole::ERenderHeatmapType LLFloaterPathfindingConsole::get
break;
}
+ LLPathingLib::getInstance()->rebuildNavMesh( getHeatMapType() );
return renderHeatmapType;
}
@@ -599,6 +616,12 @@ void LLFloaterPathfindingConsole::onShowWorldToggle()
}
}
+void LLFloaterPathfindingConsole::onShowXRayToggle()
+{
+ //nothing to do (xray parameter not stored in pathing lib
+}
+
+
void LLFloaterPathfindingConsole::onCharacterWidthSet()
{
generatePath();
@@ -1025,56 +1048,44 @@ void LLFloaterPathfindingConsole::fillInColorsForNavMeshVisualization()
LLPathingLib::NavMeshColors colors;
- LLVector3 in = gSavedSettings.getVector3("WalkableRGB");
- F32 a = gSavedSettings.getF32("WalkableA");
- colors.mWalkable= LLColor4U( (U8)in[0],(U8)in[1],(U8)in[2],(U8)a );
+ LLColor4 in = gSavedSettings.getColor4("PathfindingWalkable");
+ colors.mWalkable= LLColor4U(in);
- in = gSavedSettings.getVector3("ObstacleRGB");
- a = gSavedSettings.getF32("ObstacleA");
- colors.mObstacle= LLColor4U( (U8)in[0],(U8)in[1],(U8)in[2],(U8)a );
+ in = gSavedSettings.getColor4("PathfindingObstacle");
+ colors.mObstacle= LLColor4U(in);
- in = gSavedSettings.getVector3("MaterialRGB");
- a = gSavedSettings.getF32("MaterialA");
- colors.mMaterial= LLColor4U( (U8)in[0],(U8)in[1],(U8)in[2],(U8)a );
+ in = gSavedSettings.getColor4("PathfindingMaterial");
+ colors.mMaterial= LLColor4U(in);
- in = gSavedSettings.getVector3("ExclusionRGB");
- a = gSavedSettings.getF32("ExclusionA");
- colors.mExclusion= LLColor4U( (U8)in[0],(U8)in[1],(U8)in[2],(U8)a );
+ in = gSavedSettings.getColor4("PathfindingExclusion");
+ colors.mExclusion= LLColor4U(in);
- in = gSavedSettings.getVector3("ConnectedEdgeRGB");
- a = gSavedSettings.getF32("ConnectedEdgeA");
- colors.mConnectedEdge= LLColor4U( (U8)in[0],(U8)in[1],(U8)in[2],(U8)a );
+ in = gSavedSettings.getColor4("PathfindingConnectedEdge");
+ colors.mConnectedEdge= LLColor4U(in);
- in = gSavedSettings.getVector3("BoundaryEdgeRGB");
- a = gSavedSettings.getF32("BoundaryEdgeA");
- colors.mBoundaryEdge= LLColor4U( (U8)in[0],(U8)in[1],(U8)in[2],(U8)a );
+ in = gSavedSettings.getColor4("PathfindingBoundaryEdge");
+ colors.mBoundaryEdge= LLColor4U(in);
- in = gSavedSettings.getVector3("HeatColorBase");
- a = gSavedSettings.getF32("HeatColorBaseA");
- colors.mHeatColorBase= LLVector4(in, a);
+ in = gSavedSettings.getColor4("PathfindingHeatColorBase");
+ colors.mHeatColorBase= LLVector4(in.mV);
- in = gSavedSettings.getVector3("HeatColorMax");
- a = gSavedSettings.getF32("HeatColorMaxA");
- colors.mHeatColorMax= LLVector4( in, a );
+ in = gSavedSettings.getColor4("PathfindingHeatColorMax");
+ colors.mHeatColorMax= LLVector4( in.mV );
- in = gSavedSettings.getVector3("FaceColorRGB");
- a = gSavedSettings.getF32("FaceColorA");
- colors.mFaceColor= LLColor4U( (U8)in[0],(U8)in[1],(U8)in[2],(U8)a );
+ in = gSavedSettings.getColor4("PathfindingFaceColor");
+ colors.mFaceColor= LLColor4U(in);
- in = gSavedSettings.getVector3("StarValidColorRGB");
- a = gSavedSettings.getF32("StarValidColorA");
- colors.mStarValid= LLColor4U( (U8)in[0],(U8)in[1],(U8)in[2],(U8)a );
+ in = gSavedSettings.getColor4("PathfindingStarValidColor");
+ colors.mStarValid= LLColor4U(in);
- in = gSavedSettings.getVector3("StarInvalidRGB");
- a = gSavedSettings.getF32("StarInvalidA");
- colors.mStarInvalid= LLColor4U( (U8)in[0],(U8)in[1],(U8)in[2],(U8)a );
+ in = gSavedSettings.getColor4("PathfindingStarInvalidColor");
+ colors.mStarInvalid= LLColor4U(in);
- in = gSavedSettings.getVector3("TestPathColorRGB");
- a = gSavedSettings.getF32("TestPathColorA");
- colors.mTestPath= LLColor4U( (U8)in[0],(U8)in[1],(U8)in[2],(U8)a );
+ in = gSavedSettings.getColor4("PathfindingTestPathColor");
+ colors.mTestPath= LLColor4U(in);
- in = gSavedSettings.getVector3("NavMeshClearRGB");
- colors.mNavMeshClear= LLColor4(in[0], in[1], in[2], 0);
+ in = gSavedSettings.getColor4("PathfindingNavMeshClear");
+ colors.mNavMeshClear= LLColor4(in);
mNavMeshColors = colors;
diff --git a/indra/newview/llfloaterpathfindingconsole.h b/indra/newview/llfloaterpathfindingconsole.h
index 0aff0a8f73..c810119958 100644
--- a/indra/newview/llfloaterpathfindingconsole.h
+++ b/indra/newview/llfloaterpathfindingconsole.h
@@ -99,6 +99,9 @@ public:
BOOL isRenderWorld() const;
void setRenderWorld(BOOL pIsRenderWorld);
+ BOOL isRenderXRay() const;
+ void setRenderXRay(BOOL pIsRenderXRay);
+
BOOL isRenderAnyShapes() const;
U32 getRenderShapeFlags();
@@ -134,6 +137,7 @@ private:
void onShowWalkabilitySet();
void onShowWorldToggle();
+ void onShowXRayToggle();
void onCharacterWidthSet();
void onCharacterTypeSwitch();
void onViewCharactersClicked();
@@ -169,6 +173,7 @@ private:
LLCheckBoxCtrl *mShowMaterialVolumesCheckBox;
LLCheckBoxCtrl *mShowExclusionVolumesCheckBox;
LLCheckBoxCtrl *mShowWorldCheckBox;
+ LLCheckBoxCtrl *mShowXRayCheckBox;
LLTextBase *mPathfindingViewerStatus;
LLTextBase *mPathfindingSimulatorStatus;
LLButton *mViewCharactersButton;
diff --git a/indra/newview/llviewershadermgr.cpp b/indra/newview/llviewershadermgr.cpp
index 10c61c01d5..b2ffb068ff 100644
--- a/indra/newview/llviewershadermgr.cpp
+++ b/indra/newview/llviewershadermgr.cpp
@@ -134,6 +134,8 @@ LLGLSLShader gUnderWaterProgram;
//interface shaders
LLGLSLShader gHighlightProgram;
+LLGLSLShader gPathfindingProgram;
+LLGLSLShader gPathfindingNoNormalsProgram;
//avatar shader handles
LLGLSLShader gAvatarProgram;
@@ -603,6 +605,8 @@ void LLViewerShaderMgr::unloadShaders()
gDebugProgram.unload();
gAlphaMaskProgram.unload();
gUIProgram.unload();
+ gPathfindingProgram.unload();
+ gPathfindingNoNormalsProgram.unload();
gCustomAlphaProgram.unload();
gGlowCombineProgram.unload();
gSplatTextureRectProgram.unload();
@@ -2529,6 +2533,26 @@ BOOL LLViewerShaderMgr::loadShadersInterface()
if (success)
{
+ gPathfindingProgram.mName = "Pathfinding Shader";
+ gPathfindingProgram.mShaderFiles.clear();
+ gPathfindingProgram.mShaderFiles.push_back(make_pair("interface/pathfindingV.glsl", GL_VERTEX_SHADER_ARB));
+ gPathfindingProgram.mShaderFiles.push_back(make_pair("interface/pathfindingF.glsl", GL_FRAGMENT_SHADER_ARB));
+ gPathfindingProgram.mShaderLevel = mVertexShaderLevel[SHADER_INTERFACE];
+ success = gPathfindingProgram.createShader(NULL, NULL);
+ }
+
+ if (success)
+ {
+ gPathfindingNoNormalsProgram.mName = "PathfindingNoNormals Shader";
+ gPathfindingNoNormalsProgram.mShaderFiles.clear();
+ gPathfindingNoNormalsProgram.mShaderFiles.push_back(make_pair("interface/pathfindingNoNormalV.glsl", GL_VERTEX_SHADER_ARB));
+ gPathfindingNoNormalsProgram.mShaderFiles.push_back(make_pair("interface/pathfindingF.glsl", GL_FRAGMENT_SHADER_ARB));
+ gPathfindingNoNormalsProgram.mShaderLevel = mVertexShaderLevel[SHADER_INTERFACE];
+ success = gPathfindingNoNormalsProgram.createShader(NULL, NULL);
+ }
+
+ if (success)
+ {
gCustomAlphaProgram.mName = "Custom Alpha Shader";
gCustomAlphaProgram.mShaderFiles.clear();
gCustomAlphaProgram.mShaderFiles.push_back(make_pair("interface/customalphaV.glsl", GL_VERTEX_SHADER_ARB));
diff --git a/indra/newview/llviewershadermgr.h b/indra/newview/llviewershadermgr.h
index 95eb551bf1..ceb14870d4 100644
--- a/indra/newview/llviewershadermgr.h
+++ b/indra/newview/llviewershadermgr.h
@@ -288,6 +288,8 @@ extern LLGLSLShader gGlowExtractProgram;
//interface shaders
extern LLGLSLShader gHighlightProgram;
+extern LLGLSLShader gPathfindingProgram;
+extern LLGLSLShader gPathfindingNoNormalsProgram;
// avatar shader handles
extern LLGLSLShader gAvatarProgram;
diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp
index 163421004a..c2eb579bb9 100644
--- a/indra/newview/pipeline.cpp
+++ b/indra/newview/pipeline.cpp
@@ -4323,20 +4323,11 @@ void LLPipeline::renderDebug()
LLMemType mt(LLMemType::MTYPE_PIPELINE);
assertInitialized();
-
+
bool hud_only = hasRenderType(LLPipeline::RENDER_TYPE_HUD);
if (!hud_only )
{
- if (LLGLSLShader::sNoFixedFunction)
- {
- gUIProgram.bind();
- }
-
-
- gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
- gPipeline.disableLights();
-
//Render any navmesh geometry
LLPathingLib *llPathingLibInstance = LLPathingLib::getInstance();
if ( llPathingLibInstance != NULL )
@@ -4345,54 +4336,242 @@ void LLPipeline::renderDebug()
if (!pathfindingConsoleHandle.isDead())
{
LLFloaterPathfindingConsole *pathfindingConsole = pathfindingConsoleHandle.get();
- //NavMesh
- if ( pathfindingConsole->isRenderNavMesh() )
+
+ if (pathfindingConsole->isShown())
{
- glLineWidth(2.0f);
- LLGLEnable cull(GL_CULL_FACE);
- LLGLEnable blend(GL_BLEND);
- if ( pathfindingConsole->isRenderWorld() )
+ F32 ambiance = gSavedSettings.getF32("PathfindingAmbiance");
+
+ if (LLGLSLShader::sNoFixedFunction)
{
- glPolygonMode( GL_FRONT_AND_BACK, GL_LINE );
+ gPathfindingProgram.bind();
+
+ gPathfindingProgram.uniform1f("tint", 1.f);
+ gPathfindingProgram.uniform1f("ambiance", ambiance);
+ gPathfindingProgram.uniform1f("alpha_scale", 1.f);
}
- else
+
+ if ( !pathfindingConsole->isRenderWorld() )
{
const LLColor4 &clearColor = pathfindingConsole->mNavMeshColors.mNavMeshClear;
+ gGL.setColorMask(true, true);
glClearColor(clearColor.mV[0],clearColor.mV[1],clearColor.mV[2],0);
glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
+ gGL.setColorMask(true, false);
glPolygonMode( GL_FRONT_AND_BACK, GL_FILL );
}
+
+ //NavMesh
+ if ( pathfindingConsole->isRenderNavMesh() )
+ { gGL.flush();
+ glLineWidth(2.0f);
+ LLGLEnable cull(GL_CULL_FACE);
+ LLGLDisable blend(GL_BLEND);
+
int materialIndex = pathfindingConsole->getHeatMapType();
+
+ if ( pathfindingConsole->isRenderWorld() )
+ {
+ LLGLEnable blend(GL_BLEND);
+ gPathfindingProgram.uniform1f("alpha_scale", 0.66f);
llPathingLibInstance->renderNavMesh( materialIndex );
+ }
+ else
+ {
+ llPathingLibInstance->renderNavMesh( materialIndex );
+ }
+
+ //render edges
+ if (LLGLSLShader::sNoFixedFunction)
+ {
+ gPathfindingNoNormalsProgram.bind();
+ gPathfindingNoNormalsProgram.uniform1f("tint", 1.f);
+ gPathfindingNoNormalsProgram.uniform1f("alpha_scale", 1.f);
+ llPathingLibInstance->renderNavMeshEdges( materialIndex );
+ gPathfindingProgram.bind();
+ }
+ else
+ {
+ llPathingLibInstance->renderNavMeshEdges( materialIndex );
+ }
+
+ gGL.flush();
glPolygonMode( GL_FRONT_AND_BACK, GL_FILL );
glLineWidth(1.0f);
gGL.flush();
}
+ //User designated path
+ if ( pathfindingConsole->isRenderPath() )
+ {
+ LLGLEnable blend(GL_BLEND);
+ if (LLGLSLShader::sNoFixedFunction)
+ {
+ gUIProgram.bind();
+ gGL.getTexUnit(0)->bind(LLViewerFetchedTexture::sWhiteImagep);
+ llPathingLibInstance->renderPath();
+ gPathfindingProgram.bind();
+ }
+ else
+ {
+ llPathingLibInstance->renderPath();
+ }
+ }
//physics/exclusion shapes
if ( pathfindingConsole->isRenderAnyShapes() )
{
+ 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;
+ }
+
+ //turn off backface culling for volumes so they are visible when camera is inside volume
+ LLGLDisable cull(i >= 2 ? GL_CULL_FACE : 0);
+
+ 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);
+
+ //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);
+
LLGLEnable blend(GL_BLEND);
+
+ {
+ gPathfindingProgram.uniform1f("ambiance", ambiance);
+
+ { //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 );
+
+ F32 offset = gSavedSettings.getF32("PathfindingLineOffset");
+
+ if (pathfindingConsole->isRenderXRay())
+ {
+ gPathfindingProgram.uniform1f("tint", gSavedSettings.getF32("PathfindingXRayTint"));
+ gPathfindingProgram.uniform1f("alpha_scale", gSavedSettings.getF32("PathfindingXRayOpacity"));
+ LLGLEnable blend(GL_BLEND);
+ LLGLDepthTest depth(GL_TRUE, GL_FALSE, GL_GREATER);
+
+ glPolygonOffset(offset, -offset);
+
+ if (gSavedSettings.getBOOL("PathfindingXRayWireframe"))
+ { //draw hidden wireframe as darker and less opaque
+ gPathfindingProgram.uniform1f("ambiance", 1.f);
+ llPathingLibInstance->renderNavMeshShapesVBO( render_order[i] );
+ }
+ else
+ {
glPolygonMode( GL_FRONT_AND_BACK, GL_FILL );
- llPathingLibInstance->renderNavMeshShapesVBO( pathfindingConsole->getRenderShapeFlags() );
+ gPathfindingProgram.uniform1f("ambiance", ambiance);
+ llPathingLibInstance->renderNavMeshShapesVBO( render_order[i] );
+ glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
+ }
+ }
+
+ { //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 );
+ }
+ }
+ }
+
+ glPolygonOffset(0.f, 0.f);
+
+ if ( pathfindingConsole->isRenderNavMesh() && pathfindingConsole->isRenderXRay() )
+ { //render navmesh xray
+ F32 ambiance = gSavedSettings.getF32("PathfindingAmbiance");
+
+ LLGLEnable lineOffset(GL_POLYGON_OFFSET_LINE);
+ LLGLEnable polyOffset(GL_POLYGON_OFFSET_FILL);
+
+ F32 offset = gSavedSettings.getF32("PathfindingLineOffset");
+ glPolygonOffset(offset, -offset);
+
+ LLGLEnable blend(GL_BLEND);
+ LLGLDepthTest depth(GL_TRUE, GL_FALSE, GL_GREATER);
gGL.flush();
- LLGLDisable blendOut(GL_BLEND);
+ glLineWidth(2.0f);
+ LLGLEnable cull(GL_CULL_FACE);
+
+ int materialIndex = pathfindingConsole->getHeatMapType();
+
+ gPathfindingProgram.uniform1f("tint", gSavedSettings.getF32("PathfindingXRayTint"));
+ gPathfindingProgram.uniform1f("alpha_scale", gSavedSettings.getF32("PathfindingXRayOpacity"));
+
+ if (gSavedSettings.getBOOL("PathfindingXRayWireframe"))
+ { //draw hidden wireframe as darker and less opaque
glPolygonMode( GL_FRONT_AND_BACK, GL_LINE );
- llPathingLibInstance->renderNavMeshShapesVBO( pathfindingConsole->getRenderShapeFlags() );
- gGL.flush();
+ gPathfindingProgram.uniform1f("ambiance", 1.f);
+ llPathingLibInstance->renderNavMesh( materialIndex );
glPolygonMode( GL_FRONT_AND_BACK, GL_FILL );
}
- //User designated path
- if ( pathfindingConsole->isRenderPath() )
+ else
+ {
+ gPathfindingProgram.uniform1f("ambiance", ambiance);
+ llPathingLibInstance->renderNavMesh( materialIndex );
+ }
+
+ //render edges
+ if (LLGLSLShader::sNoFixedFunction)
{
- LLGLEnable blend(GL_BLEND);
- llPathingLibInstance->renderPath();
+ gPathfindingNoNormalsProgram.bind();
+ gPathfindingNoNormalsProgram.uniform1f("tint", gSavedSettings.getF32("PathfindingXRayTint"));
+ gPathfindingNoNormalsProgram.uniform1f("alpha_scale", gSavedSettings.getF32("PathfindingXRayOpacity"));
+ llPathingLibInstance->renderNavMeshEdges( materialIndex );
+ gPathfindingProgram.bind();
}
+ else
+ {
+ llPathingLibInstance->renderNavMeshEdges( materialIndex );
}
+
+ gGL.flush();
+ glLineWidth(1.0f);
}
+
+ glPolygonOffset(0.f, 0.f);
+
gGL.flush();
if (LLGLSLShader::sNoFixedFunction)
{
- gUIProgram.unbind();
+ gPathfindingProgram.unbind();
+ }
+ }
+ }
}
}
@@ -4402,7 +4581,7 @@ void LLPipeline::renderDebug()
gGL.loadMatrix(gGLModelView);
gGL.setColorMask(true, false);
-
+
if (!hud_only && !mDebugBlips.empty())
{ //render debug blips
if (LLGLSLShader::sNoFixedFunction)
@@ -6891,7 +7070,7 @@ void LLPipeline::renderBloom(BOOL for_snapshot, F32 zoom_factor, int subfield)
mFXAABuffer.bindTexture(0, channel);
gGL.getTexUnit(channel)->setTextureFilteringOption(LLTexUnit::TFO_BILINEAR);
}
-
+
gGLViewport[0] = gViewerWindow->getWorldViewRectRaw().mLeft;
gGLViewport[1] = gViewerWindow->getWorldViewRectRaw().mBottom;
gGLViewport[2] = gViewerWindow->getWorldViewRectRaw().getWidth();
@@ -7543,7 +7722,7 @@ void LLPipeline::renderDeferredLighting()
F32 s = volume->getLightRadius()*1.5f;
LLColor3 col = volume->getLightColor();
-
+
if (col.magVecSquared() < 0.001f)
{
continue;
@@ -7656,7 +7835,7 @@ void LLPipeline::renderDeferredLighting()
setupSpotLight(gDeferredSpotLightProgram, drawablep);
LLColor3 col = volume->getLightColor();
-
+
//vertex positions are encoded so the 3 bits of their vertex index
//correspond to their axis facing, with bit position 3,2,1 matching
//axis facing x,y,z, bit set meaning positive facing, bit clear
@@ -7765,7 +7944,7 @@ void LLPipeline::renderDeferredLighting()
setupSpotLight(gDeferredMultiSpotLightProgram, drawablep);
LLColor3 col = volume->getLightColor();
-
+
gDeferredMultiSpotLightProgram.uniform3fv(LLShaderMgr::LIGHT_CENTER, 1, tc.v);
gDeferredMultiSpotLightProgram.uniform1f(LLShaderMgr::LIGHT_SIZE, s*s);
gDeferredMultiSpotLightProgram.uniform3fv(LLShaderMgr::DIFFUSE_COLOR, 1, col.mV);
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 d6435ab95d..d1bd1a02da 100644
--- a/indra/newview/skins/default/xui/en/floater_pathfinding_console.xml
+++ b/indra/newview/skins/default/xui/en/floater_pathfinding_console.xml
@@ -2,7 +2,7 @@
<floater
open_positioning="cascading"
can_tear_off="false"
- height="430"
+ height="448"
layout="topleft"
name="floater_pathfinding_console"
help_topic="floater_pathfinding_console"
@@ -138,6 +138,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"