More priority bits.

This commit is contained in:
Andrzej Kapolka 2014-05-22 15:00:36 -07:00
parent 8717977437
commit 083543419d
2 changed files with 14 additions and 3 deletions

View file

@ -711,17 +711,19 @@ glm::vec3 MyAvatar::getUprightHeadPosition() const {
return _position + getWorldAlignedOrientation() * glm::vec3(0.0f, getPelvisToHeadLength(), 0.0f);
}
const float JOINT_PRIORITY = 2.0f;
void MyAvatar::setJointData(int index, const glm::quat& rotation) {
Avatar::setJointData(index, rotation);
if (QThread::currentThread() == thread()) {
_skeletonModel.setJointState(index, true, rotation, 2.0f);
_skeletonModel.setJointState(index, true, rotation, JOINT_PRIORITY);
}
}
void MyAvatar::clearJointData(int index) {
Avatar::clearJointData(index);
if (QThread::currentThread() == thread()) {
_skeletonModel.setJointState(index, false, glm::quat(), 2.0f);
_skeletonModel.setJointState(index, false, glm::quat(), JOINT_PRIORITY);
}
}

View file

@ -1681,7 +1681,7 @@ void AnimationHandle::setURL(const QUrl& url) {
static void insertSorted(QList<AnimationHandlePointer>& handles, const AnimationHandlePointer& handle) {
for (QList<AnimationHandlePointer>::iterator it = handles.begin(); it != handles.end(); it++) {
if (handle->getPriority() < (*it)->getPriority()) {
if (handle->getPriority() > (*it)->getPriority()) {
handles.insert(it, handle);
return;
}
@ -1713,6 +1713,15 @@ void AnimationHandle::setRunning(bool running) {
} else {
_model->_runningAnimations.removeOne(_self);
for (int i = 0; i < _jointMappings.size(); i++) {
int mapping = _jointMappings.at(i);
if (mapping != -1) {
Model::JointState& state = _model->_jointStates[mapping];
if (_priority == state.animationPriority) {
state.animationPriority = 0.0f;
}
}
}
}
}