mirror of https://github.com/zeldaret/botw.git
Havok: Fix various hkpMotion setters
This commit is contained in:
parent
2acf2ba0a4
commit
1511ec620d
|
@ -61,6 +61,19 @@ public:
|
||||||
|
|
||||||
void setOne() { m_value = 0x3F80; }
|
void setOne() { m_value = 0x3F80; }
|
||||||
|
|
||||||
|
template <bool Round>
|
||||||
|
void set(const float& r) {
|
||||||
|
union {
|
||||||
|
float f;
|
||||||
|
int i;
|
||||||
|
} u;
|
||||||
|
if constexpr (Round)
|
||||||
|
u.f = r * (1.0f + 1.0f / 256.f);
|
||||||
|
else
|
||||||
|
u.f = r;
|
||||||
|
m_value = hkInt16(u.i >> 16);
|
||||||
|
}
|
||||||
|
|
||||||
operator float() const {
|
operator float() const {
|
||||||
union {
|
union {
|
||||||
int i;
|
int i;
|
||||||
|
|
|
@ -192,7 +192,7 @@ inline hkReal hkpMotion::getLinearDamping() const {
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void hkpMotion::setLinearDamping(hkReal d) {
|
inline void hkpMotion::setLinearDamping(hkReal d) {
|
||||||
m_motionState.m_linearDamping = d;
|
m_motionState.m_linearDamping.set<true>(d);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline hkReal hkpMotion::getAngularDamping() const {
|
inline hkReal hkpMotion::getAngularDamping() const {
|
||||||
|
@ -200,7 +200,7 @@ inline hkReal hkpMotion::getAngularDamping() const {
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void hkpMotion::setAngularDamping(hkReal d) {
|
inline void hkpMotion::setAngularDamping(hkReal d) {
|
||||||
m_motionState.m_angularDamping = d;
|
m_motionState.m_angularDamping.set<true>(d);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline hkReal hkpMotion::getTimeFactor() const {
|
inline hkReal hkpMotion::getTimeFactor() const {
|
||||||
|
@ -208,7 +208,7 @@ inline hkReal hkpMotion::getTimeFactor() const {
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void hkpMotion::setTimeFactor(hkReal f) {
|
inline void hkpMotion::setTimeFactor(hkReal f) {
|
||||||
m_motionState.m_timeFactor = f;
|
m_motionState.m_timeFactor.set<true>(f);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline hkReal hkpMotion::getGravityFactor() const {
|
inline hkReal hkpMotion::getGravityFactor() const {
|
||||||
|
@ -216,7 +216,7 @@ inline hkReal hkpMotion::getGravityFactor() const {
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void hkpMotion::setGravityFactor(hkReal gravityFactor) {
|
inline void hkpMotion::setGravityFactor(hkReal gravityFactor) {
|
||||||
m_gravityFactor = gravityFactor;
|
m_gravityFactor.set<true>(gravityFactor);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline int hkpMotion::getDeactivationClass() const {
|
inline int hkpMotion::getDeactivationClass() const {
|
||||||
|
|
Loading…
Reference in New Issue