diff options
| author | RunitaiLinden <davep@lindenlab.com> | 2024-05-06 16:48:58 -0500 | 
|---|---|---|
| committer | RunitaiLinden <davep@lindenlab.com> | 2024-05-06 16:48:58 -0500 | 
| commit | c6d752b880cacca8fb8f10f28790a50161fcb9ab (patch) | |
| tree | 14910a69597962134f2e78e864a2f05962a16356 /indra/llmath | |
| parent | 76101843c0d390c25a783f212eb1ea75e508ada4 (diff) | |
| parent | 7d87e41bbd5d4761b1eb17e49b7a00b948d84213 (diff) | |
Merge remote-tracking branch 'origin/DRTVWR-600-maint-A' into gltf-dev-maint-a-merge
Diffstat (limited to 'indra/llmath')
44 files changed, 885 insertions, 931 deletions
| diff --git a/indra/llmath/llbbox.cpp b/indra/llmath/llbbox.cpp index 3e2c05a6e6..395992e68f 100644 --- a/indra/llmath/llbbox.cpp +++ b/indra/llmath/llbbox.cpp @@ -38,7 +38,7 @@ void LLBBox::addPointLocal(const LLVector3& p)  	{  		mMinLocal = p;  		mMaxLocal = p; -		mEmpty = FALSE; +		mEmpty = false;  	}  	else  	{ @@ -140,7 +140,7 @@ LLVector3 LLBBox::agentToLocalBasis(const LLVector3& v) const  	return v * m;  } -BOOL LLBBox::containsPointLocal(const LLVector3& p) const +bool LLBBox::containsPointLocal(const LLVector3& p) const  {  	if (  (p.mV[VX] < mMinLocal.mV[VX])  		||(p.mV[VX] > mMaxLocal.mV[VX]) @@ -149,12 +149,12 @@ BOOL LLBBox::containsPointLocal(const LLVector3& p) const  		||(p.mV[VZ] < mMinLocal.mV[VZ])  		||(p.mV[VZ] > mMaxLocal.mV[VZ]))  	{ -		return FALSE; +		return false;  	} -	return TRUE; +	return true;  } -BOOL LLBBox::containsPointAgent(const LLVector3& p) const +bool LLBBox::containsPointAgent(const LLVector3& p) const  {  	LLVector3 point_local = agentToLocal(p);  	return containsPointLocal(point_local); diff --git a/indra/llmath/llbbox.h b/indra/llmath/llbbox.h index 28e69b75e1..8ae5f221f7 100644 --- a/indra/llmath/llbbox.h +++ b/indra/llmath/llbbox.h @@ -37,13 +37,13 @@  class LLBBox  {  public: -	LLBBox() {mEmpty = TRUE;} +	LLBBox() {mEmpty = true;}  	LLBBox( const LLVector3& pos_agent,  		const LLQuaternion& rot,  		const LLVector3& min_local,  		const LLVector3& max_local )  		: -		mMinLocal( min_local ), mMaxLocal( max_local ), mPosAgent(pos_agent), mRotation( rot), mEmpty( TRUE ) +		mMinLocal( min_local ), mMaxLocal( max_local ), mPosAgent(pos_agent), mRotation( rot), mEmpty( true )  		{}  	// Default copy constructor is OK. @@ -64,8 +64,8 @@ public:  	LLVector3			getExtentLocal() const				{ return mMaxLocal - mMinLocal; } -	BOOL				containsPointLocal(const LLVector3& p) const; -	BOOL				containsPointAgent(const LLVector3& p) const; +	bool				containsPointLocal(const LLVector3& p) const; +	bool				containsPointAgent(const LLVector3& p) const;  	void				addPointAgent(LLVector3 p);  	void				addBBoxAgent(const LLBBox& b); @@ -92,7 +92,7 @@ private:  	LLVector3			mMaxLocal;  	LLVector3			mPosAgent;  // Position relative to Agent's Region  	LLQuaternion		mRotation; -	BOOL				mEmpty;		// Nothing has been added to this bbox yet +	bool				mEmpty;		// Nothing has been added to this bbox yet  };  //LLBBox operator*(const LLBBox &a, const LLMatrix4 &b); diff --git a/indra/llmath/llcoordframe.h b/indra/llmath/llcoordframe.h index 909adf260c..1d3f4f7e3e 100644 --- a/indra/llmath/llcoordframe.h +++ b/indra/llmath/llcoordframe.h @@ -61,7 +61,7 @@ public:  	//LLCoordFrame(const F32 *origin, const F32 *rotation);	// Assumes "origin" is 1x3 and "rotation" is 1x9 array  	//LLCoordFrame(const F32 *origin_and_rotation);			// Assumes "origin_and_rotation" is 1x12 array -	BOOL isFinite() { return mOrigin.isFinite() && mXAxis.isFinite() && mYAxis.isFinite() && mZAxis.isFinite(); } +	bool isFinite() { return mOrigin.isFinite() && mXAxis.isFinite() && mYAxis.isFinite() && mZAxis.isFinite(); }  	void reset();  	void resetAxes(); diff --git a/indra/llmath/llinterp.h b/indra/llmath/llinterp.h index 5187646179..a107d301d8 100644 --- a/indra/llmath/llinterp.h +++ b/indra/llmath/llinterp.h @@ -41,7 +41,6 @@ class LLInterpVal  {  public:  	virtual ~LLInterpVal() {} -	virtual void interp(LLInterpVal &target, const F32 frac); // Linear interpolation for each type  };  template <typename Type> @@ -52,7 +51,7 @@ public:  	virtual ~LLInterp() {}  	virtual void start(); -	void update(const F32 time); +	virtual void update(const F32 time) = 0;  	const Type &getCurVal() const;  	void setStartVal(const Type &start_val); @@ -67,15 +66,15 @@ public:  	void setEndTime(const F32 time);  	F32 getEndTime() const; -	BOOL isActive() const; -	BOOL isDone() const; +	bool isActive() const; +	bool isDone() const;  protected:  	F32 mStartTime;  	F32 mEndTime;  	F32 mDuration; -	BOOL mActive; -	BOOL mDone; +	bool mActive; +	bool mDone;  	Type mStartVal;  	Type mEndVal; @@ -88,8 +87,8 @@ template <typename Type>  class LLInterpLinear : public LLInterp<Type>  {  public: -	/*virtual*/ void start(); -	void update(const F32 time); +	void start() override; +	void update(const F32 time) override;  	F32 getCurFrac() const;  protected:  	F32 mCurFrac; @@ -108,10 +107,10 @@ class LLInterpAttractor : public LLInterp<Type>  {  public:  	LLInterpAttractor(); -	/*virtual*/ void start(); +	void start() override;  	void setStartVel(const Type &vel);  	void setForce(const F32 force); -	void update(const F32 time); +	void update(const F32 time) override;  protected:  	F32 mForce;  	Type mStartVel; @@ -123,7 +122,7 @@ class LLInterpFunc : public LLInterp<Type>  {  public:  	LLInterpFunc(); -	void update(const F32 time); +	void update(const F32 time) override;  	void setFunc(Type (*)(const F32, void *data), void *data);  protected: @@ -151,8 +150,8 @@ LLInterp<Type>::LLInterp()  	mEndTime = 1.f;  	mDuration = 1.f;  	mCurTime = 0.f; -	mDone = FALSE; -	mActive = FALSE; +	mDone = false; +	mActive = false;  }  template <class Type> @@ -166,8 +165,8 @@ void LLInterp<Type>::start()  {  	mCurVal = mStartVal;  	mCurTime = mStartTime; -	mDone = FALSE; -	mActive = FALSE; +	mDone = false; +	mActive = false;  }  template <class Type> @@ -225,13 +224,13 @@ F32 LLInterp<Type>::getEndTime() const  template <class Type> -BOOL LLInterp<Type>::isDone() const +bool LLInterp<Type>::isDone() const  {  	return mDone;  }  template <class Type> -BOOL LLInterp<Type>::isActive() const +bool LLInterp<Type>::isActive() const  {  	return mActive;  } @@ -254,7 +253,7 @@ void LLInterpLinear<Type>::update(const F32 time)  	F32 dfrac = target_frac - this->mCurFrac;  	if (target_frac >= 0.f)  	{ -		this->mActive = TRUE; +		this->mActive = true;  	}  	if (target_frac > 1.f) @@ -262,7 +261,7 @@ void LLInterpLinear<Type>::update(const F32 time)  		this->mCurVal = this->mEndVal;  		this->mCurFrac = 1.f;  		this->mCurTime = time; -		this->mDone = TRUE; +		this->mDone = true;  		return;  	} @@ -332,7 +331,7 @@ void LLInterpAttractor<Type>::update(const F32 time)  {  	if (time > this->mStartTime)  	{ -		this->mActive = TRUE; +		this->mActive = true;  	}  	else  	{ @@ -340,7 +339,7 @@ void LLInterpAttractor<Type>::update(const F32 time)  	}  	if (time > this->mEndTime)  	{ -		this->mDone = TRUE; +		this->mDone = true;  		return;  	} @@ -362,8 +361,8 @@ void LLInterpAttractor<Type>::update(const F32 time)  template <class Type>  LLInterpFunc<Type>::LLInterpFunc() : LLInterp<Type>()  { -	mFunc = NULL; -	mData = NULL; +	mFunc = nullptr; +	mData = nullptr;  }  template <class Type> @@ -378,7 +377,7 @@ void LLInterpFunc<Type>::update(const F32 time)  {  	if (time > this->mStartTime)  	{ -		this->mActive = TRUE; +		this->mActive = true;  	}  	else  	{ @@ -386,7 +385,7 @@ void LLInterpFunc<Type>::update(const F32 time)  	}  	if (time > this->mEndTime)  	{ -		this->mDone = TRUE; +		this->mDone = true;  		return;  	} @@ -405,7 +404,7 @@ void LLInterpExp<Type>::update(const F32 time)  	F32 target_frac = (time - this->mStartTime) / this->mDuration;  	if (target_frac >= 0.f)  	{ -		this->mActive = TRUE; +		this->mActive = true;  	}  	if (target_frac > 1.f) @@ -413,7 +412,7 @@ void LLInterpExp<Type>::update(const F32 time)  		this->mCurVal = this->mEndVal;  		this->mCurFrac = 1.f;  		this->mCurTime = time; -		this->mDone = TRUE; +		this->mDone = true;  		return;  	} diff --git a/indra/llmath/llmath.h b/indra/llmath/llmath.h index e4ccd81faf..efcc3882fc 100644 --- a/indra/llmath/llmath.h +++ b/indra/llmath/llmath.h @@ -59,34 +59,34 @@  #define tanf(x)		((F32)tan((F64)(x)))  #endif*/ -const F32	GRAVITY			= -9.8f; +constexpr F32	GRAVITY			= -9.8f;  // mathematical constants -const F32	F_PI		= 3.1415926535897932384626433832795f; -const F32	F_TWO_PI	= 6.283185307179586476925286766559f; -const F32	F_PI_BY_TWO	= 1.5707963267948966192313216916398f; -const F32	F_SQRT_TWO_PI = 2.506628274631000502415765284811f; -const F32	F_E			= 2.71828182845904523536f; -const F32	F_SQRT2		= 1.4142135623730950488016887242097f; -const F32	F_SQRT3		= 1.73205080756888288657986402541f; -const F32	OO_SQRT2	= 0.7071067811865475244008443621049f; -const F32	OO_SQRT3	= 0.577350269189625764509f; -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; - -const F32	F_ALMOST_ZERO	= 0.0001f; -const F32	F_ALMOST_ONE	= 1.0f - F_ALMOST_ZERO; - -const F32	GIMBAL_THRESHOLD = 0.000436f; // sets the gimballock threshold 0.025 away from +/-90 degrees +constexpr F32	F_PI		= 3.1415926535897932384626433832795f; +constexpr F32	F_TWO_PI	= 6.283185307179586476925286766559f; +constexpr F32	F_PI_BY_TWO	= 1.5707963267948966192313216916398f; +constexpr F32	F_SQRT_TWO_PI = 2.506628274631000502415765284811f; +constexpr F32	F_E			= 2.71828182845904523536f; +constexpr F32	F_SQRT2		= 1.4142135623730950488016887242097f; +constexpr F32	F_SQRT3		= 1.73205080756888288657986402541f; +constexpr F32	OO_SQRT2	= 0.7071067811865475244008443621049f; +constexpr F32	OO_SQRT3	= 0.577350269189625764509f; +constexpr F32	DEG_TO_RAD	= 0.017453292519943295769236907684886f; +constexpr F32	RAD_TO_DEG	= 57.295779513082320876798154814105f; +constexpr F32	F_APPROXIMATELY_ZERO = 0.00001f; +constexpr F32	F_LN10		= 2.3025850929940456840179914546844f; +constexpr F32	OO_LN10		= 0.43429448190325182765112891891661; +constexpr F32	F_LN2		= 0.69314718056f; +constexpr F32	OO_LN2		= 1.4426950408889634073599246810019f; + +constexpr F32	F_ALMOST_ZERO	= 0.0001f; +constexpr F32	F_ALMOST_ONE	= 1.0f - F_ALMOST_ZERO; + +constexpr F32	GIMBAL_THRESHOLD = 0.000436f; // sets the gimballock threshold 0.025 away from +/-90 degrees  // formula: GIMBAL_THRESHOLD = sin(DEG_TO_RAD * gimbal_threshold_angle);  // BUG: Eliminate in favor of F_APPROXIMATELY_ZERO above? -const F32 FP_MAG_THRESHOLD = 0.0000001f; +constexpr F32 FP_MAG_THRESHOLD = 0.0000001f;  // TODO: Replace with logic like is_approx_equal  inline bool is_approx_zero( F32 f ) { return (-F_APPROXIMATELY_ZERO < f) && (f < F_APPROXIMATELY_ZERO); } @@ -123,13 +123,13 @@ inline bool is_zero(F32 x)  inline bool is_approx_equal(F32 x, F32 y)  { -	const S32 COMPARE_MANTISSA_UP_TO_BIT = 0x02; +	constexpr S32 COMPARE_MANTISSA_UP_TO_BIT = 0x02;  	return (std::abs((S32) ((U32&)x - (U32&)y) ) < COMPARE_MANTISSA_UP_TO_BIT);  }  inline bool is_approx_equal(F64 x, F64 y)  { -	const S64 COMPARE_MANTISSA_UP_TO_BIT = 0x02; +	constexpr S64 COMPARE_MANTISSA_UP_TO_BIT = 0x02;  	return (std::abs((S32) ((U64&)x - (U64&)y) ) < COMPARE_MANTISSA_UP_TO_BIT);  } @@ -272,8 +272,8 @@ inline F64 ll_round( F64 val, F64 nearest )  // peak error = -31.4 dB  // RMS  error = -28.1 dB -const F32 FAST_MAG_ALPHA = 0.960433870103f; -const F32 FAST_MAG_BETA = 0.397824734759f; +constexpr F32 FAST_MAG_ALPHA = 0.960433870103f; +constexpr F32 FAST_MAG_BETA = 0.397824734759f;  // these provide minimum RMS error  // @@ -281,8 +281,8 @@ const F32 FAST_MAG_BETA = 0.397824734759f;  // peak error = -32.6 dB  // RMS  error = -25.7 dB  // -//const F32 FAST_MAG_ALPHA = 0.948059448969f; -//const F32 FAST_MAG_BETA = 0.392699081699f; +//constexpr F32 FAST_MAG_ALPHA = 0.948059448969f; +//constexpr F32 FAST_MAG_BETA = 0.392699081699f;  inline F32 fastMagnitude(F32 a, F32 b)  {  @@ -299,8 +299,8 @@ inline F32 fastMagnitude(F32 a, F32 b)  //  // Culled from www.stereopsis.com/FPU.html -const F64 LL_DOUBLE_TO_FIX_MAGIC	= 68719476736.0*1.5;     //2^36 * 1.5,  (52-_shiftamt=36) uses limited precisicion to floor -const S32 LL_SHIFT_AMOUNT			= 16;                    //16.16 fixed point representation, +constexpr F64 LL_DOUBLE_TO_FIX_MAGIC	= 68719476736.0*1.5;     //2^36 * 1.5,  (52-_shiftamt=36) uses limited precisicion to floor +constexpr S32 LL_SHIFT_AMOUNT			= 16;                    //16.16 fixed point representation,  // Endian dependent code  #ifdef LL_LITTLE_ENDIAN diff --git a/indra/llmath/lloctree.h b/indra/llmath/lloctree.h index 318ee65cc0..2e9625fff7 100644 --- a/indra/llmath/lloctree.h +++ b/indra/llmath/lloctree.h @@ -548,7 +548,7 @@ public:  		}  	} -	void addChild(oct_node* child, BOOL silent = FALSE)  +	void addChild(oct_node* child, bool silent = false)  	{  #if LL_OCTREE_PARANOIA_CHECK @@ -591,7 +591,7 @@ public:  		}  	} -	void removeChild(S32 index, BOOL destroy = FALSE) +	void removeChild(S32 index, bool destroy = false)  	{  		for (U32 i = 0; i < this->getListenerCount(); i++)  		{ @@ -638,7 +638,7 @@ public:  		{  			if (getChild(i) == node)  			{ -				removeChild(i, TRUE); +				removeChild(i, true);  				return;  			}  		} @@ -707,7 +707,7 @@ public:  			//(don't notify listeners of addition)  			for (U32 i = 0; i < child->getChildCount(); i++)  			{ -				this->addChild(child->getChild(i), TRUE); +				this->addChild(child->getChild(i), true);  			}  			//destroy child @@ -723,7 +723,7 @@ public:  	// LLOctreeRoot::insert  	bool insert(T* data) override  	{ -		if (data == NULL)  +		if (data == nullptr)   		{  			OCT_ERRS << "!!! INVALID ELEMENT ADDED TO OCTREE ROOT !!!" << LL_ENDL;  			return false; diff --git a/indra/llmath/llquaternion.cpp b/indra/llmath/llquaternion.cpp index 57a976b57a..dd3d552832 100644 --- a/indra/llmath/llquaternion.cpp +++ b/indra/llmath/llquaternion.cpp @@ -653,14 +653,14 @@ LLQuaternion slerp( F32 u, const LLQuaternion &a, const LLQuaternion &b )  	F32 cos_t = a.mQ[0]*b.mQ[0] + a.mQ[1]*b.mQ[1] + a.mQ[2]*b.mQ[2] + a.mQ[3]*b.mQ[3];  	// if b is on opposite hemisphere from a, use -a instead -	int bflip; +	bool bflip;   	if (cos_t < 0.0f)  	{  		cos_t = -cos_t; -		bflip = TRUE; +		bflip = true;  	}  	else -		bflip = FALSE; +		bflip = false;  	// if B is (within precision limits) the same as A,  	// just linear interpolate between A and B. @@ -959,11 +959,11 @@ void LLQuaternion::unpackFromVector3( const LLVector3& vec )  	}  } -BOOL LLQuaternion::parseQuat(const std::string& buf, LLQuaternion* value) +bool LLQuaternion::parseQuat(const std::string& buf, LLQuaternion* value)  {  	if( buf.empty() || value == NULL)  	{ -		return FALSE; +		return false;  	}  	LLQuaternion quat; @@ -971,10 +971,10 @@ BOOL LLQuaternion::parseQuat(const std::string& buf, LLQuaternion* value)  	if( 4 == count )  	{  		value->set( quat ); -		return TRUE; +		return true;  	} -	return FALSE; +	return false;  } diff --git a/indra/llmath/llquaternion.h b/indra/llmath/llquaternion.h index 51ce163b4e..1c9da7c342 100644 --- a/indra/llmath/llquaternion.h +++ b/indra/llmath/llquaternion.h @@ -69,9 +69,9 @@ public:      LLSD getValue() const;      void setValue(const LLSD& sd); -	BOOL isIdentity() const; -	BOOL isNotIdentity() const; -	BOOL isFinite() const;									// checks to see if all values of LLQuaternion are finite +	bool isIdentity() const; +	bool isNotIdentity() const; +	bool isFinite() const;									// checks to see if all values of LLQuaternion are finite  	void quantize16(F32 lower, F32 upper);					// changes the vector to reflect quatization  	void quantize8(F32 lower, F32 upper);							// changes the vector to reflect quatization  	void loadIdentity();											// Loads the quaternion that represents the identity rotation @@ -167,7 +167,7 @@ public:  	friend const char *OrderToString( const Order order );  	friend Order StringToOrder( const char *str ); -	static BOOL parseQuat(const std::string& buf, LLQuaternion* value); +	static bool parseQuat(const std::string& buf, LLQuaternion* value);  	// For debugging, only  	//static U32 mMultCount; @@ -192,12 +192,12 @@ inline void LLQuaternion::setValue(const LLSD& sd)  }  // checker -inline BOOL	LLQuaternion::isFinite() const +inline bool	LLQuaternion::isFinite() const  {  	return (llfinite(mQ[VX]) && llfinite(mQ[VY]) && llfinite(mQ[VZ]) && llfinite(mQ[VS]));  } -inline BOOL LLQuaternion::isIdentity() const +inline bool LLQuaternion::isIdentity() const  {  	return   		( mQ[VX] == 0.f ) && @@ -206,7 +206,7 @@ inline BOOL LLQuaternion::isIdentity() const  		( mQ[VS] == 1.f );  } -inline BOOL LLQuaternion::isNotIdentity() const +inline bool LLQuaternion::isNotIdentity() const  {  	return   		( mQ[VX] != 0.f ) || diff --git a/indra/llmath/llrect.h b/indra/llmath/llrect.h index 58f02d4d2b..25af04be06 100644 --- a/indra/llmath/llrect.h +++ b/indra/llmath/llrect.h @@ -83,14 +83,14 @@ public:  	}  	// Note: follows GL_QUAD conventions: the top and right edges are not considered part of the rect -	BOOL		pointInRect(const Type x, const Type y) const +	bool		pointInRect(const Type x, const Type y) const  	{  		return  mLeft <= x && x < mRight &&  				mBottom <= y && y < mTop;  	}  	//// Note: follows GL_QUAD conventions: the top and right edges are not considered part of the rect -	BOOL		localPointInRect(const Type x, const Type y) const +	bool		localPointInRect(const Type x, const Type y) const  	{  		return  0 <= x && x < getWidth() &&  				0 <= y && y < getHeight(); @@ -137,8 +137,8 @@ public:  	}  	// Note: Does NOT follow GL_QUAD conventions: the top and right edges ARE considered part of the rect -	// returns TRUE if any part of rect is is inside this LLRect -	BOOL		overlaps(const LLRectBase& rect) const +	// returns true if any part of rect is is inside this LLRect +	bool		overlaps(const LLRectBase& rect) const  	{  		return !(mLeft > rect.mRight   			|| mRight < rect.mLeft @@ -146,7 +146,7 @@ public:  			|| mTop < rect.mBottom);  	} -	BOOL		contains(const LLRectBase& rect) const +	bool		contains(const LLRectBase& rect) const  	{  		return mLeft <= rect.mLeft  			&& mRight >= rect.mRight diff --git a/indra/llmath/llsphere.cpp b/indra/llmath/llsphere.cpp index a8d6200488..7292e3c0de 100644 --- a/indra/llmath/llsphere.cpp +++ b/indra/llmath/llsphere.cpp @@ -69,18 +69,18 @@ F32 LLSphere::getRadius() const  	return mRadius;  } -// returns 'TRUE' if this sphere completely contains other_sphere -BOOL LLSphere::contains(const LLSphere& other_sphere) const +// returns 'true' if this sphere completely contains other_sphere +bool LLSphere::contains(const LLSphere& other_sphere) const  {  	F32 separation = (mCenter - other_sphere.mCenter).length(); -	return (mRadius >= separation + other_sphere.mRadius) ? TRUE : FALSE; +	return (mRadius >= separation + other_sphere.mRadius) ? true : false;  } -// returns 'TRUE' if this sphere completely contains other_sphere -BOOL LLSphere::overlaps(const LLSphere& other_sphere) const +// returns 'true' if this sphere completely contains other_sphere +bool LLSphere::overlaps(const LLSphere& other_sphere) const  {  	F32 separation = (mCenter - other_sphere.mCenter).length(); -	return (separation <= mRadius + other_sphere.mRadius) ? TRUE : FALSE; +	return (separation <= mRadius + other_sphere.mRadius) ? true : false;  }  // returns overlap diff --git a/indra/llmath/llsphere.h b/indra/llmath/llsphere.h index 7c60a11406..ba8e437ecf 100644 --- a/indra/llmath/llsphere.h +++ b/indra/llmath/llsphere.h @@ -47,11 +47,11 @@ public:  	const LLVector3& getCenter() const;  	F32 getRadius() const; -	// returns TRUE if this sphere completely contains other_sphere -	BOOL contains(const LLSphere& other_sphere) const; +	// returns true if this sphere completely contains other_sphere +	bool contains(const LLSphere& other_sphere) const; -	// returns TRUE if this sphere overlaps other_sphere -	BOOL overlaps(const LLSphere& other_sphere) const; +	// returns true if this sphere overlaps other_sphere +	bool overlaps(const LLSphere& other_sphere) const;  	// returns overlap distance  	// negative overlap is closest approach diff --git a/indra/llmath/llvolume.cpp b/indra/llmath/llvolume.cpp index 4384c732b2..d38d88eb0e 100644 --- a/indra/llmath/llvolume.cpp +++ b/indra/llmath/llvolume.cpp @@ -61,66 +61,66 @@  #define DEBUG_SILHOUETTE_NORMALS 0 // TomY: Use this to display normals using the silhouette  #define DEBUG_SILHOUETTE_EDGE_MAP 0 // DaveP: Use this to display edge map using the silhouette -const F32 MIN_CUT_DELTA = 0.02f; +constexpr F32 MIN_CUT_DELTA = 0.02f; -const F32 HOLLOW_MIN = 0.f; -const F32 HOLLOW_MAX = 0.95f; -const F32 HOLLOW_MAX_SQUARE	= 0.7f; +constexpr F32 HOLLOW_MIN = 0.f; +constexpr F32 HOLLOW_MAX = 0.95f; +constexpr F32 HOLLOW_MAX_SQUARE	= 0.7f; -const F32 TWIST_MIN = -1.f; -const F32 TWIST_MAX =  1.f; +constexpr F32 TWIST_MIN = -1.f; +constexpr F32 TWIST_MAX =  1.f; -const F32 RATIO_MIN = 0.f; -const F32 RATIO_MAX = 2.f; // Tom Y: Inverted sense here: 0 = top taper, 2 = bottom taper +constexpr F32 RATIO_MIN = 0.f; +constexpr F32 RATIO_MAX = 2.f; // Tom Y: Inverted sense here: 0 = top taper, 2 = bottom taper -const F32 HOLE_X_MIN= 0.05f; -const F32 HOLE_X_MAX= 1.0f; +constexpr F32 HOLE_X_MIN= 0.05f; +constexpr F32 HOLE_X_MAX= 1.0f; -const F32 HOLE_Y_MIN= 0.05f; -const F32 HOLE_Y_MAX= 0.5f; +constexpr F32 HOLE_Y_MIN= 0.05f; +constexpr F32 HOLE_Y_MAX= 0.5f; -const F32 SHEAR_MIN = -0.5f; -const F32 SHEAR_MAX =  0.5f; +constexpr F32 SHEAR_MIN = -0.5f; +constexpr F32 SHEAR_MAX =  0.5f; -const F32 REV_MIN = 1.f; -const F32 REV_MAX = 4.f; +constexpr F32 REV_MIN = 1.f; +constexpr F32 REV_MAX = 4.f; -const F32 TAPER_MIN = -1.f; -const F32 TAPER_MAX =  1.f; +constexpr F32 TAPER_MIN = -1.f; +constexpr F32 TAPER_MAX =  1.f; -const F32 SKEW_MIN	= -0.95f; -const F32 SKEW_MAX	=  0.95f; +constexpr F32 SKEW_MIN	= -0.95f; +constexpr F32 SKEW_MAX	=  0.95f; -const F32 SCULPT_MIN_AREA = 0.002f; -const S32 SCULPT_MIN_AREA_DETAIL = 1; +constexpr F32 SCULPT_MIN_AREA = 0.002f; +constexpr S32 SCULPT_MIN_AREA_DETAIL = 1; -BOOL gDebugGL = FALSE; // See settings.xml "RenderDebugGL" +bool gDebugGL = false; // See settings.xml "RenderDebugGL" -BOOL check_same_clock_dir( const LLVector3& pt1, const LLVector3& pt2, const LLVector3& pt3, const LLVector3& norm) -{     +bool check_same_clock_dir( const LLVector3& pt1, const LLVector3& pt2, const LLVector3& pt3, const LLVector3& norm) +{  	LLVector3 test = (pt2-pt1)%(pt3-pt2);  	//answer  	if(test * norm < 0)   	{ -		return FALSE; +		return false;  	}  	else   	{ -		return TRUE; +		return true;  	}  }  -BOOL LLLineSegmentBoxIntersect(const LLVector3& start, const LLVector3& end, const LLVector3& center, const LLVector3& size) +bool LLLineSegmentBoxIntersect(const LLVector3& start, const LLVector3& end, const LLVector3& center, const LLVector3& size)  {  	return LLLineSegmentBoxIntersect(start.mV, end.mV, center.mV, size.mV);  } -BOOL LLLineSegmentBoxIntersect(const F32* start, const F32* end, const F32* center, const F32* size) +bool LLLineSegmentBoxIntersect(const F32* start, const F32* end, const F32* center, const F32* size)  { -	F32 fAWdU[3]; -	F32 dir[3]; -	F32 diff[3]; +	F32 fAWdU[3]{}; +	F32 dir[3]{}; +	F32 diff[3]{};  	for (U32 i = 0; i < 3; i++)  	{ @@ -218,11 +218,11 @@ void calc_tangent_from_triangle(  // intersect test between triangle vert0, vert1, vert2 and a ray from orig in direction dir. -// returns TRUE if intersecting and returns barycentric coordinates in intersection_a, intersection_b, +// returns true if intersecting and returns barycentric coordinates in intersection_a, intersection_b,  // and returns the intersection point along dir in intersection_t.  // Moller-Trumbore algorithm -BOOL LLTriangleRayIntersect(const LLVector4a& vert0, const LLVector4a& vert1, const LLVector4a& vert2, const LLVector4a& orig, const LLVector4a& dir, +bool LLTriangleRayIntersect(const LLVector4a& vert0, const LLVector4a& vert1, const LLVector4a& vert2, const LLVector4a& orig, const LLVector4a& dir,  							F32& intersection_a, F32& intersection_b, F32& intersection_t)  { @@ -284,15 +284,15 @@ BOOL LLTriangleRayIntersect(const LLVector4a& vert0, const LLVector4a& vert1, co  				intersection_a = u[0];  				intersection_b = v[0];  				intersection_t = t[0]; -				return TRUE; +				return true;  			}  		}  	} -	return FALSE; +	return false;  }  -BOOL LLTriangleRayIntersectTwoSided(const LLVector4a& vert0, const LLVector4a& vert1, const LLVector4a& vert2, const LLVector4a& orig, const LLVector4a& dir, +bool LLTriangleRayIntersectTwoSided(const LLVector4a& vert0, const LLVector4a& vert1, const LLVector4a& vert2, const LLVector4a& orig, const LLVector4a& dir,  							F32& intersection_a, F32& intersection_b, F32& intersection_t)  {  	F32 u, v, t; @@ -315,7 +315,7 @@ BOOL LLTriangleRayIntersectTwoSided(const LLVector4a& vert0, const LLVector4a& v  	if (det > -F_APPROXIMATELY_ZERO && det < F_APPROXIMATELY_ZERO)  	{ -		return FALSE; +		return false;  	}  	F32 inv_det = 1.f / det; @@ -328,7 +328,7 @@ BOOL LLTriangleRayIntersectTwoSided(const LLVector4a& vert0, const LLVector4a& v  	u = (tvec.dot3(pvec).getF32()) * inv_det;  	if (u < 0.f || u > 1.f)  	{ -		return FALSE; +		return false;  	}  	/* prepare to test V parameter */ @@ -339,7 +339,7 @@ BOOL LLTriangleRayIntersectTwoSided(const LLVector4a& vert0, const LLVector4a& v  	if (v < 0.f || u + v > 1.f)  	{ -		return FALSE; +		return false;  	}  	/* calculate t, ray intersects triangle */ @@ -350,7 +350,7 @@ BOOL LLTriangleRayIntersectTwoSided(const LLVector4a& vert0, const LLVector4a& v  	intersection_t = t; -	return TRUE; +	return true;  }   //helper for non-aligned vectors @@ -390,12 +390,12 @@ LLProfile::Face* LLProfile::addCap(S16 faceID)  	face->mIndex = 0;  	face->mCount = mTotal;  	face->mScaleU= 1.0f; -	face->mCap   = TRUE; +	face->mCap   = true;  	face->mFaceID = faceID;  	return face;  } -LLProfile::Face* LLProfile::addFace(S32 i, S32 count, F32 scaleU, S16 faceID, BOOL flat) +LLProfile::Face* LLProfile::addFace(S32 i, S32 count, F32 scaleU, S16 faceID, bool flat)  {  	Face *face   = vector_append(mFaces, 1); @@ -404,7 +404,7 @@ LLProfile::Face* LLProfile::addFace(S32 i, S32 count, F32 scaleU, S16 faceID, BO  	face->mScaleU= scaleU;  	face->mFlat = flat; -	face->mCap   = FALSE; +	face->mCap   = false;  	face->mFaceID = faceID;  	return face;  } @@ -479,7 +479,7 @@ void LLProfile::genNGon(const LLProfileParams& params, S32 sides, F32 offset, F3  {  	// Generate an n-sided "circular" path.  	// 0 is (1,0), and we go counter-clockwise along a circular path from there. -	static const F32 tableScale[] = { 1, 1, 1, 0.5f, 0.707107f, 0.53f, 0.525f, 0.5f }; +	constexpr F32 tableScale[] = { 1, 1, 1, 0.5f, 0.707107f, 0.53f, 0.525f, 0.5f };  	F32 scale = 0.5f;  	F32 t, t_step, t_first, t_fraction, ang, ang_step;  	LLVector4a pt1,pt2; @@ -579,13 +579,13 @@ void LLProfile::genNGon(const LLProfileParams& params, S32 sides, F32 offset, F3  	{  		if ((end - begin)*ang_scale > 0.5f)  		{ -			mConcave = TRUE; +			mConcave = true;  		}  		else  		{ -			mConcave = FALSE; +			mConcave = false;  		} -		mOpen = TRUE; +		mOpen = true;  		if (params.getHollow() <= 0)  		{  			// put center point if not hollow. @@ -595,8 +595,8 @@ void LLProfile::genNGon(const LLProfileParams& params, S32 sides, F32 offset, F3  	else  	{  		// The profile isn't open. -		mOpen = FALSE; -		mConcave = FALSE; +		mOpen = false; +		mConcave = false;  	}  	mTotal = mProfile.size(); @@ -605,7 +605,7 @@ void LLProfile::genNGon(const LLProfileParams& params, S32 sides, F32 offset, F3  // Hollow is percent of the original bounding box, not of this particular  // profile's geometry.  Thus, a swept triangle needs lower hollow values than  // a swept square. -LLProfile::Face* LLProfile::addHole(const LLProfileParams& params, BOOL flat, F32 sides, F32 offset, F32 box_hollow, F32 ang_scale, S32 split) +LLProfile::Face* LLProfile::addHole(const LLProfileParams& params, bool flat, F32 sides, F32 offset, F32 box_hollow, F32 ang_scale, S32 split)  {  	// Note that addHole will NOT work for non-"circular" profiles, if we ever decide to use them. @@ -644,8 +644,8 @@ LLProfile::Face* LLProfile::addHole(const LLProfileParams& params, BOOL flat, F3  }  //static -S32 LLProfile::getNumPoints(const LLProfileParams& params, BOOL path_open,F32 detail, S32 split, -						 BOOL is_sculpted, S32 sculpt_size) +S32 LLProfile::getNumPoints(const LLProfileParams& params, bool path_open,F32 detail, S32 split, +						 bool is_sculpted, S32 sculpt_size)  { // this is basically LLProfile::generate stripped down to only operations that influence the number of points  	if (detail < MIN_LOD)  	{ @@ -754,16 +754,16 @@ S32 LLProfile::getNumPoints(const LLProfileParams& params, BOOL path_open,F32 de  } -BOOL LLProfile::generate(const LLProfileParams& params, BOOL path_open,F32 detail, S32 split, -						 BOOL is_sculpted, S32 sculpt_size) +bool LLProfile::generate(const LLProfileParams& params, bool path_open,F32 detail, S32 split, +						 bool is_sculpted, S32 sculpt_size)  {  	LL_PROFILE_ZONE_SCOPED_CATEGORY_VOLUME  	if ((!mDirty) && (!is_sculpted))  	{ -		return FALSE; +		return false;  	} -	mDirty = FALSE; +	mDirty = false;  	if (detail < MIN_LOD)  	{ @@ -784,7 +784,7 @@ BOOL LLProfile::generate(const LLProfileParams& params, BOOL path_open,F32 detai  	if (begin > end - 0.01f)  	{  		LL_WARNS() << "LLProfile::generate() assertion failed (begin >= end)" << LL_ENDL; -		return FALSE; +		return false;  	}  	S32 face_num = 0; @@ -801,7 +801,7 @@ BOOL LLProfile::generate(const LLProfileParams& params, BOOL path_open,F32 detai  			for (i = llfloor(begin * 4.f); i < llfloor(end * 4.f + .999f); i++)  			{ -				addFace((face_num++) * (split +1), split+2, 1, LL_FACE_OUTER_SIDE_0 << i, TRUE); +				addFace((face_num++) * (split +1), split+2, 1, LL_FACE_OUTER_SIDE_0 << i, true);  			}  			LLVector4a scale(1,1,4,1); @@ -819,16 +819,16 @@ BOOL LLProfile::generate(const LLProfileParams& params, BOOL path_open,F32 detai  				{  				case LL_PCODE_HOLE_TRIANGLE:  					// This offset is not correct, but we can't change it now... DK 11/17/04 -				  	addHole(params, TRUE, 3, -0.375f, hollow, 1.f, split); +				  	addHole(params, true, 3, -0.375f, hollow, 1.f, split);  					break;  				case LL_PCODE_HOLE_CIRCLE:  					// TODO: Compute actual detail levels for cubes -				  	addHole(params, FALSE, MIN_DETAIL_FACES * detail, -0.375f, hollow, 1.f); +				  	addHole(params, false, MIN_DETAIL_FACES * detail, -0.375f, hollow, 1.f);  					break;  				case LL_PCODE_HOLE_SAME:  				case LL_PCODE_HOLE_SQUARE:  				default: -					addHole(params, TRUE, 4, -0.375f, hollow, 1.f, split); +					addHole(params, true, 4, -0.375f, hollow, 1.f, split);  					break;  				}  			} @@ -858,7 +858,7 @@ BOOL LLProfile::generate(const LLProfileParams& params, BOOL path_open,F32 detai  			for (i = llfloor(begin * 3.f); i < llfloor(end * 3.f + .999f); i++)  			{ -				addFace((face_num++) * (split +1), split+2, 1, LL_FACE_OUTER_SIDE_0 << i, TRUE); +				addFace((face_num++) * (split +1), split+2, 1, LL_FACE_OUTER_SIDE_0 << i, true);  			}  			if (hollow)  			{ @@ -870,15 +870,15 @@ BOOL LLProfile::generate(const LLProfileParams& params, BOOL path_open,F32 detai  				{  				case LL_PCODE_HOLE_CIRCLE:  					// TODO: Actually generate level of detail for triangles -					addHole(params, FALSE, MIN_DETAIL_FACES * detail, 0, triangle_hollow, 1.f); +					addHole(params, false, MIN_DETAIL_FACES * detail, 0, triangle_hollow, 1.f);  					break;  				case LL_PCODE_HOLE_SQUARE: -					addHole(params, TRUE, 4, 0, triangle_hollow, 1.f, split); +					addHole(params, true, 4, 0, triangle_hollow, 1.f, split);  					break;  				case LL_PCODE_HOLE_SAME:  				case LL_PCODE_HOLE_TRIANGLE:  				default: -					addHole(params, TRUE, 3, 0, triangle_hollow, 1.f, split); +					addHole(params, true, 3, 0, triangle_hollow, 1.f, split);  					break;  				}  			} @@ -915,11 +915,11 @@ BOOL LLProfile::generate(const LLProfileParams& params, BOOL path_open,F32 detai  			if (mOpen && !hollow)  			{ -				addFace(0,mTotal-1,0,LL_FACE_OUTER_SIDE_0, FALSE); +				addFace(0,mTotal-1,0,LL_FACE_OUTER_SIDE_0, false);  			}  			else  			{ -				addFace(0,mTotal,0,LL_FACE_OUTER_SIDE_0, FALSE); +				addFace(0,mTotal,0,LL_FACE_OUTER_SIDE_0, false);  			}  			if (hollow) @@ -927,15 +927,15 @@ BOOL LLProfile::generate(const LLProfileParams& params, BOOL path_open,F32 detai  				switch (hole_type)  				{  				case LL_PCODE_HOLE_SQUARE: -					addHole(params, TRUE, 4, 0, hollow, 1.f, split); +					addHole(params, true, 4, 0, hollow, 1.f, split);  					break;  				case LL_PCODE_HOLE_TRIANGLE: -					addHole(params, TRUE, 3, 0, hollow, 1.f, split); +					addHole(params, true, 3, 0, hollow, 1.f, split);  					break;  				case LL_PCODE_HOLE_CIRCLE:  				case LL_PCODE_HOLE_SAME:  				default: -					addHole(params, FALSE, circle_detail, 0, hollow, 1.f); +					addHole(params, true, circle_detail, 0, hollow, 1.f);  					break;  				}  			} @@ -965,11 +965,11 @@ BOOL LLProfile::generate(const LLProfileParams& params, BOOL path_open,F32 detai  			}  			if (mOpen && !params.getHollow())  			{ -				addFace(0,mTotal-1,0,LL_FACE_OUTER_SIDE_0, FALSE); +				addFace(0,mTotal-1,0,LL_FACE_OUTER_SIDE_0, false);  			}  			else  			{ -				addFace(0,mTotal,0,LL_FACE_OUTER_SIDE_0, FALSE); +				addFace(0,mTotal,0,LL_FACE_OUTER_SIDE_0, false);  			}  			if (hollow) @@ -977,15 +977,15 @@ BOOL LLProfile::generate(const LLProfileParams& params, BOOL path_open,F32 detai  				switch (hole_type)  				{  				case LL_PCODE_HOLE_SQUARE: -					addHole(params, TRUE, 2, 0.5f, hollow, 0.5f, split); +					addHole(params, true, 2, 0.5f, hollow, 0.5f, split);  					break;  				case LL_PCODE_HOLE_TRIANGLE: -					addHole(params, TRUE, 3,  0.5f, hollow, 0.5f, split); +					addHole(params, true, 3,  0.5f, hollow, 0.5f, split);  					break;  				case LL_PCODE_HOLE_CIRCLE:  				case LL_PCODE_HOLE_SAME:  				default: -					addHole(params, FALSE, circle_detail,  0.5f, hollow, 0.5f); +					addHole(params, false, circle_detail,  0.5f, hollow, 0.5f);  					break;  				}  			} @@ -993,11 +993,11 @@ BOOL LLProfile::generate(const LLProfileParams& params, BOOL path_open,F32 detai  			// Special case for openness of sphere  			if ((params.getEnd() - params.getBegin()) < 1.f)  			{ -				mOpen = TRUE; +				mOpen = true;  			}  			else if (!hollow)  			{ -				mOpen = FALSE; +				mOpen = false;  				mProfile.push_back(mProfile[0]);  				mTotal++;  			} @@ -1015,24 +1015,24 @@ BOOL LLProfile::generate(const LLProfileParams& params, BOOL path_open,F32 detai  	if ( mOpen) // interior edge caps  	{ -		addFace(mTotal-1, 2,0.5,LL_FACE_PROFILE_BEGIN, TRUE);  +		addFace(mTotal-1, 2,0.5,LL_FACE_PROFILE_BEGIN, true);  		if (hollow)  		{ -			addFace(mTotalOut-1, 2,0.5,LL_FACE_PROFILE_END, TRUE); +			addFace(mTotalOut-1, 2,0.5,LL_FACE_PROFILE_END, true);  		}  		else  		{ -			addFace(mTotal-2, 2,0.5,LL_FACE_PROFILE_END, TRUE); +			addFace(mTotal-2, 2,0.5,LL_FACE_PROFILE_END, true);  		}  	} -	return TRUE; +	return true;  } -BOOL LLProfileParams::importFile(LLFILE *fp) +bool LLProfileParams::importFile(LLFILE *fp)  {  	const S32 BUFSIZE = 16384;  	char buffer[BUFSIZE];	/* Flawfinder: ignore */ @@ -1090,11 +1090,11 @@ BOOL LLProfileParams::importFile(LLFILE *fp)  		}  	} -	return TRUE; +	return true;  } -BOOL LLProfileParams::exportFile(LLFILE *fp) const +bool LLProfileParams::exportFile(LLFILE *fp) const  {  	fprintf(fp,"\t\tprofile 0\n");  	fprintf(fp,"\t\t{\n"); @@ -1103,11 +1103,11 @@ BOOL LLProfileParams::exportFile(LLFILE *fp) const  	fprintf(fp,"\t\t\tend\t%g\n", getEnd());  	fprintf(fp,"\t\t\thollow\t%g\n", getHollow());  	fprintf(fp, "\t\t}\n"); -	return TRUE; +	return true;  } -BOOL LLProfileParams::importLegacyStream(std::istream& input_stream) +bool LLProfileParams::importLegacyStream(std::istream& input_stream)  {  	const S32 BUFSIZE = 16384;  	char buffer[BUFSIZE];	/* Flawfinder: ignore */ @@ -1162,11 +1162,11 @@ BOOL LLProfileParams::importLegacyStream(std::istream& input_stream)  		}  	} -	return TRUE; +	return true;  } -BOOL LLProfileParams::exportLegacyStream(std::ostream& output_stream) const +bool LLProfileParams::exportLegacyStream(std::ostream& output_stream) const  {  	output_stream <<"\t\tprofile 0\n";  	output_stream <<"\t\t{\n"; @@ -1175,7 +1175,7 @@ BOOL LLProfileParams::exportLegacyStream(std::ostream& output_stream) const  	output_stream <<"\t\t\tend\t" << getEnd() << "\n";  	output_stream <<"\t\t\thollow\t" << getHollow() << "\n";  	output_stream << "\t\t}\n"; -	return TRUE; +	return true;  }  LLSD LLProfileParams::asLLSD() const @@ -1242,7 +1242,7 @@ void LLPath::genNGon(const LLPathParams& params, S32 sides, F32 startOff, F32 en  	LL_PROFILE_ZONE_SCOPED_CATEGORY_VOLUME  	// Generates a circular path, starting at (1, 0, 0), counterclockwise along the xz plane. -	static const F32 tableScale[] = { 1, 1, 1, 0.5f, 0.707107f, 0.53f, 0.525f, 0.5f }; +	constexpr F32 tableScale[] = { 1, 1, 1, 0.5f, 0.707107f, 0.53f, 0.525f, 0.5f };  	F32 revolutions = params.getRevolutions();  	F32 skew		= params.getSkew(); @@ -1472,14 +1472,14 @@ S32 LLPath::getNumPoints(const LLPathParams& params, F32 detail)  	return np;  } -BOOL LLPath::generate(const LLPathParams& params, F32 detail, S32 split, -					  BOOL is_sculpted, S32 sculpt_size) +bool LLPath::generate(const LLPathParams& params, F32 detail, S32 split, +					  bool is_sculpted, S32 sculpt_size)  {  	LL_PROFILE_ZONE_SCOPED_CATEGORY_VOLUME  	if ((!mDirty) && (!is_sculpted))  	{ -		return FALSE; +		return false;  	}  	if (detail < MIN_LOD) @@ -1488,11 +1488,11 @@ BOOL LLPath::generate(const LLPathParams& params, F32 detail, S32 split,  		detail = MIN_LOD;  	} -	mDirty = FALSE; +	mDirty = false;  	S32 np = 2; // hardcode for line  	mPath.resize(0); -	mOpen = TRUE; +	mOpen = true;  	// Is this 0xf0 mask really necessary?  DK 03/02/05  	switch (params.getCurveType() & 0xf0) @@ -1552,7 +1552,7 @@ BOOL LLPath::generate(const LLPathParams& params, F32 detail, S32 split,  			if (params.getEnd() - params.getBegin() >= 0.99f &&  				params.getScaleX() >= .99f)  			{ -				mOpen = FALSE; +				mOpen = false;  			}  			//genNGon(params, llfloor(MIN_DETAIL_FACES * detail), 4.f, 0.f); @@ -1596,19 +1596,19 @@ BOOL LLPath::generate(const LLPathParams& params, F32 detail, S32 split,  		break;  	}; -	if (params.getTwist() != params.getTwistBegin()) mOpen = TRUE; +	if (params.getTwist() != params.getTwistBegin()) mOpen = true;  	//if ((int(fabsf(params.getTwist() - params.getTwistBegin())*100))%100 != 0) { -	//	mOpen = TRUE; +	//	mOpen = true;  	//} -	return TRUE; +	return true;  } -BOOL LLDynamicPath::generate(const LLPathParams& params, F32 detail, S32 split, -							 BOOL is_sculpted, S32 sculpt_size) +bool LLDynamicPath::generate(const LLPathParams& params, F32 detail, S32 split, +							 bool is_sculpted, S32 sculpt_size)  { -	mOpen = TRUE; // Draw end caps +	mOpen = true; // Draw end caps  	if (getPathLength() == 0)  	{  		// Path hasn't been generated yet. @@ -1627,11 +1627,11 @@ BOOL LLDynamicPath::generate(const LLPathParams& params, F32 detail, S32 split,  		}  	} -	return TRUE; +	return true;  } -BOOL LLPathParams::importFile(LLFILE *fp) +bool LLPathParams::importFile(LLFILE *fp)  {  	const S32 BUFSIZE = 16384;  	char buffer[BUFSIZE];	/* Flawfinder: ignore */ @@ -1746,11 +1746,11 @@ BOOL LLPathParams::importFile(LLFILE *fp)  			LL_WARNS() << "unknown keyword " << " in path import" << LL_ENDL;  		}  	} -	return TRUE; +	return true;  } -BOOL LLPathParams::exportFile(LLFILE *fp) const +bool LLPathParams::exportFile(LLFILE *fp) const  {  	fprintf(fp, "\t\tpath 0\n");  	fprintf(fp, "\t\t{\n"); @@ -1771,11 +1771,11 @@ BOOL LLPathParams::exportFile(LLFILE *fp) const  	fprintf(fp,"\t\t\tskew\t%g\n", getSkew());  	fprintf(fp, "\t\t}\n"); -	return TRUE; +	return true;  } -BOOL LLPathParams::importLegacyStream(std::istream& input_stream) +bool LLPathParams::importLegacyStream(std::istream& input_stream)  {  	const S32 BUFSIZE = 16384;  	char buffer[BUFSIZE];	/* Flawfinder: ignore */ @@ -1886,11 +1886,11 @@ BOOL LLPathParams::importLegacyStream(std::istream& input_stream)  			LL_WARNS() << "unknown keyword " << " in path import" << LL_ENDL;  		}  	} -	return TRUE; +	return true;  } -BOOL LLPathParams::exportLegacyStream(std::ostream& output_stream) const +bool LLPathParams::exportLegacyStream(std::ostream& output_stream) const  {  	output_stream << "\t\tpath 0\n";  	output_stream << "\t\t{\n"; @@ -1911,7 +1911,7 @@ BOOL LLPathParams::exportLegacyStream(std::ostream& output_stream) const  	output_stream <<"\t\t\tskew\t" << getSkew() << "\n";  	output_stream << "\t\t}\n"; -	return TRUE; +	return true;  }  LLSD LLPathParams::asLLSD() const @@ -1976,7 +1976,7 @@ LLProfile::~LLProfile()  S32 LLVolume::sNumMeshPoints = 0; -LLVolume::LLVolume(const LLVolumeParams ¶ms, const F32 detail, const BOOL generate_single_face, const BOOL is_unique) +LLVolume::LLVolume(const LLVolumeParams ¶ms, const F32 detail, const bool generate_single_face, const bool is_unique)  	: mParams(params)  {  	mUnique = is_unique; @@ -1987,8 +1987,8 @@ LLVolume::LLVolume(const LLVolumeParams ¶ms, const F32 detail, const BOOL ge  	mIsMeshAssetLoaded = false;      mIsMeshAssetUnavaliable = false;  	mLODScaleBias.setVec(1,1,1); -	mHullPoints = NULL; -	mHullIndices = NULL; +	mHullPoints = nullptr; +	mHullIndices = nullptr;  	mNumHullPoints = 0;  	mNumHullIndices = 0; @@ -2050,7 +2050,7 @@ LLVolume::~LLVolume()  	mHullIndices = NULL;  } -BOOL LLVolume::generate() +bool LLVolume::generate()  {  	LL_PROFILE_ZONE_SCOPED_CATEGORY_VOLUME @@ -2094,8 +2094,8 @@ BOOL LLVolume::generate()  		}  	} -	BOOL regenPath = mPathp->generate(mParams.getPathParams(), path_detail, split); -	BOOL regenProf = mProfilep->generate(mParams.getProfileParams(), mPathp->isOpen(),profile_detail, split); +	bool regenPath = mPathp->generate(mParams.getPathParams(), path_detail, split); +	bool regenProf = mProfilep->generate(mParams.getProfileParams(), mPathp->isOpen(),profile_detail, split);  	if (regenPath || regenProf )   	{ @@ -2158,11 +2158,11 @@ BOOL LLVolume::generate()  			mFaceMask |= id;  		}  		LL_CHECK_MEMORY -		return TRUE; +		return true;  	}  	LL_CHECK_MEMORY -	return FALSE; +	return false;  }  void LLVolumeFace::VertexData::init() @@ -2808,10 +2808,10 @@ void LLVolume::createVolumeFaces()  	else  	{  		S32 num_faces = getNumFaces(); -		BOOL partial_build = TRUE; +		bool partial_build = true;  		if (num_faces != mVolumeFaces.size())  		{ -			partial_build = FALSE; +			partial_build = false;  			mVolumeFaces.resize(num_faces);  		}  		// Initialize volume faces with parameter data @@ -3046,9 +3046,9 @@ void LLVolume::sculptGenerateSpherePlaceholder()  void LLVolume::sculptGenerateMapVertices(U16 sculpt_width, U16 sculpt_height, S8 sculpt_components, const U8* sculpt_data, U8 sculpt_type)  {  	U8 sculpt_stitching = sculpt_type & LL_SCULPT_TYPE_MASK; -	BOOL sculpt_invert = sculpt_type & LL_SCULPT_FLAG_INVERT; -	BOOL sculpt_mirror = sculpt_type & LL_SCULPT_FLAG_MIRROR; -	BOOL reverse_horizontal = (sculpt_invert ? !sculpt_mirror : sculpt_mirror);  // XOR +	bool sculpt_invert = sculpt_type & LL_SCULPT_FLAG_INVERT; +	bool sculpt_mirror = sculpt_type & LL_SCULPT_FLAG_MIRROR; +	bool reverse_horizontal = (sculpt_invert ? !sculpt_mirror : sculpt_mirror);  // XOR  	S32 sizeS = mPathp->mPath.size();  	S32 sizeT = mProfilep->mProfile.size(); @@ -3133,14 +3133,13 @@ void LLVolume::sculptGenerateMapVertices(U16 sculpt_width, U16 sculpt_height, S8  } -const S32 SCULPT_REZ_1 = 6;  // changed from 4 to 6 - 6 looks round whereas 4 looks square -const S32 SCULPT_REZ_2 = 8; -const S32 SCULPT_REZ_3 = 16; -const S32 SCULPT_REZ_4 = 32; +constexpr S32 SCULPT_REZ_1 = 6;  // changed from 4 to 6 - 6 looks round whereas 4 looks square +constexpr S32 SCULPT_REZ_2 = 8; +constexpr S32 SCULPT_REZ_3 = 16; +constexpr S32 SCULPT_REZ_4 = 32;  S32 sculpt_sides(F32 detail)  { -  	// detail is usually one of: 1, 1.5, 2.5, 4.0.  	if (detail <= 1.0) @@ -3203,12 +3202,12 @@ void LLVolume::sculpt(U16 sculpt_width, U16 sculpt_height, S8 sculpt_components,  {  	U8 sculpt_type = mParams.getSculptType(); -	BOOL data_is_empty = FALSE; +	bool data_is_empty = false;  	if (sculpt_width == 0 || sculpt_height == 0 || sculpt_components < 3 || sculpt_data == NULL)  	{  		sculpt_level = -1; -		data_is_empty = TRUE; +		data_is_empty = true;  	}  	S32 requested_sizeS = 0; @@ -3216,8 +3215,8 @@ void LLVolume::sculpt(U16 sculpt_width, U16 sculpt_height, S8 sculpt_components,  	sculpt_calc_mesh_resolution(sculpt_width, sculpt_height, sculpt_type, mDetail, requested_sizeS, requested_sizeT); -	mPathp->generate(mParams.getPathParams(), mDetail, 0, TRUE, requested_sizeS); -	mProfilep->generate(mParams.getProfileParams(), mPathp->isOpen(), mDetail, 0, TRUE, requested_sizeT); +	mPathp->generate(mParams.getPathParams(), mDetail, 0, true, requested_sizeS); +	mProfilep->generate(mParams.getProfileParams(), mPathp->isOpen(), mDetail, 0, true, requested_sizeT);  	S32 sizeS = mPathp->mPath.size();         // we requested a specific size, now see what we really got  	S32 sizeT = mProfilep->mProfile.size();   // we requested a specific size, now see what we really got @@ -3248,7 +3247,7 @@ void LLVolume::sculpt(U16 sculpt_width, U16 sculpt_height, S8 sculpt_components,  			if (area < SCULPT_MIN_AREA || area > SCULPT_MAX_AREA)  			{ -				data_is_empty = TRUE; +				data_is_empty = true;  				visible_placeholder = true;  			}  		} @@ -3267,8 +3266,6 @@ void LLVolume::sculpt(U16 sculpt_width, U16 sculpt_height, S8 sculpt_components,  		}  	} - -	  	for (S32 i = 0; i < (S32)mProfilep->mFaces.size(); i++)  	{  		mFaceMask |= mProfilep->mFaces[i].mFaceID; @@ -3285,12 +3282,12 @@ void LLVolume::sculpt(U16 sculpt_width, U16 sculpt_height, S8 sculpt_components, -BOOL LLVolume::isCap(S32 face) +bool LLVolume::isCap(S32 face)  {  	return mProfilep->mFaces[face].mCap;   } -BOOL LLVolume::isFlat(S32 face) +bool LLVolume::isFlat(S32 face)  {  	return mProfilep->mFaces[face].mFlat;  } @@ -3353,7 +3350,7 @@ void LLVolumeParams::copyParams(const LLVolumeParams ¶ms)  }  // Less restricitve approx 0 for volumes -const F32 APPROXIMATELY_ZERO = 0.001f; +constexpr F32 APPROXIMATELY_ZERO = 0.001f;  bool approx_zero( F32 f, F32 tolerance = APPROXIMATELY_ZERO)  {  	return (f >= -tolerance) && (f <= tolerance); @@ -3609,7 +3606,7 @@ bool LLVolumeParams::setSkew(const F32 skew_value)  	return valid;  } -bool LLVolumeParams::setSculptID(const LLUUID sculpt_id, U8 sculpt_type) +bool LLVolumeParams::setSculptID(const LLUUID& sculpt_id, U8 sculpt_type)  {  	mSculptID = sculpt_id;  	mSculptType = sculpt_type; @@ -3839,7 +3836,6 @@ void LLVolume::generateSilhouetteVertices(std::vector<LLVector3> &vertices,  		}  		else  		{ -  			//==============================================  			//DEBUG draw edge map instead of silhouette edge  			//============================================== @@ -3921,8 +3917,8 @@ void LLVolume::generateSilhouetteVertices(std::vector<LLVector3> &vertices,  			//DEBUG  			//============================================== -			static const U8 AWAY = 0x01, -							TOWARDS = 0x02; +			constexpr U8 AWAY = 0x01, +						 TOWARDS = 0x02;  			//for each triangle  			std::vector<U8> fFacing; @@ -4192,7 +4188,7 @@ LLVertexIndexPair::LLVertexIndexPair(const LLVector3 &vertex, const S32 index)  	mIndex = index;  } -const F32 VERTEX_SLOP = 0.00001f; +constexpr F32 VERTEX_SLOP = 0.00001f;  struct lessVertex  { @@ -4202,32 +4198,32 @@ struct lessVertex  		if (a->mVertex.mV[0] + slop < b->mVertex.mV[0])  		{ -			return TRUE; +			return true;  		}  		else if (a->mVertex.mV[0] - slop > b->mVertex.mV[0])  		{ -			return FALSE; +			return false;  		}  		if (a->mVertex.mV[1] + slop < b->mVertex.mV[1])  		{ -			return TRUE; +			return true;  		}  		else if (a->mVertex.mV[1] - slop > b->mVertex.mV[1])  		{ -			return FALSE; +			return false;  		}  		if (a->mVertex.mV[2] + slop < b->mVertex.mV[2])  		{ -			return TRUE; +			return true;  		}  		else if (a->mVertex.mV[2] - slop > b->mVertex.mV[2])  		{ -			return FALSE; +			return false;  		} -		return FALSE; +		return false;  	}  }; @@ -4237,45 +4233,45 @@ struct lessTriangle  	{  		if (*a < *b)  		{ -			return TRUE; +			return true;  		}  		else if (*a > *b)  		{ -			return FALSE; +			return false;  		}  		if (*(a+1) < *(b+1))  		{ -			return TRUE; +			return true;  		}  		else if (*(a+1) > *(b+1))  		{ -			return FALSE; +			return false;  		}  		if (*(a+2) < *(b+2))  		{ -			return TRUE; +			return true;  		}  		else if (*(a+2) > *(b+2))  		{ -			return FALSE; +			return false;  		} -		return FALSE; +		return false;  	}  }; -BOOL equalTriangle(const S32 *a, const S32 *b) +bool equalTriangle(const S32 *a, const S32 *b)  {  	if ((*a == *b) && (*(a+1) == *(b+1)) && (*(a+2) == *(b+2)))  	{ -		return TRUE; +		return true;  	} -	return FALSE; +	return false;  } -BOOL LLVolumeParams::importFile(LLFILE *fp) +bool LLVolumeParams::importFile(LLFILE *fp)  {  	//LL_INFOS() << "importing volume" << LL_ENDL;  	const S32 BUFSIZE = 16384; @@ -4315,21 +4311,21 @@ BOOL LLVolumeParams::importFile(LLFILE *fp)  		}  	} -	return TRUE; +	return true;  } -BOOL LLVolumeParams::exportFile(LLFILE *fp) const +bool LLVolumeParams::exportFile(LLFILE *fp) const  {  	fprintf(fp,"\tshape 0\n");  	fprintf(fp,"\t{\n");  	mPathParams.exportFile(fp);  	mProfileParams.exportFile(fp);  	fprintf(fp, "\t}\n"); -	return TRUE; +	return true;  } -BOOL LLVolumeParams::importLegacyStream(std::istream& input_stream) +bool LLVolumeParams::importLegacyStream(std::istream& input_stream)  {  	//LL_INFOS() << "importing volume" << LL_ENDL;  	const S32 BUFSIZE = 16384; @@ -4365,17 +4361,17 @@ BOOL LLVolumeParams::importLegacyStream(std::istream& input_stream)  		}  	} -	return TRUE; +	return true;  } -BOOL LLVolumeParams::exportLegacyStream(std::ostream& output_stream) const +bool LLVolumeParams::exportLegacyStream(std::ostream& output_stream) const  {  	output_stream <<"\tshape 0\n";  	output_stream <<"\t{\n";  	mPathParams.exportLegacyStream(output_stream);  	mProfileParams.exportLegacyStream(output_stream);  	output_stream << "\t}\n"; -	return TRUE; +	return true;  }  LLSD LLVolumeParams::sculptAsLLSD() const @@ -4447,14 +4443,14 @@ void LLVolumeParams::reduceT(F32 begin, F32 end)  const F32 MIN_CONCAVE_PROFILE_WEDGE = 0.125f;	// 1/8 unity  const F32 MIN_CONCAVE_PATH_WEDGE = 0.111111f;	// 1/9 unity -// returns TRUE if the shape can be approximated with a convex shape  +// returns true if the shape can be approximated with a convex shape   // for collison purposes -BOOL LLVolumeParams::isConvex() const +bool LLVolumeParams::isConvex() const  {  	if (!getSculptID().isNull())  	{  		// can't determine, be safe and say no: -		return FALSE; +		return false;  	}  	F32 path_length = mPathParams.getEnd() - mPathParams.getBegin(); @@ -4467,11 +4463,11 @@ BOOL LLVolumeParams::isConvex() const  				 && LL_PCODE_PATH_LINE != path_type) ) )  	{  		// twist along a "not too short" path is concave -		return FALSE; +		return false;  	}  	F32 profile_length = mProfileParams.getEnd() - mProfileParams.getBegin(); -	BOOL same_hole = hollow == 0.f  +	bool same_hole = hollow == 0.f   					 || (mProfileParams.getCurveType() & LL_PCODE_HOLE_MASK) == LL_PCODE_HOLE_SAME;  	F32 min_profile_wedge = MIN_CONCAVE_PROFILE_WEDGE; @@ -4482,7 +4478,7 @@ BOOL LLVolumeParams::isConvex() const  		min_profile_wedge = 2.f * MIN_CONCAVE_PROFILE_WEDGE;  	} -	BOOL convex_profile = ( ( profile_length == 1.f +	bool convex_profile = ( ( profile_length == 1.f  						     || profile_length <= 0.5f )  						   && hollow == 0.f )						// trivially convex  						  || ( profile_length <= min_profile_wedge @@ -4491,36 +4487,36 @@ BOOL LLVolumeParams::isConvex() const  	if (!convex_profile)  	{  		// profile is concave -		return FALSE; +		return false;  	}  	if ( LL_PCODE_PATH_LINE == path_type )  	{  		// straight paths with convex profile -		return TRUE; +		return true;  	} -	BOOL concave_path = (path_length < 1.0f) && (path_length > 0.5f); +	bool concave_path = (path_length < 1.0f) && (path_length > 0.5f);  	if (concave_path)  	{ -		return FALSE; +		return false;  	}  	// we're left with spheres, toroids and tubes  	if ( LL_PCODE_PROFILE_CIRCLE_HALF == profile_type )  	{  		// at this stage all spheres must be convex -		return TRUE; +		return true;  	}  	// it's a toroid or tube		  	if ( path_length <= MIN_CONCAVE_PATH_WEDGE )  	{  		// effectively convex -		return TRUE; +		return true;  	} -	return FALSE; +	return false;  }  // debug @@ -4598,7 +4594,7 @@ LLFaceID LLVolume::generateFaceMask()  	return new_mask;  } -BOOL LLVolume::isFaceMaskValid(LLFaceID face_mask) +bool LLVolume::isFaceMaskValid(LLFaceID face_mask)  {  	LLFaceID test_mask = 0;  	for(S32 i = 0; i < getNumFaces(); i++) @@ -4609,9 +4605,9 @@ BOOL LLVolume::isFaceMaskValid(LLFaceID face_mask)  	return test_mask == face_mask;  } -BOOL LLVolume::isConvex() const +bool LLVolume::isConvex() const  { -	// mParams.isConvex() may return FALSE even though the final +	// mParams.isConvex() may return false even though the final  	// geometry is actually convex due to LOD approximations.  	// TODO -- provide LLPath and LLProfile with isConvex() methods  	// that correctly determine convexity. -- Leviathan @@ -4717,10 +4713,10 @@ LLVolumeFace::LLVolumeFace() :      mJustWeights(NULL),      mJointIndices(NULL),  #endif -    mWeightsScrubbed(FALSE), +    mWeightsScrubbed(false),  	mOctree(NULL),      mOctreeTriangles(NULL), -	mOptimized(FALSE) +	mOptimized(false)  {  	mExtents = (LLVector4a*) ll_aligned_malloc_16(sizeof(LLVector4a)*3);  	mExtents[0].splat(-0.5f); @@ -4748,7 +4744,7 @@ LLVolumeFace::LLVolumeFace(const LLVolumeFace& src)      mJustWeights(NULL),      mJointIndices(NULL),  #endif -    mWeightsScrubbed(FALSE), +    mWeightsScrubbed(false),      mOctree(NULL),      mOctreeTriangles(NULL)  { @@ -4815,14 +4811,14 @@ LLVolumeFace& LLVolumeFace::operator=(const LLVolumeFace& src)  		{              llassert(!mWeights); // don't orphan an old alloc here accidentally  			allocateWeights(src.mNumVertices); -			LLVector4a::memcpyNonAliased16((F32*) mWeights, (F32*) src.mWeights, vert_size);             +			LLVector4a::memcpyNonAliased16((F32*) mWeights, (F32*) src.mWeights, vert_size);              mWeightsScrubbed = src.mWeightsScrubbed;  		}  		else  		{ -			ll_aligned_free_16(mWeights);             -			mWeights = NULL;             -            mWeightsScrubbed = FALSE; +			ll_aligned_free_16(mWeights); +			mWeights = NULL; +            mWeightsScrubbed = false;  		}         #if USE_SEPARATE_JOINT_INDICES_AND_WEIGHTS @@ -4895,7 +4891,7 @@ void LLVolumeFace::freeData()      destroyOctree();  } -BOOL LLVolumeFace::create(LLVolume* volume, BOOL partial_build) +bool LLVolumeFace::create(LLVolume* volume, bool partial_build)  {  	LL_PROFILE_ZONE_SCOPED_CATEGORY_VOLUME @@ -4903,7 +4899,7 @@ BOOL LLVolumeFace::create(LLVolume* volume, BOOL partial_build)      destroyOctree();  	LL_CHECK_MEMORY -	BOOL ret = FALSE ; +	bool ret = false ;  	if (mTypeMask & CAP_MASK)  	{  		ret = createCap(volume, partial_build); @@ -5039,7 +5035,7 @@ void LLVolumeFace::optimize(F32 angle_cutoff)  		LLVolumeFace::VertexData cv;  		getVertexData(index, cv); -		BOOL found = FALSE; +		bool found = false;  		LLVector4a pos;  		pos.setSub(mPositions[index], mExtents[0]); @@ -5060,7 +5056,7 @@ void LLVolumeFace::optimize(F32 angle_cutoff)  				LLVolumeFace::VertexData& tv = (point_iter->second)[j];  				if (tv.compareNormal(cv, angle_cutoff))  				{ -					found = TRUE; +					found = true;  					new_face.pushIndex((point_iter->second)[j].mIndex);  					break;  				} @@ -5167,12 +5163,12 @@ public:  	}  }; -const F64 FindVertexScore_CacheDecayPower = 1.5; -const F64 FindVertexScore_LastTriScore = 0.75; -const F64 FindVertexScore_ValenceBoostScale = 2.0; -const F64 FindVertexScore_ValenceBoostPower = 0.5; -const U32 MaxSizeVertexCache = 32; -const F64 FindVertexScore_Scaler = 1.0/(MaxSizeVertexCache-3); +constexpr F64 FindVertexScore_CacheDecayPower = 1.5; +constexpr F64 FindVertexScore_LastTriScore = 0.75; +constexpr F64 FindVertexScore_ValenceBoostScale = 2.0; +constexpr F64 FindVertexScore_ValenceBoostPower = 0.5; +constexpr U32 MaxSizeVertexCache = 32; +constexpr F64 FindVertexScore_Scaler = 1.0/(MaxSizeVertexCache-3);  F64 find_vertex_score(LLVCacheVertexData& data)  { @@ -5475,7 +5471,7 @@ bool LLVolumeFace::cacheOptimize(bool gen_tangents)  { //optimize for vertex cache according to Forsyth method:       LL_PROFILE_ZONE_SCOPED_CATEGORY_VOLUME;  	llassert(!mOptimized); -	mOptimized = TRUE; +	mOptimized = true;      if (gen_tangents && mNormals && mTexCoords)      { // generate mikkt space tangents before cache optimizing since the index buffer may change @@ -5706,7 +5702,7 @@ void	LerpPlanarVertex(LLVolumeFace::VertexData& v0,  	vout.setNormal(v0.getNormal());  } -BOOL LLVolumeFace::createUnCutCubeCap(LLVolume* volume, BOOL partial_build) +bool LLVolumeFace::createUnCutCubeCap(LLVolume* volume, bool partial_build)  {  	LL_CHECK_MEMORY		 @@ -5938,11 +5934,11 @@ BOOL LLVolumeFace::createUnCutCubeCap(LLVolume* volume, BOOL partial_build)  	}  	LL_CHECK_MEMORY -	return TRUE; +	return true;  } -BOOL LLVolumeFace::createCap(LLVolume* volume, BOOL partial_build) +bool LLVolumeFace::createCap(LLVolume* volume, bool partial_build)  {  	if (!(mTypeMask & HOLLOW_MASK) &&   		!(mTypeMask & OPEN_MASK) &&  @@ -6099,7 +6095,7 @@ BOOL LLVolumeFace::createCap(LLVolume* volume, BOOL partial_build)  	//if (partial_build)  	//{ -	//	return TRUE; +	//	return true;  	//}  	if (mTypeMask & HOLLOW_MASK) @@ -6148,36 +6144,36 @@ BOOL LLVolumeFace::createCap(LLVolume* volume, BOOL partial_build)  							(paV[0]*pbV[1] - pbV[0]*paV[1]) +  							(pbV[0]*p2V[1] - p2V[0]*pbV[1]); -				BOOL use_tri1a2 = TRUE; -				BOOL tri_1a2 = TRUE; -				BOOL tri_21b = TRUE; +				bool use_tri1a2 = true; +				bool tri_1a2 = true; +				bool tri_21b = true;  				if (area_1a2 < 0)  				{ -					tri_1a2 = FALSE; +					tri_1a2 = false;  				}  				if (area_2ab < 0)  				{  					// Can't use, because it contains point b -					tri_1a2 = FALSE; +					tri_1a2 = false;  				}  				if (area_21b < 0)  				{ -					tri_21b = FALSE; +					tri_21b = false;  				}  				if (area_1ba < 0)  				{  					// Can't use, because it contains point b -					tri_21b = FALSE; +					tri_21b = false;  				}  				if (!tri_1a2)  				{ -					use_tri1a2 = FALSE; +					use_tri1a2 = false;  				}  				else if (!tri_21b)  				{ -					use_tri1a2 = TRUE; +					use_tri1a2 = true;  				}  				else  				{ @@ -6189,11 +6185,11 @@ BOOL LLVolumeFace::createCap(LLVolume* volume, BOOL partial_build)  					if (d1.dot3(d1) < d2.dot3(d2))  					{ -						use_tri1a2 = TRUE; +						use_tri1a2 = true;  					}  					else  					{ -						use_tri1a2 = FALSE; +						use_tri1a2 = false;  					}  				} @@ -6254,36 +6250,36 @@ BOOL LLVolumeFace::createCap(LLVolume* volume, BOOL partial_build)  							(paV[0]*pbV[1] - pbV[0]*paV[1]) +  							(pbV[0]*p2V[1] - p2V[0]*pbV[1]); -				BOOL use_tri1a2 = TRUE; -				BOOL tri_1a2 = TRUE; -				BOOL tri_21b = TRUE; +				bool use_tri1a2 = true; +				bool tri_1a2 = true; +				bool tri_21b = true;  				if (area_1a2 < 0)  				{ -					tri_1a2 = FALSE; +					tri_1a2 = false;  				}  				if (area_2ab < 0)  				{  					// Can't use, because it contains point b -					tri_1a2 = FALSE; +					tri_1a2 = false;  				}  				if (area_21b < 0)  				{ -					tri_21b = FALSE; +					tri_21b = false;  				}  				if (area_1ba < 0)  				{  					// Can't use, because it contains point b -					tri_21b = FALSE; +					tri_21b = false;  				}  				if (!tri_1a2)  				{ -					use_tri1a2 = FALSE; +					use_tri1a2 = false;  				}  				else if (!tri_21b)  				{ -					use_tri1a2 = TRUE; +					use_tri1a2 = true;  				}  				else  				{ @@ -6294,11 +6290,11 @@ BOOL LLVolumeFace::createCap(LLVolume* volume, BOOL partial_build)  					if (d1.dot3(d1) < d2.dot3(d2))  					{ -						use_tri1a2 = TRUE; +						use_tri1a2 = true;  					}  					else  					{ -						use_tri1a2 = FALSE; +						use_tri1a2 = false;  					}  				} @@ -6377,7 +6373,7 @@ BOOL LLVolumeFace::createCap(LLVolume* volume, BOOL partial_build)  		norm[i].load4a(normal.getF32ptr());  	} -	return TRUE; +	return true;  }  void LLVolumeFace::createTangents() @@ -6592,18 +6588,18 @@ void LLVolumeFace::fillFromLegacyData(std::vector<LLVolumeFace::VertexData>& v,  	}  } -BOOL LLVolumeFace::createSide(LLVolume* volume, BOOL partial_build) +bool LLVolumeFace::createSide(LLVolume* volume, bool partial_build)  {  	LL_PROFILE_ZONE_SCOPED_CATEGORY_VOLUME  	LL_CHECK_MEMORY -	BOOL flat = mTypeMask & FLAT_MASK; +	bool flat = mTypeMask & FLAT_MASK;  	U8 sculpt_type = volume->getParams().getSculptType();  	U8 sculpt_stitching = sculpt_type & LL_SCULPT_TYPE_MASK; -	BOOL sculpt_invert = sculpt_type & LL_SCULPT_FLAG_INVERT; -	BOOL sculpt_mirror = sculpt_type & LL_SCULPT_FLAG_MIRROR; -	BOOL sculpt_reverse_horizontal = (sculpt_invert ? !sculpt_mirror : sculpt_mirror);  // XOR +	bool sculpt_invert = sculpt_type & LL_SCULPT_FLAG_INVERT; +	bool sculpt_mirror = sculpt_type & LL_SCULPT_FLAG_MIRROR; +	bool sculpt_reverse_horizontal = (sculpt_invert ? !sculpt_mirror : sculpt_mirror);  // XOR  	S32 num_vertices, num_indices; @@ -6619,7 +6615,7 @@ BOOL LLVolumeFace::createSide(LLVolume* volume, BOOL partial_build)  	num_vertices = mNumS*mNumT;  	num_indices = (mNumS-1)*(mNumT-1)*6; -	partial_build = (num_vertices > mNumVertices || num_indices > mNumIndices) ? FALSE : partial_build; +	partial_build = (num_vertices > mNumVertices || num_indices > mNumIndices) ? false : partial_build;  	if (!partial_build)  	{ @@ -6790,7 +6786,7 @@ BOOL LLVolumeFace::createSide(LLVolume* volume, BOOL partial_build)  	S32 cur_index = 0;  	S32 cur_edge = 0; -	BOOL flat_face = mTypeMask & FLAT_MASK; +	bool flat_face = mTypeMask & FLAT_MASK;  	if (!partial_build)  	{ @@ -6810,7 +6806,7 @@ BOOL LLVolumeFace::createSide(LLVolume* volume, BOOL partial_build)  				if (t < mNumT-2) {												//top right/top left neighbor face   					mEdge[cur_edge++] = (mNumS-1)*2*(t+1)+s*2+1;  				} -				else if (mNumT <= 3 || volume->getPath().isOpen() == TRUE) { //no neighbor +				else if (mNumT <= 3 || volume->getPath().isOpen() == true) { //no neighbor  					mEdge[cur_edge++] = -1;  				}  				else { //wrap on T @@ -6819,7 +6815,7 @@ BOOL LLVolumeFace::createSide(LLVolume* volume, BOOL partial_build)  				if (s > 0) {													//top left/bottom left neighbor face  					mEdge[cur_edge++] = (mNumS-1)*2*t+s*2-1;  				} -				else if (flat_face ||  volume->getProfile().isOpen() == TRUE) { //no neighbor +				else if (flat_face ||  volume->getProfile().isOpen() == true) { //no neighbor  					mEdge[cur_edge++] = -1;  				}  				else {	//wrap on S @@ -6829,7 +6825,7 @@ BOOL LLVolumeFace::createSide(LLVolume* volume, BOOL partial_build)  				if (t > 0) {													//bottom left/bottom right neighbor face  					mEdge[cur_edge++] = (mNumS-1)*2*(t-1)+s*2;  				} -				else if (mNumT <= 3 || volume->getPath().isOpen() == TRUE) { //no neighbor +				else if (mNumT <= 3 || volume->getPath().isOpen() == true) { //no neighbor  					mEdge[cur_edge++] = -1;  				}  				else { //wrap on T @@ -6838,7 +6834,7 @@ BOOL LLVolumeFace::createSide(LLVolume* volume, BOOL partial_build)  				if (s < mNumS-2) {												//bottom right/top right neighbor face  					mEdge[cur_edge++] = (mNumS-1)*2*t+(s+1)*2;  				} -				else if (flat_face || volume->getProfile().isOpen() == TRUE) { //no neighbor +				else if (flat_face || volume->getProfile().isOpen() == true) { //no neighbor  					mEdge[cur_edge++] = -1;  				}  				else { //wrap on S @@ -6974,14 +6970,14 @@ BOOL LLVolumeFace::createSide(LLVolume* volume, BOOL partial_build)  	LLVector4a top;  	top.setSub(pos[0], pos[mNumS*(mNumT-2)]); -	BOOL s_bottom_converges = (top.dot3(top) < 0.000001f); +	bool s_bottom_converges = (top.dot3(top) < 0.000001f);  	top.setSub(pos[mNumS-1], pos[mNumS*(mNumT-2)+mNumS-1]); -	BOOL s_top_converges = (top.dot3(top) < 0.000001f); +	bool s_top_converges = (top.dot3(top) < 0.000001f);  	if (sculpt_stitching == LL_SCULPT_TYPE_NONE)  // logic for non-sculpt volumes  	{ -		if (volume->getPath().isOpen() == FALSE) +		if (volume->getPath().isOpen() == false)  		{ //wrap normals on T  			for (S32 i = 0; i < mNumS; i++)  			{ @@ -6992,7 +6988,7 @@ BOOL LLVolumeFace::createSide(LLVolume* volume, BOOL partial_build)  			}  		} -		if ((volume->getProfile().isOpen() == FALSE) && !(s_bottom_converges)) +		if ((volume->getProfile().isOpen() == false) && !(s_bottom_converges))  		{ //wrap normals on S  			for (S32 i = 0; i < mNumT; i++)  			{ @@ -7025,20 +7021,20 @@ BOOL LLVolumeFace::createSide(LLVolume* volume, BOOL partial_build)  	}  	else  // logic for sculpt volumes  	{ -		BOOL average_poles = FALSE; -		BOOL wrap_s = FALSE; -		BOOL wrap_t = FALSE; +		bool average_poles = false; +		bool wrap_s = false; +		bool wrap_t = false;  		if (sculpt_stitching == LL_SCULPT_TYPE_SPHERE) -			average_poles = TRUE; +			average_poles = true;  		if ((sculpt_stitching == LL_SCULPT_TYPE_SPHERE) ||  			(sculpt_stitching == LL_SCULPT_TYPE_TORUS) ||  			(sculpt_stitching == LL_SCULPT_TYPE_CYLINDER)) -			wrap_s = TRUE; +			wrap_s = true;  		if (sculpt_stitching == LL_SCULPT_TYPE_TORUS) -			wrap_t = TRUE; +			wrap_t = true;  		if (average_poles) @@ -7103,7 +7099,7 @@ BOOL LLVolumeFace::createSide(LLVolume* volume, BOOL partial_build)  	LL_CHECK_MEMORY -	return TRUE; +	return true;  }  //adapted from Lengyel, Eric. "Computing Tangent Space Basis Vectors for an Arbitrary Mesh". Terathon Software 3D Graphics Library, 2001. http://www.terathon.com/code/tangent.html diff --git a/indra/llmath/llvolume.h b/indra/llmath/llvolume.h index ccc0671315..98ad456396 100644 --- a/indra/llmath/llvolume.h +++ b/indra/llmath/llvolume.h @@ -63,146 +63,146 @@ class LLVolumeOctree;  //============================================================================ -const S32 MIN_DETAIL_FACES = 6; -const S32 MIN_LOD = 0; -const S32 MAX_LOD = 3; +constexpr S32 MIN_DETAIL_FACES = 6; +constexpr S32 MIN_LOD = 0; +constexpr S32 MAX_LOD = 3;  // These are defined here but are not enforced at this level,  // rather they are here for the convenience of code that uses  // the LLVolume class. -const F32 MIN_VOLUME_PROFILE_WIDTH 	= 0.05f; -const F32 MIN_VOLUME_PATH_WIDTH 	= 0.05f; +constexpr F32 MIN_VOLUME_PROFILE_WIDTH 	= 0.05f; +constexpr F32 MIN_VOLUME_PATH_WIDTH 	= 0.05f; -const F32 CUT_QUANTA    = 0.00002f; -const F32 SCALE_QUANTA  = 0.01f; -const F32 SHEAR_QUANTA  = 0.01f; -const F32 TAPER_QUANTA  = 0.01f; -const F32 REV_QUANTA    = 0.015f; -const F32 HOLLOW_QUANTA = 0.00002f; +constexpr F32 CUT_QUANTA    = 0.00002f; +constexpr F32 SCALE_QUANTA  = 0.01f; +constexpr F32 SHEAR_QUANTA  = 0.01f; +constexpr F32 TAPER_QUANTA  = 0.01f; +constexpr F32 REV_QUANTA    = 0.015f; +constexpr F32 HOLLOW_QUANTA = 0.00002f; -const S32 MAX_VOLUME_TRIANGLE_INDICES = 10000; +constexpr S32 MAX_VOLUME_TRIANGLE_INDICES = 10000;  //============================================================================  // useful masks -const LLPCode LL_PCODE_HOLLOW_MASK 	= 0x80;		// has a thickness -const LLPCode LL_PCODE_SEGMENT_MASK = 0x40;		// segments (1 angle) -const LLPCode LL_PCODE_PATCH_MASK 	= 0x20;		// segmented segments (2 angles) -const LLPCode LL_PCODE_HEMI_MASK 	= 0x10;		// half-primitives get their own type per PR's dictum -const LLPCode LL_PCODE_BASE_MASK 	= 0x0F; +constexpr LLPCode LL_PCODE_HOLLOW_MASK 	= 0x80;		// has a thickness +constexpr LLPCode LL_PCODE_SEGMENT_MASK = 0x40;		// segments (1 angle) +constexpr LLPCode LL_PCODE_PATCH_MASK 	= 0x20;		// segmented segments (2 angles) +constexpr LLPCode LL_PCODE_HEMI_MASK 	= 0x10;		// half-primitives get their own type per PR's dictum +constexpr LLPCode LL_PCODE_BASE_MASK 	= 0x0F;  	// primitive shapes -const LLPCode	LL_PCODE_CUBE 			= 1; -const LLPCode	LL_PCODE_PRISM 			= 2; -const LLPCode	LL_PCODE_TETRAHEDRON 	= 3; -const LLPCode	LL_PCODE_PYRAMID 		= 4; -const LLPCode	LL_PCODE_CYLINDER 		= 5; -const LLPCode	LL_PCODE_CONE 			= 6; -const LLPCode	LL_PCODE_SPHERE 		= 7; -const LLPCode	LL_PCODE_TORUS 			= 8; -const LLPCode	LL_PCODE_VOLUME			= 9; +constexpr LLPCode	LL_PCODE_CUBE 			= 1; +constexpr LLPCode	LL_PCODE_PRISM 			= 2; +constexpr LLPCode	LL_PCODE_TETRAHEDRON 	= 3; +constexpr LLPCode	LL_PCODE_PYRAMID 		= 4; +constexpr LLPCode	LL_PCODE_CYLINDER 		= 5; +constexpr LLPCode	LL_PCODE_CONE 			= 6; +constexpr LLPCode	LL_PCODE_SPHERE 		= 7; +constexpr LLPCode	LL_PCODE_TORUS 			= 8; +constexpr LLPCode	LL_PCODE_VOLUME			= 9;  	// surfaces -//const LLPCode	LL_PCODE_SURFACE_TRIANGLE 	= 10; -//const LLPCode	LL_PCODE_SURFACE_SQUARE 	= 11; -//const LLPCode	LL_PCODE_SURFACE_DISC 		= 12; +//constexpr LLPCode	LL_PCODE_SURFACE_TRIANGLE 	= 10; +//constexpr LLPCode	LL_PCODE_SURFACE_SQUARE 	= 11; +//constexpr LLPCode	LL_PCODE_SURFACE_DISC 		= 12; -const LLPCode	LL_PCODE_APP				= 14; // App specific pcode (for viewer/sim side only objects) -const LLPCode	LL_PCODE_LEGACY				= 15; +constexpr LLPCode	LL_PCODE_APP				= 14; // App specific pcode (for viewer/sim side only objects) +constexpr LLPCode	LL_PCODE_LEGACY				= 15;  // Pcodes for legacy objects -//const LLPCode	LL_PCODE_LEGACY_ATOR =				0x10 | LL_PCODE_LEGACY; // ATOR -const LLPCode	LL_PCODE_LEGACY_AVATAR =			0x20 | LL_PCODE_LEGACY; // PLAYER -//const LLPCode	LL_PCODE_LEGACY_BIRD =				0x30 | LL_PCODE_LEGACY; // BIRD -//const LLPCode	LL_PCODE_LEGACY_DEMON =				0x40 | LL_PCODE_LEGACY; // DEMON -const LLPCode	LL_PCODE_LEGACY_GRASS =				0x50 | LL_PCODE_LEGACY; // GRASS -const LLPCode	LL_PCODE_TREE_NEW =					0x60 | LL_PCODE_LEGACY; // new trees -//const LLPCode	LL_PCODE_LEGACY_ORACLE =			0x70 | LL_PCODE_LEGACY; // ORACLE -const LLPCode	LL_PCODE_LEGACY_PART_SYS =			0x80 | LL_PCODE_LEGACY; // PART_SYS -const LLPCode	LL_PCODE_LEGACY_ROCK =				0x90 | LL_PCODE_LEGACY; // ROCK -//const LLPCode	LL_PCODE_LEGACY_SHOT =				0xA0 | LL_PCODE_LEGACY; // BASIC_SHOT -//const LLPCode	LL_PCODE_LEGACY_SHOT_BIG =			0xB0 | LL_PCODE_LEGACY; -//const LLPCode	LL_PCODE_LEGACY_SMOKE =				0xC0 | LL_PCODE_LEGACY; // SMOKE -//const LLPCode	LL_PCODE_LEGACY_SPARK =				0xD0 | LL_PCODE_LEGACY;// SPARK -const LLPCode	LL_PCODE_LEGACY_TEXT_BUBBLE =		0xE0 | LL_PCODE_LEGACY; // TEXTBUBBLE -const LLPCode	LL_PCODE_LEGACY_TREE =				0xF0 | LL_PCODE_LEGACY; // TREE +//constexpr LLPCode	LL_PCODE_LEGACY_ATOR =				0x10 | LL_PCODE_LEGACY; // ATOR +constexpr LLPCode	LL_PCODE_LEGACY_AVATAR =			0x20 | LL_PCODE_LEGACY; // PLAYER +//constexpr LLPCode	LL_PCODE_LEGACY_BIRD =				0x30 | LL_PCODE_LEGACY; // BIRD +//constexpr LLPCode	LL_PCODE_LEGACY_DEMON =				0x40 | LL_PCODE_LEGACY; // DEMON +constexpr LLPCode	LL_PCODE_LEGACY_GRASS =				0x50 | LL_PCODE_LEGACY; // GRASS +constexpr LLPCode	LL_PCODE_TREE_NEW =					0x60 | LL_PCODE_LEGACY; // new trees +//constexpr LLPCode	LL_PCODE_LEGACY_ORACLE =			0x70 | LL_PCODE_LEGACY; // ORACLE +constexpr LLPCode	LL_PCODE_LEGACY_PART_SYS =			0x80 | LL_PCODE_LEGACY; // PART_SYS +constexpr LLPCode	LL_PCODE_LEGACY_ROCK =				0x90 | LL_PCODE_LEGACY; // ROCK +//constexpr LLPCode	LL_PCODE_LEGACY_SHOT =				0xA0 | LL_PCODE_LEGACY; // BASIC_SHOT +//constexpr LLPCode	LL_PCODE_LEGACY_SHOT_BIG =			0xB0 | LL_PCODE_LEGACY; +//constexpr LLPCode	LL_PCODE_LEGACY_SMOKE =				0xC0 | LL_PCODE_LEGACY; // SMOKE +//constexpr LLPCode	LL_PCODE_LEGACY_SPARK =				0xD0 | LL_PCODE_LEGACY;// SPARK +constexpr LLPCode	LL_PCODE_LEGACY_TEXT_BUBBLE =		0xE0 | LL_PCODE_LEGACY; // TEXTBUBBLE +constexpr LLPCode	LL_PCODE_LEGACY_TREE =				0xF0 | LL_PCODE_LEGACY; // TREE  	// hemis -const LLPCode	LL_PCODE_CYLINDER_HEMI =		LL_PCODE_CYLINDER	| LL_PCODE_HEMI_MASK; -const LLPCode	LL_PCODE_CONE_HEMI =			LL_PCODE_CONE		| LL_PCODE_HEMI_MASK; -const LLPCode	LL_PCODE_SPHERE_HEMI =			LL_PCODE_SPHERE		| LL_PCODE_HEMI_MASK; -const LLPCode	LL_PCODE_TORUS_HEMI =			LL_PCODE_TORUS		| LL_PCODE_HEMI_MASK; +constexpr LLPCode	LL_PCODE_CYLINDER_HEMI =		LL_PCODE_CYLINDER	| LL_PCODE_HEMI_MASK; +constexpr LLPCode	LL_PCODE_CONE_HEMI =			LL_PCODE_CONE		| LL_PCODE_HEMI_MASK; +constexpr LLPCode	LL_PCODE_SPHERE_HEMI =			LL_PCODE_SPHERE		| LL_PCODE_HEMI_MASK; +constexpr LLPCode	LL_PCODE_TORUS_HEMI =			LL_PCODE_TORUS		| LL_PCODE_HEMI_MASK;  // Volumes consist of a profile at the base that is swept around  // a path to make a volume.  // The profile code -const U8	LL_PCODE_PROFILE_MASK		= 0x0f; -const U8	LL_PCODE_PROFILE_MIN		= 0x00; -const U8    LL_PCODE_PROFILE_CIRCLE		= 0x00; -const U8    LL_PCODE_PROFILE_SQUARE		= 0x01; -const U8	LL_PCODE_PROFILE_ISOTRI		= 0x02; -const U8    LL_PCODE_PROFILE_EQUALTRI	= 0x03; -const U8    LL_PCODE_PROFILE_RIGHTTRI	= 0x04; -const U8	LL_PCODE_PROFILE_CIRCLE_HALF = 0x05; -const U8	LL_PCODE_PROFILE_MAX		= 0x05; +constexpr U8	LL_PCODE_PROFILE_MASK		= 0x0f; +constexpr U8	LL_PCODE_PROFILE_MIN		= 0x00; +constexpr U8    LL_PCODE_PROFILE_CIRCLE		= 0x00; +constexpr U8    LL_PCODE_PROFILE_SQUARE		= 0x01; +constexpr U8	LL_PCODE_PROFILE_ISOTRI		= 0x02; +constexpr U8    LL_PCODE_PROFILE_EQUALTRI	= 0x03; +constexpr U8    LL_PCODE_PROFILE_RIGHTTRI	= 0x04; +constexpr U8	LL_PCODE_PROFILE_CIRCLE_HALF = 0x05; +constexpr U8	LL_PCODE_PROFILE_MAX		= 0x05;  // Stored in the profile byte -const U8	LL_PCODE_HOLE_MASK		= 0xf0; -const U8	LL_PCODE_HOLE_MIN		= 0x00;	   -const U8	LL_PCODE_HOLE_SAME		= 0x00;		// same as outside profile -const U8	LL_PCODE_HOLE_CIRCLE	= 0x10; -const U8	LL_PCODE_HOLE_SQUARE	= 0x20; -const U8	LL_PCODE_HOLE_TRIANGLE	= 0x30; -const U8	LL_PCODE_HOLE_MAX		= 0x03;		// min/max needs to be >> 4 of real min/max - -const U8    LL_PCODE_PATH_IGNORE    = 0x00; -const U8	LL_PCODE_PATH_MIN		= 0x01;		// min/max needs to be >> 4 of real min/max -const U8    LL_PCODE_PATH_LINE      = 0x10; -const U8    LL_PCODE_PATH_CIRCLE    = 0x20; -const U8    LL_PCODE_PATH_CIRCLE2   = 0x30; -const U8    LL_PCODE_PATH_TEST      = 0x40; -const U8    LL_PCODE_PATH_FLEXIBLE  = 0x80; -const U8	LL_PCODE_PATH_MAX		= 0x08; +constexpr U8	LL_PCODE_HOLE_MASK		= 0xf0; +constexpr U8	LL_PCODE_HOLE_MIN		= 0x00; +constexpr U8	LL_PCODE_HOLE_SAME		= 0x00;		// same as outside profile +constexpr U8	LL_PCODE_HOLE_CIRCLE	= 0x10; +constexpr U8	LL_PCODE_HOLE_SQUARE	= 0x20; +constexpr U8	LL_PCODE_HOLE_TRIANGLE	= 0x30; +constexpr U8	LL_PCODE_HOLE_MAX		= 0x03;		// min/max needs to be >> 4 of real min/max + +constexpr U8    LL_PCODE_PATH_IGNORE    = 0x00; +constexpr U8	LL_PCODE_PATH_MIN		= 0x01;		// min/max needs to be >> 4 of real min/max +constexpr U8    LL_PCODE_PATH_LINE      = 0x10; +constexpr U8    LL_PCODE_PATH_CIRCLE    = 0x20; +constexpr U8    LL_PCODE_PATH_CIRCLE2   = 0x30; +constexpr U8    LL_PCODE_PATH_TEST      = 0x40; +constexpr U8    LL_PCODE_PATH_FLEXIBLE  = 0x80; +constexpr U8	LL_PCODE_PATH_MAX		= 0x08;  //============================================================================  // face identifiers  typedef U16 LLFaceID; -const LLFaceID	LL_FACE_PATH_BEGIN		= 0x1 << 0; -const LLFaceID	LL_FACE_PATH_END		= 0x1 << 1; -const LLFaceID	LL_FACE_INNER_SIDE		= 0x1 << 2; -const LLFaceID	LL_FACE_PROFILE_BEGIN	= 0x1 << 3; -const LLFaceID	LL_FACE_PROFILE_END		= 0x1 << 4; -const LLFaceID	LL_FACE_OUTER_SIDE_0	= 0x1 << 5; -const LLFaceID	LL_FACE_OUTER_SIDE_1	= 0x1 << 6; -const LLFaceID	LL_FACE_OUTER_SIDE_2	= 0x1 << 7; -const LLFaceID	LL_FACE_OUTER_SIDE_3	= 0x1 << 8; +constexpr LLFaceID	LL_FACE_PATH_BEGIN		= 0x1 << 0; +constexpr LLFaceID	LL_FACE_PATH_END		= 0x1 << 1; +constexpr LLFaceID	LL_FACE_INNER_SIDE		= 0x1 << 2; +constexpr LLFaceID	LL_FACE_PROFILE_BEGIN	= 0x1 << 3; +constexpr LLFaceID	LL_FACE_PROFILE_END		= 0x1 << 4; +constexpr LLFaceID	LL_FACE_OUTER_SIDE_0	= 0x1 << 5; +constexpr LLFaceID	LL_FACE_OUTER_SIDE_1	= 0x1 << 6; +constexpr LLFaceID	LL_FACE_OUTER_SIDE_2	= 0x1 << 7; +constexpr LLFaceID	LL_FACE_OUTER_SIDE_3	= 0x1 << 8;  //============================================================================  // sculpt types + flags -const U8 LL_SCULPT_TYPE_NONE      = 0; -const U8 LL_SCULPT_TYPE_SPHERE    = 1; -const U8 LL_SCULPT_TYPE_TORUS     = 2; -const U8 LL_SCULPT_TYPE_PLANE     = 3; -const U8 LL_SCULPT_TYPE_CYLINDER  = 4; -const U8 LL_SCULPT_TYPE_MESH      = 5; -const U8 LL_SCULPT_TYPE_MASK      = LL_SCULPT_TYPE_SPHERE | LL_SCULPT_TYPE_TORUS | LL_SCULPT_TYPE_PLANE | +constexpr U8 LL_SCULPT_TYPE_NONE      = 0; +constexpr U8 LL_SCULPT_TYPE_SPHERE    = 1; +constexpr U8 LL_SCULPT_TYPE_TORUS     = 2; +constexpr U8 LL_SCULPT_TYPE_PLANE     = 3; +constexpr U8 LL_SCULPT_TYPE_CYLINDER  = 4; +constexpr U8 LL_SCULPT_TYPE_MESH      = 5; +constexpr U8 LL_SCULPT_TYPE_MASK      = LL_SCULPT_TYPE_SPHERE | LL_SCULPT_TYPE_TORUS | LL_SCULPT_TYPE_PLANE |  	LL_SCULPT_TYPE_CYLINDER | LL_SCULPT_TYPE_MESH;  // for value checks, assign new value after adding new types -const U8 LL_SCULPT_TYPE_MAX = LL_SCULPT_TYPE_MESH; +constexpr U8 LL_SCULPT_TYPE_MAX = LL_SCULPT_TYPE_MESH; -const U8 LL_SCULPT_FLAG_INVERT    = 64; -const U8 LL_SCULPT_FLAG_MIRROR    = 128; -const U8 LL_SCULPT_FLAG_MASK = LL_SCULPT_FLAG_INVERT | LL_SCULPT_FLAG_MIRROR; +constexpr U8 LL_SCULPT_FLAG_INVERT    = 64; +constexpr U8 LL_SCULPT_FLAG_MIRROR    = 128; +constexpr U8 LL_SCULPT_FLAG_MASK = LL_SCULPT_FLAG_INVERT | LL_SCULPT_FLAG_MIRROR; -const S32 LL_SCULPT_MESH_MAX_FACES = 8; +constexpr S32 LL_SCULPT_MESH_MAX_FACES = 8; -extern BOOL gDebugGL; +extern bool gDebugGL;  class LLProfileParams  { @@ -255,11 +255,11 @@ public:  	void copyParams(const LLProfileParams ¶ms); -	BOOL importFile(LLFILE *fp); -	BOOL exportFile(LLFILE *fp) const; +	bool importFile(LLFILE *fp); +	bool exportFile(LLFILE *fp) const; -	BOOL importLegacyStream(std::istream& input_stream); -	BOOL exportLegacyStream(std::ostream& output_stream) const; +	bool importLegacyStream(std::istream& input_stream); +	bool exportLegacyStream(std::ostream& output_stream) const;  	LLSD asLLSD() const;  	operator LLSD() const { return asLLSD(); } @@ -391,11 +391,11 @@ public:  	void copyParams(const LLPathParams ¶ms); -	BOOL importFile(LLFILE *fp); -	BOOL exportFile(LLFILE *fp) const; +	bool importFile(LLFILE *fp); +	bool exportFile(LLFILE *fp) const; -	BOOL importLegacyStream(std::istream& input_stream); -	BOOL exportLegacyStream(std::ostream& output_stream) const; +	bool importLegacyStream(std::istream& input_stream); +	bool exportLegacyStream(std::ostream& output_stream) const;  	LLSD asLLSD() const;  	operator LLSD() const { return asLLSD(); } @@ -583,11 +583,11 @@ public:  	const LLPathParams &getPathParams() const {return mPathParams;}  	LLPathParams &getPathParams() {return mPathParams;} -	BOOL importFile(LLFILE *fp); -	BOOL exportFile(LLFILE *fp) const; +	bool importFile(LLFILE *fp); +	bool exportFile(LLFILE *fp) const; -	BOOL importLegacyStream(std::istream& input_stream); -	BOOL exportLegacyStream(std::ostream& output_stream) const; +	bool importLegacyStream(std::istream& input_stream); +	bool exportLegacyStream(std::ostream& output_stream) const;  	LLSD sculptAsLLSD() const;  	bool sculptFromLLSD(LLSD& sd); @@ -621,7 +621,7 @@ public:  	bool setRevolutions(const F32 revolutions);	// 1 to 4  	bool setRadiusOffset(const F32 radius_offset);  	bool setSkew(const F32 skew); -	bool setSculptID(const LLUUID sculpt_id, U8 sculpt_type); +	bool setSculptID(const LLUUID& sculpt_id, U8 sculpt_type);  	static bool validate(U8 prof_curve, F32 prof_begin, F32 prof_end, F32 hollow,  		U8 path_curve, F32 path_begin, F32 path_end, @@ -653,7 +653,7 @@ public:  	const U8& getSculptType() const     { return mSculptType;                   }  	bool isSculpt() const;  	bool isMeshSculpt() const; -	BOOL isConvex() const; +	bool isConvex() const;  	// 'begin' and 'end' should be in range [0, 1] (they will be clamped)  	// (begin, end) = (0, 1) will not change the volume @@ -688,9 +688,9 @@ class LLProfile  public:  	LLProfile() -		: mOpen(FALSE), -		  mConcave(FALSE), -		  mDirty(TRUE), +		: mOpen(false), +		  mConcave(false), +		  mDirty(true),  		  mTotalOut(0),  		  mTotal(2)  	{ @@ -698,23 +698,23 @@ public:  	S32	 getTotal() const								{ return mTotal; }  	S32	 getTotalOut() const							{ return mTotalOut; }	// Total number of outside points -	BOOL isFlat(S32 face) const							{ return (mFaces[face].mCount == 2); } -	BOOL isOpen() const									{ return mOpen; } -	void setDirty()										{ mDirty     = TRUE; } - -	static S32 getNumPoints(const LLProfileParams& params, BOOL path_open, F32 detail = 1.0f, S32 split = 0, -				  BOOL is_sculpted = FALSE, S32 sculpt_size = 0); -	BOOL generate(const LLProfileParams& params, BOOL path_open, F32 detail = 1.0f, S32 split = 0, -				  BOOL is_sculpted = FALSE, S32 sculpt_size = 0); -	BOOL isConcave() const								{ return mConcave; } +	bool isFlat(S32 face) const							{ return (mFaces[face].mCount == 2); } +	bool isOpen() const									{ return mOpen; } +	void setDirty()										{ mDirty = true; } + +	static S32 getNumPoints(const LLProfileParams& params, bool path_open, F32 detail = 1.0f, S32 split = 0, +				  bool is_sculpted = false, S32 sculpt_size = 0); +	bool generate(const LLProfileParams& params, bool path_open, F32 detail = 1.0f, S32 split = 0, +				  bool is_sculpted = false, S32 sculpt_size = 0); +	bool isConcave() const								{ return mConcave; }  public:  	struct Face  	{  		S32       mIndex;  		S32       mCount;  		F32       mScaleU; -		BOOL      mCap; -		BOOL      mFlat; +		bool      mCap; +		bool      mFlat;  		LLFaceID  mFaceID;  	}; @@ -733,14 +733,14 @@ protected:  	static S32 getNumNGonPoints(const LLProfileParams& params, S32 sides, F32 offset=0.0f, F32 bevel = 0.0f, F32 ang_scale = 1.f, S32 split = 0);  	void genNGon(const LLProfileParams& params, S32 sides, F32 offset=0.0f, F32 bevel = 0.0f, F32 ang_scale = 1.f, S32 split = 0); -	Face* addHole(const LLProfileParams& params, BOOL flat, F32 sides, F32 offset, F32 box_hollow, F32 ang_scale, S32 split = 0); +	Face* addHole(const LLProfileParams& params, bool flat, F32 sides, F32 offset, F32 box_hollow, F32 ang_scale, S32 split = 0);  	Face* addCap (S16 faceID); -	Face* addFace(S32 index, S32 count, F32 scaleU, S16 faceID, BOOL flat); +	Face* addFace(S32 index, S32 count, F32 scaleU, S16 faceID, bool flat);  protected: -	BOOL		  mOpen; -	BOOL		  mConcave; -	BOOL          mDirty; +	bool		  mOpen; +	bool		  mConcave; +	bool          mDirty;  	S32			  mTotalOut;  	S32			  mTotal; @@ -780,9 +780,9 @@ public:  public:  	LLPath() -		: mOpen(FALSE), +		: mOpen(false),  		  mTotal(0), -		  mDirty(TRUE), +		  mDirty(true),  		  mStep(1)  	{  	} @@ -793,12 +793,12 @@ public:  	static S32 getNumNGonPoints(const LLPathParams& params, S32 sides, F32 offset=0.0f, F32 end_scale = 1.f, F32 twist_scale = 1.f);  	void genNGon(const LLPathParams& params, S32 sides, F32 offset=0.0f, F32 end_scale = 1.f, F32 twist_scale = 1.f); -	virtual BOOL generate(const LLPathParams& params, F32 detail=1.0f, S32 split = 0, -						  BOOL is_sculpted = FALSE, S32 sculpt_size = 0); +	virtual bool generate(const LLPathParams& params, F32 detail=1.0f, S32 split = 0, +						  bool is_sculpted = false, S32 sculpt_size = 0); -	BOOL isOpen() const						{ return mOpen; } +	bool isOpen() const						{ return mOpen; }  	F32 getStep() const						{ return mStep; } -	void setDirty()							{ mDirty     = TRUE; } +	void setDirty()							{ mDirty = true; }  	S32 getPathLength() const				{ return (S32)mPath.size(); } @@ -810,9 +810,9 @@ public:  	LLAlignedArray<PathPt, 64> mPath;  protected: -	BOOL		  mOpen; +	bool		  mOpen;  	S32			  mTotal; -	BOOL          mDirty; +	bool          mDirty;  	F32           mStep;  }; @@ -820,8 +820,8 @@ class LLDynamicPath : public LLPath  {  public:  	LLDynamicPath() : LLPath() { } -	/*virtual*/ BOOL generate(const LLPathParams& params, F32 detail=1.0f, S32 split = 0, -							  BOOL is_sculpted = FALSE, S32 sculpt_size = 0); +	/*virtual*/ bool generate(const LLPathParams& params, F32 detail=1.0f, S32 split = 0, +							  bool is_sculpted = false, S32 sculpt_size = 0);  };  // Yet another "face" class - caches volume-specific, but not instance-specific data for faces) @@ -871,7 +871,7 @@ private:  	void freeData();  public: -	BOOL create(LLVolume* volume, BOOL partial_build = FALSE); +	bool create(LLVolume* volume, bool partial_build = false);  	void createTangents();  	void resizeVertices(S32 num_verts); @@ -973,14 +973,14 @@ public:      U8* mJointIndices;  #endif -    mutable BOOL mWeightsScrubbed; +    mutable bool mWeightsScrubbed;      // Which joints are rigged to, and the bounding box of any rigged      // vertices per joint.      LLJointRiggingInfoTab mJointRiggingInfoTab;  	//whether or not face has been cache optimized -	BOOL mOptimized; +	bool mOptimized;      // if this is a mesh asset, scale and translation that were applied      // when encoding the source mesh into a unit cube @@ -991,9 +991,9 @@ private:      LLVolumeOctree* mOctree;      LLVolumeTriangle* mOctreeTriangles; -	BOOL createUnCutCubeCap(LLVolume* volume, BOOL partial_build = FALSE); -	BOOL createCap(LLVolume* volume, BOOL partial_build = FALSE); -	BOOL createSide(LLVolume* volume, BOOL partial_build = FALSE); +	bool createUnCutCubeCap(LLVolume* volume, bool partial_build = false); +	bool createCap(LLVolume* volume, bool partial_build = false); +	bool createSide(LLVolume* volume, bool partial_build = false);  };  class LLVolume : public LLRefCount @@ -1015,7 +1015,7 @@ public:  		S32 mCountT;  	}; -	LLVolume(const LLVolumeParams ¶ms, const F32 detail, const BOOL generate_single_face = FALSE, const BOOL is_unique = FALSE); +	LLVolume(const LLVolumeParams ¶ms, const F32 detail, const bool generate_single_face = false, const bool is_unique = false);  	U8 getProfileType()	const								{ return mParams.getProfileParams().getCurveType(); }  	U8 getPathType() const									{ return mParams.getPathParams().getCurveType(); } @@ -1037,10 +1037,10 @@ public:  	void regen();      void genTangents(S32 face); -	BOOL isConvex() const; -	BOOL isCap(S32 face); -	BOOL isFlat(S32 face); -	BOOL isUnique() const									{ return mUnique; } +	bool isConvex() const; +	bool isCap(S32 face); +	bool isFlat(S32 face); +	bool isUnique() const									{ return mUnique; }  	S32 getSculptLevel() const                              { return mSculptLevel; }  	void setSculptLevel(S32 level)							{ mSculptLevel = level; } @@ -1048,7 +1048,7 @@ public:  	static void getLoDTriangleCounts(const LLVolumeParams& params, S32* counts); -	S32 getNumTriangles(S32* vcount = NULL) const; +	S32 getNumTriangles(S32* vcount = nullptr) const;  	void generateSilhouetteVertices(std::vector<LLVector3> &vertices,   									std::vector<LLVector3> &normals,  @@ -1062,15 +1062,15 @@ public:  	//Line segment must be in volume space.  	S32 lineSegmentIntersect(const LLVector4a& start, const LLVector4a& end,  							 S32 face = -1,                          // which face to check, -1 = ALL_SIDES -							 LLVector4a* intersection = NULL,         // return the intersection point -							 LLVector2* tex_coord = NULL,            // return the texture coordinates of the intersection point -							 LLVector4a* normal = NULL,               // return the surface normal at the intersection point -							 LLVector4a* tangent = NULL             // return the surface tangent at the intersection point +							 LLVector4a* intersection = nullptr,     // return the intersection point +							 LLVector2* tex_coord = nullptr,         // return the texture coordinates of the intersection point +							 LLVector4a* normal = nullptr,           // return the surface normal at the intersection point +							 LLVector4a* tangent = nullptr           // return the surface tangent at the intersection point  		);  	LLFaceID generateFaceMask(); -	BOOL isFaceMaskValid(LLFaceID face_mask); +	bool isFaceMaskValid(LLFaceID face_mask);  	static S32 sNumMeshPoints;  	friend std::ostream& operator<<(std::ostream &s, const LLVolume &volume); @@ -1099,11 +1099,9 @@ private:  	F32 sculptGetSurfaceArea();  	void sculptGenerateEmptyPlaceholder();  	void sculptGenerateSpherePlaceholder(); -	void sculptCalcMeshResolution(U16 width, U16 height, U8 type, S32& s, S32& t); -	  protected: -	BOOL generate(); +	bool generate();  	void createVolumeFaces();  public:  	bool unpackVolumeFaces(std::istream& is, S32 size); @@ -1118,7 +1116,7 @@ public:      virtual bool isMeshAssetUnavaliable();   protected: -	BOOL mUnique; +	bool mUnique;  	F32 mDetail;  	S32 mSculptLevel;  	F32 mSurfaceArea; //unscaled surface area @@ -1131,7 +1129,7 @@ public:  	LLAlignedArray<LLVector4a,64> mMesh; -	BOOL mGenerateSingleFace; +	bool mGenerateSingleFace;  	face_list_t mVolumeFaces;  public: @@ -1145,18 +1143,13 @@ std::ostream& operator<<(std::ostream &s, const LLVolumeParams &volume_params);  void LLCalculateTangentArray(U32 vertexCount, const LLVector4a *vertex, const LLVector4a *normal, const LLVector2 *texcoord, U32 triangleCount, const U16* index_array, LLVector4a *tangent); -BOOL LLLineSegmentBoxIntersect(const F32* start, const F32* end, const F32* center, const F32* size); -BOOL LLLineSegmentBoxIntersect(const LLVector3& start, const LLVector3& end, const LLVector3& center, const LLVector3& size); -BOOL LLLineSegmentBoxIntersect(const LLVector4a& start, const LLVector4a& end, const LLVector4a& center, const LLVector4a& size); - -//BOOL LLTriangleRayIntersect(const LLVector3& vert0, const LLVector3& vert1, const LLVector3& vert2, const LLVector3& orig, const LLVector3& dir, -//							F32& intersection_a, F32& intersection_b, F32& intersection_t, BOOL two_sided); +bool LLLineSegmentBoxIntersect(const F32* start, const F32* end, const F32* center, const F32* size); +bool LLLineSegmentBoxIntersect(const LLVector3& start, const LLVector3& end, const LLVector3& center, const LLVector3& size); +bool LLLineSegmentBoxIntersect(const LLVector4a& start, const LLVector4a& end, const LLVector4a& center, const LLVector4a& size); -BOOL LLTriangleRayIntersect(const LLVector4a& vert0, const LLVector4a& vert1, const LLVector4a& vert2, const LLVector4a& orig, const LLVector4a& dir, +bool LLTriangleRayIntersect(const LLVector4a& vert0, const LLVector4a& vert1, const LLVector4a& vert2, const LLVector4a& orig, const LLVector4a& dir,  							F32& intersection_a, F32& intersection_b, F32& intersection_t); -BOOL LLTriangleRayIntersectTwoSided(const LLVector4a& vert0, const LLVector4a& vert1, const LLVector4a& vert2, const LLVector4a& orig, const LLVector4a& dir, +bool LLTriangleRayIntersectTwoSided(const LLVector4a& vert0, const LLVector4a& vert1, const LLVector4a& vert2, const LLVector4a& orig, const LLVector4a& dir,  							F32& intersection_a, F32& intersection_b, F32& intersection_t); -	 -	  #endif diff --git a/indra/llmath/llvolumemgr.cpp b/indra/llmath/llvolumemgr.cpp index 9399504529..d1e145cff1 100644 --- a/indra/llmath/llvolumemgr.cpp +++ b/indra/llmath/llvolumemgr.cpp @@ -59,9 +59,9 @@ LLVolumeMgr::~LLVolumeMgr()  	mDataMutex = NULL;  } -BOOL LLVolumeMgr::cleanup() +bool LLVolumeMgr::cleanup()  { -	BOOL no_refs = TRUE; +	bool no_refs = true;  	if (mDataMutex)  	{  		mDataMutex->lock(); @@ -73,7 +73,7 @@ BOOL LLVolumeMgr::cleanup()  		LLVolumeLODGroup *volgroupp = iter->second;  		if (volgroupp->cleanupRefs() == false)  		{ -			no_refs = FALSE; +			no_refs = false;  		}   		delete volgroupp;  	} @@ -301,7 +301,7 @@ LLVolume* LLVolumeLODGroup::refLOD(const S32 lod)  	return mVolumeLODs[lod];  } -BOOL LLVolumeLODGroup::derefLOD(LLVolume *volumep) +bool LLVolumeLODGroup::derefLOD(LLVolume *volumep)  {  	llassert_always(mRefs > 0);  	mRefs--; @@ -317,11 +317,11 @@ BOOL LLVolumeLODGroup::derefLOD(LLVolume *volumep)  				mVolumeLODs[i] = NULL;  			}  #endif -			return TRUE; +			return true;  		}  	}  	LL_ERRS() << "Deref of non-matching LOD in volume LOD group" << LL_ENDL; -	return FALSE; +	return false;  }  S32 LLVolumeLODGroup::getDetailFromTan(const F32 tan_angle) diff --git a/indra/llmath/llvolumemgr.h b/indra/llmath/llvolumemgr.h index c75906f675..b0baf7054d 100644 --- a/indra/llmath/llvolumemgr.h +++ b/indra/llmath/llvolumemgr.h @@ -56,7 +56,7 @@ public:  	static S32 getVolumeDetailFromScale(F32 scale);  	LLVolume* refLOD(const S32 detail); -	BOOL derefLOD(LLVolume *volumep); +	bool derefLOD(LLVolume *volumep);  	S32 getNumRefs() const { return mRefs; }  	const LLVolumeParams* getVolumeParams() const { return &mVolumeParams; }; @@ -80,7 +80,7 @@ class LLVolumeMgr  public:  	LLVolumeMgr();  	virtual ~LLVolumeMgr(); -	BOOL cleanup();			// Cleanup all volumes being managed, returns TRUE if no dangling references +	bool cleanup();			// Cleanup all volumes being managed, returns true if no dangling references  	virtual LLVolumeLODGroup* getGroup( const LLVolumeParams& volume_params ) const; diff --git a/indra/llmath/llvolumeoctree.cpp b/indra/llmath/llvolumeoctree.cpp index 95c7cb0b5c..f97b11a94d 100644 --- a/indra/llmath/llvolumeoctree.cpp +++ b/indra/llmath/llvolumeoctree.cpp @@ -27,7 +27,7 @@  #include "llvolumeoctree.h"  #include "llvector4a.h" -BOOL LLLineSegmentBoxIntersect(const LLVector4a& start, const LLVector4a& end, const LLVector4a& center, const LLVector4a& size) +bool LLLineSegmentBoxIntersect(const LLVector4a& start, const LLVector4a& end, const LLVector4a& center, const LLVector4a& size)  {  	LLVector4a fAWdU;  	LLVector4a dir; diff --git a/indra/llmath/m3math.cpp b/indra/llmath/m3math.cpp index 65eb3348de..c7777164c0 100644 --- a/indra/llmath/m3math.cpp +++ b/indra/llmath/m3math.cpp @@ -528,10 +528,10 @@ bool operator==(const LLMatrix3 &a, const LLMatrix3 &b)  		for (j = 0; j < NUM_VALUES_IN_MAT3; j++)  		{  			if (a.mMatrix[j][i] != b.mMatrix[j][i]) -				return FALSE; +				return false;  		}  	} -	return TRUE; +	return true;  }  bool operator!=(const LLMatrix3 &a, const LLMatrix3 &b) @@ -542,10 +542,10 @@ bool operator!=(const LLMatrix3 &a, const LLMatrix3 &b)  		for (j = 0; j < NUM_VALUES_IN_MAT3; j++)  		{  			if (a.mMatrix[j][i] != b.mMatrix[j][i]) -				return TRUE; +				return true;  		}  	} -	return FALSE; +	return false;  }  const LLMatrix3& operator*=(LLMatrix3 &a, const LLMatrix3 &b) diff --git a/indra/llmath/m4math.cpp b/indra/llmath/m4math.cpp index 6e40dae30b..ee4f607442 100644 --- a/indra/llmath/m4math.cpp +++ b/indra/llmath/m4math.cpp @@ -744,10 +744,10 @@ bool operator==(const LLMatrix4 &a, const LLMatrix4 &b)  		for (j = 0; j < NUM_VALUES_IN_MAT4; j++)  		{  			if (a.mMatrix[j][i] != b.mMatrix[j][i]) -				return FALSE; +				return false;  		}  	} -	return TRUE; +	return true;  }  bool operator!=(const LLMatrix4 &a, const LLMatrix4 &b) @@ -758,10 +758,10 @@ bool operator!=(const LLMatrix4 &a, const LLMatrix4 &b)  		for (j = 0; j < NUM_VALUES_IN_MAT4; j++)  		{  			if (a.mMatrix[j][i] != b.mMatrix[j][i]) -				return TRUE; +				return true;  		}  	} -	return FALSE; +	return false;  }  bool operator<(const LLMatrix4& a, const LLMatrix4 &b) diff --git a/indra/llmath/raytrace.cpp b/indra/llmath/raytrace.cpp index f38fe49bcb..117ba2369e 100644 --- a/indra/llmath/raytrace.cpp +++ b/indra/llmath/raytrace.cpp @@ -34,8 +34,8 @@  #include "raytrace.h" -BOOL line_plane(const LLVector3 &line_point, const LLVector3 &line_direction, -				const LLVector3 &plane_point, const LLVector3 plane_normal,  +bool line_plane(const LLVector3 &line_point, const LLVector3 &line_direction, +				const LLVector3 &plane_point, const LLVector3 plane_normal,  				LLVector3 &intersection)  {  	F32 N = line_direction * plane_normal; @@ -43,19 +43,19 @@ BOOL line_plane(const LLVector3 &line_point, const LLVector3 &line_direction,  	{  		// line is perpendicular to plane normal  		// so it is either entirely on plane, or not on plane at all -		return FALSE; +		return false;  	}  	// Ax + By, + Cz + D = 0  	// D = - (plane_point * plane_normal)  	// N = line_direction * plane_normal  	// intersection = line_point - ((D + plane_normal * line_point) / N) * line_direction  	intersection = line_point - ((plane_normal * line_point - plane_point * plane_normal) / N) * line_direction; -	return TRUE; +	return true;  } -BOOL ray_plane(const LLVector3 &ray_point, const LLVector3 &ray_direction, -			   const LLVector3 &plane_point, const LLVector3 plane_normal,  +bool ray_plane(const LLVector3 &ray_point, const LLVector3 &ray_direction, +			   const LLVector3 &plane_point, const LLVector3 plane_normal,  			   LLVector3 &intersection)  {  	F32 N = ray_direction * plane_normal; @@ -63,7 +63,7 @@ BOOL ray_plane(const LLVector3 &ray_point, const LLVector3 &ray_direction,  	{  		// ray is perpendicular to plane normal  		// so it is either entirely on plane, or not on plane at all -		return FALSE; +		return false;  	}  	// Ax + By, + Cz + D = 0  	// D = - (plane_point * plane_normal) @@ -73,14 +73,14 @@ BOOL ray_plane(const LLVector3 &ray_point, const LLVector3 &ray_direction,  	if (alpha < 0.0f)  	{  		// ray points away from plane -		return FALSE; +		return false;  	}  	intersection = ray_point + alpha * ray_direction; -	return TRUE; +	return true;  } -BOOL ray_circle(const LLVector3 &ray_point, const LLVector3 &ray_direction, +bool ray_circle(const LLVector3 &ray_point, const LLVector3 &ray_direction,  				const LLVector3 &circle_center, const LLVector3 plane_normal, F32 circle_radius,  				LLVector3 &intersection)  { @@ -88,15 +88,15 @@ BOOL ray_circle(const LLVector3 &ray_point, const LLVector3 &ray_direction,  	{  		if (circle_radius >= (intersection - circle_center).magVec())  		{ -			return TRUE; +			return true;  		}  	} -	return FALSE; +	return false;  } -BOOL ray_triangle(const LLVector3 &ray_point, const LLVector3 &ray_direction, -				  const LLVector3 &point_0, const LLVector3 &point_1, const LLVector3 &point_2,  +bool ray_triangle(const LLVector3 &ray_point, const LLVector3 &ray_direction, +				  const LLVector3 &point_0, const LLVector3 &point_1, const LLVector3 &point_2,  				  LLVector3 &intersection, LLVector3 &intersection_normal)  {  	LLVector3 side_01 = point_1 - point_0; @@ -112,15 +112,15 @@ BOOL ray_triangle(const LLVector3 &ray_point, const LLVector3 &ray_direction,  			intersection_normal * (side_12 % (intersection - point_1)) >= 0.0f  &&  			intersection_normal * (side_20 % (intersection - point_2)) >= 0.0f)  		{ -			return TRUE; +			return true;  		}  	} -	return FALSE; +	return false;  }  // assumes a parallelogram -BOOL ray_quadrangle(const LLVector3 &ray_point, const LLVector3 &ray_direction, +bool ray_quadrangle(const LLVector3 &ray_point, const LLVector3 &ray_direction,  					const LLVector3 &point_0, const LLVector3 &point_1, const LLVector3 &point_2,  					LLVector3 &intersection, LLVector3 &intersection_normal)  { @@ -140,14 +140,14 @@ BOOL ray_quadrangle(const LLVector3 &ray_point, const LLVector3 &ray_direction,  			intersection_normal * (side_23 % (intersection - point_2)) >= 0.0f  &&  			intersection_normal * (side_30 % (intersection - point_3)) >= 0.0f)  		{ -			return TRUE; +			return true;  		}  	} -	return FALSE; +	return false;  } -BOOL ray_sphere(const LLVector3 &ray_point, const LLVector3 &ray_direction, +bool ray_sphere(const LLVector3 &ray_point, const LLVector3 &ray_direction,  				const LLVector3 &sphere_center, F32 sphere_radius,  				LLVector3 &intersection, LLVector3 &intersection_normal)  { @@ -160,7 +160,7 @@ BOOL ray_sphere(const LLVector3 &ray_point, const LLVector3 &ray_direction,  	F32 radius_squared = sphere_radius * sphere_radius;  	if (shortest_distance > radius_squared)  	{ -		return FALSE; +		return false;  	}  	F32 half_chord = (F32) sqrt(radius_squared - shortest_distance); @@ -170,7 +170,7 @@ BOOL ray_sphere(const LLVector3 &ray_point, const LLVector3 &ray_direction,  	if (dot < 0.0f)  	{  		// ray shoots away from sphere and is not inside it -		return FALSE; +		return false;  	}  	shortest_distance = ray_direction * ((closest_approach - half_chord * ray_direction) - ray_point); @@ -195,11 +195,11 @@ BOOL ray_sphere(const LLVector3 &ray_point, const LLVector3 &ray_direction,  		intersection_normal.setVec(0.0f, 0.0f, 0.0f);  	} -	return TRUE; +	return true;  } -BOOL ray_cylinder(const LLVector3 &ray_point, const LLVector3 &ray_direction, +bool ray_cylinder(const LLVector3 &ray_point, const LLVector3 &ray_direction,  				  const LLVector3 &cyl_center, const LLVector3 &cyl_scale, const LLQuaternion &cyl_rotation,  				  LLVector3 &intersection, LLVector3 &intersection_normal)  { @@ -242,7 +242,7 @@ BOOL ray_cylinder(const LLVector3 &ray_point, const LLVector3 &ray_direction,  			   	if (dot > 0.0f)  				{  					// ray points away from cylinder bottom -					return FALSE; +					return false;  				}  				// ray hit bottom of cylinder from outside   				intersection = ray_point - shortest_distance * cyl_axis; @@ -270,15 +270,15 @@ BOOL ray_cylinder(const LLVector3 &ray_point, const LLVector3 &ray_direction,  				if (dot < 0.0f)  				{  					// ray points away from cylinder bottom -					return FALSE; +					return false;  				}  				// ray hit top from outside  				intersection = ray_point - (shortest_distance + cyl_length) * cyl_axis;  				intersection_normal = -cyl_axis;  			} -			return TRUE; +			return true;  		} -		return FALSE; +		return false;  	}  	// check for intersection with infinite cylinder @@ -298,8 +298,8 @@ BOOL ray_cylinder(const LLVector3 &ray_point, const LLVector3 &ray_direction,  		out = dist_to_closest_point + half_chord_length;	// dist to exiting point  		if (out < 0.0f)  		{ -			// cylinder is behind the ray, so we return FALSE -			return FALSE; +			// cylinder is behind the ray, so we return false +			return false;  		}  		in = dist_to_closest_point - half_chord_length;		// dist to entering point @@ -341,14 +341,14 @@ BOOL ray_cylinder(const LLVector3 &ray_point, const LLVector3 &ray_direction,  				if (shortest_distance > out)  				{  					// ray missed the finite cylinder -					return FALSE; +					return false;  				}  				if (shortest_distance > in)  				{  					// ray intersects cylinder at top plane  					intersection = temp_vector;  					intersection_normal = -cyl_axis; -					return TRUE; +					return true;  				}  			}  			else @@ -357,7 +357,7 @@ BOOL ray_cylinder(const LLVector3 &ray_point, const LLVector3 &ray_direction,  				if (shortest_distance < in)  				{  					// missed the finite cylinder -					return FALSE; +					return false;  				}  			} @@ -370,14 +370,14 @@ BOOL ray_cylinder(const LLVector3 &ray_point, const LLVector3 &ray_direction,  				if (shortest_distance > out)  				{  					// ray missed the finite cylinder -					return FALSE; +					return false;  				}  				if (shortest_distance > in)  				{  					// ray intersects cylinder at bottom plane  					intersection = temp_vector;  					intersection_normal = cyl_axis; -					return TRUE; +					return true;  				}  			}  			else @@ -386,7 +386,7 @@ BOOL ray_cylinder(const LLVector3 &ray_point, const LLVector3 &ray_direction,  				if (shortest_distance < in)  				{  					// ray missed the finite cylinder -					return FALSE; +					return false;  				}  			} @@ -399,14 +399,14 @@ BOOL ray_cylinder(const LLVector3 &ray_point, const LLVector3 &ray_direction,  			if (shortest_distance < 0.0f  ||  shortest_distance > cyl_length)  			{  				// ray missed finite cylinder -				return FALSE; +				return false;  			}  		} -		return TRUE; +		return true;  	} -	return FALSE; +	return false;  } @@ -710,7 +710,7 @@ U32 ray_box(const LLVector3 &ray_point, const LLVector3 &ray_direction,  } -BOOL ray_prism(const LLVector3 &ray_point, const LLVector3 &ray_direction, +bool ray_prism(const LLVector3 &ray_point, const LLVector3 &ray_direction,  			   const LLVector3 &prism_center, const LLVector3 &prism_scale, const LLQuaternion &prism_rotation,  			   LLVector3 &intersection, LLVector3 &intersection_normal)  { @@ -751,7 +751,7 @@ BOOL ray_prism(const LLVector3 &ray_point, const LLVector3 &ray_direction,  	point5 = (point5 * prism_rotation) + prism_center;  	// test ray intersection for each face -	BOOL b_hit = FALSE; +	bool b_hit = false;  	LLVector3 face_intersection, face_normal;  	F32 distance_squared = 0.0f;  	F32 temp; @@ -761,14 +761,14 @@ BOOL ray_prism(const LLVector3 &ray_point, const LLVector3 &ray_direction,  		ray_quadrangle(ray_point, ray_direction, point5, point2, point0, intersection, intersection_normal))  	{  		distance_squared = (ray_point - intersection).magVecSquared(); -		b_hit = TRUE; +		b_hit = true;  	}  	// face 1  	if (ray_direction * ( (point0 - point3) % (point2 - point3)) < 0.0f  &&  		ray_triangle(ray_point, ray_direction, point2, point3, point0, face_intersection, face_normal))  	{ -		if (TRUE == b_hit) +		if (b_hit)  		{  			temp = (ray_point - face_intersection).magVecSquared();  			if (temp < distance_squared) @@ -783,7 +783,7 @@ BOOL ray_prism(const LLVector3 &ray_point, const LLVector3 &ray_direction,  			distance_squared = (ray_point - face_intersection).magVecSquared();  			intersection = face_intersection;  			intersection_normal = face_normal; -			b_hit = TRUE; +			b_hit = true;  		}  	} @@ -791,7 +791,7 @@ BOOL ray_prism(const LLVector3 &ray_point, const LLVector3 &ray_direction,  	if (ray_direction * ( (point1 - point4) % (point3 - point4)) < 0.0f  &&  		ray_quadrangle(ray_point, ray_direction, point3, point4, point1, face_intersection, face_normal))  	{ -		if (TRUE == b_hit) +		if (b_hit)  		{  			temp = (ray_point - face_intersection).magVecSquared();  			if (temp < distance_squared) @@ -806,7 +806,7 @@ BOOL ray_prism(const LLVector3 &ray_point, const LLVector3 &ray_direction,  			distance_squared = (ray_point - face_intersection).magVecSquared();  			intersection = face_intersection;  			intersection_normal = face_normal; -			b_hit = TRUE; +			b_hit = true;  		}  	} @@ -814,7 +814,7 @@ BOOL ray_prism(const LLVector3 &ray_point, const LLVector3 &ray_direction,  	if (ray_direction * ( (point5 - point4) % (point1 - point4)) < 0.0f  &&  		ray_triangle(ray_point, ray_direction, point1, point4, point5, face_intersection, face_normal))  	{ -		if (TRUE == b_hit) +		if (b_hit)  		{  			temp = (ray_point - face_intersection).magVecSquared();  			if (temp < distance_squared) @@ -829,7 +829,7 @@ BOOL ray_prism(const LLVector3 &ray_point, const LLVector3 &ray_direction,  			distance_squared = (ray_point - face_intersection).magVecSquared();  			intersection = face_intersection;  			intersection_normal = face_normal; -			b_hit = TRUE; +			b_hit = true;  		}  	} @@ -837,7 +837,7 @@ BOOL ray_prism(const LLVector3 &ray_point, const LLVector3 &ray_direction,  	if (ray_direction * ( (point4 - point5) % (point2 - point5)) < 0.0f  &&  		ray_quadrangle(ray_point, ray_direction, point2, point5, point4, face_intersection, face_normal))  	{ -		if (TRUE == b_hit) +		if (b_hit)  		{  			temp = (ray_point - face_intersection).magVecSquared();  			if (temp < distance_squared) @@ -852,7 +852,7 @@ BOOL ray_prism(const LLVector3 &ray_point, const LLVector3 &ray_direction,  			distance_squared = (ray_point - face_intersection).magVecSquared();  			intersection = face_intersection;  			intersection_normal = face_normal; -			b_hit = TRUE; +			b_hit = true;  		}  	} @@ -860,7 +860,7 @@ BOOL ray_prism(const LLVector3 &ray_point, const LLVector3 &ray_direction,  } -BOOL ray_tetrahedron(const LLVector3 &ray_point, const LLVector3 &ray_direction, +bool ray_tetrahedron(const LLVector3 &ray_point, const LLVector3 &ray_direction,  					 const LLVector3 &t_center, const LLVector3 &t_scale, const LLQuaternion &t_rotation,  					 LLVector3 &intersection, LLVector3 &intersection_normal)  { @@ -890,7 +890,7 @@ BOOL ray_tetrahedron(const LLVector3 &ray_point, const LLVector3 &ray_direction,  	point3 = (point3 * t_rotation) + t_center;  	// test ray intersection for each face -	BOOL b_hit = FALSE; +	bool b_hit = false;  	LLVector3 face_intersection, face_normal;  	F32 distance_squared = 1.0e12f;  	F32 temp; @@ -900,14 +900,14 @@ BOOL ray_tetrahedron(const LLVector3 &ray_point, const LLVector3 &ray_direction,  		ray_triangle(ray_point, ray_direction, point1, point2, point0, intersection, intersection_normal))  	{  		distance_squared = (ray_point - intersection).magVecSquared(); -		b_hit = TRUE; +		b_hit = true;  	}  	// face 1  	if (ray_direction * ( (point3 - point2) % (point0 - point2)) < 0.0f  &&  		ray_triangle(ray_point, ray_direction, point2, point3, point0, face_intersection, face_normal))  	{ -		if (TRUE == b_hit) +		if (b_hit)  		{  			temp = (ray_point - face_intersection).magVecSquared();  			if (temp < distance_squared) @@ -922,7 +922,7 @@ BOOL ray_tetrahedron(const LLVector3 &ray_point, const LLVector3 &ray_direction,  			distance_squared = (ray_point - face_intersection).magVecSquared();  			intersection = face_intersection;  			intersection_normal = face_normal; -			b_hit = TRUE; +			b_hit = true;  		}  	} @@ -930,7 +930,7 @@ BOOL ray_tetrahedron(const LLVector3 &ray_point, const LLVector3 &ray_direction,  	if (ray_direction * ( (point1 - point3) % (point0 - point3)) < 0.0f  &&  		ray_triangle(ray_point, ray_direction, point3, point1, point0, face_intersection, face_normal))  	{ -		if (TRUE == b_hit) +		if (b_hit)  		{  			temp = (ray_point - face_intersection).magVecSquared();  			if (temp < distance_squared) @@ -945,7 +945,7 @@ BOOL ray_tetrahedron(const LLVector3 &ray_point, const LLVector3 &ray_direction,  			distance_squared = (ray_point - face_intersection).magVecSquared();  			intersection = face_intersection;  			intersection_normal = face_normal; -			b_hit = TRUE; +			b_hit = true;  		}  	} @@ -953,7 +953,7 @@ BOOL ray_tetrahedron(const LLVector3 &ray_point, const LLVector3 &ray_direction,  	if (ray_direction * ( (point2 - point3) % (point1 - point3)) < 0.0f  &&  		ray_triangle(ray_point, ray_direction, point3, point2, point1, face_intersection, face_normal))  	{ -		if (TRUE == b_hit) +		if (b_hit)  		{  			temp = (ray_point - face_intersection).magVecSquared();  			if (temp < distance_squared) @@ -966,7 +966,7 @@ BOOL ray_tetrahedron(const LLVector3 &ray_point, const LLVector3 &ray_direction,  		{  			intersection = face_intersection;  			intersection_normal = face_normal; -			b_hit = TRUE; +			b_hit = true;  		}  	} @@ -974,7 +974,7 @@ BOOL ray_tetrahedron(const LLVector3 &ray_point, const LLVector3 &ray_direction,  } -BOOL ray_pyramid(const LLVector3 &ray_point, const LLVector3 &ray_direction, +bool ray_pyramid(const LLVector3 &ray_point, const LLVector3 &ray_direction,  				 const LLVector3 &p_center, const LLVector3 &p_scale, const LLQuaternion &p_rotation,  				 LLVector3 &intersection, LLVector3 &intersection_normal)  { @@ -997,7 +997,7 @@ BOOL ray_pyramid(const LLVector3 &ray_point, const LLVector3 &ray_direction,  	point4 = (point4 * p_rotation) + p_center;  	// test ray intersection for each face -	BOOL b_hit = FALSE; +	bool b_hit = false;  	LLVector3 face_intersection, face_normal;  	F32 distance_squared = 1.0e12f;  	F32 temp; @@ -1007,14 +1007,14 @@ BOOL ray_pyramid(const LLVector3 &ray_point, const LLVector3 &ray_direction,  		ray_triangle(ray_point, ray_direction, point4, point1, point0, intersection, intersection_normal))  	{  		distance_squared = (ray_point - intersection).magVecSquared(); -		b_hit = TRUE; +		b_hit = true;  	}  	// face 1  	if (ray_direction * ( (point2 - point1) % (point0 - point1)) < 0.0f  &&  		ray_triangle(ray_point, ray_direction, point1, point2, point0, face_intersection, face_normal))  	{ -		if (TRUE == b_hit) +		if (b_hit)  		{  			temp = (ray_point - face_intersection).magVecSquared();  			if (temp < distance_squared) @@ -1029,7 +1029,7 @@ BOOL ray_pyramid(const LLVector3 &ray_point, const LLVector3 &ray_direction,  			distance_squared = (ray_point - face_intersection).magVecSquared();  			intersection = face_intersection;  			intersection_normal = face_normal; -			b_hit = TRUE; +			b_hit = true;  		}  	} @@ -1037,7 +1037,7 @@ BOOL ray_pyramid(const LLVector3 &ray_point, const LLVector3 &ray_direction,  	if (ray_direction * ( (point3 - point2) % (point0 - point2)) < 0.0f  &&  		ray_triangle(ray_point, ray_direction, point2, point3, point0, face_intersection, face_normal))  	{ -		if (TRUE == b_hit) +		if (b_hit)  		{  			temp = (ray_point - face_intersection).magVecSquared();  			if (temp < distance_squared) @@ -1052,7 +1052,7 @@ BOOL ray_pyramid(const LLVector3 &ray_point, const LLVector3 &ray_direction,  			distance_squared = (ray_point - face_intersection).magVecSquared();  			intersection = face_intersection;  			intersection_normal = face_normal; -			b_hit = TRUE; +			b_hit = true;  		}  	} @@ -1060,7 +1060,7 @@ BOOL ray_pyramid(const LLVector3 &ray_point, const LLVector3 &ray_direction,  	if (ray_direction * ( (point4 - point3) % (point0 - point3)) < 0.0f  &&  		ray_triangle(ray_point, ray_direction, point3, point4, point0, face_intersection, face_normal))  	{ -		if (TRUE == b_hit) +		if (b_hit)  		{  			temp = (ray_point - face_intersection).magVecSquared();  			if (temp < distance_squared) @@ -1075,7 +1075,7 @@ BOOL ray_pyramid(const LLVector3 &ray_point, const LLVector3 &ray_direction,  			distance_squared = (ray_point - face_intersection).magVecSquared();  			intersection = face_intersection;  			intersection_normal = face_normal; -			b_hit = TRUE; +			b_hit = true;  		}  	} @@ -1083,7 +1083,7 @@ BOOL ray_pyramid(const LLVector3 &ray_point, const LLVector3 &ray_direction,  	if (ray_direction * ( (point3 - point4) % (point2 - point4)) < 0.0f  &&  		ray_quadrangle(ray_point, ray_direction, point4, point3, point2, face_intersection, face_normal))  	{ -		if (TRUE == b_hit) +		if (b_hit)  		{  			temp = (ray_point - face_intersection).magVecSquared();  			if (temp < distance_squared) @@ -1096,7 +1096,7 @@ BOOL ray_pyramid(const LLVector3 &ray_point, const LLVector3 &ray_direction,  		{  			intersection = face_intersection;  			intersection_normal = face_normal; -			b_hit = TRUE; +			b_hit = true;  		}  	} @@ -1104,7 +1104,7 @@ BOOL ray_pyramid(const LLVector3 &ray_point, const LLVector3 &ray_direction,  } -BOOL linesegment_circle(const LLVector3 &point_a, const LLVector3 &point_b, +bool linesegment_circle(const LLVector3 &point_a, const LLVector3 &point_b,  						const LLVector3 &circle_center, const LLVector3 plane_normal, F32 circle_radius,  						LLVector3 &intersection)  { @@ -1115,14 +1115,14 @@ BOOL linesegment_circle(const LLVector3 &point_a, const LLVector3 &point_b,  	{  		if (segment_length >= (point_a - intersection).magVec())  		{ -			return TRUE; +			return true;  		}  	} -	return FALSE; +	return false;  } -BOOL linesegment_triangle(const LLVector3 &point_a, const LLVector3 &point_b, +bool linesegment_triangle(const LLVector3 &point_a, const LLVector3 &point_b,  						  const LLVector3 &point_0, const LLVector3 &point_1, const LLVector3 &point_2,  						  LLVector3 &intersection, LLVector3 &intersection_normal)  { @@ -1133,14 +1133,14 @@ BOOL linesegment_triangle(const LLVector3 &point_a, const LLVector3 &point_b,  	{  		if (segment_length >= (point_a - intersection).magVec())  		{ -			return TRUE; +			return true;  		}  	} -	return FALSE; +	return false;  } -BOOL linesegment_quadrangle(const LLVector3 &point_a, const LLVector3 &point_b, +bool linesegment_quadrangle(const LLVector3 &point_a, const LLVector3 &point_b,  							const LLVector3 &point_0, const LLVector3 &point_1, const LLVector3 &point_2,  							LLVector3 &intersection, LLVector3 &intersection_normal)  { @@ -1151,14 +1151,14 @@ BOOL linesegment_quadrangle(const LLVector3 &point_a, const LLVector3 &point_b,  	{  		if (segment_length >= (point_a - intersection).magVec())  		{ -			return TRUE; +			return true;  		}  	} -	return FALSE; +	return false;  } -BOOL linesegment_sphere(const LLVector3 &point_a, const LLVector3 &point_b, +bool linesegment_sphere(const LLVector3 &point_a, const LLVector3 &point_b,  				const LLVector3 &sphere_center, F32 sphere_radius,  				LLVector3 &intersection, LLVector3 &intersection_normal)  { @@ -1169,14 +1169,14 @@ BOOL linesegment_sphere(const LLVector3 &point_a, const LLVector3 &point_b,  	{  		if (segment_length >= (point_a - intersection).magVec())  		{ -			return TRUE; +			return true;  		}  	} -	return FALSE; +	return false;  } -BOOL linesegment_cylinder(const LLVector3 &point_a, const LLVector3 &point_b, +bool linesegment_cylinder(const LLVector3 &point_a, const LLVector3 &point_b,  				  const LLVector3 &cyl_center, const LLVector3 &cyl_scale, const LLQuaternion &cyl_rotation,  				  LLVector3 &intersection, LLVector3 &intersection_normal)  { @@ -1187,10 +1187,10 @@ BOOL linesegment_cylinder(const LLVector3 &point_a, const LLVector3 &point_b,  	{  		if (segment_length >= (point_a - intersection).magVec())  		{ -			return TRUE; +			return true;  		}  	} -	return FALSE; +	return false;  } @@ -1215,7 +1215,7 @@ U32 linesegment_box(const LLVector3 &point_a, const LLVector3 &point_b,  } -BOOL linesegment_prism(const LLVector3 &point_a, const LLVector3 &point_b, +bool linesegment_prism(const LLVector3 &point_a, const LLVector3 &point_b,  					   const LLVector3 &prism_center, const LLVector3 &prism_scale, const LLQuaternion &prism_rotation,  					   LLVector3 &intersection, LLVector3 &intersection_normal)  { @@ -1226,14 +1226,14 @@ BOOL linesegment_prism(const LLVector3 &point_a, const LLVector3 &point_b,  	{  		if (segment_length >= (point_a - intersection).magVec())  		{ -			return TRUE; +			return true;  		}  	} -	return FALSE; +	return false;  } -BOOL linesegment_tetrahedron(const LLVector3 &point_a, const LLVector3 &point_b, +bool linesegment_tetrahedron(const LLVector3 &point_a, const LLVector3 &point_b,  							 const LLVector3 &t_center, const LLVector3 &t_scale, const LLQuaternion &t_rotation,  							 LLVector3 &intersection, LLVector3 &intersection_normal)  { @@ -1244,14 +1244,14 @@ BOOL linesegment_tetrahedron(const LLVector3 &point_a, const LLVector3 &point_b,  	{  		if (segment_length >= (point_a - intersection).magVec())  		{ -			return TRUE; +			return true;  		}  	} -	return FALSE; +	return false;  } -BOOL linesegment_pyramid(const LLVector3 &point_a, const LLVector3 &point_b, +bool linesegment_pyramid(const LLVector3 &point_a, const LLVector3 &point_b,  						 const LLVector3 &p_center, const LLVector3 &p_scale, const LLQuaternion &p_rotation,  						 LLVector3 &intersection, LLVector3 &intersection_normal)  { @@ -1262,13 +1262,8 @@ BOOL linesegment_pyramid(const LLVector3 &point_a, const LLVector3 &point_b,  	{  		if (segment_length >= (point_a - intersection).magVec())  		{ -			return TRUE; +			return true;  		}  	} -	return FALSE; +	return false;  } - - - - - diff --git a/indra/llmath/raytrace.h b/indra/llmath/raytrace.h index 2d32af0c86..2352790b1f 100644 --- a/indra/llmath/raytrace.h +++ b/indra/llmath/raytrace.h @@ -38,8 +38,8 @@ class LLQuaternion;  // Vector arguments of the form "shape_scale" represent the scale of the  // object along the three axes.  // -// All functions return the expected TRUE or FALSE, unless otherwise noted. -// When FALSE is returned, any resulting values that might have been stored  +// All functions return the expected true or false, unless otherwise noted. +// When false is returned, any resulting values that might have been stored   // are undefined.  //  // Rays are defined by a "ray_point" and a "ray_direction" (unit). @@ -61,26 +61,26 @@ class LLQuaternion;  // frame. -// returns TRUE iff line is not parallel to plane. -BOOL line_plane(const LLVector3 &line_point, const LLVector3 &line_direction,  -				const LLVector3 &plane_point, const LLVector3 plane_normal,  +// returns true if line is not parallel to plane. +bool line_plane(const LLVector3 &line_point, const LLVector3 &line_direction, +				const LLVector3 &plane_point, const LLVector3 plane_normal,  				LLVector3 &intersection); -// returns TRUE iff line is not parallel to plane. -BOOL ray_plane(const LLVector3 &ray_point, const LLVector3 &ray_direction,  -			   const LLVector3 &plane_point, const LLVector3 plane_normal,  +// returns true if line is not parallel to plane. +bool ray_plane(const LLVector3 &ray_point, const LLVector3 &ray_direction, +			   const LLVector3 &plane_point, const LLVector3 plane_normal,  			   LLVector3 &intersection); -BOOL ray_circle(const LLVector3 &ray_point, const LLVector3 &ray_direction,  +bool ray_circle(const LLVector3 &ray_point, const LLVector3 &ray_direction,  				const LLVector3 &circle_center, const LLVector3 plane_normal, F32 circle_radius,  				LLVector3 &intersection);  // point_0 through point_2 define the plane_normal via the right-hand rule:  // circle from point_0 to point_2 with fingers ==> thumb points in direction of normal -BOOL ray_triangle(const LLVector3 &ray_point, const LLVector3 &ray_direction,  -				  const LLVector3 &point_0, const LLVector3 &point_1, const LLVector3 &point_2,  +bool ray_triangle(const LLVector3 &ray_point, const LLVector3 &ray_direction, +				  const LLVector3 &point_0, const LLVector3 &point_1, const LLVector3 &point_2,  				  LLVector3 &intersection, LLVector3 &intersection_normal); @@ -88,24 +88,24 @@ BOOL ray_triangle(const LLVector3 &ray_point, const LLVector3 &ray_direction,  // right-hand-rule... curl fingers from lower-left toward lower-right then toward upper-right  // ==> thumb points in direction of normal  // assumes a parallelogram, so point_3 is determined by the other points -BOOL ray_quadrangle(const LLVector3 &ray_point, const LLVector3 &ray_direction,  -					const LLVector3 &point_0, const LLVector3 &point_1, const LLVector3 &point_2,  +bool ray_quadrangle(const LLVector3 &ray_point, const LLVector3 &ray_direction, +					const LLVector3 &point_0, const LLVector3 &point_1, const LLVector3 &point_2,  					LLVector3 &intersection, LLVector3 &intersection_normal); -BOOL ray_sphere(const LLVector3 &ray_point, const LLVector3 &ray_direction, +bool ray_sphere(const LLVector3 &ray_point, const LLVector3 &ray_direction,  				const LLVector3 &sphere_center, F32 sphere_radius,  				LLVector3 &intersection, LLVector3 &intersection_normal);  // finite right cylinder is defined by end centers: "cyl_top", "cyl_bottom",   // and by the cylinder radius "cyl_radius" -BOOL ray_cylinder(const LLVector3 &ray_point, const LLVector3 &ray_direction, +bool ray_cylinder(const LLVector3 &ray_point, const LLVector3 &ray_direction,  		          const LLVector3 &cyl_center, const LLVector3 &cyl_scale, const LLQuaternion &cyl_rotation,  				  LLVector3 &intersection, LLVector3 &intersection_normal); -// this function doesn't just return a BOOL because the return is currently +// this function doesn't just return a bool because the return is currently  // used to decide how to break up boxes that have been hit by shots...   // a hack that will probably be changed later  // @@ -117,66 +117,66 @@ U32 ray_box(const LLVector3 &ray_point, const LLVector3 &ray_direction,  /* TODO -BOOL ray_ellipsoid(const LLVector3 &ray_point, const LLVector3 &ray_direction, +bool ray_ellipsoid(const LLVector3 &ray_point, const LLVector3 &ray_direction,  				   const LLVector3 &e_center, const LLVector3 &e_scale, const LLQuaternion &e_rotation,  				   LLVector3 &intersection, LLVector3 &intersection_normal); -BOOL ray_cone(const LLVector3 &ray_point, const LLVector3 &ray_direction, +bool ray_cone(const LLVector3 &ray_point, const LLVector3 &ray_direction,  			  const LLVector3 &cone_tip, const LLVector3 &cone_bottom,   			  const LLVector3 &cone_scale, const LLQuaternion &cone_rotation,  			  LLVector3 &intersection, LLVector3 &intersection_normal);  */ -BOOL ray_prism(const LLVector3 &ray_point, const LLVector3 &ray_direction, +bool ray_prism(const LLVector3 &ray_point, const LLVector3 &ray_direction,  			   const LLVector3 &prism_center, const LLVector3 &prism_scale, const LLQuaternion &prism_rotation,  			   LLVector3 &intersection, LLVector3 &intersection_normal); -BOOL ray_tetrahedron(const LLVector3 &ray_point, const LLVector3 &ray_direction, +bool ray_tetrahedron(const LLVector3 &ray_point, const LLVector3 &ray_direction,  					 const LLVector3 &t_center, const LLVector3 &t_scale, const LLQuaternion &t_rotation,  					 LLVector3 &intersection, LLVector3 &intersection_normal); -BOOL ray_pyramid(const LLVector3 &ray_point, const LLVector3 &ray_direction, +bool ray_pyramid(const LLVector3 &ray_point, const LLVector3 &ray_direction,  				 const LLVector3 &p_center, const LLVector3 &p_scale, const LLQuaternion &p_rotation,  				 LLVector3 &intersection, LLVector3 &intersection_normal);  /* TODO -BOOL ray_hemiellipsoid(const LLVector3 &ray_point, const LLVector3 &ray_direction, +bool ray_hemiellipsoid(const LLVector3 &ray_point, const LLVector3 &ray_direction,  					   const LLVector3 &e_center, const LLVector3 &e_scale, const LLQuaternion &e_rotation,  					   const LLVector3 &e_cut_normal,  					   LLVector3 &intersection, LLVector3 &intersection_normal); -BOOL ray_hemisphere(const LLVector3 &ray_point, const LLVector3 &ray_direction, +bool ray_hemisphere(const LLVector3 &ray_point, const LLVector3 &ray_direction,  					const LLVector3 &sphere_center, F32 sphere_radius, const LLVector3 &sphere_cut_normal,   					LLVector3 &intersection, LLVector3 &intersection_normal); -BOOL ray_hemicylinder(const LLVector3 &ray_point, const LLVector3 &ray_direction, +bool ray_hemicylinder(const LLVector3 &ray_point, const LLVector3 &ray_direction,  					  const LLVector3 &cyl_top, const LLVector3 &cyl_bottom, F32 cyl_radius,   					  const LLVector3 &cyl_cut_normal,  					  LLVector3 &intersection, LLVector3 &intersection_normal); -BOOL ray_hemicone(const LLVector3 &ray_point, const LLVector3 &ray_direction, +bool ray_hemicone(const LLVector3 &ray_point, const LLVector3 &ray_direction,  				  const LLVector3 &cone_tip, const LLVector3 &cone_bottom,   				  const LLVector3 &cone_scale, const LLVector3 &cyl_cut_normal,  				  LLVector3 &intersection, LLVector3 &intersection_normal);  */ -BOOL linesegment_circle(const LLVector3 &point_a, const LLVector3 &point_b,  +bool linesegment_circle(const LLVector3 &point_a, const LLVector3 &point_b,  						const LLVector3 &circle_center, const LLVector3 plane_normal, F32 circle_radius,  						LLVector3 &intersection);  // point_0 through point_2 define the plane_normal via the right-hand rule:  // circle from point_0 to point_2 with fingers ==> thumb points in direction of normal -BOOL linesegment_triangle(const LLVector3 &point_a, const LLVector3 &point_b,  +bool linesegment_triangle(const LLVector3 &point_a, const LLVector3 &point_b,  						  const LLVector3 &point_0, const LLVector3 &point_1, const LLVector3 &point_2,   						  LLVector3 &intersection, LLVector3 &intersection_normal); @@ -185,24 +185,24 @@ BOOL linesegment_triangle(const LLVector3 &point_a, const LLVector3 &point_b,  // right-hand-rule... curl fingers from lower-left toward lower-right then toward upper-right  // ==> thumb points in direction of normal  // assumes a parallelogram, so point_3 is determined by the other points -BOOL linesegment_quadrangle(const LLVector3 &point_a, const LLVector3 &point_b,  +bool linesegment_quadrangle(const LLVector3 &point_a, const LLVector3 &point_b,  							const LLVector3 &point_0, const LLVector3 &point_1, const LLVector3 &point_2,   							LLVector3 &intersection, LLVector3 &intersection_normal); -BOOL linesegment_sphere(const LLVector3 &point_a, const LLVector3 &point_b, +bool linesegment_sphere(const LLVector3 &point_a, const LLVector3 &point_b,  				const LLVector3 &sphere_center, F32 sphere_radius,  				LLVector3 &intersection, LLVector3 &intersection_normal);  // finite right cylinder is defined by end centers: "cyl_top", "cyl_bottom",   // and by the cylinder radius "cyl_radius" -BOOL linesegment_cylinder(const LLVector3 &point_a, const LLVector3 &point_b, +bool linesegment_cylinder(const LLVector3 &point_a, const LLVector3 &point_b,  						  const LLVector3 &cyl_center, const LLVector3 &cyl_scale, const LLQuaternion &cyl_rotation,  						  LLVector3 &intersection, LLVector3 &intersection_normal); -// this function doesn't just return a BOOL because the return is currently +// this function doesn't just return a bool because the return is currently  // used to decide how to break up boxes that have been hit by shots...   // a hack that will probably be changed later  // @@ -213,20 +213,17 @@ U32 linesegment_box(const LLVector3 &point_a, const LLVector3 &point_b,  					LLVector3 &intersection, LLVector3 &intersection_normal); -BOOL linesegment_prism(const LLVector3 &point_a, const LLVector3 &point_b, +bool linesegment_prism(const LLVector3 &point_a, const LLVector3 &point_b,  					   const LLVector3 &prism_center, const LLVector3 &prism_scale, const LLQuaternion &prism_rotation,  					   LLVector3 &intersection, LLVector3 &intersection_normal); -BOOL linesegment_tetrahedron(const LLVector3 &point_a, const LLVector3 &point_b, +bool linesegment_tetrahedron(const LLVector3 &point_a, const LLVector3 &point_b,  							 const LLVector3 &t_center, const LLVector3 &t_scale, const LLQuaternion &t_rotation,  							 LLVector3 &intersection, LLVector3 &intersection_normal); -BOOL linesegment_pyramid(const LLVector3 &point_a, const LLVector3 &point_b, +bool linesegment_pyramid(const LLVector3 &point_a, const LLVector3 &point_b,  						 const LLVector3 &p_center, const LLVector3 &p_scale, const LLQuaternion &p_rotation,  						 LLVector3 &intersection, LLVector3 &intersection_normal); - -  #endif - diff --git a/indra/llmath/tests/llbbox_test.cpp b/indra/llmath/tests/llbbox_test.cpp index fd0dbb58fc..373e2d02a0 100644 --- a/indra/llmath/tests/llbbox_test.cpp +++ b/indra/llmath/tests/llbbox_test.cpp @@ -340,11 +340,11 @@ namespace tut  		LLBBox bbox1(LLVector3(1.0f, 1.0f, 1.0f), LLQuaternion(),  					 LLVector3(1.0f, 2.0f, 3.0f), LLVector3(3.0f, 4.0f, 5.0f)); -		ensure("containsPointLocal(0,0,0)", bbox1.containsPointLocal(LLVector3(0.0f, 0.0f, 0.0f)) == FALSE); -		ensure("containsPointLocal(1,2,3)", bbox1.containsPointLocal(LLVector3(1.0f, 2.0f, 3.0f)) == TRUE); -		ensure("containsPointLocal(0.999,2,3)", bbox1.containsPointLocal(LLVector3(0.999f, 2.0f, 3.0f)) == FALSE); -		ensure("containsPointLocal(3,4,5)", bbox1.containsPointLocal(LLVector3(3.0f, 4.0f, 5.0f)) == TRUE); -		ensure("containsPointLocal(3,4,5.001)", bbox1.containsPointLocal(LLVector3(3.0f, 4.0f, 5.001f)) == FALSE); +		ensure("containsPointLocal(0,0,0)", bbox1.containsPointLocal(LLVector3(0.0f, 0.0f, 0.0f)) == false); +		ensure("containsPointLocal(1,2,3)", bbox1.containsPointLocal(LLVector3(1.0f, 2.0f, 3.0f)) == true); +		ensure("containsPointLocal(0.999,2,3)", bbox1.containsPointLocal(LLVector3(0.999f, 2.0f, 3.0f)) == false); +		ensure("containsPointLocal(3,4,5)", bbox1.containsPointLocal(LLVector3(3.0f, 4.0f, 5.0f)) == true); +		ensure("containsPointLocal(3,4,5.001)", bbox1.containsPointLocal(LLVector3(3.0f, 4.0f, 5.001f)) == false);  	}  	template<> template<> @@ -357,11 +357,11 @@ namespace tut  		LLBBox bbox1(LLVector3(1.0f, 1.0f, 1.0f), LLQuaternion(),  					 LLVector3(1.0f, 2.0f, 3.0f), LLVector3(3.0f, 4.0f, 5.0f)); -		ensure("containsPointAgent(0,0,0)", bbox1.containsPointAgent(LLVector3(0.0f, 0.0f, 0.0f)) == FALSE); -		ensure("containsPointAgent(2,3,4)", bbox1.containsPointAgent(LLVector3(2.0f, 3.0f, 4.0f)) == TRUE); -		ensure("containsPointAgent(2,2.999,4)", bbox1.containsPointAgent(LLVector3(2.0f, 2.999f, 4.0f)) == FALSE); -		ensure("containsPointAgent(4,5,6)", bbox1.containsPointAgent(LLVector3(4.0f, 5.0f, 6.0f)) == TRUE); -		ensure("containsPointAgent(4,5.001,6)", bbox1.containsPointAgent(LLVector3(4.0f, 5.001f, 6.0f)) == FALSE); +		ensure("containsPointAgent(0,0,0)", bbox1.containsPointAgent(LLVector3(0.0f, 0.0f, 0.0f)) == false); +		ensure("containsPointAgent(2,3,4)", bbox1.containsPointAgent(LLVector3(2.0f, 3.0f, 4.0f)) == true); +		ensure("containsPointAgent(2,2.999,4)", bbox1.containsPointAgent(LLVector3(2.0f, 2.999f, 4.0f)) == false); +		ensure("containsPointAgent(4,5,6)", bbox1.containsPointAgent(LLVector3(4.0f, 5.0f, 6.0f)) == true); +		ensure("containsPointAgent(4,5.001,6)", bbox1.containsPointAgent(LLVector3(4.0f, 5.001f, 6.0f)) == false);  	}				  } diff --git a/indra/llmath/tests/llrect_test.cpp b/indra/llmath/tests/llrect_test.cpp index d740173e69..365f298636 100644 --- a/indra/llmath/tests/llrect_test.cpp +++ b/indra/llmath/tests/llrect_test.cpp @@ -471,13 +471,13 @@ namespace tut  		LLRectf rect(1.0f, 3.0f, 3.0f, 1.0f); -		ensure("(0,0) not in rect", rect.pointInRect(0.0f, 0.0f) == FALSE); -		ensure("(2,2) in rect", rect.pointInRect(2.0f, 2.0f) == TRUE); -		ensure("(1,1) in rect", rect.pointInRect(1.0f, 1.0f) == TRUE); -		ensure("(3,3) not in rect", rect.pointInRect(3.0f, 3.0f) == FALSE); -		ensure("(2.999,2.999) in rect", rect.pointInRect(2.999f, 2.999f) == TRUE); -		ensure("(2.999,3.0) not in rect", rect.pointInRect(2.999f, 3.0f) == FALSE); -		ensure("(3.0,2.999) not in rect", rect.pointInRect(3.0f, 2.999f) == FALSE); +		ensure("(0,0) not in rect", rect.pointInRect(0.0f, 0.0f) == false); +		ensure("(2,2) in rect", rect.pointInRect(2.0f, 2.0f) == true); +		ensure("(1,1) in rect", rect.pointInRect(1.0f, 1.0f) == true); +		ensure("(3,3) not in rect", rect.pointInRect(3.0f, 3.0f) == false); +		ensure("(2.999,2.999) in rect", rect.pointInRect(2.999f, 2.999f) == true); +		ensure("(2.999,3.0) not in rect", rect.pointInRect(2.999f, 3.0f) == false); +		ensure("(3.0,2.999) not in rect", rect.pointInRect(3.0f, 2.999f) == false);  	}  	template<> template<> @@ -489,13 +489,13 @@ namespace tut  		LLRectf rect(1.0f, 3.0f, 3.0f, 1.0f); -		ensure("(0,0) in local rect", rect.localPointInRect(0.0f, 0.0f) == TRUE); -		ensure("(-0.0001,-0.0001) not in local rect", rect.localPointInRect(-0.0001f, -0.001f) == FALSE); -		ensure("(1,1) in local rect", rect.localPointInRect(1.0f, 1.0f) == TRUE); -		ensure("(2,2) not in local rect", rect.localPointInRect(2.0f, 2.0f) == FALSE); -		ensure("(1.999,1.999) in local rect", rect.localPointInRect(1.999f, 1.999f) == TRUE); -		ensure("(1.999,2.0) not in local rect", rect.localPointInRect(1.999f, 2.0f) == FALSE); -		ensure("(2.0,1.999) not in local rect", rect.localPointInRect(2.0f, 1.999f) == FALSE); +		ensure("(0,0) in local rect", rect.localPointInRect(0.0f, 0.0f) == true); +		ensure("(-0.0001,-0.0001) not in local rect", rect.localPointInRect(-0.0001f, -0.001f) == false); +		ensure("(1,1) in local rect", rect.localPointInRect(1.0f, 1.0f) == true); +		ensure("(2,2) not in local rect", rect.localPointInRect(2.0f, 2.0f) == false); +		ensure("(1.999,1.999) in local rect", rect.localPointInRect(1.999f, 1.999f) == true); +		ensure("(1.999,2.0) not in local rect", rect.localPointInRect(1.999f, 2.0f) == false); +		ensure("(2.0,1.999) not in local rect", rect.localPointInRect(2.0f, 1.999f) == false);  	}  	template<> template<> diff --git a/indra/llmath/tests/mathmisc_test.cpp b/indra/llmath/tests/mathmisc_test.cpp index f12140cf8f..46bdc1cf95 100644 --- a/indra/llmath/tests/mathmisc_test.cpp +++ b/indra/llmath/tests/mathmisc_test.cpp @@ -454,7 +454,7 @@ namespace tut  	template<> template<>  	void line_object::test<1>()  	{ -		// this is a test for LLLine::intersects(point) which returns TRUE  +		// this is a test for LLLine::intersects(point) which returns true   		// if the line passes within some tolerance of point  		// these tests will have some floating point error,  diff --git a/indra/llmath/tests/v2math_test.cpp b/indra/llmath/tests/v2math_test.cpp index 4d6a2eca93..06e1292941 100644 --- a/indra/llmath/tests/v2math_test.cpp +++ b/indra/llmath/tests/v2math_test.cpp @@ -93,15 +93,15 @@ namespace tut  	{  		F32 x =-2.0f, y = -3.0f ;  		LLVector2 vec2(x,y); -		ensure_equals("abs():Fail", vec2.abs(), TRUE); +		ensure_equals("abs():Fail", vec2.abs(), true);  		ensure("abs() x", is_approx_equal(vec2.mV[VX], 2.f));  		ensure("abs() y", is_approx_equal(vec2.mV[VY], 3.f)); -		ensure("isNull():Fail ", FALSE == vec2.isNull());	//Returns TRUE if vector has a _very_small_ length +		ensure("isNull():Fail ", false == vec2.isNull());	//Returns true if vector has a _very_small_ length  		x =.00000001f, y = .000001001f;  		vec2.setVec(x, y); -		ensure("isNull(): Fail ", TRUE == vec2.isNull());	 +		ensure("isNull(): Fail ", true == vec2.isNull());	  	}  	template<> template<> @@ -111,12 +111,12 @@ namespace tut  		LLVector2 vec2(x, y), vec3;  		vec3 = vec3.scaleVec(vec2);  		ensure("scaleVec: Fail ", vec3.mV[VX] == 0. && vec3.mV[VY] == 0.); -		ensure("isExactlyZero(): Fail", TRUE == vec3.isExactlyZero()); +		ensure("isExactlyZero(): Fail", true == vec3.isExactlyZero());  		vec3.setVec(2.f, 1.f);  		vec3 = vec3.scaleVec(vec2);  		ensure("scaleVec: Fail ", (2.f == vec3.mV[VX]) && (2.f == vec3.mV[VY])); -		ensure("isExactlyZero():Fail", FALSE == vec3.isExactlyZero()); +		ensure("isExactlyZero():Fail", false == vec3.isExactlyZero());  	}  	template<> template<> @@ -254,7 +254,7 @@ namespace tut  		vec3.clearVec();  		vec2.setVec(x1, y1);  		vec3.setVec(vec2); -		ensure("2:operator!= failed", (FALSE == (vec2 != vec3))); +		ensure("2:operator!= failed", (false == (vec2 != vec3)));  	}  	template<> template<>  	void v2math_object::test<13>() @@ -373,7 +373,7 @@ namespace tut  		x1 = 1.0f, y1 = 2.0f, x2 = 1.0f, y2 = 3.2234f;  		vec2.setVec(x1, y1);  		vec3.setVec(x2, y2); -		ensure("2:operator < failed", (FALSE == (vec3 < vec2)));	 +		ensure("2:operator < failed", (false == (vec3 < vec2)));	  	}  	template<> template<> diff --git a/indra/llmath/tests/v3color_test.cpp b/indra/llmath/tests/v3color_test.cpp index 29d1c483ab..0fb52394a5 100644 --- a/indra/llmath/tests/v3color_test.cpp +++ b/indra/llmath/tests/v3color_test.cpp @@ -209,7 +209,7 @@ namespace tut  		ensure("1:operator!= failed",(llcolor3 != llcolor3a));  		llcolor3.setToBlack();  		llcolor3a.setVec(llcolor3); -		ensure("2:operator!= failed", ( FALSE == (llcolor3a != llcolor3))); +		ensure("2:operator!= failed", ( false == (llcolor3a != llcolor3)));  	}  	template<> template<> diff --git a/indra/llmath/tests/v3dmath_test.cpp b/indra/llmath/tests/v3dmath_test.cpp index c4744e1b25..0c8c01a77a 100644 --- a/indra/llmath/tests/v3dmath_test.cpp +++ b/indra/llmath/tests/v3dmath_test.cpp @@ -128,15 +128,15 @@ namespace tut  		LLVector3d vec3D(x,y,z);  		vec3D.abs();  		ensure("1:abs:Fail  ", ((-x == vec3D.mdV[VX]) && (y == vec3D.mdV[VY]) && (-z == vec3D.mdV[VZ]))); -		ensure("2:isNull():Fail ", (FALSE == vec3D.isNull()));	 +		ensure("2:isNull():Fail ", (false == vec3D.isNull()));	  		vec3D.clearVec();  		x =.00000001, y = .000001001, z = .000001001;  		vec3D.setVec(x,y,z); -		ensure("3:isNull():Fail ", (TRUE == vec3D.isNull()));	 -		ensure("4:isExactlyZero():Fail ", (FALSE == vec3D.isExactlyZero()));	 +		ensure("3:isNull():Fail ", (true == vec3D.isNull()));	 +		ensure("4:isExactlyZero():Fail ", (false == vec3D.isExactlyZero()));	  		x =.0000000, y = .00000000, z = .00000000;  		vec3D.setVec(x,y,z); -		ensure("5:isExactlyZero():Fail ", (TRUE == vec3D.isExactlyZero()));	 +		ensure("5:isExactlyZero():Fail ", (true == vec3D.isExactlyZero()));	  	}  	template<> template<> @@ -353,7 +353,7 @@ namespace tut  	{  		F64 x1 = 1., y1 = 2., z1 = -1.1;  		LLVector3d vec3D(x1,y1,z1), vec3Da; -		ensure("1:operator!= failed",(TRUE == (vec3D !=vec3Da))); +		ensure("1:operator!= failed",(true == (vec3D !=vec3Da)));  		vec3Da = vec3D;  		ensure("2:operator== failed",(vec3D ==vec3Da));   		vec3D.clearVec(); @@ -362,7 +362,7 @@ namespace tut  		vec3D.setVec(x1,y1,z1);  		vec3Da.setVec(x1,y1,z1);  		ensure("3:operator== failed",(vec3D ==vec3Da));  -		ensure("4:operator!= failed",(FALSE == (vec3D !=vec3Da))); +		ensure("4:operator!= failed",(false == (vec3D !=vec3Da)));  	}  	template<> template<> @@ -482,10 +482,10 @@ namespace tut  		F64 x = 2.32, y = 1.212, z = -.12;  		F64 min = 0.0001, max = 3.0;  		LLVector3d vec3d(x,y,z);		 -		ensure("1:clamp:Fail ", (TRUE == (vec3d.clamp(min, max)))); +		ensure("1:clamp:Fail ", (true == (vec3d.clamp(min, max))));  		x = 0.000001f, z = 5.3f;  		vec3d.setVec(x,y,z); -		ensure("2:clamp:Fail ", (TRUE == (vec3d.clamp(min, max)))); +		ensure("2:clamp:Fail ", (true == (vec3d.clamp(min, max))));  	}  	template<> template<> @@ -494,11 +494,11 @@ namespace tut  		F64 x = 10., y = 20., z = -15.;  		F64 epsilon = .23425;  		LLVector3d vec3Da(x,y,z), vec3Db(x,y,z); -		ensure("1:are_parallel: Fail ", (TRUE == are_parallel(vec3Da,vec3Db,epsilon))); +		ensure("1:are_parallel: Fail ", (true == are_parallel(vec3Da,vec3Db,epsilon)));  		F64 x1 = -12., y1 = -20., z1 = -100.;  		vec3Db.clearVec();  		vec3Db.setVec(x1,y1,z1); -		ensure("2:are_parallel: Fail ", (FALSE == are_parallel(vec3Da,vec3Db,epsilon))); +		ensure("2:are_parallel: Fail ", (false == are_parallel(vec3Da,vec3Db,epsilon)));  	}  	template<> template<> diff --git a/indra/llmath/tests/v3math_test.cpp b/indra/llmath/tests/v3math_test.cpp index e4ae1c10ef..090f399e62 100644 --- a/indra/llmath/tests/v3math_test.cpp +++ b/indra/llmath/tests/v3math_test.cpp @@ -99,7 +99,7 @@ namespace tut  	{  		F32 x = 2.32f, y = 1.212f, z = -.12f;  		LLVector3 vec3(x,y,z); -		ensure("1:isFinite= Fail to initialize ", (TRUE == vec3.isFinite()));//need more test cases: +		ensure("1:isFinite= Fail to initialize ", (true == vec3.isFinite()));//need more test cases:  		vec3.clearVec();  		ensure("2:clearVec:Fail to set values ", ((0.f == vec3.mV[VX]) && (0.f == vec3.mV[VY]) && (0.f == vec3.mV[VZ])));  		vec3.setVec(x,y,z); @@ -137,10 +137,10 @@ namespace tut  		F32 x = 2.32f, y = 3.212f, z = -.12f;  		F32 min = 0.0001f, max = 3.0f;  		LLVector3 vec3(x,y,z);		 -		ensure("1:clamp:Fail  ", TRUE == vec3.clamp(min, max) && x == vec3.mV[VX] && max == vec3.mV[VY] && min == vec3.mV[VZ]); +		ensure("1:clamp:Fail  ", true == vec3.clamp(min, max) && x == vec3.mV[VX] && max == vec3.mV[VY] && min == vec3.mV[VZ]);  		x = 1.f, y = 2.2f, z = 2.8f;  		vec3.setVec(x,y,z); -		ensure("2:clamp:Fail  ", FALSE == vec3.clamp(min, max)); +		ensure("2:clamp:Fail  ", false == vec3.clamp(min, max));  	}  	template<> template<> @@ -157,11 +157,11 @@ namespace tut  	{  		F32 x =-2.0f, y = -3.0f, z = 1.23f ;  		LLVector3 vec3(x,y,z); -		ensure("1:abs():Fail ", (TRUE == vec3.abs()));	 -		ensure("2:isNull():Fail", (FALSE == vec3.isNull()));	//Returns TRUE if vector has a _very_small_ length +		ensure("1:abs():Fail ", (true == vec3.abs())); +		ensure("2:isNull():Fail", (false == vec3.isNull()));	//Returns true if vector has a _very_small_ length  		x =.00000001f, y = .000001001f, z = .000001001f;  		vec3.setVec(x,y,z); -		ensure("3:isNull(): Fail ", (TRUE == vec3.isNull()));	 +		ensure("3:isNull(): Fail ", (true == vec3.isNull()));  	}  	template<> template<> @@ -169,13 +169,13 @@ namespace tut  	{  		F32 x =-2.0f, y = -3.0f, z = 1.f ;  		LLVector3 vec3(x,y,z),vec3a; -		ensure("1:isExactlyZero():Fail ", (TRUE == vec3a.isExactlyZero())); +		ensure("1:isExactlyZero():Fail ", (true == vec3a.isExactlyZero()));  		vec3a = vec3a.scaleVec(vec3);  		ensure("2:scaleVec: Fail ", vec3a.mV[VX] == 0.f && vec3a.mV[VY] == 0.f && vec3a.mV[VZ] == 0.f);  		vec3a.setVec(x,y,z);  		vec3a = vec3a.scaleVec(vec3);  		ensure("3:scaleVec: Fail ", ((4 == vec3a.mV[VX]) && (9 == vec3a.mV[VY]) &&(1 == vec3a.mV[VZ]))); -		ensure("4:isExactlyZero():Fail ", (FALSE == vec3.isExactlyZero())); +		ensure("4:isExactlyZero():Fail ", (false == vec3.isExactlyZero()));  	}  	template<> template<> @@ -356,7 +356,7 @@ namespace tut  		vec3.clearVec();  		vec3.clearVec();  		vec3a.setVec(vec3); -		ensure("2:operator!= failed", ( FALSE == (vec3a != vec3))); +		ensure("2:operator!= failed", ( false == (vec3a != vec3)));  	}  	template<> template<> @@ -454,15 +454,15 @@ namespace tut  	{  		F32 x1 =-2.3f, y1 = 2.f,z1 = 1.2f, x2 = 1.3f, y2 = 1.11f, z2 = 1234.234f;  		LLVector3 vec3(x1,y1,z1), vec3a(x2,y2,z2); -		ensure("1:operator< failed", (TRUE == (vec3 < vec3a))); +		ensure("1:operator< failed", (true == (vec3 < vec3a)));  		x1 =-2.3f, y1 = 2.f,z1 = 1.2f, x2 = 1.3f, y2 = 2.f, z2 = 1234.234f;  		vec3.setVec(x1,y1,z1);  		vec3a.setVec(x2,y2,z2); -		ensure("2:operator< failed ", (TRUE == (vec3 < vec3a))); +		ensure("2:operator< failed ", (true == (vec3 < vec3a)));  		x1 =2.3f, y1 = 2.f,z1 = 1.2f, x2 = 1.3f,  		vec3.setVec(x1,y1,z1);  		vec3a.setVec(x2,y2,z2); -		ensure("3:operator< failed ", (FALSE == (vec3 < vec3a))); +		ensure("3:operator< failed ", (false == (vec3 < vec3a)));  	}  	template<> template<> diff --git a/indra/llmath/tests/v4coloru_test.cpp b/indra/llmath/tests/v4coloru_test.cpp index 12e607a820..1d3aa4c63d 100644 --- a/indra/llmath/tests/v4coloru_test.cpp +++ b/indra/llmath/tests/v4coloru_test.cpp @@ -287,10 +287,10 @@ namespace tut  		ensure("parseColor4U() failed to parse the color value ", ((12 == llcolor4u1.mV[VX]) && (23 == llcolor4u1.mV[VY]) && (132 == llcolor4u1.mV[VZ])&& (50 == llcolor4u1.mV[VW])));  		color = "12, 23, 132"; -		ensure("2:parseColor4U() failed to parse the color value ",  (FALSE == LLColor4U::parseColor4U(color, &llcolor4u1))); +		ensure("2:parseColor4U() failed to parse the color value ",  (false == LLColor4U::parseColor4U(color, &llcolor4u1)));  		color = "12"; -		ensure("2:parseColor4U() failed to parse the color value ",  (FALSE == LLColor4U::parseColor4U(color, &llcolor4u1))); +		ensure("2:parseColor4U() failed to parse the color value ",  (false == LLColor4U::parseColor4U(color, &llcolor4u1)));  	}  	template<> template<> diff --git a/indra/llmath/tests/v4math_test.cpp b/indra/llmath/tests/v4math_test.cpp index 9779dfded3..5308e7efd4 100644 --- a/indra/llmath/tests/v4math_test.cpp +++ b/indra/llmath/tests/v4math_test.cpp @@ -123,9 +123,9 @@ namespace tut  		vec4.abs();  		ensure("abs:Fail " ,((x == vec4.mV[VX]) && (-y == vec4.mV[VY]) && (-z == vec4.mV[VZ])&& (-w == vec4.mV[VW])));  		vec4.clearVec(); -		ensure("isExactlyClear:Fail " ,(TRUE == vec4.isExactlyClear())); +		ensure("isExactlyClear:Fail " ,(true == vec4.isExactlyClear()));  		vec4.zeroVec(); -		ensure("isExactlyZero:Fail " ,(TRUE == vec4.isExactlyZero())); +		ensure("isExactlyZero:Fail " ,(true == vec4.isExactlyZero()));  	}  	template<> template<> @@ -303,11 +303,11 @@ namespace tut  	{  		F32 x = 1.f, y = 2.f, z = -1.1f,epsilon = .23425f;  		LLVector4 vec4(x,y,z), vec4a(x,y,z); -		ensure("1:are_parallel: Fail " ,(TRUE == are_parallel(vec4a,vec4,epsilon))); +		ensure("1:are_parallel: Fail " ,(true == are_parallel(vec4a,vec4,epsilon)));  		x = 21.f, y = 12.f, z = -123.1f;  		vec4a.clearVec();  		vec4a.setVec(x,y,z); -		ensure("2:are_parallel: Fail " ,(FALSE == are_parallel(vec4a,vec4,epsilon))); +		ensure("2:are_parallel: Fail " ,(false == are_parallel(vec4a,vec4,epsilon)));  	}  	template<> template<> diff --git a/indra/llmath/tests/xform_test.cpp b/indra/llmath/tests/xform_test.cpp index 49870eef3c..6348b3225c 100644 --- a/indra/llmath/tests/xform_test.cpp +++ b/indra/llmath/tests/xform_test.cpp @@ -91,7 +91,7 @@ namespace tut  		xform_obj.setPositionZ(z);  		ensure("setPositionX/Y/Z failed: ", xform_obj.getPosition() == vec); -		xform_obj.setScaleChildOffset(TRUE); +		xform_obj.setScaleChildOffset(true);  		ensure("setScaleChildOffset failed: ", xform_obj.getScaleChildOffset());  		vec.setVec(x, y, z); @@ -121,7 +121,7 @@ namespace tut  		// Is that the expected behavior?  	} -	// test cases for inline BOOL setParent(LLXform *parent) and getParent() fn. +	// test cases for inline bool setParent(LLXform *parent) and getParent() fn.  	template<> template<>  	void xform_test_object_t::test<3>()	  	{		 @@ -216,7 +216,7 @@ namespace tut  		parent.setPosition(llvecpospar);  		LLVector3 llvecparentscale(1.0, 2.0, 0); -		parent.setScaleChildOffset(TRUE); +		parent.setScaleChildOffset(true);  		parent.setScale(llvecparentscale);  		LLQuaternion quat(1, 2, 3, 4); diff --git a/indra/llmath/v2math.cpp b/indra/llmath/v2math.cpp index a24571f2c8..22b37628d8 100644 --- a/indra/llmath/v2math.cpp +++ b/indra/llmath/v2math.cpp @@ -42,13 +42,13 @@ LLVector2 LLVector2::zero(0,0);  // Non-member functions  // Sets all values to absolute value of their original values -// Returns TRUE if data changed -BOOL LLVector2::abs() +// Returns true if data changed +bool LLVector2::abs()  { -	BOOL ret = FALSE; +	bool ret{ false }; -	if (mV[0] < 0.f) { mV[0] = -mV[0]; ret = TRUE; } -	if (mV[1] < 0.f) { mV[1] = -mV[1]; ret = TRUE; } +	if (mV[0] < 0.f) { mV[0] = -mV[0]; ret = true; } +	if (mV[1] < 0.f) { mV[1] = -mV[1]; ret = true; }  	return ret;  } @@ -67,7 +67,7 @@ F32 angle_between(const LLVector2& a, const LLVector2& b)  	return angle;  } -BOOL are_parallel(const LLVector2 &a, const LLVector2 &b, float epsilon) +bool are_parallel(const LLVector2 &a, const LLVector2 &b, float epsilon)  {  	LLVector2 an = a;  	LLVector2 bn = b; @@ -76,9 +76,9 @@ BOOL are_parallel(const LLVector2 &a, const LLVector2 &b, float epsilon)  	F32 dot = an * bn;  	if ( (1.0f - fabs(dot)) < epsilon)  	{ -		return TRUE; +		return true;  	} -	return FALSE; +	return false;  } diff --git a/indra/llmath/v2math.h b/indra/llmath/v2math.h index 2335a2e327..b1ac0b3340 100644 --- a/indra/llmath/v2math.h +++ b/indra/llmath/v2math.h @@ -78,12 +78,12 @@ class LLVector2  		F32		magVecSquared() const;		// deprecated  		F32		normVec();					// deprecated -		BOOL		abs();						// sets all values to absolute value of original value (first octant), returns TRUE if changed +		bool	abs();						// sets all values to absolute value of original value (first octant), returns true if changed  		const LLVector2&	scaleVec(const LLVector2& vec);				// scales per component by vec -		BOOL isNull();			// Returns TRUE if vector has a _very_small_ length -		BOOL isExactlyZero() const		{ return !mV[VX] && !mV[VY]; } +		bool isNull();			// Returns true if vector has a _very_small_ length +		bool isExactlyZero() const		{ return !mV[VX] && !mV[VY]; }  		F32 operator[](int idx) const { return mV[idx]; }  		F32 &operator[](int idx) { return mV[idx]; } @@ -114,7 +114,7 @@ class LLVector2  // Non-member functions   F32	angle_between(const LLVector2 &a, const LLVector2 &b);	// Returns angle (radians) between a and b -BOOL are_parallel(const LLVector2 &a, const LLVector2 &b, F32 epsilon=F_APPROXIMATELY_ZERO);	// Returns TRUE if a and b are very close to parallel +bool are_parallel(const LLVector2 &a, const LLVector2 &b, F32 epsilon=F_APPROXIMATELY_ZERO);	// Returns true if a and b are very close to parallel  F32	dist_vec(const LLVector2 &a, const LLVector2 &b);		// Returns distance between a and b  F32	dist_vec_squared(const LLVector2 &a, const LLVector2 &b);// Returns distance squared between a and b  F32	dist_vec_squared2D(const LLVector2 &a, const LLVector2 &b);// Returns distance squared between a and b ignoring Z component @@ -232,7 +232,7 @@ inline F32 LLVector2::lengthSquared(void) const  	return mV[0]*mV[0] + mV[1]*mV[1];  } -inline F32		LLVector2::normalize(void) +inline F32 LLVector2::normalize(void)  {  	F32 mag = (F32) sqrt(mV[0]*mV[0] + mV[1]*mV[1]);  	F32 oomag; @@ -299,13 +299,13 @@ inline const LLVector2&	LLVector2::scaleVec(const LLVector2& vec)  	return *this;  } -inline BOOL	LLVector2::isNull() +inline bool	LLVector2::isNull()  {  	if ( F_APPROXIMATELY_ZERO > mV[VX]*mV[VX] + mV[VY]*mV[VY] )  	{ -		return TRUE; +		return true;  	} -	return FALSE; +	return false;  } diff --git a/indra/llmath/v3dmath.cpp b/indra/llmath/v3dmath.cpp index a50cb3c6ca..cc7121da38 100644 --- a/indra/llmath/v3dmath.cpp +++ b/indra/llmath/v3dmath.cpp @@ -52,31 +52,31 @@ const LLVector3d LLVector3d::z_axis_neg(0, 0, -1);  // Clamps each values to range (min,max). -// Returns TRUE if data changed. -BOOL LLVector3d::clamp(F64 min, F64 max) +// Returns true if data changed. +bool LLVector3d::clamp(F64 min, F64 max)  { -	BOOL ret = FALSE; +	bool ret{ false }; -	if (mdV[0] < min) { mdV[0] = min; ret = TRUE; } -	if (mdV[1] < min) { mdV[1] = min; ret = TRUE; } -	if (mdV[2] < min) { mdV[2] = min; ret = TRUE; } +	if (mdV[0] < min) { mdV[0] = min; ret = true; } +	if (mdV[1] < min) { mdV[1] = min; ret = true; } +	if (mdV[2] < min) { mdV[2] = min; ret = true; } -	if (mdV[0] > max) { mdV[0] = max; ret = TRUE; } -	if (mdV[1] > max) { mdV[1] = max; ret = TRUE; } -	if (mdV[2] > max) { mdV[2] = max; ret = TRUE; } +	if (mdV[0] > max) { mdV[0] = max; ret = true; } +	if (mdV[1] > max) { mdV[1] = max; ret = true; } +	if (mdV[2] > max) { mdV[2] = max; ret = true; }  	return ret;  }  // Sets all values to absolute value of their original values -// Returns TRUE if data changed -BOOL LLVector3d::abs() +// Returns true if data changed +bool LLVector3d::abs()  { -	BOOL ret = FALSE; +	bool ret{ false }; -	if (mdV[0] < 0.0) { mdV[0] = -mdV[0]; ret = TRUE; } -	if (mdV[1] < 0.0) { mdV[1] = -mdV[1]; ret = TRUE; } -	if (mdV[2] < 0.0) { mdV[2] = -mdV[2]; ret = TRUE; } +	if (mdV[0] < 0.0) { mdV[0] = -mdV[0]; ret = true; } +	if (mdV[1] < 0.0) { mdV[1] = -mdV[1]; ret = true; } +	if (mdV[2] < 0.0) { mdV[2] = -mdV[2]; ret = true; }  	return ret;  } @@ -127,11 +127,11 @@ const LLVector3d&	LLVector3d::rotVec(F64 angle, F64 x, F64 y, F64 z)  } -BOOL LLVector3d::parseVector3d(const std::string& buf, LLVector3d* value) +bool LLVector3d::parseVector3d(const std::string& buf, LLVector3d* value)  { -	if( buf.empty() || value == NULL) +	if( buf.empty() || value == nullptr)  	{ -		return FALSE; +		return false;  	}  	LLVector3d v; @@ -139,9 +139,9 @@ BOOL LLVector3d::parseVector3d(const std::string& buf, LLVector3d* value)  	if( 3 == count )  	{  		value->setVec( v ); -		return TRUE; +		return true;  	} -	return FALSE; +	return false;  } diff --git a/indra/llmath/v3dmath.h b/indra/llmath/v3dmath.h index 4938273d5b..751d6d6228 100644 --- a/indra/llmath/v3dmath.h +++ b/indra/llmath/v3dmath.h @@ -68,9 +68,9 @@ class LLVector3d  			return ret;  		} -		inline BOOL isFinite() const;									// checks to see if all values of LLVector3d are finite -		BOOL		clamp(const F64 min, const F64 max);		// Clamps all values to (min,max), returns TRUE if data changed -		BOOL		abs();						// sets all values to absolute value of original value (first octant), returns TRUE if changed +		inline bool isFinite() const;									// checks to see if all values of LLVector3d are finite +		bool		clamp(const F64 min, const F64 max);		// Clamps all values to (min,max), returns true if data changed +		bool		abs();						// sets all values to absolute value of original value (first octant), returns true if changed  		inline const LLVector3d&	clear();		// Clears LLVector3d to (0, 0, 0, 1)  		inline const LLVector3d&	clearVec();		// deprecated @@ -98,8 +98,8 @@ class LLVector3d  		const LLVector3d&	rotVec(const LLMatrix3 &mat);				// Rotates by LLMatrix4 mat  		const LLVector3d&	rotVec(const LLQuaternion &q);				// Rotates by LLQuaternion q -		BOOL isNull() const;			// Returns TRUE if vector has a _very_small_ length -		BOOL isExactlyZero() const		{ return !mdV[VX] && !mdV[VY] && !mdV[VZ]; } +		bool isNull() const;			// Returns true if vector has a _very_small_ length +		bool isExactlyZero() const		{ return !mdV[VX] && !mdV[VY] && !mdV[VZ]; }  		const LLVector3d&	operator=(const LLVector4 &a); @@ -126,7 +126,7 @@ class LLVector3d  		friend std::ostream&	 operator<<(std::ostream& s, const LLVector3d& a);		// Stream a -		static BOOL parseVector3d(const std::string& buf, LLVector3d* value); +		static bool parseVector3d(const std::string& buf, LLVector3d* value);  }; @@ -189,7 +189,7 @@ inline LLVector3d::LLVector3d(const LLVector3d ©)  // Destructors  // checker -inline BOOL LLVector3d::isFinite() const +inline bool LLVector3d::isFinite() const  {  	return (llfinite(mdV[VX]) && llfinite(mdV[VY]) && llfinite(mdV[VZ]));  } @@ -472,13 +472,13 @@ inline LLVector3d lerp(const LLVector3d& a, const LLVector3d& b, const F64 u)  } -inline BOOL	LLVector3d::isNull() const +inline bool	LLVector3d::isNull() const  {  	if ( F_APPROXIMATELY_ZERO > mdV[VX]*mdV[VX] + mdV[VY]*mdV[VY] + mdV[VZ]*mdV[VZ] )  	{ -		return TRUE; +		return true;  	} -	return FALSE; +	return false;  } @@ -495,7 +495,7 @@ inline F64 angle_between(const LLVector3d& a, const LLVector3d& b)  	return angle;  } -inline BOOL are_parallel(const LLVector3d& a, const LLVector3d& b, const F64 epsilon) +inline bool are_parallel(const LLVector3d& a, const LLVector3d& b, const F64 epsilon)  {  	LLVector3d an = a;  	LLVector3d bn = b; @@ -504,10 +504,9 @@ inline BOOL are_parallel(const LLVector3d& a, const LLVector3d& b, const F64 eps  	F64 dot = an * bn;  	if ( (1.0f - fabs(dot)) < epsilon)  	{ -		return TRUE; +		return true;  	} -	return FALSE; - +	return false;  }  inline LLVector3d projected_vec(const LLVector3d& a, const LLVector3d& b) diff --git a/indra/llmath/v3math.cpp b/indra/llmath/v3math.cpp index 93010d2250..72e73a79ec 100644 --- a/indra/llmath/v3math.cpp +++ b/indra/llmath/v3math.cpp @@ -53,27 +53,27 @@ const LLVector3 LLVector3::all_one(1.f,1.f,1.f);  // Clamps each values to range (min,max). -// Returns TRUE if data changed. -BOOL LLVector3::clamp(F32 min, F32 max) +// Returns true if data changed. +bool LLVector3::clamp(F32 min, F32 max)  { -	BOOL ret = FALSE; +	bool ret{ false }; -	if (mV[0] < min) { mV[0] = min; ret = TRUE; } -	if (mV[1] < min) { mV[1] = min; ret = TRUE; } -	if (mV[2] < min) { mV[2] = min; ret = TRUE; } +	if (mV[0] < min) { mV[0] = min; ret = true; } +	if (mV[1] < min) { mV[1] = min; ret = true; } +	if (mV[2] < min) { mV[2] = min; ret = true; } -	if (mV[0] > max) { mV[0] = max; ret = TRUE; } -	if (mV[1] > max) { mV[1] = max; ret = TRUE; } -	if (mV[2] > max) { mV[2] = max; ret = TRUE; } +	if (mV[0] > max) { mV[0] = max; ret = true; } +	if (mV[1] > max) { mV[1] = max; ret = true; } +	if (mV[2] > max) { mV[2] = max; ret = true; }  	return ret;  }  // Clamps length to an upper limit.   -// Returns TRUE if the data changed -BOOL LLVector3::clampLength( F32 length_limit ) +// Returns true if the data changed +bool LLVector3::clampLength( F32 length_limit )  { -	BOOL changed = FALSE; +	bool changed{ false };  	F32 len = length();  	if (llfinite(len)) @@ -88,7 +88,7 @@ BOOL LLVector3::clampLength( F32 length_limit )  			mV[0] *= length_limit;  			mV[1] *= length_limit;  			mV[2] *= length_limit; -			changed = TRUE; +			changed = true;  		}  	}  	else @@ -108,7 +108,7 @@ BOOL LLVector3::clampLength( F32 length_limit )  			{  				// no it can't be salvaged --> clear it  				clear(); -				changed = TRUE; +				changed = true;  				break;  			}  		} @@ -134,31 +134,31 @@ BOOL LLVector3::clampLength( F32 length_limit )  	return changed;  } -BOOL LLVector3::clamp(const LLVector3 &min_vec, const LLVector3 &max_vec) +bool LLVector3::clamp(const LLVector3 &min_vec, const LLVector3 &max_vec)  { -	BOOL ret = FALSE; +	bool ret{ false }; -	if (mV[0] < min_vec[0]) { mV[0] = min_vec[0]; ret = TRUE; } -	if (mV[1] < min_vec[1]) { mV[1] = min_vec[1]; ret = TRUE; } -	if (mV[2] < min_vec[2]) { mV[2] = min_vec[2]; ret = TRUE; } +	if (mV[0] < min_vec[0]) { mV[0] = min_vec[0]; ret = true; } +	if (mV[1] < min_vec[1]) { mV[1] = min_vec[1]; ret = true; } +	if (mV[2] < min_vec[2]) { mV[2] = min_vec[2]; ret = true; } -	if (mV[0] > max_vec[0]) { mV[0] = max_vec[0]; ret = TRUE; } -	if (mV[1] > max_vec[1]) { mV[1] = max_vec[1]; ret = TRUE; } -	if (mV[2] > max_vec[2]) { mV[2] = max_vec[2]; ret = TRUE; } +	if (mV[0] > max_vec[0]) { mV[0] = max_vec[0]; ret = true; } +	if (mV[1] > max_vec[1]) { mV[1] = max_vec[1]; ret = true; } +	if (mV[2] > max_vec[2]) { mV[2] = max_vec[2]; ret = true; }  	return ret;  }  // Sets all values to absolute value of their original values -// Returns TRUE if data changed -BOOL LLVector3::abs() +// Returns true if data changed +bool LLVector3::abs()  { -	BOOL ret = FALSE; +	bool ret{ false }; -	if (mV[0] < 0.f) { mV[0] = -mV[0]; ret = TRUE; } -	if (mV[1] < 0.f) { mV[1] = -mV[1]; ret = TRUE; } -	if (mV[2] < 0.f) { mV[2] = -mV[2]; ret = TRUE; } +	if (mV[0] < 0.f) { mV[0] = -mV[0]; ret = true; } +	if (mV[1] < 0.f) { mV[1] = -mV[1]; ret = true; } +	if (mV[2] < 0.f) { mV[2] = -mV[2]; ret = true; }  	return ret;  } @@ -358,11 +358,11 @@ const LLVector3& operator*=(LLVector3 &a, const LLQuaternion &rot)  }  // static  -BOOL LLVector3::parseVector3(const std::string& buf, LLVector3* value) +bool LLVector3::parseVector3(const std::string& buf, LLVector3* value)  { -	if( buf.empty() || value == NULL) +	if( buf.empty() || value == nullptr)  	{ -		return FALSE; +		return false;  	}  	LLVector3 v; @@ -370,10 +370,10 @@ BOOL LLVector3::parseVector3(const std::string& buf, LLVector3* value)  	if( 3 == count )  	{  		value->setVec( v ); -		return TRUE; +		return true;  	} -	return FALSE; +	return false;  }  // Displacement from query point to nearest neighbor point on bounding box. diff --git a/indra/llmath/v3math.h b/indra/llmath/v3math.h index 068f489020..fa6ad06008 100644 --- a/indra/llmath/v3math.h +++ b/indra/llmath/v3math.h @@ -71,16 +71,16 @@ class LLVector3  		void setValue(const LLSD& sd); -		inline BOOL isFinite() const;									// checks to see if all values of LLVector3 are finite -		BOOL		clamp(F32 min, F32 max);		// Clamps all values to (min,max), returns TRUE if data changed -		BOOL		clamp(const LLVector3 &min_vec, const LLVector3 &max_vec); // Scales vector by another vector -		BOOL		clampLength( F32 length_limit );					// Scales vector to limit length to a value +		inline bool isFinite() const;									// checks to see if all values of LLVector3 are finite +		bool		clamp(F32 min, F32 max);		// Clamps all values to (min,max), returns true if data changed +		bool		clamp(const LLVector3 &min_vec, const LLVector3 &max_vec); // Scales vector by another vector +		bool		clampLength( F32 length_limit );					// Scales vector to limit length to a value  		void		quantize16(F32 lowerxy, F32 upperxy, F32 lowerz, F32 upperz);	// changes the vector to reflect quatization  		void		quantize8(F32 lowerxy, F32 upperxy, F32 lowerz, F32 upperz);	// changes the vector to reflect quatization  		void 		snap(S32 sig_digits);											// snaps x,y,z to sig_digits decimal places -		BOOL		abs();						// sets all values to absolute value of original value (first octant), returns TRUE if changed +		bool		abs();						// sets all values to absolute value of original value (first octant), returns true if changed  		inline void	clear();						// Clears LLVector3 to (0, 0, 0)  		inline void	setZero();						// Clears LLVector3 to (0, 0, 0) @@ -108,7 +108,7 @@ class LLVector3  		inline F32		normalize();	// Normalizes and returns the magnitude of LLVector3  		inline F32		normVec();		// deprecated -		inline BOOL inRange( F32 min, F32 max ) const; // Returns true if all values of the vector are between min and max +		inline bool inRange( F32 min, F32 max ) const; // Returns true if all values of the vector are between min and max  		const LLVector3&	rotVec(F32 angle, const LLVector3 &vec);	// Rotates about vec by angle radians  		const LLVector3&	rotVec(F32 angle, F32 x, F32 y, F32 z);		// Rotates about x,y,z by angle radians @@ -119,8 +119,8 @@ class LLVector3  		const LLVector3&	scaleVec(const LLVector3& vec);				// scales per component by vec  		LLVector3			scaledVec(const LLVector3& vec) const;			// get a copy of this vector scaled by vec -		BOOL isNull() const;			// Returns TRUE if vector has a _very_small_ length -		BOOL isExactlyZero() const		{ return !mV[VX] && !mV[VY] && !mV[VZ]; } +		bool isNull() const;			// Returns true if vector has a _very_small_ length +		bool isExactlyZero() const		{ return !mV[VX] && !mV[VY] && !mV[VZ]; }  		F32 operator[](int idx) const { return mV[idx]; }  		F32 &operator[](int idx) { return mV[idx]; } @@ -149,7 +149,7 @@ class LLVector3  		friend std::ostream&	 operator<<(std::ostream& s, const LLVector3 &a);		// Stream a -		static BOOL parseVector3(const std::string& buf, LLVector3* value); +		static bool parseVector3(const std::string& buf, LLVector3* value);  };  typedef LLVector3 LLSimLocalVec; @@ -157,7 +157,7 @@ typedef LLVector3 LLSimLocalVec;  // Non-member functions   F32	angle_between(const LLVector3 &a, const LLVector3 &b);	// Returns angle (radians) between a and b -BOOL are_parallel(const LLVector3 &a, const LLVector3 &b, F32 epsilon=F_APPROXIMATELY_ZERO);	// Returns TRUE if a and b are very close to parallel +bool are_parallel(const LLVector3 &a, const LLVector3 &b, F32 epsilon=F_APPROXIMATELY_ZERO);	// Returns true if a and b are very close to parallel  F32	dist_vec(const LLVector3 &a, const LLVector3 &b);		// Returns distance between a and b  F32	dist_vec_squared(const LLVector3 &a, const LLVector3 &b);// Returns distance squared between a and b  F32	dist_vec_squared2D(const LLVector3 &a, const LLVector3 &b);// Returns distance squared between a and b ignoring Z component @@ -202,7 +202,7 @@ inline LLVector3::LLVector3(const LLVector3 ©)  // Destructors  // checker -inline BOOL LLVector3::isFinite() const +inline bool LLVector3::isFinite() const  {  	return (llfinite(mV[VX]) && llfinite(mV[VY]) && llfinite(mV[VZ]));  } @@ -350,7 +350,7 @@ inline F32	LLVector3::magVecSquared(void) const  	return mV[0]*mV[0] + mV[1]*mV[1] + mV[2]*mV[2];  } -inline BOOL LLVector3::inRange( F32 min, F32 max ) const +inline bool LLVector3::inRange( F32 min, F32 max ) const  {  	return mV[0] >= min && mV[0] <= max &&  		   mV[1] >= min && mV[1] <= max && @@ -539,13 +539,13 @@ inline LLVector3 lerp(const LLVector3 &a, const LLVector3 &b, F32 u)  } -inline BOOL	LLVector3::isNull() const +inline bool	LLVector3::isNull() const  {  	if ( F_APPROXIMATELY_ZERO > mV[VX]*mV[VX] + mV[VY]*mV[VY] + mV[VZ]*mV[VZ] )  	{ -		return TRUE; +		return true;  	} -	return FALSE; +	return false;  }  inline void update_min_max(LLVector3& min, LLVector3& max, const LLVector3& pos) @@ -589,7 +589,7 @@ inline F32 angle_between(const LLVector3& a, const LLVector3& b)  	return atan2f(sqrtf(c * c), ab); // return the angle  } -inline BOOL are_parallel(const LLVector3 &a, const LLVector3 &b, F32 epsilon) +inline bool are_parallel(const LLVector3 &a, const LLVector3 &b, F32 epsilon)  {  	LLVector3 an = a;  	LLVector3 bn = b; @@ -598,9 +598,9 @@ inline BOOL are_parallel(const LLVector3 &a, const LLVector3 &b, F32 epsilon)  	F32 dot = an * bn;  	if ( (1.0f - fabs(dot)) < epsilon)  	{ -		return TRUE; +		return true;  	} -	return FALSE; +	return false;  }  inline std::ostream& operator<<(std::ostream& s, const LLVector3 &a)  diff --git a/indra/llmath/v4color.cpp b/indra/llmath/v4color.cpp index a8768bda35..81d18285b9 100644 --- a/indra/llmath/v4color.cpp +++ b/indra/llmath/v4color.cpp @@ -385,18 +385,18 @@ void LLColor4::calcHSL(F32* hue, F32* saturation, F32* luminance) const  }  // static -BOOL LLColor4::parseColor(const std::string& buf, LLColor4* color) +bool LLColor4::parseColor(const std::string& buf, LLColor4* color)  { -	if( buf.empty() || color == NULL) +	if( buf.empty() || color == nullptr)  	{ -		return FALSE; +		return false;  	}  	boost_tokenizer tokens(buf, boost::char_separator<char>(", "));  	boost_tokenizer::iterator token_iter = tokens.begin();  	if (token_iter == tokens.end())  	{ -		return FALSE; +		return false;  	}  	// Grab the first token into a string, since we don't know @@ -708,15 +708,15 @@ BOOL LLColor4::parseColor(const std::string& buf, LLColor4* color)  		}  	} -	return TRUE; +	return true;  }  // static -BOOL LLColor4::parseColor4(const std::string& buf, LLColor4* value) +bool LLColor4::parseColor4(const std::string& buf, LLColor4* value)  { -	if( buf.empty() || value == NULL) +	if( buf.empty() || value == nullptr)  	{ -		return FALSE; +		return false;  	}  	LLColor4 v; @@ -729,10 +729,10 @@ BOOL LLColor4::parseColor4(const std::string& buf, LLColor4* value)  	if( 4 == count )  	{  		value->setVec( v ); -		return TRUE; +		return true;  	} -	return FALSE; +	return false;  }  // EOF diff --git a/indra/llmath/v4color.h b/indra/llmath/v4color.h index daa61594fb..498d4f7734 100644 --- a/indra/llmath/v4color.h +++ b/indra/llmath/v4color.h @@ -111,7 +111,7 @@ class LLColor4  		F32			lengthSquared() const;		// Returns magnitude squared of LLColor4  		F32			normalize();				// deprecated -- use normalize() -		BOOL		isOpaque() { return mV[VALPHA] == 1.f; } +		bool		isOpaque() { return mV[VALPHA] == 1.f; }  		F32 operator[](int idx) const { return mV[idx]; }  		F32 &operator[](int idx) { return mV[idx]; } @@ -226,8 +226,8 @@ class LLColor4  		static LLColor4 cyan5;  		static LLColor4 cyan6; -		static BOOL parseColor(const std::string& buf, LLColor4* color); -		static BOOL parseColor4(const std::string& buf, LLColor4* color); +		static bool parseColor(const std::string& buf, LLColor4* color); +		static bool parseColor4(const std::string& buf, LLColor4* color);  		inline void clamp();  }; diff --git a/indra/llmath/v4coloru.cpp b/indra/llmath/v4coloru.cpp index f1a2518cf3..d238d609b4 100644 --- a/indra/llmath/v4coloru.cpp +++ b/indra/llmath/v4coloru.cpp @@ -88,11 +88,11 @@ std::ostream& operator<<(std::ostream& s, const LLColor4U &a)  }  // static -BOOL LLColor4U::parseColor4U(const std::string& buf, LLColor4U* value) +bool LLColor4U::parseColor4U(const std::string& buf, LLColor4U* value)  { -	if( buf.empty() || value == NULL) +	if( buf.empty() || value == nullptr)  	{ -		return FALSE; +		return false;  	}  	U32 v[4]; @@ -104,17 +104,17 @@ BOOL LLColor4U::parseColor4U(const std::string& buf, LLColor4U* value)  	}  	if( 4 != count )  	{ -		return FALSE; +		return false;  	}  	for( S32 i = 0; i < 4; i++ )  	{  		if( v[i] > U8_MAX )  		{ -			return FALSE; +			return false;  		}  	}  	value->set( U8(v[0]), U8(v[1]), U8(v[2]), U8(v[3]) ); -	return TRUE; +	return true;  } diff --git a/indra/llmath/v4coloru.h b/indra/llmath/v4coloru.h index 0f2eff3d14..ca6a5425f9 100644 --- a/indra/llmath/v4coloru.h +++ b/indra/llmath/v4coloru.h @@ -112,12 +112,11 @@ public:  	LLColor4U addClampMax(const LLColor4U &color);						// Add and clamp the max  	LLColor4U multAll(const F32 k);										// Multiply ALL channels by scalar k -	const LLColor4U& combine();  	inline void setVecScaleClamp(const LLColor3 &color);  	inline void setVecScaleClamp(const LLColor4 &color); -	static BOOL parseColor4U(const std::string& buf, LLColor4U* value); +	static bool parseColor4U(const std::string& buf, LLColor4U* value);  	// conversion  	operator LLColor4() const diff --git a/indra/llmath/v4math.cpp b/indra/llmath/v4math.cpp index 2782cf2966..a68028d74a 100644 --- a/indra/llmath/v4math.cpp +++ b/indra/llmath/v4math.cpp @@ -36,28 +36,6 @@  // LLVector4  // Axis-Angle rotations - -/* -const LLVector4&	LLVector4::rotVec(F32 angle, const LLVector4 &vec) -{ -	if ( !vec.isExactlyZero() && angle ) -	{ -		*this = *this * LLMatrix4(angle, vec); -	} -	return *this; -} - -const LLVector4&	LLVector4::rotVec(F32 angle, F32 x, F32 y, F32 z) -{ -	LLVector3 vec(x, y, z); -	if ( !vec.isExactlyZero() && angle ) -	{ -		*this = *this * LLMatrix4(angle, vec); -	} -	return *this; -} -*/ -  const LLVector4&	LLVector4::rotVec(const LLMatrix4 &mat)  {  	*this = *this * mat; @@ -81,15 +59,15 @@ const LLVector4&	LLVector4::scaleVec(const LLVector4& vec)  }  // Sets all values to absolute value of their original values -// Returns TRUE if data changed -BOOL LLVector4::abs() +// Returns true if data changed +bool LLVector4::abs()  { -	BOOL ret = FALSE; +	bool ret{ false }; -	if (mV[0] < 0.f) { mV[0] = -mV[0]; ret = TRUE; } -	if (mV[1] < 0.f) { mV[1] = -mV[1]; ret = TRUE; } -	if (mV[2] < 0.f) { mV[2] = -mV[2]; ret = TRUE; } -	if (mV[3] < 0.f) { mV[3] = -mV[3]; ret = TRUE; } +	if (mV[0] < 0.f) { mV[0] = -mV[0]; ret = true; } +	if (mV[1] < 0.f) { mV[1] = -mV[1]; ret = true; } +	if (mV[2] < 0.f) { mV[2] = -mV[2]; ret = true; } +	if (mV[3] < 0.f) { mV[3] = -mV[3]; ret = true; }  	return ret;  } @@ -117,7 +95,7 @@ F32 angle_between( const LLVector4& a, const LLVector4& b )  	return angle;  } -BOOL are_parallel(const LLVector4 &a, const LLVector4 &b, F32 epsilon) +bool are_parallel(const LLVector4 &a, const LLVector4 &b, F32 epsilon)  {  	LLVector4 an = a;  	LLVector4 bn = b; @@ -125,8 +103,8 @@ BOOL are_parallel(const LLVector4 &a, const LLVector4 &b, F32 epsilon)  	bn.normalize();  	F32 dot = an * bn;  	if ( (1.0f - fabs(dot)) < epsilon) -		return TRUE; -	return FALSE; +		return true; +	return false;  } diff --git a/indra/llmath/v4math.h b/indra/llmath/v4math.h index b8835ba2e4..f46033db11 100644 --- a/indra/llmath/v4math.h +++ b/indra/llmath/v4math.h @@ -74,7 +74,7 @@ class LLVector4          } -		inline BOOL isFinite() const;									// checks to see if all values of LLVector3 are finite +		inline bool isFinite() const;									// checks to see if all values of LLVector3 are finite  		inline void	clear();		// Clears LLVector4 to (0, 0, 0, 1)  		inline void	clearVec();		// deprecated @@ -101,14 +101,12 @@ class LLVector4  		F32			normVec();					// deprecated  		// Sets all values to absolute value of their original values -		// Returns TRUE if data changed -		BOOL abs(); +		// Returns true if data changed +		bool abs(); -		BOOL isExactlyClear() const		{ return (mV[VW] == 1.0f) && !mV[VX] && !mV[VY] && !mV[VZ]; } -		BOOL isExactlyZero() const		{ return !mV[VW] && !mV[VX] && !mV[VY] && !mV[VZ]; } +		bool isExactlyClear() const		{ return (mV[VW] == 1.0f) && !mV[VX] && !mV[VY] && !mV[VZ]; } +		bool isExactlyZero() const		{ return !mV[VW] && !mV[VX] && !mV[VY] && !mV[VZ]; } -		const LLVector4&	rotVec(F32 angle, const LLVector4 &vec);	// Rotates about vec by angle radians -		const LLVector4&	rotVec(F32 angle, F32 x, F32 y, F32 z);		// Rotates about x,y,z by angle radians  		const LLVector4&	rotVec(const LLMatrix4 &mat);				// Rotates by MAT4 mat  		const LLVector4&	rotVec(const LLQuaternion &q);				// Rotates by QUAT q @@ -139,7 +137,7 @@ class LLVector4  // Non-member functions   F32 angle_between(const LLVector4 &a, const LLVector4 &b);		// Returns angle (radians) between a and b -BOOL are_parallel(const LLVector4 &a, const LLVector4 &b, F32 epsilon=F_APPROXIMATELY_ZERO);		// Returns TRUE if a and b are very close to parallel +bool are_parallel(const LLVector4 &a, const LLVector4 &b, F32 epsilon = F_APPROXIMATELY_ZERO);		// Returns true if a and b are very close to parallel  F32	dist_vec(const LLVector4 &a, const LLVector4 &b);			// Returns distance between a and b  F32	dist_vec_squared(const LLVector4 &a, const LLVector4 &b);	// Returns distance squared between a and b  LLVector3	vec4to3(const LLVector4 &vec); @@ -226,7 +224,7 @@ inline LLVector4::LLVector4(const LLSD &sd)  } -inline BOOL LLVector4::isFinite() const +inline bool LLVector4::isFinite() const  {  	return (llfinite(mV[VX]) && llfinite(mV[VY]) && llfinite(mV[VZ]) && llfinite(mV[VW]));  } diff --git a/indra/llmath/xform.cpp b/indra/llmath/xform.cpp index 5d8b93d5e8..838dee0a54 100644 --- a/indra/llmath/xform.cpp +++ b/indra/llmath/xform.cpp @@ -52,12 +52,12 @@ LLXform* LLXform::getRoot() const  	return (LLXform*)root;  } -BOOL LLXform::isRoot() const +bool LLXform::isRoot() const  {  	return (!mParent);  } -BOOL LLXform::isRootEdit() const +bool LLXform::isRootEdit() const  {  	return (!mParent);  } @@ -86,7 +86,7 @@ void LLXformMatrix::update()  	}  } -void LLXformMatrix::updateMatrix(BOOL update_bounds) +void LLXformMatrix::updateMatrix(bool update_bounds)  {  	update(); diff --git a/indra/llmath/xform.h b/indra/llmath/xform.h index 54b0f6d9ec..a301e4ca47 100644 --- a/indra/llmath/xform.h +++ b/indra/llmath/xform.h @@ -30,12 +30,12 @@  #include "m4math.h"  #include "llquaternion.h" -const F32 MAX_OBJECT_Z 		= 4096.f; // should match REGION_HEIGHT_METERS, Pre-havok4: 768.f -const F32 MIN_OBJECT_Z 		= -256.f; -const F32 DEFAULT_MAX_PRIM_SCALE = 64.f; -const F32 DEFAULT_MAX_PRIM_SCALE_NO_MESH = 10.f; -const F32 MIN_PRIM_SCALE = 0.01f; -const F32 MAX_PRIM_SCALE = 65536.f;	// something very high but not near FLT_MAX +constexpr F32 MAX_OBJECT_Z 		= 4096.f; // should match REGION_HEIGHT_METERS, Pre-havok4: 768.f +constexpr F32 MIN_OBJECT_Z 		= -256.f; +constexpr F32 DEFAULT_MAX_PRIM_SCALE = 64.f; +constexpr F32 DEFAULT_MAX_PRIM_SCALE_NO_MESH = 10.f; +constexpr F32 MIN_PRIM_SCALE = 0.01f; +constexpr F32 MAX_PRIM_SCALE = 65536.f;	// something very high but not near FLT_MAX  class LLXform  { @@ -52,7 +52,7 @@ protected:  	LLXform*      mParent;  	U32			  mChanged; -	BOOL		  mScaleChildOffset; +	bool		  mScaleChildOffset;  public:  	typedef enum e_changed_flags @@ -78,7 +78,7 @@ public:  		mScale.   setVec(1,1,1);  		mWorldPosition.clearVec();  		mWorldRotation.loadIdentity(); -		mScaleChildOffset = FALSE; +		mScaleChildOffset = false;  	}  	 LLXform(); @@ -86,7 +86,7 @@ public:  	void getLocalMat4(LLMatrix4 &mat) const { mat.initAll(mScale, mRotation, mPosition); } -	inline BOOL setParent(LLXform *parent); +	inline bool setParent(LLXform *parent);  	inline void setPosition(const LLVector3& pos);  	inline void setPosition(const F32 x, const F32 y, const F32 z); @@ -109,18 +109,18 @@ public:  	void warn(const char* const msg);  	void 		setChanged(const U32 bits)					{ mChanged |= bits; } -	BOOL		isChanged() const							{ return mChanged; } -	BOOL 		isChanged(const U32 bits) const				{ return mChanged & bits; } +	bool		isChanged() const							{ return mChanged; } +	bool 		isChanged(const U32 bits) const				{ return mChanged & bits; }  	void 		clearChanged()								{ mChanged = 0; }  	void        clearChanged(U32 bits)                      { mChanged &= ~bits; } -	void		setScaleChildOffset(BOOL scale)				{ mScaleChildOffset = scale; } -	BOOL		getScaleChildOffset()						{ return mScaleChildOffset; } +	void		setScaleChildOffset(bool scale)				{ mScaleChildOffset = scale; } +	bool		getScaleChildOffset()						{ return mScaleChildOffset; }  	LLXform* getParent() const { return mParent; }  	LLXform* getRoot() const; -	virtual BOOL isRoot() const; -	virtual BOOL isRootEdit() const; +	virtual bool isRoot() const; +	virtual bool isRootEdit() const;  	const LLVector3&	getPosition()  const	    { return mPosition; }  	const LLVector3&	getScale() const			{ return mScale; } @@ -149,7 +149,7 @@ public:  	}  	void update(); -	void updateMatrix(BOOL update_bounds = TRUE); +	void updateMatrix(bool update_bounds = true);  	void getMinMax(LLVector3& min,LLVector3& max) const;  protected: @@ -159,12 +159,12 @@ protected:  }; -BOOL LLXform::setParent(LLXform* parent) +bool LLXform::setParent(LLXform* parent)  {  	// Validate and make sure we're not creating a loop  	if (parent == mParent)  	{ -		return TRUE; +		return true;  	}  	if (parent)  	{ @@ -174,13 +174,13 @@ BOOL LLXform::setParent(LLXform* parent)  			if (cur_par == this)  			{  				//warn("LLXform::setParent Creating loop when setting parent!"); -				return FALSE; +				return false;  			}  			cur_par = cur_par->mParent;  		}  	}  	mParent = parent; -	return TRUE; +	return true;  }  void LLXform::setPosition(const LLVector3& pos)			 | 
