mirror of
https://github.com/lubosz/overte.git
synced 2025-08-07 16:41:02 +02:00
Code review feedback
This commit is contained in:
parent
58f95bd07b
commit
fd780845bb
4 changed files with 2 additions and 17 deletions
|
@ -79,14 +79,6 @@ AnimPose::operator glm::mat4() const {
|
||||||
}
|
}
|
||||||
|
|
||||||
void AnimPose::blend(const AnimPose& srcPose, float alpha) {
|
void AnimPose::blend(const AnimPose& srcPose, float alpha) {
|
||||||
// adjust signs if necessary
|
|
||||||
const glm::quat& q1 = srcPose._rot;
|
|
||||||
glm::quat q2 = _rot;
|
|
||||||
float dot = glm::dot(q1, q2);
|
|
||||||
if (dot < 0.0f) {
|
|
||||||
q2 = -q2;
|
|
||||||
}
|
|
||||||
|
|
||||||
_scale = lerp(srcPose._scale, _scale, alpha);
|
_scale = lerp(srcPose._scale, _scale, alpha);
|
||||||
_rot = safeLerp(srcPose._rot, _rot, alpha);
|
_rot = safeLerp(srcPose._rot, _rot, alpha);
|
||||||
_trans = lerp(srcPose._trans, _trans, alpha);
|
_trans = lerp(srcPose._trans, _trans, alpha);
|
||||||
|
|
|
@ -145,6 +145,7 @@ const AnimPoseVec& AnimTwoBoneIK::evaluate(const AnimVariantMap& animVars, const
|
||||||
|
|
||||||
float d = glm::length(targetPose.trans() - basePose.trans());
|
float d = glm::length(targetPose.trans() - basePose.trans());
|
||||||
|
|
||||||
|
// http://mathworld.wolfram.com/Circle-CircleIntersection.html
|
||||||
float midAngle = 0.0f;
|
float midAngle = 0.0f;
|
||||||
if (d < r0 + r1) {
|
if (d < r0 + r1) {
|
||||||
float y = sqrtf((-d + r1 - r0) * (-d - r1 + r0) * (-d + r1 + r0) * (d + r1 + r0)) / (2.0f * d);
|
float y = sqrtf((-d + r1 - r0) * (-d - r1 + r0) * (-d + r1 + r0) * (d + r1 + r0)) / (2.0f * d);
|
||||||
|
|
|
@ -21,14 +21,6 @@ void blend(size_t numPoses, const AnimPose* a, const AnimPose* b, float alpha, A
|
||||||
const AnimPose& aPose = a[i];
|
const AnimPose& aPose = a[i];
|
||||||
const AnimPose& bPose = b[i];
|
const AnimPose& bPose = b[i];
|
||||||
|
|
||||||
// adjust signs if necessary
|
|
||||||
const glm::quat& q1 = aPose.rot();
|
|
||||||
glm::quat q2 = bPose.rot();
|
|
||||||
float dot = glm::dot(q1, q2);
|
|
||||||
if (dot < 0.0f) {
|
|
||||||
q2 = -q2;
|
|
||||||
}
|
|
||||||
|
|
||||||
result[i].scale() = lerp(aPose.scale(), bPose.scale(), alpha);
|
result[i].scale() = lerp(aPose.scale(), bPose.scale(), alpha);
|
||||||
result[i].rot() = safeLerp(aPose.rot(), bPose.rot(), alpha);
|
result[i].rot() = safeLerp(aPose.rot(), bPose.rot(), alpha);
|
||||||
result[i].trans() = lerp(aPose.trans(), bPose.trans(), alpha);
|
result[i].trans() = lerp(aPose.trans(), bPose.trans(), alpha);
|
||||||
|
|
|
@ -63,8 +63,8 @@ static const QString LEFT_FOOT_POSITION("leftFootPosition");
|
||||||
static const QString LEFT_FOOT_ROTATION("leftFootRotation");
|
static const QString LEFT_FOOT_ROTATION("leftFootRotation");
|
||||||
static const QString LEFT_FOOT_IK_POSITION_VAR("leftFootIKPositionVar");
|
static const QString LEFT_FOOT_IK_POSITION_VAR("leftFootIKPositionVar");
|
||||||
static const QString LEFT_FOOT_IK_ROTATION_VAR("leftFootIKRotationVar");
|
static const QString LEFT_FOOT_IK_ROTATION_VAR("leftFootIKRotationVar");
|
||||||
static const QString MAIN_STATE_MACHINE_LEFT_FOOT_ROTATION("mainStateMachineLeftFootRotation");
|
|
||||||
static const QString MAIN_STATE_MACHINE_LEFT_FOOT_POSITION("mainStateMachineLeftFootPosition");
|
static const QString MAIN_STATE_MACHINE_LEFT_FOOT_POSITION("mainStateMachineLeftFootPosition");
|
||||||
|
static const QString MAIN_STATE_MACHINE_LEFT_FOOT_ROTATION("mainStateMachineLeftFootRotation");
|
||||||
|
|
||||||
static const QString RIGHT_FOOT_POSITION("rightFootPosition");
|
static const QString RIGHT_FOOT_POSITION("rightFootPosition");
|
||||||
static const QString RIGHT_FOOT_ROTATION("rightFootRotation");
|
static const QString RIGHT_FOOT_ROTATION("rightFootRotation");
|
||||||
|
|
Loading…
Reference in a new issue