Merge pull request #2548 from ey6es/master

Couple of quick fixes: reset the skeleton joints when space is pressed a...
This commit is contained in:
AndrewMeadows 2014-03-27 11:21:24 -07:00
commit 8661bdf788
3 changed files with 15 additions and 3 deletions

View file

@ -397,9 +397,13 @@ void Avatar::renderDisplayName() {
glPushMatrix();
glm::vec3 textPosition;
getSkeletonModel().getNeckPosition(textPosition);
textPosition += getBodyUpDirection() * getHeadHeight() * 1.1f;
if (getSkeletonModel().getNeckPosition(textPosition)) {
textPosition += getBodyUpDirection() * getHeadHeight() * 1.1f;
} else {
const float HEAD_PROPORTION = 0.75f;
textPosition = _position + getBodyUpDirection() * (getBillboardSize() * HEAD_PROPORTION);
}
glTranslatef(textPosition.x, textPosition.y, textPosition.z);
// we need "always facing camera": we must remove the camera rotation from the stack

View file

@ -79,6 +79,7 @@ void MyAvatar::reset() {
// TODO? resurrect headMouse stuff?
//_headMouseX = _glWidget->width() / 2;
//_headMouseY = _glWidget->height() / 2;
_skeletonModel.reset();
getHead()->reset();
getHand()->reset();

View file

@ -130,9 +130,16 @@ void Model::init() {
}
void Model::reset() {
if (_jointStates.isEmpty()) {
return;
}
foreach (Model* attachment, _attachments) {
attachment->reset();
}
const FBXGeometry& geometry = _geometry->getFBXGeometry();
for (int i = 0; i < _jointStates.size(); i++) {
_jointStates[i].rotation = geometry.joints.at(i).rotation;
}
}
void Model::clearShapes() {