|
From: <axl...@us...> - 2009-03-15 20:42:38
|
Revision: 179
http://hgengine.svn.sourceforge.net/hgengine/?rev=179&view=rev
Author: axlecrusher
Date: 2009-03-15 20:42:29 +0000 (Sun, 15 Mar 2009)
Log Message:
-----------
add C version of cross product
Modified Paths:
--------------
Mercury2/src/MercuryMath.h
Modified: Mercury2/src/MercuryMath.h
===================================================================
--- Mercury2/src/MercuryMath.h 2009-03-15 20:38:32 UTC (rev 178)
+++ Mercury2/src/MercuryMath.h 2009-03-15 20:42:29 UTC (rev 179)
@@ -58,6 +58,7 @@
//void Float2FloatRow(const float* f, FloatRow& r);
//void FloatRow2Float(const FloatRow& fr, float* f);
+#ifdef USE_SSE
inline void MMCrossProduct( const FloatRow& r1, const FloatRow& r2, FloatRow& result)
{
__m128 a,b,c,d,r;//using more registers is faster
@@ -71,6 +72,14 @@
r -= _mm_mul_ps( c, d );
result = r;
}
+#else
+inline void MMCrossProduct( const FloatRow& r1, const FloatRow& r2, FloatRow& result)
+{
+ result[0] = r1[1]*r2[2] - r1[2]*r2[1];
+ result[1] = r1[2]*r2[0] - r1[0]*r2[2];
+ result[2] = r1[0]*r2[1] - r1[1]*r2[0];
+}
+#endif
const FloatRow gfrZero = { 0.f, 0.f, 0.f, 0.f };
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|