diff --git a/interface/external/Leap/readme.txt b/interface/external/Leap/readme.txt new file mode 100644 index 0000000000..24a79299c0 --- /dev/null +++ b/interface/external/Leap/readme.txt @@ -0,0 +1,11 @@ + +Instructions for adding the Leap driver to Interface +Eric Johnston, July 10, 2013 + +NOTE: Without doing step 2, you will crash at program start time. + +1. Copy the Leap sdk folders (lib, include, etc.) into the interface/external/Leap folder. There should be a folder already there called "stub", and this read me.txt should be there as well. + +2. IMPORTANT: Copy the file interface/external/Leap/lib/libc++/libLeap.dylib to /usr/lib + +3. Delete your build directory, run cmake and build, and you should be all set. diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index 80eeaf546b..8d442a4b34 100755 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -2252,6 +2252,15 @@ void Application::displayOculus(Camera& whichCamera) { void Application::displaySide(Camera& whichCamera) { // transform by eye offset + // flip x if in mirror mode (also requires reversing winding order for backface culling) + if (_lookingInMirror->isChecked()) { + glScalef(-1.0f, 1.0f, 1.0f); + glFrontFace(GL_CW); + + } else { + glFrontFace(GL_CCW); + } + glm::vec3 eyeOffsetPos = whichCamera.getEyeOffsetPosition(); glm::quat eyeOffsetOrient = whichCamera.getEyeOffsetOrientation(); glm::vec3 eyeOffsetAxis = glm::axis(eyeOffsetOrient); diff --git a/interface/src/Avatar.cpp b/interface/src/Avatar.cpp index 00bf65fd7d..426aad57b3 100755 --- a/interface/src/Avatar.cpp +++ b/interface/src/Avatar.cpp @@ -324,7 +324,7 @@ void Avatar::updateFromGyrosAndOrWebcam(bool gyroLook, const glm::vec3& amplifyA // Update torso lean distance based on accelerometer data const float TORSO_LENGTH = 0.5f; const float MAX_LEAN = 45.0f; - _head.setLeanSideways(glm::clamp(glm::degrees(atanf(-estimatedPosition.x * _leanScale / TORSO_LENGTH)), + _head.setLeanSideways(glm::clamp(glm::degrees(atanf(estimatedPosition.x * _leanScale / TORSO_LENGTH)), -MAX_LEAN, MAX_LEAN)); _head.setLeanForward(glm::clamp(glm::degrees(atanf(estimatedPosition.z * _leanScale / TORSO_LENGTH)), -MAX_LEAN, MAX_LEAN)); @@ -1222,7 +1222,7 @@ void Avatar::renderBody(bool lookingInMirror, bool renderAvatarBalls) { // Always render other people, and render myself when beyond threshold distance if (b == BODY_BALL_HEAD_BASE) { // the head is rendered as a special if (alpha > 0.0f) { - _head.render(lookingInMirror, alpha); + _head.render(alpha); } } else if (alpha > 0.0f) { // Render the body ball sphere diff --git a/interface/src/Head.cpp b/interface/src/Head.cpp index 39f0da3ca9..8b116b48ff 100644 --- a/interface/src/Head.cpp +++ b/interface/src/Head.cpp @@ -67,7 +67,6 @@ Head::Head(Avatar* owningAvatar) : _audioAttack(0.0f), _returnSpringScale(1.0f), _bodyRotation(0.0f, 0.0f, 0.0f), - _lookingInMirror(false), _renderLookatVectors(false), _mohawkTriangleFan(NULL), _mohawkColors(NULL), @@ -283,11 +282,10 @@ void Head::calculateGeometry() { } -void Head::render(bool lookingInMirror, float alpha) { +void Head::render(float alpha) { _renderAlpha = alpha; - _lookingInMirror = lookingInMirror; - + calculateGeometry(); glEnable(GL_DEPTH_TEST); @@ -375,8 +373,8 @@ void Head::renderMohawk() { } else { glPushMatrix(); glTranslatef(_position.x, _position.y, _position.z); - glRotatef((_lookingInMirror ? (_bodyRotation.y - _yaw) : (_bodyRotation.y + _yaw)), 0, 1, 0); - glRotatef(_lookingInMirror ? _roll: -_roll, 0, 0, 1); + glRotatef(_bodyRotation.y + _yaw, 0, 1, 0); + glRotatef(-_roll, 0, 0, 1); glRotatef(-_pitch - _bodyRotation.x, 1, 0, 0); glBegin(GL_TRIANGLE_FAN); @@ -391,8 +389,7 @@ void Head::renderMohawk() { } glm::quat Head::getOrientation() const { - return glm::quat(glm::radians(_bodyRotation)) * glm::quat(glm::radians(_lookingInMirror ? - glm::vec3(_pitch, -_yaw, -_roll) : glm::vec3(_pitch, _yaw, _roll))); + return glm::quat(glm::radians(_bodyRotation)) * glm::quat(glm::radians(glm::vec3(_pitch, _yaw, _roll))); } glm::quat Head::getCameraOrientation () const { diff --git a/interface/src/Head.h b/interface/src/Head.h index e8bcfb5277..2b1b7aabfb 100644 --- a/interface/src/Head.h +++ b/interface/src/Head.h @@ -35,7 +35,7 @@ public: void init(); void reset(); void simulate(float deltaTime, bool isMine); - void render(bool lookingInMirror, float alpha); + void render(float alpha); void renderMohawk(); void setScale (float scale ) { _scale = scale; } @@ -102,7 +102,6 @@ private: float _audioAttack; float _returnSpringScale; //strength of return springs glm::vec3 _bodyRotation; - bool _lookingInMirror; bool _renderLookatVectors; HairTuft _hairTuft[NUM_HAIR_TUFTS]; glm::vec3* _mohawkTriangleFan;