History

Made mirror view remain constant no matter what the avatar scale is set to.

barnold1953 committed 12 years ago

Commit 97c0a2f1 parent 21f03a41 file · +2 −32Browse files

Showing the changes to interface/src/Application.cpp (1 of 1 file). Show all

Unified · Split

interface/src/Application.cpp+2−32
@@ -553,9 +553,6 @@ void Application::paintGL() { · 552 unmodified lines
553553 PerformanceWarning warn(showWarnings, "Application::paintGL()");
554554
555555 glEnable(GL_LINE_SMOOTH);
556−
557− float pushback = 0.0f;
558− float pushbackFocalLength = 0.0f;
559556
560557 if (_myCamera.getMode() == CAMERA_MODE_FIRST_PERSON) {
561558 _myCamera.setTightness(0.0f); // In first person, camera follows (untweaked) head exactly without delay
@@ -571,52 +568,25 @@ void Application::paintGL() { · 9 unmodified lines
571568 _myCamera.setTightness(0.0f);
572569 glm::vec3 eyePosition = _myAvatar->getHead()->calculateAverageEyePosition();
573570 float headHeight = eyePosition.y - _myAvatar->getPosition().y;
574− _myCamera.setDistance(MIRROR_FULLSCREEN_DISTANCE * _myAvatar->getScale() * _scaleMirror);
571+ _myCamera.setDistance(MIRROR_FULLSCREEN_DISTANCE * _scaleMirror);
575572 _myCamera.setTargetPosition(_myAvatar->getPosition() + glm::vec3(0, headHeight + (_raiseMirror * _myAvatar->getScale()), 0));
576573 _myCamera.setTargetRotation(_myAvatar->getWorldAlignedOrientation() * glm::quat(glm::vec3(0.0f, PI + _rotateMirror, 0.0f)));
577−
578− // if the head would intersect the near clip plane, we must push the camera out
579− glm::vec3 relativePosition = glm::inverse(_myCamera.getTargetRotation()) *
580− (eyePosition - _myCamera.getTargetPosition());
581− const float BASE_PUSHBACK_RADIUS = 0.2f;
582− float pushbackRadius = _myCamera.getNearClip() + _myAvatar->getScale() * BASE_PUSHBACK_RADIUS;
583− pushback = relativePosition.z + pushbackRadius - _myCamera.getDistance();
584− pushbackFocalLength = _myCamera.getDistance();
585574 }
586575
587576 if (OculusManager::isConnected()) {
588− // OR in third person causes nausea, so only allow it if option is checked in dev menu
577+ // Oculus in third person causes nausea, so only allow it if option is checked in dev menu
589578 if (!Menu::getInstance()->isOptionChecked(MenuOption::AllowOculusCameraModeChange) || _myCamera.getMode() == CAMERA_MODE_FIRST_PERSON) {
590579 _myCamera.setDistance(0.0f);
591580 _myCamera.setTargetPosition(_myAvatar->getHead()->calculateAverageEyePosition());
592581 _myCamera.setTargetRotation(_myAvatar->getHead()->getCameraOrientation());
593− pushback = 0.0f;
594− pushbackFocalLength = 0.0f;
595582 }
596583 _myCamera.setUpShift(0.0f);
597584 _myCamera.setTightness(0.0f); // Camera is directly connected to head without smoothing
598585 }
599−
600− // handle pushback, if any
601− if (pushbackFocalLength > 0.0f) {
602− const float PUSHBACK_DECAY = 0.5f;
603− _cameraPushback = qMax(pushback, _cameraPushback * PUSHBACK_DECAY);
604− if (_cameraPushback > EPSILON) {
605− _myCamera.setTargetPosition(_myCamera.getTargetPosition() +
606− _myCamera.getTargetRotation() * glm::vec3(0.0f, 0.0f, _cameraPushback));
607− float enlargement = pushbackFocalLength / (pushbackFocalLength + _cameraPushback);
608− _myCamera.setFieldOfView(glm::degrees(2.0f * atanf(enlargement * tanf(
609− glm::radians(Menu::getInstance()->getFieldOfView() * 0.5f)))));
610− } else {
611− _myCamera.setFieldOfView(Menu::getInstance()->getFieldOfView());
612− }
613− updateProjectionMatrix(_myCamera, true);
614− }
615586
616587 // Update camera position
617588 _myCamera.update( 1.f/_fps );
618589
619−
620590 // Note: whichCamera is used to pick between the normal camera myCamera for our
621591 // main camera, vs, an alternate camera. The alternate camera we support right now
622592 // is the viewFrustumOffsetCamera. But theoretically, we could use this same mechanism

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t