History

Working on pushing the mirror camera back to prevent intersecting the near clip plane. Closes #2617.

Andrzej Kapolka committed 12 years ago

Commit 57765141 parent 8e097be1 file · +10 −0Browse files

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

Unified · Split

interface/src/Application.cpp+10−0
@@ -528,6 +528,16 @@ void Application::paintGL() { · 527 unmodified lines
528 _myCamera.setDistance(MIRROR_FULLSCREEN_DISTANCE * _myAvatar->getScale());528 _myCamera.setDistance(MIRROR_FULLSCREEN_DISTANCE * _myAvatar->getScale());
529 _myCamera.setTargetPosition(_myAvatar->getPosition() + glm::vec3(0, headHeight, 0));529 _myCamera.setTargetPosition(_myAvatar->getPosition() + glm::vec3(0, headHeight, 0));
530 _myCamera.setTargetRotation(_myAvatar->getWorldAlignedOrientation() * glm::quat(glm::vec3(0.0f, PI, 0.0f)));530 _myCamera.setTargetRotation(_myAvatar->getWorldAlignedOrientation() * glm::quat(glm::vec3(0.0f, PI, 0.0f)));
531
532 // if the head would intersect the near clip plane, we must push the camera out
533 glm::vec3 relativePosition = glm::inverse(_myCamera.getTargetRotation()) *
534 (_myAvatar->getHead()->getPosition() - _myCamera.getTargetPosition());
535 const float HEAD_RADIUS = 0.1f;
536 float pushback = relativePosition.z + _myCamera.getNearClip() + HEAD_RADIUS;
537 if (pushback > 0.0f) {
538 _myCamera.setTargetPosition(_myCamera.getTargetPosition() +
539 _myCamera.getTargetRotation() * glm::vec3(0.0f, 0.0f, pushback));
540 }
531 }541 }
532 542
533 // Update camera position543 // Update camera position

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