diff options
| -rwxr-xr-x | indra/newview/app_settings/settings.xml | 2 | ||||
| -rw-r--r-- | indra/newview/llvieweroctree.cpp | 18 | ||||
| -rw-r--r-- | indra/newview/llvieweroctree.h | 2 | ||||
| -rwxr-xr-x | indra/newview/llvocache.cpp | 29 | ||||
| -rwxr-xr-x | indra/newview/llvocache.h | 2 | 
5 files changed, 32 insertions, 21 deletions
| diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index df2079a6e4..f7af39d486 100755 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -10240,7 +10240,7 @@        <key>Type</key>        <string>F32</string>        <key>Value</key> -      <real>20.0</real> +      <real>32.0</real>      </map>    <key>SceneLoadRearMaxRadiusFraction</key>    <map> diff --git a/indra/newview/llvieweroctree.cpp b/indra/newview/llvieweroctree.cpp index ff8f4d2434..aef632e913 100644 --- a/indra/newview/llvieweroctree.cpp +++ b/indra/newview/llvieweroctree.cpp @@ -1439,22 +1439,30 @@ S32 LLViewerOctreeCull::AABBRegionSphereIntersectObjectExtents(const LLViewerOct  }  //------------------------------------------  //check if the objects projection large enough -bool LLViewerOctreeCull::checkProjectionArea(const LLVector4a& center, const LLVector4a& size, const LLVector3& shift, F32 pixel_threshold, F32 near_squared_radius) + +static LLTrace::BlockTimerStatHandle sProjectedAreaCheckTimeStat("Object projected area check", "Culling objects based on projected area"); + +bool LLViewerOctreeCull::checkProjectionArea(const LLVector4a& center, const LLVector4a& size, const LLVector3& shift, F32 pixel_threshold, F32 near_radius)  {	 +	LL_RECORD_BLOCK_TIME(sProjectedAreaCheckTimeStat);  	LLVector3 local_orig = mCamera->getOrigin() - shift;  	LLVector4a origin;  	origin.load3(local_orig.mV);  	LLVector4a lookAt;  	lookAt.setSub(center, origin); -	F32 squared_dist = lookAt.dot3(lookAt).getF32(); -	if(squared_dist < near_squared_radius) +	F32 distance = lookAt.getLength3().getF32(); +	if(distance <= near_radius)  	{ -		return true; //always load closeby objects +		return true; //always load close-by objects  	} +	// treat object as if it were near_radius meters closer than it actually was. +	// this allows us to get some temporal coherence on visibility...objects that can be reached quickly will tend to be visible +	distance -= near_radius; +  	F32 squared_rad = size.dot3(size).getF32(); -	return squared_rad / squared_dist > pixel_threshold; +	return squared_rad / (distance * distance) > pixel_threshold;  }  //virtual  diff --git a/indra/newview/llvieweroctree.h b/indra/newview/llvieweroctree.h index d73772b84e..0f32e0dcc4 100644 --- a/indra/newview/llvieweroctree.h +++ b/indra/newview/llvieweroctree.h @@ -394,7 +394,7 @@ protected:  	virtual S32 frustumCheck(const LLViewerOctreeGroup* group) = 0;  	virtual S32 frustumCheckObjects(const LLViewerOctreeGroup* group) = 0; -	bool checkProjectionArea(const LLVector4a& center, const LLVector4a& size, const LLVector3& shift, F32 pixel_threshold, F32 near_squared_radius); +	bool checkProjectionArea(const LLVector4a& center, const LLVector4a& size, const LLVector3& shift, F32 pixel_threshold, F32 near_radius);  	virtual bool checkObjects(const OctreeNode* branch, const LLViewerOctreeGroup* group);  	virtual void preprocess(LLViewerOctreeGroup* group);  	virtual void processGroup(LLViewerOctreeGroup* group); diff --git a/indra/newview/llvocache.cpp b/indra/newview/llvocache.cpp index 05d61fab49..956f9a2667 100755 --- a/indra/newview/llvocache.cpp +++ b/indra/newview/llvocache.cpp @@ -37,7 +37,7 @@  //static variables  U32 LLVOCacheEntry::sMinFrameRange = 0; -F32 LLVOCacheEntry::sNearRadiusSquared = 1.0f; +F32 LLVOCacheEntry::sNearRadius = 1.0f;  F32 LLVOCacheEntry::sRearFarRadius = 1.0f;  F32 LLVOCacheEntry::sFrontPixelThreshold = 1.0f;  F32 LLVOCacheEntry::sRearPixelThreshold = 1.0f; @@ -353,9 +353,8 @@ void LLVOCacheEntry::updateDebugSettings()  	//min radius: all objects within this radius remain loaded in memory  	static LLCachedControl<F32> min_radius(gSavedSettings,"SceneLoadMinRadius"); -	sNearRadiusSquared = llmin((F32)min_radius, gAgentCamera.mDrawDistance); //can not exceed the draw distance -	sNearRadiusSquared *= sNearRadiusSquared; -	sNearRadiusSquared = llmax(sNearRadiusSquared, 1.f); //minimum value is 1.0m +	sNearRadius = llmin((F32)min_radius, gAgentCamera.mDrawDistance); //can not exceed the draw distance +	sNearRadius = llmax(sNearRadius, 1.f); //minimum value is 1.0m  	//objects within the view frustum whose visible area is greater than this threshold will be loaded  	static LLCachedControl<F32> front_pixel_threshold(gSavedSettings,"SceneLoadFrontPixelThreshold"); @@ -434,8 +433,11 @@ bool LLVOCacheEntry::isAnyVisible(const LLVector4a& camera_origin, const LLVecto  	return vis;  } +static LLTrace::BlockTimerStatHandle sSceneContributionCalc("Calculate scene contribution", "Calculates relative importance of object to scene, to control object load from cache"); +  void LLVOCacheEntry::calcSceneContribution(const LLVector4a& camera_origin, bool needs_update, U32 last_update, F32 dist_threshold)  { +	LL_RECORD_BLOCK_TIME(sSceneContributionCalc);  	if(!needs_update && getVisible() >= last_update)  	{  		return; //no need to update @@ -443,9 +445,9 @@ void LLVOCacheEntry::calcSceneContribution(const LLVector4a& camera_origin, bool  	LLVector4a lookAt;  	lookAt.setSub(getPositionGroup(), camera_origin); -	F32 squared_dist = lookAt.dot3(lookAt).getF32(); +	F32 distance = lookAt.getLength3().getF32(); -	if(squared_dist < sNearRadiusSquared) +	if(distance <= sNearRadius)  	{  		//nearby objects, set a large number  		const F32 LARGE_SCENE_CONTRIBUTION = 1000.f; //a large number to force to load the object. @@ -453,13 +455,14 @@ void LLVOCacheEntry::calcSceneContribution(const LLVector4a& camera_origin, bool  	}  	else  	{ +		distance -= sNearRadius; +  		F32 rad = getBinRadius();  		dist_threshold += rad; -		dist_threshold *= dist_threshold; -		if(squared_dist < dist_threshold) +		if(distance < dist_threshold)  		{ -			mSceneContrib = rad * rad / squared_dist;		 +			mSceneContrib = (rad * rad) / (distance * distance);		  		}  		else  		{ @@ -627,7 +630,7 @@ public:  	{  		mLocalShift = shift;  		mUseObjectCacheOcclusion = use_object_cache_occlusion; -		mSquaredNearRadius = LLVOCacheEntry::sNearRadiusSquared; +		mNearRadius = LLVOCacheEntry::sNearRadius;  	}  	virtual bool earlyFail(LLViewerOctreeGroup* base_group) @@ -684,7 +687,7 @@ public:  		{  			//check if the objects projection large enough  			const LLVector4a* exts = group->getObjectExtents(); -			res = checkProjectionArea(exts[0], exts[1], mLocalShift, mPixelThreshold, mSquaredNearRadius); +			res = checkProjectionArea(exts[0], exts[1], mLocalShift, mPixelThreshold, mNearRadius);  		}  		return res; @@ -731,7 +734,7 @@ private:  	LLViewerRegion*     mRegionp;  	LLVector3           mLocalShift; //shift vector from agent space to local region space.  	F32                 mPixelThreshold; -	F32                 mSquaredNearRadius; +	F32                 mNearRadius;  	bool                mUseObjectCacheOcclusion;  }; @@ -775,7 +778,7 @@ public:  		{  			//check if the objects projection large enough  			const LLVector4a* exts = group->getObjectExtents(); -			return checkProjectionArea(exts[0], exts[1], mLocalShift, mPixelThreshold, mSphereRadius * mSphereRadius); +			return checkProjectionArea(exts[0], exts[1], mLocalShift, mPixelThreshold, mSphereRadius);  		}  		return false;  	} diff --git a/indra/newview/llvocache.h b/indra/newview/llvocache.h index 6af38e5b7c..80268d4e9c 100755 --- a/indra/newview/llvocache.h +++ b/indra/newview/llvocache.h @@ -159,7 +159,7 @@ protected:  public:  	static U32  sMinFrameRange; -	static F32  sNearRadiusSquared; +	static F32  sNearRadius;  	static F32  sRearFarRadius;  	static F32  sFrontPixelThreshold;  	static F32  sRearPixelThreshold; | 
