diff options
| -rw-r--r-- | indra/newview/llviewerobject.cpp | 47 | ||||
| -rw-r--r-- | indra/newview/llviewerparceloverlay.cpp | 27 | ||||
| -rw-r--r-- | indra/newview/llviewerparceloverlay.h | 1 | ||||
| -rw-r--r-- | indra/newview/llviewerregion.cpp | 3 | 
4 files changed, 58 insertions, 20 deletions
diff --git a/indra/newview/llviewerobject.cpp b/indra/newview/llviewerobject.cpp index a3a6ef1888..c3a7d345f5 100644 --- a/indra/newview/llviewerobject.cpp +++ b/indra/newview/llviewerobject.cpp @@ -104,7 +104,6 @@  #include "llaccountingquota.h"  //#define DEBUG_UPDATE_TYPE -#define EXTENDED_ENCROACHMENT_CHECK //temp:  BOOL		LLViewerObject::sVelocityInterpolate = TRUE;  BOOL		LLViewerObject::sPingInterpolate = TRUE;  @@ -528,6 +527,7 @@ bool LLViewerObject::isReturnable()  	{  		return false;  	} +		  	std::vector<LLBBox> boxes;  	boxes.push_back(LLBBox(getPositionRegion(), getRotationRegion(), getScale() * -0.5f, getScale() * 0.5f).getAxisAligned());  	for (child_list_t::iterator iter = mChildList.begin(); @@ -538,13 +538,11 @@ bool LLViewerObject::isReturnable()  	}  	bool result = (mRegionp && mRegionp->objectIsReturnable(getPositionRegion(), boxes)) ? 1 : 0; - -#ifdef EXTENDED_ENCROACHMENT_CHECK	  	if ( !result )  	{		 -		std::vector<LLViewerRegion*> uniqueRegions;  		//Get list of neighboring regions relative to this vo's region +		std::vector<LLViewerRegion*> uniqueRegions;  		mRegionp->getNeighboringRegions( uniqueRegions );  		//Build aabb's - for root and all children @@ -552,9 +550,14 @@ bool LLViewerObject::isReturnable()  		typedef std::vector<LLViewerRegion*>::iterator RegionIt;  		RegionIt regionStart = uniqueRegions.begin();  		RegionIt regionEnd   = uniqueRegions.end(); +		  		for (; regionStart != regionEnd; ++regionStart )  		{  			LLViewerRegion* pTargetRegion = *regionStart; +			//Add the root vo as there may be no children and we still want +			//to test for any edge overlap +			buildReturnablesForChildrenVO( returnables, this, pTargetRegion ); +			//Add it's children  			for (child_list_t::iterator iter = mChildList.begin();  iter != mChildList.end(); iter++)  			{  				LLViewerObject* pChild = *iter;		 @@ -562,7 +565,7 @@ bool LLViewerObject::isReturnable()  			}  		}	 -		//TBD# Should probably create a region -> box list map  +		//TBD#Eventually create a region -> box list map   		typedef std::vector<PotentialReturnableObject>::iterator ReturnablesIt;  		ReturnablesIt retCurrentIt = returnables.begin();  		ReturnablesIt retEndIt = returnables.end(); @@ -572,10 +575,7 @@ bool LLViewerObject::isReturnable()  			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; +			bool retResult = (pRegion && pRegion->childrenObjectReturnable( boxes )) ? 1 : 0;  			if ( retResult )  			{   				result = true; @@ -583,7 +583,6 @@ bool LLViewerObject::isReturnable()  			}  		}  	} -#endif  	return result;  } @@ -606,16 +605,28 @@ void LLViewerObject::buildReturnablesForChildrenVO( std::vector<PotentialReturna  void LLViewerObject::constructAndAddReturnable( std::vector<PotentialReturnableObject>& returnables, LLViewerObject* pChild, LLViewerRegion* pTargetRegion )  { -	PotentialReturnableObject returnableObj; - -	LLViewerRegion* pRegion		= pChild->getRegion();			 -	LLVector3d posGlobal		= pRegion->getPosGlobalFromRegion( pChild->getPositionRegion() ); -	LLVector3 targetRegionPos	= pTargetRegion->getPosRegionFromGlobal( posGlobal ); -	returnableObj.box = LLBBox( targetRegionPos, pChild->getRotationRegion(), pChild->getScale() * -0.5f,  +	LLVector3 targetRegionPos; +	targetRegionPos.setVec( pChild->getPositionGlobal() );	 +	 +	LLBBox childBBox = LLBBox( targetRegionPos, pChild->getRotationRegion(), pChild->getScale() * -0.5f,   							    pChild->getScale() * 0.5f).getAxisAligned(); -	returnableObj.pRegion		= pTargetRegion; -	returnables.push_back( returnableObj ); +	 +	LLVector3 edgeA = targetRegionPos + childBBox.getMinLocal(); +	LLVector3 edgeB = targetRegionPos + childBBox.getMaxLocal(); +	 +	LLVector3d edgeAd, edgeBd; +	edgeAd.setVec(edgeA); +	edgeBd.setVec(edgeB); +	 +	//Only add the box when either of the extents are in a neighboring region +	if ( pTargetRegion->pointInRegionGlobal( edgeAd ) || pTargetRegion->pointInRegionGlobal( edgeBd ) ) +	{ +		PotentialReturnableObject returnableObj; +		returnableObj.box		= childBBox; +		returnableObj.pRegion	= pTargetRegion; +		returnables.push_back( returnableObj ); +	}  }  BOOL LLViewerObject::setParent(LLViewerObject* parent) diff --git a/indra/newview/llviewerparceloverlay.cpp b/indra/newview/llviewerparceloverlay.cpp index 26765bdd01..eff16b6a6e 100644 --- a/indra/newview/llviewerparceloverlay.cpp +++ b/indra/newview/llviewerparceloverlay.cpp @@ -173,6 +173,33 @@ bool LLViewerParcelOverlay::encroachesOwned(const std::vector<LLBBox>& boxes) co  	}  	return false;  } +bool LLViewerParcelOverlay::encroachesOnUnowned(const std::vector<LLBBox>& boxes) const +{ +	// boxes are expected to already be axis aligned +	for (U32 i = 0; i < boxes.size(); ++i) +	{ +		LLVector3 min = boxes[i].getMinAgent(); +		LLVector3 max = boxes[i].getMaxAgent(); +		 +		S32 left   = S32(llclamp((min.mV[VX] / PARCEL_GRID_STEP_METERS), 0.f, REGION_WIDTH_METERS - 1)); +		S32 right  = S32(llclamp((max.mV[VX] / PARCEL_GRID_STEP_METERS), 0.f, REGION_WIDTH_METERS - 1)); +		S32 top    = S32(llclamp((min.mV[VY] / PARCEL_GRID_STEP_METERS), 0.f, REGION_WIDTH_METERS - 1)); +		S32 bottom = S32(llclamp((max.mV[VY] / PARCEL_GRID_STEP_METERS), 0.f, REGION_WIDTH_METERS - 1)); +		 +		for (S32 row = top; row <= bottom; row++) +		{ +			for (S32 column = left; column <= right; column++) +			{ +				U8 type = ownership(row, column); +				if ((PARCEL_SELF != type)) +				{ +					return true; +				} +			} +		} +	} +	return false; +}  BOOL LLViewerParcelOverlay::isSoundLocal(const LLVector3& pos) const  { diff --git a/indra/newview/llviewerparceloverlay.h b/indra/newview/llviewerparceloverlay.h index c80baedda6..3c6794e7d0 100644 --- a/indra/newview/llviewerparceloverlay.h +++ b/indra/newview/llviewerparceloverlay.h @@ -60,6 +60,7 @@ public:  	// might be in another parcel. for now, we simply test axis aligned   	// bounding boxes which isn't perfect, but is close  	bool encroachesOwned(const std::vector<LLBBox>& boxes) const; +	bool encroachesOnUnowned(const std::vector<LLBBox>& boxes) const;  	BOOL			isSoundLocal(const LLVector3& pos) const; diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index 0df97d6050..85b4b60bf7 100644 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -1702,8 +1702,7 @@ bool LLViewerRegion::objectIsReturnable(const LLVector3& pos, const std::vector<  bool LLViewerRegion::childrenObjectReturnable( const std::vector<LLBBox>& boxes ) const  {  	bool result = false; -	//TBD# Do we need similar checks to objectIsReturnable? if so just use objectisreturnable -	result = ( mParcelOverlay && mParcelOverlay->encroachesOwned( boxes ) ) ? 1 : 0; +	result = ( mParcelOverlay && mParcelOverlay->encroachesOnUnowned( boxes ) ) ? 1 : 0;  	return result;  }  | 
