[EEP] LLMath update

This commit is contained in:
Lirusaito
2019-03-24 22:50:43 -04:00
parent 98d315b3f7
commit 0ac2560508
8 changed files with 81 additions and 3 deletions

View File

@@ -93,6 +93,11 @@ F32 LLCamera::getMaxView() const
: MAX_FIELD_OF_VIEW; // narrow views
}
LLPlane LLCamera::getUserClipPlane() const
{
return mAgentPlanes[AGENT_PLANE_USER_CLIP];
}
// ---------------- LLCamera::setFoo() member functions ----------------
void LLCamera::setUserClipPlane(const LLPlane& plane)

View File

@@ -154,6 +154,7 @@ public:
bool isChanged(); //check if mAgentPlanes changed since last frame.
LLPlane getUserClipPlane() const;
void setUserClipPlane(const LLPlane& plane);
void disableUserClipPlane();
virtual void setView(F32 vertical_fov_rads);

View File

@@ -2195,6 +2195,12 @@ BOOL LLVolume::generate()
LLVector4a* end_profile = profile+sizeT;
LLVector4a offset = mPathp->mPath[s].mPos;
if (!offset.isFinite3())
{ // MAINT-5660; don't know why this happens, does not affect Release builds
LL_WARNS() << "LLVolume using path with non-finite points. Resetting them to 0,0,0" << LL_ENDL;
offset.clear();
}
LLVector4a tmp;
// Run along the profile.
@@ -2202,7 +2208,6 @@ BOOL LLVolume::generate()
{
rot_mat.rotate(*profile++, tmp);
dst->setAdd(tmp,offset);
llassert(dst->isFinite3());
++dst;
}
}

View File

@@ -118,7 +118,7 @@ LLSD LLVector2::getValue() const
return ret;
}
void LLVector2::setValue(LLSD& sd)
void LLVector2::setValue(const LLSD& sd)
{
mV[0] = (F32) sd[0].asReal();
mV[1] = (F32) sd[1].asReal();

View File

@@ -49,6 +49,7 @@ class LLVector2
LLVector2(F32 x, F32 y); // Initializes LLVector2 to (x. y)
LLVector2(const F32 *vec); // Initializes LLVector2 to (vec[0]. vec[1])
explicit LLVector2(const LLVector3 &vec); // Initializes LLVector2 to (vec[0]. vec[1])
explicit LLVector2(const LLSD &sd);
// Clears LLVector2 to (0, 0). DEPRECATED - prefer zeroVec.
void clear();
@@ -61,7 +62,7 @@ class LLVector2
void set(const F32 *vec); // Sets LLVector2 to vec
LLSD getValue() const;
void setValue(LLSD& sd);
void setValue(const LLSD& sd);
void setVec(F32 x, F32 y); // deprecated
void setVec(const LLVector2 &vec); // deprecated
@@ -145,6 +146,10 @@ inline LLVector2::LLVector2(const LLVector3 &vec)
mV[VY] = vec.mV[VY];
}
inline LLVector2::LLVector2(const LLSD &sd)
{
setValue(sd);
}
// Clear and Assignment Functions

View File

@@ -100,6 +100,23 @@ public:
const LLColor3& operator=(const LLColor4 &a);
LL_FORCE_INLINE LLColor3 divide(const LLColor3 &col2)
{
return LLColor3(
mV[0] / col2.mV[0],
mV[1] / col2.mV[1],
mV[2] / col2.mV[2] );
}
LL_FORCE_INLINE LLColor3 color_norm() const
{
F32 l = length();
return LLColor3(
mV[0] / l,
mV[1] / l,
mV[2] / l );
}
friend std::ostream& operator<<(std::ostream& s, const LLColor3 &a); // Print a
friend LLColor3 operator+(const LLColor3 &a, const LLColor3 &b); // Return vector a + b
friend LLColor3 operator-(const LLColor3 &a, const LLColor3 &b); // Return vector a minus b

View File

