summaryrefslogtreecommitdiff
path: root/indra/llmath
diff options
context:
space:
mode:
Diffstat (limited to 'indra/llmath')
-rw-r--r--indra/llmath/llmatrix4a.h28
-rw-r--r--indra/llmath/llvector4a.h43
-rw-r--r--indra/llmath/llvolume.h6
-rw-r--r--indra/llmath/llvolumeoctree.cpp6
-rw-r--r--indra/llmath/llvolumeoctree.h6
5 files changed, 78 insertions, 11 deletions
diff --git a/indra/llmath/llmatrix4a.h b/indra/llmath/llmatrix4a.h
index cf4e522467..3b423f783a 100644
--- a/indra/llmath/llmatrix4a.h
+++ b/indra/llmath/llmatrix4a.h
@@ -46,6 +46,34 @@ public:
loadu(val);
}
+ explicit LLMatrix4a(const F32* val)
+ {
+ loadu(val);
+ }
+
+ static const LLMatrix4a& identity()
+ {
+ static const F32 v[] =
+ { 1.f, 0.f, 0.f, 0.f,
+ 0.f, 1.f, 0.f, 0.f,
+ 0.f, 0.f, 1.f, 0.f,
+ 0.f, 0.f, 0.f, 1.f
+ };
+ static LLMatrix4a identity_mat(v);
+
+ return identity_mat;
+ }
+
+ bool operator==(const LLMatrix4a& rhs) const
+ {
+ return mMatrix[0] == rhs.mMatrix[0] && mMatrix[1] == rhs.mMatrix[1] && mMatrix[2] == rhs.mMatrix[2] && mMatrix[3] == rhs.mMatrix[3];
+ }
+
+ bool operator!=(const LLMatrix4a& rhs) const
+ {
+ return !(*this == rhs);
+ }
+
inline F32* getF32ptr()
{
return (F32*) &mMatrix;
diff --git a/indra/llmath/llvector4a.h b/indra/llmath/llvector4a.h
index ea80b33e2d..8ef560dadf 100644
--- a/indra/llmath/llvector4a.h
+++ b/indra/llmath/llvector4a.h
@@ -117,6 +117,49 @@ public:
mQ = q;
}
+ bool operator==(const LLVector4a& rhs) const
+ {
+ return equals4(rhs);
+ }
+
+ bool operator!=(const LLVector4a& rhs) const
+ {
+ return !(*this == rhs);
+ }
+
+ const LLVector4a& operator+=(const LLVector4a& rhs)
+ {
+ add(rhs);
+ return *this;
+ }
+
+ const LLVector4a& operator-=(const LLVector4a& rhs)
+ {
+ sub(rhs);
+ return *this;
+ }
+
+ LLVector4a operator+(const LLVector4a& rhs) const
+ {
+ LLVector4a result = *this;
+ result.add(rhs);
+ return result;
+ }
+
+ LLVector4a operator-(const LLVector4a& rhs) const
+ {
+ LLVector4a result = *this;
+ result.sub(rhs);
+ return result;
+ }
+
+ LLVector4a cross3(const LLVector4a& b) const
+ {
+ LLVector4a result;
+ result.setCross3(*this, b);
+ return result;
+ }
+
////////////////////////////////////
// LOAD/STORE
////////////////////////////////////
diff --git a/indra/llmath/llvolume.h b/indra/llmath/llvolume.h
index 9760ad7cf2..bbb2a16b0b 100644
--- a/indra/llmath/llvolume.h
+++ b/indra/llmath/llvolume.h
@@ -190,11 +190,13 @@ 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_GLTF = 6;
+constexpr U8 LL_SCULPT_TYPE_MAX = LL_SCULPT_TYPE_GLTF;
+
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;
+ LL_SCULPT_TYPE_CYLINDER | LL_SCULPT_TYPE_MESH | LL_SCULPT_TYPE_GLTF;
// for value checks, assign new value after adding new types
-constexpr U8 LL_SCULPT_TYPE_MAX = LL_SCULPT_TYPE_MESH;
constexpr U8 LL_SCULPT_FLAG_INVERT = 64;
constexpr U8 LL_SCULPT_FLAG_MIRROR = 128;
diff --git a/indra/llmath/llvolumeoctree.cpp b/indra/llmath/llvolumeoctree.cpp
index 00c0988092..71288daa89 100644
--- a/indra/llmath/llvolumeoctree.cpp
+++ b/indra/llmath/llvolumeoctree.cpp
@@ -151,7 +151,7 @@ void LLOctreeTriangleRayIntersect::visit(const LLOctreeNode<LLVolumeTriangle, LL
U32 idx1 = tri->mIndex[1];
U32 idx2 = tri->mIndex[2];
- if (mTexCoord != NULL)
+ if (mTexCoord != NULL && mFace->mTexCoords)
{
LLVector2* tc = (LLVector2*) mFace->mTexCoords;
*mTexCoord = ((1.f - a - b) * tc[idx0] +
@@ -160,7 +160,7 @@ void LLOctreeTriangleRayIntersect::visit(const LLOctreeNode<LLVolumeTriangle, LL
}
- if (mNormal != NULL)
+ if (mNormal != NULL && mFace->mNormals)
{
LLVector4a* norm = mFace->mNormals;
@@ -180,7 +180,7 @@ void LLOctreeTriangleRayIntersect::visit(const LLOctreeNode<LLVolumeTriangle, LL
*mNormal = n1;
}
- if (mTangent != NULL)
+ if (mTangent != NULL && mFace->mTangents)
{
LLVector4a* tangents = mFace->mTangents;
diff --git a/indra/llmath/llvolumeoctree.h b/indra/llmath/llvolumeoctree.h
index 827d657835..05d45f7b5f 100644
--- a/indra/llmath/llvolumeoctree.h
+++ b/indra/llmath/llvolumeoctree.h
@@ -48,12 +48,6 @@ public:
*this = rhs;
}
- const LLVolumeTriangle& operator=(const LLVolumeTriangle& rhs)
- {
- LL_ERRS() << "Illegal operation!" << LL_ENDL;
- return *this;
- }
-
~LLVolumeTriangle()
{