Skip to content

Commit

Permalink
Merge branch 'release/4.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
naavis committed Jul 23, 2022
2 parents 2b742a5 + 617087c commit b12bdd9
Show file tree
Hide file tree
Showing 7 changed files with 58 additions and 13 deletions.
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,19 @@ 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).

## 4.1.0 - 2022-07-23

### Changed

- Changed equation used to calculate index of refraction for use switched from
one provided in Stanley Gedzelman's paper Simulatin Rainbows and Halos in
Color to a polynomial fitted to data provided by Warren and Brandt in their
paper Optical Constants of Ice from The Ultraviolet to The Microwave, which
is what HaloPoint 2.0 used to use
- HaloRay now remembers which folder you opened last when loading or saving
files like simulation parameter files or images, and opens the file dialog
picker in that same folder the next time

## 4.0.1 - 2021-08-26

### Fixed
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ HaloRay.exe -platform windows:dpiawareness=2
HaloRay writes a log file to help in troubleshooting.

On Windows you can find it in `%LOCALAPPDATA%\Temp\haloray\haloray.log` where
`%LOCALAPPDATA` is usually equal to `C:\Users\<username>\AppData\Local`
`%LOCALAPPDATA%` is usually equal to `C:\Users\<username>\AppData\Local`

On Linux the log file is in `/tmp/haloray/haloray.log`

Expand Down
4 changes: 2 additions & 2 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version: "4.0.1-{build}"
version: "4.1.0-{build}"
branches:
only:
- master
Expand All @@ -24,6 +24,6 @@ deploy:
description: ""
skip_tags: true
auth_token:
secure: qxadIRLRDKo8Tji0y+kZ03BIbNPJzdmp2HkzE6+G5lp1xtRCoeSpp6c4m4KU99D4
secure: eMwk/VxPE6NFjxlZpAAFZuf66bhTSGr53RDKw4DYPFhKomd2jybUE1y2dHQDAjgG
on:
branch: master
38 changes: 31 additions & 7 deletions src/haloray-core/gui/mainWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,39 +98,43 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), m_previousTimedIt
auto defaultFilename = QString("haloray_%1.png")
.arg(currentTime)
.replace(":", "-");
auto defaultFilePath = getLatestAccessedFolder().absoluteFilePath(defaultFilename);
QString filename = QFileDialog::getSaveFileName(this,
tr("Save File"),
defaultFilename,
defaultFilePath,
tr("Images (*.png)"));

if (!filename.isNull())
{
image.save(filename, "PNG", 50);
}
if (filename.isNull()) return;

image.save(filename, "PNG", 50);
updateLatestAccessedFolder(filename);
});
connect(m_saveSimulationAction, &QAction::triggered, [this]() {
auto currentTime = QDateTime::currentDateTimeUtc().toString(Qt::DateFormat::ISODate);
auto defaultFilename = QString("haloray_sim_%1.ini")
.arg(currentTime)
.replace(":", "-");
auto defaultFilePath = getLatestAccessedFolder().absoluteFilePath(defaultFilename);
QString filename = QFileDialog::getSaveFileName(this,
tr("Save File"),
defaultFilename,
defaultFilePath,
tr("Simulation files (*.ini)"));

if (filename.isNull()) return;

StateSaver::SaveState(filename, m_engine, m_crystalRepository.get());
updateLatestAccessedFolder(filename);
});
connect(m_loadSimulationAction, &QAction::triggered, [this]() {
QString filename = QFileDialog::getOpenFileName(this,
tr("Open file"),
QString(),
getLatestAccessedFolder().absolutePath(),
tr("Simulation files (*.ini)"));

if (filename.isNull()) return;

StateSaver::LoadState(filename, m_simulationStateModel, m_crystalModel);
updateLatestAccessedFolder(filename);
});
connect(m_openCrystalPreviewWindow, &QAction::triggered, [this]() {
auto previewWindow = new CrystalPreviewWindow(m_crystalModel, m_crystalSettingsWidget->getCurrentPopulationIndex(), this);
Expand Down Expand Up @@ -273,4 +277,24 @@ void HaloRay::MainWindow::restartSimulation()
m_openGLWidget->update();
}

QDir MainWindow::getLatestAccessedFolder() const
{
QSettings settings;
QString pathString = settings.value("filedialog/latestFolder", QString()).toString();
QDir dir(pathString);
if (dir.exists()) {
return dir;
}

return QDir();
}

void MainWindow::updateLatestAccessedFolder(QString fileOrDirPath)
{
QFileInfo fileInfo(fileOrDirPath);
QString path = fileInfo.absoluteDir().path();
QSettings settings;
settings.setValue("filedialog/latestFolder", path);
}

}
5 changes: 4 additions & 1 deletion src/haloray-core/gui/mainWindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
#include <QTimer>
#include "gui/models/simulationStateModel.h"


class QDoubleSpinBox;
class QProgressBar;
class QScrollArea;
class QAction;
class QDir;

namespace HaloRay
{
Expand Down Expand Up @@ -39,6 +39,9 @@ class MainWindow : public QMainWindow
void setupRenderTimer();
void restartSimulation();

QDir getLatestAccessedFolder() const;
void updateLatestAccessedFolder(QString fileOrDirPath);

GeneralSettingsWidget *m_generalSettingsWidget;
CrystalSettingsWidget *m_crystalSettingsWidget;
ViewSettingsWidget *m_viewSettingsWidget;
Expand Down
6 changes: 4 additions & 2 deletions src/haloray-core/resources/shaders/raytrace.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -208,8 +208,10 @@ float zFit_1931(float wave)

float getIceIOR(float wavelength)
{
// Eq. from Simulating rainbows and halos in color by Stanley Gedzelman
return 1.3203 - 0.0000333 * wavelength;
// The index of refraction is based on a second degree polynomial fitted to data from
// "Optical constants of ice from the ultraviolet to the microwave" by Warren and Brandt
// The raw data is available here: https://atmos.uw.edu/ice_optical_constants/
return 9.35698756194051e-8 * wavelength * wavelength - 1.42326056729702e-4 * wavelength + 1.36093233643442;
}

uint selectFirstTriangle(vec3 rayDirection)
Expand Down
3 changes: 3 additions & 0 deletions src/main/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,9 @@ int main(int argc, char *argv[])
Q_INIT_RESOURCE(haloray);
initializeLogging();

QCoreApplication::setOrganizationName("Other Computer Software");
QCoreApplication::setApplicationName("HaloRay");

QGuiApplication::setAttribute(Qt::AA_UseDesktopOpenGL);
QGuiApplication::setAttribute(Qt::AA_ShareOpenGLContexts);
QGuiApplication::setAttribute(Qt::AA_UseHighDpiPixmaps);
Expand Down

0 comments on commit b12bdd9

Please sign in to comment.