summaryrefslogtreecommitdiff
path: root/indra/llmath
diff options
context:
space:
mode:
Diffstat (limited to 'indra/llmath')
-rwxr-xr-xindra/llmath/llmath.h6
-rwxr-xr-xindra/llmath/llvolume.cpp17
2 files changed, 8 insertions, 15 deletions
diff --git a/indra/llmath/llmath.h b/indra/llmath/llmath.h
index cad2461e9c..eeb5cd3ee6 100755
--- a/indra/llmath/llmath.h
+++ b/indra/llmath/llmath.h
@@ -113,6 +113,12 @@ inline bool is_approx_zero( F32 f ) { return (-F_APPROXIMATELY_ZERO < f) && (f <
// WARNING: Infinity is comparable with F32_MAX and negative
// infinity is comparable with F32_MIN
+// handles negative and positive zeros
+inline bool is_zero(F32 x)
+{
+ return (*(U32*)(&x) & 0x7fffffff) == 0;
+}
+
inline bool is_approx_equal(F32 x, F32 y)
{
const S32 COMPARE_MANTISSA_UP_TO_BIT = 0x02;
diff --git a/indra/llmath/llvolume.cpp b/indra/llmath/llvolume.cpp
index 7867d2c546..41914446d1 100755
--- a/indra/llmath/llvolume.cpp
+++ b/indra/llmath/llvolume.cpp
@@ -7276,9 +7276,6 @@ void CalculateTangentArray(U32 vertexCount, const LLVector4a *vertex, const LLVe
LLVector4a n = normal[a];
const LLVector4a& t = tan1[a];
-
- llassert(tan1[a].getLength3().getF32() >= 0.f);
- llassert(tan2[a].getLength3().getF32() >= 0.f);
LLVector4a ncrosst;
ncrosst.setCross3(n,t);
@@ -7299,18 +7296,8 @@ void CalculateTangentArray(U32 vertexCount, const LLVector4a *vertex, const LLVe
tsubn.getF32ptr()[3] = handedness;
tangent[a] = tsubn;
-
- /*
- These are going off on invalid input and hindering other debugging.
- llassert(llfinite(tangent[a].getF32ptr()[0]));
- llassert(llfinite(tangent[a].getF32ptr()[1]));
- llassert(llfinite(tangent[a].getF32ptr()[2]));
-
- llassert(!llisnan(tangent[a].getF32ptr()[0]));
- llassert(!llisnan(tangent[a].getF32ptr()[1]));
- llassert(!llisnan(tangent[a].getF32ptr()[2]));*/
- }
- else
+ }
+ else
{ //degenerate, make up a value
tangent[a].set(0,0,1,1);
}