From d157428704a487bfa8cb7f4516d11b8046be9d14 Mon Sep 17 00:00:00 2001 From: Andrzej Kapolka Date: Fri, 28 Feb 2014 16:58:22 -0800 Subject: [PATCH] When we send data to the avatar mixer, send the tweaked head rotation. Closes --- interface/src/avatar/Head.h | 6 +++--- libraries/avatars/src/AvatarData.cpp | 6 +++--- libraries/avatars/src/HeadData.h | 4 ++++ 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/interface/src/avatar/Head.h b/interface/src/avatar/Head.h index d51df8d168..5c8e1e8769 100644 --- a/interface/src/avatar/Head.h +++ b/interface/src/avatar/Head.h @@ -74,9 +74,9 @@ public: void tweakYaw(float yaw) { _tweakedYaw = yaw; } void tweakRoll(float roll) { _tweakedRoll = roll; } - float getTweakedPitch() const; - float getTweakedYaw() const; - float getTweakedRoll() const; + virtual float getTweakedPitch() const; + virtual float getTweakedYaw() const; + virtual float getTweakedRoll() const; void applyCollision(CollisionInfo& collisionInfo); diff --git a/libraries/avatars/src/AvatarData.cpp b/libraries/avatars/src/AvatarData.cpp index 482cd7564a..78c73438dd 100644 --- a/libraries/avatars/src/AvatarData.cpp +++ b/libraries/avatars/src/AvatarData.cpp @@ -91,9 +91,9 @@ QByteArray AvatarData::toByteArray() { destinationBuffer += packFloatRatioToTwoByte(destinationBuffer, _targetScale); // Head rotation (NOTE: This needs to become a quaternion to save two bytes) - destinationBuffer += packFloatAngleToTwoByte(destinationBuffer, _headData->_yaw); - destinationBuffer += packFloatAngleToTwoByte(destinationBuffer, _headData->_pitch); - destinationBuffer += packFloatAngleToTwoByte(destinationBuffer, _headData->_roll); + destinationBuffer += packFloatAngleToTwoByte(destinationBuffer, _headData->getTweakedYaw()); + destinationBuffer += packFloatAngleToTwoByte(destinationBuffer, _headData->getTweakedPitch()); + destinationBuffer += packFloatAngleToTwoByte(destinationBuffer, _headData->getTweakedRoll()); // Head lean X,Z (head lateral and fwd/back motion relative to torso) diff --git a/libraries/avatars/src/HeadData.h b/libraries/avatars/src/HeadData.h index 618de89b31..e33f090bb9 100644 --- a/libraries/avatars/src/HeadData.h +++ b/libraries/avatars/src/HeadData.h @@ -43,6 +43,10 @@ public: float getRoll() const { return _roll; } void setRoll(float roll) { _roll = glm::clamp(roll, MIN_HEAD_ROLL, MAX_HEAD_ROLL); } + virtual float getTweakedYaw() const { return _yaw; } + virtual float getTweakedPitch() const { return _pitch; } + virtual float getTweakedRoll() const { return _roll; } + glm::quat getOrientation() const; void setOrientation(const glm::quat& orientation);