From e5d59b3c2ae99c7e6cfb0312dd8842e8d948aad0 Mon Sep 17 00:00:00 2001 From: Todd Stinson Date: Tue, 14 Feb 2012 16:41:53 -0800 Subject: Moving the bulk of the display settings into the viewer. --- indra/newview/llfloaterpathfindingconsole.cpp | 169 ++++++++++---------------- indra/newview/llfloaterpathfindingconsole.h | 26 +++- indra/newview/llviewerdisplay.cpp | 43 ++++--- 3 files changed, 110 insertions(+), 128 deletions(-) (limited to 'indra') diff --git a/indra/newview/llfloaterpathfindingconsole.cpp b/indra/newview/llfloaterpathfindingconsole.cpp index 9a1651f537..26e1ff3963 100644 --- a/indra/newview/llfloaterpathfindingconsole.cpp +++ b/indra/newview/llfloaterpathfindingconsole.cpp @@ -68,23 +68,18 @@ BOOL LLFloaterPathfindingConsole::postBuild() mShowNavMeshCheckBox = findChild("show_navmesh"); llassert(mShowNavMeshCheckBox != NULL); - mShowNavMeshCheckBox->setCommitCallback(boost::bind(&LLFloaterPathfindingConsole::onShowNavMeshToggle, this)); mShowWalkablesCheckBox = findChild("show_walkables"); llassert(mShowWalkablesCheckBox != NULL); - mShowWalkablesCheckBox->setCommitCallback(boost::bind(&LLFloaterPathfindingConsole::onShowWalkablesToggle, this)); mShowStaticObstaclesCheckBox = findChild("show_static_obstacles"); llassert(mShowStaticObstaclesCheckBox != NULL); - mShowStaticObstaclesCheckBox->setCommitCallback(boost::bind(&LLFloaterPathfindingConsole::onShowStaticObstaclesToggle, this)); mShowMaterialVolumesCheckBox = findChild("show_material_volumes"); llassert(mShowMaterialVolumesCheckBox != NULL); - mShowMaterialVolumesCheckBox->setCommitCallback(boost::bind(&LLFloaterPathfindingConsole::onShowMaterialVolumesToggle, this)); mShowExclusionVolumesCheckBox = findChild("show_exclusion_volumes"); llassert(mShowExclusionVolumesCheckBox != NULL); - mShowExclusionVolumesCheckBox->setCommitCallback(boost::bind(&LLFloaterPathfindingConsole::onShowExclusionVolumesToggle, this)); mShowWorldCheckBox = findChild("show_world"); llassert(mShowWorldCheckBox != NULL); @@ -159,6 +154,71 @@ LLHandle LLFloaterPathfindingConsole::getInstanceHa return sInstanceHandle; } +BOOL LLFloaterPathfindingConsole::isRenderPath() const +{ + return (mHasStartPoint && mHasEndPoint); +} + +BOOL LLFloaterPathfindingConsole::isRenderNavMesh() const +{ + return mShowNavMeshCheckBox->get(); +} + +void LLFloaterPathfindingConsole::setRenderNavMesh(BOOL pIsRenderNavMesh) +{ + mShowNavMeshCheckBox->set(pIsRenderNavMesh); +} + +BOOL LLFloaterPathfindingConsole::isRenderWalkables() const +{ + return mShowWalkablesCheckBox->get(); +} + +void LLFloaterPathfindingConsole::setRenderWalkables(BOOL pIsRenderWalkables) +{ + mShowWalkablesCheckBox->set(pIsRenderWalkables); +} + +BOOL LLFloaterPathfindingConsole::isRenderStaticObstacles() const +{ + return mShowStaticObstaclesCheckBox->get(); +} + +void LLFloaterPathfindingConsole::setRenderStaticObstacles(BOOL pIsRenderStaticObstacles) +{ + mShowStaticObstaclesCheckBox->set(pIsRenderStaticObstacles); +} + +BOOL LLFloaterPathfindingConsole::isRenderMaterialVolumes() const +{ + return mShowMaterialVolumesCheckBox->get(); +} + +void LLFloaterPathfindingConsole::setRenderMaterialVolumes(BOOL pIsRenderMaterialVolumes) +{ + mShowMaterialVolumesCheckBox->set(pIsRenderMaterialVolumes); +} + +BOOL LLFloaterPathfindingConsole::isRenderExclusionVolumes() const +{ + return mShowExclusionVolumesCheckBox->get(); +} + +void LLFloaterPathfindingConsole::setRenderExclusionVolumes(BOOL pIsRenderExclusionVolumes) +{ + mShowExclusionVolumesCheckBox->set(pIsRenderExclusionVolumes); +} + +BOOL LLFloaterPathfindingConsole::isRenderWorld() const +{ + return mShowWorldCheckBox->get(); +} + +void LLFloaterPathfindingConsole::setRenderWorld(BOOL pIsRenderWorld) +{ + mShowWorldCheckBox->set(pIsRenderWorld); +} + F32 LLFloaterPathfindingConsole::getCharacterWidth() const { return mCharacterWidthSlider->getValueF32(); @@ -337,106 +397,9 @@ void LLFloaterPathfindingConsole::onOpen(const LLSD& pKey) llinfos<<"Region has does not required caps of type ["<setRenderPath(true); } } -void LLFloaterPathfindingConsole::onClose(bool app_quitting) -{ - //make sure we have a pathing system - if ( !LLPathingLib::getInstance() ) - { - LLPathingLib::getInstance()->setRenderPath(false); - } -} - -void LLFloaterPathfindingConsole::onShowNavMeshToggle() -{ - BOOL checkBoxValue = mShowNavMeshCheckBox->get(); - - LLPathingLib *llPathingLibInstance = LLPathingLib::getInstance(); - if (llPathingLibInstance != NULL) - { - llPathingLibInstance->setRenderNavMesh(checkBoxValue); - } - else - { - mShowNavMeshCheckBox->set(FALSE); - llwarns << "cannot find LLPathingLib instance" << llendl; - } -} - -void LLFloaterPathfindingConsole::onShowWalkablesToggle() -{ - BOOL checkBoxValue = mShowWalkablesCheckBox->get(); - - LLPathingLib *llPathingLibInstance = LLPathingLib::getInstance(); - if (llPathingLibInstance != NULL) - { - //llPathingLibInstance->setRenderNavMesh(checkBoxValue); - llwarns << "functionality has not yet been implemented to set walkables to " - << (checkBoxValue ? "TRUE" : "FALSE") << llendl; - - } - else - { - mShowWalkablesCheckBox->set(FALSE); - llwarns << "cannot find LLPathingLib instance" << llendl; - } -} - -void LLFloaterPathfindingConsole::onShowStaticObstaclesToggle() -{ - BOOL checkBoxValue = mShowStaticObstaclesCheckBox->get(); - - LLPathingLib *llPathingLibInstance = LLPathingLib::getInstance(); - if (llPathingLibInstance != NULL) - { - //llPathingLibInstance->setRenderNavMesh(checkBoxValue); - llwarns << "functionality has not yet been implemented to set static obstacles to " - << (checkBoxValue ? "TRUE" : "FALSE") << llendl; - } - else - { - mShowStaticObstaclesCheckBox->set(FALSE); - llwarns << "cannot find LLPathingLib instance" << llendl; - } -} - -void LLFloaterPathfindingConsole::onShowMaterialVolumesToggle() -{ - BOOL checkBoxValue = mShowMaterialVolumesCheckBox->get(); - - LLPathingLib *llPathingLibInstance = LLPathingLib::getInstance(); - if (llPathingLibInstance != NULL) - { - //llPathingLibInstance->setRenderNavMesh(checkBoxValue); - llwarns << "functionality has not yet been implemented to set material volumes to " - << (checkBoxValue ? "TRUE" : "FALSE") << llendl; - } - else - { - mShowMaterialVolumesCheckBox->set(FALSE); - llwarns << "cannot find LLPathingLib instance" << llendl; - } -} - -void LLFloaterPathfindingConsole::onShowExclusionVolumesToggle() -{ - BOOL checkBoxValue = mShowExclusionVolumesCheckBox->get(); - - LLPathingLib *llPathingLibInstance = LLPathingLib::getInstance(); - if (llPathingLibInstance != NULL) - { - llPathingLibInstance->setRenderShapes(checkBoxValue); - } - else - { - mShowExclusionVolumesCheckBox->set(FALSE); - llwarns << "cannot find LLPathingLib instance" << llendl; - } -} - void LLFloaterPathfindingConsole::onShowWorldToggle() { BOOL checkBoxValue = mShowWorldCheckBox->get(); @@ -444,7 +407,7 @@ void LLFloaterPathfindingConsole::onShowWorldToggle() LLPathingLib *llPathingLibInstance = LLPathingLib::getInstance(); if (llPathingLibInstance != NULL) { - llPathingLibInstance->setRenderOverlayMode(checkBoxValue); + llPathingLibInstance->setRenderWorld(checkBoxValue); } else { diff --git a/indra/newview/llfloaterpathfindingconsole.h b/indra/newview/llfloaterpathfindingconsole.h index 2a813de657..10731c3e1f 100644 --- a/indra/newview/llfloaterpathfindingconsole.h +++ b/indra/newview/llfloaterpathfindingconsole.h @@ -62,6 +62,26 @@ public: static LLHandle getInstanceHandle(); + BOOL isRenderPath() const; + + BOOL isRenderNavMesh() const; + void setRenderNavMesh(BOOL pIsRenderNavMesh); + + BOOL isRenderWalkables() const; + void setRenderWalkables(BOOL pIsRenderWalkables); + + BOOL isRenderStaticObstacles() const; + void setRenderStaticObstacles(BOOL pIsRenderStaticObstacles); + + BOOL isRenderMaterialVolumes() const; + void setRenderMaterialVolumes(BOOL pIsRenderMaterialVolumes); + + BOOL isRenderExclusionVolumes() const; + void setRenderExclusionVolumes(BOOL pIsRenderExclusionVolumes); + + BOOL isRenderWorld() const; + void setRenderWorld(BOOL pIsRenderWorld); + F32 getCharacterWidth() const; void setCharacterWidth(F32 pCharacterWidth); @@ -80,13 +100,7 @@ private: virtual ~LLFloaterPathfindingConsole(); virtual void onOpen(const LLSD& pKey); - virtual void onClose(bool app_quitting); - void onShowNavMeshToggle(); - void onShowWalkablesToggle(); - void onShowStaticObstaclesToggle(); - void onShowMaterialVolumesToggle(); - void onShowExclusionVolumesToggle(); void onShowWorldToggle(); void onCharacterWidthSet(); void onCharacterTypeSwitch(); diff --git a/indra/newview/llviewerdisplay.cpp b/indra/newview/llviewerdisplay.cpp index 0774ab4029..c58783d64b 100644 --- a/indra/newview/llviewerdisplay.cpp +++ b/indra/newview/llviewerdisplay.cpp @@ -900,26 +900,31 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot) //Render any navmesh geometry LLPathingLib *llPathingLibInstance = LLPathingLib::getInstance(); if ( llPathingLibInstance != NULL ) - { - //Determine if we can should overlay the navmesh ontop of the scenes typical renderables - allowRenderables = llPathingLibInstance->getRenderOverlayMode(); - - //NavMesh - if ( llPathingLibInstance->getRenderNavMeshState() ) - { - llPathingLibInstance->renderNavMesh(); - exclusiveDraw = true; - } - //physics/exclusion shapes - if ( llPathingLibInstance->getRenderShapesState() ) - { - llPathingLibInstance->renderNavMeshShapesVBO(); - exclusiveDraw = true; - } - //User designated path - if ( llPathingLibInstance->getRenderPathState() ) + { + LLHandle pathfindingConsoleHandle = LLFloaterPathfindingConsole::getInstanceHandle(); + if (!pathfindingConsoleHandle.isDead()) { - llPathingLibInstance->renderPath(); + LLFloaterPathfindingConsole *pathfindingConsole = pathfindingConsoleHandle.get(); + //Determine if we can should overlay the navmesh ontop of the scenes typical renderables + allowRenderables = pathfindingConsole->isRenderWorld(); + + //NavMesh + if (pathfindingConsole->isRenderNavMesh()) + { + llPathingLibInstance->renderNavMesh(); + exclusiveDraw = true; + } + //physics/exclusion shapes + if (pathfindingConsole->isRenderExclusionVolumes()) + { + llPathingLibInstance->renderNavMeshShapesVBO(); + exclusiveDraw = true; + } + //User designated path + if (pathfindingConsole->isRenderPath()) + { + llPathingLibInstance->renderPath(); + } } } } -- cgit v1.2.3