summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--indra/newview/llviewerobject.cpp95
-rw-r--r--indra/newview/llviewerobject.h4
2 files changed, 50 insertions, 49 deletions
diff --git a/indra/newview/llviewerobject.cpp b/indra/newview/llviewerobject.cpp
index 3185625094..a3a6ef1888 100644
--- a/indra/newview/llviewerobject.cpp
+++ b/indra/newview/llviewerobject.cpp
@@ -104,7 +104,7 @@
#include "llaccountingquota.h"
//#define DEBUG_UPDATE_TYPE
-//#define EXTENDED_ENCROACHMENT_CHECK //temp:
+#define EXTENDED_ENCROACHMENT_CHECK //temp:
BOOL LLViewerObject::sVelocityInterpolate = TRUE;
BOOL LLViewerObject::sPingInterpolate = TRUE;
@@ -538,82 +538,83 @@ bool LLViewerObject::isReturnable()
}
bool result = (mRegionp && mRegionp->objectIsReturnable(getPositionRegion(), boxes)) ? 1 : 0;
+
#ifdef EXTENDED_ENCROACHMENT_CHECK
- //Get list of neighboring regions
- std::vector<LLViewerRegion*> uniqueRegions;
- //Store this vo's region
- uniqueRegions.push_back( mRegionp );
- //Build list of neighboring regions realtive to this vo's region
- mRegionp->getNeighboringRegions( uniqueRegions );
- //Build aabb's - for root and all children
- std::vector<PotentialReturnableObject> returnables;
if ( !result )
- {
- //Current region
- PotentialReturnableObject returnableObj;
- returnableObj.box = LLBBox( getPositionRegion(), getRotationRegion(), getScale() * -0.5f, getScale() * 0.5f).getAxisAligned() ;
- returnableObj.pRegion = getRegion();
-
- for (child_list_t::iterator iter = mChildList.begin(); iter != mChildList.end(); iter++)
- {
- LLViewerObject* pChild = *iter;
- buildReturnablesForChildrenVO( returnables, pChild );
- }
- }
+ {
+ std::vector<LLViewerRegion*> uniqueRegions;
+ //Get list of neighboring regions relative to this vo's region
+ mRegionp->getNeighboringRegions( uniqueRegions );
+
+ //Build aabb's - for root and all children
+ std::vector<PotentialReturnableObject> returnables;
+ typedef std::vector<LLViewerRegion*>::iterator RegionIt;
+ RegionIt regionStart = uniqueRegions.begin();
+ RegionIt regionEnd = uniqueRegions.end();
+ for (; regionStart != regionEnd; ++regionStart )
+ {
+ LLViewerRegion* pTargetRegion = *regionStart;
+ for (child_list_t::iterator iter = mChildList.begin(); iter != mChildList.end(); iter++)
+ {
+ LLViewerObject* pChild = *iter;
+ buildReturnablesForChildrenVO( returnables, pChild, pTargetRegion );
+ }
+ }
- //TBD# Should probably create a region -> box map
- typedef std::vector<PotentialReturnableObject>::iterator ReturnablesIt;
- ReturnablesIt retCurrentIt = returnables.begin();
- ReturnablesIt retEndIt = returnables.end();
+ //TBD# Should probably create a region -> box list map
+ typedef std::vector<PotentialReturnableObject>::iterator ReturnablesIt;
+ ReturnablesIt retCurrentIt = returnables.begin();
+ ReturnablesIt retEndIt = returnables.end();
- for ( ; retCurrentIt !=retEndIt; ++retCurrentIt )
- {
- boxes.clear();
- LLViewerRegion* pRegion = (*retCurrentIt).pRegion;
- boxes.push_back( (*retCurrentIt).box );
- //LLVector3 boxPos = (*retCurrentIt).box.getPositionAgent();
- //TBD# Should we just use pRegion->objectIsReturnable, instead?
- //As it does various other checks, childrenObjectReturnable does not.
- bool retResult = (mRegionp && pRegion->childrenObjectReturnable( boxes )) ? 1 : 0;
- if ( retResult )
- {
- result = true;
- break;
+ for ( ; retCurrentIt !=retEndIt; ++retCurrentIt )
+ {
+ boxes.clear();
+ LLViewerRegion* pRegion = (*retCurrentIt).pRegion;
+ boxes.push_back( (*retCurrentIt).box );
+ //LLVector3 boxPos = (*retCurrentIt).box.getPositionAgent();
+ //TBD# Should we just use pRegion->objectIsReturnable, instead?
+ //As it does various other checks, childrenObjectReturnable does not.
+ bool retResult = (mRegionp && pRegion->childrenObjectReturnable( boxes )) ? 1 : 0;
+ if ( retResult )
+ {
+ result = true;
+ break;
+ }
}
}
#endif
return result;
}
-void LLViewerObject::buildReturnablesForChildrenVO( std::vector<PotentialReturnableObject>& returnables, LLViewerObject* pChild )
+void LLViewerObject::buildReturnablesForChildrenVO( std::vector<PotentialReturnableObject>& returnables, LLViewerObject* pChild, LLViewerRegion* pTargetRegion )
{
if ( !pChild )
{
llerrs<<"child viewerobject is NULL "<<llendl;
}
- constructAndAddReturnable( returnables, pChild );
+ constructAndAddReturnable( returnables, pChild, pTargetRegion );
- //We want to handle any children VO's.
+ //We want to handle any children VO's as well
for (child_list_t::iterator iter = pChild->mChildList.begin(); iter != pChild->mChildList.end(); iter++)
{
LLViewerObject* pChildofChild = *iter;
- buildReturnablesForChildrenVO( returnables, pChildofChild );
+ buildReturnablesForChildrenVO( returnables, pChildofChild, pTargetRegion );
}
}
-void LLViewerObject::constructAndAddReturnable( std::vector<PotentialReturnableObject>& returnables, LLViewerObject* pChild )
+void LLViewerObject::constructAndAddReturnable( std::vector<PotentialReturnableObject>& returnables, LLViewerObject* pChild, LLViewerRegion* pTargetRegion )
{
PotentialReturnableObject returnableObj;
- LLViewerRegion* pRegion = pChild->getRegion();
-
+
+ LLViewerRegion* pRegion = pChild->getRegion();
LLVector3d posGlobal = pRegion->getPosGlobalFromRegion( pChild->getPositionRegion() );
- LLVector3 targetRegionPos = pRegion->getPosRegionFromGlobal( posGlobal );
+ LLVector3 targetRegionPos = pTargetRegion->getPosRegionFromGlobal( posGlobal );
returnableObj.box = LLBBox( targetRegionPos, pChild->getRotationRegion(), pChild->getScale() * -0.5f,
pChild->getScale() * 0.5f).getAxisAligned();
- returnableObj.pRegion = pRegion;
+ returnableObj.pRegion = pTargetRegion;
returnables.push_back( returnableObj );
}
diff --git a/indra/newview/llviewerobject.h b/indra/newview/llviewerobject.h
index a7d0933dc3..f75a3d996d 100644
--- a/indra/newview/llviewerobject.h
+++ b/indra/newview/llviewerobject.h
@@ -240,8 +240,8 @@ public:
// anti-encroachment is enabled
bool isReturnable();
- void buildReturnablesForChildrenVO( std::vector<PotentialReturnableObject>& returnables, LLViewerObject* pChild );
- void constructAndAddReturnable( std::vector<PotentialReturnableObject>& returnables, LLViewerObject* pChild );
+ void buildReturnablesForChildrenVO( std::vector<PotentialReturnableObject>& returnables, LLViewerObject* pChild, LLViewerRegion* pTargetRegion );
+ void constructAndAddReturnable( std::vector<PotentialReturnableObject>& returnables, LLViewerObject* pChild, LLViewerRegion* pTargetRegion );
/*
// This method will scan through this object, and then query the