change the way to handle creating/destroying a same object repeatedly
parent
b5f98560c7
commit
6827febd30
|
|
@ -1101,7 +1101,7 @@ LLSpatialPartition* LLDrawable::getSpatialPartition()
|
|||
}
|
||||
|
||||
//virtual
|
||||
S32 LLDrawable::getMinVisFrameRange() const
|
||||
S32 LLDrawable::getMinFrameRange() const
|
||||
{
|
||||
const S32 MIN_VIS_FRAME_RANGE = 2 ; //two frames:the current one and the last one.
|
||||
|
||||
|
|
|
|||
|
|
@ -193,7 +193,7 @@ public:
|
|||
|
||||
LLSpatialPartition* getSpatialPartition();
|
||||
|
||||
virtual S32 getMinVisFrameRange()const;
|
||||
virtual S32 getMinFrameRange()const;
|
||||
void removeFromOctree();
|
||||
|
||||
void setSpatialBridge(LLSpatialBridge* bridge) { mSpatialBridge = (LLDrawable*) bridge; }
|
||||
|
|
|
|||
|
|
@ -409,7 +409,7 @@ bool LLViewerOctreeEntryData::isRecentlyVisible() const
|
|||
return true;
|
||||
}
|
||||
|
||||
return (sCurVisible - mEntry->mVisible < getMinVisFrameRange());
|
||||
return (sCurVisible - mEntry->mVisible < getMinFrameRange());
|
||||
}
|
||||
|
||||
void LLViewerOctreeEntryData::setVisible() const
|
||||
|
|
|
|||
|
|
@ -149,7 +149,7 @@ public:
|
|||
|
||||
virtual void setOctreeEntry(LLViewerOctreeEntry* entry);
|
||||
|
||||
virtual S32 getMinVisFrameRange()const = 0;
|
||||
virtual S32 getMinFrameRange()const = 0;
|
||||
|
||||
F32 getBinRadius() const {return mEntry->getBinRadius();}
|
||||
const LLVector4a* getSpatialExtents() const;
|
||||
|
|
|
|||
|
|
@ -60,8 +60,7 @@ LLVOCacheEntry::LLVOCacheEntry(U32 local_id, U32 crc, LLDataPackerBinaryBuffer &
|
|||
mDupeCount(0),
|
||||
mCRCChangeCount(0),
|
||||
mState(INACTIVE),
|
||||
mRepeatedVisCounter(0),
|
||||
mVisFrameRange(64),
|
||||
mMinFrameRange(64),
|
||||
mSceneContrib(0.f),
|
||||
mTouched(TRUE),
|
||||
mParentID(0)
|
||||
|
|
@ -81,8 +80,7 @@ LLVOCacheEntry::LLVOCacheEntry()
|
|||
mCRCChangeCount(0),
|
||||
mBuffer(NULL),
|
||||
mState(INACTIVE),
|
||||
mRepeatedVisCounter(0),
|
||||
mVisFrameRange(64),
|
||||
mMinFrameRange(64),
|
||||
mSceneContrib(0.f),
|
||||
mTouched(TRUE),
|
||||
mParentID(0)
|
||||
|
|
@ -95,8 +93,7 @@ LLVOCacheEntry::LLVOCacheEntry(LLAPRFile* apr_file)
|
|||
mBuffer(NULL),
|
||||
mUpdateFlags(-1),
|
||||
mState(INACTIVE),
|
||||
mRepeatedVisCounter(0),
|
||||
mVisFrameRange(64),
|
||||
mMinFrameRange(64),
|
||||
mSceneContrib(0.f),
|
||||
mTouched(FALSE),
|
||||
mParentID(0)
|
||||
|
|
@ -215,35 +212,26 @@ void LLVOCacheEntry::setState(U32 state)
|
|||
|
||||
if(getState() == ACTIVE)
|
||||
{
|
||||
const S32 MIN_REAVTIVE_INTERVAL = 20;
|
||||
const S32 MIN_REAVTIVE_INTERVAL = 32;
|
||||
U32 last_visible = getVisible();
|
||||
|
||||
setVisible();
|
||||
|
||||
if(getVisible() - last_visible < MIN_REAVTIVE_INTERVAL + mVisFrameRange)
|
||||
if(getVisible() - last_visible < MIN_REAVTIVE_INTERVAL + mMinFrameRange)
|
||||
{
|
||||
mRepeatedVisCounter++;
|
||||
mMinFrameRange = llmin(mMinFrameRange * 2, 2048);
|
||||
}
|
||||
else
|
||||
{
|
||||
mRepeatedVisCounter = 0;
|
||||
mVisFrameRange = 64;
|
||||
}
|
||||
|
||||
if(mRepeatedVisCounter > 2)
|
||||
{
|
||||
//if repeatedly becomes visible immediately after invisible, enlarge the visible frame range
|
||||
|
||||
mRepeatedVisCounter = 0;
|
||||
mVisFrameRange *= 2;
|
||||
mMinFrameRange = 64; //reset
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//virtual
|
||||
S32 LLVOCacheEntry::getMinVisFrameRange()const
|
||||
S32 LLVOCacheEntry::getMinFrameRange()const
|
||||
{
|
||||
return mVisFrameRange;
|
||||
return mMinFrameRange;
|
||||
}
|
||||
|
||||
void LLVOCacheEntry::addChild(LLVOCacheEntry* entry)
|
||||
|
|
|
|||
|
|
@ -87,7 +87,7 @@ public:
|
|||
U32 getCRC() const { return mCRC; }
|
||||
S32 getHitCount() const { return mHitCount; }
|
||||
S32 getCRCChangeCount() const { return mCRCChangeCount; }
|
||||
S32 getMinVisFrameRange()const;
|
||||
S32 getMinFrameRange()const;
|
||||
|
||||
void calcSceneContribution(const LLVector3& camera_origin, bool needs_update, U32 last_update);
|
||||
void setSceneContribution(F32 scene_contrib) {mSceneContrib = scene_contrib;}
|
||||
|
|
@ -116,7 +116,7 @@ public:
|
|||
|
||||
void setTouched(BOOL touched = TRUE) {mTouched = touched;}
|
||||
BOOL isTouched() const {return mTouched;}
|
||||
|
||||
|
||||
void setUpdateFlags(U32 flags) {mUpdateFlags = flags;}
|
||||
U32 getUpdateFlags() const {return mUpdateFlags;}
|
||||
|
||||
|
|
@ -137,8 +137,7 @@ protected:
|
|||
U8 *mBuffer;
|
||||
|
||||
F32 mSceneContrib; //projected scene contributuion of this object.
|
||||
S32 mVisFrameRange;
|
||||
S32 mRepeatedVisCounter; //number of repeatedly visible within a short time.
|
||||
S32 mMinFrameRange;
|
||||
U32 mState; //high 16 bits reserved for special use.
|
||||
std::vector<LLVOCacheEntry*> mChildrenList; //children entries in a linked set.
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue