diff options
Diffstat (limited to 'indra/llmath')
| -rwxr-xr-x | indra/llmath/llcalc.cpp | 6 | ||||
| -rwxr-xr-x | indra/llmath/llcalcparser.h | 5 | ||||
| -rwxr-xr-x | indra/llmath/llcamera.cpp | 66 | ||||
| -rwxr-xr-x | indra/llmath/llcamera.h | 10 | ||||
| -rwxr-xr-x | indra/llmath/llcoordframe.cpp | 54 | ||||
| -rwxr-xr-x | indra/llmath/llline.cpp | 4 | ||||
| -rwxr-xr-x | indra/llmath/llmath.h | 9 | ||||
| -rwxr-xr-x | indra/llmath/lloctree.h | 34 | ||||
| -rwxr-xr-x | indra/llmath/llplane.h | 8 | ||||
| -rwxr-xr-x | indra/llmath/llvolume.cpp | 137 | ||||
| -rwxr-xr-x | indra/llmath/llvolume.h | 1 | ||||
| -rwxr-xr-x | indra/llmath/llvolumemgr.cpp | 14 | ||||
| -rwxr-xr-x | indra/llmath/llvolumeoctree.cpp | 6 | ||||
| -rwxr-xr-x | indra/llmath/llvolumeoctree.h | 4 | ||||
| -rwxr-xr-x | indra/llmath/v4color.cpp | 6 | ||||
| -rwxr-xr-x | indra/llmath/v4color.h | 4 | ||||
| -rwxr-xr-x | indra/llmath/xform.cpp | 4 | ||||
| -rwxr-xr-x | indra/llmath/xform.h | 4 | 
18 files changed, 225 insertions, 151 deletions
| diff --git a/indra/llmath/llcalc.cpp b/indra/llmath/llcalc.cpp index 1b2d609b67..edc6986cc9 100755 --- a/indra/llmath/llcalc.cpp +++ b/indra/llmath/llcalc.cpp @@ -141,20 +141,20 @@ bool LLCalc::evalString(const std::string& expression, F32& result)  	try  	{  		info = parse(start, expr_upper.end(), calc, space_p); -		lldebugs << "Math expression: " << expression << " = " << result << llendl; +		LL_DEBUGS() << "Math expression: " << expression << " = " << result << LL_ENDL;  	}  	catch(parser_error<std::string, std::string::iterator> &e)  	{  		mLastErrorPos = e.where - expr_upper.begin(); -		llinfos << "Calc parser exception: " << e.descriptor << " at " << mLastErrorPos << " in expression: " << expression << llendl; +		LL_INFOS() << "Calc parser exception: " << e.descriptor << " at " << mLastErrorPos << " in expression: " << expression << LL_ENDL;  		return false;  	}  	if (!info.full)  	{  		mLastErrorPos = info.stop - expr_upper.begin(); -		llinfos << "Unhandled syntax error at " << mLastErrorPos << " in expression: " << expression << llendl; +		LL_INFOS() << "Unhandled syntax error at " << mLastErrorPos << " in expression: " << expression << LL_ENDL;  		return false;  	} diff --git a/indra/llmath/llcalcparser.h b/indra/llmath/llcalcparser.h index e0ad270266..faa699ff7b 100755 --- a/indra/llmath/llcalcparser.h +++ b/indra/llmath/llcalcparser.h @@ -163,7 +163,7 @@ private:  	bool checkNaN(const F32& a) const { return !llisnan(a); } -	//FIX* non ambigious function fix making SIN() work for calc -Cryogenic Blitz +	//FIX* non ambiguous function fix making SIN() work for calc -Cryogenic Blitz  	F32 _sin(const F32& a) const { return sin(DEG_TO_RAD * a); }  	F32 _cos(const F32& a) const { return cos(DEG_TO_RAD * a); }  	F32 _tan(const F32& a) const { return tan(DEG_TO_RAD * a); } @@ -176,11 +176,8 @@ private:  	F32 _fabs(const F32& a) const { return fabs(a); }  	F32 _floor(const F32& a) const { return (F32)llfloor(a); }  	F32 _ceil(const F32& a) const { return llceil(a); } -  	F32 _atan2(const F32& a,const F32& b) const { return atan2(a,b); } - -  	LLCalc::calc_map_t* mConstants;  	LLCalc::calc_map_t* mVariables;  //	LLCalc::calc_map_t* mUserVariables; diff --git a/indra/llmath/llcamera.cpp b/indra/llmath/llcamera.cpp index 33cf185196..4d1ee15661 100755 --- a/indra/llmath/llcamera.cpp +++ b/indra/llmath/llcamera.cpp @@ -183,8 +183,30 @@ static	const LLVector4a sFrustumScaler[] =  	LLVector4a( 1, 1, 1)		// 8 entries  }; -S32 LLCamera::AABBInFrustum(const LLVector4a ¢er, const LLVector4a& radius)  +bool LLCamera::isChanged()  { +	bool changed = false; +	for (U32 i = 0; i < mPlaneCount; i++) +	{ +		U8 mask = mPlaneMask[i]; +		if (mask != 0xff && !changed) +		{ +			changed = !mAgentPlanes[i].equal(mLastAgentPlanes[i]); +		} +		mLastAgentPlanes[i].set(mAgentPlanes[i]); +	} + +	return changed; +} + +S32 LLCamera::AABBInFrustum(const LLVector4a ¢er, const LLVector4a& radius, const LLPlane* planes)  +{ +	if(!planes) +	{ +		//use agent space +		planes = mAgentPlanes; +	} +  	U8 mask = 0;  	bool result = false;  	LLVector4a rscale, maxp, minp; @@ -195,7 +217,7 @@ S32 LLCamera::AABBInFrustum(const LLVector4a ¢er, const LLVector4a& radius)  		mask = mPlaneMask[i];  		if (mask < PLANE_MASK_NUM)  		{ -			const LLPlane& p(mAgentPlanes[i]); +			const LLPlane& p(planes[i]);  			p.getAt<3>(d);  			rscale.setMul(radius, sFrustumScaler[mask]);  			minp.setSub(center, rscale); @@ -216,9 +238,21 @@ S32 LLCamera::AABBInFrustum(const LLVector4a ¢er, const LLVector4a& radius)  	return result?1:2;  } +//exactly same as the function AABBInFrustum(...) +//except uses mRegionPlanes instead of mAgentPlanes. +S32 LLCamera::AABBInRegionFrustum(const LLVector4a& center, const LLVector4a& radius)  +{ +	return AABBInFrustum(center, radius, mRegionPlanes); +} -S32 LLCamera::AABBInFrustumNoFarClip(const LLVector4a& center, const LLVector4a& radius)  +S32 LLCamera::AABBInFrustumNoFarClip(const LLVector4a& center, const LLVector4a& radius, const LLPlane* planes)   { +	if(!planes) +	{ +		//use agent space +		planes = mAgentPlanes; +	} +  	U8 mask = 0;  	bool result = false;  	LLVector4a rscale, maxp, minp; @@ -229,7 +263,7 @@ S32 LLCamera::AABBInFrustumNoFarClip(const LLVector4a& center, const LLVector4a&  		mask = mPlaneMask[i];  		if ((i != 5) && (mask < PLANE_MASK_NUM))  		{ -			const LLPlane& p(mAgentPlanes[i]); +			const LLPlane& p(planes[i]);  			p.getAt<3>(d);  			rscale.setMul(radius, sFrustumScaler[mask]);  			minp.setSub(center, rscale); @@ -250,6 +284,13 @@ S32 LLCamera::AABBInFrustumNoFarClip(const LLVector4a& center, const LLVector4a&  	return result?1:2;  } +//exactly same as the function AABBInFrustumNoFarClip(...) +//except uses mRegionPlanes instead of mAgentPlanes. +S32 LLCamera::AABBInRegionFrustumNoFarClip(const LLVector4a& center, const LLVector4a& radius)  +{ +	return AABBInFrustumNoFarClip(center, radius, mRegionPlanes); +} +  int LLCamera::sphereInFrustumQuick(const LLVector3 &sphere_center, const F32 radius)   {  	LLVector3 dist = sphere_center-mFrustCenter; @@ -586,6 +627,23 @@ void LLCamera::calcAgentFrustumPlanes(LLVector3* frust)  	}  } +//calculate regional planes from mAgentPlanes. +//vector "shift" is the vector of the region origin in the agent space. +void LLCamera::calcRegionFrustumPlanes(const LLVector3& shift)  +{ +	F32 d; +	LLVector3 n; +	for(S32 i = 0 ; i < 7; i++) +	{ +		if (mPlaneMask[i] != 0xff) +		{ +			n.setVec(mAgentPlanes[i][0], mAgentPlanes[i][1], mAgentPlanes[i][2]); +			d = mAgentPlanes[i][3] + n * shift; +			mRegionPlanes[i].setVec(n, d); +		} +	} +} +  void LLCamera::calculateFrustumPlanes(F32 left, F32 right, F32 top, F32 bottom)  {  	LLVector3 a, b, c; diff --git a/indra/llmath/llcamera.h b/indra/llmath/llcamera.h index 1283cfb16b..946f9f8d84 100755 --- a/indra/llmath/llcamera.h +++ b/indra/llmath/llcamera.h @@ -122,6 +122,8 @@ public:  private:  	LL_ALIGN_16(LLPlane mAgentPlanes[AGENT_PLANE_USER_CLIP_NUM]);  //frustum planes in agent space a la gluUnproject (I'm a bastard, I know) - DaveP +	LL_ALIGN_16(LLPlane mRegionPlanes[AGENT_PLANE_USER_CLIP_NUM]);  //frustum planes in a local region space, derived from mAgentPlanes +	LL_ALIGN_16(LLPlane mLastAgentPlanes[AGENT_PLANE_USER_CLIP_NUM]);  	U8 mPlaneMask[PLANE_MASK_NUM];         // 8 for alignment	  	F32 mView;					// angle between top and bottom frustum planes in radians. @@ -150,6 +152,7 @@ public:  	LLCamera(F32 vertical_fov_rads, F32 aspect_ratio, S32 view_height_in_pixels, F32 near_plane, F32 far_plane);  	virtual ~LLCamera(); +	bool isChanged(); //check if mAgentPlanes changed since last frame.  	void setUserClipPlane(LLPlane& plane);  	void disableUserClipPlane(); @@ -191,6 +194,7 @@ public:  	// Return number of bytes copied.  	size_t readFrustumFromBuffer(const char *buffer);  	void calcAgentFrustumPlanes(LLVector3* frust); +	void calcRegionFrustumPlanes(const LLVector3& shift); //calculate regional planes from mAgentPlanes.  	void ignoreAgentFrustumPlane(S32 idx);  	// Returns 1 if partly in, 2 if fully in. @@ -199,8 +203,10 @@ public:  	S32 sphereInFrustum(const LLVector3 ¢er, const F32 radius) const;  	S32 pointInFrustum(const LLVector3 &point) const { return sphereInFrustum(point, 0.0f); }  	S32 sphereInFrustumFull(const LLVector3 ¢er, const F32 radius) const { return sphereInFrustum(center, radius); } -	S32 AABBInFrustum(const LLVector4a& center, const LLVector4a& radius); -	S32 AABBInFrustumNoFarClip(const LLVector4a& center, const LLVector4a& radius); +	S32 AABBInFrustum(const LLVector4a& center, const LLVector4a& radius, const LLPlane* planes = NULL); +	S32 AABBInRegionFrustum(const LLVector4a& center, const LLVector4a& radius); +	S32 AABBInFrustumNoFarClip(const LLVector4a& center, const LLVector4a& radius, const LLPlane* planes = NULL); +	S32 AABBInRegionFrustumNoFarClip(const LLVector4a& center, const LLVector4a& radius);  	//does a quick 'n dirty sphere-sphere check  	S32 sphereInFrustumQuick(const LLVector3 &sphere_center, const F32 radius);  diff --git a/indra/llmath/llcoordframe.cpp b/indra/llmath/llcoordframe.cpp index 7dd8e43185..1bf51ca0eb 100755 --- a/indra/llmath/llcoordframe.cpp +++ b/indra/llmath/llcoordframe.cpp @@ -59,7 +59,7 @@ LLCoordFrame::LLCoordFrame(const LLVector3 &origin) :  	if( !mOrigin.isFinite() )  	{  		reset(); -		llwarns << "Non Finite in LLCoordFrame::LLCoordFrame()" << llendl; +		LL_WARNS() << "Non Finite in LLCoordFrame::LLCoordFrame()" << LL_ENDL;  	}  } @@ -71,7 +71,7 @@ LLCoordFrame::LLCoordFrame(const LLVector3 &origin, const LLVector3 &direction)  	if( !isFinite() )  	{  		reset(); -		llwarns << "Non Finite in LLCoordFrame::LLCoordFrame()" << llendl; +		LL_WARNS() << "Non Finite in LLCoordFrame::LLCoordFrame()" << LL_ENDL;  	}  } @@ -86,7 +86,7 @@ LLCoordFrame::LLCoordFrame(const LLVector3 &x_axis,  	if( !isFinite() )  	{  		reset(); -		llwarns << "Non Finite in LLCoordFrame::LLCoordFrame()" << llendl; +		LL_WARNS() << "Non Finite in LLCoordFrame::LLCoordFrame()" << LL_ENDL;  	}  } @@ -102,7 +102,7 @@ LLCoordFrame::LLCoordFrame(const LLVector3 &origin,  	if( !isFinite() )  	{  		reset(); -		llwarns << "Non Finite in LLCoordFrame::LLCoordFrame()" << llendl; +		LL_WARNS() << "Non Finite in LLCoordFrame::LLCoordFrame()" << LL_ENDL;  	}  } @@ -117,7 +117,7 @@ LLCoordFrame::LLCoordFrame(const LLVector3 &origin,  	if( !isFinite() )  	{  		reset(); -		llwarns << "Non Finite in LLCoordFrame::LLCoordFrame()" << llendl; +		LL_WARNS() << "Non Finite in LLCoordFrame::LLCoordFrame()" << LL_ENDL;  	}  } @@ -132,7 +132,7 @@ LLCoordFrame::LLCoordFrame(const LLQuaternion &q) :  	if( !isFinite() )  	{  		reset(); -		llwarns << "Non Finite in LLCoordFrame::LLCoordFrame()" << llendl; +		LL_WARNS() << "Non Finite in LLCoordFrame::LLCoordFrame()" << LL_ENDL;  	}  } @@ -147,7 +147,7 @@ LLCoordFrame::LLCoordFrame(const LLVector3 &origin, const LLQuaternion &q) :  	if( !isFinite() )  	{  		reset(); -		llwarns << "Non Finite in LLCoordFrame::LLCoordFrame()" << llendl; +		LL_WARNS() << "Non Finite in LLCoordFrame::LLCoordFrame()" << LL_ENDL;  	}  } @@ -160,7 +160,7 @@ LLCoordFrame::LLCoordFrame(const LLMatrix4 &mat) :  	if( !isFinite() )  	{  		reset(); -		llwarns << "Non Finite in LLCoordFrame::LLCoordFrame()" << llendl; +		LL_WARNS() << "Non Finite in LLCoordFrame::LLCoordFrame()" << LL_ENDL;  	}  } @@ -176,7 +176,7 @@ LLCoordFrame::LLCoordFrame(const F32 *origin, const F32 *rotation) :  	if( !isFinite() )  	{  		reset(); -		llwarns << "Non Finite in LLCoordFrame::LLCoordFrame()" << llendl; +		LL_WARNS() << "Non Finite in LLCoordFrame::LLCoordFrame()" << LL_ENDL;  	}  }  */ @@ -191,7 +191,7 @@ LLCoordFrame::LLCoordFrame(const F32 *origin_and_rotation) :  	if( !isFinite() )  	{  		reset(); -		llwarns << "Non Finite in LLCoordFrame::LLCoordFrame()" << llendl; +		LL_WARNS() << "Non Finite in LLCoordFrame::LLCoordFrame()" << LL_ENDL;  	}  }  */ @@ -220,7 +220,7 @@ void LLCoordFrame::setOrigin(F32 x, F32 y, F32 z)  	if( !mOrigin.isFinite() )  	{  		reset(); -		llwarns << "Non Finite in LLCoordFrame::setOrigin()" << llendl; +		LL_WARNS() << "Non Finite in LLCoordFrame::setOrigin()" << LL_ENDL;  	}  } @@ -230,7 +230,7 @@ void LLCoordFrame::setOrigin(const LLVector3 &new_origin)  	if( !mOrigin.isFinite() )  	{  		reset(); -		llwarns << "Non Finite in LLCoordFrame::setOrigin()" << llendl; +		LL_WARNS() << "Non Finite in LLCoordFrame::setOrigin()" << LL_ENDL;  	}  } @@ -243,7 +243,7 @@ void LLCoordFrame::setOrigin(const F32 *origin)  	if( !mOrigin.isFinite() )  	{  		reset(); -		llwarns << "Non Finite in LLCoordFrame::setOrigin()" << llendl; +		LL_WARNS() << "Non Finite in LLCoordFrame::setOrigin()" << LL_ENDL;  	}  } @@ -254,7 +254,7 @@ void LLCoordFrame::setOrigin(const LLCoordFrame &frame)  	if( !mOrigin.isFinite() )  	{  		reset(); -		llwarns << "Non Finite in LLCoordFrame::setOrigin()" << llendl; +		LL_WARNS() << "Non Finite in LLCoordFrame::setOrigin()" << LL_ENDL;  	}  } @@ -271,7 +271,7 @@ void LLCoordFrame::setAxes(const LLVector3 &x_axis,  	if( !isFinite() )  	{  		reset(); -		llwarns << "Non Finite in LLCoordFrame::setAxes()" << llendl; +		LL_WARNS() << "Non Finite in LLCoordFrame::setAxes()" << LL_ENDL;  	}  } @@ -284,7 +284,7 @@ void LLCoordFrame::setAxes(const LLMatrix3 &rotation_matrix)  	if( !isFinite() )  	{  		reset(); -		llwarns << "Non Finite in LLCoordFrame::setAxes()" << llendl; +		LL_WARNS() << "Non Finite in LLCoordFrame::setAxes()" << LL_ENDL;  	}  } @@ -296,7 +296,7 @@ void LLCoordFrame::setAxes(const LLQuaternion &q )  	if( !isFinite() )  	{  		reset(); -		llwarns << "Non Finite in LLCoordFrame::setAxes()" << llendl; +		LL_WARNS() << "Non Finite in LLCoordFrame::setAxes()" << LL_ENDL;  	}  } @@ -316,7 +316,7 @@ void LLCoordFrame::setAxes(  const F32 *rotation_matrix )  	if( !isFinite() )  	{  		reset(); -		llwarns << "Non Finite in LLCoordFrame::setAxes()" << llendl; +		LL_WARNS() << "Non Finite in LLCoordFrame::setAxes()" << LL_ENDL;  	}  } @@ -330,7 +330,7 @@ void LLCoordFrame::setAxes(const LLCoordFrame &frame)  	if( !isFinite() )  	{  		reset(); -		llwarns << "Non Finite in LLCoordFrame::setAxes()" << llendl; +		LL_WARNS() << "Non Finite in LLCoordFrame::setAxes()" << LL_ENDL;  	}  } @@ -346,7 +346,7 @@ void LLCoordFrame::translate(F32 x, F32 y, F32 z)  	if( !mOrigin.isFinite() )  	{  		reset(); -		llwarns << "Non Finite in LLCoordFrame::translate()" << llendl; +		LL_WARNS() << "Non Finite in LLCoordFrame::translate()" << LL_ENDL;  	}  } @@ -358,7 +358,7 @@ void LLCoordFrame::translate(const LLVector3 &v)  	if( !mOrigin.isFinite() )  	{  		reset(); -		llwarns << "Non Finite in LLCoordFrame::translate()" << llendl; +		LL_WARNS() << "Non Finite in LLCoordFrame::translate()" << LL_ENDL;  	}  } @@ -372,7 +372,7 @@ void LLCoordFrame::translate(const F32 *origin)  	if( !mOrigin.isFinite() )  	{  		reset(); -		llwarns << "Non Finite in LLCoordFrame::translate()" << llendl; +		LL_WARNS() << "Non Finite in LLCoordFrame::translate()" << LL_ENDL;  	}  } @@ -409,7 +409,7 @@ void LLCoordFrame::rotate(const LLMatrix3 &rotation_matrix)  	if( !isFinite() )  	{  		reset(); -		llwarns << "Non Finite in LLCoordFrame::rotate()" << llendl; +		LL_WARNS() << "Non Finite in LLCoordFrame::rotate()" << LL_ENDL;  	}  } @@ -423,7 +423,7 @@ void LLCoordFrame::roll(F32 angle)  	if( !mYAxis.isFinite() || !mZAxis.isFinite() )  	{  		reset(); -		llwarns << "Non Finite in LLCoordFrame::roll()" << llendl; +		LL_WARNS() << "Non Finite in LLCoordFrame::roll()" << LL_ENDL;  	}  } @@ -436,7 +436,7 @@ void LLCoordFrame::pitch(F32 angle)  	if( !mXAxis.isFinite() || !mZAxis.isFinite() )  	{  		reset(); -		llwarns << "Non Finite in LLCoordFrame::pitch()" << llendl; +		LL_WARNS() << "Non Finite in LLCoordFrame::pitch()" << LL_ENDL;  	}  } @@ -449,7 +449,7 @@ void LLCoordFrame::yaw(F32 angle)  	if( !mXAxis.isFinite() || !mYAxis.isFinite() )  	{  		reset(); -		llwarns << "Non Finite in LLCoordFrame::yaw()" << llendl; +		LL_WARNS() << "Non Finite in LLCoordFrame::yaw()" << LL_ENDL;  	}  } @@ -509,7 +509,7 @@ size_t LLCoordFrame::readOrientation(const char *buffer)  	if( !isFinite() )  	{  		reset(); -		llwarns << "Non Finite in LLCoordFrame::readOrientation()" << llendl; +		LL_WARNS() << "Non Finite in LLCoordFrame::readOrientation()" << LL_ENDL;  	}  	return 12*sizeof(F32); diff --git a/indra/llmath/llline.cpp b/indra/llmath/llline.cpp index ef10d1e7fa..f26231840b 100755 --- a/indra/llmath/llline.cpp +++ b/indra/llmath/llline.cpp @@ -82,10 +82,10 @@ LLVector3 LLLine::nearestApproach( const LLLine& other_line ) const  	if ( one_minus_dir_dot_dir < SOME_VERY_SMALL_NUMBER )  	{  #ifdef LL_DEBUG -		llwarns << "LLLine::nearestApproach() was given two very " +		LL_WARNS() << "LLLine::nearestApproach() was given two very "  			<< "nearly parallel lines dir1 = " << mDirection   			<< " dir2 = " << other_line.mDirection << " with 1-dot_product = "  -			<< one_minus_dir_dot_dir << llendl; +			<< one_minus_dir_dot_dir << LL_ENDL;  #endif  		// the lines are approximately parallel  		// We shouldn't fall in here because this check should have been made diff --git a/indra/llmath/llmath.h b/indra/llmath/llmath.h index b93f89d674..29db799154 100755 --- a/indra/llmath/llmath.h +++ b/indra/llmath/llmath.h @@ -30,6 +30,7 @@  #include <cmath>  #include <cstdlib>  #include <vector> +#include <limits>  #include "lldefs.h"  //#include "llstl.h" // *TODO: Remove when LLString is gone  //#include "llstring.h" // *TODO: Remove when LLString is gone @@ -75,6 +76,8 @@ const F32	OO_SQRT2	= 0.7071067811865475244008443621049f;  const F32	DEG_TO_RAD	= 0.017453292519943295769236907684886f;  const F32	RAD_TO_DEG	= 57.295779513082320876798154814105f;  const F32	F_APPROXIMATELY_ZERO = 0.00001f; +const F32	F_LN10		= 2.3025850929940456840179914546844f; +const F32	OO_LN10		= 0.43429448190325182765112891891661;  const F32	F_LN2		= 0.69314718056f;  const F32	OO_LN2		= 1.4426950408889634073599246810019f; @@ -111,6 +114,12 @@ inline bool is_approx_zero( F32 f ) { return (-F_APPROXIMATELY_ZERO < f) && (f <  // WARNING: Infinity is comparable with F32_MAX and negative   // infinity is comparable with F32_MIN +// handles negative and positive zeros +inline bool is_zero(F32 x) +{ +	return (*(U32*)(&x) & 0x7fffffff) == 0; +} +  inline bool is_approx_equal(F32 x, F32 y)  {  	const S32 COMPARE_MANTISSA_UP_TO_BIT = 0x02; diff --git a/indra/llmath/lloctree.h b/indra/llmath/lloctree.h index 7348904c61..02220c41d8 100755 --- a/indra/llmath/lloctree.h +++ b/indra/llmath/lloctree.h @@ -265,12 +265,12 @@ public:  				if (child->getOctant() != i)  				{ -					llerrs << "Invalid child map, bad octant data." << llendl; +					LL_ERRS() << "Invalid child map, bad octant data." << LL_ENDL;  				}  				if (getOctant(child->getCenter()) != child->getOctant())  				{ -					llerrs << "Invalid child octant compared to position data." << llendl; +					LL_ERRS() << "Invalid child octant compared to position data." << LL_ENDL;  				}  			}  		} @@ -311,7 +311,7 @@ public:  	{  		if (data == NULL || data->getBinIndex() != -1)  		{ -			OCT_ERRS << "!!! INVALID ELEMENT ADDED TO OCTREE BRANCH !!!" << llendl; +			OCT_ERRS << "!!! INVALID ELEMENT ADDED TO OCTREE BRANCH !!!" << LL_ENDL;  			return false;  		}  		LLOctreeNode<T>* parent = getOctParent(); @@ -374,7 +374,7 @@ public:  				if (getChildCount() == 8)  				{  					//this really isn't possible, something bad has happened -					OCT_ERRS << "Octree detected floating point error and gave up." << llendl; +					OCT_ERRS << "Octree detected floating point error and gave up." << LL_ENDL;  					return false;  				} @@ -383,7 +383,7 @@ public:  				{  					if (mChild[i]->getCenter().equals3(center))  					{ -						OCT_ERRS << "Octree detected duplicate child center and gave up." << llendl; +						OCT_ERRS << "Octree detected duplicate child center and gave up." << LL_ENDL;  						return false;  					}  				} @@ -399,7 +399,7 @@ public:  		else   		{  			//it's not in here, give it to the root -			OCT_ERRS << "Octree insertion failed, starting over from root!" << llendl; +			OCT_ERRS << "Octree insertion failed, starting over from root!" << LL_ENDL;  			oct_node* node = this; @@ -483,7 +483,7 @@ public:  		}  		//node is now root -		llwarns << "!!! OCTREE REMOVING ELEMENT BY ADDRESS, SEVERE PERFORMANCE PENALTY |||" << llendl; +		LL_WARNS() << "!!! OCTREE REMOVING ELEMENT BY ADDRESS, SEVERE PERFORMANCE PENALTY |||" << LL_ENDL;  		node->removeByAddress(data);  		llassert(data->getBinIndex() == -1);  		return true; @@ -496,7 +496,7 @@ public:  			if (mData[i] == data)  			{ //we have data  				_remove(data, i); -				llwarns << "FOUND!" << llendl; +				LL_WARNS() << "FOUND!" << LL_ENDL;  				return;  			}  		} @@ -524,7 +524,7 @@ public:  			mChild[i]->validate();  			if (mChild[i]->getParent() != this)  			{ -				llerrs << "Octree child has invalid parent." << llendl; +				LL_ERRS() << "Octree child has invalid parent." << LL_ENDL;  			}  		}  #endif @@ -550,24 +550,24 @@ public:  		if (child->getSize().equals3(getSize()))  		{ -			OCT_ERRS << "Child size is same as parent size!" << llendl; +			OCT_ERRS << "Child size is same as parent size!" << LL_ENDL;  		}  		for (U32 i = 0; i < getChildCount(); i++)  		{  			if(!mChild[i]->getSize().equals3(child->getSize()))   			{ -				OCT_ERRS <<"Invalid octree child size." << llendl; +				OCT_ERRS <<"Invalid octree child size." << LL_ENDL;  			}  			if (mChild[i]->getCenter().equals3(child->getCenter()))  			{ -				OCT_ERRS <<"Duplicate octree child position." << llendl; +				OCT_ERRS <<"Duplicate octree child position." << LL_ENDL;  			}  		}  		if (mChild.size() >= 8)  		{ -			OCT_ERRS <<"Octree node has too many children... why?" << llendl; +			OCT_ERRS <<"Octree node has too many children... why?" << LL_ENDL;  		}  #endif @@ -641,7 +641,7 @@ public:  			}  		} -		OCT_ERRS << "Octree failed to delete requested child." << llendl; +		OCT_ERRS << "Octree failed to delete requested child." << LL_ENDL;  	}  protected:	 @@ -724,13 +724,13 @@ public:  	{  		if (data == NULL)   		{ -			OCT_ERRS << "!!! INVALID ELEMENT ADDED TO OCTREE ROOT !!!" << llendl; +			OCT_ERRS << "!!! INVALID ELEMENT ADDED TO OCTREE ROOT !!!" << LL_ENDL;  			return false;  		}  		if (data->getBinRadius() > 4096.0)  		{ -			OCT_ERRS << "!!! ELEMENT EXCEEDS MAXIMUM SIZE IN OCTREE ROOT !!!" << llendl; +			OCT_ERRS << "!!! ELEMENT EXCEEDS MAXIMUM SIZE IN OCTREE ROOT !!!" << LL_ENDL;  			return false;  		} @@ -746,7 +746,7 @@ public:  		if (lt != 0x7)  		{ -			//OCT_ERRS << "!!! ELEMENT EXCEEDS RANGE OF SPATIAL PARTITION !!!" << llendl; +			//OCT_ERRS << "!!! ELEMENT EXCEEDS RANGE OF SPATIAL PARTITION !!!" << LL_ENDL;  			return false;  		} diff --git a/indra/llmath/llplane.h b/indra/llmath/llplane.h index 3c32441b11..64a3eed0e5 100755 --- a/indra/llmath/llplane.h +++ b/indra/llmath/llplane.h @@ -93,7 +93,13 @@ public:  	{   		return mV.greaterEqual(LLVector4a::getZero()).getGatheredBits() & LLVector4Logical::MASK_XYZ;  	} -		 +	 +	//check if two planes are nearly same +	bool equal(const LLPlane& p) const +	{ +		return mV.equals4(p.mV); +	} +  private:  	LLVector4a mV;  } LL_ALIGN_POSTFIX(16); diff --git a/indra/llmath/llvolume.cpp b/indra/llmath/llvolume.cpp index 14cebfe5aa..640e916b4b 100755 --- a/indra/llmath/llvolume.cpp +++ b/indra/llmath/llvolume.cpp @@ -44,7 +44,6 @@  #include "m3math.h"  #include "llmatrix3a.h"  #include "lloctree.h" -#include "lldarray.h"  #include "llvolume.h"  #include "llvolumeoctree.h"  #include "llstl.h" @@ -350,7 +349,7 @@ public:  		}  		else  		{ -			llerrs << "Empty leaf" << llendl; +			LL_ERRS() << "Empty leaf" << LL_ENDL;  		}  		for (S32 i = 0; i < branch->getChildCount(); ++i) @@ -840,7 +839,7 @@ BOOL LLProfile::generate(const LLProfileParams& params, BOOL path_open,F32 detai  	if (detail < MIN_LOD)  	{ -		llinfos << "Generating profile with LOD < MIN_LOD.  CLAMPING" << llendl; +		LL_INFOS() << "Generating profile with LOD < MIN_LOD.  CLAMPING" << LL_ENDL;  		detail = MIN_LOD;  	} @@ -856,7 +855,7 @@ BOOL LLProfile::generate(const LLProfileParams& params, BOOL path_open,F32 detai  	// Quick validation to eliminate some server crashes.  	if (begin > end - 0.01f)  	{ -		llwarns << "LLProfile::generate() assertion failed (begin >= end)" << llendl; +		LL_WARNS() << "LLProfile::generate() assertion failed (begin >= end)" << LL_ENDL;  		return FALSE;  	} @@ -1072,7 +1071,7 @@ BOOL LLProfile::generate(const LLProfileParams& params, BOOL path_open,F32 detai  		}  		break;  	default: -	    llerrs << "Unknown profile: getCurveType()=" << params.getCurveType() << llendl; +	    LL_ERRS() << "Unknown profile: getCurveType()=" << params.getCurveType() << LL_ENDL;  		break;  	}; @@ -1156,7 +1155,7 @@ BOOL LLProfileParams::importFile(LLFILE *fp)  		}  		else  		{ -			llwarns << "unknown keyword " << keyword << " in profile import" << llendl; +			LL_WARNS() << "unknown keyword " << keyword << " in profile import" << LL_ENDL;  		}  	} @@ -1228,7 +1227,7 @@ BOOL LLProfileParams::importLegacyStream(std::istream& input_stream)  		}  		else  		{ - 		llwarns << "unknown keyword " << keyword << " in profile import" << llendl; + 		LL_WARNS() << "unknown keyword " << keyword << " in profile import" << LL_ENDL;  		}  	} @@ -1392,7 +1391,7 @@ void LLPath::genNGon(const LLPathParams& params, S32 sides, F32 startOff, F32 en  	pt->mScale.mV[VX] = hole_x * lerp(taper_x_begin, taper_x_end, t);  	pt->mScale.mV[VY] = hole_y * lerp(taper_y_begin, taper_y_end, t);  	pt->mTexT  = t; - +	  	// Twist rotates the path along the x,y plane (I think) - DJS 04/05/02  	twist.setQuat  (lerp(twist_begin,twist_end,t) * 2.f * F_PI - F_PI,0,0,1);  	// Rotate the point around the circle's center. @@ -1446,7 +1445,7 @@ void LLPath::genNGon(const LLPathParams& params, S32 sides, F32 startOff, F32 en  	pt->mScale.mV[VX] = hole_x * lerp(taper_x_begin, taper_x_end, t);  	pt->mScale.mV[VY] = hole_y * lerp(taper_y_begin, taper_y_end, t);  	pt->mTexT  = t; - +	  	// Twist rotates the path along the x,y plane (I think) - DJS 04/05/02  	twist.setQuat  (lerp(twist_begin,twist_end,t) * 2.f * F_PI - F_PI,0,0,1);  	// Rotate the point around the circle's center. @@ -1542,7 +1541,7 @@ BOOL LLPath::generate(const LLPathParams& params, F32 detail, S32 split,  	if (detail < MIN_LOD)  	{ -		llinfos << "Generating path with LOD < MIN!  Clamping to 1" << llendl; +		LL_INFOS() << "Generating path with LOD < MIN!  Clamping to 1" << LL_ENDL;  		detail = MIN_LOD;  	} @@ -1794,7 +1793,7 @@ BOOL LLPathParams::importFile(LLFILE *fp)  		}  		else  		{ -			llwarns << "unknown keyword " << " in path import" << llendl; +			LL_WARNS() << "unknown keyword " << " in path import" << LL_ENDL;  		}  	}  	return TRUE; @@ -1934,7 +1933,7 @@ BOOL LLPathParams::importLegacyStream(std::istream& input_stream)  		}  		else  		{ -			llwarns << "unknown keyword " << " in path import" << llendl; +			LL_WARNS() << "unknown keyword " << " in path import" << LL_ENDL;  		}  	}  	return TRUE; @@ -2025,7 +2024,7 @@ LLProfile::~LLProfile()  {  	if(profile_delete_lock)  	{ -		llerrs << "LLProfile should not be deleted here!" << llendl ; +		LL_ERRS() << "LLProfile should not be deleted here!" << LL_ENDL ;  	}  } @@ -2146,13 +2145,13 @@ BOOL LLVolume::generate()  	//debug info, to be removed  	if((U32)(mPathp->mPath.size() * mProfilep->mProfile.size()) > (1u << 20))  	{ -		llinfos << "sizeS: " << mPathp->mPath.size() << " sizeT: " << mProfilep->mProfile.size() << llendl ; -		llinfos << "path_detail : " << path_detail << " split: " << split << " profile_detail: " << profile_detail << llendl ; -		llinfos << mParams << llendl ; -		llinfos << "more info to check if mProfilep is deleted or not." << llendl ; -		llinfos << mProfilep->mNormals.size() << " : " << mProfilep->mFaces.size() << " : " << mProfilep->mEdgeNormals.size() << " : " << mProfilep->mEdgeCenters.size() << llendl ; +		LL_INFOS() << "sizeS: " << mPathp->mPath.size() << " sizeT: " << mProfilep->mProfile.size() << LL_ENDL ; +		LL_INFOS() << "path_detail : " << path_detail << " split: " << split << " profile_detail: " << profile_detail << LL_ENDL ; +		LL_INFOS() << mParams << LL_ENDL ; +		LL_INFOS() << "more info to check if mProfilep is deleted or not." << LL_ENDL ; +		LL_INFOS() << mProfilep->mNormals.size() << " : " << mProfilep->mFaces.size() << " : " << mProfilep->mEdgeNormals.size() << " : " << mProfilep->mEdgeCenters.size() << LL_ENDL ; -		llerrs << "LLVolume corrupted!" << llendl ; +		LL_ERRS() << "LLVolume corrupted!" << LL_ENDL ;  	}  	//******************************************************************** @@ -2168,14 +2167,14 @@ BOOL LLVolume::generate()  		//debug info, to be removed  		if((U32)(sizeS * sizeT) > (1u << 20))  		{ -			llinfos << "regenPath: " << (S32)regenPath << " regenProf: " << (S32)regenProf << llendl ; -			llinfos << "sizeS: " << sizeS << " sizeT: " << sizeT << llendl ; -			llinfos << "path_detail : " << path_detail << " split: " << split << " profile_detail: " << profile_detail << llendl ; -			llinfos << mParams << llendl ; -			llinfos << "more info to check if mProfilep is deleted or not." << llendl ; -			llinfos << mProfilep->mNormals.size() << " : " << mProfilep->mFaces.size() << " : " << mProfilep->mEdgeNormals.size() << " : " << mProfilep->mEdgeCenters.size() << llendl ; +			LL_INFOS() << "regenPath: " << (S32)regenPath << " regenProf: " << (S32)regenProf << LL_ENDL ; +			LL_INFOS() << "sizeS: " << sizeS << " sizeT: " << sizeT << LL_ENDL ; +			LL_INFOS() << "path_detail : " << path_detail << " split: " << split << " profile_detail: " << profile_detail << LL_ENDL ; +			LL_INFOS() << mParams << LL_ENDL ; +			LL_INFOS() << "more info to check if mProfilep is deleted or not." << LL_ENDL ; +			LL_INFOS() << mProfilep->mNormals.size() << " : " << mProfilep->mFaces.size() << " : " << mProfilep->mEdgeNormals.size() << " : " << mProfilep->mEdgeCenters.size() << LL_ENDL ; -			llerrs << "LLVolume corrupted!" << llendl ; +			LL_ERRS() << "LLVolume corrupted!" << LL_ENDL ;  		}  		//******************************************************************** @@ -2369,7 +2368,7 @@ bool LLVolume::unpackVolumeFaces(std::istream& is, S32 size)  	LLSD mdl;  	if (!unzip_llsd(mdl, is, size))  	{ -		LL_DEBUGS("MeshStreaming") << "Failed to unzip LLSD blob for LoD, will probably fetch from sim again." << llendl; +		LL_DEBUGS("MeshStreaming") << "Failed to unzip LLSD blob for LoD, will probably fetch from sim again." << LL_ENDL;  		return false;  	} @@ -2378,7 +2377,7 @@ bool LLVolume::unpackVolumeFaces(std::istream& is, S32 size)  		if (face_count == 0)  		{ //no faces unpacked, treat as failed decode -			llwarns << "found no faces!" << llendl; +			LL_WARNS() << "found no faces!" << LL_ENDL;  			return false;  		} @@ -2411,7 +2410,7 @@ bool LLVolume::unpackVolumeFaces(std::istream& is, S32 size)  			if (idx.empty() || face.mNumIndices < 3)  			{ //why is there an empty index list? -				llwarns <<"Empty face present!" << llendl; +				LL_WARNS() <<"Empty face present!" << LL_ENDL;  				continue;  			} @@ -2558,7 +2557,7 @@ bool LLVolume::unpackVolumeFaces(std::istream& is, S32 size)  				if (cur_vertex != num_verts || idx != weights.size())  				{ -					llwarns << "Vertex weight count does not match vertex count!" << llendl; +					LL_WARNS() << "Vertex weight count does not match vertex count!" << LL_ENDL;  				}  			} @@ -2724,7 +2723,7 @@ void LLVolume::createVolumeFaces()  			vf.mNumS = face.mCount;  			if (vf.mNumS < 0)  			{ -				llerrs << "Volume face corruption detected." << llendl; +				LL_ERRS() << "Volume face corruption detected." << LL_ENDL;  			}  			vf.mBeginT = 0; @@ -2772,7 +2771,7 @@ void LLVolume::createVolumeFaces()  						vf.mNumS = vf.mNumS*2;  						if (vf.mNumS < 0)  						{ -							llerrs << "Volume face corruption detected." << llendl; +							LL_ERRS() << "Volume face corruption detected." << LL_ENDL;  						}  					}  				} @@ -3081,7 +3080,7 @@ void LLVolume::sculpt(U16 sculpt_width, U16 sculpt_height, S8 sculpt_components,  	// weird crash bug - DEV-11158 - trying to collect more data:  	if ((sizeS == 0) || (sizeT == 0))  	{ -		llwarns << "sculpt bad mesh size " << sizeS << " " << sizeT << llendl; +		LL_WARNS() << "sculpt bad mesh size " << sizeS << " " << sizeT << LL_ENDL;  	}  	sNumMeshPoints -= mMesh.size(); @@ -3476,16 +3475,16 @@ bool LLVolumeParams::setType(U8 profile, U8 path)  		// Bad profile.  Make it square.  		profile = LL_PCODE_PROFILE_SQUARE;  		result = false; -		llwarns << "LLVolumeParams::setType changing bad profile type (" << profile_type -			 	<< ") to be LL_PCODE_PROFILE_SQUARE" << llendl; +		LL_WARNS() << "LLVolumeParams::setType changing bad profile type (" << profile_type +			 	<< ") to be LL_PCODE_PROFILE_SQUARE" << LL_ENDL;  	}  	else if (hole_type > LL_PCODE_HOLE_MAX)  	{  		// Bad hole.  Make it the same.  		profile = profile_type;  		result = false; -		llwarns << "LLVolumeParams::setType changing bad hole type (" << hole_type -			 	<< ") to be LL_PCODE_HOLE_SAME" << llendl; +		LL_WARNS() << "LLVolumeParams::setType changing bad hole type (" << hole_type +			 	<< ") to be LL_PCODE_HOLE_SAME" << LL_ENDL;  	}  	if (path_type < LL_PCODE_PATH_MIN || @@ -3493,8 +3492,8 @@ bool LLVolumeParams::setType(U8 profile, U8 path)  	{  		// Bad path.  Make it linear.  		result = false; -		llwarns << "LLVolumeParams::setType changing bad path (" << path -			 	<< ") to be LL_PCODE_PATH_LINE" << llendl; +		LL_WARNS() << "LLVolumeParams::setType changing bad path (" << path +			 	<< ") to be LL_PCODE_PATH_LINE" << LL_ENDL;  		path = LL_PCODE_PATH_LINE;  	} @@ -3568,7 +3567,7 @@ S32 *LLVolume::getTriangleIndices(U32 &num_indices) const  	if (expected_num_triangle_indices > MAX_VOLUME_TRIANGLE_INDICES)  	{  		// we don't allow LLVolumes with this many vertices -		llwarns << "Couldn't allocate triangle indices" << llendl; +		LL_WARNS() << "Couldn't allocate triangle indices" << LL_ENDL;  		num_indices = 0;  		return NULL;  	} @@ -4161,9 +4160,9 @@ S32 *LLVolume::getTriangleIndices(U32 &num_indices) const  	// assert that we computed the correct number of indices  	if (count != expected_num_triangle_indices )  	{ -		llerrs << "bad index count prediciton:" +		LL_ERRS() << "bad index count prediciton:"  			<< "  expected=" << expected_num_triangle_indices  -			<< " actual=" << count << llendl; +			<< " actual=" << count << LL_ENDL;  	}  #endif @@ -4172,7 +4171,7 @@ S32 *LLVolume::getTriangleIndices(U32 &num_indices) const  	S32 num_vertices = mMesh.size();  	for (i = 0; i < count; i+=3)  	{ -		llinfos << index[i] << ":" << index[i+1] << ":" << index[i+2] << llendl; +		LL_INFOS() << index[i] << ":" << index[i+1] << ":" << index[i+2] << LL_ENDL;  		llassert(index[i] < num_vertices);  		llassert(index[i+1] < num_vertices);  		llassert(index[i+2] < num_vertices); @@ -4615,7 +4614,7 @@ S32 LLVolume::lineSegmentIntersect(const LLVector4a& start, const LLVector4a& en  								n1.add(n2);  								n1.add(n3); -								 +  								*normal		= n1;   							} @@ -4764,7 +4763,7 @@ BOOL equalTriangle(const S32 *a, const S32 *b)  BOOL LLVolumeParams::importFile(LLFILE *fp)  { -	//llinfos << "importing volume" << llendl; +	//LL_INFOS() << "importing volume" << LL_ENDL;  	const S32 BUFSIZE = 16384;  	char buffer[BUFSIZE];	/* Flawfinder: ignore */  	// *NOTE: changing the size or type of this buffer will require @@ -4798,7 +4797,7 @@ BOOL LLVolumeParams::importFile(LLFILE *fp)  		}  		else  		{ -			llwarns << "unknown keyword " << keyword << " in volume import" << llendl; +			LL_WARNS() << "unknown keyword " << keyword << " in volume import" << LL_ENDL;  		}  	} @@ -4818,7 +4817,7 @@ BOOL LLVolumeParams::exportFile(LLFILE *fp) const  BOOL LLVolumeParams::importLegacyStream(std::istream& input_stream)  { -	//llinfos << "importing volume" << llendl; +	//LL_INFOS() << "importing volume" << LL_ENDL;  	const S32 BUFSIZE = 16384;  	// *NOTE: changing the size or type of this buffer will require  	// changing the sscanf below. @@ -4848,7 +4847,7 @@ BOOL LLVolumeParams::importLegacyStream(std::istream& input_stream)  		}  		else  		{ -			llwarns << "unknown keyword " << keyword << " in volume import" << llendl; +			LL_WARNS() << "unknown keyword " << keyword << " in volume import" << LL_ENDL;  		}  	} @@ -5060,7 +5059,7 @@ LLFaceID LLVolume::generateFaceMask()  		}  		break;  	default: -		llerrs << "Unknown profile!" << llendl; +		LL_ERRS() << "Unknown profile!" << LL_ENDL;  		break;  	} @@ -5354,7 +5353,7 @@ BOOL LLVolumeFace::create(LLVolume* volume, BOOL partial_build)  	}  	else  	{ -		llerrs << "Unknown/uninitialized face type!" << llendl; +		LL_ERRS() << "Unknown/uninitialized face type!" << LL_ENDL;  	}  	//update the range of the texture coordinates @@ -5961,7 +5960,7 @@ void LLVolumeFace::cacheOptimize()  	mTangents = binorm;  	//std::string result = llformat("ACMR pre/post: %.3f/%.3f  --  %d triangles %d breaks", pre_acmr, post_acmr, mNumIndices/3, breaks); -	//llinfos << result << llendl; +	//LL_INFOS() << result << LL_ENDL;  } @@ -6130,7 +6129,7 @@ BOOL LLVolumeFace::createUnCutCubeCap(LLVolume* volume, BOOL partial_build)  		S32 size = (grid_size+1)*(grid_size+1);  		resizeVertices(size); -		 +  		LLVector4a* pos = (LLVector4a*) mPositions;  		LLVector4a* norm = (LLVector4a*) mNormals;  		LLVector2* tc = (LLVector2*) mTexCoords; @@ -6151,7 +6150,7 @@ BOOL LLVolumeFace::createUnCutCubeCap(LLVolume* volume, BOOL partial_build)  				*pos++ = newVert.getPosition();  				*norm++ = baseVert.getNormal();  				*tc++ = newVert.mTexCoord; -				 +  				if (gx == 0 && gy == 0)  				{  					min = newVert.getPosition(); @@ -6227,7 +6226,7 @@ BOOL LLVolumeFace::createCap(LLVolume* volume, BOOL partial_build)  	if (!(mTypeMask & HOLLOW_MASK) && !(mTypeMask & OPEN_MASK))  	{  		resizeVertices(num_vertices+1); -		 +  		if (!partial_build)  		{  			resizeIndices(num_indices+3); @@ -6236,7 +6235,7 @@ BOOL LLVolumeFace::createCap(LLVolume* volume, BOOL partial_build)  	else  	{  		resizeVertices(num_vertices); -		 +  		if (!partial_build)  		{  			resizeIndices(num_indices); @@ -6270,7 +6269,7 @@ BOOL LLVolumeFace::createCap(LLVolume* volume, BOOL partial_build)  	LLVector2* tc = (LLVector2*) mTexCoords;  	LLVector4a* pos = (LLVector4a*) mPositions;  	LLVector4a* norm = (LLVector4a*) mNormals; -	 +  	// Copy the vertices into the array  	for (S32 i = 0; i < num_vertices; i++)  	{ @@ -6552,7 +6551,7 @@ BOOL LLVolumeFace::createCap(LLVolume* volume, BOOL partial_build)  	} - +		  	LLVector4a d0,d1;  	d0.setSub(mPositions[mIndices[1]], mPositions[mIndices[0]]); @@ -6562,13 +6561,13 @@ BOOL LLVolumeFace::createCap(LLVolume* volume, BOOL partial_build)  	normal.setCross3(d0,d1);  	if (normal.dot3(normal).getF32() > F_APPROXIMATELY_ZERO) -	{ +		{  		normal.normalize3fast();  	}  	else  	{ //degenerate, make up a value  		normal.set(0,0,1); -	} +		}  	llassert(llfinite(normal.getF32ptr()[0]));  	llassert(llfinite(normal.getF32ptr()[1])); @@ -6577,7 +6576,7 @@ BOOL LLVolumeFace::createCap(LLVolume* volume, BOOL partial_build)  	llassert(!llisnan(normal.getF32ptr()[0]));  	llassert(!llisnan(normal.getF32ptr()[1]));  	llassert(!llisnan(normal.getF32ptr()[2])); -	 +						  	for (S32 i = 0; i < num_vertices; i++)  	{  		norm[i].load4a(normal.getF32ptr()); @@ -6592,7 +6591,7 @@ void CalculateTangentArray(U32 vertexCount, const LLVector4a *vertex, const LLVe  void LLVolumeFace::createTangents()  {  	if (!mTangents) -	{ +			{  		allocateTangents(mNumVertices);  		//generate tangents @@ -6602,7 +6601,7 @@ void LLVolumeFace::createTangents()  		LLVector4a* end = mTangents+mNumVertices;  		while (binorm < end) -		{ +			{  			(*binorm++).clear();  		} @@ -6760,12 +6759,12 @@ void LLVolumeFace::appendFace(const LLVolumeFace& face, LLMatrix4& mat_in, LLMat  	if (new_count > 65536)  	{ -		llerrs << "Cannot append face -- 16-bit overflow will occur." << llendl; +		LL_ERRS() << "Cannot append face -- 16-bit overflow will occur." << LL_ENDL;  	}  	if (face.mNumVertices == 0)  	{ -		llerrs << "Cannot append empty face." << llendl; +		LL_ERRS() << "Cannot append empty face." << LL_ENDL;  	}  	//allocate new buffer space @@ -7221,7 +7220,7 @@ void CalculateTangentArray(U32 vertexCount, const LLVector4a *vertex, const LLVe  	memset(tan1, 0, vertexCount*2*sizeof(LLVector4a));      for (U32 a = 0; a < triangleCount; a++) -    { +{          U32 i1 = *index_array++;          U32 i2 = *index_array++;          U32 i3 = *index_array++; @@ -7265,7 +7264,7 @@ void CalculateTangentArray(U32 vertexCount, const LLVector4a *vertex, const LLVe  		tan1[i1].add(sdir);  		tan1[i2].add(sdir);  		tan1[i3].add(sdir); -         +	  		tan2[i1].add(tdir);  		tan2[i2].add(tdir);  		tan2[i3].add(tdir); @@ -7279,7 +7278,7 @@ void CalculateTangentArray(U32 vertexCount, const LLVector4a *vertex, const LLVe  		LLVector4a ncrosst;  		ncrosst.setCross3(n,t); - +		          // Gram-Schmidt orthogonalize          n.mul(n.dot3(t).getF32()); @@ -7287,7 +7286,7 @@ void CalculateTangentArray(U32 vertexCount, const LLVector4a *vertex, const LLVe  		tsubn.setSub(t,n);  		if (tsubn.dot3(tsubn).getF32() > F_APPROXIMATELY_ZERO) -		{ +	{  			tsubn.normalize3fast();  			// Calculate handedness @@ -7301,7 +7300,7 @@ void CalculateTangentArray(U32 vertexCount, const LLVector4a *vertex, const LLVe  		{ //degenerate, make up a value  			tangent[a].set(0,0,1,1);  		} -    } +	}  	ll_aligned_free_16(tan1);  } diff --git a/indra/llmath/llvolume.h b/indra/llmath/llvolume.h index 164b8d6652..a4291df7db 100755 --- a/indra/llmath/llvolume.h +++ b/indra/llmath/llvolume.h @@ -42,7 +42,6 @@ class LLVolumeFace;  class LLVolume;  class LLVolumeTriangle; -#include "lldarray.h"  #include "lluuid.h"  #include "v4color.h"  //#include "vmath.h" diff --git a/indra/llmath/llvolumemgr.cpp b/indra/llmath/llvolumemgr.cpp index 9083273ee5..3b8f08e0c6 100755 --- a/indra/llmath/llvolumemgr.cpp +++ b/indra/llmath/llvolumemgr.cpp @@ -147,7 +147,7 @@ void LLVolumeMgr::unrefVolume(LLVolume *volumep)  	volume_lod_group_map_t::iterator iter = mVolumeLODGroups.find(params);  	if( iter == mVolumeLODGroups.end() )  	{ -		llerrs << "Warning! Tried to cleanup unknown volume type! " << *params << llendl; +		LL_ERRS() << "Warning! Tried to cleanup unknown volume type! " << *params << LL_ENDL;  		if (mDataMutex)  		{  			mDataMutex->unlock(); @@ -207,7 +207,7 @@ void LLVolumeMgr::dump()  	{  		mDataMutex->unlock();  	} -	llinfos << "Average usage of LODs " << avg << llendl; +	LL_INFOS() << "Average usage of LODs " << avg << LL_ENDL;  }  void LLVolumeMgr::useMutex() @@ -270,18 +270,18 @@ bool LLVolumeLODGroup::cleanupRefs()  	bool res = true;  	if (mRefs != 0)  	{ -		llwarns << "Volume group has remaining refs:" << getNumRefs() << llendl; +		LL_WARNS() << "Volume group has remaining refs:" << getNumRefs() << LL_ENDL;  		mRefs = 0;  		for (S32 i = 0; i < NUM_LODS; i++)  		{  			if (mLODRefs[i] > 0)  			{ -				llwarns << " LOD " << i << " refs = " << mLODRefs[i] << llendl; +				LL_WARNS() << " LOD " << i << " refs = " << mLODRefs[i] << LL_ENDL;  				mLODRefs[i] = 0;  				mVolumeLODs[i] = NULL;  			}  		} -		llwarns << *getVolumeParams() << llendl; +		LL_WARNS() << *getVolumeParams() << LL_ENDL;  		res = false;  	}  	return res; @@ -320,7 +320,7 @@ BOOL LLVolumeLODGroup::derefLOD(LLVolume *volumep)  			return TRUE;  		}  	} -	llerrs << "Deref of non-matching LOD in volume LOD group" << llendl; +	LL_ERRS() << "Deref of non-matching LOD in volume LOD group" << LL_ENDL;  	return FALSE;  } @@ -393,7 +393,7 @@ F32 LLVolumeLODGroup::dump()  	std::string dump_str = llformat("%.3f %d %d %d %d", usage, mAccessCount[0], mAccessCount[1], mAccessCount[2], mAccessCount[3]); -	llinfos << dump_str << llendl; +	LL_INFOS() << dump_str << LL_ENDL;  	return usage;  } diff --git a/indra/llmath/llvolumeoctree.cpp b/indra/llmath/llvolumeoctree.cpp index 0728b49c1f..fb232d5f6c 100755 --- a/indra/llmath/llvolumeoctree.cpp +++ b/indra/llmath/llvolumeoctree.cpp @@ -237,7 +237,7 @@ void LLVolumeOctreeValidate::visit(const LLOctreeNode<LLVolumeTriangle>* branch)  	if (!test_min.equals3(min, 0.001f) ||  		!test_max.equals3(max, 0.001f))  	{ -		llerrs << "Bad bounding box data found." << llendl; +		LL_ERRS() << "Bad bounding box data found." << LL_ENDL;  	}  	test_min.sub(LLVector4a(0.001f)); @@ -251,7 +251,7 @@ void LLVolumeOctreeValidate::visit(const LLOctreeNode<LLVolumeTriangle>* branch)  		if (child->mExtents[0].lessThan(test_min).areAnySet(LLVector4Logical::MASK_XYZ) ||  			child->mExtents[1].greaterThan(test_max).areAnySet(LLVector4Logical::MASK_XYZ))  		{ -			llerrs << "Child protrudes from bounding box." << llendl; +			LL_ERRS() << "Child protrudes from bounding box." << LL_ENDL;  		}  	} @@ -267,7 +267,7 @@ void LLVolumeOctreeValidate::visit(const LLOctreeNode<LLVolumeTriangle>* branch)  			if (tri->mV[i]->greaterThan(test_max).areAnySet(LLVector4Logical::MASK_XYZ) ||  				tri->mV[i]->lessThan(test_min).areAnySet(LLVector4Logical::MASK_XYZ))  			{ -				llerrs << "Triangle protrudes from node." << llendl; +				LL_ERRS() << "Triangle protrudes from node." << LL_ENDL;  			}  		}  	} diff --git a/indra/llmath/llvolumeoctree.h b/indra/llmath/llvolumeoctree.h index 80d6ced36d..13150028d8 100755 --- a/indra/llmath/llvolumeoctree.h +++ b/indra/llmath/llvolumeoctree.h @@ -59,7 +59,7 @@ public:  	const LLVolumeTriangle& operator=(const LLVolumeTriangle& rhs)  	{ -		llerrs << "Illegal operation!" << llendl; +		LL_ERRS() << "Illegal operation!" << LL_ENDL;  		return *this;  	} @@ -110,7 +110,7 @@ public:  	const LLVolumeOctreeListener& operator=(const LLVolumeOctreeListener& rhs)  	{ -		llerrs << "Illegal operation!" << llendl; +		LL_ERRS() << "Illegal operation!" << LL_ENDL;  		return *this;  	} diff --git a/indra/llmath/v4color.cpp b/indra/llmath/v4color.cpp index 81ac62be56..cd2be7c8fd 100755 --- a/indra/llmath/v4color.cpp +++ b/indra/llmath/v4color.cpp @@ -245,7 +245,7 @@ void LLColor4::setValue(const LLSD& sd)  	if (out_of_range)  	{ -		llwarns << "LLSD color value out of range!" << llendl; +		LL_WARNS() << "LLSD color value out of range!" << LL_ENDL;  	}  #else  	mV[0] = (F32) sd[0].asReal(); @@ -417,7 +417,7 @@ BOOL LLColor4::parseColor(const std::string& buf, LLColor4* color)  		if (token_iter == tokens.end())  		{  			// This is a malformed vector. -			llwarns << "LLColor4::parseColor() malformed color " << buf << llendl; +			LL_WARNS() << "LLColor4::parseColor() malformed color " << buf << LL_ENDL;  		}  		else  		{ @@ -704,7 +704,7 @@ BOOL LLColor4::parseColor(const std::string& buf, LLColor4* color)  		}  		else  		{ -			llwarns << "invalid color " << color_name << llendl; +			LL_WARNS() << "invalid color " << color_name << LL_ENDL;  		}  	} diff --git a/indra/llmath/v4color.h b/indra/llmath/v4color.h index b047f86e6e..0d632f59be 100755 --- a/indra/llmath/v4color.h +++ b/indra/llmath/v4color.h @@ -49,10 +49,10 @@ class LLColor4  		LLColor4();						// Initializes LLColor4 to (0, 0, 0, 1)  		LLColor4(F32 r, F32 g, F32 b);		// Initializes LLColor4 to (r, g, b, 1)  		LLColor4(F32 r, F32 g, F32 b, F32 a);		// Initializes LLColor4 to (r. g, b, a) -		LLColor4(U32 clr);							// Initializes LLColor4 to (r=clr>>24, etc)) -		LLColor4(const F32 *vec);			// Initializes LLColor4 to (vec[0]. vec[1], vec[2], 1)  		LLColor4(const LLColor3 &vec, F32 a = 1.f);	// Initializes LLColor4 to (vec, a)  		explicit LLColor4(const LLSD& sd); +		explicit LLColor4(const F32 *vec);			// Initializes LLColor4 to (vec[0]. vec[1], vec[2], 1) +		explicit LLColor4(U32 clr);							// Initializes LLColor4 to (r=clr>>24, etc))  		explicit LLColor4(const LLColor4U& color4u);  // "explicit" to avoid automatic conversion  		explicit LLColor4(const LLVector4& vector4);  // "explicit" to avoid automatic conversion diff --git a/indra/llmath/xform.cpp b/indra/llmath/xform.cpp index b75aec6a27..5d8b93d5e8 100755 --- a/indra/llmath/xform.cpp +++ b/indra/llmath/xform.cpp @@ -36,10 +36,10 @@ LLXform::~LLXform()  {  } -// Link optimization - don't inline these llwarns +// Link optimization - don't inline these LL_WARNS()  void LLXform::warn(const char* const msg)  { -	llwarns << msg << llendl; +	LL_WARNS() << msg << LL_ENDL;  }  LLXform* LLXform::getRoot() const diff --git a/indra/llmath/xform.h b/indra/llmath/xform.h index 1b50749b3e..54b0f6d9ec 100755 --- a/indra/llmath/xform.h +++ b/indra/llmath/xform.h @@ -103,9 +103,9 @@ public:  	inline void setRotation(const F32 x, const F32 y, const F32 z, const F32 s);  	// Above functions must be inline for speed, but also -	// need to emit warnings.  llwarns causes inline LLError::CallSite +	// need to emit warnings.  LL_WARNS() causes inline LLError::CallSite  	// static objects that make more work for the linker. -	// Avoid inline llwarns by calling this function. +	// Avoid inline LL_WARNS() by calling this function.  	void warn(const char* const msg);  	void 		setChanged(const U32 bits)					{ mChanged |= bits; } | 
