summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--indra/newview/lldrawable.cpp25
-rw-r--r--indra/newview/llspatialpartition.cpp1
-rw-r--r--indra/newview/llspatialpartition.h12
-rw-r--r--indra/newview/llviewerobject.cpp26
-rw-r--r--indra/newview/llviewerobject.h1
-rw-r--r--indra/newview/llviewerregion.cpp1
-rw-r--r--indra/newview/llviewerregion.h1
-rw-r--r--indra/newview/llvoavatar.cpp2
-rw-r--r--indra/newview/llvovolume.cpp11
-rw-r--r--indra/newview/pipeline.cpp2
10 files changed, 65 insertions, 17 deletions
diff --git a/indra/newview/lldrawable.cpp b/indra/newview/lldrawable.cpp
index 61524bcc6e..ad19574b44 100644
--- a/indra/newview/lldrawable.cpp
+++ b/indra/newview/lldrawable.cpp
@@ -1181,7 +1181,9 @@ LLSpatialPartition* LLDrawable::getSpatialPartition()
if (mSpatialBridge)
{
U32 partition_type = mSpatialBridge->asPartition()->mPartitionType;
- if ((partition_type == LLViewerRegion::PARTITION_HUD) != mVObjp->isHUDAttachment())
+ bool is_hud = mVObjp->isHUDAttachment();
+ bool is_attachment = mVObjp->isAttachment() && !is_hud;
+ if ((partition_type == LLViewerRegion::PARTITION_HUD) != is_hud)
{
// Was/became HUD
// remove obsolete bridge
@@ -1195,6 +1197,13 @@ LLSpatialPartition* LLDrawable::getSpatialPartition()
mSpatialBridge->markDead();
setSpatialBridge(NULL);
}
+ else if ((partition_type == LLViewerRegion::PARTITION_AVATAR) != is_attachment)
+ {
+ // Was/became part of avatar
+ // remove obsolete bridge
+ mSpatialBridge->markDead();
+ setSpatialBridge(NULL);
+ }
}
//must be an active volume
if (!mSpatialBridge)
@@ -1207,6 +1216,11 @@ LLSpatialPartition* LLDrawable::getSpatialPartition()
{
setSpatialBridge(new LLControlAVBridge(this, getRegion()));
}
+ // check HUD first, because HUD is also attachment
+ else if (mVObjp->isAttachment())
+ {
+ setSpatialBridge(new LLAvatarBridge(this, getRegion()));
+ }
else
{
setSpatialBridge(new LLVolumeBridge(this, getRegion()));
@@ -1714,12 +1728,19 @@ void LLDrawable::updateFaceSize(S32 idx)
LLBridgePartition::LLBridgePartition(LLViewerRegion* regionp)
: LLSpatialPartition(0, FALSE, 0, regionp)
{
- mDrawableType = LLPipeline::RENDER_TYPE_AVATAR;
+ mDrawableType = LLPipeline::RENDER_TYPE_VOLUME;
mPartitionType = LLViewerRegion::PARTITION_BRIDGE;
mLODPeriod = 16;
mSlopRatio = 0.25f;
}
+LLAvatarPartition::LLAvatarPartition(LLViewerRegion* regionp)
+ : LLBridgePartition(regionp)
+{
+ mDrawableType = LLPipeline::RENDER_TYPE_AVATAR;
+ mPartitionType = LLViewerRegion::PARTITION_AVATAR;
+}
+
LLControlAVPartition::LLControlAVPartition(LLViewerRegion* regionp)
: LLBridgePartition(regionp)
{
diff --git a/indra/newview/llspatialpartition.cpp b/indra/newview/llspatialpartition.cpp
index 8fcfe9d386..ab95076ab5 100644
--- a/indra/newview/llspatialpartition.cpp
+++ b/indra/newview/llspatialpartition.cpp
@@ -559,6 +559,7 @@ void LLSpatialGroup::shift(const LLVector4a &offset)
getSpatialPartition()->mPartitionType != LLViewerRegion::PARTITION_TREE &&
getSpatialPartition()->mPartitionType != LLViewerRegion::PARTITION_TERRAIN &&
getSpatialPartition()->mPartitionType != LLViewerRegion::PARTITION_BRIDGE &&
+ getSpatialPartition()->mPartitionType != LLViewerRegion::PARTITION_AVATAR &&
getSpatialPartition()->mPartitionType != LLViewerRegion::PARTITION_CONTROL_AV)
{
setState(GEOM_DIRTY);
diff --git a/indra/newview/llspatialpartition.h b/indra/newview/llspatialpartition.h
index 7947b2c908..919f386d29 100644
--- a/indra/newview/llspatialpartition.h
+++ b/indra/newview/llspatialpartition.h
@@ -685,6 +685,12 @@ public:
virtual void addGeometryCount(LLSpatialGroup* group, U32 &vertex_count, U32& index_count) { LLVolumeGeometryManager::addGeometryCount(group, vertex_count, index_count); }
};
+class LLAvatarBridge : public LLVolumeBridge
+{
+public:
+ LLAvatarBridge(LLDrawable* drawablep, LLViewerRegion* regionp);
+};
+
class LLControlAVBridge : public LLVolumeBridge
{
public:
@@ -708,6 +714,12 @@ public:
virtual void addGeometryCount(LLSpatialGroup* group, U32 &vertex_count, U32& index_count) { }
};
+class LLAvatarPartition : public LLBridgePartition
+{
+public:
+ LLAvatarPartition(LLViewerRegion* regionp);
+};
+
class LLControlAVPartition : public LLBridgePartition
{
public:
diff --git a/indra/newview/llviewerobject.cpp b/indra/newview/llviewerobject.cpp
index 1353a27982..0cbfa7d31a 100644
--- a/indra/newview/llviewerobject.cpp
+++ b/indra/newview/llviewerobject.cpp
@@ -279,6 +279,7 @@ LLViewerObject::LLViewerObject(const LLUUID &id, const LLPCode pcode, LLViewerRe
mOnActiveList(FALSE),
mOnMap(FALSE),
mStatic(FALSE),
+ mSeatCount(0),
mNumFaces(0),
mRotTime(0.f),
mAngularVelocityRot(),
@@ -890,7 +891,12 @@ void LLViewerObject::addChild(LLViewerObject *childp)
if(childp->setParent(this))
{
mChildList.push_back(childp);
- childp->afterReparent();
+ childp->afterReparent();
+
+ if (childp->isAvatar())
+ {
+ mSeatCount++;
+ }
}
}
@@ -919,6 +925,11 @@ void LLViewerObject::removeChild(LLViewerObject *childp)
{
childp->setParent(NULL);
}
+
+ if (childp->isAvatar())
+ {
+ mSeatCount--;
+ }
break;
}
}
@@ -976,21 +987,10 @@ BOOL LLViewerObject::isChild(LLViewerObject *childp) const
return FALSE;
}
-
// returns TRUE if at least one avatar is sitting on this object
BOOL LLViewerObject::isSeat() const
{
- for (child_list_t::const_iterator iter = mChildList.begin();
- iter != mChildList.end(); iter++)
- {
- LLViewerObject* child = *iter;
- if (child->isAvatar())
- {
- return TRUE;
- }
- }
- return FALSE;
-
+ return mSeatCount > 0;
}
BOOL LLViewerObject::setDrawableParent(LLDrawable* parentp)
diff --git a/indra/newview/llviewerobject.h b/indra/newview/llviewerobject.h
index 873b300489..5322dbfe89 100644
--- a/indra/newview/llviewerobject.h
+++ b/indra/newview/llviewerobject.h
@@ -822,6 +822,7 @@ protected:
BOOL mOnActiveList;
BOOL mOnMap; // On the map.
BOOL mStatic; // Object doesn't move.
+ S32 mSeatCount;
S32 mNumFaces;
F32 mRotTime; // Amount (in seconds) that object has rotated according to angular velocity (llSetTargetOmega)
diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp
index a5a4c877b9..dbe9cdb13b 100644
--- a/indra/newview/llviewerregion.cpp
+++ b/indra/newview/llviewerregion.cpp
@@ -607,6 +607,7 @@ LLViewerRegion::LLViewerRegion(const U64 &handle,
mImpl->mObjectPartition.push_back(new LLGrassPartition(this)); //PARTITION_GRASS
mImpl->mObjectPartition.push_back(new LLVolumePartition(this)); //PARTITION_VOLUME
mImpl->mObjectPartition.push_back(new LLBridgePartition(this)); //PARTITION_BRIDGE
+ mImpl->mObjectPartition.push_back(new LLAvatarPartition(this)); //PARTITION_AVATAR
mImpl->mObjectPartition.push_back(new LLControlAVPartition(this)); //PARTITION_CONTROL_AV
mImpl->mObjectPartition.push_back(new LLHUDParticlePartition(this));//PARTITION_HUD_PARTICLE
mImpl->mObjectPartition.push_back(new LLVOCachePartition(this)); //PARTITION_VO_CACHE
diff --git a/indra/newview/llviewerregion.h b/indra/newview/llviewerregion.h
index d9b08d4548..6e96b98a2d 100644
--- a/indra/newview/llviewerregion.h
+++ b/indra/newview/llviewerregion.h
@@ -86,6 +86,7 @@ public:
PARTITION_GRASS,
PARTITION_VOLUME,
PARTITION_BRIDGE,
+ PARTITION_AVATAR,
PARTITION_CONTROL_AV, // Animesh
PARTITION_HUD_PARTICLE,
PARTITION_VO_CACHE,
diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp
index 6644654a1c..706927d81e 100644
--- a/indra/newview/llvoavatar.cpp
+++ b/indra/newview/llvoavatar.cpp
@@ -9963,7 +9963,7 @@ void LLVOAvatar::onActiveOverrideMeshesChanged()
U32 LLVOAvatar::getPartitionType() const
{
// Avatars merely exist as drawables in the bridge partition
- return mIsControlAvatar ? LLViewerRegion::PARTITION_CONTROL_AV : LLViewerRegion::PARTITION_BRIDGE;
+ return mIsControlAvatar ? LLViewerRegion::PARTITION_CONTROL_AV : LLViewerRegion::PARTITION_AVATAR;
}
//static
diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp
index 83f7f6a5e9..25e9b425b4 100644
--- a/indra/newview/llvovolume.cpp
+++ b/indra/newview/llvovolume.cpp
@@ -4854,6 +4854,10 @@ U32 LLVOVolume::getPartitionType() const
{
return LLViewerRegion::PARTITION_CONTROL_AV;
}
+ if (isAttachment())
+ {
+ return LLViewerRegion::PARTITION_AVATAR;
+ }
return LLViewerRegion::PARTITION_VOLUME;
}
@@ -4884,6 +4888,13 @@ LLVolumeGeometryManager()
mSlopRatio = 0.25f;
}
+LLAvatarBridge::LLAvatarBridge(LLDrawable* drawablep, LLViewerRegion* regionp)
+ : LLVolumeBridge(drawablep, regionp)
+{
+ mDrawableType = LLPipeline::RENDER_TYPE_AVATAR;
+ mPartitionType = LLViewerRegion::PARTITION_AVATAR;
+}
+
LLControlAVBridge::LLControlAVBridge(LLDrawable* drawablep, LLViewerRegion* regionp)
: LLVolumeBridge(drawablep, regionp)
{
diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp
index 927ed5528f..7c0ba51dd3 100644
--- a/indra/newview/pipeline.cpp
+++ b/indra/newview/pipeline.cpp
@@ -7209,7 +7209,7 @@ LLViewerObject* LLPipeline::lineSegmentIntersectInWorld(const LLVector4a& start,
{
LLViewerRegion* region = *iter;
- LLSpatialPartition* part = region->getSpatialPartition(LLViewerRegion::PARTITION_BRIDGE);
+ LLSpatialPartition* part = region->getSpatialPartition(LLViewerRegion::PARTITION_AVATAR);
if (part && hasRenderType(part->mDrawableType))
{
LLDrawable* hit = part->lineSegmentIntersect(start, local_end, pick_transparent, pick_rigged, face_hit, &position, tex_coord, normal, tangent);