mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 13:28:09 +02:00
Merge branch 'master' of https://github.com/highfidelity/hifi into orange
This commit is contained in:
commit
d6d95ff86b
10 changed files with 69 additions and 14 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; }
|
||||||
|
|
|
@ -1299,10 +1299,13 @@ void MyAvatar::initAnimGraph() {
|
||||||
// ik-avatar-hands.json
|
// ik-avatar-hands.json
|
||||||
// https://gist.githubusercontent.com/hyperlogic/04a02c47eb56d8bfaebb
|
// https://gist.githubusercontent.com/hyperlogic/04a02c47eb56d8bfaebb
|
||||||
//
|
//
|
||||||
|
// ik-avatar-hands-idle.json
|
||||||
|
// https://gist.githubusercontent.com/hyperlogic/d951c78532e7a20557ad
|
||||||
|
//
|
||||||
// or run a local web-server
|
// or run a local web-server
|
||||||
// python -m SimpleHTTPServer&
|
// python -m SimpleHTTPServer&
|
||||||
//auto graphUrl = QUrl("http://localhost:8000/avatar.json");
|
//auto graphUrl = QUrl("http://localhost:8000/avatar.json");
|
||||||
auto graphUrl = QUrl("https://gist.githubusercontent.com/hyperlogic/04a02c47eb56d8bfaebb/raw/72517b231f606b724c5169e02642e401f9af5a54/ik-avatar-hands.json");
|
auto graphUrl = QUrl("https://gist.githubusercontent.com/hyperlogic/d951c78532e7a20557ad/raw/8275a99a859bbb9b42530c1c7ebfd024e63ba250/ik-avatar-hands-idle.json");
|
||||||
_rig->initAnimGraph(graphUrl, _skeletonModel.getGeometry()->getFBXGeometry());
|
_rig->initAnimGraph(graphUrl, _skeletonModel.getGeometry()->getFBXGeometry());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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,11 @@ 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);
|
||||||
|
_animVars.set("notIsTalking", !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;
|
||||||
};
|
};
|
||||||
|
|
|
@ -73,7 +73,7 @@ AvatarData::~AvatarData() {
|
||||||
// We cannot have a file-level variable (const or otherwise) in the header if it uses PathUtils, because that references Application, which will not yet initialized.
|
// We cannot have a file-level variable (const or otherwise) in the header if it uses PathUtils, because that references Application, which will not yet initialized.
|
||||||
// Thus we have a static class getter, referencing a static class var.
|
// Thus we have a static class getter, referencing a static class var.
|
||||||
QUrl AvatarData::_defaultFullAvatarModelUrl = {}; // In C++, if this initialization were in the header, every file would have it's own copy, even for class vars.
|
QUrl AvatarData::_defaultFullAvatarModelUrl = {}; // In C++, if this initialization were in the header, every file would have it's own copy, even for class vars.
|
||||||
const QUrl AvatarData::defaultFullAvatarModelUrl() {
|
const QUrl& AvatarData::defaultFullAvatarModelUrl() {
|
||||||
if (_defaultFullAvatarModelUrl.isEmpty()) {
|
if (_defaultFullAvatarModelUrl.isEmpty()) {
|
||||||
_defaultFullAvatarModelUrl = QUrl::fromLocalFile(PathUtils::resourcesPath() + "meshes/defaultAvatar_full.fst");
|
_defaultFullAvatarModelUrl = QUrl::fromLocalFile(PathUtils::resourcesPath() + "meshes/defaultAvatar_full.fst");
|
||||||
}
|
}
|
||||||
|
@ -966,8 +966,9 @@ bool AvatarData::hasIdentityChangedAfterParsing(NLPacket& packet) {
|
||||||
QByteArray AvatarData::identityByteArray() {
|
QByteArray AvatarData::identityByteArray() {
|
||||||
QByteArray identityData;
|
QByteArray identityData;
|
||||||
QDataStream identityStream(&identityData, QIODevice::Append);
|
QDataStream identityStream(&identityData, QIODevice::Append);
|
||||||
|
const QUrl& urlToSend = (_skeletonModelURL == AvatarData::defaultFullAvatarModelUrl()) ? QUrl("") : _skeletonModelURL;
|
||||||
|
|
||||||
identityStream << QUuid() << _faceModelURL << _skeletonModelURL << _attachmentData << _displayName;
|
identityStream << QUuid() << _faceModelURL << urlToSend << _attachmentData << _displayName;
|
||||||
|
|
||||||
return identityData;
|
return identityData;
|
||||||
}
|
}
|
||||||
|
|
|
@ -166,7 +166,7 @@ public:
|
||||||
AvatarData();
|
AvatarData();
|
||||||
virtual ~AvatarData();
|
virtual ~AvatarData();
|
||||||
|
|
||||||
static const QUrl defaultFullAvatarModelUrl();
|
static const QUrl& defaultFullAvatarModelUrl();
|
||||||
|
|
||||||
virtual bool isMyAvatar() const { return false; }
|
virtual bool isMyAvatar() const { return false; }
|
||||||
|
|
||||||
|
|
|
@ -99,8 +99,8 @@ void AvatarHashMap::processAvatarIdentityPacket(QSharedPointer<NLPacket> packet,
|
||||||
avatar->setFaceModelURL(faceMeshURL);
|
avatar->setFaceModelURL(faceMeshURL);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (avatar->getSkeletonModelURL() != skeletonURL) {
|
if (avatar->getSkeletonModelURL().isEmpty() || (avatar->getSkeletonModelURL() != skeletonURL)) {
|
||||||
avatar->setSkeletonModelURL(skeletonURL);
|
avatar->setSkeletonModelURL(skeletonURL); // Will expand "" to default and so will not continuously fire
|
||||||
}
|
}
|
||||||
|
|
||||||
if (avatar->getAttachmentData() != attachmentData) {
|
if (avatar->getAttachmentData() != attachmentData) {
|
||||||
|
|
|
@ -451,15 +451,54 @@
|
||||||
"children": [
|
"children": [
|
||||||
{
|
{
|
||||||
"id": "idle",
|
"id": "idle",
|
||||||
"type": "clip",
|
"type": "stateMachine",
|
||||||
"data": {
|
"data": {
|
||||||
"url": "https://hifi-public.s3.amazonaws.com/ozan/anim/standard_anims/idle.fbx",
|
"currentState": "idleStand",
|
||||||
"startFrame": 0.0,
|
"states": [
|
||||||
"endFrame": 90.0,
|
{
|
||||||
"timeScale": 1.0,
|
"id": "idleStand",
|
||||||
"loopFlag": true
|
"interpTarget": 6,
|
||||||
|
"interpDuration": 6,
|
||||||
|
"transitions": [
|
||||||
|
{ "var": "isTalking", "state": "idleTalk" }
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "idleTalk",
|
||||||
|
"interpTarget": 6,
|
||||||
|
"interpDuration": 6,
|
||||||
|
"transitions": [
|
||||||
|
{ "var": "notIsTalking", "state": "idleStand" }
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"children": []
|
"children": [
|
||||||
|
{
|
||||||
|
"id": "idleStand",
|
||||||
|
"type": "clip",
|
||||||
|
"data": {
|
||||||
|
"url": "https://hifi-public.s3.amazonaws.com/ozan/anim/standard_anims/idle.fbx",
|
||||||
|
"startFrame": 0.0,
|
||||||
|
"endFrame": 90.0,
|
||||||
|
"timeScale": 1.0,
|
||||||
|
"loopFlag": true
|
||||||
|
},
|
||||||
|
"children": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "idleTalk",
|
||||||
|
"type": "clip",
|
||||||
|
"data": {
|
||||||
|
"url": "http://hifi-public.s3.amazonaws.com/ozan/anim/talk/talk.fbx",
|
||||||
|
"startFrame": 0.0,
|
||||||
|
"endFrame": 801.0,
|
||||||
|
"timeScale": 1.0,
|
||||||
|
"loopFlag": true
|
||||||
|
},
|
||||||
|
"children": []
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "walkFwd",
|
"id": "walkFwd",
|
||||||
|
|
Loading…
Reference in a new issue