summaryrefslogtreecommitdiff
path: root/indra/newview/llvovolume.cpp
diff options
context:
space:
mode:
authorCosmic Linden <cosmic@lindenlab.com>2022-04-20 16:19:42 -0700
committerCosmic Linden <cosmic@lindenlab.com>2022-06-21 12:33:33 -0700
commit1d3b85356f516fa2f5a5d49572743dc2a03ac86a (patch)
tree72df6fdfba94150a7f070f9f37b873e234b91156 /indra/newview/llvovolume.cpp
parent0a08645eb6a86a3279beb925ebba88393bb89936 (diff)
SL-17021: Only calculate the octree for a skinned mesh if intersection falls inside an on-the-fly calculated bounding box.
Technically not a broadphase check, but better than calculating an octree for a bunch of meshes.
Diffstat (limited to 'indra/newview/llvovolume.cpp')
-rw-r--r--indra/newview/llvovolume.cpp17
1 files changed, 8 insertions, 9 deletions
diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp
index fce233969b..6a53e704c3 100644
--- a/indra/newview/llvovolume.cpp
+++ b/indra/newview/llvovolume.cpp
@@ -4660,7 +4660,9 @@ BOOL LLVOVolume::lineSegmentIntersect(const LLVector4a& start, const LLVector4a&
continue;
}
- updateRiggedVolume(true, i);
+ // This calculates the bounding box of the skinned mesh from scratch. It's actually quite expensive, but not nearly as expensive as building a full octree.
+ // rebuild_face_octrees = false because an octree for this face will be built later only if needed for narrow phase picking.
+ updateRiggedVolume(true, i, false);
face_hit = volume->lineSegmentIntersect(local_start, local_end, i,
&p, &tc, &n, &tn);
@@ -4784,7 +4786,7 @@ void LLVOVolume::clearRiggedVolume()
}
}
-void LLVOVolume::updateRiggedVolume(bool force_update, LLRiggedVolume::FaceIndex face_index)
+void LLVOVolume::updateRiggedVolume(bool force_update, LLRiggedVolume::FaceIndex face_index, bool rebuild_face_octrees)
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_VOLUME;
//Update mRiggedVolume to match current animation frame of avatar.
@@ -4819,10 +4821,10 @@ void LLVOVolume::updateRiggedVolume(bool force_update, LLRiggedVolume::FaceIndex
updateRelativeXform();
}
- mRiggedVolume->update(skin, avatar, volume, face_index);
+ mRiggedVolume->update(skin, avatar, volume, face_index, rebuild_face_octrees);
}
-void LLRiggedVolume::update(const LLMeshSkinInfo* skin, LLVOAvatar* avatar, const LLVolume* volume, FaceIndex face_index)
+void LLRiggedVolume::update(const LLMeshSkinInfo* skin, LLVOAvatar* avatar, const LLVolume* volume, FaceIndex face_index, bool rebuild_face_octrees)
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_VOLUME;
bool copy = false;
@@ -4974,15 +4976,12 @@ void LLRiggedVolume::update(const LLMeshSkinInfo* skin, LLVOAvatar* avatar, cons
}
+ if (rebuild_face_octrees)
{
delete dst_face.mOctree;
dst_face.mOctree = NULL;
- LLVector4a size;
- size.setSub(dst_face.mExtents[1], dst_face.mExtents[0]);
- size.splat(size.getLength3().getF32()*0.5f);
-
- dst_face.createOctree(1.f);
+ dst_face.createOctree();
}
}
}