diff -r ce6abe0aeeae -r 1081e3dd3f3e include/vector.h --- a/include/vector.h Sun Apr 27 19:56:23 2008 +0200 +++ b/include/vector.h Sun Apr 27 22:55:17 2008 +0200 @@ -211,6 +211,8 @@ VectorPacket() {}; VectorPacket(__m128 ax, __m128 ay, __m128 az): mx(ax), my(ay), mz(az) {}; + VectorPacket(const Vector3 &v): + mx(_mm_set_ps1(v.x)), my(_mm_set_ps1(v.y)), mz(_mm_set_ps1(v.z)) {}; Vector3 getVector(int i) const { @@ -232,6 +234,15 @@ mz = _mm_mul_ps(mz, m); }; + // dot product + friend __m128 dot(const VectorPacket &a, const VectorPacket &b) + { + return _mm_add_ps(_mm_add_ps( + _mm_mul_ps(a.mx, b.mx), + _mm_mul_ps(a.my, b.my)), + _mm_mul_ps(a.mz, b.mz)); + }; + friend VectorPacket operator+(const VectorPacket &a, const VectorPacket &b) { return VectorPacket(