diff options
author | Dave Parks <davep@lindenlab.com> | 2010-06-04 12:08:16 -0500 |
---|---|---|
committer | Dave Parks <davep@lindenlab.com> | 2010-06-04 12:08:16 -0500 |
commit | 9faf00b40f43a7c18afecc4b0f90070e15f8409b (patch) | |
tree | cb82c233ba742149dedaa8274d41288a1de61ec7 /indra/newview | |
parent | 83aed5b6b7aae32c48abcbd3a6bead6e2b099f7d (diff) | |
parent | a8f0e47fd5deee1e45b4126ee43955a7bc68bb5d (diff) |
merge
Diffstat (limited to 'indra/newview')
-rw-r--r-- | indra/newview/app_settings/settings.xml | 13 | ||||
-rw-r--r-- | indra/newview/llspatialpartition.cpp | 57 | ||||
-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 |
5 files changed, 83 insertions, 2 deletions
diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 9b7cc04120..a95100d9ba 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -6280,7 +6280,18 @@ <key>Value</key> <integer>0</integer> </map> - <key>RenderDebugPipeline</key> + <key>RenderDebugNormalScale</key> + <map> + <key>Comment</key> + <string>Scale of normals in debug display.</string> + <key>Persist</key> + <integer>1</integer> + <key>Type</key> + <string>F32</string> + <key>Value</key> + <real>0.03</real> + </map> + <key>RenderDebugPipeline</key> <map> <key>Comment</key> <string>Enable strict pipeline debugging.</string> diff --git a/indra/newview/llspatialpartition.cpp b/indra/newview/llspatialpartition.cpp index e5d0e064c6..d0e3a1428f 100644 --- a/indra/newview/llspatialpartition.cpp +++ b/indra/newview/llspatialpartition.cpp @@ -2704,7 +2704,56 @@ void renderBoundingBox(LLDrawable* drawable, BOOL set_color = TRUE) { drawBoxOutline(pos,size); } - +} + +void renderNormals(LLDrawable* drawablep) +{ + LLVertexBuffer::unbind(); + + LLVOVolume* vol = drawablep->getVOVolume(); + if (vol) + { + LLVolume* volume = vol->getVolume(); + gGL.pushMatrix(); + glMultMatrixf((F32*) vol->getRelativeXform().mMatrix); + + gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); + + LLVector4a scale(gSavedSettings.getF32("RenderDebugNormalScale")); + + for (S32 i = 0; i < volume->getNumVolumeFaces(); ++i) + { + const LLVolumeFace& face = volume->getVolumeFace(i); + + gGL.begin(LLRender::LINES); + + for (S32 j = 0; j < face.mNumVertices; ++j) + { + LLVector4a n,p; + + n.setMul(face.mNormals[j], scale); + p.setAdd(face.mPositions[j], n); + + gGL.color4f(1,1,1,1); + gGL.vertex3fv(face.mPositions[j].getF32()); + gGL.vertex3fv(p.getF32()); + + if (face.mBinormals) + { + n.setMul(face.mBinormals[j], scale); + p.setAdd(face.mPositions[j], n); + + gGL.color4f(0,1,1,1); + gGL.vertex3fv(face.mPositions[j].getF32()); + gGL.vertex3fv(p.getF32()); + } + } + + gGL.end(); + } + + gGL.popMatrix(); + } } void renderTexturePriority(LLDrawable* drawable) @@ -3081,6 +3130,11 @@ public: { renderBoundingBox(drawable); } + + if (gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_NORMALS)) + { + renderNormals(drawable); + } if (gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_BUILD_QUEUE)) { @@ -3280,6 +3334,7 @@ void LLSpatialPartition::renderDebug() LLPipeline::RENDER_DEBUG_LIGHTS | LLPipeline::RENDER_DEBUG_BATCH_SIZE | LLPipeline::RENDER_DEBUG_BBOXES | + LLPipeline::RENDER_DEBUG_NORMALS | LLPipeline::RENDER_DEBUG_POINTS | LLPipeline::RENDER_DEBUG_TEXTURE_PRIORITY | LLPipeline::RENDER_DEBUG_TEXTURE_ANIM | diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index b63ef921ac..eb2ee94af3 100644 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -857,6 +857,10 @@ U32 info_display_from_string(std::string info_display) { return LLPipeline::RENDER_DEBUG_BBOXES; } + else if ("normals" == info_display) + { + return LLPipeline::RENDER_DEBUG_NORMALS; + } else if ("points" == info_display) { return LLPipeline::RENDER_DEBUG_POINTS; diff --git a/indra/newview/pipeline.h b/indra/newview/pipeline.h index 52f943cd1d..4e8760947c 100644 --- a/indra/newview/pipeline.h +++ b/indra/newview/pipeline.h @@ -440,6 +440,7 @@ public: RENDER_DEBUG_AVATAR_VOLUME = 0x0100000, RENDER_DEBUG_BUILD_QUEUE = 0x0200000, RENDER_DEBUG_AGENT_TARGET = 0x0400000, + RENDER_DEBUG_NORMALS = 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..9cc1a481f5 100644 --- a/indra/newview/skins/default/xui/en/menu_viewer.xml +++ b/indra/newview/skins/default/xui/en/menu_viewer.xml @@ -1926,6 +1926,16 @@ parameter="bboxes" /> </menu_item_check> <menu_item_check + label="Normals" + name="Normals"> + <menu_item_check.on_check + function="Advanced.CheckInfoDisplay" + parameter="normals" /> + <menu_item_check.on_click + function="Advanced.ToggleInfoDisplay" + parameter="normals" /> + </menu_item_check> + <menu_item_check label="Octree" name="Octree"> <menu_item_check.on_check |