more fix to reduce number of rendered triangles per frame.
parent
46c3bf7575
commit
960765e8c7
|
|
@ -217,6 +217,7 @@ public:
|
|||
BOOL isVisible() const;
|
||||
virtual BOOL isRecentlyVisible() const;
|
||||
S32 getVisible(LLViewerCamera::eCameraID id) const {return mVisible[id];}
|
||||
S32 getAnyVisible() const {return mAnyVisible;}
|
||||
bool isEmpty() const { return mOctreeNode->isEmpty(); }
|
||||
|
||||
U32 getState() {return mState; }
|
||||
|
|
|
|||
|
|
@ -1359,6 +1359,8 @@ BOOL LLViewerRegion::isViewerCameraStatic()
|
|||
|
||||
F32 LLViewerRegion::killInvisibleObjects(F32 max_time)
|
||||
{
|
||||
static LLCachedControl<F32> back_sphere_radius(gSavedSettings,"BackShpereCullingRadius");
|
||||
|
||||
#if 1
|
||||
if(!sVOCacheCullingEnabled)
|
||||
{
|
||||
|
|
@ -1369,6 +1371,10 @@ F32 LLViewerRegion::killInvisibleObjects(F32 max_time)
|
|||
return max_time;
|
||||
}
|
||||
|
||||
LLVector4a camera_origin;
|
||||
camera_origin.load3(LLViewerCamera::getInstance()->getOrigin().mV);
|
||||
F32 squared_back_threshold = back_sphere_radius * back_sphere_radius;
|
||||
|
||||
bool unstable = sNewObjectCreationThrottle < 0;
|
||||
size_t max_update = unstable ? mImpl->mActiveSet.size() : 64;
|
||||
if(!mInvisibilityCheckHistory && isViewerCameraStatic())
|
||||
|
|
@ -1388,7 +1394,7 @@ F32 LLViewerRegion::killInvisibleObjects(F32 max_time)
|
|||
iter = mImpl->mActiveSet.begin();
|
||||
}
|
||||
|
||||
if(!(*iter)->isRecentlyVisible() && (unstable || (*iter)->mLastCameraUpdated < sLastCameraUpdated))
|
||||
if(!(*iter)->isAnyVisible(camera_origin, squared_back_threshold) && (unstable || (*iter)->mLastCameraUpdated < sLastCameraUpdated))
|
||||
{
|
||||
killObject((*iter), delete_list);
|
||||
}
|
||||
|
|
@ -1425,18 +1431,18 @@ void LLViewerRegion::killObject(LLVOCacheEntry* entry, std::vector<LLDrawable*>&
|
|||
|
||||
if(!drawablep->getParent())
|
||||
{
|
||||
LLViewerObject::const_child_list_t& child_list = drawablep->getVObj()->getChildren();
|
||||
for (LLViewerObject::child_list_t::const_iterator iter = child_list.begin();
|
||||
iter != child_list.end(); iter++)
|
||||
{
|
||||
LLViewerObject* child = *iter;
|
||||
if(child->mDrawable->isRecentlyVisible())
|
||||
{
|
||||
//set the parent group visible if any of its children visible.
|
||||
((LLViewerOctreeEntryData*)drawablep)->setVisible();
|
||||
return;
|
||||
}
|
||||
}
|
||||
//LLViewerObject::const_child_list_t& child_list = drawablep->getVObj()->getChildren();
|
||||
//for (LLViewerObject::child_list_t::const_iterator iter = child_list.begin();
|
||||
// iter != child_list.end(); iter++)
|
||||
//{
|
||||
// LLViewerObject* child = *iter;
|
||||
// if(child->mDrawable->isRecentlyVisible())
|
||||
// {
|
||||
// //set the parent group visible if any of its children visible.
|
||||
// ((LLViewerOctreeEntryData*)drawablep)->setVisible();
|
||||
// return;
|
||||
// }
|
||||
//}
|
||||
delete_list.push_back(drawablep);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -358,26 +358,34 @@ void LLVOCacheEntry::updateDebugSettings()
|
|||
sBackAngleTanSquared = squared_back_angle;
|
||||
}
|
||||
|
||||
bool LLVOCacheEntry::isRecentlyVisible() const
|
||||
bool LLVOCacheEntry::isAnyVisible(const LLVector4a& camera_origin, F32 squared_dist_threshold)
|
||||
{
|
||||
bool vis = LLViewerOctreeEntryData::isRecentlyVisible();
|
||||
|
||||
if(!vis && getGroup())
|
||||
LLOcclusionCullingGroup* group = (LLOcclusionCullingGroup*)getGroup();
|
||||
if(!group)
|
||||
{
|
||||
//recently visible to any camera?
|
||||
vis = ((LLOcclusionCullingGroup*)getGroup())->isAnyRecentlyVisible();
|
||||
return false;
|
||||
}
|
||||
|
||||
//combination of projected area and squared distance
|
||||
if(!vis && !mParentID && mSceneContrib > sBackAngleTanSquared)
|
||||
{
|
||||
F32 rad = getBinRadius();
|
||||
vis = (rad * rad / mSceneContrib < sBackDistanceSquared);
|
||||
}
|
||||
//any visible
|
||||
bool vis = group->isAnyRecentlyVisible();
|
||||
|
||||
//not ready to remove
|
||||
if(!vis)
|
||||
{
|
||||
vis = (getVisible() + sMinFrameRange > LLViewerOctreeEntryData::getCurrentFrame());
|
||||
vis = (group->getAnyVisible() + sMinFrameRange > LLViewerOctreeEntryData::getCurrentFrame());
|
||||
}
|
||||
|
||||
//within the back sphere
|
||||
if(!vis && !mParentID)
|
||||
{
|
||||
LLVector4a lookAt;
|
||||
lookAt.setSub(getPositionGroup(), camera_origin);
|
||||
F32 squared_dist = lookAt.dot3(lookAt).getF32();
|
||||
F32 rad = getBinRadius();
|
||||
rad *= rad;
|
||||
|
||||
//rough estimation
|
||||
vis = (squared_dist - rad < squared_dist_threshold);
|
||||
}
|
||||
|
||||
return vis;
|
||||
|
|
|
|||
|
|
@ -85,8 +85,7 @@ public:
|
|||
bool hasState(U32 state) {return mState & state;}
|
||||
U32 getState() const {return mState;}
|
||||
|
||||
//virtual
|
||||
bool isRecentlyVisible() const;
|
||||
bool isAnyVisible(const LLVector4a& camera_origin, F32 squared_dist_threshold);
|
||||
|
||||
U32 getLocalID() const { return mLocalID; }
|
||||
U32 getCRC() const { return mCRC; }
|
||||
|
|
|
|||
Loading…
Reference in New Issue