mirror of
https://github.com/JulianGro/overte.git
synced 2025-04-08 07:22:25 +02:00
Merge pull request #16045 from hyperlogic/feature/reaction-intro-loop-outro
Higher quality standing and seated reactions
This commit is contained in:
commit
c2fbfd70c4
14 changed files with 1068 additions and 81 deletions
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
interface/resources/avatar/animations/sitting_emote_clap_all.fbx
Normal file
BIN
interface/resources/avatar/animations/sitting_emote_clap_all.fbx
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
interface/resources/avatar/animations/sitting_talk04.fbx
Normal file
BIN
interface/resources/avatar/animations/sitting_talk04.fbx
Normal file
Binary file not shown.
File diff suppressed because it is too large
Load diff
|
@ -57,14 +57,12 @@ const AnimPoseVec& AnimRandomSwitch::evaluate(const AnimVariantMap& animVars, co
|
|||
lowerBound = upperBound;
|
||||
}
|
||||
if (abs(_randomSwitchEvaluationCount - context.getEvaluationCount()) > 1) {
|
||||
_duringInterp = false;
|
||||
switchRandomState(animVars, context, desiredState, _duringInterp);
|
||||
switchRandomState(animVars, context, desiredState, false);
|
||||
} else {
|
||||
// firing a random switch, be sure that we aren't completing a previously triggered transition
|
||||
if (currentStateHasPriority) {
|
||||
if (desiredState->getID() != _currentState->getID()) {
|
||||
_duringInterp = true;
|
||||
switchRandomState(animVars, context, desiredState, _duringInterp);
|
||||
switchRandomState(animVars, context, desiredState, true);
|
||||
} else {
|
||||
_duringInterp = false;
|
||||
}
|
||||
|
@ -79,8 +77,7 @@ const AnimPoseVec& AnimRandomSwitch::evaluate(const AnimVariantMap& animVars, co
|
|||
// evaluate currentState transitions
|
||||
auto transitionState = evaluateTransitions(animVars);
|
||||
if (transitionState != _currentState) {
|
||||
_duringInterp = true;
|
||||
switchRandomState(animVars, context, transitionState, _duringInterp);
|
||||
switchRandomState(animVars, context, transitionState, true);
|
||||
_triggerTime = randFloatInRange(_triggerTimeMin, _triggerTimeMax);
|
||||
_randomSwitchTime = randFloatInRange(_randomSwitchTimeMin, _randomSwitchTimeMax);
|
||||
}
|
||||
|
@ -172,6 +169,9 @@ void AnimRandomSwitch::switchRandomState(const AnimVariantMap& animVars, const A
|
|||
_lastPlayedState = nextStateNode->getID();
|
||||
if (shouldInterp) {
|
||||
|
||||
bool interpActive = _duringInterp;
|
||||
_duringInterp = true;
|
||||
|
||||
const float FRAMES_PER_SECOND = 30.0f;
|
||||
|
||||
auto prevStateNode = _children[_currentState->getChildIndex()];
|
||||
|
@ -195,13 +195,21 @@ void AnimRandomSwitch::switchRandomState(const AnimVariantMap& animVars, const A
|
|||
}
|
||||
_nextPoses = nextStateNode->evaluate(animVars, context, dt, triggers);
|
||||
} else if (_interpType == InterpType::SnapshotPrev) {
|
||||
// snapshot previoius pose
|
||||
// snapshot previous pose
|
||||
_prevPoses = _poses;
|
||||
// no need to evaluate _nextPoses we will do it dynamically during the interp,
|
||||
// however we need to set the current frame.
|
||||
if (!desiredState->getResume()) {
|
||||
nextStateNode->setCurrentFrame(desiredState->_interpTarget - duration);
|
||||
}
|
||||
} else if (_interpType == InterpType::EvaluateBoth) {
|
||||
// need to set current frame in destination branch.
|
||||
nextStateNode->setCurrentFrame(desiredState->_interpTarget - duration);
|
||||
if (interpActive) {
|
||||
// snapshot previous pose
|
||||
_prevPoses = _poses;
|
||||
_interpType = InterpType::SnapshotPrev;
|
||||
}
|
||||
} else {
|
||||
assert(false);
|
||||
}
|
||||
|
|
|
@ -128,6 +128,7 @@ void AnimStateMachine::switchState(const AnimVariantMap& animVars, const AnimCon
|
|||
auto prevStateNode = _children[_currentState->getChildIndex()];
|
||||
auto nextStateNode = _children[desiredState->getChildIndex()];
|
||||
|
||||
bool interpActive = _duringInterp;
|
||||
_duringInterp = true;
|
||||
_alpha = 0.0f;
|
||||
float duration = std::max(0.001f, animVars.lookup(desiredState->_interpDurationVar, desiredState->_interpDuration));
|
||||
|
@ -146,11 +147,19 @@ void AnimStateMachine::switchState(const AnimVariantMap& animVars, const AnimCon
|
|||
nextStateNode->setCurrentFrame(desiredState->_interpTarget);
|
||||
_nextPoses = nextStateNode->evaluate(animVars, context, dt, triggers);
|
||||
} else if (_interpType == InterpType::SnapshotPrev) {
|
||||
// snapshot previoius pose
|
||||
// snapshot previous pose
|
||||
_prevPoses = _poses;
|
||||
// no need to evaluate _nextPoses we will do it dynamically during the interp,
|
||||
// however we need to set the current frame.
|
||||
nextStateNode->setCurrentFrame(desiredState->_interpTarget - duration);
|
||||
} else if (_interpType == InterpType::EvaluateBoth) {
|
||||
// need to set current frame in destination branch.
|
||||
nextStateNode->setCurrentFrame(desiredState->_interpTarget - duration);
|
||||
if (interpActive) {
|
||||
// snapshot previous pose
|
||||
_prevPoses = _poses;
|
||||
_interpType = InterpType::SnapshotPrev;
|
||||
}
|
||||
} else {
|
||||
assert(false);
|
||||
}
|
||||
|
|
|
@ -2112,8 +2112,10 @@ void Rig::updateFromControllerParameters(const ControllerParameters& params, flo
|
|||
}
|
||||
float easeOutInValue = _talkIdleInterpTime < 0.5f ? 4.0f * powf(_talkIdleInterpTime, 3.0f) : 4.0f * powf((_talkIdleInterpTime - 1.0f), 3.0f) + 1.0f;
|
||||
_animVars.set("talkOverlayAlpha", easeOutInValue);
|
||||
_animVars.set("idleOverlayAlpha", easeOutInValue); // backward compatibility for older anim graphs.
|
||||
} else {
|
||||
_animVars.set("talkOverlayAlpha", 1.0f);
|
||||
_animVars.set("idleOverlayAlpha", 1.0f); // backward compatibility for older anim graphs.
|
||||
}
|
||||
} else {
|
||||
if (_talkIdleInterpTime < 1.0f) {
|
||||
|
@ -2124,8 +2126,10 @@ void Rig::updateFromControllerParameters(const ControllerParameters& params, flo
|
|||
float easeOutInValue = _talkIdleInterpTime < 0.5f ? 4.0f * powf(_talkIdleInterpTime, 3.0f) : 4.0f * powf((_talkIdleInterpTime - 1.0f), 3.0f) + 1.0f;
|
||||
float talkAlpha = 1.0f - easeOutInValue;
|
||||
_animVars.set("talkOverlayAlpha", talkAlpha);
|
||||
_animVars.set("idleOverlayAlpha", talkAlpha); // backward compatibility for older anim graphs.
|
||||
} else {
|
||||
_animVars.set("talkOverlayAlpha", 0.0f);
|
||||
_animVars.set("idleOverlayAlpha", 0.0f); // backward compatibility for older anim graphs.
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue