summaryrefslogtreecommitdiff
path: root/indra/llmath
diff options
context:
space:
mode:
authorAndrew Meadows <andrew@lindenlab.com>2010-12-14 08:52:33 -0800
committerAndrew Meadows <andrew@lindenlab.com>2010-12-14 08:52:33 -0800
commit64512b681e2f5582378d9943642a82c83cae30ac (patch)
tree2ebc13a3426054c315a63e53d94ce7a45e9e1e63 /indra/llmath
parente040f16a4f2e50592a125a04185fd9f06ac49522 (diff)
ER-398 viewer's encroachment logic only uses bounding box of root prim
Adding LLBBox::join() to allow us to compute the bounding box of a linked object
Diffstat (limited to 'indra/llmath')
-rw-r--r--indra/llmath/llbbox.cpp13
-rw-r--r--indra/llmath/llbbox.h5
2 files changed, 17 insertions, 1 deletions
diff --git a/indra/llmath/llbbox.cpp b/indra/llmath/llbbox.cpp
index 72c906b5ca..67a305d269 100644
--- a/indra/llmath/llbbox.cpp
+++ b/indra/llmath/llbbox.cpp
@@ -102,6 +102,19 @@ LLBBox LLBBox::getAxisAligned() const
return aligned;
}
+// Increases the size to contain other_box
+void LLBBox::join(const LLBBox& other_box)
+{
+ LLVector3 other_min = (other_box.mPosAgent - mPosAgent) - other_box.mMinLocal;
+ mMinLocal.mV[VX] = llmin( other_min.mV[VX], mMinLocal.mV[VX] );
+ mMinLocal.mV[VY] = llmin( other_min.mV[VY], mMinLocal.mV[VY] );
+ mMinLocal.mV[VZ] = llmin( other_min.mV[VZ], mMinLocal.mV[VZ] );
+
+ LLVector3 other_max = (other_box.mPosAgent - mPosAgent) + other_box.mMaxLocal;
+ mMaxLocal.mV[VX] = llmax( other_max.mV[VX], mMaxLocal.mV[VX] );
+ mMaxLocal.mV[VY] = llmax( other_max.mV[VY], mMaxLocal.mV[VY] );
+ mMaxLocal.mV[VZ] = llmax( other_max.mV[VZ], mMaxLocal.mV[VZ] );
+}
void LLBBox::expand( F32 delta )
diff --git a/indra/llmath/llbbox.h b/indra/llmath/llbbox.h
index a0d434b051..8616320381 100644
--- a/indra/llmath/llbbox.h
+++ b/indra/llmath/llbbox.h
@@ -83,7 +83,10 @@ public:
LLVector3 agentToLocalBasis(const LLVector3& v) const;
// Get the smallest possible axis aligned bbox that contains this bbox
- LLBBox getAxisAligned() const;
+ LLBBox getAxisAligned() const;
+
+ // Increases the size to contain other_box
+ void join(const LLBBox& other_box);
// friend LLBBox operator*(const LLBBox& a, const LLMatrix4& b);