summaryrefslogtreecommitdiff
path: root/indra/newview/lldrawable.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/lldrawable.cpp')
-rw-r--r--indra/newview/lldrawable.cpp90
1 files changed, 58 insertions, 32 deletions
diff --git a/indra/newview/lldrawable.cpp b/indra/newview/lldrawable.cpp
index 108ec92f6d..4eda2b92b3 100644
--- a/indra/newview/lldrawable.cpp
+++ b/indra/newview/lldrawable.cpp
@@ -57,6 +57,8 @@ const F32 MIN_SHADOW_CASTER_RADIUS = 2.0f;
static LLFastTimer::DeclareTimer FTM_CULL_REBOUND("Cull Rebound");
+extern bool gShiftFrame;
+
////////////////////////
//
@@ -97,7 +99,6 @@ void LLDrawable::init()
mPositionGroup.clear();
mExtents[0].clear();
mExtents[1].clear();
- mQuietCount = 0;
mState = 0;
mVObjp = NULL;
@@ -108,6 +109,8 @@ void LLDrawable::init()
mGeneration = -1;
mBinRadius = 1.f;
+ mBinIndex = -1;
+
mSpatialBridge = NULL;
}
@@ -403,6 +406,8 @@ void LLDrawable::makeActive()
if (!isRoot() && !mParent->isActive())
{
mParent->makeActive();
+ //NOTE: linked set will now NEVER become static
+ mParent->setState(LLDrawable::ACTIVE_CHILD);
}
//all child objects must also be active
@@ -422,41 +427,27 @@ void LLDrawable::makeActive()
if (mVObjp->getPCode() == LL_PCODE_VOLUME)
{
- if (mVObjp->isFlexible())
- {
- return;
- }
- }
-
- if (mVObjp->getPCode() == LL_PCODE_VOLUME)
- {
gPipeline.markRebuild(this, LLDrawable::REBUILD_VOLUME, TRUE);
}
updatePartition();
}
- if (isRoot())
- {
- mQuietCount = 0;
- }
- else
- {
- getParent()->mQuietCount = 0;
- }
+ llassert(isAvatar() || isRoot() || mParent->isActive());
}
void LLDrawable::makeStatic(BOOL warning_enabled)
{
- if (isState(ACTIVE))
+ if (isState(ACTIVE) &&
+ !isState(ACTIVE_CHILD) &&
+ !mVObjp->isAttachment() &&
+ !mVObjp->isFlexible())
{
clearState(ACTIVE | ANIMATED_CHILD);
- if (mParent.notNull() && mParent->isActive() && warning_enabled)
- {
- LL_WARNS_ONCE("Drawable") << "Drawable becomes static with active parent!" << LL_ENDL;
- }
-
+ //drawable became static with active parent, not acceptable
+ llassert(mParent.isNull() || !mParent->isActive() || !warning_enabled);
+
LLViewerObject::const_child_list_t& child_list = mVObjp->getChildren();
for (LLViewerObject::child_list_t::const_iterator iter = child_list.begin();
iter != child_list.end(); iter++)
@@ -483,8 +474,8 @@ void LLDrawable::makeStatic(BOOL warning_enabled)
mSpatialBridge->markDead();
setSpatialBridge(NULL);
}
+ updatePartition();
}
- updatePartition();
}
// Returns "distance" between target destination and resulting xfrom
@@ -634,8 +625,6 @@ BOOL LLDrawable::updateMove()
return FALSE;
}
- makeActive();
-
BOOL done;
if (isState(MOVE_UNDAMPED))
@@ -644,6 +633,7 @@ BOOL LLDrawable::updateMove()
}
else
{
+ makeActive();
done = updateMoveDamped();
}
return done;
@@ -714,6 +704,11 @@ void LLDrawable::updateDistance(LLCamera& camera, bool force_update)
return;
}
+ if (gShiftFrame)
+ {
+ return;
+ }
+
//switch LOD with the spatial group to avoid artifacts
//LLSpatialGroup* sg = getSpatialGroup();
@@ -811,14 +806,19 @@ void LLDrawable::shiftPos(const LLVector4a &shift_vector)
mXform.setPosition(mVObjp->getPositionAgent());
}
- mXform.setRotation(mVObjp->getRotation());
- mXform.setScale(1,1,1);
mXform.updateMatrix();
if (isStatic())
{
LLVOVolume* volume = getVOVolume();
- if (!volume)
+
+ bool rebuild = (!volume &&
+ getRenderType() != LLPipeline::RENDER_TYPE_TREE &&
+ getRenderType() != LLPipeline::RENDER_TYPE_TERRAIN &&
+ getRenderType() != LLPipeline::RENDER_TYPE_SKY &&
+ getRenderType() != LLPipeline::RENDER_TYPE_GROUND);
+
+ if (rebuild)
{
gPipeline.markRebuild(this, LLDrawable::REBUILD_ALL, TRUE);
}
@@ -832,7 +832,7 @@ void LLDrawable::shiftPos(const LLVector4a &shift_vector)
facep->mExtents[0].add(shift_vector);
facep->mExtents[1].add(shift_vector);
- if (!volume && facep->hasGeometry())
+ if (rebuild && facep->hasGeometry())
{
facep->clearVertexBuffer();
}
@@ -943,6 +943,12 @@ void LLDrawable::updateUVMinMax()
{
}
+LLSpatialGroup* LLDrawable::getSpatialGroup() const
+{
+ llassert((mSpatialGroupp == NULL) ? getBinIndex() == -1 : getBinIndex() != -1);
+ return mSpatialGroupp;
+}
+
void LLDrawable::setSpatialGroup(LLSpatialGroup *groupp)
{
/*if (mSpatialGroupp && (groupp != mSpatialGroupp))
@@ -965,6 +971,8 @@ void LLDrawable::setSpatialGroup(LLSpatialGroup *groupp)
}
mSpatialGroupp = groupp;
+
+ llassert((mSpatialGroupp == NULL) ? getBinIndex() == -1 : getBinIndex() != -1);
}
LLSpatialPartition* LLDrawable::getSpatialPartition()
@@ -1087,6 +1095,8 @@ LLSpatialBridge::LLSpatialBridge(LLDrawable* root, BOOL render_by_group, U32 dat
mDrawable = root;
root->setSpatialBridge(this);
+ mBinIndex = -1;
+
mRenderType = mDrawable->mRenderType;
mDrawableType = mDrawable->mRenderType;
@@ -1390,6 +1400,11 @@ void LLSpatialBridge::updateDistance(LLCamera& camera_in, bool force_update)
markDead();
return;
}
+
+ if (gShiftFrame)
+ {
+ return;
+ }
if (mDrawable->getVObj())
{
@@ -1468,7 +1483,13 @@ void LLSpatialBridge::cleanupReferences()
LLDrawable::cleanupReferences();
if (mDrawable)
{
- mDrawable->setSpatialGroup(NULL);
+ LLSpatialGroup* group = mDrawable->getSpatialGroup();
+ if (group)
+ {
+ group->mOctreeNode->remove(mDrawable);
+ mDrawable->setSpatialGroup(NULL);
+ }
+
if (mDrawable->getVObj())
{
LLViewerObject::const_child_list_t& child_list = mDrawable->getVObj()->getChildren();
@@ -1479,7 +1500,12 @@ void LLSpatialBridge::cleanupReferences()
LLDrawable* drawable = child->mDrawable;
if (drawable)
{
- drawable->setSpatialGroup(NULL);
+ LLSpatialGroup* group = drawable->getSpatialGroup();
+ if (group)
+ {
+ group->mOctreeNode->remove(drawable);
+ drawable->setSpatialGroup(NULL);
+ }
}
}
}