mirror of
https://github.com/lubosz/overte.git
synced 2025-04-14 01:46:18 +02:00
adding ifdef for android os
This commit is contained in:
parent
425413419a
commit
d6dfaacf6f
3 changed files with 15 additions and 7 deletions
|
@ -2951,6 +2951,9 @@ void MyAvatar::initAnimGraph() {
|
|||
graphUrl = _fstAnimGraphOverrideUrl;
|
||||
} else {
|
||||
graphUrl = PathUtils::resourcesUrl("avatar/avatar-animation.json");
|
||||
#ifdef Q_OS_ANDROID
|
||||
graphUrl = PathUtils::resourcesUrl("avatar/avatar-animation_withSplineIKNode.json");
|
||||
#endif
|
||||
}
|
||||
|
||||
emit animGraphUrlChanged(graphUrl);
|
||||
|
|
|
@ -131,7 +131,7 @@ const AnimPoseVec& AnimSplineIK::evaluate(const AnimVariantMap& animVars, const
|
|||
baseParentAbsPose = _skeleton->getAbsolutePose(baseParentIndex, _poses);
|
||||
}
|
||||
_poses[_baseJointIndex] = baseParentAbsPose.inverse() * baseTargetAbsolutePose;
|
||||
_poses[_baseJointIndex].scale() = glm::vec3(1.0f);
|
||||
_poses[_baseJointIndex].scale() = 1.0f;
|
||||
|
||||
// initialize the middle joint target
|
||||
IKTarget midTarget;
|
||||
|
@ -290,7 +290,7 @@ void AnimSplineIK::setSkeletonInternal(AnimSkeleton::ConstPointer skeleton) {
|
|||
void AnimSplineIK::solveTargetWithSpline(const AnimContext& context, int base, const IKTarget& target, const AnimPoseVec& absolutePoses, bool debug, AnimChain& chainInfoOut) const {
|
||||
|
||||
// build spline from tip to base
|
||||
AnimPose tipPose = AnimPose(glm::vec3(1.0f), target.getRotation(), target.getTranslation());
|
||||
AnimPose tipPose = AnimPose(1.0f, target.getRotation(), target.getTranslation());
|
||||
AnimPose basePose = absolutePoses[base];
|
||||
|
||||
CubicHermiteSplineFunctorWithArcLength spline;
|
||||
|
@ -338,7 +338,7 @@ void AnimSplineIK::solveTargetWithSpline(const AnimContext& context, int base, c
|
|||
glm::mat3 m(u, v, glm::cross(u, v));
|
||||
glm::quat rot = glm::normalize(glm::quat_cast(m));
|
||||
|
||||
AnimPose desiredAbsPose = AnimPose(glm::vec3(1.0f), rot, trans) * splineJointInfo.offsetPose;
|
||||
AnimPose desiredAbsPose = AnimPose(1.0f, rot, trans) * splineJointInfo.offsetPose;
|
||||
|
||||
// apply flex coefficent
|
||||
AnimPose flexedAbsPose;
|
||||
|
@ -457,7 +457,7 @@ void AnimSplineIK::computeAndCacheSplineJointInfosForIKTarget(const AnimContext&
|
|||
glm::mat3 m(u, v, glm::cross(u, v));
|
||||
glm::quat rot = glm::normalize(glm::quat_cast(m));
|
||||
|
||||
AnimPose pose(glm::vec3(1.0f), rot, spline(t));
|
||||
AnimPose pose(1.0f, rot, spline(t));
|
||||
AnimPose offsetPose = pose.inverse() * defaultPose;
|
||||
|
||||
SplineJointInfo splineJointInfo = { index, ratio, offsetPose };
|
||||
|
|
|
@ -1516,8 +1516,13 @@ void Rig::updateHands(bool leftHandEnabled, bool rightHandEnabled, bool hipsEnab
|
|||
|
||||
if (ENABLE_POLE_VECTORS && handJointIndex >= 0 && armJointIndex >= 0 && elbowJointIndex >= 0 && oppositeArmJointIndex >= 0) {
|
||||
glm::vec3 poleVector;
|
||||
//bool usePoleVector = calculateElbowPoleVector(handJointIndex, elbowJointIndex, armJointIndex, oppositeArmJointIndex, poleVector);
|
||||
bool usePoleVector = calculateElbowPoleVectorOptimized(handJointIndex, elbowJointIndex, armJointIndex, false, poleVector);
|
||||
bool usePoleVector = false;
|
||||
#ifdef Q_OS_ANDROID
|
||||
usePoleVector = calculateElbowPoleVectorOptimized(handJointIndex, elbowJointIndex, armJointIndex, false, poleVector);
|
||||
#else
|
||||
usePoleVector = calculateElbowPoleVectorOptimized(handJointIndex, elbowJointIndex, armJointIndex, false, poleVector);
|
||||
// bool usePoleVector = calculateElbowPoleVector(handJointIndex, elbowJointIndex, armJointIndex, oppositeArmJointIndex, poleVector);
|
||||
#endif
|
||||
if (usePoleVector) {
|
||||
glm::vec3 sensorPoleVector = transformVectorFast(rigToSensorMatrix, poleVector);
|
||||
_animVars.set("rightHandPoleVectorEnabled", true);
|
||||
|
@ -1708,7 +1713,7 @@ bool Rig::calculateElbowPoleVectorOptimized(int handIndex, int elbowIndex, int s
|
|||
|
||||
// calculate the reference axis and the side axis.
|
||||
// Look up refVector from animVars, make sure to convert into geom space.
|
||||
glm::vec3 refVector = (AnimPose(_rigToGeometryTransform) * elbowPose).xformVectorFast(Vectors::UNIT_X);
|
||||
glm::vec3 refVector = (AnimPose(_rigToGeometryTransform) * elbowPose).xformVector(Vectors::UNIT_X);
|
||||
float refVectorLength = glm::length(refVector);
|
||||
|
||||
if (left) {
|
||||
|
|
Loading…
Reference in a new issue