summaryrefslogtreecommitdiff
path: root/indra/newview/llface.cpp
diff options
context:
space:
mode:
authorBrad Payne (Vir Linden) <vir@lindenlab.com>2018-06-01 15:08:59 +0100
committerBrad Payne (Vir Linden) <vir@lindenlab.com>2018-06-01 15:08:59 +0100
commite86839fac19753d0fa4006296c7f8909fe781013 (patch)
treef65f6ae403736fb48012a9334a95730f88e2ae1e /indra/newview/llface.cpp
parent39bcae574f410f93d26c95ec2398f3653678e997 (diff)
SL-915 - WIP on dynamic joint box tracking
Diffstat (limited to 'indra/newview/llface.cpp')
-rw-r--r--indra/newview/llface.cpp92
1 files changed, 22 insertions, 70 deletions
diff --git a/indra/newview/llface.cpp b/indra/newview/llface.cpp
index efd57ec39f..7bc7814392 100644
--- a/indra/newview/llface.cpp
+++ b/indra/newview/llface.cpp
@@ -810,17 +810,11 @@ bool less_than_max_mag(const LLVector4a& vec)
}
BOOL LLFace::genVolumeBBoxes(const LLVolume &volume, S32 f,
- const LLMatrix4& mat_vert_in, BOOL global_volume)
+ const LLMatrix4& mat_vert_in, BOOL global_volume)
{
//get bounding box
if (mDrawablep->isState(LLDrawable::REBUILD_VOLUME | LLDrawable::REBUILD_POSITION | LLDrawable::REBUILD_RIGGED))
{
- //VECTORIZE THIS
- LLMatrix4a mat_vert;
- mat_vert.loadu(mat_vert_in);
-
- LLVector4a min,max;
-
if (f >= volume.getNumVolumeFaces())
{
LL_WARNS() << "Generating bounding box for invalid face index!" << LL_ENDL;
@@ -828,39 +822,11 @@ BOOL LLFace::genVolumeBBoxes(const LLVolume &volume, S32 f,
}
const LLVolumeFace &face = volume.getVolumeFace(f);
- min = face.mExtents[0];
- max = face.mExtents[1];
- LL_DEBUGS("RiggedBox") << "updating extents for face " << f << " starting extents " << mExtents[0] << ", " << mExtents[1] << LL_ENDL;
- LL_DEBUGS("RiggedBox") << "updating extents for face " << f << " starting vf extents " << face.mExtents[0] << ", " << face.mExtents[1] << " num verts " << face.mNumVertices << LL_ENDL;
-
- llassert(less_than_max_mag(min));
- llassert(less_than_max_mag(max));
-
- //min, max are in volume space, convert to drawable render space
-
- //get 8 corners of bounding box
- LLVector4Logical mask[6];
-
- for (U32 i = 0; i < 6; ++i)
- {
- mask[i].clear();
- }
-
- mask[0].setElement<2>(); //001
- mask[1].setElement<1>(); //010
- mask[2].setElement<1>(); //011
- mask[2].setElement<2>();
- mask[3].setElement<0>(); //100
- mask[4].setElement<0>(); //101
- mask[4].setElement<2>();
- mask[5].setElement<0>(); //110
- mask[5].setElement<1>();
-
- LLVector4a v[8];
-
- v[6] = min;
- v[7] = max;
+ LL_DEBUGS("RiggedBox") << "updating extents for face " << f
+ << " starting extents " << mExtents[0] << ", " << mExtents[1]
+ << " starting vf extents " << face.mExtents[0] << ", " << face.mExtents[1]
+ << " num verts " << face.mNumVertices << LL_ENDL;
// MAINT-8264 - stray vertices, especially in low LODs, cause bounding box errors.
if (face.mNumVertices < 3)
@@ -870,52 +836,38 @@ BOOL LLFace::genVolumeBBoxes(const LLVolume &volume, S32 f,
return FALSE;
}
- for (U32 i = 0; i < 6; ++i)
- {
- v[i].setSelectWithMask(mask[i], min, max);
- }
-
- LLVector4a tv[8];
-
- LL_DEBUGS("RiggedBox") << "updating extents for face " << f << " mat is " << mat_vert << LL_ENDL;
+ //VECTORIZE THIS
+ LLMatrix4a mat_vert;
+ mat_vert.loadu(mat_vert_in);
+ LLVector4a new_extents[2];
- //transform bounding box into drawable space
- for (U32 i = 0; i < 8; ++i)
- {
- mat_vert.affineTransform(v[i], tv[i]);
- LL_DEBUGS("RiggedBox") << "updating extents for face " << f << " i " << i << " v and tv " << v[i] << ", " << tv[i] << LL_ENDL;
- }
-
- //find bounding box
- LLVector4a& newMin = mExtents[0];
- LLVector4a& newMax = mExtents[1];
+ llassert(less_than_max_mag(face.mExtents[0]));
+ llassert(less_than_max_mag(face.mExtents[1]));
- newMin = newMax = tv[0];
+ matMulBoundBox(mat_vert, face.mExtents, mExtents);
- for (U32 i = 1; i < 8; ++i)
- {
- newMin.setMin(newMin, tv[i]);
- newMax.setMax(newMax, tv[i]);
- }
- LL_DEBUGS("RiggedBox") << "updating extents for face " << f << " bbox gave extents " << mExtents[0] << ", " << mExtents[1] << LL_ENDL;
+ LL_DEBUGS("RiggedBox") << "updated extents for face " << f
+ << " bbox gave extents " << mExtents[0] << ", " << mExtents[1] << LL_ENDL;
if (!mDrawablep->isActive())
{ // Shift position for region
LLVector4a offset;
offset.load3(mDrawablep->getRegion()->getOriginAgent().mV);
- newMin.add(offset);
- newMax.add(offset);
- LL_DEBUGS("RiggedBox") << "updating extents for face " << f << " not active, added offset " << offset << LL_ENDL;
+ mExtents[0].add(offset);
+ mExtents[1].add(offset);
+ LL_DEBUGS("RiggedBox") << "updating extents for face " << f
+ << " not active, added offset " << offset << LL_ENDL;
}
- LL_DEBUGS("RiggedBox") << "updated extents for face " << f << " to " << mExtents[0] << ", " << mExtents[1] << LL_ENDL;
+ LL_DEBUGS("RiggedBox") << "updated extents for face " << f
+ << " to " << mExtents[0] << ", " << mExtents[1] << LL_ENDL;
LLVector4a t;
- t.setAdd(newMin,newMax);
+ t.setAdd(mExtents[0],mExtents[1]);
t.mul(0.5f);
mCenterLocal.set(t.getF32ptr());
- t.setSub(newMax,newMin);
+ t.setSub(mExtents[1],mExtents[0]);
mBoundingSphereRadius = t.getLength3().getF32()*0.5f;
updateCenterAgent();