summaryrefslogtreecommitdiff
path: root/indra/llmath/m4math.h
diff options
context:
space:
mode:
authorDebi King (Dessie) <dessie@lindenlab.com>2011-06-09 14:06:04 -0400
committerDebi King (Dessie) <dessie@lindenlab.com>2011-06-09 14:06:04 -0400
commit3c539c498a328696c9aa3cd8f00519d9ad0a40e8 (patch)
tree49ec2d995791cf43842fbe0764f5e5fe124a95d8 /indra/llmath/m4math.h
parentffe8417a0410a554e22210c83feadeea76d0ab8a (diff)
parentd5041f5fb0850f71474f0b6a37e15ef322c509a7 (diff)
reconciled .hgtags
Diffstat (limited to 'indra/llmath/m4math.h')
-rw-r--r--indra/llmath/m4math.h34
1 files changed, 30 insertions, 4 deletions
diff --git a/indra/llmath/m4math.h b/indra/llmath/m4math.h
index 6ec9958491..a7dce10397 100644
--- a/indra/llmath/m4math.h
+++ b/indra/llmath/m4math.h
@@ -119,6 +119,8 @@ public:
~LLMatrix4(void); // Destructor
+ LLSD getValue() const;
+ void setValue(const LLSD&);
//////////////////////////////
//
@@ -132,6 +134,7 @@ public:
// various useful matrix functions
const LLMatrix4& setIdentity(); // Load identity matrix
+ bool isIdentity() const;
const LLMatrix4& setZero(); // Clears matrix to all zeros.
const LLMatrix4& initRotation(const F32 angle, const F32 x, const F32 y, const F32 z); // Calculate rotation matrix by rotating angle radians about (x, y, z)
@@ -153,6 +156,7 @@ public:
const LLMatrix4& initRotTrans(const F32 roll, const F32 pitch, const F32 yaw, const LLVector4 &pos); // Rotation from Euler + translation
const LLMatrix4& initRotTrans(const LLQuaternion &q, const LLVector4 &pos); // Set with Quaternion and position
+ const LLMatrix4& initScale(const LLVector3 &scale);
// Set all
const LLMatrix4& initAll(const LLVector3 &scale, const LLQuaternion &q, const LLVector3 &pos);
@@ -219,10 +223,7 @@ public:
// Operators
//
-// Not implemented to enforce code that agrees with symbolic syntax
-// friend LLVector4 operator*(const LLMatrix4 &a, const LLVector4 &b); // Apply rotation a to vector b
-
-// friend inline LLMatrix4 operator*(const LLMatrix4 &a, const LLMatrix4 &b); // Return a * b
+ // friend inline LLMatrix4 operator*(const LLMatrix4 &a, const LLMatrix4 &b); // Return a * b
friend LLVector4 operator*(const LLVector4 &a, const LLMatrix4 &b); // Return transform of vector a by matrix b
friend const LLVector3 operator*(const LLVector3 &a, const LLMatrix4 &b); // Return full transform of a by matrix b
friend LLVector4 rotate_vector(const LLVector4 &a, const LLMatrix4 &b); // Rotates a but does not translate
@@ -230,6 +231,7 @@ public:
friend bool operator==(const LLMatrix4 &a, const LLMatrix4 &b); // Return a == b
friend bool operator!=(const LLMatrix4 &a, const LLMatrix4 &b); // Return a != b
+ friend bool operator<(const LLMatrix4 &a, const LLMatrix4& b); // Return a < b
friend const LLMatrix4& operator+=(LLMatrix4 &a, const LLMatrix4 &b); // Return a + b
friend const LLMatrix4& operator-=(LLMatrix4 &a, const LLMatrix4 &b); // Return a - b
@@ -263,6 +265,30 @@ inline const LLMatrix4& LLMatrix4::setIdentity()
return (*this);
}
+inline bool LLMatrix4::isIdentity() const
+{
+ return
+ mMatrix[0][0] == 1.f &&
+ mMatrix[0][1] == 0.f &&
+ mMatrix[0][2] == 0.f &&
+ mMatrix[0][3] == 0.f &&
+
+ mMatrix[1][0] == 0.f &&
+ mMatrix[1][1] == 1.f &&
+ mMatrix[1][2] == 0.f &&
+ mMatrix[1][3] == 0.f &&
+
+ mMatrix[2][0] == 0.f &&
+ mMatrix[2][1] == 0.f &&
+ mMatrix[2][2] == 1.f &&
+ mMatrix[2][3] == 0.f &&
+
+ mMatrix[3][0] == 0.f &&
+ mMatrix[3][1] == 0.f &&
+ mMatrix[3][2] == 0.f &&
+ mMatrix[3][3] == 1.f;
+}
+
/*
inline LLMatrix4 operator*(const LLMatrix4 &a, const LLMatrix4 &b)