Showing the changes to interface/src/ui/ApplicationOverlay.cpp (1 of 1 file). Show all
Unified · Split
| @@ -29,6 +29,7 @@ const quint64 MSECS_TO_USECS = 1000ULL; · 28 unmodified lines | |||
| 29 | 29 | ||
| 30 | const float WHITE_TEXT[] = { 0.93f, 0.93f, 0.93f }; | 30 | const float WHITE_TEXT[] = { 0.93f, 0.93f, 0.93f }; |
| 31 | const float RETICLE_COLOR[] = { 0.0f, 198.0f / 255.0f, 244.0f / 255.0f }; | 31 | const float RETICLE_COLOR[] = { 0.0f, 198.0f / 255.0f, 244.0f / 255.0f }; |
| 32 | const float reticleSize = TWO_PI / 100.0f; | ||
| 32 | 33 | ||
| 33 | 34 | ||
| 34 | const float CONNECTION_STATUS_BORDER_COLOR[] = { 1.0f, 0.0f, 0.0f }; | 35 | const float CONNECTION_STATUS_BORDER_COLOR[] = { 1.0f, 0.0f, 0.0f }; |
| @@ -103,8 +104,6 @@ bool raySphereIntersect(const glm::vec3 &dir, const glm::vec3 &origin, float r, · 68 unmodified lines | |||
| 103 | } | 104 | } |
| 104 | 105 | ||
| 105 | void renderReticule(glm::quat orientation, float alpha) { | 106 | void renderReticule(glm::quat orientation, float alpha) { |
| 106 | const float reticleSize = TWO_PI / 80.0f; | ||
| 107 | |||
| 108 | glm::vec3 topLeft = getPoint(reticleSize / 2.0f, -reticleSize / 2.0f); | 107 | glm::vec3 topLeft = getPoint(reticleSize / 2.0f, -reticleSize / 2.0f); |
| 109 | glm::vec3 topRight = getPoint(-reticleSize / 2.0f, -reticleSize / 2.0f); | 108 | glm::vec3 topRight = getPoint(-reticleSize / 2.0f, -reticleSize / 2.0f); |
| 110 | glm::vec3 bottomLeft = getPoint(reticleSize / 2.0f, reticleSize / 2.0f); | 109 | glm::vec3 bottomLeft = getPoint(reticleSize / 2.0f, reticleSize / 2.0f); |
| @@ -523,7 +522,7 @@ void ApplicationOverlay::renderPointers() { · 412 unmodified lines | |||
| 523 | //If we are in oculus, render reticle later | 522 | //If we are in oculus, render reticle later |
| 524 | _reticleActive[MOUSE] = true; | 523 | _reticleActive[MOUSE] = true; |
| 525 | _magActive[MOUSE] = true; | 524 | _magActive[MOUSE] = true; |
| 526 | _reticulePosition[MOUSE] = glm::vec2(application->getTrueMouseX(), application->getTrueMouseY()); | 525 | _reticulePosition[MOUSE] = glm::vec2(application->getMouseX(), application->getMouseY()); |
| 527 | _reticleActive[LEFT_CONTROLLER] = false; | 526 | _reticleActive[LEFT_CONTROLLER] = false; |
| 528 | _reticleActive[RIGHT_CONTROLLER] = false; | 527 | _reticleActive[RIGHT_CONTROLLER] = false; |
| 529 | 528 | ||
| @@ -658,70 +657,17 @@ void ApplicationOverlay::renderPointersOculus(const glm::vec3& eyePos) { · 128 unmodified lines | |||
| 658 | MyAvatar* myAvatar = Application::getInstance()->getAvatar(); | 657 | MyAvatar* myAvatar = Application::getInstance()->getAvatar(); |
| 659 | for (int i = 0; i < (int)myAvatar->getHand()->getNumPalms(); i++) { | 658 | for (int i = 0; i < (int)myAvatar->getHand()->getNumPalms(); i++) { |
| 660 | 659 | ||
| 661 | // PalmData& palm = myAvatar->getHand()->getPalms()[i]; | 660 | PalmData& palm = myAvatar->getHand()->getPalms()[i]; |
| 662 | // if (palm.isActive()) { | 661 | if (palm.isActive()) { |
| 663 | // glm::vec3 tip = myAvatar->getLaserPointerTipPosition(&palm); | 662 | glm::vec3 tip = myAvatar->getLaserPointerTipPosition(&palm); |
| 664 | // glm::vec3 tipPos = (tip - eyePos); | 663 | glm::vec3 tipDirection = glm::normalize(glm::inverse(myAvatar->getOrientation()) * (tip - eyePos)); |
| 665 | // | 664 | float pitch = -glm::asin(tipDirection.y); |
| 666 | // float length = glm::length(eyePos - tip); | 665 | float yawSign = glm::sign(-tipDirection.x); |
| 667 | // float size = 0.03f * length; | 666 | float yaw = glm::acos(-tipDirection.z) * |
| 668 | // | 667 | ((yawSign == 0.0f) ? 1.0f : yawSign); |
| 669 | // glm::vec3 up = glm::vec3(0.0, 1.0, 0.0) * size; | 668 | glm::quat orientation = glm::quat(glm::vec3(pitch, yaw, 0.0f)); |
| 670 | // glm::vec3 right = glm::vec3(1.0, 0.0, 0.0) * size; | 669 | renderReticule(orientation, _alpha); |
| 671 | // | 670 | } |
| 672 | // cursorVerts[0] = -right + up; | ||
| 673 | // cursorVerts[1] = right + up; | ||
| 674 | // cursorVerts[2] = right - up; | ||
| 675 | // cursorVerts[3] = -right - up; | ||
| 676 | // | ||
| 677 | // glPushMatrix(); | ||
| 678 | // | ||
| 679 | // // objToCamProj is the vector in world coordinates from the | ||
| 680 | // // local origin to the camera projected in the XZ plane | ||
| 681 | // glm::vec3 cursorToCameraXZ(-tipPos.x, 0, -tipPos.z); | ||
| 682 | // cursorToCameraXZ = glm::normalize(cursorToCameraXZ); | ||
| 683 | // | ||
| 684 | // //Translate the cursor to the tip of the oculus ray | ||
| 685 | // glTranslatef(tip.x, tip.y, tip.z); | ||
| 686 | // | ||
| 687 | // glm::vec3 direction(0, 0, 1); | ||
| 688 | // // easy fix to determine wether the angle is negative or positive | ||
| 689 | // // for positive angles upAux will be a vector pointing in the | ||
| 690 | // // positive y direction, otherwise upAux will point downwards | ||
| 691 | // // effectively reversing the rotation. | ||
| 692 | // glm::vec3 upAux = glm::cross(direction, cursorToCameraXZ); | ||
| 693 | // | ||
| 694 | // // compute the angle | ||
| 695 | // float angleCosine = glm::dot(direction, cursorToCameraXZ); | ||
| 696 | // | ||
| 697 | // //Rotate in XZ direction | ||
| 698 | // glRotatef(acos(angleCosine) * DEGREES_PER_RADIAN, upAux[0], upAux[1], upAux[2]); | ||
| 699 | // | ||
| 700 | // glm::vec3 cursorToCamera = glm::normalize(-tipPos); | ||
| 701 | // | ||
| 702 | // // Compute the angle between cursorToCameraXZ and cursorToCamera, | ||
| 703 | // angleCosine = glm::dot(cursorToCameraXZ, cursorToCamera); | ||
| 704 | // | ||
| 705 | // //Rotate in Y direction | ||
| 706 | // if (cursorToCamera.y < 0) { | ||
| 707 | // glRotatef(acos(angleCosine) * DEGREES_PER_RADIAN, 1, 0, 0); | ||
| 708 | // } else { | ||
| 709 | // glRotatef(acos(angleCosine) * DEGREES_PER_RADIAN, -1, 0, 0); | ||
| 710 | // } | ||
| 711 | // | ||
| 712 | // glBegin(GL_QUADS); | ||
| 713 | // | ||
| 714 | // glColor4f(RETICLE_COLOR[0], RETICLE_COLOR[1], RETICLE_COLOR[2], _alpha); | ||
| 715 | // | ||
| 716 | // glTexCoord2f(0.0f, 0.0f); glVertex3f(cursorVerts[0].x, cursorVerts[0].y, cursorVerts[0].z); | ||
| 717 | // glTexCoord2f(1.0f, 0.0f); glVertex3f(cursorVerts[1].x, cursorVerts[1].y, cursorVerts[1].z); | ||
| 718 | // glTexCoord2f(1.0f, 1.0f); glVertex3f(cursorVerts[2].x, cursorVerts[2].y, cursorVerts[2].z); | ||
| 719 | // glTexCoord2f(0.0f, 1.0f); glVertex3f(cursorVerts[3].x, cursorVerts[3].y, cursorVerts[3].z); | ||
| 720 | // | ||
| 721 | // glEnd(); | ||
| 722 | // | ||
| 723 | // glPopMatrix(); | ||
| 724 | // } | ||
| 725 | } | 671 | } |
| 726 | 672 | ||
| 727 | //Mouse Pointer | 673 | //Mouse Pointer |
| @@ -791,8 +737,6 @@ void ApplicationOverlay::renderMagnifier(glm::vec2 magPos, float sizeMult, bool · 63 unmodified lines | |||
| 791 | } glPopMatrix(); | 737 | } glPopMatrix(); |
| 792 | } | 738 | } |
| 793 | 739 | ||
| 794 | |||
| 795 | |||
| 796 | void ApplicationOverlay::renderAudioMeter() { | 740 | void ApplicationOverlay::renderAudioMeter() { |
| 797 | 741 | ||
| 798 | Application* application = Application::getInstance(); | 742 | Application* application = Application::getInstance(); |
| @@ -990,8 +934,6 @@ void ApplicationOverlay::renderDomainConnectionStatusBorder() { · 191 unmodified lines | |||
| 990 | } | 934 | } |
| 991 | } | 935 | } |
| 992 | 936 | ||
| 993 | |||
| 994 | |||
| 995 | ApplicationOverlay::TexturedHemisphere::TexturedHemisphere() : | 937 | ApplicationOverlay::TexturedHemisphere::TexturedHemisphere() : |
| 996 | _vertices(0), | 938 | _vertices(0), |
| 997 | _indices(0), | 939 | _indices(0), |