summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--indra/newview/lldrawable.cpp5
-rw-r--r--indra/newview/llviewerobject.cpp16
-rw-r--r--indra/newview/llviewerobject.h1
-rw-r--r--indra/newview/llviewerobjectlist.cpp3
-rw-r--r--indra/newview/llviewerobjectlist.h2
-rw-r--r--indra/newview/llviewerregion.cpp6
-rw-r--r--indra/newview/llvocache.cpp22
-rw-r--r--indra/newview/llvocache.h18
8 files changed, 33 insertions, 40 deletions
diff --git a/indra/newview/lldrawable.cpp b/indra/newview/lldrawable.cpp
index 1b7a98ba54..3c68ac231e 100644
--- a/indra/newview/lldrawable.cpp
+++ b/indra/newview/lldrawable.cpp
@@ -1099,11 +1099,6 @@ LLSpatialBridge::LLSpatialBridge(LLDrawable* root, BOOL render_by_group, U32 dat
{
part->put(this);
}
-
- if(mDrawable->getEntry()->hasVOCacheEntry())
- {
- ((LLVOCacheEntry*)mDrawable->getEntry()->getVOCacheEntry())->setBridgeChild();
- }
}
LLSpatialBridge::~LLSpatialBridge()
diff --git a/indra/newview/llviewerobject.cpp b/indra/newview/llviewerobject.cpp
index dbccb2a4d9..2aa0e15fc3 100644
--- a/indra/newview/llviewerobject.cpp
+++ b/indra/newview/llviewerobject.cpp
@@ -323,6 +323,22 @@ void LLViewerObject::deleteTEImages()
mTEImages = NULL;
}
+//if enabled, add this object to vo cache tree when removed from rendering.
+void LLViewerObject::EnableToCacheTree(bool enabled)
+{
+ if(mDrawable.notNull() && mDrawable->getEntry() && mDrawable->getEntry()->hasVOCacheEntry())
+ {
+ if(enabled)
+ {
+ ((LLVOCacheEntry*)mDrawable->getEntry()->getVOCacheEntry())->addState(LLVOCacheEntry::ADD_TO_CACHE_TREE);
+ }
+ else
+ {
+ ((LLVOCacheEntry*)mDrawable->getEntry()->getVOCacheEntry())->clearState(LLVOCacheEntry::ADD_TO_CACHE_TREE);
+ }
+ }
+}
+
void LLViewerObject::markDead()
{
if (!mDead)
diff --git a/indra/newview/llviewerobject.h b/indra/newview/llviewerobject.h
index 02b4f84785..74b86600d4 100644
--- a/indra/newview/llviewerobject.h
+++ b/indra/newview/llviewerobject.h
@@ -132,6 +132,7 @@ public:
BOOL isDead() const {return mDead;}
BOOL isOrphaned() const { return mOrphaned; }
BOOL isParticleSource() const;
+ void EnableToCacheTree(bool enabled);
virtual LLVOAvatar* asAvatar();
diff --git a/indra/newview/llviewerobjectlist.cpp b/indra/newview/llviewerobjectlist.cpp
index 5b2214f3b3..6e7ce103b5 100644
--- a/indra/newview/llviewerobjectlist.cpp
+++ b/indra/newview/llviewerobjectlist.cpp
@@ -1326,7 +1326,7 @@ void LLViewerObjectList::removeDrawable(LLDrawable* drawablep)
}
}
-BOOL LLViewerObjectList::killObject(LLViewerObject *objectp)
+BOOL LLViewerObjectList::killObject(LLViewerObject *objectp, bool cache_enabled)
{
// Don't ever kill gAgentAvatarp, just force it to the agent's region
// unless region is NULL which is assumed to mean you are logging out.
@@ -1341,6 +1341,7 @@ BOOL LLViewerObjectList::killObject(LLViewerObject *objectp)
if (objectp)
{
+ objectp->EnableToCacheTree(cache_enabled); //enable to add to VO cache tree if set.
objectp->markDead(); // does the right thing if object already dead
return TRUE;
}
diff --git a/indra/newview/llviewerobjectlist.h b/indra/newview/llviewerobjectlist.h
index 3b26df7de6..0e2b34cb34 100644
--- a/indra/newview/llviewerobjectlist.h
+++ b/indra/newview/llviewerobjectlist.h
@@ -72,7 +72,7 @@ public:
LLViewerObject *replaceObject(const LLUUID &id, const LLPCode pcode, LLViewerRegion *regionp); // TomY: hack to switch VO instances on the fly
- BOOL killObject(LLViewerObject *objectp);
+ BOOL killObject(LLViewerObject *objectp, bool cache_enabled = false);
void killObjects(LLViewerRegion *regionp); // Kill all objects owned by a particular region.
void killAllObjects();
void removeDrawable(LLDrawable* drawablep);
diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp
index 33e8348660..c4b6cacae2 100644
--- a/indra/newview/llviewerregion.cpp
+++ b/indra/newview/llviewerregion.cpp
@@ -894,6 +894,10 @@ void LLViewerRegion::addToVOCacheTree(LLVOCacheEntry* entry)
{
return;
}
+ if(!entry->hasState(LLVOCacheEntry::ADD_TO_CACHE_TREE))
+ {
+ return; //can not add to vo cache tree.
+ }
mImpl->mVOCachePartition->addEntry(entry->getEntry());
}
@@ -1132,7 +1136,7 @@ F32 LLViewerRegion::killInvisibleObjects(F32 max_time)
}
for(S32 i = 0; i < delete_list.size(); i++)
{
- gObjectList.killObject(delete_list[i]->getVObj());
+ gObjectList.killObject(delete_list[i]->getVObj(), true);
}
delete_list.clear();
diff --git a/indra/newview/llvocache.cpp b/indra/newview/llvocache.cpp
index 59645fdbe9..86cfbb1d74 100644
--- a/indra/newview/llvocache.cpp
+++ b/indra/newview/llvocache.cpp
@@ -64,18 +64,6 @@ LLVOCacheEntry::LLVOCacheEntry(U32 local_id, U32 crc, LLDataPackerBinaryBuffer &
mBuffer = new U8[dp.getBufferSize()];
mDP.assignBuffer(mBuffer, dp.getBufferSize());
mDP = dp;
-
- if(dp.getBufferSize() > 0)
- {
- U32 parent_id = 0;
- dp.reset();
- dp.unpackU32(parent_id, "ParentID");
- dp.reset();
- if(parent_id > 0)
- {
- mState |= CHILD; //is a child
- }
- }
}
LLVOCacheEntry::LLVOCacheEntry()
@@ -224,16 +212,6 @@ void LLVOCacheEntry::setOctreeEntry(LLViewerOctreeEntry* entry)
LLViewerOctreeEntryData::setOctreeEntry(entry);
}
-void LLVOCacheEntry::setBridgeChild()
-{
- mState |= BRIDGE_CHILD;
-}
-
-void LLVOCacheEntry::clearBridgeChild()
-{
- mState &= ~BRIDGE_CHILD;
-}
-
void LLVOCacheEntry::copyTo(LLVOCacheEntry* new_entry)
{
//copy LLViewerOctreeEntry
diff --git a/indra/newview/llvocache.h b/indra/newview/llvocache.h
index f5cc5d2f75..c631e12739 100644
--- a/indra/newview/llvocache.h
+++ b/indra/newview/llvocache.h
@@ -51,8 +51,7 @@ public:
enum
{
- CHILD = 0x00010000, //has parent
- BRIDGE_CHILD = 0x00020000 //is a child of a spatial bridge.
+ ADD_TO_CACHE_TREE = 0x00010000, //has parent
};
struct CompareVOCacheEntry
@@ -85,14 +84,13 @@ public:
LLVOCacheEntry();
void setState(U32 state);
- bool isState(U32 state) {return (mState & 0xffff) == state;}
- U32 getState() const {return (mState & 0xffff);}
- U32 getFullState() const {return mState;}
-
- void setBridgeChild();
- void clearBridgeChild();
- bool isBridgeChild() {return mState & BRIDGE_CHILD;}
-
+ void clearState(U32 state) {mState &= ~state;}
+ void addState(U32 state) {mState |= state;}
+ bool isState(U32 state) {return (mState & 0xffff) == state;}
+ bool hasState(U32 state) {return mState & state;}
+ U32 getState() const {return (mState & 0xffff);}
+ U32 getFullState() const {return mState;}
+
U32 getLocalID() const { return mLocalID; }
U32 getCRC() const { return mCRC; }
S32 getHitCount() const { return mHitCount; }