using Integer = typename Traits::Integer;
using Vec4 = typename Traits::Vec4;
using Mask = typename Traits::Mask;
-
- static const size_t VECTOR_BYTES = sizeof(Float);
-
- // Populates a SIMD Vec4 from a non-simd vector. So p = xyzw becomes xxxx yyyy zzzz wwww.
- static SIMDINLINE void vec4_load1_ps(Vec4& r, const float* p)
- {
- r[0] = SIMD::set1_ps(p[0]);
- r[1] = SIMD::set1_ps(p[1]);
- r[2] = SIMD::set1_ps(p[2]);
- r[3] = SIMD::set1_ps(p[3]);
- }
-
- static SIMDINLINE void vec4_set1_vps(Vec4& r, Float const& s)
- {
- r[0] = s;
- r[1] = s;
- r[2] = s;
- r[3] = s;
- }
-
- static SIMDINLINE Float vec4_dp3_ps(const Vec4& v0, const Vec4& v1)
- {
- Float tmp, r;
- r = SIMD::mul_ps(v0[0], v1[0]); // (v0.x*v1.x)
-
- tmp = SIMD::mul_ps(v0[1], v1[1]); // (v0.y*v1.y)
- r = SIMD::add_ps(r, tmp); // (v0.x*v1.x) + (v0.y*v1.y)
-
- tmp = SIMD::mul_ps(v0[2], v1[2]); // (v0.z*v1.z)
- r = SIMD::add_ps(r, tmp); // (v0.x*v1.x) + (v0.y*v1.y) + (v0.z*v1.z)
-
- return r;
- }
-
- static SIMDINLINE Float vec4_dp4_ps(const Vec4& v0, const Vec4& v1)
- {
- Float tmp, r;
- r = SIMD::mul_ps(v0[0], v1[0]); // (v0.x*v1.x)
-
- tmp = SIMD::mul_ps(v0[1], v1[1]); // (v0.y*v1.y)
- r = SIMD::add_ps(r, tmp); // (v0.x*v1.x) + (v0.y*v1.y)
-
- tmp = SIMD::mul_ps(v0[2], v1[2]); // (v0.z*v1.z)
- r = SIMD::add_ps(r, tmp); // (v0.x*v1.x) + (v0.y*v1.y) + (v0.z*v1.z)
-
- tmp = SIMD::mul_ps(v0[3], v1[3]); // (v0.w*v1.w)
- r = SIMD::add_ps(r, tmp); // (v0.x*v1.x) + (v0.y*v1.y) + (v0.z*v1.z)
-
- return r;
- }
-
- static SIMDINLINE Float vec4_rcp_length_ps(const Vec4& v)
- {
- Float length = vec4_dp4_ps(v, v);
- return SIMD::rsqrt_ps(length);
- }
-
- static SIMDINLINE void vec4_normalize_ps(Vec4& r, const Vec4& v)
- {
- Float rcpLength = vec4_rcp_length_ps(v);
-
- r[0] = SIMD::mul_ps(v[0], rcpLength);
- r[1] = SIMD::mul_ps(v[1], rcpLength);
- r[2] = SIMD::mul_ps(v[2], rcpLength);
- r[3] = SIMD::mul_ps(v[3], rcpLength);
- }
-
- static SIMDINLINE void vec4_mul_ps(Vec4& r, const Vec4& v, Float const& s)
- {
- r[0] = SIMD::mul_ps(v[0], s);
- r[1] = SIMD::mul_ps(v[1], s);
- r[2] = SIMD::mul_ps(v[2], s);
- r[3] = SIMD::mul_ps(v[3], s);
- }
-
- static SIMDINLINE void vec4_mul_ps(Vec4& r, const Vec4& v0, const Vec4& v1)
- {
- r[0] = SIMD::mul_ps(v0[0], v1[0]);
- r[1] = SIMD::mul_ps(v0[1], v1[1]);
- r[2] = SIMD::mul_ps(v0[2], v1[2]);
- r[3] = SIMD::mul_ps(v0[3], v1[3]);
- }
-
- static SIMDINLINE void vec4_add_ps(Vec4& r, const Vec4& v0, Float const& s)
- {
- r[0] = SIMD::add_ps(v0[0], s);
- r[1] = SIMD::add_ps(v0[1], s);
- r[2] = SIMD::add_ps(v0[2], s);
- r[3] = SIMD::add_ps(v0[3], s);
- }
-
- static SIMDINLINE void vec4_add_ps(Vec4& r, const Vec4& v0, const Vec4& v1)
- {
- r[0] = SIMD::add_ps(v0[0], v1[0]);
- r[1] = SIMD::add_ps(v0[1], v1[1]);
- r[2] = SIMD::add_ps(v0[2], v1[2]);
- r[3] = SIMD::add_ps(v0[3], v1[3]);
- }
-
- static SIMDINLINE void vec4_min_ps(Vec4& r, const Vec4& v0, Float const& s)
- {
- r[0] = SIMD::min_ps(v0[0], s);
- r[1] = SIMD::min_ps(v0[1], s);
- r[2] = SIMD::min_ps(v0[2], s);
- r[3] = SIMD::min_ps(v0[3], s);
- }
-
- static SIMDINLINE void vec4_max_ps(Vec4& r, const Vec4& v0, Float const& s)
- {
- r[0] = SIMD::max_ps(v0[0], s);
- r[1] = SIMD::max_ps(v0[1], s);
- r[2] = SIMD::max_ps(v0[2], s);
- r[3] = SIMD::max_ps(v0[3], s);
- }
-
- // Matrix4x4 * Vector4
- // outVec.x = (m00 * v.x) + (m01 * v.y) + (m02 * v.z) + (m03 * v.w)
- // outVec.y = (m10 * v.x) + (m11 * v.y) + (m12 * v.z) + (m13 * v.w)
- // outVec.z = (m20 * v.x) + (m21 * v.y) + (m22 * v.z) + (m23 * v.w)
- // outVec.w = (m30 * v.x) + (m31 * v.y) + (m32 * v.z) + (m33 * v.w)
- static SIMDINLINE void SIMDCALL mat4x4_vec4_multiply(Vec4& result,
- const float* pMatrix,
- const Vec4& v)
- {
- Float m;
- Float r0;
- Float r1;
-
- m = SIMD::load1_ps(pMatrix + 0 * 4 + 0); // m[row][0]
- r0 = SIMD::mul_ps(m, v[0]); // (m00 * v.x)
- m = SIMD::load1_ps(pMatrix + 0 * 4 + 1); // m[row][1]
- r1 = SIMD::mul_ps(m, v[1]); // (m1 * v.y)
- r0 = SIMD::add_ps(r0, r1); // (m0 * v.x) + (m1 * v.y)
- m = SIMD::load1_ps(pMatrix + 0 * 4 + 2); // m[row][2]
- r1 = SIMD::mul_ps(m, v[2]); // (m2 * v.z)
- r0 = SIMD::add_ps(r0, r1); // (m0 * v.x) + (m1 * v.y) + (m2 * v.z)
- m = SIMD::load1_ps(pMatrix + 0 * 4 + 3); // m[row][3]
- r1 = SIMD::mul_ps(m, v[3]); // (m3 * v.z)
- r0 = SIMD::add_ps(r0, r1); // (m0 * v.x) + (m1 * v.y) + (m2 * v.z) + (m2 * v.w)
- result[0] = r0;
-
- m = SIMD::load1_ps(pMatrix + 1 * 4 + 0); // m[row][0]
- r0 = SIMD::mul_ps(m, v[0]); // (m00 * v.x)
- m = SIMD::load1_ps(pMatrix + 1 * 4 + 1); // m[row][1]
- r1 = SIMD::mul_ps(m, v[1]); // (m1 * v.y)
- r0 = SIMD::add_ps(r0, r1); // (m0 * v.x) + (m1 * v.y)
- m = SIMD::load1_ps(pMatrix + 1 * 4 + 2); // m[row][2]
- r1 = SIMD::mul_ps(m, v[2]); // (m2 * v.z)
- r0 = SIMD::add_ps(r0, r1); // (m0 * v.x) + (m1 * v.y) + (m2 * v.z)
- m = SIMD::load1_ps(pMatrix + 1 * 4 + 3); // m[row][3]
- r1 = SIMD::mul_ps(m, v[3]); // (m3 * v.z)
- r0 = SIMD::add_ps(r0, r1); // (m0 * v.x) + (m1 * v.y) + (m2 * v.z) + (m2 * v.w)
- result[1] = r0;
-
- m = SIMD::load1_ps(pMatrix + 2 * 4 + 0); // m[row][0]
- r0 = SIMD::mul_ps(m, v[0]); // (m00 * v.x)
- m = SIMD::load1_ps(pMatrix + 2 * 4 + 1); // m[row][1]
- r1 = SIMD::mul_ps(m, v[1]); // (m1 * v.y)
- r0 = SIMD::add_ps(r0, r1); // (m0 * v.x) + (m1 * v.y)
- m = SIMD::load1_ps(pMatrix + 2 * 4 + 2); // m[row][2]
- r1 = SIMD::mul_ps(m, v[2]); // (m2 * v.z)
- r0 = SIMD::add_ps(r0, r1); // (m0 * v.x) + (m1 * v.y) + (m2 * v.z)
- m = SIMD::load1_ps(pMatrix + 2 * 4 + 3); // m[row][3]
- r1 = SIMD::mul_ps(m, v[3]); // (m3 * v.z)
- r0 = SIMD::add_ps(r0, r1); // (m0 * v.x) + (m1 * v.y) + (m2 * v.z) + (m2 * v.w)
- result[2] = r0;
-
- m = SIMD::load1_ps(pMatrix + 3 * 4 + 0); // m[row][0]
- r0 = SIMD::mul_ps(m, v[0]); // (m00 * v.x)
- m = SIMD::load1_ps(pMatrix + 3 * 4 + 1); // m[row][1]
- r1 = SIMD::mul_ps(m, v[1]); // (m1 * v.y)
- r0 = SIMD::add_ps(r0, r1); // (m0 * v.x) + (m1 * v.y)
- m = SIMD::load1_ps(pMatrix + 3 * 4 + 2); // m[row][2]
- r1 = SIMD::mul_ps(m, v[2]); // (m2 * v.z)
- r0 = SIMD::add_ps(r0, r1); // (m0 * v.x) + (m1 * v.y) + (m2 * v.z)
- m = SIMD::load1_ps(pMatrix + 3 * 4 + 3); // m[row][3]
- r1 = SIMD::mul_ps(m, v[3]); // (m3 * v.z)
- r0 = SIMD::add_ps(r0, r1); // (m0 * v.x) + (m1 * v.y) + (m2 * v.z) + (m2 * v.w)
- result[3] = r0;
- }
-
- // Matrix4x4 * Vector3 - Direction Vector where w = 0.
- // outVec.x = (m00 * v.x) + (m01 * v.y) + (m02 * v.z) + (m03 * 0)
- // outVec.y = (m10 * v.x) + (m11 * v.y) + (m12 * v.z) + (m13 * 0)
- // outVec.z = (m20 * v.x) + (m21 * v.y) + (m22 * v.z) + (m23 * 0)
- // outVec.w = (m30 * v.x) + (m31 * v.y) + (m32 * v.z) + (m33 * 0)
- static SIMDINLINE void SIMDCALL mat3x3_vec3_w0_multiply(Vec4& result,
- const float* pMatrix,
- const Vec4& v)
- {
- Float m;
- Float r0;
- Float r1;
-
- m = SIMD::load1_ps(pMatrix + 0 * 4 + 0); // m[row][0]
- r0 = SIMD::mul_ps(m, v[0]); // (m00 * v.x)
- m = SIMD::load1_ps(pMatrix + 0 * 4 + 1); // m[row][1]
- r1 = SIMD::mul_ps(m, v[1]); // (m1 * v.y)
- r0 = SIMD::add_ps(r0, r1); // (m0 * v.x) + (m1 * v.y)
- m = SIMD::load1_ps(pMatrix + 0 * 4 + 2); // m[row][2]
- r1 = SIMD::mul_ps(m, v[2]); // (m2 * v.z)
- r0 = SIMD::add_ps(r0, r1); // (m0 * v.x) + (m1 * v.y) + (m2 * v.z)
- result[0] = r0;
-
- m = SIMD::load1_ps(pMatrix + 1 * 4 + 0); // m[row][0]
- r0 = SIMD::mul_ps(m, v[0]); // (m00 * v.x)
- m = SIMD::load1_ps(pMatrix + 1 * 4 + 1); // m[row][1]
- r1 = SIMD::mul_ps(m, v[1]); // (m1 * v.y)
- r0 = SIMD::add_ps(r0, r1); // (m0 * v.x) + (m1 * v.y)
- m = SIMD::load1_ps(pMatrix + 1 * 4 + 2); // m[row][2]
- r1 = SIMD::mul_ps(m, v[2]); // (m2 * v.z)
- r0 = SIMD::add_ps(r0, r1); // (m0 * v.x) + (m1 * v.y) + (m2 * v.z)
- result[1] = r0;
-
- m = SIMD::load1_ps(pMatrix + 2 * 4 + 0); // m[row][0]
- r0 = SIMD::mul_ps(m, v[0]); // (m00 * v.x)
- m = SIMD::load1_ps(pMatrix + 2 * 4 + 1); // m[row][1]
- r1 = SIMD::mul_ps(m, v[1]); // (m1 * v.y)
- r0 = SIMD::add_ps(r0, r1); // (m0 * v.x) + (m1 * v.y)
- m = SIMD::load1_ps(pMatrix + 2 * 4 + 2); // m[row][2]
- r1 = SIMD::mul_ps(m, v[2]); // (m2 * v.z)
- r0 = SIMD::add_ps(r0, r1); // (m0 * v.x) + (m1 * v.y) + (m2 * v.z)
- result[2] = r0;
-
- result[3] = SIMD::setzero_ps();
- }
-
- // Matrix4x4 * Vector3 - Position vector where w = 1.
- // outVec.x = (m00 * v.x) + (m01 * v.y) + (m02 * v.z) + (m03 * 1)
- // outVec.y = (m10 * v.x) + (m11 * v.y) + (m12 * v.z) + (m13 * 1)
- // outVec.z = (m20 * v.x) + (m21 * v.y) + (m22 * v.z) + (m23 * 1)
- // outVec.w = (m30 * v.x) + (m31 * v.y) + (m32 * v.z) + (m33 * 1)
- static SIMDINLINE void SIMDCALL mat4x4_vec3_w1_multiply(Vec4& result,
- const float* pMatrix,
- const Vec4& v)
- {
- Float m;
- Float r0;
- Float r1;
-
- m = SIMD::load1_ps(pMatrix + 0 * 4 + 0); // m[row][0]
- r0 = SIMD::mul_ps(m, v[0]); // (m00 * v.x)
- m = SIMD::load1_ps(pMatrix + 0 * 4 + 1); // m[row][1]
- r1 = SIMD::mul_ps(m, v[1]); // (m1 * v.y)
- r0 = SIMD::add_ps(r0, r1); // (m0 * v.x) + (m1 * v.y)
- m = SIMD::load1_ps(pMatrix + 0 * 4 + 2); // m[row][2]
- r1 = SIMD::mul_ps(m, v[2]); // (m2 * v.z)
- r0 = SIMD::add_ps(r0, r1); // (m0 * v.x) + (m1 * v.y) + (m2 * v.z)
- m = SIMD::load1_ps(pMatrix + 0 * 4 + 3); // m[row][3]
- r0 = SIMD::add_ps(r0, m); // (m0 * v.x) + (m1 * v.y) + (m2 * v.z) + (m2 * 1)
- result[0] = r0;
-
- m = SIMD::load1_ps(pMatrix + 1 * 4 + 0); // m[row][0]
- r0 = SIMD::mul_ps(m, v[0]); // (m00 * v.x)
- m = SIMD::load1_ps(pMatrix + 1 * 4 + 1); // m[row][1]
- r1 = SIMD::mul_ps(m, v[1]); // (m1 * v.y)
- r0 = SIMD::add_ps(r0, r1); // (m0 * v.x) + (m1 * v.y)
- m = SIMD::load1_ps(pMatrix + 1 * 4 + 2); // m[row][2]
- r1 = SIMD::mul_ps(m, v[2]); // (m2 * v.z)
- r0 = SIMD::add_ps(r0, r1); // (m0 * v.x) + (m1 * v.y) + (m2 * v.z)
- m = SIMD::load1_ps(pMatrix + 1 * 4 + 3); // m[row][3]
- r0 = SIMD::add_ps(r0, m); // (m0 * v.x) + (m1 * v.y) + (m2 * v.z) + (m2 * 1)
- result[1] = r0;
-
- m = SIMD::load1_ps(pMatrix + 2 * 4 + 0); // m[row][0]
- r0 = SIMD::mul_ps(m, v[0]); // (m00 * v.x)
- m = SIMD::load1_ps(pMatrix + 2 * 4 + 1); // m[row][1]
- r1 = SIMD::mul_ps(m, v[1]); // (m1 * v.y)
- r0 = SIMD::add_ps(r0, r1); // (m0 * v.x) + (m1 * v.y)
- m = SIMD::load1_ps(pMatrix + 2 * 4 + 2); // m[row][2]
- r1 = SIMD::mul_ps(m, v[2]); // (m2 * v.z)
- r0 = SIMD::add_ps(r0, r1); // (m0 * v.x) + (m1 * v.y) + (m2 * v.z)
- m = SIMD::load1_ps(pMatrix + 2 * 4 + 3); // m[row][3]
- r0 = SIMD::add_ps(r0, m); // (m0 * v.x) + (m1 * v.y) + (m2 * v.z) + (m2 * 1)
- result[2] = r0;
-
- m = SIMD::load1_ps(pMatrix + 3 * 4 + 0); // m[row][0]
- r0 = SIMD::mul_ps(m, v[0]); // (m00 * v.x)
- m = SIMD::load1_ps(pMatrix + 3 * 4 + 1); // m[row][1]
- r1 = SIMD::mul_ps(m, v[1]); // (m1 * v.y)
- r0 = SIMD::add_ps(r0, r1); // (m0 * v.x) + (m1 * v.y)
- m = SIMD::load1_ps(pMatrix + 3 * 4 + 2); // m[row][2]
- r1 = SIMD::mul_ps(m, v[2]); // (m2 * v.z)
- r0 = SIMD::add_ps(r0, r1); // (m0 * v.x) + (m1 * v.y) + (m2 * v.z)
- m = SIMD::load1_ps(pMatrix + 3 * 4 + 3); // m[row][3]
- result[3] = SIMD::add_ps(r0, m); // (m0 * v.x) + (m1 * v.y) + (m2 * v.z) + (m2 * 1)
- }
-
- static SIMDINLINE void SIMDCALL mat4x3_vec3_w1_multiply(Vec4& result,
- const float* pMatrix,
- const Vec4& v)
- {
- Float m;
- Float r0;
- Float r1;
-
- m = SIMD::load1_ps(pMatrix + 0 * 4 + 0); // m[row][0]
- r0 = SIMD::mul_ps(m, v[0]); // (m00 * v.x)
- m = SIMD::load1_ps(pMatrix + 0 * 4 + 1); // m[row][1]
- r1 = SIMD::mul_ps(m, v[1]); // (m1 * v.y)
- r0 = SIMD::add_ps(r0, r1); // (m0 * v.x) + (m1 * v.y)
- m = SIMD::load1_ps(pMatrix + 0 * 4 + 2); // m[row][2]
- r1 = SIMD::mul_ps(m, v[2]); // (m2 * v.z)
- r0 = SIMD::add_ps(r0, r1); // (m0 * v.x) + (m1 * v.y) + (m2 * v.z)
- m = SIMD::load1_ps(pMatrix + 0 * 4 + 3); // m[row][3]
- r0 = SIMD::add_ps(r0, m); // (m0 * v.x) + (m1 * v.y) + (m2 * v.z) + (m2 * 1)
- result[0] = r0;
-
- m = SIMD::load1_ps(pMatrix + 1 * 4 + 0); // m[row][0]
- r0 = SIMD::mul_ps(m, v[0]); // (m00 * v.x)
- m = SIMD::load1_ps(pMatrix + 1 * 4 + 1); // m[row][1]
- r1 = SIMD::mul_ps(m, v[1]); // (m1 * v.y)
- r0 = SIMD::add_ps(r0, r1); // (m0 * v.x) + (m1 * v.y)
- m = SIMD::load1_ps(pMatrix + 1 * 4 + 2); // m[row][2]
- r1 = SIMD::mul_ps(m, v[2]); // (m2 * v.z)
- r0 = SIMD::add_ps(r0, r1); // (m0 * v.x) + (m1 * v.y) + (m2 * v.z)
- m = SIMD::load1_ps(pMatrix + 1 * 4 + 3); // m[row][3]
- r0 = SIMD::add_ps(r0, m); // (m0 * v.x) + (m1 * v.y) + (m2 * v.z) + (m2 * 1)
- result[1] = r0;
-
- m = SIMD::load1_ps(pMatrix + 2 * 4 + 0); // m[row][0]
- r0 = SIMD::mul_ps(m, v[0]); // (m00 * v.x)
- m = SIMD::load1_ps(pMatrix + 2 * 4 + 1); // m[row][1]
- r1 = SIMD::mul_ps(m, v[1]); // (m1 * v.y)
- r0 = SIMD::add_ps(r0, r1); // (m0 * v.x) + (m1 * v.y)
- m = SIMD::load1_ps(pMatrix + 2 * 4 + 2); // m[row][2]
- r1 = SIMD::mul_ps(m, v[2]); // (m2 * v.z)
- r0 = SIMD::add_ps(r0, r1); // (m0 * v.x) + (m1 * v.y) + (m2 * v.z)
- m = SIMD::load1_ps(pMatrix + 2 * 4 + 3); // m[row][3]
- r0 = SIMD::add_ps(r0, m); // (m0 * v.x) + (m1 * v.y) + (m2 * v.z) + (m2 * 1)
- result[2] = r0;
- result[3] = SIMD::set1_ps(1.0f);
- }
}; // struct SIMDBase
using SIMD128 = SIMDBase<SIMDImpl::SIMD128Impl::Traits>;
//=======================================================================
// Advanced masking interface (currently available only in SIMD16 width)
//=======================================================================
-
-
- //=======================================================================
- // Extended Utility Functions (common to SIMD256 and SIMD16)
- //=======================================================================
-
- //-----------------------------------------------------------------------
- // Extended Types
- //-----------------------------------------------------------------------
-
- // Vec4, an SOA SIMD set of 4-dimensional vectors
- union Vec4
- {
- Vec4() = default;
- Vec4(Float in)
- {
- s.x = in;
- s.y = in;
- s.z = in;
- s.w = in;
- }
- Vec4(Float x, Float y, Float z, Float w)
- {
- s.x = x;
- s.y = y;
- s.z = z;
- s.w = w;
- }
-
- Float v[4];
- Integer vi[4];
- struct
- {
- Float x;
- Float y;
- Float z;
- Float w;
- } s;
- Float& operator[] (const int i) { return v[i]; }
- Float const & operator[] (const int i) const { return v[i]; }
- };
-
- //-----------------------------------------------------------------------
- // Extended Functions
- //-----------------------------------------------------------------------
- static void vec4_set1_ps(Vec4& r, const float *p); // r[0] = set1(p[0]), r[1] = set1(p[1]), ...
- static void vec4_set1_vps(Vec4& r, Float s); // r[0] = s, r[1] = s, ...
- static Float vec4_dp3_ps(const Vec4& v0, const Vec4& v1); // return dp3(v0, v1)
- static Float vec4_dp4_ps(const Vec4& v0, const Vec4& v1); // return dp4(v0, v1)
- static Float vec4_rcp_length_ps(const Vec4& v); // return 1.0f / sqrt(dp4(v, v))
- static void vec4_normalize_ps(Vec4& r, const Vec4& v); // r = v * rcp_length(v)
- static void vec4_mul_ps(Vec4& r, const Vec4& v, Float s); // r = v * set1_vps(s)
- static void vec4_mul_ps(Vec4& r, const Vec4& v0, const Vec4& v1); // r = v0 * v1
- static void vec4_add_ps(Vec4& r, const Vec4& v0, const Vec4& v1); // r = v0 + v1
- static void vec4_min_ps(Vec4& r, const Vec4& v0, Float s); // r = (v0 < s) ? v0 : s
- static void vec4_max_ps(Vec4& r, const Vec4& v0, Float s); // r = (v0 > s) ? v0 : s
-
- // Matrix4x4 * Vector4
- // result.s.x = (m00 * v.s.x) + (m01 * v.s.y) + (m02 * v.s.z) + (m03 * v.s.w)
- // result.s.y = (m10 * v.s.x) + (m11 * v.s.y) + (m12 * v.s.z) + (m13 * v.s.w)
- // result.s.z = (m20 * v.s.x) + (m21 * v.s.y) + (m22 * v.s.z) + (m23 * v.s.w)
- // result.s.w = (m30 * v.s.x) + (m31 * v.s.y) + (m32 * v.s.z) + (m33 * v.s.w)
- static void mat4x4_vec4_multiply(
- Vec4& result,
- const float *pMatrix,
- const Vec4& v);
-
- // Matrix4x4 * Vector3 - Direction Vector where w = 0.
- // result.s.x = (m00 * v.s.x) + (m01 * v.s.y) + (m02 * v.s.z) + (m03 * 0)
- // result.s.y = (m10 * v.s.x) + (m11 * v.s.y) + (m12 * v.s.z) + (m13 * 0)
- // result.s.z = (m20 * v.s.x) + (m21 * v.s.y) + (m22 * v.s.z) + (m23 * 0)
- // result.s.w = (m30 * v.s.x) + (m31 * v.s.y) + (m32 * v.s.z) + (m33 * 0)
- static void mat3x3_vec3_w0_multiply(
- Vec4& result,
- const float *pMatrix,
- const Vec4& v);
-
- // Matrix4x4 * Vector3 - Position vector where w = 1.
- // result.s.x = (m00 * v.s.x) + (m01 * v.s.y) + (m02 * v.s.z) + (m03 * 1)
- // result.s.y = (m10 * v.s.x) + (m11 * v.s.y) + (m12 * v.s.z) + (m13 * 1)
- // result.s.z = (m20 * v.s.x) + (m21 * v.s.y) + (m22 * v.s.z) + (m23 * 1)
- // result.s.w = (m30 * v.s.x) + (m31 * v.s.y) + (m32 * v.s.z) + (m33 * 1)
- static void mat4x4_vec3_w1_multiply(
- Vec4& result,
- const float *pMatrix,
- const Vec4& v);
-
- // Matrix4x3 * Vector3 - Position vector where w = 1.
- // result.s.x = (m00 * v.s.x) + (m01 * v.s.y) + (m02 * v.s.z) + (m03 * 1)
- // result.s.y = (m10 * v.s.x) + (m11 * v.s.y) + (m12 * v.s.z) + (m13 * 1)
- // result.s.z = (m20 * v.s.x) + (m21 * v.s.y) + (m22 * v.s.z) + (m23 * 1)
- // result.s.w = 1
- static void mat4x3_vec3_w1_multiply(
- Vec4& result,
- const float *pMatrix,
- const Vec4& v);
};
#endif // #if 0