History

Proper mirror and third person mode in Oculus

barnold1953 committed 12 years ago

Commit d109ef61 parent 508fed95 files · +74 −49Browse files

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

Unified · Split

interface/src/Application.cpp+8−14
@@ -582,8 +582,8 @@ void Application::paintGL() { · 581 unmodified lines
582 582
583 } else if (_myCamera.getMode() == CAMERA_MODE_THIRD_PERSON) {583 } else if (_myCamera.getMode() == CAMERA_MODE_THIRD_PERSON) {
584 _myCamera.setTightness(0.0f); // Camera is directly connected to head without smoothing584 _myCamera.setTightness(0.0f); // Camera is directly connected to head without smoothing
585 _myCamera.setTargetPosition(_myAvatar->getUprightHeadPosition());585 _myCamera.setTargetPosition(_myAvatar->getHead()->calculateAverageEyePosition());
586 _myCamera.setTargetRotation(_myAvatar->getHead()->getCameraOrientation());586 _myCamera.setTargetRotation(_myAvatar->getWorldAlignedOrientation());
587 587
588 } else if (_myCamera.getMode() == CAMERA_MODE_MIRROR) {588 } else if (_myCamera.getMode() == CAMERA_MODE_MIRROR) {
589 _myCamera.setTightness(0.0f);589 _myCamera.setTightness(0.0f);
@@ -594,17 +594,6 @@ void Application::paintGL() { · 4 unmodified lines
594 _myCamera.setTargetRotation(_myAvatar->getWorldAlignedOrientation() * glm::quat(glm::vec3(0.0f, PI + _rotateMirror, 0.0f)));594 _myCamera.setTargetRotation(_myAvatar->getWorldAlignedOrientation() * glm::quat(glm::vec3(0.0f, PI + _rotateMirror, 0.0f)));
595 }595 }
596 596
597 if (OculusManager::isConnected()) {
598 // Oculus in third person causes nausea, so only allow it if option is checked in dev menu
599 if (!Menu::getInstance()->isOptionChecked(MenuOption::AllowOculusCameraModeChange) || _myCamera.getMode() == CAMERA_MODE_FIRST_PERSON) {
600 _myCamera.setDistance(0.0f);
601 _myCamera.setTargetPosition(_myAvatar->getHead()->calculateAverageEyePosition());
602 _myCamera.setTargetRotation(_myAvatar->getHead()->getCameraOrientation());
603 }
604 _myCamera.setUpShift(0.0f);
605 _myCamera.setTightness(0.0f); // Camera is directly connected to head without smoothing
606 }
607
608 // Update camera position597 // Update camera position
609 _myCamera.update( 1.f/_fps );598 _myCamera.update( 1.f/_fps );
610 599
@@ -638,7 +627,12 @@ void Application::paintGL() { · 27 unmodified lines
638 }627 }
639 628
640 if (OculusManager::isConnected()) {629 if (OculusManager::isConnected()) {
641 OculusManager::display(_myAvatar->getOrientation(), whichCamera);630 //When in mirror mode, use camera rotation. Otherwise, use body rotation
631 if (whichCamera.getMode() == CAMERA_MODE_MIRROR) {
632 OculusManager::display(whichCamera.getRotation(), whichCamera.getPosition(), whichCamera);
633 } else {
634 OculusManager::display(_myAvatar->getWorldAlignedOrientation(), whichCamera.getPosition(), whichCamera);
635 }
642 636
643 } else if (TV3DManager::isConnected()) {637 } else if (TV3DManager::isConnected()) {
644 _glowEffect.prepare();638 _glowEffect.prepare();

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