mirror of
https://github.com/overte-org/overte.git
synced 2025-04-22 03:24:13 +02:00
Fixing aspect ratio on stereo plugins
This commit is contained in:
parent
08ee5cbc17
commit
f176003dad
4 changed files with 14 additions and 2 deletions
interface/src
libraries/display-plugins/src/display-plugins
|
@ -1269,7 +1269,7 @@ void Application::resizeGL() {
|
|||
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 = aspect(_renderResolution);
|
||||
float aspectRatio = displayPlugin->getRecommendedAspectRatio();
|
||||
_myCamera.setProjection(glm::perspective(fov, aspectRatio, DEFAULT_NEAR_CLIP, DEFAULT_FAR_CLIP));
|
||||
}
|
||||
|
||||
|
|
|
@ -8,12 +8,12 @@
|
|||
#pragma once
|
||||
|
||||
#include "plugins/Plugin.h"
|
||||
|
||||
#include <QSize>
|
||||
#include <QPoint>
|
||||
#include <functional>
|
||||
|
||||
#include "gpu/GPUConfig.h"
|
||||
#include "GLMHelpers.h"
|
||||
|
||||
#include <glm/glm.hpp>
|
||||
#include <glm/gtc/quaternion.hpp>
|
||||
|
@ -92,6 +92,11 @@ public:
|
|||
return getRecommendedRenderSize();
|
||||
}
|
||||
|
||||
// By default the aspect ratio is just the render size
|
||||
virtual float getRecommendedAspectRatio() const {
|
||||
return aspect(getRecommendedRenderSize());
|
||||
}
|
||||
|
||||
// Stereo specific methods
|
||||
virtual glm::mat4 getProjection(Eye eye, const glm::mat4& baseProjection) const {
|
||||
return baseProjection;
|
||||
|
|
|
@ -91,3 +91,9 @@ void StereoDisplayPlugin::deactivate() {
|
|||
CONTAINER->unsetFullscreen();
|
||||
WindowOpenGLDisplayPlugin::deactivate();
|
||||
}
|
||||
|
||||
// Derived classes will override the recommended render size based on the window size,
|
||||
// so here we want to fix the aspect ratio based on the window, not on the render size
|
||||
float StereoDisplayPlugin::getRecommendedAspectRatio() const {
|
||||
return aspect(WindowOpenGLDisplayPlugin::getRecommendedRenderSize());
|
||||
}
|
||||
|
|
|
@ -19,6 +19,7 @@ public:
|
|||
virtual void activate() override;
|
||||
virtual void deactivate() override;
|
||||
|
||||
virtual float getRecommendedAspectRatio() const override;
|
||||
virtual glm::mat4 getProjection(Eye eye, const glm::mat4& baseProjection) const override;
|
||||
virtual glm::mat4 getEyePose(Eye eye) const override;
|
||||
|
||||
|
|
Loading…
Reference in a new issue