From f2af37801e8434b12558ac58284179724c69e4e0 Mon Sep 17 00:00:00 2001 From: Jeffrey Ventrella Date: Fri, 17 May 2013 14:56:14 -0700 Subject: [PATCH 1/2] tidied up the head class and fixed a negated pitch value in orientation --- interface/src/Head.cpp | 20 ++++--- interface/src/Head.h | 119 ++++++++++++++++++++--------------------- 2 files changed, 71 insertions(+), 68 deletions(-) diff --git a/interface/src/Head.cpp b/interface/src/Head.cpp index 91971efd27..3a583479fd 100644 --- a/interface/src/Head.cpp +++ b/interface/src/Head.cpp @@ -88,7 +88,7 @@ void Head::setNewTarget(float pitch, float yaw) { void Head::simulate(float deltaTime, bool isMine) { //generate orientation directions based on Euler angles... - _orientation.setToPitchYawRoll( _pitch, _bodyYaw + _yaw, _roll); + _orientation.setToPitchYawRoll( -_pitch, _bodyYaw + _yaw, _roll); //calculate the eye positions (algorithm still being designed) updateEyePositions(); @@ -146,15 +146,21 @@ void Head::simulate(float deltaTime, bool isMine) { if (randFloat() < 0.1) { _eyeContactTarget = MOUTH; } else { - if (randFloat() < 0.5) _eyeContactTarget = LEFT_EYE; else _eyeContactTarget = RIGHT_EYE; + if (randFloat() < 0.5) { + _eyeContactTarget = LEFT_EYE; + } else { + _eyeContactTarget = RIGHT_EYE; + } } } + // Set eyeball pitch and yaw to make contact - float eye_target_yaw_adjust = 0; - float eye_target_pitch_adjust = 0; - if (_eyeContactTarget == LEFT_EYE) eye_target_yaw_adjust = DEGREES_BETWEEN_VIEWER_EYES; - if (_eyeContactTarget == RIGHT_EYE) eye_target_yaw_adjust = -DEGREES_BETWEEN_VIEWER_EYES; - if (_eyeContactTarget == MOUTH) eye_target_pitch_adjust = DEGREES_TO_VIEWER_MOUTH; + float eye_target_yaw_adjust = 0.0f; + float eye_target_pitch_adjust = 0.0f; + + if (_eyeContactTarget == LEFT_EYE ) { eye_target_yaw_adjust = DEGREES_BETWEEN_VIEWER_EYES; } + if (_eyeContactTarget == RIGHT_EYE) { eye_target_yaw_adjust = -DEGREES_BETWEEN_VIEWER_EYES; } + if (_eyeContactTarget == MOUTH ) { eye_target_pitch_adjust = DEGREES_TO_VIEWER_MOUTH; } _eyeballPitch[0] = _eyeballPitch[1] = -_pitch + eye_target_pitch_adjust; _eyeballYaw [0] = _eyeballYaw [1] = _yaw + eye_target_yaw_adjust; diff --git a/interface/src/Head.h b/interface/src/Head.h index 83e4930b7b..8f5afd052a 100644 --- a/interface/src/Head.h +++ b/interface/src/Head.h @@ -16,34 +16,38 @@ #include "SerialInterface.h" #include "Orientation.h" -enum eyeContactTargets {LEFT_EYE, RIGHT_EYE, MOUTH}; +enum eyeContactTargets +{ + LEFT_EYE, + RIGHT_EYE, + MOUTH +}; class Head { public: Head(); void simulate(float deltaTime, bool isMine); - void setPositionRotationAndScale(glm::vec3 position, glm::vec3 rotation, float scale); void render(bool lookingInMirror); - void setNewTarget(float, float); - void setSpringScale(float s) { _returnSpringScale = s; } - void setLookatPosition(glm::vec3 l ) { _lookatPosition = l; } - void setLooking(bool looking); - void setGravity(glm::vec3 gravity) { _gravity = gravity; } - void setBodyYaw(float y) { _bodyYaw = y; } - - glm::vec3 getApproximateEyePosition(); - - // Do you want head to try to return to center (depends on interface detected) - void setReturnToCenter(bool returnHeadToCenter) { _returnHeadToCenter = returnHeadToCenter; } - const bool getReturnToCenter() const { return _returnHeadToCenter; } - - float getAverageLoudness() {return _averageLoudness;}; - void setAverageLoudness(float averageLoudness) { _averageLoudness = averageLoudness; } - - void setSkinColor(glm::vec3 skinColor) { _skinColor = skinColor; } - void setAudioLoudness(float audioLoudness) { _audioLoudness = audioLoudness; } + void setLooking(bool looking); + void setPositionRotationAndScale(glm::vec3 position, glm::vec3 rotation, float scale); + void setNewTarget(float, float); + + void setLookatPosition (glm::vec3 lookatPosition ) { _lookatPosition = lookatPosition; } + void setGravity (glm::vec3 gravity ) { _gravity = gravity; } + void setSkinColor (glm::vec3 skinColor ) { _skinColor = skinColor; } + void setBodyYaw (float bodyYaw ) { _bodyYaw = bodyYaw; } + void setSpringScale (float returnSpringScale ) { _returnSpringScale = returnSpringScale; } + void setAverageLoudness(float averageLoudness ) { _averageLoudness = averageLoudness; } + void setAudioLoudness (float audioLoudness ) { _audioLoudness = audioLoudness; } + void setReturnToCenter (bool returnHeadToCenter) { _returnHeadToCenter = returnHeadToCenter; } + + glm::vec3 getApproximateEyePosition(); + const bool getReturnToCenter() const { return _returnHeadToCenter; } // Do you want head to try to return to center (depends on interface detected) + float getAverageLoudness() {return _averageLoudness;}; + + //some public members (left-over from pulling Head out of Avatar - I may see about privatizing these later). float yawRate; float noise; float leanForward; @@ -51,48 +55,41 @@ public: private: - bool _returnHeadToCenter; - float _audioLoudness; - glm::vec3 _skinColor; - glm::vec3 _position; - glm::vec3 _rotation; - glm::vec3 _lookatPosition; - - glm::vec3 _leftEyePosition; - glm::vec3 _rightEyePosition; - - float _yaw; - float _pitch; - float _roll; - float _eyeballPitch[2]; - float _eyeballYaw [2]; - float _eyebrowPitch[2]; - float _eyebrowRoll [2]; - float _interBrowDistance; - float _mouthPitch; - float _mouthYaw; - float _mouthWidth; - float _mouthHeight; - float _pitchTarget; - float _yawTarget; - float _noiseEnvelope; - float _scale; - int _eyeContact; - float _browAudioLift; - eyeContactTargets _eyeContactTarget; + bool _returnHeadToCenter; + float _audioLoudness; + glm::vec3 _skinColor; + glm::vec3 _position; + glm::vec3 _rotation; + glm::vec3 _lookatPosition; + glm::vec3 _leftEyePosition; + glm::vec3 _rightEyePosition; + float _yaw; + float _pitch; + float _roll; + float _eyeballPitch[2]; + float _eyeballYaw [2]; + float _eyebrowPitch[2]; + float _eyebrowRoll [2]; + float _interBrowDistance; + float _mouthPitch; + float _mouthYaw; + float _mouthWidth; + float _mouthHeight; + float _pitchTarget; + float _yawTarget; + float _noiseEnvelope; + float _scale; + int _eyeContact; + float _browAudioLift; + bool _looking; + glm::vec3 _gravity; + float _lastLoudness; + float _averageLoudness; + float _audioAttack; + float _returnSpringScale; //strength of return springs Orientation _orientation; - float _bodyYaw; - - // Sound loudness information - float _lastLoudness; - float _averageLoudness; - float _audioAttack; - - bool _looking; - glm::vec3 _gravity; - - // Strength of return springs - float _returnSpringScale; + float _bodyYaw; + eyeContactTargets _eyeContactTarget; // private methods void renderEyeBalls(); From f5dc5b0a392829c523d0ea11cb10dbf517ecf68f Mon Sep 17 00:00:00 2001 From: Jeffrey Ventrella Date: Fri, 17 May 2013 14:57:15 -0700 Subject: [PATCH 2/2] thingy --- CMakeLists.txt | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f55cd7d8b4..71fe49709b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -11,5 +11,4 @@ add_subdirectory(injector) add_subdirectory(pairing-server) add_subdirectory(space-server) add_subdirectory(voxel-edit) -add_subdirectory(voxel-server) -add_subdirectory(animation-server) \ No newline at end of file +add_subdirectory(animation-server)add_subdirectory(voxel-server) \ No newline at end of file