From 7b877b84f2f2972fd7b25145cd51822c10f2faf3 Mon Sep 17 00:00:00 2001 From: Samuli Vuorinen Date: Sat, 1 May 2021 17:04:39 +0300 Subject: [PATCH 1/6] Improve spinbox behaviour Now typing values into spinboxes only takes an effect after pressing enter or changing focus to another widget. Updating the value on every keypress also updates the formatting of the spinbox so that typing in decimal numbers is difficult. Usually there's also no reason to update the view on every keypress. --- CHANGELOG.md | 41 ++++++++++++++----- .../gui/components/sliderSpinBox.cpp | 1 + .../gui/crystalSettingsWidget.cpp | 2 + .../gui/generalSettingsWidget.cpp | 3 ++ 4 files changed, 37 insertions(+), 10 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4d07576..ea09a16 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,7 +3,19 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), -and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +and this project adheres to +[Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## Unreleased + +### Changed + +- When typing values into spinboxes, the change only takes effect after pressing + enter or moving focus elsewhere. + +### Fixed + +- Fixed bug where typing decimals into spinboxes wasn't working. ## 3.2.0 - 2021-03-24 @@ -13,20 +25,23 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed -- Fixed bug where pyramid apex angle was set incorrectly based on crystal edge angle rather than face angle +- Fixed bug where pyramid apex angle was set incorrectly based on crystal edge + angle rather than face angle ## 3.1.0 - 2021-02-21 ### Changed - Improved logging and error messages in case shader compilation fails -- Population weight was changed from an integer to a decimal number for more granular control +- Population weight was changed from an integer to a decimal number for more + granular control ## 3.0.0 - 2021-02-21 ### Added -- Created a realistic sky and sun model based on Hosek-Wilkie and Preetham papers +- Created a realistic sky and sun model based on Hosek-Wilkie and Preetham + papers - Simulation rate shown in status bar - Ice crystals now have adjustable pyramidal caps - Possibility to save and load simulations @@ -37,13 +52,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed -- Forced application to use native desktop OpenGL instead of ANGLE or software renderer +- Forced application to use native desktop OpenGL instead of ANGLE or software + renderer - Build system switched to qmake from CMake - Rewrote most of the GUI code to use Qt model/view architecture - Triangle normals are now cached during raytracing - The settings groups in the side panel are now collapsible - Adjusting sliders with arrow kys now uses smaller steps -- Light is now allowed to bounce inside ice crystal for a 100 times instead of 10 +- Light is now allowed to bounce inside ice crystal for a 100 times instead + of 10 ### Fixed @@ -88,14 +105,16 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed -- Disabled "Remove population" button when there is only one population in simulation +- Disabled "Remove population" button when there is only one population in + simulation - Added multiple crystal populations by default ## 2.1.1 - 2019-07-08 ### Fixed -- Fixed bug where removing the only crystal population caused the UI controls not to work anymore +- Fixed bug where removing the only crystal population caused the UI controls + not to work anymore ## 2.1.0 - 2019-07-07 @@ -108,11 +127,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Made sidebar scrollable when the window is small enough - Made UI show field of view in degrees -- Limited field of view for stereographic, rectilinear and orthographic projections +- Limited field of view for stereographic, rectilinear and orthographic + projections ### Fixed -- Fixed bug where field of view sometimes did not update correctly when choosing a new projection +- Fixed bug where field of view sometimes did not update correctly when choosing + a new projection ## 2.0.0 - 2019-07-02 diff --git a/src/haloray-core/gui/components/sliderSpinBox.cpp b/src/haloray-core/gui/components/sliderSpinBox.cpp index 81f5a62..35a731e 100644 --- a/src/haloray-core/gui/components/sliderSpinBox.cpp +++ b/src/haloray-core/gui/components/sliderSpinBox.cpp @@ -17,6 +17,7 @@ SliderSpinBox::SliderSpinBox(QWidget *parent) : QWidget(parent), m_value(0.0) m_spinBox = new QDoubleSpinBox(); m_spinBox->setSingleStep(0.1); + m_spinBox->setKeyboardTracking(false); auto layout = new QHBoxLayout(this); layout->addWidget(m_slider); diff --git a/src/haloray-core/gui/crystalSettingsWidget.cpp b/src/haloray-core/gui/crystalSettingsWidget.cpp index c86d5e0..953ff5b 100644 --- a/src/haloray-core/gui/crystalSettingsWidget.cpp +++ b/src/haloray-core/gui/crystalSettingsWidget.cpp @@ -185,6 +185,7 @@ void CrystalSettingsWidget::setupUi() m_upperApexAngleSpinBox->setMinimum(0.0); m_upperApexAngleSpinBox->setMaximum(180.0); m_upperApexAngleSpinBox->setSuffix("°"); + m_upperApexAngleSpinBox->setKeyboardTracking(false); m_upperApexHeightAverageSlider = new SliderSpinBox(0.0, 1.0); @@ -194,6 +195,7 @@ void CrystalSettingsWidget::setupUi() m_lowerApexAngleSpinBox->setMinimum(0.0); m_lowerApexAngleSpinBox->setMaximum(180.0); m_lowerApexAngleSpinBox->setSuffix("°"); + m_lowerApexAngleSpinBox->setKeyboardTracking(false); m_lowerApexHeightAverageSlider = new SliderSpinBox(0.0, 1.0); diff --git a/src/haloray-core/gui/generalSettingsWidget.cpp b/src/haloray-core/gui/generalSettingsWidget.cpp index dc87e30..cb0da73 100644 --- a/src/haloray-core/gui/generalSettingsWidget.cpp +++ b/src/haloray-core/gui/generalSettingsWidget.cpp @@ -48,18 +48,21 @@ void GeneralSettingsWidget::setupUi() m_sunDiameterSpinBox->setSingleStep(0.1); m_sunDiameterSpinBox->setMinimum(0.01); m_sunDiameterSpinBox->setMaximum(30.0); + m_sunDiameterSpinBox->setKeyboardTracking(false); m_raysPerFrameSpinBox = new QSpinBox(); m_raysPerFrameSpinBox->setSingleStep(1000); m_raysPerFrameSpinBox->setMinimum(1); m_raysPerFrameSpinBox->setMaximum(m_viewModel->getRaysPerFrameUpperLimit()); m_raysPerFrameSpinBox->setGroupSeparatorShown(true); + m_raysPerFrameSpinBox->setKeyboardTracking(false); m_maximumFramesSpinBox = new QSpinBox(); m_maximumFramesSpinBox->setSingleStep(60); m_maximumFramesSpinBox->setMinimum(1); m_maximumFramesSpinBox->setMaximum(1000000000); m_maximumFramesSpinBox->setGroupSeparatorShown(true); + m_maximumFramesSpinBox->setKeyboardTracking(false); m_multipleScatteringSlider = new SliderSpinBox(); m_multipleScatteringSlider->setMinimum(0.0); From c64f330c74bbf411b3a1c48903701d1c65f0706c Mon Sep 17 00:00:00 2001 From: Samuli Vuorinen Date: Sun, 2 May 2021 22:00:06 +0300 Subject: [PATCH 2/6] Increase maximum value of brightness slider --- CHANGELOG.md | 3 ++- src/haloray-core/gui/viewSettingsWidget.cpp | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ea09a16..8b08940 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,10 +12,11 @@ and this project adheres to - When typing values into spinboxes, the change only takes effect after pressing enter or moving focus elsewhere. +- Increased maximum value of image brightness slider ### Fixed -- Fixed bug where typing decimals into spinboxes wasn't working. +- Fixed bug where typing decimals into spinboxes wasn't working ## 3.2.0 - 2021-03-24 diff --git a/src/haloray-core/gui/viewSettingsWidget.cpp b/src/haloray-core/gui/viewSettingsWidget.cpp index e04b746..29d72bb 100644 --- a/src/haloray-core/gui/viewSettingsWidget.cpp +++ b/src/haloray-core/gui/viewSettingsWidget.cpp @@ -66,7 +66,7 @@ void ViewSettingsWidget::setupUi() m_brightnessSlider = new SliderSpinBox(); m_brightnessSlider->setMinimum(0.1); - m_brightnessSlider->setMaximum(15.0); + m_brightnessSlider->setMaximum(30.0); m_hideSubHorizonCheckBox = new QCheckBox(); From cc8b28d444828f61f08cf39e7f3a525f8033c1b3 Mon Sep 17 00:00:00 2001 From: Samuli Vuorinen Date: Sun, 2 May 2021 22:10:02 +0300 Subject: [PATCH 3/6] Fixed bug where sky was shown twice with extra large FOV The sky was being rendered a second time when FOV was over 360 degrees. --- CHANGELOG.md | 2 ++ src/haloray-core/resources/shaders/sky.glsl | 2 ++ 2 files changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8b08940..0ed481b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,8 @@ and this project adheres to ### Fixed - Fixed bug where typing decimals into spinboxes wasn't working +- Fixed bug where sky was shown a second time outside field of view with + equidistant and equal area camera projections ## 3.2.0 - 2021-03-24 diff --git a/src/haloray-core/resources/shaders/sky.glsl b/src/haloray-core/resources/shaders/sky.glsl index 980af45..fa0c7d4 100644 --- a/src/haloray-core/resources/shaders/sky.glsl +++ b/src/haloray-core/resources/shaders/sky.glsl @@ -286,6 +286,8 @@ void main(void) projectedAngle = asin(polar.x / camera.focalLength); } + if (projectedAngle > PI) return; + float x = sin(projectedAngle) * cos(polar.y); float y = sin(projectedAngle) * sin(polar.y); float z = -cos(projectedAngle); From 21e3ae7fe2f4a583d3cac98f364241d2cafcfa6f Mon Sep 17 00:00:00 2001 From: Samuli Vuorinen Date: Fri, 7 May 2021 21:43:35 +0300 Subject: [PATCH 4/6] Add prism face distances to save files When adjustable prism face distances were added to the UI and data model, they weren't added to saving and loading files due to human error. --- CHANGELOG.md | 1 + src/haloray-core/gui/stateSaver.cpp | 30 ++++++++++++++++++++++------- 2 files changed, 24 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0ed481b..5092c2c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,6 +19,7 @@ and this project adheres to - Fixed bug where typing decimals into spinboxes wasn't working - Fixed bug where sky was shown a second time outside field of view with equidistant and equal area camera projections +- Fixed missing prism face distances from save files ## 3.2.0 - 2021-03-24 diff --git a/src/haloray-core/gui/stateSaver.cpp b/src/haloray-core/gui/stateSaver.cpp index 568b2fc..45a6001 100644 --- a/src/haloray-core/gui/stateSaver.cpp +++ b/src/haloray-core/gui/stateSaver.cpp @@ -23,13 +23,13 @@ void StateSaver::SaveState(QString filename, SimulationEngine *engine, CrystalPo settings.beginGroup("CrystalPopulations"); settings.beginWriteArray("pop"); - for (auto i = 0u; i < crystals->getCount(); ++i) + for (auto popIndex = 0u; popIndex < crystals->getCount(); ++popIndex) { - settings.setArrayIndex(i); - settings.setValue("Weight", crystals->getWeight(i)); - auto population = crystals->get(i); + settings.setArrayIndex(popIndex); + settings.setValue("Weight", crystals->getWeight(popIndex)); + auto population = crystals->get(popIndex); - settings.setValue("Name", QString::fromStdString(crystals->getName(i))); + settings.setValue("Name", QString::fromStdString(crystals->getName(popIndex))); settings.setValue("Enabled", population.enabled); settings.setValue("CaRatioAverage", (double)population.caRatioAverage); @@ -50,6 +50,14 @@ void StateSaver::SaveState(QString filename, SimulationEngine *engine, CrystalPo settings.setValue("LowerApexAngle", (double)population.lowerApexAngle); settings.setValue("LowerApexHeightAverage", (double)population.lowerApexHeightAverage); settings.setValue("LowerApexHeightStd", (double)population.lowerApexHeightStd); + + settings.beginWriteArray("PrismFaceDistances"); + for (auto prismFaceIndex = 0u; prismFaceIndex < 6; ++prismFaceIndex) + { + settings.setArrayIndex(prismFaceIndex); + settings.setValue("Average", (double)population.prismFaceDistances[prismFaceIndex]); + } + settings.endArray(); } settings.endArray(); settings.endGroup(); @@ -92,9 +100,9 @@ void StateSaver::LoadState(QString filename, SimulationStateModel *simState, Cry crystalModel->clear(); auto crystalPopulationCount = settings.beginReadArray("CrystalPopulations/pop"); - for (auto i = 0; i < crystalPopulationCount; ++i) + for (auto popIndex = 0; popIndex < crystalPopulationCount; ++popIndex) { - settings.setArrayIndex(i); + settings.setArrayIndex(popIndex); auto pop = CrystalPopulation::createRandom(); pop.enabled = settings.value("Enabled", pop.enabled).toBool(); @@ -120,6 +128,14 @@ void StateSaver::LoadState(QString filename, SimulationStateModel *simState, Cry auto name = settings.value("Name", "Default name").toString(); double weight = settings.value("Weight", 1.0).toDouble(); + settings.beginReadArray("PrismFaceDistances"); + for (auto prismFaceIndex = 0u; prismFaceIndex < 6; ++prismFaceIndex) + { + settings.setArrayIndex(prismFaceIndex); + pop.prismFaceDistances[prismFaceIndex] = settings.value("Average", pop.prismFaceDistances[prismFaceIndex]).toFloat(); + } + settings.endArray(); + crystalModel->addRow(pop, weight, name); } settings.endArray(); From b600b9949245296678bbc8f89bb3f6e4650371f9 Mon Sep 17 00:00:00 2001 From: Samuli Vuorinen Date: Fri, 7 May 2021 22:43:25 +0300 Subject: [PATCH 5/6] Fix incorrect crystal geometry Two triangles in the crystal geometry used for raytracing were incorrect, leaving two small holes in the crystal. This manifested as slightly asymmetric brightness distribution of halos with Parry crystals. --- CHANGELOG.md | 2 ++ src/haloray-core/resources/shaders/raytrace.glsl | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5092c2c..35d41e5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,6 +20,8 @@ and this project adheres to - Fixed bug where sky was shown a second time outside field of view with equidistant and equal area camera projections - Fixed missing prism face distances from save files +- Fixed bug with slightly incorrect crystal geometry causing uneven brightness + distribution with Parry crystal halos ## 3.2.0 - 2021-03-24 diff --git a/src/haloray-core/resources/shaders/raytrace.glsl b/src/haloray-core/resources/shaders/raytrace.glsl index 20da1b8..1d63cb8 100644 --- a/src/haloray-core/resources/shaders/raytrace.glsl +++ b/src/haloray-core/resources/shaders/raytrace.glsl @@ -130,11 +130,11 @@ ivec3 triangles[] = ivec3[]( ivec3(15, 16, 10), // Face 7 (prism) - ivec3(10, 16, 17), + ivec3(10, 16, 11), ivec3(16, 17, 11), // Face 8 (prism) - ivec3(11, 17, 12), + ivec3(11, 17, 6), ivec3(17, 12, 6) ); From 933e31873de02ca7f33a56563d0d1124fc66d3c6 Mon Sep 17 00:00:00 2001 From: Samuli Vuorinen Date: Fri, 7 May 2021 22:49:18 +0300 Subject: [PATCH 6/6] Bump version number --- CHANGELOG.md | 2 +- appveyor.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 35d41e5..e4f97fa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,7 +6,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). -## Unreleased +## 3.3.0 - 2021-05-07 ### Changed diff --git a/appveyor.yml b/appveyor.yml index 6da6a19..44e1799 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,4 +1,4 @@ -version: "3.2.0-{build}" +version: "3.3.0-{build}" branches: only: - master