void float3x4::ScaleRow(int r, float scalar) { #ifdef MATH_SIMD row[r] = muls_ps(row[r], scalar); #else Row(r) *= scalar; #endif }
Quat Quat::operator *(float scalar) const { #ifdef MATH_AUTOMATIC_SSE return muls_ps(q, scalar); #else return Quat(x * scalar, y * scalar, z * scalar, w * scalar); #endif }
void AABBTransformAsAABB_SIMD(AABB &aabb, const float4x4 &m) { simd4f minPt = aabb.minPoint; simd4f maxPt = aabb.maxPoint; simd4f centerPoint = muls_ps(add_ps(minPt, maxPt), 0.5f); simd4f newCenter = mat4x4_mul_vec4(m.row, centerPoint); simd4f halfSize = sub_ps(centerPoint, minPt); simd4f x = abs_ps(mul_ps(m.row[0], halfSize)); simd4f y = abs_ps(mul_ps(m.row[1], halfSize)); simd4f z = abs_ps(mul_ps(m.row[2], halfSize)); simd4f w = zero_ps(); simd4f newDir = hadd4_ps(x, y, z, w); aabb.minPoint = sub_ps(newCenter, newDir); aabb.maxPoint = add_ps(newCenter, newDir); }