diff options
Diffstat (limited to 'indra/newview/llviewerregion.cpp')
-rwxr-xr-x | indra/newview/llviewerregion.cpp | 71 |
1 files changed, 37 insertions, 34 deletions
diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index d27b37d029..b80d87ef07 100755 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -905,37 +905,37 @@ void LLViewerRegion::addActiveCacheEntry(LLVOCacheEntry* entry) void LLViewerRegion::removeActiveCacheEntry(LLVOCacheEntry* entry, LLDrawable* drawablep) { - if(mDead) + if(mDead || !entry) { return; } - bool is_orphan = false; - LLVOCacheEntry* parent = NULL; - if(entry->getParentID() > 0) //is a child + //shift to the local regional space from agent space + if(drawablep != NULL && drawablep->getVObj().notNull()) { - parent = getCacheEntry(entry->getParentID()); - if(!parent) - { - is_orphan = true; - mOrphanMap[entry->getParentID()].push_back(entry->getLocalID()); - } + const LLVector3& pos = drawablep->getVObj()->getPositionRegion(); + LLVector4a shift; + shift.load3(pos.mV); + shift.sub(entry->getPositionGroup()); + entry->shift(shift); } - - if(!is_orphan)//insert to vo cache tree. + + if(entry->getParentID() > 0) //is a child { - //shift to the local regional space from agent space - const LLVector3 pos = drawablep->getVObj()->getPositionRegion(); - LLVector4a vec(pos[0], pos[1], pos[2]); - LLVector4a shift; - shift.setSub(vec, entry->getPositionGroup()); - entry->shift(shift); - - if(parent) //is a child + LLVOCacheEntry* parent = getCacheEntry(entry->getParentID()); + if(parent) { - entry->shift(parent->getPositionGroup()); parent->addChild(entry); } + else //parent not in cache. + { + //this happens only when parent is not cacheable. + mOrphanMap[entry->getParentID()].push_back(entry->getLocalID()); + } + } + else //insert to vo cache tree. + { + entry->updateParentBoundingInfo(); addToVOCacheTree(entry); } @@ -970,6 +970,10 @@ void LLViewerRegion::addToVOCacheTree(LLVOCacheEntry* entry) { return; } + if(entry->getParentID() > 0) + { + return; //no child prim in cache octree. + } llassert(!entry->getEntry()->hasDrawable()); @@ -1103,8 +1107,7 @@ F32 LLViewerRegion::updateVisibleEntries(F32 max_time) if(vo_entry->getParentID() > 0) //is a child { - //child visibility depends on its parent, force its parent to be visible - addVisibleCacheEntry(getCacheEntry(vo_entry->getParentID())); + //child visibility depends on its parent. continue; } @@ -1834,11 +1837,11 @@ void LLViewerRegion::decodeBoundingInfo(LLVOCacheEntry* entry) //1, find the parent in cache LLVOCacheEntry* parent = getCacheEntry(parent_id); - //2, parent is not in the cache or not probed, put into the orphan list. - if(!parent || !parent->getEntry()) + //2, parent is not in the cache, put into the orphan list. + if(!parent) { //check if parent is non-cacheable and already created - if(!parent && isNonCacheableObjectCreated(parent_id)) + if(isNonCacheableObjectCreated(parent_id)) { //parent is visible, so is the child. addVisibleCacheEntry(entry); @@ -1846,10 +1849,10 @@ void LLViewerRegion::decodeBoundingInfo(LLVOCacheEntry* entry) else { entry->setBoundingInfo(pos, scale); - mOrphanMap[parent_id].push_back(entry->getLocalID()); + mOrphanMap[parent_id].push_back(entry->getLocalID()); } } - else //parent in cache octree or probed + else //parent in cache. { if(!parent->isState(LLVOCacheEntry::INACTIVE)) { @@ -1859,8 +1862,6 @@ void LLViewerRegion::decodeBoundingInfo(LLVOCacheEntry* entry) else { entry->setBoundingInfo(pos, scale); - entry->shift(parent->getPositionGroup()); - addToVOCacheTree(entry); parent->addChild(entry); } } @@ -1890,8 +1891,6 @@ void LLViewerRegion::decodeBoundingInfo(LLVOCacheEntry* entry) LLVOCacheEntry* child = getCacheEntry((*orphans)[i]); if(child) { - child->shift(entry->getPositionGroup()); - addToVOCacheTree(child); entry->addChild(child); } } @@ -2063,7 +2062,7 @@ bool LLViewerRegion::probeCache(U32 local_id, U32 crc, U32 flags, U8 &cache_miss { // Record a hit entry->recordHit(); - cache_miss_type = CACHE_MISS_TYPE_NONE; + cache_miss_type = CACHE_MISS_TYPE_NONE; entry->setUpdateFlags(flags); if(entry->isState(LLVOCacheEntry::ACTIVE)) @@ -2072,7 +2071,11 @@ bool LLViewerRegion::probeCache(U32 local_id, U32 crc, U32 flags, U8 &cache_miss return true; } - if(entry->getGroup() || !entry->isState(LLVOCacheEntry::INACTIVE)) + if(entry->getGroup() || !entry->isState(LLVOCacheEntry::INACTIVE)) //already probed + { + return true; + } + if(entry->getParentID() > 0) //already probed { return true; } |