summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
authorDave Parks <davep@lindenlab.com>2010-05-08 16:10:05 -0500
committerDave Parks <davep@lindenlab.com>2010-05-08 16:10:05 -0500
commit44e9e6d2310c598011d7af59ced43f32abbf68b0 (patch)
treec66ccf46be19681e9f7f3530eb0a048ed8962b9a /indra
parent7bb6532e93b7536a9a11cf19db10ba0cda1d99c3 (diff)
Physics shape fetching.
Diffstat (limited to 'indra')
-rw-r--r--indra/newview/llspatialpartition.cpp49
-rw-r--r--indra/newview/llviewermenu.cpp4
-rw-r--r--indra/newview/pipeline.h1
-rw-r--r--indra/newview/skins/default/xui/en/menu_viewer.xml10
4 files changed, 63 insertions, 1 deletions
diff --git a/indra/newview/llspatialpartition.cpp b/indra/newview/llspatialpartition.cpp
index 77c38798d1..6787018f5a 100644
--- a/indra/newview/llspatialpartition.cpp
+++ b/indra/newview/llspatialpartition.cpp
@@ -44,6 +44,7 @@
#include "llviewerregion.h"
#include "llcamera.h"
#include "pipeline.h"
+#include "llmeshrepository.h"
#include "llrender.h"
#include "lloctree.h"
#include "llvoavatar.h"
@@ -2658,6 +2659,46 @@ void renderBoundingBox(LLDrawable* drawable, BOOL set_color = TRUE)
}
+void renderPhysicsShape(LLDrawable* drawable)
+{
+ LLVOVolume* volume = drawable->getVOVolume();
+ if (volume)
+ {
+ if (volume->isMesh())
+ {
+ LLUUID mesh_id = volume->getVolume()->getParams().getSculptID();
+ const LLMeshDecomposition* decomp = gMeshRepo.getDecomposition(mesh_id);
+ if (decomp)
+ {
+ gGL.pushMatrix();
+ glLoadMatrixd(gGLModelView);
+ gGL.flush();
+ glPointSize(4.f);
+ gGL.begin(LLRender::POINTS);
+ static std::vector<LLColor4U> color;
+
+ for (U32 i = 0; i < decomp->mHull.size(); ++i)
+ {
+ if (color.size() <= i)
+ {
+ color.push_back(LLColor4U(rand()%128+127, rand()%128+127, rand()%128+127));
+ }
+ gGL.color4ubv(color[i].mV);
+ for (U32 j = 0; j < decomp->mHull[i].size(); ++j)
+ {
+ LLVector3 v = volume->volumePositionToAgent(decomp->mHull[i][j]);
+ gGL.vertex3fv(v.mV);
+ }
+ }
+ gGL.end();
+ gGL.flush();
+ gGL.popMatrix();
+ glPointSize(1.f);
+ }
+ }
+ }
+}
+
void renderTexturePriority(LLDrawable* drawable)
{
for (int face=0; face<drawable->getNumFaces(); ++face)
@@ -2974,6 +3015,11 @@ public:
renderBoundingBox(drawable);
}
+ if (gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_PHYSICS_SHAPES))
+ {
+ renderPhysicsShape(drawable);
+ }
+
if (gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_BUILD_QUEUE))
{
if (drawable->isState(LLDrawable::IN_REBUILD_Q2))
@@ -3173,7 +3219,8 @@ void LLSpatialPartition::renderDebug()
LLPipeline::RENDER_DEBUG_AVATAR_VOLUME |
LLPipeline::RENDER_DEBUG_AGENT_TARGET |
LLPipeline::RENDER_DEBUG_BUILD_QUEUE |
- LLPipeline::RENDER_DEBUG_SHADOW_FRUSTA))
+ LLPipeline::RENDER_DEBUG_SHADOW_FRUSTA |
+ LLPipeline::RENDER_DEBUG_PHYSICS_SHAPES))
{
return;
}
diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp
index b63ef921ac..04c1c64f8f 100644
--- a/indra/newview/llviewermenu.cpp
+++ b/indra/newview/llviewermenu.cpp
@@ -869,6 +869,10 @@ U32 info_display_from_string(std::string info_display)
{
return LLPipeline::RENDER_DEBUG_SHADOW_FRUSTA;
}
+ else if ("physics shapes" == info_display)
+ {
+ return LLPipeline::RENDER_DEBUG_PHYSICS_SHAPES;
+ }
else if ("occlusion" == info_display)
{
return LLPipeline::RENDER_DEBUG_OCCLUSION;
diff --git a/indra/newview/pipeline.h b/indra/newview/pipeline.h
index be878ae667..11c350000f 100644
--- a/indra/newview/pipeline.h
+++ b/indra/newview/pipeline.h
@@ -413,6 +413,7 @@ public:
RENDER_DEBUG_AVATAR_VOLUME = 0x0100000,
RENDER_DEBUG_BUILD_QUEUE = 0x0200000,
RENDER_DEBUG_AGENT_TARGET = 0x0400000,
+ RENDER_DEBUG_PHYSICS_SHAPES = 0x0800000,
};
public:
diff --git a/indra/newview/skins/default/xui/en/menu_viewer.xml b/indra/newview/skins/default/xui/en/menu_viewer.xml
index bdc171ea52..b540619431 100644
--- a/indra/newview/skins/default/xui/en/menu_viewer.xml
+++ b/indra/newview/skins/default/xui/en/menu_viewer.xml
@@ -1946,6 +1946,16 @@
parameter="shadow frusta" />
</menu_item_check>
<menu_item_check
+ label="Physics Shapes"
+ name="Physics Shapes">
+ <menu_item_check.on_check
+ function="Advanced.CheckInfoDisplay"
+ parameter="physics shapes" />
+ <menu_item_check.on_click
+ function="Advanced.ToggleInfoDisplay"
+ parameter="physics shapes" />
+ </menu_item_check>
+ <menu_item_check
label="Occlusion"
name="Occlusion">
<menu_item_check.on_check