From 0538dcf62e3c13b50fc0828e930fa50e4050302d Mon Sep 17 00:00:00 2001 From: prep <prep@lindenlab.com> Date: Thu, 1 Dec 2011 10:54:21 -0500 Subject: [PATCH] New navmesh viewer options, rendering improvements, etc. --- indra/llrender/llrendersegment.cpp | 31 +++++++-- indra/llrender/llrendersegment.h | 1 + indra/newview/llnavmeshstation.cpp | 2 +- indra/newview/llviewermenufile.cpp | 68 ++++++------------- indra/newview/pipeline.cpp | 16 +++-- .../skins/default/xui/en/menu_viewer.xml | 20 ++++-- 6 files changed, 71 insertions(+), 67 deletions(-) diff --git a/indra/llrender/llrendersegment.cpp b/indra/llrender/llrendersegment.cpp index 8f856f62f30..1f57af174e9 100644 --- a/indra/llrender/llrendersegment.cpp +++ b/indra/llrender/llrendersegment.cpp @@ -36,19 +36,36 @@ LLRenderSegment gSegment; //============================================================================= void LLRenderSegment::renderSegment( const LLVector3& start, const LLVector3& end, int color ) -{ - LLColor4 colorA = LLColor4::yellow; - - gGL.color4fv( colorA.mV ); +{ + + LLColor4 colorA( color ); + glLineWidth(1.5f); + gGL.color3fv( colorA.mV ); gGL.begin(LLRender::LINES); { gGL.vertex3fv( start.mV ); - gGL.vertex3fv( end.mV ); } - + gGL.end(); + glLineWidth(1.0f); +} +//============================================================================= +void LLRenderSegment::renderTri( const LLVector3& a, const LLVector3& b, const LLVector3& c, int color ) +{ + LLGLEnable offset(GL_POLYGON_OFFSET_LINE); + glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); + glLineWidth(1.5f); + LLColor4 colorA( color ); + gGL.color4fv( colorA.mV ); + gGL.begin(LLRender::TRIANGLES); + { + gGL.vertex3fv( a.mV ); + gGL.vertex3fv( b.mV ); + gGL.vertex3fv( c.mV ); + } gGL.end(); - + + glLineWidth(1.f); } //============================================================================= \ No newline at end of file diff --git a/indra/llrender/llrendersegment.h b/indra/llrender/llrendersegment.h index d929d6f628d..58bc083e251 100644 --- a/indra/llrender/llrendersegment.h +++ b/indra/llrender/llrendersegment.h @@ -40,6 +40,7 @@ class LLRenderSegment { public: void renderSegment( const LLVector3& start, const LLVector3& end, int color ); + void renderTri( const LLVector3& a, const LLVector3& b, const LLVector3& c, int color ); private: }; diff --git a/indra/newview/llnavmeshstation.cpp b/indra/newview/llnavmeshstation.cpp index 2f7e62b8aef..9ae84923802 100644 --- a/indra/newview/llnavmeshstation.cpp +++ b/indra/newview/llnavmeshstation.cpp @@ -27,7 +27,7 @@ #include "llviewerprecompiledheaders.h" #include "llnavmeshstation.h" #include "llcurl.h" -#include "LLPathingLib.h"//prep# fixme +#include "llpathinglib.h" #include "llagent.h" #include "llviewerregion.h" #include "llsdutil.h" diff --git a/indra/newview/llviewermenufile.cpp b/indra/newview/llviewermenufile.cpp index 2c826788a20..91ca4175f45 100644 --- a/indra/newview/llviewermenufile.cpp +++ b/indra/newview/llviewermenufile.cpp @@ -74,13 +74,12 @@ #include "lluuid.h" #include "llvorbisencode.h" #include "message.h" +#include "llpathinglib.h" +#include "llnavmeshstation.h" // system libraries #include <boost/tokenizer.hpp> -#include "LLPathingLib.h" -#include "llnavmeshstation.h" - class LLBuildNavMesh : public view_listener_t { bool handleEvent(const LLSD& userdata) @@ -89,56 +88,29 @@ class LLBuildNavMesh : public view_listener_t return result; } }; -//prep#TODO#remove if not needed for ship -class LLFileUploadNavMesh : public view_listener_t, LLNavMeshObserver +class LLNavMeshRenderingToggle : public view_listener_t { - bool handleEvent(const LLSD& userdata) { - LLPathingLib::initSystem(); - - if ( LLPathingLib::getInstance() == NULL ) - { - llinfos<<"No implementation of pathing library."<<llendl; + if ( LLPathingLib::getInstance() ) + { + LLPathingLib::getInstance()->toggleRenderNavMeshState( ); } - else - { - LLPathingLib::getInstance()->testNavMeshGenerationWithLocalAsset(); - LLSD data; - LLPLResult result = LLPathingLib::getInstance()->getNavMeshAsLLSD( data ); - if ( result == LLPL_OK ) - { - std::string capability = "NavMeshUpload"; - std::string url = gAgent.getRegion()->getCapability( capability ); - if ( !url.empty() ) - { - llinfos<< typeid(*this).name() <<"setNavMeshUploadURL "<< url <<llendl; - //Populate the required paramters that are required to store in the dictionary - data["agent_id"] = gAgent.getID(); - LLUUID object_id; - data["object_id"] = object_id; //"prepFIXME#IsThisReallyNeeded?"; - data["region_id"] = gAgent.getRegion()->getRegionID(); - data["sim_host"] = gAgent.getRegion()->getHost().getString(); - data["sim_port"] = (S32)gAgent.getRegion()->getHost().getPort(); - LLNavMeshStation::getInstance()->setNavMeshUploadURL( url ); - LLNavMeshStation::getInstance()->postNavMeshToServer( data, getObserverHandle() ); - } - else - { - llinfos<<"region contained no capability of type ["<<capability<<"]"<<llendl; - } - } - else - { - llinfos<<"ok4"<<llendl; - } + return true; + } +}; +class LLNavMeshShapeRenderingToggle : public view_listener_t +{ + bool handleEvent(const LLSD& userdata) + { + if ( LLPathingLib::getInstance() ) + { + LLPathingLib::getInstance()->toggleRenderNavMeshandShapesState( ); } - return true; } }; - - +//prep# class LLPathingTools : public view_listener_t, LLNavMeshDownloadObserver { @@ -173,8 +145,7 @@ class LLPathingTools : public view_listener_t, LLNavMeshDownloadObserver { llinfos<<"Region has does not required caps of type ["<<capability<<"]"<<llendl; } - } - + } return true; } }; @@ -1386,7 +1357,8 @@ void init_menu_file() view_listener_t::addMenu(new LLMeshUploadVisible(), "File.VisibleUploadModel"); //prep# - //view_listener_t::addCommit(new LLFileUploadNavMesh(), "File.UploadNavMesh"); view_listener_t::addCommit(new LLPathingTools(), "PathingTools.RetrieveSrc"); + view_listener_t::addCommit(new LLNavMeshRenderingToggle(), "PathingTools.ToggleNavMeshView"); + view_listener_t::addCommit(new LLNavMeshShapeRenderingToggle(), "PathingTools.ToggleNavMeshShapeView"); // "File.SaveTexture" moved to llpanelmaininventory so that it can be properly handled. } diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index f797822d41c..97b69370c90 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -104,8 +104,7 @@ #include "lltoolpie.h" #include "llcurl.h" #include "llnotifications.h" -//prep# -#include "LLPathingLib.h" +#include "llpathinglib.h" void check_stack_depth(S32 stack_depth) { @@ -3787,9 +3786,16 @@ void LLPipeline::renderGeom(LLCamera& camera, BOOL forceVBOUpdate) LLVertexBuffer::unbind(); //prep# - if ( LLPathingLib::getInstance() ) - { - LLPathingLib::getInstance()->renderNavMesh(); + if ( LLPathingLib::getInstance() ) + { + if ( LLPathingLib::getInstance()->getRenderNavMeshState() ) + { + LLPathingLib::getInstance()->renderNavMesh(); + } + if ( LLPathingLib::getInstance()->getRenderNavMeshandShapesState() ) + { + LLPathingLib::getInstance()->renderNavMeshandShapes(); + } } if (!LLPipeline::sReflectionRender && !LLPipeline::sRenderDeferred) diff --git a/indra/newview/skins/default/xui/en/menu_viewer.xml b/indra/newview/skins/default/xui/en/menu_viewer.xml index e7a0f1b0e0d..2f88b6fbf19 100644 --- a/indra/newview/skins/default/xui/en/menu_viewer.xml +++ b/indra/newview/skins/default/xui/en/menu_viewer.xml @@ -657,17 +657,25 @@ name="Pathing Tools" tear_off="true" visible="true"> - <menu_item_check - label="Retrieve NavMesh Src" + <menu_item_call + label="Retrieve Navigation Mesh Src" name="Show Pathing Tools"> - <menu_item_check.on_click + <menu_item_call.on_click function="PathingTools.RetrieveSrc" /> - </menu_item_check> + </menu_item_call> + <menu_item_call - label="Toggle NavMesh Display" - name="Toggle NavMesh View"> + label="Toggle Navigation Mesh Display" + name="Toggle Navigation Mesh View"> <menu_item_call.on_click function="PathingTools.ToggleNavMeshView" /> + </menu_item_call> + + <menu_item_call + label="Toggle Navigation Mesh Shape Display" + name="Toggle Navigation Mesh Shape View"> + <menu_item_call.on_click + function="PathingTools.ToggleNavMeshShapeView" /> </menu_item_call> </menu> -- GitLab