diff options
author | Dave Parks <davep@lindenlab.com> | 2010-06-04 12:07:55 -0500 |
---|---|---|
committer | Dave Parks <davep@lindenlab.com> | 2010-06-04 12:07:55 -0500 |
commit | a8f0e47fd5deee1e45b4126ee43955a7bc68bb5d (patch) | |
tree | a8c0e6eb02a796086a0d52bbb3d4473d4d98772d /indra | |
parent | ca1caeb1deedd1b8e59a90223153ca6f05914b95 (diff) |
Normal debug display and fix for bad bump mapping and planar texture coordinates.
Diffstat (limited to 'indra')
-rw-r--r-- | indra/llmath/llvolume.cpp | 2 | ||||
-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 |
6 files changed, 85 insertions, 2 deletions
diff --git a/indra/llmath/llvolume.cpp b/indra/llmath/llvolume.cpp index 72833c019f..8cb9475994 100644 --- a/indra/llmath/llvolume.cpp +++ b/indra/llmath/llvolume.cpp @@ -6076,6 +6076,8 @@ void LLVolumeFace::createBinormals() for (U32 i = 0; i < mNumVertices; i++) { binorm[i].normalize3fast(); + //bump map/planar projection code requires normals to be normalized + mNormals[i].normalize3fast(); } } } 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 05e7bbb6cd..77d36b1c2e 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 |