mirror of https://github.com/zeldaret/botw.git
Havok: Add quaternion component access functions
This commit is contained in:
parent
e5dc569cd6
commit
c771cd4cb0
|
@ -13,6 +13,10 @@ public:
|
|||
|
||||
HK_FORCE_INLINE hkQuaternionf& operator=(const hkQuaternionf& q);
|
||||
|
||||
HK_FORCE_INLINE const hkFloat32& operator()(int i) const;
|
||||
template <int I>
|
||||
HK_FORCE_INLINE hkSimdFloat32 getComponent() const;
|
||||
|
||||
hkVector4f m_vec;
|
||||
};
|
||||
|
||||
|
@ -28,3 +32,12 @@ inline hkQuaternionf& hkQuaternionf::operator=(const hkQuaternionf& q) {
|
|||
m_vec = q.m_vec;
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline const hkFloat32& hkQuaternionf::operator()(int i) const {
|
||||
return m_vec(i);
|
||||
}
|
||||
|
||||
template <int I>
|
||||
inline hkSimdFloat32 hkQuaternionf::getComponent() const {
|
||||
return m_vec.getComponent<I>();
|
||||
}
|
||||
|
|
|
@ -129,11 +129,15 @@ public:
|
|||
const hkFloat32& operator()(int i) const { return reinterpret_cast<const float*>(&v)[i]; }
|
||||
const hkFloat32& operator[](int i) const { return reinterpret_cast<const float*>(&v)[i]; }
|
||||
|
||||
template <int I>
|
||||
HK_FORCE_INLINE hkSimdFloat32 getComponent() const {
|
||||
return v[I];
|
||||
}
|
||||
hkSimdFloat32 getComponent(int i) const { return v[i]; }
|
||||
hkSimdFloat32 getX() const { return getComponent(0); }
|
||||
hkSimdFloat32 getY() const { return getComponent(1); }
|
||||
hkSimdFloat32 getZ() const { return getComponent(2); }
|
||||
hkSimdFloat32 getW() const { return getComponent(3); }
|
||||
hkSimdFloat32 getX() const { return getComponent<0>(); }
|
||||
hkSimdFloat32 getY() const { return getComponent<1>(); }
|
||||
hkSimdFloat32 getZ() const { return getComponent<2>(); }
|
||||
hkSimdFloat32 getW() const { return getComponent<3>(); }
|
||||
void setComponent(int i, hkSimdFloat32Parameter val) { v[i] = val; }
|
||||
void setX(hkSimdFloat32Parameter val) { setComponent(0, val); }
|
||||
void setY(hkSimdFloat32Parameter val) { setComponent(1, val); }
|
||||
|
|
Loading…
Reference in New Issue