mirror of https://github.com/zeldaret/botw.git
Havok: Add hkVector4f::load
This commit is contained in:
parent
88f3c8c49a
commit
a15790e624
|
@ -158,6 +158,10 @@ public:
|
||||||
return u;
|
return u;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Load N floats from in.
|
||||||
|
template <int N>
|
||||||
|
void load(const hkFloat32* in);
|
||||||
|
|
||||||
/// Store N floats to out.
|
/// Store N floats to out.
|
||||||
template <int N>
|
template <int N>
|
||||||
void store(hkFloat32* out) const;
|
void store(hkFloat32* out) const;
|
||||||
|
|
|
@ -386,6 +386,37 @@ inline const hkVector4f& hkVector4f::getConstant() {
|
||||||
return reinterpret_cast<const hkVector4f&>(g_vectorfConstants[Constant]);
|
return reinterpret_cast<const hkVector4f&>(g_vectorfConstants[Constant]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <int N>
|
||||||
|
inline void hkVector4f::load(const hkFloat32* in) {
|
||||||
|
static_assert(1 <= N && N <= 4, "invalid N");
|
||||||
|
#ifdef HK_VECTOR4F_AARCH64_NEON
|
||||||
|
switch (N) {
|
||||||
|
case 1:
|
||||||
|
v = vld1q_dup_f32(in);
|
||||||
|
break;
|
||||||
|
case 2: {
|
||||||
|
auto xy = vld1_f32(in);
|
||||||
|
v = vcombine_f32(xy, xy);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 3: {
|
||||||
|
auto xy = vld1_f32(in);
|
||||||
|
auto zz = vld1_dup_f32(in + 2);
|
||||||
|
v = vcombine_f32(xy, zz);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 4:
|
||||||
|
v = vld1q_f32(in);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
for (int i = 0; i < N; ++i)
|
||||||
|
v[i] = in[i];
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
template <int N>
|
template <int N>
|
||||||
inline void hkVector4f::store(hkFloat32* out) const {
|
inline void hkVector4f::store(hkFloat32* out) const {
|
||||||
static_assert(1 <= N && N <= 4, "invalid N");
|
static_assert(1 <= N && N <= 4, "invalid N");
|
||||||
|
|
Loading…
Reference in New Issue