diff options
author | Ansariel <ansariel.hiller@phoenixviewer.com> | 2024-02-16 00:07:58 +0100 |
---|---|---|
committer | Andrey Lihatskiy <alihatskiy@productengine.com> | 2024-02-16 10:17:55 +0200 |
commit | 9480a98cffaafa5826b8daad20020cf399bbbefc (patch) | |
tree | 32ddf9fc0d844e27b58956aa8c5d68145164dbb8 /indra/llmath | |
parent | a02459dea6c24d851ab5e76f63f31376d9d4791c (diff) |
Replace most of BOOL with bool in llmath
Diffstat (limited to 'indra/llmath')
-rw-r--r-- | indra/llmath/llcoordframe.h | 2 | ||||
-rw-r--r-- | indra/llmath/llinterp.h | 53 | ||||
-rw-r--r-- | indra/llmath/llmath.h | 62 | ||||
-rw-r--r-- | indra/llmath/lloctree.h | 10 | ||||
-rw-r--r-- | indra/llmath/llquaternion.cpp | 2 | ||||
-rw-r--r-- | indra/llmath/llquaternion.h | 14 | ||||
-rw-r--r-- | indra/llmath/llrect.h | 8 | ||||
-rw-r--r-- | indra/llmath/llvolume.cpp | 57 | ||||
-rw-r--r-- | indra/llmath/llvolume.h | 17 | ||||
-rw-r--r-- | indra/llmath/llvolumeoctree.cpp | 2 | ||||
-rw-r--r-- | indra/llmath/raytrace.cpp | 113 | ||||
-rw-r--r-- | indra/llmath/raytrace.h | 25 | ||||
-rw-r--r-- | indra/llmath/v2math.cpp | 14 | ||||
-rw-r--r-- | indra/llmath/v2math.h | 16 | ||||
-rw-r--r-- | indra/llmath/v3dmath.cpp | 36 | ||||
-rw-r--r-- | indra/llmath/v3dmath.h | 27 | ||||
-rw-r--r-- | indra/llmath/v3math.cpp | 60 | ||||
-rw-r--r-- | indra/llmath/v3math.h | 24 | ||||
-rw-r--r-- | indra/llmath/v4color.cpp | 20 | ||||
-rw-r--r-- | indra/llmath/v4color.h | 6 | ||||
-rw-r--r-- | indra/llmath/v4coloru.cpp | 12 | ||||
-rw-r--r-- | indra/llmath/v4coloru.h | 3 | ||||
-rw-r--r-- | indra/llmath/v4math.cpp | 40 | ||||
-rw-r--r-- | indra/llmath/v4math.h | 14 |
24 files changed, 286 insertions, 351 deletions
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 1e7c39df65..0d1ffa5857 100644 --- a/indra/llmath/llquaternion.cpp +++ b/indra/llmath/llquaternion.cpp @@ -959,7 +959,7 @@ 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) { 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..4da29482fd 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(); @@ -138,7 +138,7 @@ 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 + 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/llvolume.cpp b/indra/llmath/llvolume.cpp index 838eb9c653..f9306d6bce 100644 --- a/indra/llmath/llvolume.cpp +++ b/indra/llmath/llvolume.cpp @@ -97,31 +97,31 @@ const S32 SCULPT_MIN_AREA_DETAIL = 1; 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++) { @@ -223,7 +223,7 @@ void calc_tangent_from_triangle( // 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) { @@ -285,15 +285,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; @@ -316,7 +316,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; @@ -329,7 +329,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 */ @@ -340,7 +340,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 */ @@ -351,32 +351,9 @@ BOOL LLTriangleRayIntersectTwoSided(const LLVector4a& vert0, const LLVector4a& v intersection_t = t; - return TRUE; + return true; } -//helper for non-aligned vectors -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) -{ - LLVector4a vert0a, vert1a, vert2a, origa, dira; - vert0a.load3(vert0.mV); - vert1a.load3(vert1.mV); - vert2a.load3(vert2.mV); - origa.load3(orig.mV); - dira.load3(dir.mV); - - if (two_sided) - { - return LLTriangleRayIntersectTwoSided(vert0a, vert1a, vert2a, origa, dira, - intersection_a, intersection_b, intersection_t); - } - else - { - return LLTriangleRayIntersect(vert0a, vert1a, vert2a, origa, dira, - intersection_a, intersection_b, intersection_t); - } -} - class LLVolumeOctreeRebound : public LLOctreeTravelerDepthFirst<LLVolumeTriangle, LLVolumeTriangle*> { public: diff --git a/indra/llmath/llvolume.h b/indra/llmath/llvolume.h index 9048118243..c27bc5e821 100644 --- a/indra/llmath/llvolume.h +++ b/indra/llmath/llvolume.h @@ -1098,9 +1098,7 @@ private: F32 sculptGetSurfaceArea(); void sculptGenerateEmptyPlaceholder(); void sculptGenerateSpherePlaceholder(); - void sculptCalcMeshResolution(U16 width, U16 height, U8 type, S32& s, S32& t); - protected: BOOL generate(); void createVolumeFaces(); @@ -1142,18 +1140,13 @@ public: std::ostream& operator<<(std::ostream &s, const LLVolumeParams &volume_params); -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/llvolumeoctree.cpp b/indra/llmath/llvolumeoctree.cpp index 6894d04d3c..cef4d66c04 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/raytrace.cpp b/indra/llmath/raytrace.cpp index 314255374a..c3956e9995 100644 --- a/indra/llmath/raytrace.cpp +++ b/indra/llmath/raytrace.cpp @@ -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) { @@ -1229,11 +1229,11 @@ BOOL linesegment_prism(const LLVector3 &point_a, const LLVector3 &point_b, 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 92bca45566..3f7014c1b9 100644 --- a/indra/llmath/raytrace.h +++ b/indra/llmath/raytrace.h @@ -129,17 +129,17 @@ BOOL ray_cone(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); -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); @@ -170,13 +170,13 @@ BOOL ray_hemicone(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); // 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,19 +185,19 @@ 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); @@ -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/v2math.cpp b/indra/llmath/v2math.cpp index a24571f2c8..e86d8723a3 100644 --- a/indra/llmath/v2math.cpp +++ b/indra/llmath/v2math.cpp @@ -43,12 +43,12 @@ LLVector2 LLVector2::zero(0,0); // Sets all values to absolute value of their original values // Returns TRUE if data changed -BOOL LLVector2::abs() +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..e455b8742c 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..1be989d991 100644 --- a/indra/llmath/v3dmath.cpp +++ b/indra/llmath/v3dmath.cpp @@ -53,30 +53,30 @@ 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) +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() +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..1d1a7c7512 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..4a82051f2e 100644 --- a/indra/llmath/v3math.cpp +++ b/indra/llmath/v3math.cpp @@ -54,26 +54,26 @@ 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) +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 ) +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,17 +134,17 @@ 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; } @@ -152,13 +152,13 @@ BOOL LLVector3::clamp(const LLVector3 &min_vec, const LLVector3 &max_vec) // Sets all values to absolute value of their original values // Returns TRUE if data changed -BOOL LLVector3::abs() +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 31abf433a0..3d2365e04b 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 @@ -120,7 +120,7 @@ class LLVector3 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 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 && @@ -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; 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..8388fbdbc4 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; @@ -82,14 +60,14 @@ 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() +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..8a0a882cf0 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 @@ -102,13 +102,11 @@ class LLVector4 // Sets all values to absolute value of their original values // Returns TRUE if data changed - BOOL abs(); + 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])); } |