summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
authorAdam Moss <moss@lindenlab.com>2009-10-08 16:31:28 +0000
committerAdam Moss <moss@lindenlab.com>2009-10-08 16:31:28 +0000
commit50e3b3373bb12e4a19b4d85e148c514a8584e25d (patch)
tree16c048b349d46597c6b6c72090dde4569b3e7cb1 /indra
parentac63aaf7d8545c6701f9aa15bb7482e6c956be84 (diff)
DEV-41080 - wriggle some method implementations out into header implementations, just enough so that llbboxlocal can be a unit test rather than an integration test. Slightly dubious about whether it's worth it.
Diffstat (limited to 'indra')
-rw-r--r--indra/llmath/CMakeLists.txt4
-rw-r--r--indra/llmath/m4math.cpp26
-rw-r--r--indra/llmath/m4math.h30
-rw-r--r--indra/llmath/v3math.cpp8
-rw-r--r--indra/llmath/v3math.h6
5 files changed, 36 insertions, 38 deletions
diff --git a/indra/llmath/CMakeLists.txt b/indra/llmath/CMakeLists.txt
index ea58765b89..dd13d8acd3 100644
--- a/indra/llmath/CMakeLists.txt
+++ b/indra/llmath/CMakeLists.txt
@@ -84,7 +84,9 @@ add_library (llmath ${llmath_SOURCE_FILES})
# Add tests
include(LLAddBuildTest)
+# UNIT TESTS
SET(llmath_TEST_SOURCE_FILES
+ llbboxlocal.cpp
llrect.cpp
v2math.cpp
v3color.cpp
@@ -92,10 +94,10 @@ SET(llmath_TEST_SOURCE_FILES
)
LL_ADD_PROJECT_UNIT_TESTS(llmath "${llmath_TEST_SOURCE_FILES}")
+# INTEGRATION TESTS
set(test_libs llmath llcommon ${LLCOMMON_LIBRARIES} ${WINDOWS_LIBRARIES})
# TODO: Some of these need refactoring to be proper Unit tests rather than Integration tests.
LL_ADD_INTEGRATION_TEST(llbbox llbbox.cpp "${test_libs}")
-LL_ADD_INTEGRATION_TEST(llbboxlocal llbboxlocal.cpp "${test_libs}")
LL_ADD_INTEGRATION_TEST(mathmisc "" "${test_libs}")
LL_ADD_INTEGRATION_TEST(llquaternion llquaternion.cpp "${test_libs}")
LL_ADD_INTEGRATION_TEST(v3dmath v3dmath.cpp "${test_libs}")
diff --git a/indra/llmath/m4math.cpp b/indra/llmath/m4math.cpp
index 59a0bc2335..d8e7b4aaf9 100644
--- a/indra/llmath/m4math.cpp
+++ b/indra/llmath/m4math.cpp
@@ -678,32 +678,6 @@ LLVector4 operator*(const LLMatrix4 &a, const LLVector4 &b)
}
*/
-// Operates "to the left" on row-vector a
-//
-// This used to be in the header file but was not actually inlined in practice.
-// When avatar vertex programs are off, this function is a hot spot in profiles
-// due to software skinning in LLViewerJointMesh::updateGeometry(). JC
-LLVector3 operator*(const LLVector3 &a, const LLMatrix4 &b)
-{
- // This is better than making a temporary LLVector3. This eliminates an
- // unnecessary LLVector3() constructor and also helps the compiler to
- // realize that the output floats do not alias the input floats, hence
- // eliminating redundant loads of a.mV[0], etc. JC
- return LLVector3(a.mV[VX] * b.mMatrix[VX][VX] +
- a.mV[VY] * b.mMatrix[VY][VX] +
- a.mV[VZ] * b.mMatrix[VZ][VX] +
- b.mMatrix[VW][VX],
-
- a.mV[VX] * b.mMatrix[VX][VY] +
- a.mV[VY] * b.mMatrix[VY][VY] +
- a.mV[VZ] * b.mMatrix[VZ][VY] +
- b.mMatrix[VW][VY],
-
- a.mV[VX] * b.mMatrix[VX][VZ] +
- a.mV[VY] * b.mMatrix[VY][VZ] +
- a.mV[VZ] * b.mMatrix[VZ][VZ] +
- b.mMatrix[VW][VZ]);
-}
LLVector4 operator*(const LLVector4 &a, const LLMatrix4 &b)
{
diff --git a/indra/llmath/m4math.h b/indra/llmath/m4math.h
index 58c9c09d7f..e74b7afe9b 100644
--- a/indra/llmath/m4math.h
+++ b/indra/llmath/m4math.h
@@ -230,7 +230,7 @@ public:
// 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 LLVector3 operator*(const LLVector3 &a, const LLMatrix4 &b); // Return full transform of 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
friend LLVector3 rotate_vector(const LLVector3 &a, const LLMatrix4 &b); // Rotates a but does not translate
@@ -353,7 +353,31 @@ inline const LLMatrix4& operator-=(LLMatrix4 &a, const LLMatrix4 &b)
return a;
}
-#endif
-
+// Operates "to the left" on row-vector a
+//
+// When avatar vertex programs are off, this function is a hot spot in profiles
+// due to software skinning in LLViewerJointMesh::updateGeometry(). JC
+inline const LLVector3 operator*(const LLVector3 &a, const LLMatrix4 &b)
+{
+ // This is better than making a temporary LLVector3. This eliminates an
+ // unnecessary LLVector3() constructor and also helps the compiler to
+ // realize that the output floats do not alias the input floats, hence
+ // eliminating redundant loads of a.mV[0], etc. JC
+ return LLVector3(a.mV[VX] * b.mMatrix[VX][VX] +
+ a.mV[VY] * b.mMatrix[VY][VX] +
+ a.mV[VZ] * b.mMatrix[VZ][VX] +
+ b.mMatrix[VW][VX],
+
+ a.mV[VX] * b.mMatrix[VX][VY] +
+ a.mV[VY] * b.mMatrix[VY][VY] +
+ a.mV[VZ] * b.mMatrix[VZ][VY] +
+ b.mMatrix[VW][VY],
+
+ a.mV[VX] * b.mMatrix[VX][VZ] +
+ a.mV[VY] * b.mMatrix[VY][VZ] +
+ a.mV[VZ] * b.mMatrix[VZ][VZ] +
+ b.mMatrix[VW][VZ]);
+}
+#endif
diff --git a/indra/llmath/v3math.cpp b/indra/llmath/v3math.cpp
index f392ac448b..63683ed496 100644
--- a/indra/llmath/v3math.cpp
+++ b/indra/llmath/v3math.cpp
@@ -185,14 +185,6 @@ void LLVector3::snap(S32 sig_digits)
mV[VZ] = snap_to_sig_figs(mV[VZ], sig_digits);
}
-
-std::ostream& operator<<(std::ostream& s, const LLVector3 &a)
-{
- s << "{ " << a.mV[VX] << ", " << a.mV[VY] << ", " << a.mV[VZ] << " }";
- return s;
-}
-
-
const LLVector3& LLVector3::rotVec(const LLMatrix3 &mat)
{
*this = *this * mat;
diff --git a/indra/llmath/v3math.h b/indra/llmath/v3math.h
index 06a4f5c542..73738cffd2 100644
--- a/indra/llmath/v3math.h
+++ b/indra/llmath/v3math.h
@@ -556,4 +556,10 @@ inline BOOL are_parallel(const LLVector3 &a, const LLVector3 &b, F32 epsilon)
return FALSE;
}
+inline std::ostream& operator<<(std::ostream& s, const LLVector3 &a)
+{
+ s << "{ " << a.mV[VX] << ", " << a.mV[VY] << ", " << a.mV[VZ] << " }";
+ return s;
+}
+
#endif