diff options
| -rw-r--r-- | indra/llcharacter/llcharacter.cpp | 7 | ||||
| -rw-r--r-- | indra/llcharacter/lleditingmotion.cpp | 3 | ||||
| -rw-r--r-- | indra/llcharacter/llkeyframewalkmotion.cpp | 4 | ||||
| -rw-r--r-- | indra/llcharacter/llmotioncontroller.cpp | 29 | ||||
| -rw-r--r-- | indra/llmath/lloctree.h | 125 | ||||
| -rw-r--r-- | indra/llmath/llvolume.cpp | 6 | ||||
| -rw-r--r-- | indra/llmath/llvolumeoctree.cpp | 6 | ||||
| -rw-r--r-- | indra/llmath/llvolumeoctree.h | 9 | ||||
| -rw-r--r-- | indra/newview/lldrawable.cpp | 4 | ||||
| -rw-r--r-- | indra/newview/lldrawable.h | 4 | ||||
| -rw-r--r-- | indra/newview/llface.cpp | 13 | ||||
| -rw-r--r-- | indra/newview/llspatialpartition.cpp | 42 | ||||
| -rw-r--r-- | indra/newview/llspatialpartition.h | 5 | ||||
| -rw-r--r-- | indra/newview/llvograss.cpp | 2 | ||||
| -rw-r--r-- | indra/newview/llvopartgroup.cpp | 2 | ||||
| -rw-r--r-- | indra/newview/llvovolume.cpp | 10 | ||||
| -rw-r--r-- | indra/newview/pipeline.cpp | 14 | 
17 files changed, 168 insertions, 117 deletions
| diff --git a/indra/llcharacter/llcharacter.cpp b/indra/llcharacter/llcharacter.cpp index 0a6a8f9fa6..07f0baae51 100644 --- a/indra/llcharacter/llcharacter.cpp +++ b/indra/llcharacter/llcharacter.cpp @@ -187,20 +187,14 @@ void LLCharacter::requestStopMotion( LLMotion* motion)  //-----------------------------------------------------------------------------  // updateMotions()  //----------------------------------------------------------------------------- -static LLFastTimer::DeclareTimer FTM_UPDATE_ANIMATION("Update Animation"); -static LLFastTimer::DeclareTimer FTM_UPDATE_HIDDEN_ANIMATION("Update Hidden Anim"); -static LLFastTimer::DeclareTimer FTM_UPDATE_MOTIONS("Update Motions"); -  void LLCharacter::updateMotions(e_update_t update_type)  {  	if (update_type == HIDDEN_UPDATE)  	{ -		LLFastTimer t(FTM_UPDATE_HIDDEN_ANIMATION);  		mMotionController.updateMotionsMinimal();  	}  	else  	{ -		LLFastTimer t(FTM_UPDATE_ANIMATION);  		// unpause if the number of outstanding pause requests has dropped to the initial one  		if (mMotionController.isPaused() && mPauseRequest->getNumRefs() == 1)  		{ @@ -208,7 +202,6 @@ void LLCharacter::updateMotions(e_update_t update_type)  		}  		bool force_update = (update_type == FORCE_UPDATE);  		{ -			LLFastTimer t(FTM_UPDATE_MOTIONS);  			mMotionController.updateMotions(force_update);  		}  	} diff --git a/indra/llcharacter/lleditingmotion.cpp b/indra/llcharacter/lleditingmotion.cpp index 830e323476..66b3c2bd25 100644 --- a/indra/llcharacter/lleditingmotion.cpp +++ b/indra/llcharacter/lleditingmotion.cpp @@ -158,14 +158,11 @@ BOOL LLEditingMotion::onActivate()  	return TRUE;  } -static LLFastTimer::DeclareTimer FTM_EDITING_MOTION("Editing Motion"); -  //-----------------------------------------------------------------------------  // LLEditingMotion::onUpdate()  //-----------------------------------------------------------------------------  BOOL LLEditingMotion::onUpdate(F32 time, U8* joint_mask)  { -	LLFastTimer t(FTM_EDITING_MOTION);  	LLVector3 focus_pt;  	LLVector3* pointAtPt = (LLVector3*)mCharacter->getAnimationData("PointAtPoint"); diff --git a/indra/llcharacter/llkeyframewalkmotion.cpp b/indra/llcharacter/llkeyframewalkmotion.cpp index ea63f9f8dc..d52eb89a5c 100644 --- a/indra/llcharacter/llkeyframewalkmotion.cpp +++ b/indra/llcharacter/llkeyframewalkmotion.cpp @@ -196,15 +196,11 @@ BOOL LLWalkAdjustMotion::onActivate()  	return TRUE;  } -static LLFastTimer::DeclareTimer FTM_WALK_ADJUST_MOTION("Walk Adjust"); -  //-----------------------------------------------------------------------------  // LLWalkAdjustMotion::onUpdate()  //-----------------------------------------------------------------------------  BOOL LLWalkAdjustMotion::onUpdate(F32 time, U8* joint_mask)  { -	LLFastTimer t(FTM_WALK_ADJUST_MOTION); -  	// delta_time is guaranteed to be non zero  	F32 delta_time = llclamp(time - mLastTime, TIME_EPSILON, MAX_TIME_DELTA);  	mLastTime = time; diff --git a/indra/llcharacter/llmotioncontroller.cpp b/indra/llcharacter/llmotioncontroller.cpp index e7ec83efc0..236b8c616d 100644 --- a/indra/llcharacter/llmotioncontroller.cpp +++ b/indra/llcharacter/llmotioncontroller.cpp @@ -539,14 +539,11 @@ void LLMotionController::updateIdleActiveMotions()  	}  } -static LLFastTimer::DeclareTimer FTM_UPDATE_MOTIONS_BY_TYPE("Update Motions By Type"); -  //-----------------------------------------------------------------------------  // updateMotionsByType()  //-----------------------------------------------------------------------------  void LLMotionController::updateMotionsByType(LLMotion::LLMotionBlendType anim_type)  { -	LLFastTimer t(FTM_UPDATE_MOTIONS_BY_TYPE);  	BOOL update_result = TRUE;  	U8 last_joint_signature[LL_CHARACTER_MAX_JOINTS]; @@ -798,9 +795,6 @@ void LLMotionController::updateLoadingMotions()  // call updateMotion() or updateMotionsMinimal() every frame  //----------------------------------------------------------------------------- -static LLFastTimer::DeclareTimer FTM_UPDATE_MOTION_PURGE_EXCESS("Purge Excess Motions"); -static LLFastTimer::DeclareTimer FTM_UPDATE_LOADING_MOTIONS("Update Loading Motions"); -  //-----------------------------------------------------------------------------  // updateMotion()  //----------------------------------------------------------------------------- @@ -814,12 +808,9 @@ void LLMotionController::updateMotions(bool force_update)  	mPrevTimerElapsed = cur_time;  	mLastTime = mAnimTime; -	{ -		LLFastTimer t(FTM_UPDATE_MOTION_PURGE_EXCESS); -		// Always cap the number of loaded motions -		purgeExcessMotions(); -	} -	 +	// Always cap the number of loaded motions +	purgeExcessMotions(); +		  	// Update timing info for this time step.  	if (!mPaused)  	{ @@ -840,11 +831,8 @@ void LLMotionController::updateMotions(bool force_update)  					mLastInterp = interp;  				} -				{ -					LLFastTimer t(FTM_UPDATE_LOADING_MOTIONS); -					updateLoadingMotions(); -				} - +				updateLoadingMotions(); +				  				return;  			} @@ -862,11 +850,8 @@ void LLMotionController::updateMotions(bool force_update)  		}  	} -	{ -		LLFastTimer t(FTM_UPDATE_LOADING_MOTIONS); -		updateLoadingMotions(); -	} - +	updateLoadingMotions(); +	  	resetJointSignatures();  	if (mPaused && !force_update) diff --git a/indra/llmath/lloctree.h b/indra/llmath/lloctree.h index 1b11e83b4a..d26ac8e298 100644 --- a/indra/llmath/lloctree.h +++ b/indra/llmath/lloctree.h @@ -79,9 +79,9 @@ public:  	typedef LLOctreeTraveler<T>									oct_traveler;  	typedef LLTreeTraveler<T>									tree_traveler; -	typedef typename std::set<LLPointer<T> >					element_list; -	typedef typename element_list::iterator						element_iter; -	typedef typename element_list::const_iterator	const_element_iter; +	typedef LLPointer<T>*										element_list; +	typedef LLPointer<T>*										element_iter; +	typedef const LLPointer<T>*									const_element_iter;  	typedef typename std::vector<LLTreeListener<T>*>::iterator	tree_listener_iter;  	typedef typename std::vector<LLOctreeNode<T>* >				child_list;  	typedef LLTreeNode<T>		BaseType; @@ -105,6 +105,9 @@ public:  	:	mParent((oct_node*)parent),   		mOctant(octant)   	{  +		mData = NULL; +		mDataEnd = NULL; +  		mCenter = center;  		mSize = size; @@ -123,6 +126,16 @@ public:  	{   		BaseType::destroyListeners();  +		for (U32 i = 0; i < mElementCount; ++i) +		{ +			mData[i]->setBinIndex(-1); +			mData[i] = NULL; +		} + +		free(mData); +		mData = NULL; +		mDataEnd = NULL; +  		for (U32 i = 0; i < getChildCount(); i++)  		{  			delete getChild(i); @@ -222,9 +235,14 @@ public:  	virtual bool isLeaf() const						{ return mChild.empty(); }  	U32 getElementCount() const						{ return mElementCount; } +	bool isEmpty() const							{ return mElementCount == 0; }  	element_list& getData()							{ return mData; }  	const element_list& getData() const				{ return mData; } -	 +	element_iter getDataBegin()						{ return mData; } +	element_iter getDataEnd()						{ return mDataEnd; } +	const_element_iter getDataBegin() const			{ return mData; } +	const_element_iter getDataEnd() const			{ return mDataEnd; } +		  	U32 getChildCount()	const						{ return mChildCount; }  	oct_node* getChild(U32 index)					{ return mChild[index]; }  	const oct_node* getChild(U32 index) const		{ return mChild[index]; } @@ -289,7 +307,7 @@ public:  	virtual bool insert(T* data)  	{ -		if (data == NULL) +		if (data == NULL || data->getBinIndex() != -1)  		{  			OCT_ERRS << "!!! INVALID ELEMENT ADDED TO OCTREE BRANCH !!!" << llendl;  			return false; @@ -302,13 +320,16 @@ public:  			if ((getElementCount() < gOctreeMaxCapacity && contains(data->getBinRadius()) ||  				(data->getBinRadius() > getSize()[0] &&	parent && parent->getElementCount() >= gOctreeMaxCapacity)))   			{ //it belongs here -				//if this is a redundant insertion, error out (should never happen) -				llassert(mData.find(data) == mData.end()); +				mElementCount++; +				mData = (element_list) realloc(mData, sizeof(LLPointer<T>)*mElementCount); -				mData.insert(data); -				BaseType::insert(data); +				//avoid unref on uninitialized memory +				memset(mData+mElementCount-1, 0, sizeof(LLPointer<T>)); -				mElementCount = mData.size(); +				mData[mElementCount-1] = data; +				mDataEnd = mData + mElementCount; +				data->setBinIndex(mElementCount-1); +				BaseType::insert(data);  				return true;  			}  			else @@ -342,10 +363,16 @@ public:  				if( lt == 0x7 )  				{ -					mData.insert(data); -					BaseType::insert(data); +					mElementCount++; +					mData = (element_list) realloc(mData, sizeof(LLPointer<T>)*mElementCount); + +					//avoid unref on uninitialized memory +					memset(mData+mElementCount-1, 0, sizeof(LLPointer<T>)); -					mElementCount = mData.size(); +					mData[mElementCount-1] = data; +					mDataEnd = mData + mElementCount; +					data->setBinIndex(mElementCount-1); +					BaseType::insert(data);  					return true;  				} @@ -394,23 +421,59 @@ public:  		return false;  	} +	void _remove(T* data, S32 i) +	{ //precondition -- mElementCount > 0, idx is in range [0, mElementCount) + +		mElementCount--; +		data->setBinIndex(-1);  +		 +		if (mElementCount > 0) +		{ +			if (mElementCount != i) +			{ +				mData[i] = mData[mElementCount]; //might unref data, do not access data after this point +				mData[i]->setBinIndex(i); +			} + +			mData[mElementCount] = NULL; //needed for unref +			mData = (element_list) realloc(mData, sizeof(LLPointer<T>)*mElementCount); +			mDataEnd = mData+mElementCount; +		} +		else +		{ +			mData[0] = NULL; //needed for unref +			free(mData); +			mData = NULL; +			mDataEnd = NULL; +		} + +		notifyRemoval(data); +		checkAlive(); +	} +  	bool remove(T* data)  	{ -		if (mData.find(data) != mData.end()) -		{	//we have data -			mData.erase(data); -			mElementCount = mData.size(); -			notifyRemoval(data); -			checkAlive(); -			return true; -		} -		else if (isInside(data)) +		S32 i = data->getBinIndex(); + +		if (i >= 0 && i < mElementCount) +		{ +			if (mData[i] == data) +			{ //found it +				_remove(data, i); +				llassert(data->getBinIndex() == -1); +				return true; +			} +		} +		 +		if (isInside(data))  		{  			oct_node* dest = getNodeAt(data);  			if (dest != this)  			{ -				return dest->remove(data); +				bool ret = dest->remove(data); +				llassert(data->getBinIndex() == -1); +				return ret;  			}  		} @@ -429,19 +492,20 @@ public:  		//node is now root  		llwarns << "!!! OCTREE REMOVING FACE BY ADDRESS, SEVERE PERFORMANCE PENALTY |||" << llendl;  		node->removeByAddress(data); +		llassert(data->getBinIndex() == -1);  		return true;  	}  	void removeByAddress(T* data)  	{ -        if (mData.find(data) != mData.end()) +        for (U32 i = 0; i < mElementCount; ++i)  		{ -			mData.erase(data); -			mElementCount = mData.size(); -			notifyRemoval(data); -			llwarns << "FOUND!" << llendl; -			checkAlive(); -			return; +			if (mData[i] == data) +			{ //we have data +				_remove(data, i); +				llwarns << "FOUND!" << llendl; +				return; +			}  		}  		for (U32 i = 0; i < getChildCount(); i++) @@ -606,6 +670,7 @@ protected:  	U32 mChildCount;  	element_list mData; +	element_iter mDataEnd;  	U32 mElementCount;  };  diff --git a/indra/llmath/llvolume.cpp b/indra/llmath/llvolume.cpp index cc9744756f..c6d405c675 100644 --- a/indra/llmath/llvolume.cpp +++ b/indra/llmath/llvolume.cpp @@ -328,16 +328,16 @@ public:  		LLVector4a& min = node->mExtents[0];  		LLVector4a& max = node->mExtents[1]; -		if (!branch->getData().empty()) +		if (!branch->isEmpty())  		{ //node has data, find AABB that binds data set -			const LLVolumeTriangle* tri = *(branch->getData().begin()); +			const LLVolumeTriangle* tri = *(branch->getDataBegin());  			//initialize min/max to first available vertex  			min = *(tri->mV[0]);  			max = *(tri->mV[0]);  			for (LLOctreeNode<LLVolumeTriangle>::const_element_iter iter =  -				branch->getData().begin(); iter != branch->getData().end(); ++iter) +				branch->getDataBegin(); iter != branch->getDataEnd(); ++iter)  			{ //for each triangle in node  				//stretch by triangles in node diff --git a/indra/llmath/llvolumeoctree.cpp b/indra/llmath/llvolumeoctree.cpp index b5a935c2b5..cc83cb7235 100644 --- a/indra/llmath/llvolumeoctree.cpp +++ b/indra/llmath/llvolumeoctree.cpp @@ -131,7 +131,7 @@ void LLOctreeTriangleRayIntersect::traverse(const LLOctreeNode<LLVolumeTriangle>  void LLOctreeTriangleRayIntersect::visit(const LLOctreeNode<LLVolumeTriangle>* node)  {  	for (LLOctreeNode<LLVolumeTriangle>::const_element_iter iter =  -			node->getData().begin(); iter != node->getData().end(); ++iter) +			node->getDataBegin(); iter != node->getDataEnd(); ++iter)  	{  		const LLVolumeTriangle* tri = *iter; @@ -236,8 +236,8 @@ void LLVolumeOctreeValidate::visit(const LLOctreeNode<LLVolumeTriangle>* branch)  	}  	//children fit, check data -	for (LLOctreeNode<LLVolumeTriangle>::const_element_iter iter = branch->getData().begin();  -			iter != branch->getData().end(); ++iter) +	for (LLOctreeNode<LLVolumeTriangle>::const_element_iter iter = branch->getDataBegin();  +			iter != branch->getDataEnd(); ++iter)  	{  		const LLVolumeTriangle* tri = *iter; diff --git a/indra/llmath/llvolumeoctree.h b/indra/llmath/llvolumeoctree.h index 688d91dc40..ed54fe0835 100644 --- a/indra/llmath/llvolumeoctree.h +++ b/indra/llmath/llvolumeoctree.h @@ -39,7 +39,7 @@ class LLVolumeTriangle : public LLRefCount  public:  	LLVolumeTriangle()  	{ -		 +		mBinIndex = -1;	  	}  	LLVolumeTriangle(const LLVolumeTriangle& rhs) @@ -64,9 +64,16 @@ public:  	U16 mIndex[3];  	F32 mRadius; +	mutable S32 mBinIndex; +  	virtual const LLVector4a& getPositionGroup() const;  	virtual const F32& getBinRadius() const; +	 +	S32 getBinIndex() const { return mBinIndex; } +	void setBinIndex(S32 idx) const { mBinIndex = idx; } + +  };  class LLVolumeOctreeListener : public LLOctreeListener<LLVolumeTriangle> diff --git a/indra/newview/lldrawable.cpp b/indra/newview/lldrawable.cpp index 98246162f0..a42f4fcaa1 100644 --- a/indra/newview/lldrawable.cpp +++ b/indra/newview/lldrawable.cpp @@ -108,6 +108,8 @@ void LLDrawable::init()  	mGeneration = -1;  	mBinRadius = 1.f; +	mBinIndex = -1; +  	mSpatialBridge = NULL;  } @@ -1099,6 +1101,8 @@ LLSpatialBridge::LLSpatialBridge(LLDrawable* root, BOOL render_by_group, U32 dat  	mDrawable = root;  	root->setSpatialBridge(this); +	mBinIndex = -1; +  	mRenderType = mDrawable->mRenderType;  	mDrawableType = mDrawable->mRenderType; diff --git a/indra/newview/lldrawable.h b/indra/newview/lldrawable.h index e2064b79f8..c01a8c3c29 100644 --- a/indra/newview/lldrawable.h +++ b/indra/newview/lldrawable.h @@ -109,6 +109,9 @@ public:  	F32			          getIntensity() const			{ return llmin(mXform.getScale().mV[0], 4.f); }  	S32					  getLOD() const				{ return mVObjp ? mVObjp->getLOD() : 1; }  	F32					  getBinRadius() const			{ return mBinRadius; } +	S32					  getBinIndex() const			{ return mBinIndex; } +	void				  setBinIndex(S32 index) const	{ mBinIndex = index; } +  	void  getMinMax(LLVector3& min,LLVector3& max) const { mXform.getMinMax(min,max); }  	LLXformMatrix*		getXform() { return &mXform; } @@ -315,6 +318,7 @@ private:  	mutable U32		mVisible;  	F32				mRadius;  	F32				mBinRadius; +	mutable S32		mBinIndex;  	S32				mGeneration;  	LLVector3		mCurrentScale; diff --git a/indra/newview/llface.cpp b/indra/newview/llface.cpp index 49a20d5ef9..c1c68040cd 100644 --- a/indra/newview/llface.cpp +++ b/indra/newview/llface.cpp @@ -163,15 +163,10 @@ void LLFace::init(LLDrawable* drawablep, LLViewerObject* objp)  	mGeomCount		= 0;  	mGeomIndex		= 0;  	mIndicesCount	= 0; -	if (drawablep->getRenderType() == LLPipeline::RENDER_TYPE_PARTICLES || -		drawablep->getRenderType() == LLPipeline::RENDER_TYPE_HUD_PARTICLES) -	{ //indicate to LLParticlePartition that this particle is uninitialized -		mIndicesIndex = 0xFFFFFFFF; -	} -	else -	{ -		mIndicesIndex	= 0; -	} + +	//special value to indicate uninitialized position +	mIndicesIndex	= 0xFFFFFFFF; +	  	mIndexInTex = 0;  	mTexture		= NULL;  	mTEOffset		= -1; diff --git a/indra/newview/llspatialpartition.cpp b/indra/newview/llspatialpartition.cpp index 9a0a3e12dd..02f9aaad8c 100644 --- a/indra/newview/llspatialpartition.cpp +++ b/indra/newview/llspatialpartition.cpp @@ -541,7 +541,7 @@ void LLSpatialGroup::validate()  	validateDrawMap(); -	for (element_iter i = getData().begin(); i != getData().end(); ++i) +	for (element_iter i = getDataBegin(); i != getDataEnd(); ++i)  	{  		LLDrawable* drawable = *i;  		sg_assert(drawable->getSpatialGroup() == this); @@ -758,7 +758,7 @@ BOOL LLSpatialGroup::boundObjects(BOOL empty, LLVector4a& minOut, LLVector4a& ma  {	  	const OctreeNode* node = mOctreeNode; -	if (node->getData().empty()) +	if (node->isEmpty())  	{	//don't do anything if there are no objects  		if (empty && mOctreeNode->getParent())  		{	//only root is allowed to be empty @@ -775,14 +775,14 @@ BOOL LLSpatialGroup::boundObjects(BOOL empty, LLVector4a& minOut, LLVector4a& ma  		clearState(OBJECT_DIRTY);  		//initialize bounding box to first element -		OctreeNode::const_element_iter i = node->getData().begin(); +		OctreeNode::const_element_iter i = node->getDataBegin();  		LLDrawable* drawablep = *i;  		const LLVector4a* minMax = drawablep->getSpatialExtents();  		newMin = minMax[0];  		newMax = minMax[1]; -		for (++i; i != node->getData().end(); ++i) +		for (++i; i != node->getDataEnd(); ++i)  		{  			drawablep = *i;  			minMax = drawablep->getSpatialExtents(); @@ -1244,7 +1244,7 @@ void LLSpatialGroup::updateDistance(LLCamera &camera)  		llerrs << "Spatial group dirty on distance update." << llendl;  	}  #endif -	if (!getData().empty()) +	if (!isEmpty())  	{  		mRadius = mSpatialPartition->mRenderByGroup ? mObjectBounds[1].getLength3().getF32() :  						(F32) mOctreeNode->getSize().getLength3().getF32(); @@ -1395,7 +1395,7 @@ void LLSpatialGroup::handleDestruction(const TreeNode* node)  	LLMemType mt(LLMemType::MTYPE_SPACE_PARTITION);  	setState(DEAD); -	for (element_iter i = getData().begin(); i != getData().end(); ++i) +	for (element_iter i = getDataBegin(); i != getDataEnd(); ++i)  	{  		LLDrawable* drawable = *i;  		if (drawable->getSpatialGroup() == this) @@ -1482,7 +1482,7 @@ void LLSpatialGroup::destroyGL(bool keep_occlusion)  	} -	for (LLSpatialGroup::element_iter i = getData().begin(); i != getData().end(); ++i) +	for (LLSpatialGroup::element_iter i = getDataBegin(); i != getDataEnd(); ++i)  	{  		LLDrawable* drawable = *i;  		for (S32 j = 0; j < drawable->getNumFaces(); j++) @@ -2114,7 +2114,7 @@ public:  	virtual void processGroup(LLSpatialGroup* group)  	{ -		llassert(!group->isState(LLSpatialGroup::DIRTY) && !group->getData().empty()) +		llassert(!group->isState(LLSpatialGroup::DIRTY) && !group->isEmpty())  		if (mRes < 2)  		{ @@ -2181,7 +2181,7 @@ public:  	{  		LLSpatialGroup::OctreeNode* branch = group->mOctreeNode; -		for (LLSpatialGroup::OctreeNode::const_element_iter i = branch->getData().begin(); i != branch->getData().end(); ++i) +		for (LLSpatialGroup::OctreeNode::const_element_iter i = branch->getDataBegin(); i != branch->getDataEnd(); ++i)  		{  			LLDrawable* drawable = *i; @@ -2305,7 +2305,7 @@ public:  		LLSpatialGroup* group = (LLSpatialGroup*) state->getListener(0);  		group->destroyGL(); -		for (LLSpatialGroup::element_iter i = group->getData().begin(); i != group->getData().end(); ++i) +		for (LLSpatialGroup::element_iter i = group->getDataBegin(); i != group->getDataEnd(); ++i)  		{  			LLDrawable* drawable = *i;  			if (drawable->getVObj().notNull() && !group->mSpatialPartition->mRenderByGroup) @@ -2615,7 +2615,7 @@ void renderOctree(LLSpatialGroup* group)  			gGL.flush();  			glLineWidth(1.f);  			gGL.flush(); -			for (LLSpatialGroup::element_iter i = group->getData().begin(); i != group->getData().end(); ++i) +			for (LLSpatialGroup::element_iter i = group->getDataBegin(); i != group->getDataEnd(); ++i)  			{  				LLDrawable* drawable = *i;  				if (!group->mSpatialPartition->isBridge()) @@ -2661,7 +2661,7 @@ void renderOctree(LLSpatialGroup* group)  	}  	else  	{ -		if (group->mBufferUsage == GL_STATIC_DRAW_ARB && !group->getData().empty()  +		if (group->mBufferUsage == GL_STATIC_DRAW_ARB && !group->isEmpty()   			&& group->mSpatialPartition->mRenderByGroup)  		{  			col.setVec(0.8f, 0.4f, 0.1f, 0.1f); @@ -2729,7 +2729,7 @@ void renderVisibility(LLSpatialGroup* group, LLCamera* camera)  	glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);  	BOOL render_objects = (!LLPipeline::sUseOcclusion || !group->isOcclusionState(LLSpatialGroup::OCCLUDED)) && group->isVisible() && -							!group->getData().empty(); +							!group->isEmpty();  	if (render_objects)  	{ @@ -3460,7 +3460,7 @@ void renderPhysicsShape(LLDrawable* drawable, LLVOVolume* volume)  void renderPhysicsShapes(LLSpatialGroup* group)  { -	for (LLSpatialGroup::OctreeNode::const_element_iter i = group->getData().begin(); i != group->getData().end(); ++i) +	for (LLSpatialGroup::OctreeNode::const_element_iter i = group->getDataBegin(); i != group->getDataEnd(); ++i)  	{  		LLDrawable* drawable = *i;  		LLVOVolume* volume = drawable->getVOVolume(); @@ -3705,7 +3705,7 @@ public:  		LLVector3 center, size; -		if (branch->getData().empty()) +		if (branch->isEmpty())  		{  			gGL.diffuseColor3f(1.f,0.2f,0.f);  			center.set(branch->getCenter().getF32ptr()); @@ -3741,8 +3741,8 @@ public:  			}  			gGL.begin(LLRender::TRIANGLES); -			for (LLOctreeNode<LLVolumeTriangle>::const_element_iter iter = branch->getData().begin(); -					iter != branch->getData().end(); +			for (LLOctreeNode<LLVolumeTriangle>::const_element_iter iter = branch->getDataBegin(); +					iter != branch->getDataEnd();  					++iter)  			{  				const LLVolumeTriangle* tri = *iter; @@ -3979,7 +3979,7 @@ public:  		if (gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_BBOXES))  		{ -			if (!group->getData().empty()) +			if (!group->isEmpty())  			{  				gGL.diffuseColor3f(0,0,1);  				drawBoxOutline(group->mObjectBounds[0], @@ -3987,7 +3987,7 @@ public:  			}  		} -		for (LLSpatialGroup::OctreeNode::const_element_iter i = branch->getData().begin(); i != branch->getData().end(); ++i) +		for (LLSpatialGroup::OctreeNode::const_element_iter i = branch->getDataBegin(); i != branch->getDataEnd(); ++i)  		{  			LLDrawable* drawable = *i; @@ -4172,7 +4172,7 @@ public:  			return;  		} -		for (LLSpatialGroup::OctreeNode::const_element_iter i = branch->getData().begin(); i != branch->getData().end(); ++i) +		for (LLSpatialGroup::OctreeNode::const_element_iter i = branch->getDataBegin(); i != branch->getDataEnd(); ++i)  		{  			LLDrawable* drawable = *i; @@ -4395,7 +4395,7 @@ public:  	virtual void visit(const LLSpatialGroup::OctreeNode* branch)   	{	 -		for (LLSpatialGroup::OctreeNode::const_element_iter i = branch->getData().begin(); i != branch->getData().end(); ++i) +		for (LLSpatialGroup::OctreeNode::const_element_iter i = branch->getDataBegin(); i != branch->getDataEnd(); ++i)  		{  			check(*i);  		} diff --git a/indra/newview/llspatialpartition.h b/indra/newview/llspatialpartition.h index e02bbd3096..e82c50b92b 100644 --- a/indra/newview/llspatialpartition.h +++ b/indra/newview/llspatialpartition.h @@ -325,8 +325,13 @@ public:  	void dirtyGeom() { setState(GEOM_DIRTY); }  	void dirtyMesh() { setState(MESH_DIRTY); } + +	//octree wrappers to make code more readable  	element_list& getData() { return mOctreeNode->getData(); } +	element_iter getDataBegin() { return mOctreeNode->getDataBegin(); } +	element_iter getDataEnd() { return mOctreeNode->getDataEnd(); }  	U32 getElementCount() const { return mOctreeNode->getElementCount(); } +	bool isEmpty() const { return mOctreeNode->isEmpty(); }  	void drawObjectBox(LLColor4 col); diff --git a/indra/newview/llvograss.cpp b/indra/newview/llvograss.cpp index 44968342bf..5ad9ccc9af 100644 --- a/indra/newview/llvograss.cpp +++ b/indra/newview/llvograss.cpp @@ -622,7 +622,7 @@ void LLGrassPartition::addGeometryCount(LLSpatialGroup* group, U32& vertex_count  	mFaceList.clear();  	LLViewerCamera* camera = LLViewerCamera::getInstance(); -	for (LLSpatialGroup::element_iter i = group->getData().begin(); i != group->getData().end(); ++i) +	for (LLSpatialGroup::element_iter i = group->getDataBegin(); i != group->getDataEnd(); ++i)  	{  		LLDrawable* drawablep = *i; diff --git a/indra/newview/llvopartgroup.cpp b/indra/newview/llvopartgroup.cpp index e21358b65a..02282fd6a6 100644 --- a/indra/newview/llvopartgroup.cpp +++ b/indra/newview/llvopartgroup.cpp @@ -554,7 +554,7 @@ void LLParticlePartition::addGeometryCount(LLSpatialGroup* group, U32& vertex_co  	mFaceList.clear();  	LLViewerCamera* camera = LLViewerCamera::getInstance(); -	for (LLSpatialGroup::element_iter i = group->getData().begin(); i != group->getData().end(); ++i) +	for (LLSpatialGroup::element_iter i = group->getDataBegin(); i != group->getDataEnd(); ++i)  	{  		LLDrawable* drawablep = *i; diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index c4e7ea44b4..a4a142958e 100644 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -4232,7 +4232,7 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group)  		LLFastTimer t(FTM_REBUILD_VOLUME_FACE_LIST);  		//get all the faces into a list -		for (LLSpatialGroup::element_iter drawable_iter = group->getData().begin(); drawable_iter != group->getData().end(); ++drawable_iter) +		for (LLSpatialGroup::element_iter drawable_iter = group->getDataBegin(); drawable_iter != group->getDataEnd(); ++drawable_iter)  		{  			LLDrawable* drawablep = *drawable_iter; @@ -4638,7 +4638,7 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group)  	if (!LLPipeline::sDelayVBUpdate)  	{  		//drawables have been rebuilt, clear rebuild status -		for (LLSpatialGroup::element_iter drawable_iter = group->getData().begin(); drawable_iter != group->getData().end(); ++drawable_iter) +		for (LLSpatialGroup::element_iter drawable_iter = group->getDataBegin(); drawable_iter != group->getDataEnd(); ++drawable_iter)  		{  			LLDrawable* drawablep = *drawable_iter;  			drawablep->clearState(LLDrawable::REBUILD_ALL); @@ -4678,7 +4678,7 @@ void LLVolumeGeometryManager::rebuildMesh(LLSpatialGroup* group)  		std::set<LLVertexBuffer*> mapped_buffers; -		for (LLSpatialGroup::element_iter drawable_iter = group->getData().begin(); drawable_iter != group->getData().end(); ++drawable_iter) +		for (LLSpatialGroup::element_iter drawable_iter = group->getDataBegin(); drawable_iter != group->getDataEnd(); ++drawable_iter)  		{  			LLDrawable* drawablep = *drawable_iter; @@ -4740,7 +4740,7 @@ void LLVolumeGeometryManager::rebuildMesh(LLSpatialGroup* group)  		if(num_mapped_veretx_buffer != LLVertexBuffer::sMappedCount)   		{  			llwarns << "Not all mapped vertex buffers are unmapped!" << llendl ;  -			for (LLSpatialGroup::element_iter drawable_iter = group->getData().begin(); drawable_iter != group->getData().end(); ++drawable_iter) +			for (LLSpatialGroup::element_iter drawable_iter = group->getDataBegin(); drawable_iter != group->getDataEnd(); ++drawable_iter)  			{  				LLDrawable* drawablep = *drawable_iter;  				for (S32 i = 0; i < drawablep->getNumFaces(); ++i) @@ -5208,7 +5208,7 @@ void LLGeometryManager::addGeometryCount(LLSpatialGroup* group, U32 &vertex_coun  	//for each drawable -	for (LLSpatialGroup::element_iter drawable_iter = group->getData().begin(); drawable_iter != group->getData().end(); ++drawable_iter) +	for (LLSpatialGroup::element_iter drawable_iter = group->getDataBegin(); drawable_iter != group->getDataEnd(); ++drawable_iter)  	{  		LLDrawable* drawablep = *drawable_iter; diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index c981bb55cf..0a4cf63205 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -1342,7 +1342,7 @@ public:  	{  		LLSpatialGroup* group = (LLSpatialGroup*) node->getListener(0); -		if (!group->isState(LLSpatialGroup::GEOM_DIRTY) && !group->getData().empty()) +		if (!group->isState(LLSpatialGroup::GEOM_DIRTY) && !group->isEmpty())  		{  			for (LLSpatialGroup::draw_map_t::iterator i = group->mDrawMap.begin(); i != group->mDrawMap.end(); ++i)  			{ @@ -1947,7 +1947,7 @@ void LLPipeline::clearReferences()  void check_references(LLSpatialGroup* group, LLDrawable* drawable)  { -	for (LLSpatialGroup::element_iter i = group->getData().begin(); i != group->getData().end(); ++i) +	for (LLSpatialGroup::element_iter i = group->getDataBegin(); i != group->getDataEnd(); ++i)  	{  		if (drawable == *i)  		{ @@ -1969,7 +1969,7 @@ void check_references(LLDrawable* drawable, LLFace* face)  void check_references(LLSpatialGroup* group, LLFace* face)  { -	for (LLSpatialGroup::element_iter i = group->getData().begin(); i != group->getData().end(); ++i) +	for (LLSpatialGroup::element_iter i = group->getDataBegin(); i != group->getDataEnd(); ++i)  	{  		LLDrawable* drawable = *i;  		check_references(drawable, face); @@ -2345,7 +2345,7 @@ void LLPipeline::updateCull(LLCamera& camera, LLCullResult& result, S32 water_cl  void LLPipeline::markNotCulled(LLSpatialGroup* group, LLCamera& camera)  { -	if (group->getData().empty()) +	if (group->isEmpty())  	{   		return;  	} @@ -2973,7 +2973,7 @@ void LLPipeline::stateSort(LLCamera& camera, LLCullResult &result)  		else  		{  			group->setVisible(); -			for (LLSpatialGroup::element_iter i = group->getData().begin(); i != group->getData().end(); ++i) +			for (LLSpatialGroup::element_iter i = group->getDataBegin(); i != group->getDataEnd(); ++i)  			{  				markVisible(*i, camera);  			} @@ -3061,7 +3061,7 @@ void LLPipeline::stateSort(LLSpatialGroup* group, LLCamera& camera)  	LLMemType mt(LLMemType::MTYPE_PIPELINE_STATE_SORT);  	if (group->changeLOD())  	{ -		for (LLSpatialGroup::element_iter i = group->getData().begin(); i != group->getData().end(); ++i) +		for (LLSpatialGroup::element_iter i = group->getDataBegin(); i != group->getDataEnd(); ++i)  		{  			LLDrawable* drawablep = *i;  			stateSort(drawablep, camera); @@ -3184,7 +3184,7 @@ void forAllDrawables(LLCullResult::sg_iterator begin,  {  	for (LLCullResult::sg_iterator i = begin; i != end; ++i)  	{ -		for (LLSpatialGroup::element_iter j = (*i)->getData().begin(); j != (*i)->getData().end(); ++j) +		for (LLSpatialGroup::element_iter j = (*i)->getDataBegin(); j != (*i)->getDataEnd(); ++j)  		{  			func(*j);	  		} | 
