From 13b91ad30633cb50275b1ca4a25522da23107e34 Mon Sep 17 00:00:00 2001 From: Ansariel Hiller Date: Wed, 2 Oct 2024 19:53:17 +0200 Subject: Add a lot of more constexpr; use constants for accessing vector indices in vector math classes (#2766) --- indra/llmath/v4math.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'indra/llmath/v4math.cpp') diff --git a/indra/llmath/v4math.cpp b/indra/llmath/v4math.cpp index 0aa6eb09c3..e87bfc0013 100644 --- a/indra/llmath/v4math.cpp +++ b/indra/llmath/v4math.cpp @@ -36,13 +36,13 @@ // LLVector4 // Axis-Angle rotations -const LLVector4& LLVector4::rotVec(const LLMatrix4 &mat) +const LLVector4& LLVector4::rotVec(const LLMatrix4& mat) { *this = *this * mat; return *this; } -const LLVector4& LLVector4::rotVec(const LLQuaternion &q) +const LLVector4& LLVector4::rotVec(const LLQuaternion& q) { *this = *this * q; return *this; @@ -64,16 +64,16 @@ bool LLVector4::abs() { 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[VX] < 0.f) { mV[VX] = -mV[VX]; ret = true; } + if (mV[VY] < 0.f) { mV[VY] = -mV[VY]; ret = true; } + if (mV[VZ] < 0.f) { mV[VZ] = -mV[VZ]; ret = true; } + if (mV[VW] < 0.f) { mV[VW] = -mV[VW]; ret = true; } return ret; } -std::ostream& operator<<(std::ostream& s, const LLVector4 &a) +std::ostream& operator<<(std::ostream& s, const LLVector4& a) { s << "{ " << a.mV[VX] << ", " << a.mV[VY] << ", " << a.mV[VZ] << ", " << a.mV[VW] << " }"; return s; @@ -108,12 +108,12 @@ bool are_parallel(const LLVector4 &a, const LLVector4 &b, F32 epsilon) } -LLVector3 vec4to3(const LLVector4 &vec) +LLVector3 vec4to3(const LLVector4& vec) { return LLVector3( vec.mV[VX], vec.mV[VY], vec.mV[VZ] ); } -LLVector4 vec3to4(const LLVector3 &vec) +LLVector4 vec3to4(const LLVector3& vec) { return LLVector4(vec.mV[VX], vec.mV[VY], vec.mV[VZ]); } -- cgit v1.2.3