SH-4606 FIX Interesting: Small objects do not load until they are very close.

changed culling to use inverse distance to calculate solid angle, not distance squared
master
Richard Linden 2013-12-03 15:52:36 -08:00
parent 29476d29c4
commit 3cb64c5038
4 changed files with 14 additions and 38 deletions

View File

@ -130,7 +130,6 @@ TimeBlockTreeNode* ThreadRecorder::getTimeBlockTreeNode( S32 index )
return NULL;
}
AccumulatorBufferGroup* ThreadRecorder::activate( AccumulatorBufferGroup* recording)
{
ActiveRecording* active_recording = new ActiveRecording(recording);
@ -215,8 +214,7 @@ void ThreadRecorder::deactivate( AccumulatorBufferGroup* recording )
ThreadRecorder::ActiveRecording::ActiveRecording( AccumulatorBufferGroup* target )
: mTargetRecording(target)
{
}
{}
void ThreadRecorder::ActiveRecording::movePartialToTarget()
{
@ -238,21 +236,7 @@ void ThreadRecorder::addChildRecorder( class ThreadRecorder* child )
void ThreadRecorder::removeChildRecorder( class ThreadRecorder* child )
{
{ LLMutexLock lock(&mChildListMutex);
for (child_thread_recorder_list_t::iterator it = mChildThreadRecorders.begin(), end_it = mChildThreadRecorders.end();
it != end_it;
++it)
{
if ((*it) == child)
{
// FIXME: this won't do any good, as the child stores the "pushed" values internally
// and it is in the process of being deleted.
// We need a way to finalize the stats from the outgoing thread, but the storage
// for those stats needs to be outside the child's thread recorder
//(*it)->pushToParent();
mChildThreadRecorders.erase(it);
break;
}
}
mChildThreadRecorders.remove(child);
}
}
@ -316,5 +300,4 @@ void set_thread_recorder( ThreadRecorder* recorder )
get_thread_recorder_ptr() = recorder;
}
}

View File

@ -1440,11 +1440,8 @@ S32 LLViewerOctreeCull::AABBRegionSphereIntersectObjectExtents(const LLViewerOct
//------------------------------------------
//check if the objects projection large enough
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);
@ -1462,7 +1459,7 @@ bool LLViewerOctreeCull::checkProjectionArea(const LLVector4a& center, const LLV
distance -= near_radius;
F32 squared_rad = size.dot3(size).getF32();
return squared_rad / (distance * distance) > pixel_threshold;
return squared_rad / distance > pixel_threshold;
}
//virtual

View File

@ -433,11 +433,8 @@ 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)
void LLVOCacheEntry::calcSceneContribution(const LLVector4a& camera_origin, bool needs_update, U32 last_update, F32 max_dist)
{
LL_RECORD_BLOCK_TIME(sSceneContributionCalc);
if(!needs_update && getVisible() >= last_update)
{
return; //no need to update
@ -446,8 +443,9 @@ void LLVOCacheEntry::calcSceneContribution(const LLVector4a& camera_origin, bool
LLVector4a lookAt;
lookAt.setSub(getPositionGroup(), camera_origin);
F32 distance = lookAt.getLength3().getF32();
distance -= sNearRadius;
if(distance <= sNearRadius)
if(distance <= 0.f)
{
//nearby objects, set a large number
const F32 LARGE_SCENE_CONTRIBUTION = 1000.f; //a large number to force to load the object.
@ -455,14 +453,12 @@ void LLVOCacheEntry::calcSceneContribution(const LLVector4a& camera_origin, bool
}
else
{
distance -= sNearRadius;
F32 rad = getBinRadius();
dist_threshold += rad;
max_dist += rad;
if(distance < dist_threshold)
if(distance + sNearRadius < max_dist)
{
mSceneContrib = (rad * rad) / (distance * distance);
mSceneContrib = (rad * rad) / distance;
}
else
{

View File

@ -158,11 +158,11 @@ protected:
F32 mBSphereRadius; //bounding sphere radius
public:
static U32 sMinFrameRange;
static F32 sNearRadius;
static F32 sRearFarRadius;
static F32 sFrontPixelThreshold;
static F32 sRearPixelThreshold;
static U32 sMinFrameRange;
static F32 sNearRadius;
static F32 sRearFarRadius;
static F32 sFrontPixelThreshold;
static F32 sRearPixelThreshold;
};
class LLVOCacheGroup : public LLOcclusionCullingGroup