From 0b014c563521271dd9616bd4691c8c7ae6495a8a Mon Sep 17 00:00:00 2001 From: Jeffrey Ventrella Date: Wed, 22 May 2013 15:50:36 -0700 Subject: [PATCH] cleaned up some stuff --- interface/src/Application.cpp | 6 +----- interface/src/Avatar.cpp | 23 +---------------------- interface/src/Avatar.h | 8 ++++---- interface/src/Head.cpp | 13 +++---------- interface/src/Head.h | 3 ++- 5 files changed, 11 insertions(+), 42 deletions(-) diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index e33a49be6e..577edc229d 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -1702,11 +1702,7 @@ void Application::displaySide(Camera& whichCamera) { // Render my own Avatar _myAvatar.render(_lookingInMirror->isChecked(), _myCamera.getPosition()); - if (_renderLookatOn->isChecked()) { - _myAvatar.setDisplayingLookatVectors(true); - } else { - _myAvatar.setDisplayingLookatVectors(false); - } + _myAvatar.setDisplayingLookatVectors(_renderLookatOn->isChecked()); } // Render the world box diff --git a/interface/src/Avatar.cpp b/interface/src/Avatar.cpp index 9655076ffd..3b2c9bf686 100644 --- a/interface/src/Avatar.cpp +++ b/interface/src/Avatar.cpp @@ -400,7 +400,7 @@ void Avatar::simulate(float deltaTime, Transmitter* transmitter) { // set head lookat position if (_isMine) { if (_interactingOther) { - _head.setLookAtPosition(_interactingOther->getAverageEyePosition()); + _head.setLookAtPosition(_interactingOther->caclulateAverageEyePosition()); } else { _head.setLookAtPosition(glm::vec3(0.0f, 0.0f, 0.0f)); // 0,0,0 represents NOT looking at anything } @@ -421,11 +421,6 @@ void Avatar::simulate(float deltaTime, Transmitter* transmitter) { } } -glm::vec3 Avatar::getAverageEyePosition() { - - return _head.getAverageEyePosition(); -} - void Avatar::checkForMouseRayTouching() { for (int b = 0; b < NUM_AVATAR_JOINTS; b++) { @@ -587,15 +582,6 @@ void Avatar::updateCollisionWithSphere(glm::vec3 position, float radius, float d } } } - - /* - if (jointCollision) { - if (!_usingBodySprings) { - _usingBodySprings = true; - initializeBodySprings(); - } - } - */ } } @@ -716,13 +702,6 @@ void Avatar::applyCollisionWithOtherAvatar(Avatar * otherAvatar, float deltaTime otherAvatar->_velocity *= bodyMomentum; } -void Avatar::setDisplayingHead(bool displayingHead) { - _displayingHead = displayingHead; -} - -void Avatar::setDisplayingLookatVectors(bool displayingLookatVectors) { - _head.setRenderLookatVectors(displayingLookatVectors); -} static TextRenderer* textRenderer() { static TextRenderer* renderer = new TextRenderer(SANS_FONT_FAMILY, 24, -1, false, TextRenderer::SHADOW_EFFECT); diff --git a/interface/src/Avatar.h b/interface/src/Avatar.h index a2f2b83383..9afe9d4b05 100644 --- a/interface/src/Avatar.h +++ b/interface/src/Avatar.h @@ -94,7 +94,7 @@ public: float getAbsoluteHeadYaw() const; float getAbsoluteHeadPitch() const; - glm::vec3 getAverageEyePosition(); // get the position smack-dab between the eyes (for lookat) + glm::vec3 caclulateAverageEyePosition() { return _head.caclulateAverageEyePosition(); } // get the position smack-dab between the eyes (for lookat) const glm::vec3& getHeadPosition() const ; // get the position of the avatar's rigid body head const glm::vec3& getSpringyHeadPosition() const ; // get the springy position of the avatar's head const glm::vec3& getJointPosition(AvatarJointID j) const { return _joint[j].springyPosition; }; @@ -113,9 +113,9 @@ public: void simulate(float deltaTime, Transmitter* transmitter); void setMovedHandOffset(glm::vec3 movedHandOffset) { _movedHandOffset = movedHandOffset; } void updateArmIKAndConstraints( float deltaTime ); - void setDisplayingHead( bool displayingHead ); - void setDisplayingLookatVectors(bool displayingLookatVectors); - + void setDisplayingHead( bool displayingHead ) { _displayingHead = displayingHead; } + void setDisplayingLookatVectors(bool displayingLookatVectors) { _head.setRenderLookatVectors(displayingLookatVectors); } + // Set what driving keys are being pressed to control thrust levels void setDriveKeys(int key, bool val) { _driveKeys[key] = val; }; bool getDriveKeys(int key) { return _driveKeys[key]; }; diff --git a/interface/src/Head.cpp b/interface/src/Head.cpp index d187e0d23b..9561cee19e 100644 --- a/interface/src/Head.cpp +++ b/interface/src/Head.cpp @@ -7,7 +7,6 @@ #include "Head.h" #include "Util.h" #include -#include #include using namespace std; @@ -118,7 +117,7 @@ void Head::determineIfLookingAtSomething() { if ( fabs(_lookAtPosition.x + _lookAtPosition.y + _lookAtPosition.z) == 0.0 ) { // a lookatPosition of 0,0,0 signifies NOT looking _lookingAtSomething = false; } else { - glm::vec3 targetLookatAxis = glm::normalize(_lookAtPosition - getAverageEyePosition()); + glm::vec3 targetLookatAxis = glm::normalize(_lookAtPosition - caclulateAverageEyePosition()); float dot = glm::dot(targetLookatAxis, _orientation.getFront()); if (dot < MINIMUM_EYE_ROTATION_DOT) { // too far off from center for the eyes to rotate _lookingAtSomething = false; @@ -128,10 +127,6 @@ void Head::determineIfLookingAtSomething() { } } -glm::vec3 Head::getAverageEyePosition() { - return _leftEyePosition + (_rightEyePosition - _leftEyePosition ) * ONE_HALF; -} - void Head::calculateGeometry(bool lookingInMirror) { //generate orientation directions based on Euler angles... @@ -188,10 +183,8 @@ void Head::render(bool lookingInMirror) { renderMouth(); renderEyeBrows(); - if (_renderLookatVectors) { - if (_lookingAtSomething) { - renderLookatVectors(_leftEyePosition, _rightEyePosition, _lookAtPosition); - } + if (_renderLookatVectors && _lookingAtSomething) { + renderLookatVectors(_leftEyePosition, _rightEyePosition, _lookAtPosition); } } diff --git a/interface/src/Head.h b/interface/src/Head.h index de92aeb2e4..5b45c6421c 100644 --- a/interface/src/Head.h +++ b/interface/src/Head.h @@ -15,6 +15,7 @@ #include "InterfaceConfig.h" #include "SerialInterface.h" #include "Orientation.h" +#include enum eyeContactTargets { @@ -45,7 +46,7 @@ public: const bool getReturnToCenter() const { return _returnHeadToCenter; } // Do you want head to try to return to center (depends on interface detected) float getAverageLoudness() {return _averageLoudness;}; - glm::vec3 getAverageEyePosition(); + glm::vec3 caclulateAverageEyePosition() { return _leftEyePosition + (_rightEyePosition - _leftEyePosition ) * ONE_HALF; } float yawRate; float noise;