equal
deleted
inserted
replaced
209 }; |
209 }; |
210 |
210 |
211 VectorPacket() {}; |
211 VectorPacket() {}; |
212 VectorPacket(__m128 ax, __m128 ay, __m128 az): |
212 VectorPacket(__m128 ax, __m128 ay, __m128 az): |
213 mx(ax), my(ay), mz(az) {}; |
213 mx(ax), my(ay), mz(az) {}; |
|
214 VectorPacket(const Vector3 &v): |
|
215 mx(_mm_set_ps1(v.x)), my(_mm_set_ps1(v.y)), mz(_mm_set_ps1(v.z)) {}; |
214 |
216 |
215 Vector3 getVector(int i) const |
217 Vector3 getVector(int i) const |
216 { |
218 { |
217 return Vector3(x[i], y[i], z[i]); |
219 return Vector3(x[i], y[i], z[i]); |
218 }; |
220 }; |
230 mx = _mm_mul_ps(mx, m); |
232 mx = _mm_mul_ps(mx, m); |
231 my = _mm_mul_ps(my, m); |
233 my = _mm_mul_ps(my, m); |
232 mz = _mm_mul_ps(mz, m); |
234 mz = _mm_mul_ps(mz, m); |
233 }; |
235 }; |
234 |
236 |
|
237 // dot product |
|
238 friend __m128 dot(const VectorPacket &a, const VectorPacket &b) |
|
239 { |
|
240 return _mm_add_ps(_mm_add_ps( |
|
241 _mm_mul_ps(a.mx, b.mx), |
|
242 _mm_mul_ps(a.my, b.my)), |
|
243 _mm_mul_ps(a.mz, b.mz)); |
|
244 }; |
|
245 |
235 friend VectorPacket operator+(const VectorPacket &a, const VectorPacket &b) |
246 friend VectorPacket operator+(const VectorPacket &a, const VectorPacket &b) |
236 { |
247 { |
237 return VectorPacket( |
248 return VectorPacket( |
238 _mm_add_ps(a.mx, b.mx), |
249 _mm_add_ps(a.mx, b.mx), |
239 _mm_add_ps(a.my, b.my), |
250 _mm_add_ps(a.my, b.my), |