mirror of
https://github.com/overte-org/overte.git
synced 2025-04-25 17:35:45 +02:00
Fix view frustum preference
This commit is contained in:
parent
60ebd3a544
commit
5e9425d9eb
3 changed files with 17 additions and 12 deletions
|
@ -1316,6 +1316,13 @@ void Application::faceTrackerMuteToggled() {
|
||||||
Menu::getInstance()->getActionForOption(MenuOption::CalibrateCamera)->setEnabled(!isMuted);
|
Menu::getInstance()->getActionForOption(MenuOption::CalibrateCamera)->setEnabled(!isMuted);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Application::setFieldOfView(float fov) {
|
||||||
|
if (fov != _fieldOfView.get()) {
|
||||||
|
_fieldOfView.set(fov);
|
||||||
|
resizeGL();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void Application::aboutApp() {
|
void Application::aboutApp() {
|
||||||
InfoView::show(INFO_HELP_PATH);
|
InfoView::show(INFO_HELP_PATH);
|
||||||
}
|
}
|
||||||
|
@ -1342,16 +1349,15 @@ void Application::resizeGL() {
|
||||||
if (_renderResolution != renderSize) {
|
if (_renderResolution != renderSize) {
|
||||||
_renderResolution = renderSize;
|
_renderResolution = renderSize;
|
||||||
DependencyManager::get<FramebufferCache>()->setFrameBufferSize(fromGlm(renderSize));
|
DependencyManager::get<FramebufferCache>()->setFrameBufferSize(fromGlm(renderSize));
|
||||||
|
|
||||||
// Possible change in aspect ratio
|
|
||||||
loadViewFrustum(_myCamera, _viewFrustum);
|
|
||||||
float fov = glm::radians(DEFAULT_FIELD_OF_VIEW_DEGREES);
|
|
||||||
// FIXME the aspect ratio for stereo displays is incorrect based on this.
|
|
||||||
float aspectRatio = displayPlugin->getRecommendedAspectRatio();
|
|
||||||
_myCamera.setProjection(glm::perspective(fov, aspectRatio, DEFAULT_NEAR_CLIP, DEFAULT_FAR_CLIP));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// FIXME the aspect ratio for stereo displays is incorrect based on this.
|
||||||
|
float aspectRatio = displayPlugin->getRecommendedAspectRatio();
|
||||||
|
_myCamera.setProjection(glm::perspective(glm::radians(_fieldOfView.get()), aspectRatio,
|
||||||
|
DEFAULT_NEAR_CLIP, DEFAULT_FAR_CLIP));
|
||||||
|
// Possible change in aspect ratio
|
||||||
|
loadViewFrustum(_myCamera, _viewFrustum);
|
||||||
|
|
||||||
auto offscreenUi = DependencyManager::get<OffscreenUi>();
|
auto offscreenUi = DependencyManager::get<OffscreenUi>();
|
||||||
auto uiSize = displayPlugin->getRecommendedUiSize();
|
auto uiSize = displayPlugin->getRecommendedUiSize();
|
||||||
// Bit of a hack since there's no device pixel ratio change event I can find.
|
// Bit of a hack since there's no device pixel ratio change event I can find.
|
||||||
|
|
|
@ -159,7 +159,7 @@ public:
|
||||||
float getFps() const { return _fps; }
|
float getFps() const { return _fps; }
|
||||||
|
|
||||||
float getFieldOfView() { return _fieldOfView.get(); }
|
float getFieldOfView() { return _fieldOfView.get(); }
|
||||||
void setFieldOfView(float fov) { _fieldOfView.set(fov); }
|
void setFieldOfView(float fov);
|
||||||
|
|
||||||
NodeToOctreeSceneStats* getOcteeSceneStats() { return &_octreeServerSceneStats; }
|
NodeToOctreeSceneStats* getOcteeSceneStats() { return &_octreeServerSceneStats; }
|
||||||
|
|
||||||
|
|
|
@ -428,8 +428,7 @@ void MyAvatar::updateFromTrackers(float deltaTime) {
|
||||||
head->setDeltaYaw(estimatedRotation.y);
|
head->setDeltaYaw(estimatedRotation.y);
|
||||||
head->setDeltaRoll(estimatedRotation.z);
|
head->setDeltaRoll(estimatedRotation.z);
|
||||||
} else {
|
} else {
|
||||||
float magnifyFieldOfView = qApp->getFieldOfView() /
|
float magnifyFieldOfView = qApp->getViewFrustum()->getFieldOfView() / _realWorldFieldOfView.get();
|
||||||
_realWorldFieldOfView.get();
|
|
||||||
head->setDeltaPitch(estimatedRotation.x * magnifyFieldOfView);
|
head->setDeltaPitch(estimatedRotation.x * magnifyFieldOfView);
|
||||||
head->setDeltaYaw(estimatedRotation.y * magnifyFieldOfView);
|
head->setDeltaYaw(estimatedRotation.y * magnifyFieldOfView);
|
||||||
head->setDeltaRoll(estimatedRotation.z);
|
head->setDeltaRoll(estimatedRotation.z);
|
||||||
|
|
Loading…
Reference in a new issue