diff options
author | Dave Parks <davep@lindenlab.com> | 2010-05-12 17:20:02 -0500 |
---|---|---|
committer | Dave Parks <davep@lindenlab.com> | 2010-05-12 17:20:02 -0500 |
commit | 2514a12c8c10fbadc1828802300a6f0755f2d9e6 (patch) | |
tree | b8d72c972c2e7149f161bfefb291495f4ad77eed /indra | |
parent | 3ad81349acccc9af2531121d5d6d89ad4e6ec0b2 (diff) | |
parent | b2906b594470ced996f102f4797eef7671ad009c (diff) |
merge
Diffstat (limited to 'indra')
-rw-r--r-- | indra/newview/llspatialpartition.cpp | 45 | ||||
-rw-r--r-- | indra/newview/llviewermenu.cpp | 4 | ||||
-rw-r--r-- | indra/newview/pipeline.h | 1 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/menu_viewer.xml | 10 |
4 files changed, 59 insertions, 1 deletions
diff --git a/indra/newview/llspatialpartition.cpp b/indra/newview/llspatialpartition.cpp index 77c38798d1..ed99f8648f 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,42 @@ 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(); + glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); + glMultMatrixf((F32*) volume->getRelativeXform().mMatrix); + 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)); + } + glColor4ubv(color[i].mV); + + LLVertexBuffer* buff = decomp->mMesh; + + buff->setBuffer(LLVertexBuffer::MAP_VERTEX); + buff->drawArrays(LLRender::TRIANGLES, 0, buff->getNumVerts()); + } + glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); + gGL.popMatrix(); + } + } + } +} + void renderTexturePriority(LLDrawable* drawable) { for (int face=0; face<drawable->getNumFaces(); ++face) @@ -2974,6 +3011,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 +3215,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 2c14b94847..fc6f96c668 100644 --- a/indra/newview/pipeline.h +++ b/indra/newview/pipeline.h @@ -431,6 +431,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 |