mirror of
https://github.com/lubosz/overte.git
synced 2025-04-14 14:46:55 +02:00
changed name of pre processor variable
This commit is contained in:
parent
95b3fbdc35
commit
27bfe2f0fe
3 changed files with 10 additions and 46 deletions
|
@ -2943,7 +2943,6 @@ void MyAvatar::setAnimGraphUrl(const QUrl& url) {
|
|||
connect(&(_skeletonModel->getRig()), SIGNAL(onLoadComplete()), this, SLOT(animGraphLoaded()));
|
||||
}
|
||||
|
||||
#define USE_Q_OS_ANDROID
|
||||
void MyAvatar::initAnimGraph() {
|
||||
QUrl graphUrl;
|
||||
if (!_prefOverrideAnimGraphUrl.get().isEmpty()) {
|
||||
|
@ -2953,7 +2952,7 @@ void MyAvatar::initAnimGraph() {
|
|||
} else {
|
||||
graphUrl = PathUtils::resourcesUrl("avatar/avatar-animation.json");
|
||||
|
||||
#if defined(Q_OS_ANDROID) || defined(USE_Q_OS_ANDROID)
|
||||
#if defined(Q_OS_ANDROID) || defined(HIFI_USE_Q_OS_ANDROID)
|
||||
graphUrl = PathUtils::resourcesUrl("avatar/avatar-animation_withSplineIKNode.json");
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -123,10 +123,6 @@ const AnimPoseVec& AnimPoleVectorConstraint::evaluate(const AnimVariantMap& anim
|
|||
|
||||
glm::quat deltaRot = glm::angleAxis(theta, unitAxis);
|
||||
|
||||
if (_tipJointName == "RightHand") {
|
||||
//qCDebug(animation) << "anim ik theta " << (theta / PI)*180.0f;
|
||||
}
|
||||
|
||||
// transform result back into parent relative frame.
|
||||
glm::quat relBaseRot = glm::inverse(baseParentPose.rot()) * deltaRot * basePose.rot();
|
||||
ikChain.setRelativePoseAtJointIndex(_baseJointIndex, AnimPose(relBaseRot, underPoses[_baseJointIndex].trans()));
|
||||
|
|
|
@ -34,7 +34,6 @@
|
|||
#include "IKTarget.h"
|
||||
#include "PathUtils.h"
|
||||
|
||||
#define USE_Q_OS_ANDROID
|
||||
static int nextRigId = 1;
|
||||
static std::map<int, Rig*> rigRegistry;
|
||||
static std::mutex rigRegistryMutex;
|
||||
|
@ -1460,7 +1459,7 @@ void Rig::updateHands(bool leftHandEnabled, bool rightHandEnabled, bool hipsEnab
|
|||
int oppositeArmJointIndex = _animSkeleton->nameToJointIndex("RightArm");
|
||||
if (ENABLE_POLE_VECTORS && handJointIndex >= 0 && armJointIndex >= 0 && elbowJointIndex >= 0 && oppositeArmJointIndex >= 0) {
|
||||
glm::vec3 poleVector;
|
||||
#if defined(Q_OS_ANDROID) || defined(USE_Q_OS_ANDROID)
|
||||
#if defined(Q_OS_ANDROID) || defined(HIFI_USE_Q_OS_ANDROID)
|
||||
bool isLeft = true;
|
||||
bool usePoleVector = calculateElbowPoleVectorOptimized(handJointIndex, elbowJointIndex, armJointIndex, isLeft, poleVector);
|
||||
#else
|
||||
|
@ -1520,7 +1519,7 @@ void Rig::updateHands(bool leftHandEnabled, bool rightHandEnabled, bool hipsEnab
|
|||
|
||||
if (ENABLE_POLE_VECTORS && handJointIndex >= 0 && armJointIndex >= 0 && elbowJointIndex >= 0 && oppositeArmJointIndex >= 0) {
|
||||
glm::vec3 poleVector;
|
||||
#if defined(Q_OS_ANDROID) || defined(USE_Q_OS_ANDROID)
|
||||
#if defined(Q_OS_ANDROID) || defined(HIFI_USE_Q_OS_ANDROID)
|
||||
bool isLeft = false;
|
||||
bool usePoleVector = calculateElbowPoleVectorOptimized(handJointIndex, elbowJointIndex, armJointIndex, isLeft, poleVector);
|
||||
#else
|
||||
|
@ -1702,7 +1701,6 @@ static float getHandPositionTheta(glm::vec3 armToHand, float defaultArmLength, b
|
|||
const float zWeightBottom = -100.0f;
|
||||
const glm::vec3 weights(-50.0f, 60.0f, 90.0f);
|
||||
|
||||
|
||||
float yFactor = (fabsf(armToHand[1] / defaultArmLength) * weights[1]) + biases[1];
|
||||
|
||||
float zFactor;
|
||||
|
@ -1714,7 +1712,6 @@ static float getHandPositionTheta(glm::vec3 armToHand, float defaultArmLength, b
|
|||
|
||||
float xFactor;
|
||||
if (left) {
|
||||
//xFactor = weights[0] * glm::max(-1.0f * (armToHand[0] / defaultArmLength) + xStart, 0.0f);
|
||||
xFactor = weights[0] * ((-1.0f * (armToHand[0] / defaultArmLength) + xStart) - (0.2f) * ((1.0f + (armToHand[1] / defaultArmLength)) / 2.0f));
|
||||
} else {
|
||||
xFactor = weights[0] * (((armToHand[0] / defaultArmLength) + xStart) - (0.2f) * ((1.0f + (armToHand[1] / defaultArmLength)) / 2.0f));
|
||||
|
@ -1722,18 +1719,19 @@ static float getHandPositionTheta(glm::vec3 armToHand, float defaultArmLength, b
|
|||
|
||||
handPositionTheta = xFactor + yFactor + zFactor;
|
||||
|
||||
if (handPositionTheta < 50.0f) {
|
||||
handPositionTheta = 50.0f;
|
||||
const float LOWER_ANATOMICAL_ANGLE = 175.0f;
|
||||
const float UPPER_ANATOMICAL_ANGLE = 50.0f;
|
||||
if (handPositionTheta < LOWER_ANATOMICAL_ANGLE) {
|
||||
handPositionTheta = LOWER_ANATOMICAL_ANGLE;
|
||||
}
|
||||
if (handPositionTheta > 175.0f) {
|
||||
handPositionTheta = 175.0f;
|
||||
if (handPositionTheta > UPPER_ANATOMICAL_ANGLE) {
|
||||
handPositionTheta = UPPER_ANATOMICAL_ANGLE;
|
||||
}
|
||||
|
||||
if (left) {
|
||||
handPositionTheta *= -1.0f;
|
||||
}
|
||||
|
||||
|
||||
return handPositionTheta;
|
||||
}
|
||||
|
||||
|
@ -1875,31 +1873,10 @@ bool Rig::calculateElbowPoleVectorOptimized(int handIndex, int elbowIndex, int s
|
|||
} else {
|
||||
unitAxis = Vectors::UNIT_Y;
|
||||
}
|
||||
|
||||
|
||||
// get the pole vector theta based on the hand position relative to the shoulder.
|
||||
float positionalTheta = getHandPositionTheta(armToHand, defaultArmLength, left);
|
||||
//qCDebug(animation) << "hand position theta " << left << " " << positionalTheta;
|
||||
|
||||
/*
|
||||
float deltaTheta = 0.0f;
|
||||
if (left) {
|
||||
deltaTheta = positionalTheta - _lastThetaLeft;
|
||||
} else {
|
||||
deltaTheta = positionalTheta - _lastThetaRight;
|
||||
}
|
||||
float deltaThetaRadians = (deltaTheta / 180.0f)*PI;
|
||||
AnimPose deltaRot(glm::angleAxis(deltaThetaRadians, unitAxis), glm::vec3());
|
||||
AnimPose relMid = shoulderPose.inverse() * elbowPose;
|
||||
AnimPose updatedBase = shoulderPose * deltaRot;
|
||||
AnimPose newAbsMid = updatedBase * relMid;
|
||||
|
||||
glm::quat axisRotation;
|
||||
glm::quat nonAxisRotation;
|
||||
swingTwistDecomposition(updatedBase.rot(), unitAxis, nonAxisRotation, axisRotation);
|
||||
//qCDebug(animation) << "the rotation about the axis of the arm " << (glm::sign(glm::axis(axisRotation)[2]) * glm::angle(axisRotation) / PI)*180.0f << " delta Rot theta " << deltaTheta;
|
||||
|
||||
//glm::quat relativeHandRotation = (newAbsMid.inverse() * handPose).rot();
|
||||
*/
|
||||
|
||||
// now we calculate the contribution of the hand rotation relative to the arm
|
||||
glm::quat relativeHandRotation = (elbowPose.inverse() * handPose).rot();
|
||||
|
@ -1983,10 +1960,6 @@ bool Rig::calculateElbowPoleVectorOptimized(int handIndex, int elbowIndex, int s
|
|||
_lastPositionThetaRight = positionalTheta;
|
||||
_lastThetaRight = positionalTheta + _lastWristCoefficientRight;
|
||||
}
|
||||
|
||||
if (left) {
|
||||
qCDebug(animation) << " ulnar deviation ave: " << (_ulnarRadialThetaRunningAverageLeft / PI) * 180.0f << " ulnar correction " << currentWristCoefficient << " twist theta " << (trueTwistTheta / PI) * 180.0f;
|
||||
}
|
||||
|
||||
// limit the correction anatomically possible angles and change to radians
|
||||
const float LOWER_ANATOMICAL_ANGLE = 175.0f;
|
||||
|
@ -2000,10 +1973,6 @@ bool Rig::calculateElbowPoleVectorOptimized(int handIndex, int elbowIndex, int s
|
|||
if (_lastThetaLeft < -LOWER_ANATOMICAL_ANGLE) {
|
||||
_lastThetaLeft = -LOWER_ANATOMICAL_ANGLE;
|
||||
}
|
||||
const float MIN_VALUE = 0.0001f;
|
||||
if (fabsf(_lastPositionThetaLeft - _lastThetaLeft) > MIN_VALUE) {
|
||||
//qCDebug(animation) << " lastThetaLeft " << _lastThetaLeft << "last position theta left" << _lastPositionThetaLeft << "last wrist coeff " << _lastWristCoefficientLeft;
|
||||
}
|
||||
// convert to radians and make 180 0 to match pole vector theta
|
||||
thetaRadians = ((180.0f - _lastThetaLeft) / 180.0f)*PI;
|
||||
} else {
|
||||
|
|
Loading…
Reference in a new issue