diff options
Diffstat (limited to 'indra/llmath')
| -rw-r--r-- | indra/llmath/llquaternion.cpp | 2 | ||||
| -rw-r--r-- | indra/llmath/llvolume.cpp | 8 | ||||
| -rw-r--r-- | indra/llmath/m3math.cpp | 26 | ||||
| -rw-r--r-- | indra/llmath/m3math.h | 4 | ||||
| -rw-r--r-- | indra/llmath/m4math.cpp | 27 | ||||
| -rw-r--r-- | indra/llmath/m4math.h | 6 | ||||
| -rw-r--r-- | indra/llmath/tests/m3math_test.cpp | 2 | ||||
| -rw-r--r-- | indra/llmath/v3color.h | 17 | 
8 files changed, 30 insertions, 62 deletions
| diff --git a/indra/llmath/llquaternion.cpp b/indra/llmath/llquaternion.cpp index a8d9eba2a0..a7ff707bb8 100644 --- a/indra/llmath/llquaternion.cpp +++ b/indra/llmath/llquaternion.cpp @@ -38,6 +38,8 @@  #include "m3math.h"  #include "llquantize.h" +#pragma optimize("", off) +  // WARNING: Don't use this for global const definitions!  using this  // at the top of a *.cpp file might not give you what you think.  const LLQuaternion LLQuaternion::DEFAULT; diff --git a/indra/llmath/llvolume.cpp b/indra/llmath/llvolume.cpp index 648f9a8d93..14b0f350b9 100644 --- a/indra/llmath/llvolume.cpp +++ b/indra/llmath/llvolume.cpp @@ -2191,6 +2191,12 @@ BOOL LLVolume::generate()  			LLVector4a* end_profile = profile+sizeT;  			LLVector4a offset = mPathp->mPath[s].mPos; +            if (!offset.isFinite3()) +            { // MAINT-5660; don't know why this happens, does not affect Release builds +                LL_WARNS() << "LLVolume using path with non-finite points. Resetting them to 0,0,0" << LL_ENDL; +                offset.clear(); +            } +  			LLVector4a tmp;  			// Run along the profile. @@ -2198,7 +2204,7 @@ BOOL LLVolume::generate()  			{  				rot_mat.rotate(*profile++, tmp);  				dst->setAdd(tmp,offset); -				llassert(dst->isFinite3()); // MAINT-5660; don't know why this happens, does not affect Release builds +				  				++dst;  			}  		} diff --git a/indra/llmath/m3math.cpp b/indra/llmath/m3math.cpp index 802ddb9e57..7e59e10bab 100644 --- a/indra/llmath/m3math.cpp +++ b/indra/llmath/m3math.cpp @@ -34,6 +34,8 @@  #include "m3math.h"  #include "llquaternion.h" +#pragma optimize("", off) +  // LLMatrix3  //              ji   @@ -75,13 +77,6 @@ LLMatrix3::LLMatrix3(const F32 angle, const LLVector4 &vec)  	setRot(quat);  } -LLMatrix3::LLMatrix3(const F32 angle, const F32 x, const F32 y, const F32 z) -{ -	LLVector3 vec(x, y, z); -	LLQuaternion	quat(angle, vec); -	setRot(quat); -} -  LLMatrix3::LLMatrix3(const F32 roll, const F32 pitch, const F32 yaw)  {  	setRot(roll,pitch,yaw); @@ -294,14 +289,6 @@ LLQuaternion	LLMatrix3::quaternion() const  	return quat;  } - -// These functions take Rotation arguments -const LLMatrix3&	LLMatrix3::setRot(const F32 angle, const F32 x, const F32 y, const F32 z) -{ -	setRot(LLQuaternion(angle,x,y,z)); -	return *this; -} -  const LLMatrix3&	LLMatrix3::setRot(const F32 angle, const LLVector3 &vec)  {  	setRot(LLQuaternion(angle, vec)); @@ -394,15 +381,6 @@ const LLMatrix3& LLMatrix3::setCol( U32 colIndex, const LLVector3& col )  	return *this;  } -		 -// Rotate exisitng mMatrix -const LLMatrix3&	LLMatrix3::rotate(const F32 angle, const F32 x, const F32 y, const F32 z) -{ -	LLMatrix3	mat(angle, x, y, z); -	*this *= mat; -	return *this; -} -  const LLMatrix3&	LLMatrix3::rotate(const F32 angle, const LLVector3 &vec)  { diff --git a/indra/llmath/m3math.h b/indra/llmath/m3math.h index 2be5452f8d..bf38895855 100644 --- a/indra/llmath/m3math.h +++ b/indra/llmath/m3math.h @@ -60,7 +60,6 @@ class LLMatrix3  		explicit LLMatrix3(const F32 *mat);					// Initializes Matrix to values in mat  		explicit LLMatrix3(const LLQuaternion &q);			// Initializes Matrix with rotation q -		LLMatrix3(const F32 angle, const F32 x, const F32 y, const F32 z);	// Initializes Matrix with axis angle  		LLMatrix3(const F32 angle, const LLVector3 &vec);	// Initializes Matrix with axis angle  		LLMatrix3(const F32 angle, const LLVector3d &vec);	// Initializes Matrix with axis angle  		LLMatrix3(const F32 angle, const LLVector4 &vec);	// Initializes Matrix with axis angle @@ -81,8 +80,7 @@ class LLMatrix3  		// Matrix setters - set some properties without modifying others  		// -		// These functions take Rotation arguments -		const LLMatrix3& setRot(const F32 angle, const F32 x, const F32 y, const F32 z);	// Calculate rotation matrix for rotating angle radians about (x, y, z) +		// These functions take Rotation arguments		  		const LLMatrix3& setRot(const F32 angle, const LLVector3 &vec);	// Calculate rotation matrix for rotating angle radians about vec  		const LLMatrix3& setRot(const F32 roll, const F32 pitch, const F32 yaw);	// Calculate rotation matrix from Euler angles  		const LLMatrix3& setRot(const LLQuaternion &q);			// Transform matrix by Euler angles and translating by pos diff --git a/indra/llmath/m4math.cpp b/indra/llmath/m4math.cpp index d89c482804..3baf1bad18 100644 --- a/indra/llmath/m4math.cpp +++ b/indra/llmath/m4math.cpp @@ -384,13 +384,6 @@ void LLMatrix4::initRows(const LLVector4 &row0,  } -const LLMatrix4& 	LLMatrix4::initRotation(const F32 angle, const F32 x, const F32 y, const F32 z) -{ -	LLMatrix3	mat(angle, x, y, z); -	return initMatrix(mat); -} - -  const LLMatrix4& 	LLMatrix4::initRotation(F32 angle, const LLVector4 &vec)  {  	LLMatrix3	mat(angle, vec); @@ -412,17 +405,6 @@ const LLMatrix4&  	LLMatrix4::initRotation(const LLQuaternion &q)  } -// Position and Rotation -const LLMatrix4&  	LLMatrix4::initRotTrans(const F32 angle, const F32 rx, const F32 ry, const F32 rz, -											const F32 tx, const F32 ty, const F32 tz) -{ -	LLMatrix3	mat(angle, rx, ry, rz); -	LLVector3	translation(tx, ty, tz); -	initMatrix(mat); -	setTranslation(translation); -	return (*this); -} -  const LLMatrix4&  	LLMatrix4::initRotTrans(const F32 angle, const LLVector3 &axis, const LLVector3&translation)  {  	LLMatrix3	mat(angle, axis); @@ -513,15 +495,6 @@ const LLMatrix4& LLMatrix4::initAll(const LLVector3 &scale, const LLQuaternion &  	return (*this);  } -// Rotate exisitng mMatrix -const LLMatrix4&  	LLMatrix4::rotate(const F32 angle, const F32 x, const F32 y, const F32 z) -{ -	LLVector4	vec4(x, y, z); -	LLMatrix4	mat(angle, vec4); -	*this *= mat; -	return *this; -} -  const LLMatrix4&  	LLMatrix4::rotate(const F32 angle, const LLVector4 &vec)  {  	LLMatrix4	mat(angle, vec); diff --git a/indra/llmath/m4math.h b/indra/llmath/m4math.h index a77c5bc76d..bf60adb9b6 100644 --- a/indra/llmath/m4math.h +++ b/indra/llmath/m4math.h @@ -137,7 +137,6 @@ public:  	bool isIdentity() const;  	const LLMatrix4& setZero();						// Clears matrix to all zeros. -	const LLMatrix4& initRotation(const F32 angle, const F32 x, const F32 y, const F32 z);	// Calculate rotation matrix by rotating angle radians about (x, y, z)  	const LLMatrix4& initRotation(const F32 angle, const LLVector4 &axis);	// Calculate rotation matrix for rotating angle radians about vec  	const LLMatrix4& initRotation(const F32 roll, const F32 pitch, const F32 yaw);		// Calculate rotation matrix from Euler angles  	const LLMatrix4& initRotation(const LLQuaternion &q);			// Set with Quaternion and position @@ -148,10 +147,6 @@ public:  	// These operation create a matrix that will rotate and translate by the  	// specified amounts. -	const LLMatrix4& initRotTrans(const F32 angle, -								  const F32 rx, const F32 ry, const F32 rz, -								  const F32 px, const F32 py, const F32 pz); -  	const LLMatrix4& initRotTrans(const F32 angle, const LLVector3 &axis, const LLVector3 &translation);	 // Rotation from axis angle + translation  	const LLMatrix4& initRotTrans(const F32 roll, const F32 pitch, const F32 yaw, const LLVector4 &pos); // Rotation from Euler + translation  	const LLMatrix4& initRotTrans(const LLQuaternion &q, const LLVector4 &pos);	// Set with Quaternion and position @@ -211,7 +206,6 @@ public:  	// Rotate existing matrix  	// These are really, really, inefficient as implemented! - djs -	const LLMatrix4& rotate(const F32 angle, const F32 x, const F32 y, const F32 z); 		// Rotate matrix by rotating angle radians about (x, y, z)  	const LLMatrix4& rotate(const F32 angle, const LLVector4 &vec);		// Rotate matrix by rotating angle radians about vec  	const LLMatrix4& rotate(const F32 roll, const F32 pitch, const F32 yaw);		// Rotate matrix by Euler angles  	const LLMatrix4& rotate(const LLQuaternion &q);				// Rotate matrix by Quaternion diff --git a/indra/llmath/tests/m3math_test.cpp b/indra/llmath/tests/m3math_test.cpp index 1ca2b005d9..2a0fe76aa7 100644 --- a/indra/llmath/tests/m3math_test.cpp +++ b/indra/llmath/tests/m3math_test.cpp @@ -77,7 +77,7 @@ namespace tut  	template<> template<>  	void m3math_test_object_t::test<2>()  	{ -		LLMatrix3 llmat3_obj(30, 1, 2, 3); +		LLMatrix3 llmat3_obj;  		llmat3_obj.setZero();  		ensure("LLMatrix3::setZero failed", 0.f == llmat3_obj.setZero().mMatrix[0][0] && diff --git a/indra/llmath/v3color.h b/indra/llmath/v3color.h index daf3a6857b..41dbdb8cd5 100644 --- a/indra/llmath/v3color.h +++ b/indra/llmath/v3color.h @@ -100,6 +100,23 @@ public:  	const LLColor3&	operator=(const LLColor4 &a); +    LL_FORCE_INLINE LLColor3 divide(const LLColor3 &col2)
 +    {
 +        return LLColor3(
 +                mV[0] / col2.mV[0],
 +                mV[1] / col2.mV[1],
 +                mV[2] / col2.mV[2] );
 +    }
 +
 +    LL_FORCE_INLINE LLColor3 color_norm()
 +    {
 +        F32 l = length();
 +        return LLColor3(
 +                mV[0] / l,
 +                mV[1] / l,
 +                mV[2] / l );
 +    }
 +  	friend std::ostream&	 operator<<(std::ostream& s, const LLColor3 &a);		// Print a  	friend LLColor3 operator+(const LLColor3 &a, const LLColor3 &b);	// Return vector a + b  	friend LLColor3 operator-(const LLColor3 &a, const LLColor3 &b);	// Return vector a minus b | 
