From 253154ce6d45daf0460b3548cf7b64a1141e4ee6 Mon Sep 17 00:00:00 2001 From: Jeffrey Ventrella Date: Wed, 7 Aug 2013 10:17:53 -0700 Subject: [PATCH 1/9] fixed mohawk physics bug --- interface/src/Application.cpp | 4 ++-- interface/src/BendyLine.cpp | 2 +- interface/src/avatar/Head.cpp | 15 +++++++++------ interface/src/avatar/Head.h | 3 ++- 4 files changed, 14 insertions(+), 10 deletions(-) diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index 52e6c984ea..5bde58a302 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -2681,7 +2681,7 @@ void Application::updateAvatar(float deltaTime) { // If I'm in paint mode, send a voxel out to VOXEL server nodes. if (_paintOn) { - + glm::vec3 avatarPos = _myAvatar.getPosition(); // For some reason, we don't want to flip X and Z here. @@ -2692,7 +2692,7 @@ void Application::updateAvatar(float deltaTime) { if (_paintingVoxel.x >= 0.0 && _paintingVoxel.x <= 1.0 && _paintingVoxel.y >= 0.0 && _paintingVoxel.y <= 1.0 && _paintingVoxel.z >= 0.0 && _paintingVoxel.z <= 1.0) { - + PACKET_TYPE message = (_destructiveAddVoxel->isChecked() ? PACKET_TYPE_SET_VOXEL_DESTRUCTIVE : PACKET_TYPE_SET_VOXEL); sendVoxelEditMessage(message, _paintingVoxel); diff --git a/interface/src/BendyLine.cpp b/interface/src/BendyLine.cpp index ef5bd5f18d..8aca07dfac 100644 --- a/interface/src/BendyLine.cpp +++ b/interface/src/BendyLine.cpp @@ -24,7 +24,7 @@ BendyLine::BendyLine(){ _gravityForce = glm::vec3(0.0f, 0.0f, 0.0f); _basePosition = glm::vec3(0.0f, 0.0f, 0.0f); - _baseDirection = glm::vec3(0.0f, 0.0f, 0.0f); + _baseDirection = glm::vec3(0.0f, 1.0f, 0.0f); _midPosition = glm::vec3(0.0f, 0.0f, 0.0f); _endPosition = glm::vec3(0.0f, 0.0f, 0.0f); _midVelocity = glm::vec3(0.0f, 0.0f, 0.0f); diff --git a/interface/src/avatar/Head.cpp b/interface/src/avatar/Head.cpp index b88802b7f1..c74f06f9f0 100644 --- a/interface/src/avatar/Head.cpp +++ b/interface/src/avatar/Head.cpp @@ -30,10 +30,12 @@ const float MINIMUM_EYE_ROTATION_DOT = 0.5f; // based on a dot product: 1.0 is const float EYEBALL_RADIUS = 0.017; const float EYELID_RADIUS = 0.019; const float EYEBALL_COLOR[3] = { 0.9f, 0.9f, 0.8f }; -const float HAIR_SPRING_FORCE = 7.0f; -const float HAIR_TORQUE_FORCE = 0.1f; -const float HAIR_GRAVITY_FORCE = 0.02f; + +const float HAIR_SPRING_FORCE = 15.0f; +const float HAIR_TORQUE_FORCE = 0.2f; +const float HAIR_GRAVITY_FORCE = 0.001f; const float HAIR_DRAG = 10.0f; + const float HAIR_LENGTH = 0.09f; const float HAIR_THICKNESS = 0.03f; const float NOSE_LENGTH = 0.025; @@ -73,9 +75,10 @@ Head::Head(Avatar* owningAvatar) : _audioAttack(0.0f), _returnSpringScale(1.0f), _bodyRotation(0.0f, 0.0f, 0.0f), + _hairInitialized(false), _renderLookatVectors(false), _mohawkTriangleFan(NULL), - _mohawkColors(NULL), + _mohawkColors(NULL), _saccade(0.0f, 0.0f, 0.0f), _saccadeTarget(0.0f, 0.0f, 0.0f), _leftEyeBlink(0.0f), @@ -128,7 +131,6 @@ void Head::reset() { } void Head::resetHairPhysics() { - //glm::vec3 up = getUpDirection(); for (int t = 0; t < NUM_HAIR_TUFTS; t ++) { for (int t = 0; t < NUM_HAIR_TUFTS; t ++) { @@ -334,7 +336,7 @@ void Head::setScale (float scale) { delete[] _mohawkColors; createMohawk(); - resetHairPhysics(); + //resetHairPhysics(); } void Head::createMohawk() { @@ -737,6 +739,7 @@ void Head::renderLookatVectors(glm::vec3 leftEyePosition, glm::vec3 rightEyePosi } void Head::updateHairPhysics(float deltaTime) { + glm::quat orientation = getOrientation(); glm::vec3 up = orientation * IDENTITY_UP; glm::vec3 front = orientation * IDENTITY_FRONT; diff --git a/interface/src/avatar/Head.h b/interface/src/avatar/Head.h index 1256b05bb7..a848e566f4 100644 --- a/interface/src/avatar/Head.h +++ b/interface/src/avatar/Head.h @@ -112,7 +112,8 @@ private: float _returnSpringScale; //strength of return springs glm::vec3 _bodyRotation; bool _renderLookatVectors; - BendyLine _hairTuft[NUM_HAIR_TUFTS]; + BendyLine _hairTuft[NUM_HAIR_TUFTS]; + bool _hairInitialized; glm::vec3* _mohawkTriangleFan; glm::vec3* _mohawkColors; glm::vec3 _saccade; From 6997d0174acf48235b50b4b560cb3dd1e3ce586c Mon Sep 17 00:00:00 2001 From: Jeffrey Ventrella Date: Wed, 7 Aug 2013 10:24:21 -0700 Subject: [PATCH 2/9] clean up in mohawk code --- interface/src/avatar/Head.cpp | 10 ++++++++-- interface/src/avatar/Head.h | 1 - 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/interface/src/avatar/Head.cpp b/interface/src/avatar/Head.cpp index 0cff0c45b7..1f6f4159f6 100644 --- a/interface/src/avatar/Head.cpp +++ b/interface/src/avatar/Head.cpp @@ -75,7 +75,6 @@ Head::Head(Avatar* owningAvatar) : _audioAttack(0.0f), _returnSpringScale(1.0f), _bodyRotation(0.0f, 0.0f, 0.0f), - _hairInitialized(false), _renderLookatVectors(false), _mohawkTriangleFan(NULL), _mohawkColors(NULL), @@ -335,10 +334,17 @@ void Head::setScale (float scale) { delete[] _mohawkTriangleFan; delete[] _mohawkColors; createMohawk(); + + if (USING_PHYSICAL_MOHAWK) { + for (int t = 0; t < NUM_HAIR_TUFTS; t ++) { - //resetHairPhysics(); + _hairTuft[t].setLength (_scale * HAIR_LENGTH ); + _hairTuft[t].setThickness(_scale * HAIR_THICKNESS); + } + } } + void Head::createMohawk() { uint16_t nodeId = UNKNOWN_NODE_ID; if (_owningAvatar->getOwningNode()) { diff --git a/interface/src/avatar/Head.h b/interface/src/avatar/Head.h index 3a6f6d4d90..60fc2864ed 100644 --- a/interface/src/avatar/Head.h +++ b/interface/src/avatar/Head.h @@ -115,7 +115,6 @@ private: glm::vec3 _bodyRotation; bool _renderLookatVectors; BendyLine _hairTuft[NUM_HAIR_TUFTS]; - bool _hairInitialized; glm::vec3* _mohawkTriangleFan; glm::vec3* _mohawkColors; glm::vec3 _saccade; From 1fc4f17f7af8784a7527c2a8e17fecff8c00de73 Mon Sep 17 00:00:00 2001 From: Eric Johnston Date: Wed, 7 Aug 2013 10:29:31 -0700 Subject: [PATCH 3/9] Rave tweaks: change the look of the hands, fix screen-darken Screen-darken is now a simple fullscreen draw Leap hands are now visible and match body lighting Fingertips are hidden and hand coloring matches body and arm "fake hands" aren't active unless they're chosen from the Debug menu. --- interface/src/Application.cpp | 2 +- interface/src/avatar/Avatar.cpp | 20 ++---- interface/src/avatar/Hand.cpp | 123 +++++++++++++------------------- interface/src/avatar/Hand.h | 2 - 4 files changed, 57 insertions(+), 90 deletions(-) diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index 5aac781d3d..d347830bb9 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -2540,7 +2540,7 @@ void Application::update(float deltaTime) { } // Leap finger-sensing device - LeapManager::enableFakeFingers(_simulateLeapHand->isChecked() || _testRaveGlove->isChecked()); + LeapManager::enableFakeFingers(_simulateLeapHand->isChecked()); _myAvatar.getHand().setRaveGloveActive(_testRaveGlove->isChecked()); LeapManager::nextFrame(_myAvatar); diff --git a/interface/src/avatar/Avatar.cpp b/interface/src/avatar/Avatar.cpp index 1f1609d401..dec361b798 100755 --- a/interface/src/avatar/Avatar.cpp +++ b/interface/src/avatar/Avatar.cpp @@ -913,12 +913,10 @@ void Avatar::updateHandMovementAndTouching(float deltaTime, bool enableHandMovem } // If there's a leap-interaction hand visible, use that as the endpoint - if (!getHand().isRaveGloveActive()) { - for (size_t i = 0; i < getHand().getPalms().size(); ++i) { - PalmData& palm = getHand().getPalms()[i]; - if (palm.isActive()) { - _skeleton.joint[ AVATAR_JOINT_RIGHT_FINGERTIPS ].position = palm.getPosition(); - } + for (size_t i = 0; i < getHand().getPalms().size(); ++i) { + PalmData& palm = getHand().getPalms()[i]; + if (palm.isActive()) { + _skeleton.joint[ AVATAR_JOINT_RIGHT_FINGERTIPS ].position = palm.getPosition(); } } }//if (_isMine) @@ -1404,13 +1402,9 @@ void Avatar::renderBody(bool lookingInMirror, bool renderAvatarBalls) { for (int b = 0; b < NUM_AVATAR_BODY_BALLS; b++) { float alpha = getBallRenderAlpha(b, lookingInMirror); - // When in rave glove mode, don't show the arms at all. - if (_hand.isRaveGloveActive()) { - if (b == BODY_BALL_LEFT_ELBOW - || b == BODY_BALL_LEFT_WRIST - || b == BODY_BALL_LEFT_FINGERTIPS - || b == BODY_BALL_RIGHT_ELBOW - || b == BODY_BALL_RIGHT_WRIST + // When we have leap hands, hide part of the arms. + if (_hand.getNumPalms() > 0) { + if (b == BODY_BALL_LEFT_FINGERTIPS || b == BODY_BALL_RIGHT_FINGERTIPS) { continue; } diff --git a/interface/src/avatar/Hand.cpp b/interface/src/avatar/Hand.cpp index e274e64e1a..a8939d8c1a 100755 --- a/interface/src/avatar/Hand.cpp +++ b/interface/src/avatar/Hand.cpp @@ -78,7 +78,7 @@ void Hand::calculateGeometry() { for (size_t f = 0; f < palm.getNumFingers(); ++f) { FingerData& finger = palm.getFingers()[f]; if (finger.isActive()) { - const float standardBallRadius = 0.01f; + const float standardBallRadius = 0.005f; _leapFingerTipBalls.resize(_leapFingerTipBalls.size() + 1); HandBall& ball = _leapFingerTipBalls.back(); ball.rotation = _baseOrientation; @@ -99,7 +99,7 @@ void Hand::calculateGeometry() { for (size_t f = 0; f < palm.getNumFingers(); ++f) { FingerData& finger = palm.getFingers()[f]; if (finger.isActive()) { - const float standardBallRadius = 0.01f; + const float standardBallRadius = 0.005f; _leapFingerRootBalls.resize(_leapFingerRootBalls.size() + 1); HandBall& ball = _leapFingerRootBalls.back(); ball.rotation = _baseOrientation; @@ -139,10 +139,18 @@ void Hand::render(bool lookingInMirror) { calculateGeometry(); - if (_isRaveGloveActive) { - // Disable raveGloveStage while we work on the network glove features - // renderRaveGloveStage(); + if ( SHOW_LEAP_HAND ) { + if (!isRaveGloveActive()) { + renderLeapFingerTrails(); + } + if (isRaveGloveActive()) { + // Use mood lighting for the hand itself + setRaveLights(RAVE_LIGHTS_AVATAR); + } + renderLeapHands(); + } + if (_isRaveGloveActive) { if (_raveGloveInitialized) { updateRaveGloveEmitters(); // do this after calculateGeometry @@ -155,13 +163,6 @@ void Hand::render(bool lookingInMirror) { glEnable(GL_DEPTH_TEST); glEnable(GL_RESCALE_NORMAL); - if ( SHOW_LEAP_HAND ) { - //renderLeapHands(); - if (!isRaveGloveActive()) { - renderLeapFingerTrails(); - renderLeapHandSpheres(); - } - } } void Hand::setRaveLights(RaveLightsSetting setting) { @@ -190,76 +191,50 @@ void Hand::setRaveLights(RaveLightsSetting setting) { } void Hand::renderRaveGloveStage() { - if (_owningAvatar && _owningAvatar->isMyAvatar()) { - Head& head = _owningAvatar->getHead(); - glm::quat headOrientation = head.getOrientation(); - glm::vec3 headPosition = head.getPosition(); - float scale = 100.0f; - glm::vec3 vc = headOrientation * glm::vec3( 0.0f, 0.0f, -30.0f) + headPosition; - glm::vec3 v0 = headOrientation * (glm::vec3(-1.0f, -1.0f, 0.0f) * scale) + vc; - glm::vec3 v1 = headOrientation * (glm::vec3( 1.0f, -1.0f, 0.0f) * scale) + vc; - glm::vec3 v2 = headOrientation * (glm::vec3( 1.0f, 1.0f, 0.0f) * scale) + vc; - glm::vec3 v3 = headOrientation * (glm::vec3(-1.0f, 1.0f, 0.0f) * scale) + vc; - - glDisable(GL_DEPTH_TEST); - glDepthMask(GL_FALSE); - glEnable(GL_BLEND); - glBegin(GL_TRIANGLE_FAN); - glColor4f(0.0f, 0.0f, 0.0f, 1.0f); - glVertex3fv((float*)&vc); - glColor4f(0.0f, 0.0f, 0.0f, 0.5f); - glVertex3fv((float*)&v0); - glVertex3fv((float*)&v1); - glVertex3fv((float*)&v2); - glVertex3fv((float*)&v3); - glVertex3fv((float*)&v0); - glEnd(); - glDepthMask(GL_TRUE); - glEnable(GL_DEPTH_TEST); - } -} - - -void Hand::renderLeapHands() { - for (size_t i = 0; i < getNumPalms(); ++i) { - PalmData& hand = getPalms()[i]; - if (hand.isActive()) { - renderLeapHand(hand); - } - } -} - -void Hand::renderLeapHand(PalmData& hand) { + // Draw a simple fullscreen triangle fan, darkest in the center. + glMatrixMode(GL_PROJECTION); glPushMatrix(); - const float palmThickness = 0.002f; - glColor4f(0.5f, 0.5f, 0.5f, 1.0); - glm::vec3 tip = hand.getPosition(); - glm::vec3 root = hand.getPosition() + hand.getNormal() * palmThickness; - Avatar::renderJointConnectingCone(root, tip, 0.05, 0.03); - - for (size_t f = 0; f < hand.getNumFingers(); ++f) { - FingerData& finger = hand.getFingers()[f]; - if (finger.isActive()) { - glColor4f(_ballColor.r, _ballColor.g, _ballColor.b, 0.5); - glm::vec3 tip = finger.getTipPosition(); - glm::vec3 root = finger.getRootPosition(); - Avatar::renderJointConnectingCone(root, tip, 0.001, 0.003); - } - } - + glLoadIdentity(); + glMatrixMode(GL_MODELVIEW); + glPushMatrix(); + glLoadIdentity(); + + glDisable(GL_DEPTH_TEST); + glDepthMask(GL_FALSE); + glEnable(GL_BLEND); + glBegin(GL_TRIANGLE_FAN); + // Dark center vertex + glColor4f(0.0f, 0.0f, 0.0f, 1.0f); + glVertex3f(0.0f, 0.0f, 0.0f); + // Lighter outer vertices + glColor4f(0.0f, 0.0f, 0.0f, 0.5f); + glVertex3f(-1.0f,-1.0f, 0.0f); + glVertex3f( 1.0f,-1.0f, 0.0f); + glVertex3f( 1.0f, 1.0f, 0.0f); + glVertex3f(-1.0f, 1.0f, 0.0f); + glVertex3f(-1.0f,-1.0f, 0.0f); + glEnd(); + glDepthMask(GL_TRUE); + glEnable(GL_DEPTH_TEST); + + glMatrixMode(GL_PROJECTION); + glPopMatrix(); + glMatrixMode(GL_MODELVIEW); glPopMatrix(); } +void Hand::renderLeapHands() { -void Hand::renderLeapHandSpheres() { + const float alpha = 1.0f; + //const glm::vec3 handColor = _ballColor; + const glm::vec3 handColor(1.0, 0.84, 0.66); // use the skin color + glPushMatrix(); // Draw the leap balls for (size_t i = 0; i < _leapFingerTipBalls.size(); i++) { - float alpha = 1.0f; - if (alpha > 0.0f) { - glColor4f(_ballColor.r, _ballColor.g, _ballColor.b, alpha); + glColor4f(handColor.r, handColor.g, handColor.b, alpha); glPushMatrix(); glTranslatef(_leapFingerTipBalls[i].position.x, _leapFingerTipBalls[i].position.y, _leapFingerTipBalls[i].position.z); @@ -275,7 +250,7 @@ void Hand::renderLeapHandSpheres() { for (size_t f = 0; f < palm.getNumFingers(); ++f) { FingerData& finger = palm.getFingers()[f]; if (finger.isActive()) { - glColor4f(_ballColor.r, _ballColor.g, _ballColor.b, 0.5); + glColor4f(handColor.r, handColor.g, handColor.b, 0.5); glm::vec3 tip = finger.getTipPosition(); glm::vec3 root = finger.getRootPosition(); Avatar::renderJointConnectingCone(root, tip, 0.001, 0.003); @@ -289,7 +264,7 @@ void Hand::renderLeapHandSpheres() { PalmData& palm = getPalms()[i]; if (palm.isActive()) { const float palmThickness = 0.002f; - glColor4f(_ballColor.r, _ballColor.g, _ballColor.b, 0.25); + glColor4f(handColor.r, handColor.g, handColor.b, 0.25); glm::vec3 tip = palm.getPosition(); glm::vec3 root = palm.getPosition() + palm.getNormal() * palmThickness; Avatar::renderJointConnectingCone(root, tip, 0.05, 0.03); diff --git a/interface/src/avatar/Hand.h b/interface/src/avatar/Hand.h index 54a2b2e8a3..c4bc428456 100755 --- a/interface/src/avatar/Hand.h +++ b/interface/src/avatar/Hand.h @@ -81,9 +81,7 @@ private: void activateNewRaveGloveMode(); - void renderLeapHandSpheres(); void renderLeapHands(); - void renderLeapHand(PalmData& hand); void renderLeapFingerTrails(); void calculateGeometry(); }; From 414af9811a93dc0f9b08e2b823820a2348ec95cf Mon Sep 17 00:00:00 2001 From: atlante45 Date: Wed, 7 Aug 2013 10:54:52 -0700 Subject: [PATCH 4/9] - Add fading to lookAt vectors --- interface/src/avatar/Head.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/interface/src/avatar/Head.cpp b/interface/src/avatar/Head.cpp index 8f1d511b02..21ee350de0 100644 --- a/interface/src/avatar/Head.cpp +++ b/interface/src/avatar/Head.cpp @@ -724,14 +724,15 @@ void Head::renderEyeBalls() { void Head::renderLookatVectors(glm::vec3 leftEyePosition, glm::vec3 rightEyePosition, glm::vec3 lookatPosition) { - glColor3f(0.0f, 0.0f, 0.0f); glLineWidth(2.0); - glBegin(GL_LINE_STRIP); + glBegin(GL_LINES); + glColor4f(0.2f, 0.2f, 0.2f, 1.f); glVertex3f(leftEyePosition.x, leftEyePosition.y, leftEyePosition.z); + glColor4f(1.0f, 1.0f, 1.0f, 0.f); glVertex3f(lookatPosition.x, lookatPosition.y, lookatPosition.z); - glEnd(); - glBegin(GL_LINE_STRIP); + glColor4f(0.2f, 0.2f, 0.2f, 1.f); glVertex3f(rightEyePosition.x, rightEyePosition.y, rightEyePosition.z); + glColor4f(1.0f, 1.0f, 1.0f, 0.f); glVertex3f(lookatPosition.x, lookatPosition.y, lookatPosition.z); glEnd(); } From 132d03e291dda2223f394d78b46a3aae87874873 Mon Sep 17 00:00:00 2001 From: atlante45 Date: Wed, 7 Aug 2013 10:56:32 -0700 Subject: [PATCH 5/9] Moved string when following to chest --- interface/src/Application.cpp | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index 359975339d..204945a213 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -2326,13 +2326,13 @@ void Application::renderFollowIndicator() { if (leader != NULL) { glColor3f(1.f, 0.f, 0.f); - glVertex3f(avatar->getPosition().x, - avatar->getPosition().y, - avatar->getPosition().z); + glVertex3f((avatar->getHead().getPosition().x + avatar->getPosition().x) / 2.f, + (avatar->getHead().getPosition().y + avatar->getPosition().y) / 2.f, + (avatar->getHead().getPosition().z + avatar->getPosition().z) / 2.f); glColor3f(0.f, 1.f, 0.f); - glVertex3f(leader->getPosition().x, - leader->getPosition().y, - leader->getPosition().z); + glVertex3f((leader->getHead().getPosition().x + leader->getPosition().x) / 2.f, + (leader->getHead().getPosition().y + leader->getPosition().y) / 2.f, + (leader->getHead().getPosition().z + leader->getPosition().z) / 2.f); } } } @@ -2340,13 +2340,13 @@ void Application::renderFollowIndicator() { if (_myAvatar.getLeadingAvatar() != NULL) { glColor3f(1.f, 0.f, 0.f); - glVertex3f(_myAvatar.getPosition().x, - _myAvatar.getPosition().y, - _myAvatar.getPosition().z); + glVertex3f((_myAvatar.getHead().getPosition().x + _myAvatar.getPosition().x) / 2.f, + (_myAvatar.getHead().getPosition().y + _myAvatar.getPosition().y) / 2.f, + (_myAvatar.getHead().getPosition().z + _myAvatar.getPosition().z) / 2.f); glColor3f(0.f, 1.f, 0.f); - glVertex3f(_myAvatar.getLeadingAvatar()->getPosition().x, - _myAvatar.getLeadingAvatar()->getPosition().y, - _myAvatar.getLeadingAvatar()->getPosition().z); + glVertex3f((_myAvatar.getLeadingAvatar()->getHead().getPosition().x + _myAvatar.getLeadingAvatar()->getPosition().x) / 2.f, + (_myAvatar.getLeadingAvatar()->getHead().getPosition().y + _myAvatar.getLeadingAvatar()->getPosition().y) / 2.f, + (_myAvatar.getLeadingAvatar()->getHead().getPosition().z + _myAvatar.getLeadingAvatar()->getPosition().z) / 2.f); } glEnd(); From f151b2cfc11980127ecc5483ba2e9950607686b1 Mon Sep 17 00:00:00 2001 From: atlante45 Date: Wed, 7 Aug 2013 10:58:30 -0700 Subject: [PATCH 6/9] - Don't render body when in first person view --- interface/src/Application.cpp | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index 204945a213..2e45707557 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -3099,14 +3099,16 @@ void Application::displaySide(Camera& whichCamera) { } // Render my own Avatar - if (_myCamera.getMode() == CAMERA_MODE_MIRROR) { - _myAvatar.getHead().setLookAtPosition(_myCamera.getPosition()); - } - _myAvatar.render(_lookingInMirror->isChecked(), _renderAvatarBalls->isChecked()); - _myAvatar.setDisplayingLookatVectors(_renderLookatOn->isChecked()); + if (_myCamera.getMode() != CAMERA_MODE_FIRST_PERSON) { + if (_myCamera.getMode() == CAMERA_MODE_MIRROR) { + _myAvatar.getHead().setLookAtPosition(_myCamera.getPosition()); + } + _myAvatar.render(_lookingInMirror->isChecked(), _renderAvatarBalls->isChecked()); + _myAvatar.setDisplayingLookatVectors(_renderLookatOn->isChecked()); - if (_renderLookatIndicatorOn->isChecked() && _isLookingAtOtherAvatar) { - renderLookatIndicator(_lookatOtherPosition, whichCamera); + if (_renderLookatIndicatorOn->isChecked() && _isLookingAtOtherAvatar) { + renderLookatIndicator(_lookatOtherPosition, whichCamera); + } } } From dcdae6c6a039ccea2e95f84b30bf00fb7962b0d6 Mon Sep 17 00:00:00 2001 From: atlante45 Date: Wed, 7 Aug 2013 11:00:20 -0700 Subject: [PATCH 7/9] - Add a translucide sphere around avatars far away with radius relative to average loudness --- interface/src/avatar/Avatar.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/interface/src/avatar/Avatar.cpp b/interface/src/avatar/Avatar.cpp index d695cb4759..2ce2fc29a5 100755 --- a/interface/src/avatar/Avatar.cpp +++ b/interface/src/avatar/Avatar.cpp @@ -1165,6 +1165,23 @@ void Avatar::render(bool lookingInMirror, bool renderAvatarBalls) { // render body renderBody(lookingInMirror, renderAvatarBalls); + // render sphere when far away + if (!isMyAvatar()) { + const float MAX_ANGLE = 10.f; + glm::vec3 toTarget = _position - Application::getInstance()->getAvatar()->getPosition(); + glm::vec3 delta = _height * (_head.getCameraOrientation() * IDENTITY_UP) / 2.f; + float angle = abs(angleBetween(toTarget + delta, toTarget - delta)); + + if (angle < MAX_ANGLE) { + glColor4f(0.5f, 0.8f, 0.8f, 1.f - angle / MAX_ANGLE); + glPushMatrix(); + glTranslatef(_position.x, _position.y, _position.z); + glScalef(_height / 2.f, _height / 2.f, _height / 2.f); + glutSolidSphere(1.2f + _head.getAverageLoudness() * .0005f, 20, 20); + glPopMatrix(); + } + } + // if this is my avatar, then render my interactions with the other avatar if (isMyAvatar()) { _avatarTouch.render(Application::getInstance()->getCamera()->getPosition()); From 10e4174ce302d6328951b9a5f7338069af027549 Mon Sep 17 00:00:00 2001 From: Eric Johnston Date: Wed, 7 Aug 2013 11:08:14 -0700 Subject: [PATCH 8/9] Rave tweak: keep the right arm on the right-most Leap hand. --- interface/src/avatar/Avatar.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/interface/src/avatar/Avatar.cpp b/interface/src/avatar/Avatar.cpp index dec361b798..c973a31f1e 100755 --- a/interface/src/avatar/Avatar.cpp +++ b/interface/src/avatar/Avatar.cpp @@ -913,10 +913,17 @@ void Avatar::updateHandMovementAndTouching(float deltaTime, bool enableHandMovem } // If there's a leap-interaction hand visible, use that as the endpoint + glm::vec3 rightMostHand; + bool anyHandsFound = false; for (size_t i = 0; i < getHand().getPalms().size(); ++i) { PalmData& palm = getHand().getPalms()[i]; if (palm.isActive()) { - _skeleton.joint[ AVATAR_JOINT_RIGHT_FINGERTIPS ].position = palm.getPosition(); + if (!anyHandsFound + || palm.getRawPosition().x > rightMostHand.x) { + _skeleton.joint[ AVATAR_JOINT_RIGHT_FINGERTIPS ].position = palm.getPosition(); + rightMostHand = palm.getRawPosition(); + } + anyHandsFound = true; } } }//if (_isMine) From ccf3498ae5f1c8ab063e829c9f8706f36ff0c094 Mon Sep 17 00:00:00 2001 From: ZappoMan Date: Wed, 7 Aug 2013 11:11:03 -0700 Subject: [PATCH 9/9] quick fix crash in parseVoxelStats() --- interface/src/Application.cpp | 33 ++++++++++++++++++--------------- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index 19b889a918..1f06eef04e 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -3953,24 +3953,27 @@ int Application::parseVoxelStats(unsigned char* messageData, ssize_t messageLeng // But, also identify the sender, and keep track of the contained jurisdiction root for this server Node* voxelServer = NodeList::getInstance()->nodeWithAddress(&senderAddress); - uint16_t nodeID = voxelServer->getNodeID(); - - VoxelPositionSize jurisditionDetails; - voxelDetailsForCode(_voxelSceneStats.getJurisdictionRoot(), jurisditionDetails); - // see if this is the first we've heard of this node... - if (_voxelServerJurisdictions.find(nodeID) == _voxelServerJurisdictions.end()) { - printf("stats from new voxel server... v[%f, %f, %f, %f]\n", - jurisditionDetails.x, jurisditionDetails.y, jurisditionDetails.z, jurisditionDetails.s); + // quick fix for crash... why would voxelServer be NULL? + if (voxelServer) { + uint16_t nodeID = voxelServer->getNodeID(); - // Add the jurisditionDetails object to the list of "fade outs" - VoxelFade fade(VoxelFade::FADE_OUT, NODE_ADDED_RED, NODE_ADDED_GREEN, NODE_ADDED_BLUE); - fade.voxelDetails = jurisditionDetails; - _voxelFades.push_back(fade); + VoxelPositionSize jurisditionDetails; + voxelDetailsForCode(_voxelSceneStats.getJurisdictionRoot(), jurisditionDetails); + + // see if this is the first we've heard of this node... + if (_voxelServerJurisdictions.find(nodeID) == _voxelServerJurisdictions.end()) { + printf("stats from new voxel server... v[%f, %f, %f, %f]\n", + jurisditionDetails.x, jurisditionDetails.y, jurisditionDetails.z, jurisditionDetails.s); + + // Add the jurisditionDetails object to the list of "fade outs" + VoxelFade fade(VoxelFade::FADE_OUT, NODE_ADDED_RED, NODE_ADDED_GREEN, NODE_ADDED_BLUE); + fade.voxelDetails = jurisditionDetails; + _voxelFades.push_back(fade); + } + // store jurisdiction details for later use + _voxelServerJurisdictions[nodeID] = jurisditionDetails; } - // store jurisdiction details for later use - _voxelServerJurisdictions[nodeID] = jurisditionDetails; - return statsMessageLength; }