diff options
Diffstat (limited to 'indra/newview')
| -rw-r--r-- | indra/newview/app_settings/settings.xml | 75 | ||||
| -rw-r--r-- | indra/newview/lldrawable.cpp | 9 | ||||
| -rw-r--r-- | indra/newview/lldrawable.h | 1 | ||||
| -rw-r--r-- | indra/newview/llspatialpartition.cpp | 42 | ||||
| -rw-r--r-- | indra/newview/llviewercontrol.cpp | 16 | ||||
| -rw-r--r-- | indra/newview/llviewerdisplay.cpp | 1 | ||||
| -rw-r--r-- | indra/newview/llviewerobjectlist.cpp | 18 | ||||
| -rw-r--r-- | indra/newview/llviewerobjectlist.h | 1 | ||||
| -rw-r--r-- | indra/newview/llvovolume.cpp | 48 | ||||
| -rw-r--r-- | indra/newview/pipeline.cpp | 28 | ||||
| -rw-r--r-- | indra/newview/pipeline.h | 7 | 
11 files changed, 201 insertions, 45 deletions
| diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 78db307d64..2c6d75e3c9 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -7091,7 +7091,76 @@        <key>Value</key>        <integer>1</integer>      </map> -    <key>RenderAnisotropic</key> + +  <key>OctreeMaxNodeCapacity</key> +  <map> +    <key>Comment</key> +    <string>Maximum number of elements to store in a single octree node</string> +    <key>Persist</key> +    <integer>1</integer> +    <key>Type</key> +    <string>U32</string> +    <key>Value</key> +    <integer>128</integer> +  </map> + +  <key>OctreeStaticObjectSizeFactor</key> +  <map> +    <key>Comment</key> +    <string>Multiplier on static object size for determining octree node size </string> +    <key>Persist</key> +    <integer>1</integer> +    <key>Type</key> +    <string>S32</string> +    <key>Value</key> +    <integer>1</integer> +  </map> + +  <key>OctreeAlphaDistanceFactor</key> +  <map> +    <key>Comment</key> +    <string>Multiplier on alpha object distance for determining octree node size </string> +    <key>Persist</key> +    <integer>1</integer> +    <key>Type</key> +    <string>Vector3</string> +    <key>Value</key> +    <array> +      <real>0.05</real> +      <real>0.0</real> +      <real>0.0</real> +    </array> +  </map> + +  <key>OctreeAttachmentSizeFactor</key> +  <map> +    <key>Comment</key> +    <string>Multiplier on attachment size for determining octree node size </string> +    <key>Persist</key> +    <integer>1</integer> +    <key>Type</key> +    <string>S32</string> +    <key>Value</key> +    <integer>4</integer> +  </map> + +  <key>OctreeDistanceFactor</key> +  <map> +    <key>Comment</key> +    <string>Multiplier on distance for determining octree node size </string> +    <key>Persist</key> +    <integer>1</integer> +    <key>Type</key> +    <string>Vector3</string> +    <key>Value</key> +    <array> +      <real>0.05</real> +      <real>0.0</real> +      <real>0.0</real> +    </array> +  </map> + +  <key>RenderAnisotropic</key>      <map>        <key>Comment</key>        <string>Render textures using anisotropic filtering</string> @@ -7188,7 +7257,7 @@        <key>Type</key>        <string>F32</string>        <key>Value</key> -      <integer>1.0</integer> +      <real>1.0</real>      </map>      <key>RenderAvatarVP</key>      <map> @@ -8589,7 +8658,7 @@      <key>Type</key>      <string>S32</string>      <key>Value</key> -    <integer>8192</integer> +    <integer>65536</integer>    </map>      <key>RenderMaxVBOSize</key>      <map> diff --git a/indra/newview/lldrawable.cpp b/indra/newview/lldrawable.cpp index 7db13868d6..ad3710843c 100644 --- a/indra/newview/lldrawable.cpp +++ b/indra/newview/lldrawable.cpp @@ -94,7 +94,9 @@ void LLDrawable::init()  	mRenderType = 0;  	mCurrentScale = LLVector3(1,1,1);  	mDistanceWRTCamera = 0.0f; - +	mPositionGroup.clear(); +	mExtents[0].clear(); +	mExtents[1].clear();  	mQuietCount = 0;  	mState     = 0; @@ -587,7 +589,10 @@ void LLDrawable::setRadius(F32 radius)  void LLDrawable::moveUpdatePipeline(BOOL moved)  { -	makeActive(); +	if (moved) +	{ +		makeActive(); +	}  	// Update the face centers.  	for (S32 i = 0; i < getNumFaces(); i++) diff --git a/indra/newview/lldrawable.h b/indra/newview/lldrawable.h index 9ebe1a45b4..e268640a21 100644 --- a/indra/newview/lldrawable.h +++ b/indra/newview/lldrawable.h @@ -276,6 +276,7 @@ public:  		REBUILD_SHADOW =  0x02000000,  		HAS_ALPHA		= 0x04000000,  		RIGGED			= 0x08000000, +		PARTITION_MOVE	= 0x10000000,  	} EDrawableFlags;  private: //aligned members diff --git a/indra/newview/llspatialpartition.cpp b/indra/newview/llspatialpartition.cpp index a812ba4e03..8143d6a41f 100644 --- a/indra/newview/llspatialpartition.cpp +++ b/indra/newview/llspatialpartition.cpp @@ -69,6 +69,7 @@ U32 LLSpatialGroup::sNodeCount = 0;  std::set<GLuint> LLSpatialGroup::sPendingQueries; +U32 gOctreeMaxCapacity;  BOOL LLSpatialGroup::sNoDelete = FALSE; @@ -630,7 +631,7 @@ BOOL LLSpatialGroup::updateInGroup(LLDrawable *drawablep, BOOL immediate)  	if (mOctreeNode->isInside(drawablep->getPositionGroup()) &&   		(mOctreeNode->contains(drawablep) ||  		 (drawablep->getBinRadius() > mOctreeNode->getSize()[0] && -				parent && parent->getElementCount() >= LL_OCTREE_MAX_CAPACITY))) +				parent && parent->getElementCount() >= gOctreeMaxCapacity)))  	{  		unbound();  		setState(OBJECT_DIRTY); @@ -2515,7 +2516,7 @@ void renderOctree(LLSpatialGroup* group)  	//coded by buffer usage and activity  	gGL.setSceneBlendType(LLRender::BT_ADD_WITH_ALPHA);  	LLVector4 col; -	if (group->mBuilt > 0.f) +	/*if (group->mBuilt > 0.f)  	{  		group->mBuilt -= 2.f * gFrameIntervalSeconds;  		if (group->mBufferUsage == GL_STATIC_DRAW_ARB) @@ -2584,7 +2585,7 @@ void renderOctree(LLSpatialGroup* group)  			gGL.color4f(1,1,1,1);  		}  	} -	else +	else*/  	{  		if (group->mBufferUsage == GL_STATIC_DRAW_ARB && !group->getData().empty()   			&& group->mSpatialPartition->mRenderByGroup) @@ -2604,33 +2605,24 @@ void renderOctree(LLSpatialGroup* group)  	size.mul(1.01f);  	size.add(fudge); -	{ -		LLGLDepthTest depth(GL_TRUE, GL_FALSE); -		drawBox(group->mObjectBounds[0], fudge); -	} +	//{ +	//	LLGLDepthTest depth(GL_TRUE, GL_FALSE); +	//	drawBox(group->mObjectBounds[0], fudge); +	//}  	gGL.setSceneBlendType(LLRender::BT_ALPHA); -	if (group->mBuilt <= 0.f) +	//if (group->mBuilt <= 0.f)  	{  		//draw opaque outline -		gGL.color4f(col.mV[0], col.mV[1], col.mV[2], 1.f); -		drawBoxOutline(group->mObjectBounds[0], group->mObjectBounds[1]); +		//gGL.color4f(col.mV[0], col.mV[1], col.mV[2], 1.f); +		//drawBoxOutline(group->mObjectBounds[0], group->mObjectBounds[1]); -		if (group->mOctreeNode->isLeaf()) -		{ -			gGL.color4f(1,1,1,1); -		} -		else -		{ -			gGL.color4f(0,1,1,1); -		} -						 +		gGL.color4f(0,1,1,1);  		drawBoxOutline(group->mBounds[0],group->mBounds[1]); - - +		  		//draw bounding box for draw info -		if (group->mSpatialPartition->mRenderByGroup) +		/*if (group->mSpatialPartition->mRenderByGroup)  		{  			gGL.color4f(1.0f, 0.75f, 0.25f, 0.6f);  			for (LLSpatialGroup::draw_map_t::iterator i = group->mDrawMap.begin(); i != group->mDrawMap.end(); ++i) @@ -2647,7 +2639,7 @@ void renderOctree(LLSpatialGroup* group)  					drawBoxOutline(center, size);  				}  			} -		} +		}*/  	}  //	LLSpatialGroup::OctreeNode* node = group->mOctreeNode; @@ -2690,7 +2682,7 @@ void renderVisibility(LLSpatialGroup* group, LLCamera* camera)  			gGL.color4f(0.f, 0.75f, 0.f, 0.5f);  			pushBufferVerts(group, LLVertexBuffer::MAP_VERTEX);  		} -		else if (camera && group->mOcclusionVerts.notNull()) +		/*else if (camera && group->mOcclusionVerts.notNull())  		{  			LLVertexBuffer::unbind();  			group->mOcclusionVerts->setBuffer(LLVertexBuffer::MAP_VERTEX); @@ -2702,7 +2694,7 @@ void renderVisibility(LLSpatialGroup* group, LLCamera* camera)  			glColor4f(1.0f, 1.f, 1.f, 1.0f);  			group->mOcclusionVerts->drawRange(LLRender::TRIANGLE_FAN, 0, 7, 8, get_box_fan_indices(camera, group->mBounds[0]));  			glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); -		} +		}*/  	}  } diff --git a/indra/newview/llviewercontrol.cpp b/indra/newview/llviewercontrol.cpp index 00a0b87d93..61200db2b9 100644 --- a/indra/newview/llviewercontrol.cpp +++ b/indra/newview/llviewercontrol.cpp @@ -57,6 +57,7 @@  #include "llworld.h"  #include "pipeline.h"  #include "llviewerjoystick.h" +#include "llviewerobjectlist.h"  #include "llviewerparcelmgr.h"  #include "llparcel.h"  #include "llkeyboard.h" @@ -372,6 +373,16 @@ static bool handleResetVertexBuffersChanged(const LLSD&)  	return true;  } +static bool handleRepartition(const LLSD&) +{ +	if (gPipeline.isInit()) +	{ +		gOctreeMaxCapacity = gSavedSettings.getU32("OctreeMaxNodeCapacity"); +		gObjectList.repartitionObjects(); +	} +	return true; +} +  static bool handleRenderDynamicLODChanged(const LLSD& newvalue)  {  	LLPipeline::sDynamicLOD = newvalue.asBoolean(); @@ -575,6 +586,11 @@ void settings_setup_listeners()  	gSavedSettings.getControl("FirstPersonAvatarVisible")->getSignal()->connect(boost::bind(&handleRenderAvatarMouselookChanged, _2));  	gSavedSettings.getControl("RenderFarClip")->getSignal()->connect(boost::bind(&handleRenderFarClipChanged, _2));  	gSavedSettings.getControl("RenderTerrainDetail")->getSignal()->connect(boost::bind(&handleTerrainDetailChanged, _2)); +	gSavedSettings.getControl("OctreeStaticObjectSizeFactor")->getSignal()->connect(boost::bind(&handleRepartition, _2)); +	gSavedSettings.getControl("OctreeDistanceFactor")->getSignal()->connect(boost::bind(&handleRepartition, _2)); +	gSavedSettings.getControl("OctreeMaxNodeCapacity")->getSignal()->connect(boost::bind(&handleRepartition, _2)); +	gSavedSettings.getControl("OctreeAlphaDistanceFactor")->getSignal()->connect(boost::bind(&handleRepartition, _2)); +	gSavedSettings.getControl("OctreeAttachmentSizeFactor")->getSignal()->connect(boost::bind(&handleRepartition, _2));  	gSavedSettings.getControl("RenderUseTriStrips")->getSignal()->connect(boost::bind(&handleResetVertexBuffersChanged, _2));  	gSavedSettings.getControl("RenderAnimateTrees")->getSignal()->connect(boost::bind(&handleResetVertexBuffersChanged, _2));  	gSavedSettings.getControl("RenderAvatarVP")->getSignal()->connect(boost::bind(&handleSetShaderChanged, _2)); diff --git a/indra/newview/llviewerdisplay.cpp b/indra/newview/llviewerdisplay.cpp index 10e96525ce..5dadd2c33b 100644 --- a/indra/newview/llviewerdisplay.cpp +++ b/indra/newview/llviewerdisplay.cpp @@ -582,6 +582,7 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot)  			LLMemType mt_ug(LLMemType::MTYPE_DISPLAY_UPDATE_GEOM);  			const F32 max_geom_update_time = 0.005f*10.f*gFrameIntervalSeconds; // 50 ms/second update time  			gPipeline.createObjects(max_geom_update_time); +			gPipeline.processPartitionQ();  			gPipeline.updateGeom(max_geom_update_time);  			stop_glerror();  		} diff --git a/indra/newview/llviewerobjectlist.cpp b/indra/newview/llviewerobjectlist.cpp index 78b06b0764..45c6777ae8 100644 --- a/indra/newview/llviewerobjectlist.cpp +++ b/indra/newview/llviewerobjectlist.cpp @@ -1497,6 +1497,24 @@ void LLViewerObjectList::shiftObjects(const LLVector3 &offset)  	LLWorld::getInstance()->shiftRegions(offset);  } +void LLViewerObjectList::repartitionObjects() +{ +	for (vobj_list_t::iterator iter = mObjects.begin(); iter != mObjects.end(); ++iter) +	{ +		LLViewerObject* objectp = *iter; +		if (!objectp->isDead()) +		{ +			LLDrawable* drawable = objectp->mDrawable; +			if (drawable && !drawable->isDead()) +			{ +				drawable->updateBinRadius(); +				drawable->updateSpatialExtents(); +				drawable->movePartition(); +			} +		} +	} +} +  //debug code  bool LLViewerObjectList::hasMapObjectInRegion(LLViewerRegion* regionp)   { diff --git a/indra/newview/llviewerobjectlist.h b/indra/newview/llviewerobjectlist.h index 6f0d285f5d..9d1b5cb56f 100644 --- a/indra/newview/llviewerobjectlist.h +++ b/indra/newview/llviewerobjectlist.h @@ -105,6 +105,7 @@ public:  	void updateQuota( const LLUUID& objectId, const SelectionQuota& costs );  	void shiftObjects(const LLVector3 &offset); +	void repartitionObjects();  	bool hasMapObjectInRegion(LLViewerRegion* regionp) ;  	void clearAllMapObjectsInRegion(LLViewerRegion* regionp) ; diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index 943de669f6..cc443d32fb 100644 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -1245,7 +1245,19 @@ BOOL LLVOVolume::calcLOD()  	if (gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_LOD_INFO))  	{ -		setDebugText(llformat("%.2f:%.2f, %d", debug_distance, radius, cur_detail)); +		//setDebugText(llformat("%.2f:%.2f, %d", debug_distance, radius, cur_detail)); + +		F32 bin_radius = getBinRadius(); +		F32 node_size = 0.f;  + +		LLSpatialGroup* group = mDrawable->getSpatialGroup(); +		if (group) +		{ +			LLSpatialGroup::OctreeNode* node = group->mOctreeNode; +			node_size = node->getSize()[0]; +		} + +		setDebugText(llformat("%.2f:%.2f", bin_radius, node_size));  	}  	if (cur_detail != mLOD) @@ -1274,6 +1286,15 @@ BOOL LLVOVolume::updateLOD()  		gPipeline.markRebuild(mDrawable, LLDrawable::REBUILD_VOLUME, FALSE);  		mLODChanged = TRUE;  	} +	else +	{ +		F32 new_radius = getBinRadius(); +		F32 old_radius = mDrawable->getBinRadius(); +		if (new_radius < old_radius * 0.9f || new_radius > old_radius*1.1f) +		{ +			gPipeline.markPartitionMove(mDrawable); +		} +	}  	lod_changed = lod_changed || LLViewerObject::updateLOD(); @@ -3187,6 +3208,10 @@ F32 LLVOVolume::getBinRadius()  	F32 scale = 1.f; +	S32 size_factor = llmax(gSavedSettings.getS32("OctreeStaticObjectSizeFactor"), 1); +	S32 attachment_size_factor = llmax(gSavedSettings.getS32("OctreeAttachmentSizeFactor"), 1); +	LLVector3 distance_factor = gSavedSettings.getVector3("OctreeDistanceFactor"); +	LLVector3 alpha_distance_factor = gSavedSettings.getVector3("OctreeAlphaDistanceFactor");  	const LLVector4a* ext = mDrawable->getSpatialExtents();  	BOOL shrink_wrap = mDrawable->isAnimating(); @@ -3216,6 +3241,8 @@ F32 LLVOVolume::getBinRadius()  		radius = llmin(bounds.mV[1], bounds.mV[2]);  		radius = llmin(radius, bounds.mV[0]);  		radius *= 0.5f; +		radius *= 1.f+mDrawable->mDistanceWRTCamera*alpha_distance_factor[1]; +		radius += mDrawable->mDistanceWRTCamera*alpha_distance_factor[0];  	}  	else if (shrink_wrap)  	{ @@ -3226,24 +3253,19 @@ F32 LLVOVolume::getBinRadius()  	}  	else if (mDrawable->isStatic())  	{ -		/*if (mDrawable->getRadius() < 2.0f) -		{ -			radius = 16.f; -		} -		else -		{ -			radius = llmax(mDrawable->getRadius(), 32.f); -		}*/ - -		radius = (((S32) mDrawable->getRadius())/2+1)*8; +		radius = llmax((S32) mDrawable->getRadius(), 1)*size_factor; +		radius *= 1.f + mDrawable->mDistanceWRTCamera * distance_factor[1]; +		radius += mDrawable->mDistanceWRTCamera * distance_factor[0];  	}  	else if (mDrawable->getVObj()->isAttachment())  	{ -		radius = (((S32) (mDrawable->getRadius()*4)+1))*2; +		radius = llmax((S32) mDrawable->getRadius(),1)*attachment_size_factor;  	}  	else  	{ -		radius = 8.f; +		radius = mDrawable->getRadius(); +		radius *= 1.f + mDrawable->mDistanceWRTCamera * distance_factor[1]; +		radius += mDrawable->mDistanceWRTCamera * distance_factor[0];  	}  	return llclamp(radius*scale, 0.5f, 256.f); diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index 1214d1b545..fadae7c71e 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -392,6 +392,7 @@ void LLPipeline::init()  {  	LLMemType mt(LLMemType::MTYPE_PIPELINE_INIT); +	gOctreeMaxCapacity = gSavedSettings.getU32("OctreeMaxNodeCapacity");  	sDynamicLOD = gSavedSettings.getBOOL("RenderDynamicLOD");  	sRenderBump = gSavedSettings.getBOOL("RenderObjectBump");  	sUseTriStrips = gSavedSettings.getBOOL("RenderUseTriStrips"); @@ -2519,6 +2520,32 @@ void LLPipeline::markGLRebuild(LLGLUpdate* glu)  	}  } +void LLPipeline::markPartitionMove(LLDrawable* drawable) +{ +	if (!drawable->isState(LLDrawable::PARTITION_MOVE) &&  +		!drawable->getPositionGroup().equals3(LLVector4a::getZero())) +	{ +		drawable->setState(LLDrawable::PARTITION_MOVE); +		mPartitionQ.push_back(drawable); +	} +} + +void LLPipeline::processPartitionQ() +{ +	for (LLDrawable::drawable_list_t::iterator iter = mPartitionQ.begin(); iter != mPartitionQ.end(); ++iter) +	{ +		LLDrawable* drawable = *iter; +		if (!drawable->isDead()) +		{ +			drawable->updateBinRadius(); +			drawable->movePartition(); +		} +		drawable->clearState(LLDrawable::PARTITION_MOVE); +	} + +	mPartitionQ.clear(); +} +  void LLPipeline::markRebuild(LLSpatialGroup* group, BOOL priority)  {  	LLMemType mt(LLMemType::MTYPE_PIPELINE); @@ -5888,7 +5915,6 @@ LLSpatialPartition* LLPipeline::getSpatialPartition(LLViewerObject* vobj)  	return NULL;  } -  void LLPipeline::resetVertexBuffers(LLDrawable* drawable)  {  	if (!drawable || drawable->isDead()) diff --git a/indra/newview/pipeline.h b/indra/newview/pipeline.h index ed4a803e7e..e967b8c31e 100644 --- a/indra/newview/pipeline.h +++ b/indra/newview/pipeline.h @@ -157,7 +157,8 @@ public:  	void		markGLRebuild(LLGLUpdate* glu);  	void		markRebuild(LLSpatialGroup* group, BOOL priority = FALSE);  	void        markRebuild(LLDrawable *drawablep, LLDrawable::EDrawableFlags flag = LLDrawable::REBUILD_ALL, BOOL priority = FALSE); -		 +	void		markPartitionMove(LLDrawable* drawablep); +  	//get the object between start and end that's closest to start.  	LLViewerObject* lineSegmentIntersectInWorld(const LLVector3& start, const LLVector3& end,  												BOOL pick_transparent, @@ -211,6 +212,7 @@ public:  	void updateCull(LLCamera& camera, LLCullResult& result, S32 water_clip = 0, LLPlane* plane = NULL);  //if water_clip is 0, ignore water plane, 1, cull to above plane, -1, cull to below plane  	void createObjects(F32 max_dtime);  	void createObject(LLViewerObject* vobj); +	void processPartitionQ();  	void updateGeom(F32 max_dtime);  	void updateGL();  	void rebuildPriorityGroups(); @@ -636,6 +638,9 @@ protected:  	LLDrawable::drawable_list_t 	mBuildQ2; // non-priority  	LLSpatialGroup::sg_vector_t		mGroupQ1; //priority  	LLSpatialGroup::sg_vector_t		mGroupQ2; // non-priority + +	LLDrawable::drawable_list_t		mPartitionQ; //drawables that need to update their spatial partition radius  +  	bool mGroupQ2Locked;  	bool mGroupQ1Locked; | 
