From 424786d8d05093abd816a3decd86aace64816179 Mon Sep 17 00:00:00 2001 From: Andrew Meadows Date: Thu, 18 Nov 2010 15:55:53 -0800 Subject: Added viewer-side "object overlaps parcel" check encroachment returnabilty UI Reviewed with Falcon --- indra/llmath/llbbox.cpp | 23 +++++++++++++++++++++++ indra/llmath/llbbox.h | 5 +++++ 2 files changed, 28 insertions(+) (limited to 'indra/llmath') diff --git a/indra/llmath/llbbox.cpp b/indra/llmath/llbbox.cpp index b46a6e03d2..72c906b5ca 100644 --- a/indra/llmath/llbbox.cpp +++ b/indra/llmath/llbbox.cpp @@ -89,6 +89,20 @@ void LLBBox::addBBoxAgent(const LLBBox& b) } } +LLBBox LLBBox::getAxisAligned() const +{ + // no rotiation = axis aligned rotation + LLBBox aligned(mPosAgent, LLQuaternion(), LLVector3(), LLVector3()); + + // add the center point so that it's not empty + aligned.addPointAgent(mPosAgent); + + // add our BBox + aligned.addBBoxAgent(*this); + + return aligned; +} + void LLBBox::expand( F32 delta ) { @@ -147,6 +161,15 @@ BOOL LLBBox::containsPointAgent(const LLVector3& p) const return containsPointLocal(point_local); } +LLVector3 LLBBox::getMinAgent() const +{ + return localToAgent(mMinLocal); +} + +LLVector3 LLBBox::getMaxAgent() const +{ + return localToAgent(mMaxLocal); +} /* LLBBox operator*(const LLBBox &a, const LLMatrix4 &b) diff --git a/indra/llmath/llbbox.h b/indra/llmath/llbbox.h index 5b911793f0..a0d434b051 100644 --- a/indra/llmath/llbbox.h +++ b/indra/llmath/llbbox.h @@ -51,9 +51,11 @@ public: const LLVector3& getPositionAgent() const { return mPosAgent; } const LLQuaternion& getRotation() const { return mRotation; } + LLVector3 getMinAgent() const; const LLVector3& getMinLocal() const { return mMinLocal; } void setMinLocal( const LLVector3& min ) { mMinLocal = min; } + LLVector3 getMaxAgent() const; const LLVector3& getMaxLocal() const { return mMaxLocal; } void setMaxLocal( const LLVector3& max ) { mMaxLocal = max; } @@ -80,6 +82,9 @@ public: LLVector3 localToAgentBasis(const LLVector3& v) const; LLVector3 agentToLocalBasis(const LLVector3& v) const; + // Get the smallest possible axis aligned bbox that contains this bbox + LLBBox getAxisAligned() const; + // friend LLBBox operator*(const LLBBox& a, const LLMatrix4& b); -- cgit v1.2.3 From 64512b681e2f5582378d9943642a82c83cae30ac Mon Sep 17 00:00:00 2001 From: Andrew Meadows Date: Tue, 14 Dec 2010 08:52:33 -0800 Subject: 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 --- indra/llmath/llbbox.cpp | 13 +++++++++++++ indra/llmath/llbbox.h | 5 ++++- 2 files changed, 17 insertions(+), 1 deletion(-) (limited to 'indra/llmath') 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); -- cgit v1.2.3 From 3be87bb04685e971965ab5ac4166165c3785476f Mon Sep 17 00:00:00 2001 From: Andrew Meadows Date: Wed, 15 Dec 2010 11:23:00 -0800 Subject: ER-407 child bounding boxes not rotated properly for encroachment returnability Using the correct method for joining BBoxes in the agent frame ::addBBoxAgent() --- indra/llmath/llbbox.cpp | 14 -------------- indra/llmath/llbbox.h | 4 ---- 2 files changed, 18 deletions(-) (limited to 'indra/llmath') diff --git a/indra/llmath/llbbox.cpp b/indra/llmath/llbbox.cpp index 67a305d269..d2208f604e 100644 --- a/indra/llmath/llbbox.cpp +++ b/indra/llmath/llbbox.cpp @@ -102,20 +102,6 @@ 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 8616320381..28e69b75e1 100644 --- a/indra/llmath/llbbox.h +++ b/indra/llmath/llbbox.h @@ -85,10 +85,6 @@ public: // Get the smallest possible axis aligned bbox that contains this bbox 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); private: -- cgit v1.2.3 From 44e6327674bbe45d92e3411c24ff51b5c4318bbb Mon Sep 17 00:00:00 2001 From: Wolfpup Lowenhar Date: Tue, 28 Dec 2010 19:14:33 -0500 Subject: STORM-825 : Reenable the LLMatrix3::orthogonalize test in llmath/tests/m3math_test.cpp Removed the skipping of a working test as this was causeing a the test to fail building and thus not actualy running all the tests. --- indra/llmath/tests/m3math_test.cpp | 1 - 1 file changed, 1 deletion(-) (limited to 'indra/llmath') diff --git a/indra/llmath/tests/m3math_test.cpp b/indra/llmath/tests/m3math_test.cpp index 8abf61b740..e4d31996a3 100644 --- a/indra/llmath/tests/m3math_test.cpp +++ b/indra/llmath/tests/m3math_test.cpp @@ -280,7 +280,6 @@ namespace tut llmat_obj.setRows(llvec1, llvec2, llvec3); llmat_obj.orthogonalize(); - skip("Grr, LLMatrix3::orthogonalize test is failing. Has it ever worked?"); ensure("LLMatrix3::orthogonalize failed ", is_approx_equal(0.19611613f, llmat_obj.mMatrix[0][0]) && is_approx_equal(0.78446454f, llmat_obj.mMatrix[0][1]) && -- cgit v1.2.3 From c8457f266423370e6f8e84c1b23ef95ed69a2997 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Mon, 10 Jan 2011 18:01:16 -0800 Subject: STORM-807 : Clean up code as discussed with Andrew --- indra/llmath/llbbox.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/llmath') diff --git a/indra/llmath/llbbox.cpp b/indra/llmath/llbbox.cpp index d2208f604e..3e2c05a6e6 100644 --- a/indra/llmath/llbbox.cpp +++ b/indra/llmath/llbbox.cpp @@ -91,7 +91,7 @@ void LLBBox::addBBoxAgent(const LLBBox& b) LLBBox LLBBox::getAxisAligned() const { - // no rotiation = axis aligned rotation + // no rotation = axis aligned rotation LLBBox aligned(mPosAgent, LLQuaternion(), LLVector3(), LLVector3()); // add the center point so that it's not empty -- cgit v1.2.3 From c602fed9b7f262d6cba713f6a282aacde6304fde Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Tue, 18 Jan 2011 14:08:21 -0700 Subject: fix for SH-659: small textures not loaded --- indra/llmath/llvolume.cpp | 41 ++++++++++++++++++++++++++++++++++++++--- indra/llmath/llvolume.h | 1 + 2 files changed, 39 insertions(+), 3 deletions(-) (limited to 'indra/llmath') diff --git a/indra/llmath/llvolume.cpp b/indra/llmath/llvolume.cpp index 14e1ca8d43..71b92962fb 100644 --- a/indra/llmath/llvolume.cpp +++ b/indra/llmath/llvolume.cpp @@ -4406,19 +4406,54 @@ std::ostream& operator<<(std::ostream &s, const LLVolume *volumep) BOOL LLVolumeFace::create(LLVolume* volume, BOOL partial_build) { + BOOL ret = FALSE ; if (mTypeMask & CAP_MASK) { - return createCap(volume, partial_build); + ret = createCap(volume, partial_build); } else if ((mTypeMask & END_MASK) || (mTypeMask & SIDE_MASK)) { - return createSide(volume, partial_build); + ret = createSide(volume, partial_build); } else { llerrs << "Unknown/uninitialized face type!" << llendl; - return FALSE; } + + //update the range of the texture coordinates + if(ret) + { + mTexCoordExtents[0].setVec(1.f, 1.f) ; + mTexCoordExtents[1].setVec(0.f, 0.f) ; + + U32 end = mVertices.size() ; + for(U32 i = 0 ; i < end ; i++) + { + if(mTexCoordExtents[0].mV[0] > mVertices[i].mTexCoord.mV[0]) + { + mTexCoordExtents[0].mV[0] = mVertices[i].mTexCoord.mV[0] ; + } + if(mTexCoordExtents[1].mV[0] < mVertices[i].mTexCoord.mV[0]) + { + mTexCoordExtents[1].mV[0] = mVertices[i].mTexCoord.mV[0] ; + } + + if(mTexCoordExtents[0].mV[1] > mVertices[i].mTexCoord.mV[1]) + { + mTexCoordExtents[0].mV[1] = mVertices[i].mTexCoord.mV[1] ; + } + if(mTexCoordExtents[1].mV[1] < mVertices[i].mTexCoord.mV[1]) + { + mTexCoordExtents[1].mV[1] = mVertices[i].mTexCoord.mV[1] ; + } + } + mTexCoordExtents[0].mV[0] = llmax(0.f, mTexCoordExtents[0].mV[0]) ; + mTexCoordExtents[0].mV[1] = llmax(0.f, mTexCoordExtents[0].mV[1]) ; + mTexCoordExtents[1].mV[0] = llmin(1.f, mTexCoordExtents[1].mV[0]) ; + mTexCoordExtents[1].mV[1] = llmin(1.f, mTexCoordExtents[1].mV[1]) ; + } + + return ret ; } void LerpPlanarVertex(LLVolumeFace::VertexData& v0, diff --git a/indra/llmath/llvolume.h b/indra/llmath/llvolume.h index d48a79ee46..28b9895ff3 100644 --- a/indra/llmath/llvolume.h +++ b/indra/llmath/llvolume.h @@ -831,6 +831,7 @@ public: S32 mNumT; LLVector3 mExtents[2]; //minimum and maximum point of face + LLVector2 mTexCoordExtents[2]; //minimum and maximum of texture coordinates of the face. std::vector mVertices; std::vector mIndices; -- cgit v1.2.3