summaryrefslogtreecommitdiff
path: root/indra/llmath
diff options
context:
space:
mode:
Diffstat (limited to 'indra/llmath')
-rw-r--r--indra/llmath/llrect.h2
-rw-r--r--indra/llmath/llvolume.cpp21
-rw-r--r--indra/llmath/raytrace.cpp2
-rw-r--r--indra/llmath/raytrace.h4
-rw-r--r--indra/llmath/tests/mathmisc_test.cpp2
-rw-r--r--indra/llmath/tests/v3math_test.cpp2
-rw-r--r--indra/llmath/v2math.cpp2
-rw-r--r--indra/llmath/v2math.h6
-rw-r--r--indra/llmath/v3dmath.cpp4
-rw-r--r--indra/llmath/v3dmath.h6
-rw-r--r--indra/llmath/v3math.cpp6
-rw-r--r--indra/llmath/v3math.h8
-rw-r--r--indra/llmath/v4math.cpp2
-rw-r--r--indra/llmath/v4math.h4
14 files changed, 41 insertions, 30 deletions
diff --git a/indra/llmath/llrect.h b/indra/llmath/llrect.h
index 4da29482fd..25af04be06 100644
--- a/indra/llmath/llrect.h
+++ b/indra/llmath/llrect.h
@@ -137,7 +137,7 @@ public:
}
// Note: Does NOT follow GL_QUAD conventions: the top and right edges ARE considered part of the rect
- // returns TRUE if any part of rect is is inside this LLRect
+ // returns true if any part of rect is is inside this LLRect
bool overlaps(const LLRectBase& rect) const
{
return !(mLeft > rect.mRight
diff --git a/indra/llmath/llvolume.cpp b/indra/llmath/llvolume.cpp
index 292e8f1ff4..5375e2813b 100644
--- a/indra/llmath/llvolume.cpp
+++ b/indra/llmath/llvolume.cpp
@@ -219,7 +219,7 @@ void calc_tangent_from_triangle(
// intersect test between triangle vert0, vert1, vert2 and a ray from orig in direction dir.
-// returns TRUE if intersecting and returns barycentric coordinates in intersection_a, intersection_b,
+// returns true if intersecting and returns barycentric coordinates in intersection_a, intersection_b,
// and returns the intersection point along dir in intersection_t.
// Moller-Trumbore algorithm
@@ -4492,7 +4492,7 @@ void LLVolumeParams::reduceT(F32 begin, F32 end)
const F32 MIN_CONCAVE_PROFILE_WEDGE = 0.125f; // 1/8 unity
const F32 MIN_CONCAVE_PATH_WEDGE = 0.111111f; // 1/9 unity
-// returns TRUE if the shape can be approximated with a convex shape
+// returns true if the shape can be approximated with a convex shape
// for collison purposes
bool LLVolumeParams::isConvex() const
{
@@ -4656,7 +4656,7 @@ bool LLVolume::isFaceMaskValid(LLFaceID face_mask)
bool LLVolume::isConvex() const
{
- // mParams.isConvex() may return FALSE even though the final
+ // mParams.isConvex() may return false even though the final
// geometry is actually convex due to LOD approximations.
// TODO -- provide LLPath and LLProfile with isConvex() methods
// that correctly determine convexity. -- Leviathan
@@ -5565,9 +5565,9 @@ bool LLVolumeFace::cacheOptimize(bool gen_tangents)
U32 stream_count = data.w.empty() ? 4 : 5;
- U32 vert_count = meshopt_generateVertexRemapMulti(&remap[0], nullptr, data.p.size(), data.p.size(), mos, stream_count);
+ size_t vert_count = meshopt_generateVertexRemapMulti(&remap[0], nullptr, data.p.size(), data.p.size(), mos, stream_count);
- if (vert_count < 65535)
+ if (vert_count < 65535 && vert_count != 0)
{
std::vector<U32> indices;
indices.resize(mNumIndices);
@@ -5586,6 +5586,13 @@ bool LLVolumeFace::cacheOptimize(bool gen_tangents)
{
U32 src_idx = i;
U32 dst_idx = remap[i];
+ if (dst_idx >= mNumVertices)
+ {
+ dst_idx = mNumVertices - 1;
+ // Shouldn't happen, figure out what gets returned in remap and why.
+ llassert(false);
+ LL_DEBUGS_ONCE("LLVOLUME") << "Invalid destination index, substituting" << LL_ENDL;
+ }
mIndices[i] = dst_idx;
mPositions[dst_idx].load3(data.p[src_idx].mV);
@@ -5619,6 +5626,10 @@ bool LLVolumeFace::cacheOptimize(bool gen_tangents)
}
else
{
+ if (vert_count == 0)
+ {
+ LL_WARNS_ONCE("LLVOLUME") << "meshopt_generateVertexRemapMulti failed to process a model or model was invalid" << LL_ENDL;
+ }
// blew past the max vertex size limit, use legacy tangent generation which never adds verts
createTangents();
}
diff --git a/indra/llmath/raytrace.cpp b/indra/llmath/raytrace.cpp
index 125374a4c2..117ba2369e 100644
--- a/indra/llmath/raytrace.cpp
+++ b/indra/llmath/raytrace.cpp
@@ -298,7 +298,7 @@ bool ray_cylinder(const LLVector3 &ray_point, const LLVector3 &ray_direction,
out = dist_to_closest_point + half_chord_length; // dist to exiting point
if (out < 0.0f)
{
- // cylinder is behind the ray, so we return FALSE
+ // cylinder is behind the ray, so we return false
return false;
}
diff --git a/indra/llmath/raytrace.h b/indra/llmath/raytrace.h
index f620e48459..2352790b1f 100644
--- a/indra/llmath/raytrace.h
+++ b/indra/llmath/raytrace.h
@@ -38,8 +38,8 @@ class LLQuaternion;
// Vector arguments of the form "shape_scale" represent the scale of the
// object along the three axes.
//
-// All functions return the expected TRUE or FALSE, unless otherwise noted.
-// When FALSE is returned, any resulting values that might have been stored
+// All functions return the expected true or false, unless otherwise noted.
+// When false is returned, any resulting values that might have been stored
// are undefined.
//
// Rays are defined by a "ray_point" and a "ray_direction" (unit).
diff --git a/indra/llmath/tests/mathmisc_test.cpp b/indra/llmath/tests/mathmisc_test.cpp
index f12140cf8f..46bdc1cf95 100644
--- a/indra/llmath/tests/mathmisc_test.cpp
+++ b/indra/llmath/tests/mathmisc_test.cpp
@@ -454,7 +454,7 @@ namespace tut
template<> template<>
void line_object::test<1>()
{
- // this is a test for LLLine::intersects(point) which returns TRUE
+ // this is a test for LLLine::intersects(point) which returns true
// if the line passes within some tolerance of point
// these tests will have some floating point error,
diff --git a/indra/llmath/tests/v3math_test.cpp b/indra/llmath/tests/v3math_test.cpp
index b1831af1cc..090f399e62 100644
--- a/indra/llmath/tests/v3math_test.cpp
+++ b/indra/llmath/tests/v3math_test.cpp
@@ -158,7 +158,7 @@ namespace tut
F32 x =-2.0f, y = -3.0f, z = 1.23f ;
LLVector3 vec3(x,y,z);
ensure("1:abs():Fail ", (true == vec3.abs()));
- ensure("2:isNull():Fail", (false == vec3.isNull())); //Returns TRUE if vector has a _very_small_ length
+ ensure("2:isNull():Fail", (false == vec3.isNull())); //Returns true if vector has a _very_small_ length
x =.00000001f, y = .000001001f, z = .000001001f;
vec3.setVec(x,y,z);
ensure("3:isNull(): Fail ", (true == vec3.isNull()));
diff --git a/indra/llmath/v2math.cpp b/indra/llmath/v2math.cpp
index e86d8723a3..22b37628d8 100644
--- a/indra/llmath/v2math.cpp
+++ b/indra/llmath/v2math.cpp
@@ -42,7 +42,7 @@ LLVector2 LLVector2::zero(0,0);
// Non-member functions
// Sets all values to absolute value of their original values
-// Returns TRUE if data changed
+// Returns true if data changed
bool LLVector2::abs()
{
bool ret{ false };
diff --git a/indra/llmath/v2math.h b/indra/llmath/v2math.h
index e455b8742c..b1ac0b3340 100644
--- a/indra/llmath/v2math.h
+++ b/indra/llmath/v2math.h
@@ -78,11 +78,11 @@ class LLVector2
F32 magVecSquared() const; // deprecated
F32 normVec(); // deprecated
- bool abs(); // sets all values to absolute value of original value (first octant), returns TRUE if changed
+ bool abs(); // sets all values to absolute value of original value (first octant), returns true if changed
const LLVector2& scaleVec(const LLVector2& vec); // scales per component by vec
- bool isNull(); // Returns TRUE if vector has a _very_small_ length
+ bool isNull(); // Returns true if vector has a _very_small_ length
bool isExactlyZero() const { return !mV[VX] && !mV[VY]; }
F32 operator[](int idx) const { return mV[idx]; }
@@ -114,7 +114,7 @@ class LLVector2
// Non-member functions
F32 angle_between(const LLVector2 &a, const LLVector2 &b); // Returns angle (radians) between a and b
-bool are_parallel(const LLVector2 &a, const LLVector2 &b, F32 epsilon=F_APPROXIMATELY_ZERO); // Returns TRUE if a and b are very close to parallel
+bool are_parallel(const LLVector2 &a, const LLVector2 &b, F32 epsilon=F_APPROXIMATELY_ZERO); // Returns true if a and b are very close to parallel
F32 dist_vec(const LLVector2 &a, const LLVector2 &b); // Returns distance between a and b
F32 dist_vec_squared(const LLVector2 &a, const LLVector2 &b);// Returns distance squared between a and b
F32 dist_vec_squared2D(const LLVector2 &a, const LLVector2 &b);// Returns distance squared between a and b ignoring Z component
diff --git a/indra/llmath/v3dmath.cpp b/indra/llmath/v3dmath.cpp
index 1be989d991..cc7121da38 100644
--- a/indra/llmath/v3dmath.cpp
+++ b/indra/llmath/v3dmath.cpp
@@ -52,7 +52,7 @@ const LLVector3d LLVector3d::z_axis_neg(0, 0, -1);
// Clamps each values to range (min,max).
-// Returns TRUE if data changed.
+// Returns true if data changed.
bool LLVector3d::clamp(F64 min, F64 max)
{
bool ret{ false };
@@ -69,7 +69,7 @@ bool LLVector3d::clamp(F64 min, F64 max)
}
// Sets all values to absolute value of their original values
-// Returns TRUE if data changed
+// Returns true if data changed
bool LLVector3d::abs()
{
bool ret{ false };
diff --git a/indra/llmath/v3dmath.h b/indra/llmath/v3dmath.h
index 1d1a7c7512..751d6d6228 100644
--- a/indra/llmath/v3dmath.h
+++ b/indra/llmath/v3dmath.h
@@ -69,8 +69,8 @@ class LLVector3d
}
inline bool isFinite() const; // checks to see if all values of LLVector3d are finite
- bool clamp(const F64 min, const F64 max); // Clamps all values to (min,max), returns TRUE if data changed
- bool abs(); // sets all values to absolute value of original value (first octant), returns TRUE if changed
+ bool clamp(const F64 min, const F64 max); // Clamps all values to (min,max), returns true if data changed
+ bool abs(); // sets all values to absolute value of original value (first octant), returns true if changed
inline const LLVector3d& clear(); // Clears LLVector3d to (0, 0, 0, 1)
inline const LLVector3d& clearVec(); // deprecated
@@ -98,7 +98,7 @@ class LLVector3d
const LLVector3d& rotVec(const LLMatrix3 &mat); // Rotates by LLMatrix4 mat
const LLVector3d& rotVec(const LLQuaternion &q); // Rotates by LLQuaternion q
- bool isNull() const; // Returns TRUE if vector has a _very_small_ length
+ bool isNull() const; // Returns true if vector has a _very_small_ length
bool isExactlyZero() const { return !mdV[VX] && !mdV[VY] && !mdV[VZ]; }
const LLVector3d& operator=(const LLVector4 &a);
diff --git a/indra/llmath/v3math.cpp b/indra/llmath/v3math.cpp
index 4a82051f2e..72e73a79ec 100644
--- a/indra/llmath/v3math.cpp
+++ b/indra/llmath/v3math.cpp
@@ -53,7 +53,7 @@ const LLVector3 LLVector3::all_one(1.f,1.f,1.f);
// Clamps each values to range (min,max).
-// Returns TRUE if data changed.
+// Returns true if data changed.
bool LLVector3::clamp(F32 min, F32 max)
{
bool ret{ false };
@@ -70,7 +70,7 @@ bool LLVector3::clamp(F32 min, F32 max)
}
// Clamps length to an upper limit.
-// Returns TRUE if the data changed
+// Returns true if the data changed
bool LLVector3::clampLength( F32 length_limit )
{
bool changed{ false };
@@ -151,7 +151,7 @@ bool LLVector3::clamp(const LLVector3 &min_vec, const LLVector3 &max_vec)
// Sets all values to absolute value of their original values
-// Returns TRUE if data changed
+// Returns true if data changed
bool LLVector3::abs()
{
bool ret{ false };
diff --git a/indra/llmath/v3math.h b/indra/llmath/v3math.h
index 3d2365e04b..fa6ad06008 100644
--- a/indra/llmath/v3math.h
+++ b/indra/llmath/v3math.h
@@ -72,7 +72,7 @@ class LLVector3
void setValue(const LLSD& sd);
inline bool isFinite() const; // checks to see if all values of LLVector3 are finite
- bool clamp(F32 min, F32 max); // Clamps all values to (min,max), returns TRUE if data changed
+ bool clamp(F32 min, F32 max); // Clamps all values to (min,max), returns true if data changed
bool clamp(const LLVector3 &min_vec, const LLVector3 &max_vec); // Scales vector by another vector
bool clampLength( F32 length_limit ); // Scales vector to limit length to a value
@@ -80,7 +80,7 @@ class LLVector3
void quantize8(F32 lowerxy, F32 upperxy, F32 lowerz, F32 upperz); // changes the vector to reflect quatization
void snap(S32 sig_digits); // snaps x,y,z to sig_digits decimal places
- bool abs(); // sets all values to absolute value of original value (first octant), returns TRUE if changed
+ bool abs(); // sets all values to absolute value of original value (first octant), returns true if changed
inline void clear(); // Clears LLVector3 to (0, 0, 0)
inline void setZero(); // Clears LLVector3 to (0, 0, 0)
@@ -119,7 +119,7 @@ class LLVector3
const LLVector3& scaleVec(const LLVector3& vec); // scales per component by vec
LLVector3 scaledVec(const LLVector3& vec) const; // get a copy of this vector scaled by vec
- bool isNull() const; // Returns TRUE if vector has a _very_small_ length
+ bool isNull() const; // Returns true if vector has a _very_small_ length
bool isExactlyZero() const { return !mV[VX] && !mV[VY] && !mV[VZ]; }
F32 operator[](int idx) const { return mV[idx]; }
@@ -157,7 +157,7 @@ typedef LLVector3 LLSimLocalVec;
// Non-member functions
F32 angle_between(const LLVector3 &a, const LLVector3 &b); // Returns angle (radians) between a and b
-bool are_parallel(const LLVector3 &a, const LLVector3 &b, F32 epsilon=F_APPROXIMATELY_ZERO); // Returns TRUE if a and b are very close to parallel
+bool are_parallel(const LLVector3 &a, const LLVector3 &b, F32 epsilon=F_APPROXIMATELY_ZERO); // Returns true if a and b are very close to parallel
F32 dist_vec(const LLVector3 &a, const LLVector3 &b); // Returns distance between a and b
F32 dist_vec_squared(const LLVector3 &a, const LLVector3 &b);// Returns distance squared between a and b
F32 dist_vec_squared2D(const LLVector3 &a, const LLVector3 &b);// Returns distance squared between a and b ignoring Z component
diff --git a/indra/llmath/v4math.cpp b/indra/llmath/v4math.cpp
index 8388fbdbc4..a68028d74a 100644
--- a/indra/llmath/v4math.cpp
+++ b/indra/llmath/v4math.cpp
@@ -59,7 +59,7 @@ const LLVector4& LLVector4::scaleVec(const LLVector4& vec)
}
// Sets all values to absolute value of their original values
-// Returns TRUE if data changed
+// Returns true if data changed
bool LLVector4::abs()
{
bool ret{ false };
diff --git a/indra/llmath/v4math.h b/indra/llmath/v4math.h
index 8a0a882cf0..f46033db11 100644
--- a/indra/llmath/v4math.h
+++ b/indra/llmath/v4math.h
@@ -101,7 +101,7 @@ class LLVector4
F32 normVec(); // deprecated
// Sets all values to absolute value of their original values
- // Returns TRUE if data changed
+ // Returns true if data changed
bool abs();
bool isExactlyClear() const { return (mV[VW] == 1.0f) && !mV[VX] && !mV[VY] && !mV[VZ]; }
@@ -137,7 +137,7 @@ class LLVector4
// Non-member functions
F32 angle_between(const LLVector4 &a, const LLVector4 &b); // Returns angle (radians) between a and b
-bool are_parallel(const LLVector4 &a, const LLVector4 &b, F32 epsilon = F_APPROXIMATELY_ZERO); // Returns TRUE if a and b are very close to parallel
+bool are_parallel(const LLVector4 &a, const LLVector4 &b, F32 epsilon = F_APPROXIMATELY_ZERO); // Returns true if a and b are very close to parallel
F32 dist_vec(const LLVector4 &a, const LLVector4 &b); // Returns distance between a and b
F32 dist_vec_squared(const LLVector4 &a, const LLVector4 &b); // Returns distance squared between a and b
LLVector3 vec4to3(const LLVector4 &vec);