mirror of
https://github.com/lubosz/overte.git
synced 2025-08-08 03:27:48 +02:00
Hooked up isTalking flag to Rig and AnimGraph.
This commit is contained in:
parent
35e38a443c
commit
44eb448cbe
5 changed files with 12 additions and 1 deletions
|
@ -158,10 +158,11 @@ void Head::simulate(float deltaTime, bool isMine, bool billboard) {
|
||||||
bool forceBlink = false;
|
bool forceBlink = false;
|
||||||
const float TALKING_LOUDNESS = 100.0f;
|
const float TALKING_LOUDNESS = 100.0f;
|
||||||
const float BLINK_AFTER_TALKING = 0.25f;
|
const float BLINK_AFTER_TALKING = 0.25f;
|
||||||
|
_timeWithoutTalking += deltaTime;
|
||||||
if ((_averageLoudness - _longTermAverageLoudness) > TALKING_LOUDNESS) {
|
if ((_averageLoudness - _longTermAverageLoudness) > TALKING_LOUDNESS) {
|
||||||
_timeWithoutTalking = 0.0f;
|
_timeWithoutTalking = 0.0f;
|
||||||
|
|
||||||
} else if (_timeWithoutTalking < BLINK_AFTER_TALKING && (_timeWithoutTalking += deltaTime) >= BLINK_AFTER_TALKING) {
|
} else if (_timeWithoutTalking < BLINK_AFTER_TALKING && _timeWithoutTalking >= BLINK_AFTER_TALKING) {
|
||||||
forceBlink = true;
|
forceBlink = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -102,6 +102,8 @@ public:
|
||||||
|
|
||||||
void relaxLean(float deltaTime);
|
void relaxLean(float deltaTime);
|
||||||
void addLeanDeltas(float sideways, float forward);
|
void addLeanDeltas(float sideways, float forward);
|
||||||
|
|
||||||
|
float getTimeWithoutTalking() const { return _timeWithoutTalking; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
glm::vec3 calculateAverageEyePosition() const { return _leftEyePosition + (_rightEyePosition - _leftEyePosition ) * 0.5f; }
|
glm::vec3 calculateAverageEyePosition() const { return _leftEyePosition + (_rightEyePosition - _leftEyePosition ) * 0.5f; }
|
||||||
|
|
|
@ -146,6 +146,8 @@ void SkeletonModel::updateRig(float deltaTime, glm::mat4 parentTransform) {
|
||||||
headParams.leftEyeJointIndex = geometry.leftEyeJointIndex;
|
headParams.leftEyeJointIndex = geometry.leftEyeJointIndex;
|
||||||
headParams.rightEyeJointIndex = geometry.rightEyeJointIndex;
|
headParams.rightEyeJointIndex = geometry.rightEyeJointIndex;
|
||||||
|
|
||||||
|
headParams.isTalking = head->getTimeWithoutTalking() <= 1.5f;
|
||||||
|
|
||||||
_rig->updateFromHeadParameters(headParams, deltaTime);
|
_rig->updateFromHeadParameters(headParams, deltaTime);
|
||||||
|
|
||||||
Rig::HandParameters handParams;
|
Rig::HandParameters handParams;
|
||||||
|
|
|
@ -44,6 +44,7 @@ void Rig::HeadParameters::dump() const {
|
||||||
qCDebug(animation, " neckJointIndex = %.d", neckJointIndex);
|
qCDebug(animation, " neckJointIndex = %.d", neckJointIndex);
|
||||||
qCDebug(animation, " leftEyeJointIndex = %.d", leftEyeJointIndex);
|
qCDebug(animation, " leftEyeJointIndex = %.d", leftEyeJointIndex);
|
||||||
qCDebug(animation, " rightEyeJointIndex = %.d", rightEyeJointIndex);
|
qCDebug(animation, " rightEyeJointIndex = %.d", rightEyeJointIndex);
|
||||||
|
qCDebug(animation, " isTalking = %s", isTalking ? "true" : "false");
|
||||||
}
|
}
|
||||||
|
|
||||||
void insertSorted(QList<AnimationHandlePointer>& handles, const AnimationHandlePointer& handle) {
|
void insertSorted(QList<AnimationHandlePointer>& handles, const AnimationHandlePointer& handle) {
|
||||||
|
@ -951,6 +952,10 @@ void Rig::updateFromHeadParameters(const HeadParameters& params, float dt) {
|
||||||
updateNeckJoint(params.neckJointIndex, params);
|
updateNeckJoint(params.neckJointIndex, params);
|
||||||
updateEyeJoints(params.leftEyeJointIndex, params.rightEyeJointIndex, params.modelTranslation, params.modelRotation,
|
updateEyeJoints(params.leftEyeJointIndex, params.rightEyeJointIndex, params.modelTranslation, params.modelRotation,
|
||||||
params.worldHeadOrientation, params.eyeLookAt, params.eyeSaccade);
|
params.worldHeadOrientation, params.eyeLookAt, params.eyeSaccade);
|
||||||
|
|
||||||
|
if (_enableAnimGraph) {
|
||||||
|
_animVars.set("isTalking", params.isTalking);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static const glm::vec3 X_AXIS(1.0f, 0.0f, 0.0f);
|
static const glm::vec3 X_AXIS(1.0f, 0.0f, 0.0f);
|
||||||
|
|
|
@ -72,6 +72,7 @@ public:
|
||||||
int neckJointIndex = -1;
|
int neckJointIndex = -1;
|
||||||
int leftEyeJointIndex = -1;
|
int leftEyeJointIndex = -1;
|
||||||
int rightEyeJointIndex = -1;
|
int rightEyeJointIndex = -1;
|
||||||
|
bool isTalking = false;
|
||||||
|
|
||||||
void dump() const;
|
void dump() const;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue