diff options
Diffstat (limited to 'indra')
-rwxr-xr-x | indra/llmath/llcamera.cpp | 2 | ||||
-rwxr-xr-x | indra/newview/lldrawable.cpp | 4 | ||||
-rwxr-xr-x | indra/newview/llviewerobjectlist.cpp | 3 | ||||
-rwxr-xr-x | indra/newview/llviewerregion.cpp | 101 | ||||
-rwxr-xr-x | indra/newview/llviewerregion.h | 2 | ||||
-rwxr-xr-x | indra/newview/llvocache.cpp | 15 |
6 files changed, 91 insertions, 36 deletions
diff --git a/indra/llmath/llcamera.cpp b/indra/llmath/llcamera.cpp index 6551b52462..054afd3e95 100755 --- a/indra/llmath/llcamera.cpp +++ b/indra/llmath/llcamera.cpp @@ -620,7 +620,7 @@ void LLCamera::calcRegionFrustumPlanes(const LLVector3& shift) if (mPlaneMask[i] != 0xff) { n.setVec(mAgentPlanes[i][0], mAgentPlanes[i][1], mAgentPlanes[i][2]); - d = mAgentPlanes[i][3] - n * shift; + d = mAgentPlanes[i][3] + n * shift; mRegionPlanes[i].setVec(n, d); } } diff --git a/indra/newview/lldrawable.cpp b/indra/newview/lldrawable.cpp index 93fb484f06..22a7c350d6 100755 --- a/indra/newview/lldrawable.cpp +++ b/indra/newview/lldrawable.cpp @@ -133,7 +133,9 @@ void LLDrawable::init(bool new_entry) getRegion()->addVisibleCacheEntry(vo_entry); //to load all children. } - getRegion()->addActiveCacheEntry(vo_entry); + getRegion()->addActiveCacheEntry(vo_entry); + + llassert(!vo_entry->getGroup()); //not in the object cache octree. } llassert(!vo_entry || vo_entry->getEntry() == mEntry); diff --git a/indra/newview/llviewerobjectlist.cpp b/indra/newview/llviewerobjectlist.cpp index 83ebfc2ec3..ea004560d2 100755 --- a/indra/newview/llviewerobjectlist.cpp +++ b/indra/newview/llviewerobjectlist.cpp @@ -340,7 +340,8 @@ LLViewerObject* LLViewerObjectList::processObjectUpdateFromCache(LLVOCacheEntry* } else { - return objectp; //already loaded. + //should fall through if already loaded because may need to update the object. + //return objectp; //already loaded. } } diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index 55137168ee..a2fd440895 100755 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -797,21 +797,25 @@ void LLViewerRegion::dirtyHeights() } } -void LLViewerRegion::replaceCacheEntry(LLVOCacheEntry* old_entry, LLVOCacheEntry* new_entry) +void LLViewerRegion::replaceVisibleCacheEntry(LLVOCacheEntry* old_entry, LLVOCacheEntry* new_entry) { - U32 state = LLVOCacheEntry::INACTIVE; - bool in_vo_tree = false; - - if(old_entry) - { - old_entry->moveTo(new_entry); - state = old_entry->getState(); - in_vo_tree = (state == LLVOCacheEntry::INACTIVE && old_entry->getGroup() != NULL); - killCacheEntry(old_entry); - } - - mImpl->mCacheMap[new_entry->getLocalID()] = new_entry; + //save old entry + old_entry->moveTo(new_entry); + U32 state = old_entry->getState(); + U32 old_parent_id = old_entry->getParentID(); + //kill old entry + killCacheEntry(old_entry); + + //parse new entry + U32 new_parent_id = 0; + LLViewerObject::unpackParentID(new_entry->getDP(), new_parent_id); + + //store new entry + mImpl->mCacheMap[new_entry->getLocalID()] = new_entry; + + //process entry state + new_entry->setState(state); if(state == LLVOCacheEntry::ACTIVE) { llassert(new_entry->getEntry()->hasDrawable()); @@ -821,11 +825,16 @@ void LLViewerRegion::replaceCacheEntry(LLVOCacheEntry* old_entry, LLVOCacheEntry { mImpl->mWaitingSet.insert(new_entry); } - else if(!old_entry || in_vo_tree) + + //process parent info + if(!old_parent_id && new_parent_id > 0) //becomes a child { - addToVOCacheTree(new_entry); + new_entry->clearChildrenList(); } - new_entry->setState(state); + new_entry->setParentID(new_parent_id); + + //update the object + gObjectList.processObjectUpdateFromCache(new_entry, this); } //physically delete the cache entry @@ -901,14 +910,17 @@ void LLViewerRegion::removeActiveCacheEntry(LLVOCacheEntry* entry, LLDrawable* d return; } - if(drawablep->getParent()) //child object + if(entry->getParentID() > 0) //is a child { - LLViewerOctreeEntry* parent_oct_entry = drawablep->getParent()->getEntry(); - if(parent_oct_entry && parent_oct_entry->hasVOCacheEntry()) + LLVOCacheEntry* parent = getCacheEntry(entry->getParentID()); + if(parent) { - LLVOCacheEntry* parent = (LLVOCacheEntry*)parent_oct_entry->getVOCacheEntry(); parent->addChild(entry); } + else //parent is not in the cache, put into the orphan list. + { + mOrphanMap[entry->getParentID()].push_back(entry->getLocalID()); + } } else //insert to vo cache tree. { @@ -953,6 +965,12 @@ void LLViewerRegion::addToVOCacheTree(LLVOCacheEntry* entry) { return; } + if(entry->getParentID() > 0) + { + return; //no child prim in cache octree. + } + + llassert(!entry->getEntry()->hasDrawable()); mImpl->mVOCachePartition->addEntry(entry->getEntry()); } @@ -993,6 +1011,11 @@ void LLViewerRegion::addVisibleCacheEntry(LLVOCacheEntry* entry) F32 LLViewerRegion::updateVisibleEntries(F32 max_time) { + if(mDead) + { + return max_time; + } + if(mImpl->mVisibleGroups.empty() && mImpl->mVisibleEntries.empty()) { return max_time; @@ -1100,6 +1123,10 @@ F32 LLViewerRegion::updateVisibleEntries(F32 max_time) F32 LLViewerRegion::createVisibleObjects(F32 max_time) { + if(mDead) + { + return max_time; + } if(mImpl->mWaitingList.empty()) { return max_time; @@ -1120,8 +1147,7 @@ F32 LLViewerRegion::createVisibleObjects(F32 max_time) break; } } - } - mImpl->mWaitingList.clear(); + } return max_time - update_timer.getElapsedTimeF32(); } @@ -1156,6 +1182,7 @@ BOOL LLViewerRegion::idleUpdate(F32 max_update_time) max_update_time = updateVisibleEntries(max_update_time); createVisibleObjects(max_update_time); + mImpl->mWaitingList.clear(); mImpl->mVisibleGroups.clear(); return did_update; @@ -1253,7 +1280,12 @@ LLViewerObject* LLViewerRegion::addNewObject(LLVOCacheEntry* entry) } else { - llerrs << "Object is already created." << llendl; + //should not hit here any more, but does not hurt either, just put it back to active list + addActiveCacheEntry(entry); + + //object is already created, crash here for debug use. + llwarns << "Object is already created." << llendl; + llassert(!entry->getEntry()->hasDrawable()); } return obj; } @@ -1763,6 +1795,23 @@ void LLViewerRegion::decodeBoundingInfo(LLVOCacheEntry* entry) if(entry != NULL && !entry->getEntry()) { entry->setOctreeEntry(NULL); + + if(entry->getEntry()->hasDrawable()) //already in the rendering pipeline + { + addActiveCacheEntry(entry); + + //set parent id + U32 parent_id = 0; + LLViewerObject::unpackParentID(entry->getDP(), parent_id); + if(parent_id > 0) + { + entry->setParentID(parent_id); + } + + //update the object + gObjectList.processObjectUpdateFromCache(entry, this); + return; //done + } } else if(entry->getGroup() != NULL) { @@ -1794,8 +1843,8 @@ void LLViewerRegion::decodeBoundingInfo(LLVOCacheEntry* entry) } else { - mOrphanMap[parent_id].push_back(entry->getLocalID()); - } + mOrphanMap[parent_id].push_back(entry->getLocalID()); + } } else //parent in cache { @@ -1874,7 +1923,7 @@ LLViewerRegion::eCacheUpdateResult LLViewerRegion::cacheFullUpdate(LLDataPackerB //if visible, update it if(!entry->isState(LLVOCacheEntry::INACTIVE)) { - replaceCacheEntry(entry, new_entry); + replaceVisibleCacheEntry(entry, new_entry); } else //invisible { diff --git a/indra/newview/llviewerregion.h b/indra/newview/llviewerregion.h index f3c4c080c1..78a6c782a9 100755 --- a/indra/newview/llviewerregion.h +++ b/indra/newview/llviewerregion.h @@ -367,7 +367,7 @@ private: LLViewerObject* addNewObject(LLVOCacheEntry* entry); void killObject(LLVOCacheEntry* entry, std::vector<LLDrawable*>& delete_list); void removeFromVOCacheTree(LLVOCacheEntry* entry); - void replaceCacheEntry(LLVOCacheEntry* old_entry, LLVOCacheEntry* new_entry); + void replaceVisibleCacheEntry(LLVOCacheEntry* old_entry, LLVOCacheEntry* new_entry); void killCacheEntry(LLVOCacheEntry* entry); //physically delete the cache entry F32 killInvisibleObjects(F32 max_time); diff --git a/indra/newview/llvocache.cpp b/indra/newview/llvocache.cpp index 5e2d2efc5e..9816fb9af0 100755 --- a/indra/newview/llvocache.cpp +++ b/indra/newview/llvocache.cpp @@ -102,8 +102,7 @@ LLVOCacheEntry::LLVOCacheEntry(LLAPRFile* apr_file) BOOL success; mDP.assignBuffer(mBuffer, 0); - setOctreeEntry(NULL); - + success = check_read(apr_file, &mLocalID, sizeof(U32)); if(success) { @@ -417,9 +416,11 @@ public: virtual S32 frustumCheck(const LLviewerOctreeGroup* group) { +#if 1 S32 res = AABBInRegionFrustumGroupBounds(group); - - //S32 res = AABBInRegionFrustumNoFarClipGroupBounds(group); +#else + S32 res = AABBInRegionFrustumNoFarClipGroupBounds(group); +#endif if (res != 0) { res = llmin(res, AABBRegionSphereIntersectGroupExtents(group, mLocalShift)); @@ -429,9 +430,11 @@ public: virtual S32 frustumCheckObjects(const LLviewerOctreeGroup* group) { +#if 1 S32 res = AABBInRegionFrustumObjectBounds(group); - - //S32 res = AABBInRegionFrustumNoFarClipObjectBounds(group); +#else + S32 res = AABBInRegionFrustumNoFarClipObjectBounds(group); +#endif if (res != 0) { res = llmin(res, AABBRegionSphereIntersectObjectExtents(group, mLocalShift)); |