@@ -114,9 +114,11 @@ class LLColor4
friend LLColor4 operator-(const LLColor4 &a, const LLColor4 &b); // Return vector a minus b
friend LLColor4 operator*(const LLColor4 &a, const LLColor4 &b); // Return component wise a * b
friend LLColor4 operator*(const LLColor4 &a, F32 k); // Return rgb times scaler k (no alpha change)
friend LLColor4 operator/(const LLColor4 &a, F32 k); // Return rgb divided by scalar k (no alpha change)
friend LLColor4 operator*(F32 k, const LLColor4 &a); // Return rgb times scaler k (no alpha change)
friend LLColor4 operator%(const LLColor4 &a, F32 k); // Return alpha times scaler k (no rgb change)
friend LLColor4 operator%(F32 k, const LLColor4 &a); // Return alpha times scaler k (no rgb change)
friend bool operator==(const LLColor4 &a, const LLColor4 &b); // Return a == b
friend bool operator!=(const LLColor4 &a, const LLColor4 &b); // Return a != b
@@ -477,6 +479,15 @@ inline LLColor4 operator*(const LLColor4 &a, F32 k)
a.mV[VW]);
}
inline LLColor4 operator/(const LLColor4 &a, F32 k)
{
return LLColor4(
a.mV[VX] / k,
a.mV[VY] / k,
a.mV[VZ] / k,
a.mV[VW]);
}
inline LLColor4 operator*(F32 k, const LLColor4 &a)
{
// only affects rgb (not a!)

View File

@@ -30,6 +30,7 @@
#include "llerror.h"
#include "llmath.h"
#include "v3math.h"
#include "v2math.h"
class LLMatrix3;
class LLMatrix4;
@@ -46,8 +47,11 @@ class LLVector4
LLVector4(); // Initializes LLVector4 to (0, 0, 0, 1)
explicit LLVector4(const F32 *vec); // Initializes LLVector4 to (vec[0]. vec[1], vec[2], vec[3])
explicit LLVector4(const F64 *vec); // Initialized LLVector4 to ((F32) vec[0], (F32) vec[1], (F32) vec[3], (F32) vec[4]);
explicit LLVector4(const LLVector2 &vec);
explicit LLVector4(const LLVector2 &vec, F32 z, F32 w);
explicit LLVector4(const LLVector3 &vec); // Initializes LLVector4 to (vec, 1)
explicit LLVector4(const LLVector3 &vec, F32 w); // Initializes LLVector4 to (vec, w)
explicit LLVector4(const LLSD &sd);
LLVector4(F32 x, F32 y, F32 z); // Initializes LLVector4 to (x. y, z, 1)
LLVector4(F32 x, F32 y, F32 z, F32 w);
@@ -61,6 +65,15 @@ class LLVector4
return ret;
}
void setValue(const LLSD& sd)
{
mV[0] = sd[0].asReal();
mV[1] = sd[1].asReal();
mV[2] = sd[2].asReal();
mV[3] = sd[3].asReal();
}
inline BOOL isFinite() const; // checks to see if all values of LLVector3 are finite
inline void clear(); // Clears LLVector4 to (0, 0, 0, 1)
@@ -175,6 +188,22 @@ inline LLVector4::LLVector4(const F64 *vec)
mV[VW] = (F32) vec[VW];
}
inline LLVector4::LLVector4(const LLVector2 &vec)
{
mV[VX] = vec[VX];
mV[VY] = vec[VY];
mV[VZ] = 0.f;
mV[VW] = 0.f;
}
inline LLVector4::LLVector4(const LLVector2 &vec, F32 z, F32 w)
{
mV[VX] = vec[VX];
mV[VY] = vec[VY];
mV[VZ] = z;
mV[VW] = w;
}
inline LLVector4::LLVector4(const LLVector3 &vec)
{
mV[VX] = vec.mV[VX];
@@ -191,6 +220,11 @@ inline LLVector4::LLVector4(const LLVector3 &vec, F32 w)
mV[VW] = w;
}
inline LLVector4::LLVector4(const LLSD &sd)
{
setValue(sd);
}
inline BOOL LLVector4::isFinite() const
{