mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-05-12 22:39:09 -05:00
Put some stricter limitations on the FOV settings in the Configuration generator (#2156)
This commit is contained in:
@@ -63,6 +63,7 @@ namespace {
|
||||
constexpr float DefaultFovV = 50.534f;
|
||||
constexpr float DefaultHeightOffset = 0.f;
|
||||
constexpr int MaxWindowSizePixels = 10000;
|
||||
constexpr double FovEpsilon = 0.00001;
|
||||
|
||||
QList<QString> monitorNames(const std::vector<QRect>& resolutions) {
|
||||
QList<QString> monitorNames;
|
||||
@@ -355,8 +356,8 @@ QWidget* WindowControl::createPlanarWidget() {
|
||||
layout->addWidget(fovH, 1, 0);
|
||||
|
||||
_planar.fovH = new QDoubleSpinBox;
|
||||
_planar.fovH->setMinimum(0.0);
|
||||
_planar.fovH->setMaximum(179.0);
|
||||
_planar.fovH->setMinimum(FovEpsilon);
|
||||
_planar.fovH->setMaximum(180.0 - FovEpsilon);
|
||||
_planar.fovH->setValue(DefaultFovH);
|
||||
_planar.fovH->setEnabled(false);
|
||||
_planar.fovH->setToolTip(hfovTip);
|
||||
@@ -373,8 +374,8 @@ QWidget* WindowControl::createPlanarWidget() {
|
||||
layout->addWidget(fovV, 2, 0);
|
||||
|
||||
_planar.fovV = new QDoubleSpinBox;
|
||||
_planar.fovV->setMinimum(0.0);
|
||||
_planar.fovV->setMaximum(179.0);
|
||||
_planar.fovV->setMinimum(FovEpsilon);
|
||||
_planar.fovV->setMaximum(180.0 - FovEpsilon);
|
||||
_planar.fovV->setValue(DefaultFovV);
|
||||
_planar.fovV->setEnabled(false);
|
||||
_planar.fovV->setToolTip(vfovTip);
|
||||
@@ -685,11 +686,17 @@ sgct::config::Projections WindowControl::generateProjectionInformation() const {
|
||||
}
|
||||
case ProjectionIndices::Planar:
|
||||
{
|
||||
double fovH = _planar.fovH->text().toFloat();
|
||||
fovH = std::clamp(fovH, FovEpsilon, 180.0 - FovEpsilon);
|
||||
|
||||
double fovV = _planar.fovV->text().toFloat();
|
||||
fovV = std::clamp(fovV, FovEpsilon, 180.0 - FovEpsilon);
|
||||
|
||||
// The negative values for left & down are due to SGCT's convention
|
||||
PlanarProjection projection;
|
||||
projection.fov.right = _planar.fovH->text().toFloat() / 2.0;
|
||||
projection.fov.right = fovH / 2.0;
|
||||
projection.fov.left = -projection.fov.right;
|
||||
projection.fov.up = _planar.fovV->text().toFloat() / 2.0;
|
||||
projection.fov.up = fovV / 2.0;
|
||||
projection.fov.down = -projection.fov.up;
|
||||
return projection;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user