diff --git a/indra/llrender/llrendersegment.cpp b/indra/llrender/llrendersegment.cpp index 8f856f62f301129fab1860d5e1614917366529ce..1f57af174e96ec80b49e554ed545ccd874369756 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 d929d6f628d233f9b5696332bec11e064d0f4464..58bc083e251b36e5fad14a400fc7f670a882ae08 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 2f7e62b8aef5affd94b22cc80c65702867029305..9ae849238024de17dcca81e22b1274675e6c8ab3 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 2c826788a204414f2d4a1c0b1ec8c977470b31e1..91ca4175f453e2f935b18aa70ff33070559417b7 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 f797822d41c9dd0f4380139adb22943412b7282a..97b69370c90bdf33f82c7df8024c8396c6a29080 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 e7a0f1b0e0da1104a6370129029889621a9276bd..2f88b6fbf19aa5535f0b5013f2ca5cbb34838501 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>