mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 13:09:52 +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
|
@ -1269,7 +1269,7 @@ void Application::resizeGL() {
|
||||||
loadViewFrustum(_myCamera, _viewFrustum);
|
loadViewFrustum(_myCamera, _viewFrustum);
|
||||||
float fov = glm::radians(DEFAULT_FIELD_OF_VIEW_DEGREES);
|
float fov = glm::radians(DEFAULT_FIELD_OF_VIEW_DEGREES);
|
||||||
// FIXME the aspect ratio for stereo displays is incorrect based on this.
|
// 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));
|
_myCamera.setProjection(glm::perspective(fov, aspectRatio, DEFAULT_NEAR_CLIP, DEFAULT_FAR_CLIP));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -8,12 +8,12 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "plugins/Plugin.h"
|
#include "plugins/Plugin.h"
|
||||||
|
|
||||||
#include <QSize>
|
#include <QSize>
|
||||||
#include <QPoint>
|
#include <QPoint>
|
||||||
#include <functional>
|
#include <functional>
|
||||||
|
|
||||||
#include "gpu/GPUConfig.h"
|
#include "gpu/GPUConfig.h"
|
||||||
|
#include "GLMHelpers.h"
|
||||||
|
|
||||||
#include <glm/glm.hpp>
|
#include <glm/glm.hpp>
|
||||||
#include <glm/gtc/quaternion.hpp>
|
#include <glm/gtc/quaternion.hpp>
|
||||||
|
@ -92,6 +92,11 @@ public:
|
||||||
return getRecommendedRenderSize();
|
return getRecommendedRenderSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// By default the aspect ratio is just the render size
|
||||||
|
virtual float getRecommendedAspectRatio() const {
|
||||||
|
return aspect(getRecommendedRenderSize());
|
||||||
|
}
|
||||||
|
|
||||||
// Stereo specific methods
|
// Stereo specific methods
|
||||||
virtual glm::mat4 getProjection(Eye eye, const glm::mat4& baseProjection) const {
|
virtual glm::mat4 getProjection(Eye eye, const glm::mat4& baseProjection) const {
|
||||||
return baseProjection;
|
return baseProjection;
|
||||||
|
|
|
@ -91,3 +91,9 @@ void StereoDisplayPlugin::deactivate() {
|
||||||
CONTAINER->unsetFullscreen();
|
CONTAINER->unsetFullscreen();
|
||||||
WindowOpenGLDisplayPlugin::deactivate();
|
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 activate() override;
|
||||||
virtual void deactivate() 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 getProjection(Eye eye, const glm::mat4& baseProjection) const override;
|
||||||
virtual glm::mat4 getEyePose(Eye eye) const override;
|
virtual glm::mat4 getEyePose(Eye eye) const override;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue