SL-20244 On-screen animesh characters that start pelvis offset animations disappear when root goes off-screen

meow-7.2.2
Alexander Gavriliuk 2023-09-25 12:29:51 +02:00 committed by Guru
parent ddd67c3ece
commit 18dc7d0c0b
4 changed files with 41 additions and 36 deletions

View File

@ -763,19 +763,6 @@ void LLDrawable::movePartition()
if (part)
{
part->move(this, getSpatialGroup());
// SL-18251 "On-screen animesh characters using pelvis offset animations
// disappear when root goes off-screen"
//
// Update extents of the root node when Control Avatar changes it's bounds
if (mRenderType == LLPipeline::RENDER_TYPE_CONTROL_AV && isRoot())
{
LLControlAvatar* controlAvatar = dynamic_cast<LLControlAvatar*>(getVObj().get());
if (controlAvatar && controlAvatar->mControlAVBridge)
{
((LLSpatialGroup*)controlAvatar->mControlAVBridge->mOctree->getListener(0))->setState(LLViewerOctreeGroup::DIRTY);
}
}
}
}

View File

@ -847,6 +847,43 @@ void LLSpatialGroup::handleChildAddition(const OctreeNode* parent, OctreeNode* c
assert_states_valid(this);
}
//virtual
void LLSpatialGroup::rebound()
{
if (!isDirty())
return;
super::rebound();
if (mSpatialPartition->mDrawableType == LLPipeline::RENDER_TYPE_CONTROL_AV)
{
llassert(mSpatialPartition->mPartitionType == LLViewerRegion::PARTITION_CONTROL_AV);
LLSpatialBridge* bridge = getSpatialPartition()->asBridge();
if (bridge &&
bridge->mDrawable &&
bridge->mDrawable->getVObj() &&
bridge->mDrawable->getVObj()->isRoot())
{
LLControlAvatar* controlAvatar = bridge->mDrawable->getVObj()->getControlAvatar();
if (controlAvatar &&
controlAvatar->mDrawable &&
controlAvatar->mControlAVBridge)
{
llassert(controlAvatar->mControlAVBridge->mOctree);
LLSpatialGroup* root = (LLSpatialGroup*)controlAvatar->mControlAVBridge->mOctree->getListener(0);
if (this == root)
{
const LLVector4a* addingExtents = controlAvatar->mDrawable->getSpatialExtents();
const LLXformMatrix* currentTransform = bridge->mDrawable->getXform();
expandExtents(addingExtents, *currentTransform);
}
}
}
}
}
void LLSpatialGroup::destroyGL(bool keep_occlusion)
{
setState(LLSpatialGroup::GEOM_DIRTY | LLSpatialGroup::IMAGE_DIRTY);

View File

@ -205,6 +205,7 @@ public:
LL_ALIGN_PREFIX(64)
class LLSpatialGroup : public LLOcclusionCullingGroup
{
using super = LLOcclusionCullingGroup;
friend class LLSpatialPartition;
friend class LLOctreeStateCheck;
public:
@ -322,6 +323,9 @@ public:
virtual void handleDestruction(const TreeNode* node);
virtual void handleChildAddition(const OctreeNode* parent, OctreeNode* child);
// LLViewerOctreeGroup
virtual void rebound();
public:
LL_ALIGN_16(LLVector4a mViewAngle);
LL_ALIGN_16(LLVector4a mLastUpdateViewAngle);
@ -703,7 +707,6 @@ class LLControlAVBridge : public LLVolumeBridge
using super = LLVolumeBridge;
public:
LLControlAVBridge(LLDrawable* drawablep, LLViewerRegion* regionp);
virtual void updateSpatialExtents();
};
class LLHUDBridge : public LLVolumeBridge

View File

@ -5110,28 +5110,6 @@ LLControlAVBridge::LLControlAVBridge(LLDrawable* drawablep, LLViewerRegion* regi
mPartitionType = LLViewerRegion::PARTITION_CONTROL_AV;
}
void LLControlAVBridge::updateSpatialExtents()
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWABLE
LLControlAvatar* controlAvatar = getVObj()->getControlAvatar();
LLSpatialGroup* root = (LLSpatialGroup*)mOctree->getListener(0);
bool rootWasDirty = root->isDirty();
super::updateSpatialExtents(); // root becomes non-dirty here
// SL-18251 "On-screen animesh characters using pelvis offset animations
// disappear when root goes off-screen"
//
// Expand extents to include Control Avatar placed outside of the bounds
if (controlAvatar && (rootWasDirty || controlAvatar->mPlaying))
{
root->expandExtents(controlAvatar->mDrawable->getSpatialExtents(), *mDrawable->getXform());
}
}
bool can_batch_texture(LLFace* facep)
{
if (facep->getTextureEntry()->getBumpmap())