Xiaohong Bao 2013-06-24 23:37:48 -06:00
commit e6e82b5b35
2 changed files with 24 additions and 21 deletions

View File

@ -1026,11 +1026,6 @@ U32 LLViewerObject::extractSpatialExtents(LLDataPackerBinaryBuffer *dp, LLVector
{
U32 parent_id = 0;
LLViewerObject::unpackParentID(dp, parent_id);
if(parent_id > 0)
{
//is a child, no need to decode further.
return parent_id;
}
LLViewerObject::unpackVector3(dp, scale, "Scale");
LLViewerObject::unpackVector3(dp, pos, "Pos");

View File

@ -910,19 +910,19 @@ void LLViewerRegion::removeActiveCacheEntry(LLVOCacheEntry* entry, LLDrawable* d
return;
}
bool is_orphan = false;
LLVOCacheEntry* parent = NULL;
if(entry->getParentID() > 0) //is a child
{
LLVOCacheEntry* parent = getCacheEntry(entry->getParentID());
if(parent)
{
parent->addChild(entry);
}
else //parent is not in the cache, put into the orphan list.
parent = getCacheEntry(entry->getParentID());
if(!parent)
{
is_orphan = true;
mOrphanMap[entry->getParentID()].push_back(entry->getLocalID());
}
}
else //insert to vo cache tree.
if(!is_orphan)//insert to vo cache tree.
{
//shift to the local regional space from agent space
const LLVector3 pos = drawablep->getVObj()->getPositionRegion();
@ -931,6 +931,11 @@ void LLViewerRegion::removeActiveCacheEntry(LLVOCacheEntry* entry, LLDrawable* d
shift.setSub(vec, entry->getPositionGroup());
entry->shift(shift);
if(parent) //is a child
{
entry->shift(parent->getPositionGroup());
parent->addChild(entry);
}
addToVOCacheTree(entry);
}
@ -965,10 +970,6 @@ void LLViewerRegion::addToVOCacheTree(LLVOCacheEntry* entry)
{
return;
}
if(entry->getParentID() > 0)
{
return; //no child prim in cache octree.
}
llassert(!entry->getEntry()->hasDrawable());
@ -1102,7 +1103,8 @@ F32 LLViewerRegion::updateVisibleEntries(F32 max_time)
if(vo_entry->getParentID() > 0) //is a child
{
//child visibility depends on its parent.
//child visibility depends on its parent, force its parent to be visible
addVisibleCacheEntry(getCacheEntry(vo_entry->getParentID()));
continue;
}
@ -1832,21 +1834,22 @@ void LLViewerRegion::decodeBoundingInfo(LLVOCacheEntry* entry)
//1, find the parent in cache
LLVOCacheEntry* parent = getCacheEntry(parent_id);
//2, parent is not in the cache, put into the orphan list.
if(!parent)
//2, parent is not in the cache or not probed, put into the orphan list.
if(!parent || !parent->getEntry())
{
//check if parent is non-cacheable and already created
if(isNonCacheableObjectCreated(parent_id))
if(!parent && isNonCacheableObjectCreated(parent_id))
{
//parent is visible, so is the child.
addVisibleCacheEntry(entry);
}
else
{
entry->setBoundingInfo(pos, scale);
mOrphanMap[parent_id].push_back(entry->getLocalID());
}
}
else //parent in cache
else //parent in cache octree or probed
{
if(!parent->isState(LLVOCacheEntry::INACTIVE))
{
@ -1855,6 +1858,9 @@ void LLViewerRegion::decodeBoundingInfo(LLVOCacheEntry* entry)
}
else
{
entry->setBoundingInfo(pos, scale);
entry->shift(parent->getPositionGroup());
addToVOCacheTree(entry);
parent->addChild(entry);
}
}
@ -1884,6 +1890,8 @@ void LLViewerRegion::decodeBoundingInfo(LLVOCacheEntry* entry)
LLVOCacheEntry* child = getCacheEntry((*orphans)[i]);
if(child)
{
child->shift(entry->getPositionGroup());
addToVOCacheTree(child);
entry->addChild(child);
}
}