Path-494: Added support for culling permanent objects from the pathfinding window.

meow-7.2.2
prep 2012-05-01 10:54:00 -04:00
parent 4bb589bc2b
commit 87cba5a2b2
4 changed files with 98 additions and 2 deletions

View File

@ -48,7 +48,7 @@
#include "llpathfindingpathtool.h"
#include "lltoolmgr.h"
#include "lltoolfocus.h"
#include "pipeline.h"
#include "llpathinglib.h"
#define XUI_RENDER_HEATMAP_NONE 0
@ -85,6 +85,8 @@
LLHandle<LLFloaterPathfindingConsole> LLFloaterPathfindingConsole::sInstanceHandle;
extern LLPipeline gPipeline;
//---------------------------------------------------------------------------
// LLFloaterPathfindingConsole
//---------------------------------------------------------------------------
@ -97,8 +99,9 @@ BOOL LLFloaterPathfindingConsole::postBuild()
mShowWorldCheckBox = findChild<LLCheckBoxCtrl>("show_world");
llassert(mShowWorldCheckBox != NULL);
mShowWorldCheckBox->setCommitCallback(boost::bind(&LLFloaterPathfindingConsole::onShowWorldSet, this));
mShowWorldMovablesOnlyCheckBox = findChild<LLCheckBoxCtrl>("show_world_movables_only");
mShowWorldMovablesOnlyCheckBox->setCommitCallback(boost::bind(&LLFloaterPathfindingConsole::onRenderWorldMovablesOnly, this));
llassert(mShowWorldMovablesOnlyCheckBox != NULL);
mShowNavMeshCheckBox = findChild<LLCheckBoxCtrl>("show_navmesh");
@ -600,6 +603,18 @@ void LLFloaterPathfindingConsole::onClearPathClicked()
clearPath();
}
void LLFloaterPathfindingConsole::onRenderWorldMovablesOnly()
{
if ( mShowWorldMovablesOnlyCheckBox->get() )
{
gPipeline.hidePermanentObjects( mRenderableRestoreList );
}
else
{
gPipeline.restorePermanentObjects( mRenderableRestoreList );
mRenderableRestoreList.clear();
}
}
void LLFloaterPathfindingConsole::onNavMeshZoneCB(LLPathfindingNavMeshZone::ENavMeshZoneRequestStatus pNavMeshZoneRequestStatus)
{
switch (pNavMeshZoneRequestStatus)

View File

@ -126,6 +126,8 @@ private:
void onCharacterWidthSet();
void onCharacterTypeSwitch();
void onClearPathClicked();
void onRenderWorldMovablesOnly();
void onNavMeshZoneCB(LLPathfindingNavMeshZone::ENavMeshZoneRequestStatus pNavMeshZoneRequestStatus);
void onAgentStateCB(LLPathfindingManager::EAgentState pAgentState);
void onRegionBoundaryCross();
@ -219,6 +221,8 @@ private:
boost::signals2::connection mSavedSettingWaterSlot;
EConsoleState mConsoleState;
std::vector<U32> mRenderableRestoreList;
static LLHandle<LLFloaterPathfindingConsole> sInstanceHandle;
};

View File

@ -2624,6 +2624,7 @@ void LLPipeline::markVisible(LLDrawable *drawablep, LLCamera& camera)
{
const LLDrawable* root = ((LLSpatialBridge*) drawablep)->mDrawable;
llassert(root); // trying to catch a bad assumption
if (root && // // this test may not be needed, see above
root->getVObj()->isAttachment())
{
@ -2646,6 +2647,7 @@ void LLPipeline::markVisible(LLDrawable *drawablep, LLCamera& camera)
}
else
{
sCull->pushDrawable(drawablep);
}
@ -10103,3 +10105,75 @@ void LLPipeline::addDebugBlip(const LLVector3& position, const LLColor4& color)
mDebugBlips.push_back(blip);
}
void LLPipeline::hidePermanentObjects( std::vector<U32>& restoreList )
{
//This method is used to hide any vo's from the object list that may have
//the permanent flag set.
U32 objCnt = gObjectList.getNumObjects();
for (U32 i = 0; i < objCnt; ++i)
{
LLViewerObject* pObject = gObjectList.getObject(i);
if ( pObject && pObject->flagObjectPermanent() )
{
LLDrawable *pDrawable = pObject->mDrawable;
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 );
}
}
}
}
}
}
void LLPipeline::restorePermanentObjects( std::vector<U32>& restoreList )
{
//This method is used to restore(unhide) any vo's from the object list that may have
//been hidden because their permanency flag was set.
std::vector<U32>::iterator itCurrent = restoreList.begin();
std::vector<U32>::iterator itEnd = restoreList.end();
while ( itCurrent != itEnd )
{
U32 index = *itCurrent;
LLViewerObject* pObject = gObjectList.getObject( index );
if ( pObject )
{
LLDrawable *pDrawable = pObject->mDrawable;
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 );
}
}
}
}
++itCurrent;
}
}

View File

@ -366,6 +366,9 @@ public:
void addDebugBlip(const LLVector3& position, const LLColor4& color);
void hidePermanentObjects( std::vector<U32>& restoreList );
void restorePermanentObjects( std::vector<U32>& restoreList );
private:
void unloadShaders();
void addToQuickLookup( LLDrawPool* new_poolp );