summaryrefslogtreecommitdiff
path: root/indra/newview/llspatialpartition.cpp
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/newview/llspatialpartition.cpp
parent7bb6532e93b7536a9a11cf19db10ba0cda1d99c3 (diff)
Physics shape fetching.
Diffstat (limited to 'indra/newview/llspatialpartition.cpp')
-rw-r--r--indra/newview/llspatialpartition.cpp49
1 files changed, 48 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;
}