summaryrefslogtreecommitdiff
path: root/indra/newview/lldrawable.cpp
diff options
context:
space:
mode:
authorMichael Pohoreski <ptolemy@lindenlab.com>2021-12-15 22:12:27 +0000
committerMichael Pohoreski <ptolemy@lindenlab.com>2021-12-15 22:12:27 +0000
commitc15a7765399630282f177cb96e8ff2116be650e4 (patch)
tree286b5a7314fb1eb05c467ef35d388a4c8a5e0be2 /indra/newview/lldrawable.cpp
parent9ac89bca2cb8cf3bc55cc26113d400b7b3473335 (diff)
parent828e58432981e7c256618bd293f77906abaae699 (diff)
Merged DRTVWR-546 into SL-16493
Diffstat (limited to 'indra/newview/lldrawable.cpp')
-rw-r--r--indra/newview/lldrawable.cpp39
1 files changed, 29 insertions, 10 deletions
diff --git a/indra/newview/lldrawable.cpp b/indra/newview/lldrawable.cpp
index 7e99b99284..7c3c230cff 100644
--- a/indra/newview/lldrawable.cpp
+++ b/indra/newview/lldrawable.cpp
@@ -1162,21 +1162,26 @@ void LLDrawable::setGroup(LLViewerOctreeGroup *groupp)
LLViewerOctreeEntryData::setGroup(groupp);
}
+/*
+* Get the SpatialPartition this Drawable should use.
+* Checks current SpatialPartition assignment and corrects if it is invalid.
+*/
LLSpatialPartition* LLDrawable::getSpatialPartition()
{
LL_PROFILE_ZONE_SCOPED
LLSpatialPartition* retval = NULL;
-
+
if (!mVObjp ||
!getVOVolume() ||
isStatic())
{
- retval = gPipeline.getSpatialPartition((LLViewerObject*) mVObjp);
+ retval = gPipeline.getSpatialPartition((LLViewerObject*)mVObjp);
}
else if (isRoot())
{
- if (mSpatialBridge)
+ // determine if the spatial bridge has changed
+ if (mSpatialBridge)
{
U32 partition_type = mSpatialBridge->asPartition()->mPartitionType;
bool is_hud = mVObjp->isHUDAttachment();
@@ -1193,14 +1198,14 @@ LLSpatialPartition* LLDrawable::getSpatialPartition()
{
// Was/became part of animesh
// remove obsolete bridge
- mSpatialBridge->markDead();
+ mSpatialBridge->markDead();
setSpatialBridge(NULL);
}
else if ((partition_type == LLViewerRegion::PARTITION_AVATAR) != is_attachment)
{
// Was/became part of avatar
// remove obsolete bridge
- mSpatialBridge->markDead();
+ mSpatialBridge->markDead();
setSpatialBridge(NULL);
}
}
@@ -1211,17 +1216,20 @@ LLSpatialPartition* LLDrawable::getSpatialPartition()
{
setSpatialBridge(new LLHUDBridge(this, getRegion()));
}
- else if (mVObjp->isAnimatedObject() && mVObjp->getControlAvatar())
- {
- setSpatialBridge(new LLControlAVBridge(this, getRegion()));
- }
+ else if (mVObjp->isAnimatedObject() && mVObjp->getControlAvatar())
+ {
+ setSpatialBridge(new LLControlAVBridge(this, getRegion()));
+ }
// check HUD first, because HUD is also attachment
else if (mVObjp->isAttachment())
{
+ // Attachment
+ // Use AvatarBridge of root object in attachment linkset
setSpatialBridge(new LLAvatarBridge(this, getRegion()));
}
else
{
+ // Moving linkset, use VolumeBridge of root object in linkset
setSpatialBridge(new LLVolumeBridge(this, getRegion()));
}
}
@@ -1395,10 +1403,21 @@ LLCamera LLSpatialBridge::transformCamera(LLCamera& camera)
ret.setOrigin(delta);
ret.setAxes(lookAt, left_axis, up_axis);
-
+
return ret;
}
+void LLSpatialBridge::transformExtents(const LLVector4a* src, LLVector4a* dst)
+{
+ LLMatrix4 mat = mDrawable->getXform()->getWorldMatrix();
+ mat.invert();
+
+ LLMatrix4a world_to_bridge(mat);
+
+ matMulBoundBox(world_to_bridge, src, dst);
+}
+
+
void LLDrawable::setVisible(LLCamera& camera, std::vector<LLDrawable*>* results, BOOL for_select)
{
LLViewerOctreeEntryData::setVisible();