diff options
Diffstat (limited to 'indra/newview')
-rw-r--r-- | indra/newview/llfloaterpathfindingobjects.cpp | 91 | ||||
-rw-r--r-- | indra/newview/llfloaterpathfindingobjects.h | 39 | ||||
-rw-r--r-- | indra/newview/llpathfindingcharacter.cpp | 10 | ||||
-rw-r--r-- | indra/newview/llpathfindingcharacterlist.cpp | 8 | ||||
-rw-r--r-- | indra/newview/pipeline.cpp | 144 | ||||
-rw-r--r-- | indra/newview/pipeline.h | 5 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/floater_pathfinding_characters.xml | 9 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/floater_pathfinding_linksets.xml | 9 |
8 files changed, 270 insertions, 45 deletions
diff --git a/indra/newview/llfloaterpathfindingobjects.cpp b/indra/newview/llfloaterpathfindingobjects.cpp index a8f604b970..d78ad9d754 100644 --- a/indra/newview/llfloaterpathfindingobjects.cpp +++ b/indra/newview/llfloaterpathfindingobjects.cpp @@ -54,9 +54,13 @@ #include "llviewerobjectlist.h" #include "llviewerregion.h" #include "v4color.h" +#include "pipeline.h" +#include "llfloaterreg.h" #define DEFAULT_BEACON_WIDTH 6 +LLHandle<LLFloaterPathfindingObjects> LLFloaterPathfindingObjects::sInstanceHandle; + //--------------------------------------------------------------------------- // LLFloaterPathfindingObjects //--------------------------------------------------------------------------- @@ -154,6 +158,7 @@ LLFloaterPathfindingObjects::LLFloaterPathfindingObjects(const LLSD &pSeed) mSelectAllButton(NULL), mSelectNoneButton(NULL), mShowBeaconCheckBox(NULL), + mShowPhysicsCapsuleCheckBox(NULL), mTakeButton(NULL), mTakeCopyButton(NULL), mReturnButton(NULL), @@ -168,8 +173,10 @@ LLFloaterPathfindingObjects::LLFloaterPathfindingObjects(const LLSD &pSeed) mObjectList(), mObjectsSelection(), mSelectionUpdateSlot(), - mRegionBoundaryCrossingSlot() + mRegionBoundaryCrossingSlot(), + mSelfHandle() { + mSelfHandle.bind(this); } LLFloaterPathfindingObjects::~LLFloaterPathfindingObjects() @@ -206,6 +213,10 @@ BOOL LLFloaterPathfindingObjects::postBuild() mShowBeaconCheckBox = findChild<LLCheckBoxCtrl>("show_beacon"); llassert(mShowBeaconCheckBox != NULL); + mShowPhysicsCapsuleCheckBox = findChild<LLCheckBoxCtrl>("show_physics_capsule"); + llassert(mShowPhysicsCapsuleCheckBox != NULL); + mShowPhysicsCapsuleCheckBox->setCommitCallback(boost::bind(&LLFloaterPathfindingObjects::onShowPhysicsCapsuleClicked, this)); + mTakeButton = findChild<LLButton>("take_objects"); llassert(mTakeButton != NULL); mTakeButton->setCommitCallback(boost::bind(&LLFloaterPathfindingObjects::onTakeClicked, this)); @@ -638,6 +649,7 @@ void LLFloaterPathfindingObjects::updateStateOnEditFields() bool isEditEnabled = (numSelectedItems > 0); mShowBeaconCheckBox->setEnabled(isEditEnabled); + //prep#mShowPhysicsCapsuleCheckBox->setEnabled( false ); mTakeButton->setEnabled(isEditEnabled && visible_take_object()); mTakeCopyButton->setEnabled(isEditEnabled && enable_object_take_copy()); mReturnButton->setEnabled(isEditEnabled && enable_object_return()); @@ -688,3 +700,80 @@ LLPathfindingObjectPtr LLFloaterPathfindingObjects::findObject(const LLScrollLis return objectPtr; } + +void LLFloaterPathfindingObjects::onShowPhysicsCapsuleClicked() +{ + if ( mShowPhysicsCapsuleCheckBox->get() ) + { + //We want to hide the VO and display the the objects physics capsule + LLVector3 pos; + LLUUID id = getUUIDFromSelection( pos ); + if ( id.notNull() ) + { + gPipeline.hideObject( id ); + } + } + else + { + //We want to restore the selected objects vo and disable the physics capsule rendering + LLVector3 pos; + LLUUID id = getUUIDFromSelection( pos ); + if ( id.notNull() ) + { + gPipeline.restoreHiddenObject( id ); + } + } +} + +BOOL LLFloaterPathfindingObjects::isPhysicsCapsuleEnabled( LLUUID& id, LLVector3& pos ) +{ + BOOL result = false; + if ( mShowPhysicsCapsuleCheckBox->get() ) + { + id = getUUIDFromSelection( pos ); + result = true; + } + else + { + id.setNull(); + } + return result; +} + +LLUUID LLFloaterPathfindingObjects::getUUIDFromSelection( LLVector3& pos ) +{ + std::vector<LLScrollListItem*> selectedItems = mObjectsScrollList->getAllSelected(); + if ( selectedItems.size() > 1 ) + { + return LLUUID::null; + } + if (selectedItems.size() == 1) + { + std::vector<LLScrollListItem*>::const_reference selectedItemRef = selectedItems.front(); + const LLScrollListItem *selectedItem = selectedItemRef; + llassert(mObjectList != NULL); + LLViewerObject *viewerObject = gObjectList.findObject( selectedItem->getUUID() ); + if ( viewerObject != NULL ) + { + pos = viewerObject->getRenderPosition(); + } + //prep#llinfos<<"id : "<<selectedItem->getUUID()<<llendl; + return selectedItem->getUUID(); + } + + return LLUUID::null; +} + +LLHandle<LLFloaterPathfindingObjects> LLFloaterPathfindingObjects::getInstanceHandle() +{ + if ( sInstanceHandle.isDead() ) + { + LLFloaterPathfindingObjects *floaterInstance = LLFloaterReg::getTypedInstance<LLFloaterPathfindingObjects>("pathfinding_characters"); + if (floaterInstance != NULL) + { + sInstanceHandle = floaterInstance->mSelfHandle; + } + } + + return sInstanceHandle; +} diff --git a/indra/newview/llfloaterpathfindingobjects.h b/indra/newview/llfloaterpathfindingobjects.h index aacf299d13..fc096a7c31 100644 --- a/indra/newview/llfloaterpathfindingobjects.h +++ b/indra/newview/llfloaterpathfindingobjects.h @@ -98,28 +98,33 @@ protected: EMessagingState getMessagingState() const; +public: + LLUUID getUUIDFromSelection( LLVector3& pos ); + BOOL isPhysicsCapsuleEnabled( LLUUID& id, LLVector3& pos ); + void onShowPhysicsCapsuleClicked(); + private: LLFloaterPathfindingObjects(const LLFloaterPathfindingObjects &pOther); - void setMessagingState(EMessagingState pMessagingState); + void setMessagingState(EMessagingState pMessagingState); - void onRefreshObjectsClicked(); - void onSelectAllObjectsClicked(); - void onSelectNoneObjectsClicked(); - void onTakeClicked(); - void onTakeCopyClicked(); - void onReturnClicked(); - void onDeleteClicked(); - void onTeleportClicked(); + void onRefreshObjectsClicked(); + void onSelectAllObjectsClicked(); + void onSelectNoneObjectsClicked(); + void onTakeClicked(); + void onTakeCopyClicked(); + void onReturnClicked(); + void onDeleteClicked(); + void onTeleportClicked(); - void onScrollListSelectionChanged(); + void onScrollListSelectionChanged(); void onInWorldSelectionListChanged(); - void onRegionBoundaryCrossed(); + void onRegionBoundaryCrossed(); void onGodLevelChange(U8 pGodLevel); - void updateMessagingStatus(); - void updateStateOnListActionControls(); - void updateStateOnEditFields(); + void updateMessagingStatus(); + void updateStateOnListActionControls(); + void updateStateOnEditFields(); void updateOnScrollListChange(); LLPathfindingObjectPtr findObject(const LLScrollListItem *pListItem) const; @@ -130,6 +135,7 @@ private: LLButton *mSelectAllButton; LLButton *mSelectNoneButton; LLCheckBoxCtrl *mShowBeaconCheckBox; + LLCheckBoxCtrl *mShowPhysicsCapsuleCheckBox; LLButton *mTakeButton; LLButton *mTakeCopyButton; LLButton *mReturnButton; @@ -151,6 +157,11 @@ private: boost::signals2::connection mSelectionUpdateSlot; boost::signals2::connection mRegionBoundaryCrossingSlot; LLAgent::god_level_change_slot_t mGodLevelChangeSlot; +public: + + LLRootHandle<LLFloaterPathfindingObjects> mSelfHandle; + static LLHandle<LLFloaterPathfindingObjects> sInstanceHandle; + static LLHandle<LLFloaterPathfindingObjects> getInstanceHandle(); }; #endif // LL_LLFLOATERPATHFINDINGOBJECTS_H diff --git a/indra/newview/llpathfindingcharacter.cpp b/indra/newview/llpathfindingcharacter.cpp index 0696783bf7..c7843b8fee 100644 --- a/indra/newview/llpathfindingcharacter.cpp +++ b/indra/newview/llpathfindingcharacter.cpp @@ -31,12 +31,16 @@ #include "llpathfindingobject.h" #include "llsd.h" +#include "llpathinglib.h" #define CHARACTER_CPU_TIME_FIELD "cpu_time" #define CHARACTER_HORIZONTAL_FIELD "horizontal" #define CHARACTER_LENGTH_FIELD "length" #define CHARACTER_RADIUS_FIELD "radius" +//prep# +#define SERVER_SIDE_CHARACTER_SHAPE_ROLLOUT_COMPLETE + //--------------------------------------------------------------------------- // LLPathfindingCharacter //--------------------------------------------------------------------------- @@ -119,5 +123,11 @@ void LLPathfindingCharacter::parseCharacterData(const LLSD &pCharacterData) llassert(pCharacterData.has(CHARACTER_RADIUS_FIELD)); llassert(pCharacterData.get(CHARACTER_RADIUS_FIELD).isReal()); mRadius = pCharacterData.get(CHARACTER_RADIUS_FIELD).asReal(); + + //Create the rep inside the pathing library + LLVector3 empty(0,0,0); + const LLUUID id = getUUID(); + LLPathingLib::getInstance()->createPhysicsCapsuleRep( mLength, mRadius, mIsHorizontal, empty, id ); + #endif // SERVER_SIDE_CHARACTER_SHAPE_ROLLOUT_COMPLETE } diff --git a/indra/newview/llpathfindingcharacterlist.cpp b/indra/newview/llpathfindingcharacterlist.cpp index 9b0ed14e35..15eaac771f 100644 --- a/indra/newview/llpathfindingcharacterlist.cpp +++ b/indra/newview/llpathfindingcharacterlist.cpp @@ -33,6 +33,7 @@ #include "llpathfindingobject.h" #include "llpathfindingobjectlist.h" #include "llsd.h" +#include "llpathinglib.h" //--------------------------------------------------------------------------- // LLPathfindingCharacterList @@ -46,6 +47,13 @@ LLPathfindingCharacterList::LLPathfindingCharacterList() LLPathfindingCharacterList::LLPathfindingCharacterList(const LLSD& pCharacterListData) : LLPathfindingObjectList() { + if ( LLPathingLib::getInstance() == NULL ) + { + LLPathingLib::initSystem(); + } + + LLPathingLib::getInstance()->cleanupPhysicsCapsuleRepResiduals( ); + parseCharacterListData(pCharacterListData); } diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index cdcf468a4d..46d257bd87 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -106,6 +106,7 @@ #include "llnotifications.h" #include "llpathinglib.h" #include "llfloaterpathfindingconsole.h" +#include "llfloaterpathfindingobjects.h" #include "llpathfindingpathtool.h" #ifdef _DEBUG @@ -4359,6 +4360,49 @@ void LLPipeline::renderDebug() LLPathingLib *llPathingLibInstance = LLPathingLib::getInstance(); if ( llPathingLibInstance != NULL ) { + //character floater renderables + + LLHandle<LLFloaterPathfindingObjects> pathfindingCharacterHandle = LLFloaterPathfindingObjects::getInstanceHandle(); + if ( !pathfindingCharacterHandle.isDead() ) + { + LLFloaterPathfindingObjects *pathfindingCharacter = pathfindingCharacterHandle.get(); + + if ( pathfindingCharacter->getVisible() || gAgentCamera.cameraMouselook() ) + { + if (LLGLSLShader::sNoFixedFunction) + { + gPathfindingProgram.bind(); + gPathfindingProgram.uniform1f("tint", 1.f); + gPathfindingProgram.uniform1f("ambiance", 1.f); + gPathfindingProgram.uniform1f("alpha_scale", 1.f); + } + + LLUUID id; + LLVector3 pos; + if ( pathfindingCharacter->isPhysicsCapsuleEnabled( id, pos ) ) + { + if (LLGLSLShader::sNoFixedFunction) + { + //remove blending artifacts + gGL.setColorMask(false, false); + llPathingLibInstance->renderPathBookend( gGL, LLPathingLib::LLPL_START ); + llPathingLibInstance->renderPathBookend( gGL, LLPathingLib::LLPL_END ); + gGL.setColorMask(true, false); + LLGLEnable blend(GL_BLEND); + gPathfindingProgram.uniform1f("alpha_scale", 0.90f); + llPathingLibInstance->renderSimpleShapeCapsuleID( gGL, id, pos ); + gPathfindingProgram.bind(); + } + else + { + llPathingLibInstance->renderSimpleShapeCapsuleID( gGL, id, pos ); + } + } + } + } + + + //pathing console renderables LLHandle<LLFloaterPathfindingConsole> pathfindingConsoleHandle = LLFloaterPathfindingConsole::getInstanceHandle(); if (!pathfindingConsoleHandle.isDead()) { @@ -10145,21 +10189,7 @@ void LLPipeline::hidePermanentObjects( std::vector<U32>& restoreList ) if ( pDrawable ) { restoreList.push_back( i ); - pDrawable->setState( LLDrawable::FORCE_INVISIBLE ); - markRebuild( pDrawable, LLDrawable::REBUILD_ALL, TRUE ); - //hide children - LLViewerObject::const_child_list_t& child_list = pDrawable->getVObj()->getChildren(); - for ( LLViewerObject::child_list_t::const_iterator iter = child_list.begin(); - iter != child_list.end(); iter++ ) - { - LLViewerObject* child = *iter; - LLDrawable* drawable = child->mDrawable; - if (drawable) - { - drawable->setState( LLDrawable::FORCE_INVISIBLE ); - markRebuild( drawable, LLDrawable::REBUILD_ALL, TRUE ); - } - } + hideDrawable( pDrawable ); } } } @@ -10191,20 +10221,7 @@ void LLPipeline::restorePermanentObjects( const std::vector<U32>& restoreList ) if ( pDrawable ) { pDrawable->clearState( LLDrawable::FORCE_INVISIBLE ); - markRebuild( pDrawable, LLDrawable::REBUILD_ALL, TRUE ); - //restore children - LLViewerObject::const_child_list_t& child_list = pDrawable->getVObj()->getChildren(); - for ( LLViewerObject::child_list_t::const_iterator iter = child_list.begin(); - iter != child_list.end(); iter++) - { - LLViewerObject* child = *iter; - LLDrawable* drawable = child->mDrawable; - if (drawable) - { - drawable->clearState( LLDrawable::FORCE_INVISIBLE ); - markRebuild( drawable, LLDrawable::REBUILD_ALL, TRUE ); - } - } + unhideDrawable( pDrawable ); } } ++itCurrent; @@ -10227,3 +10244,72 @@ void LLPipeline::skipRenderingOfTerrain( BOOL flag ) ++iter; } } + +void LLPipeline::hideObject( const LLUUID& id ) +{ + LLViewerObject *pVO = gObjectList.findObject( id ); + + if ( pVO ) + { + LLDrawable *pDrawable = pVO->mDrawable; + + if ( pDrawable ) + { + hideDrawable( pDrawable ); + } + } +} + +void LLPipeline::hideDrawable( LLDrawable *pDrawable ) +{ + pDrawable->setState( LLDrawable::FORCE_INVISIBLE ); + markRebuild( pDrawable, LLDrawable::REBUILD_ALL, TRUE ); + //hide the children + LLViewerObject::const_child_list_t& child_list = pDrawable->getVObj()->getChildren(); + for ( LLViewerObject::child_list_t::const_iterator iter = child_list.begin(); + iter != child_list.end(); iter++ ) + { + LLViewerObject* child = *iter; + LLDrawable* drawable = child->mDrawable; + if ( drawable ) + { + drawable->setState( LLDrawable::FORCE_INVISIBLE ); + markRebuild( drawable, LLDrawable::REBUILD_ALL, TRUE ); + } + } +} +void LLPipeline::unhideDrawable( LLDrawable *pDrawable ) +{ + pDrawable->clearState( LLDrawable::FORCE_INVISIBLE ); + markRebuild( pDrawable, LLDrawable::REBUILD_ALL, TRUE ); + //restore children + LLViewerObject::const_child_list_t& child_list = pDrawable->getVObj()->getChildren(); + for ( LLViewerObject::child_list_t::const_iterator iter = child_list.begin(); + iter != child_list.end(); iter++) + { + LLViewerObject* child = *iter; + LLDrawable* drawable = child->mDrawable; + if ( drawable ) + { + drawable->clearState( LLDrawable::FORCE_INVISIBLE ); + markRebuild( drawable, LLDrawable::REBUILD_ALL, TRUE ); + } + } +} +void LLPipeline::restoreHiddenObject( const LLUUID& id ) +{ + LLViewerObject *pVO = gObjectList.findObject( id ); + + if ( pVO ) + { + LLDrawable *pDrawable = pVO->mDrawable; + if ( pDrawable ) + { + unhideDrawable( pDrawable ); + } + } +} + + + + diff --git a/indra/newview/pipeline.h b/indra/newview/pipeline.h index f431576702..117b18be80 100644 --- a/indra/newview/pipeline.h +++ b/indra/newview/pipeline.h @@ -371,6 +371,8 @@ public: void hidePermanentObjects( std::vector<U32>& restoreList ); void restorePermanentObjects( const std::vector<U32>& restoreList ); void skipRenderingOfTerrain( BOOL flag ); + void hideObject( const LLUUID& id ); + void restoreHiddenObject( const LLUUID& id ); private: void unloadShaders(); @@ -379,7 +381,8 @@ private: BOOL updateDrawableGeom(LLDrawable* drawable, BOOL priority); void assertInitializedDoError(); bool assertInitialized() { const bool is_init = isInit(); if (!is_init) assertInitializedDoError(); return is_init; }; - + void hideDrawable( LLDrawable *pDrawable ); + void unhideDrawable( LLDrawable *pDrawable ); public: enum {GPU_CLASS_MAX = 3 }; diff --git a/indra/newview/skins/default/xui/en/floater_pathfinding_characters.xml b/indra/newview/skins/default/xui/en/floater_pathfinding_characters.xml index a81c4cb891..fac6ee05bb 100644 --- a/indra/newview/skins/default/xui/en/floater_pathfinding_characters.xml +++ b/indra/newview/skins/default/xui/en/floater_pathfinding_characters.xml @@ -147,6 +147,15 @@ top_pad="-16" left_pad="0" width="90" /> + <check_box + height="19" + follows="left|bottom" + label="Show physics capsule" + layout="topleft" + name="show_physics_capsule" + top_pad="-19" + left_pad="10" + width="90" /> <button follows="left|bottom" height="22" diff --git a/indra/newview/skins/default/xui/en/floater_pathfinding_linksets.xml b/indra/newview/skins/default/xui/en/floater_pathfinding_linksets.xml index 3ae5301cc2..063aa7bef0 100644 --- a/indra/newview/skins/default/xui/en/floater_pathfinding_linksets.xml +++ b/indra/newview/skins/default/xui/en/floater_pathfinding_linksets.xml @@ -300,6 +300,15 @@ left_pad="0" top_pad="-16" width="90" /> + <check_box + height="19" + follows="left|bottom" + label="Show physics capsule" + layout="topleft" + name="show_physics_capsule" + top_pad="-19" + left_pad="10" + width="90" /> <button follows="left|bottom" height="21" |