Skip to content

Commit

Permalink
Merge branch 'release/1.1.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
naavis committed Jun 17, 2019
2 parents aef1de7 + 81d87b2 commit 955950f
Show file tree
Hide file tree
Showing 8 changed files with 56 additions and 34 deletions.
17 changes: 17 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Changelog

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).

## 1.1.0

### Changed

- Fixed bug where uniform C-axis orientation was messing with C-axis rotation
- Renamed C-axis orientation to simply C-axis tilt

## 1.0.0

- First official release
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# HaloRay

HaloRay simulates the reflection and refraction of sun light inside hexagonal ice crystals present
in high altitude clouds in the atmosphere. These ice crystal produce various optical phenomena
in high altitude clouds in the atmosphere. These ice crystals produce various optical phenomena
in the sky, including bright spots, circles and arcs.

HaloRay employs GPGPU to massively accelerate simulations. Brunt of the work happens in OpenGL compute shaders.
Expand Down
2 changes: 1 addition & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
set (HaloRay_VERSION_MAJOR 1)
set (HaloRay_VERSION_MINOR 0)
set (HaloRay_VERSION_MINOR 1)
set (HaloRay_VERSION_PATCH 0)

configure_file("${CMAKE_CURRENT_SOURCE_DIR}/version.h.in" "${CMAKE_CURRENT_SOURCE_DIR}/version.h")
Expand Down
15 changes: 8 additions & 7 deletions src/gui/gui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
#include "nuklear/nuklear.h"
#include "../simulation/simulationEngine.h"

namespace GUI {
namespace GUI
{

const nk_flags WINDOW_FLAGS = NK_WINDOW_BORDER | NK_WINDOW_MOVABLE | NK_WINDOW_SCALABLE | NK_WINDOW_MINIMIZABLE | NK_WINDOW_TITLE;
const nk_flags GROUP_FLAGS = NK_WINDOW_BORDER | NK_WINDOW_TITLE;
Expand Down Expand Up @@ -82,15 +83,15 @@ void renderCrystalSettingsWindow(struct nk_context *ctx,

const char *distributions[] = {"Uniform", "Gaussian"};
nk_layout_row_dynamic(ctx, 120, 1);
if (nk_group_begin(ctx, "C axis orientation", GROUP_FLAGS))
if (nk_group_begin(ctx, "C axis tilt", GROUP_FLAGS))
{
nk_layout_row_dynamic(ctx, 30, 1);
nk_combobox(ctx, distributions, NK_LEN(distributions), &(population.polarAngleDistribution), 30, nk_vec2(nk_layout_widget_bounds(ctx).w, 90));
if (population.polarAngleDistribution == 1)
nk_combobox(ctx, distributions, NK_LEN(distributions), &(population.tiltDistribution), 30, nk_vec2(nk_layout_widget_bounds(ctx).w, 90));
if (population.tiltDistribution == 1)
{
nk_layout_row_dynamic(ctx, 30, 2);
nk_property_float(ctx, "#Average rotation:", 0.0f, &(population.polarAngleAverage), 360.0f, 0.1f, 0.5f);
nk_property_float(ctx, "#Rotation std:", 0.0f, &(population.polarAngleStd), 360.0f, 0.1f, 0.5f);
nk_property_float(ctx, "#Average tilt:", 0.0f, &(population.tiltAverage), 360.0f, 0.1f, 0.5f);
nk_property_float(ctx, "#Tilt std:", 0.0f, &(population.tiltStd), 360.0f, 0.1f, 0.5f);
}
nk_group_end(ctx);
}
Expand Down Expand Up @@ -151,4 +152,4 @@ void renderViewSettingsWindow(struct nk_context *ctx,
nk_end(ctx);
}

}
} // namespace GUI
6 changes: 3 additions & 3 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -133,9 +133,9 @@ void runMainLoop(GLFWwindow *window,
crystalProperties.caRatioAverage = 0.3f;
crystalProperties.caRatioStd = 0.0f;

crystalProperties.polarAngleDistribution = 1;
crystalProperties.polarAngleAverage = 0.0f;
crystalProperties.polarAngleStd = 40.0f;
crystalProperties.tiltDistribution = 1;
crystalProperties.tiltAverage = 0.0f;
crystalProperties.tiltStd = 40.0f;

crystalProperties.rotationDistribution = 1;
crystalProperties.rotationAverage = 0.0f;
Expand Down
30 changes: 17 additions & 13 deletions src/simulation/shaders/raytrace.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ uniform struct crystalProperties_t
float caRatioAverage;
float caRatioStd;

int polarAngleDistribution;
float polarAngleAverage;
float polarAngleStd;
int tiltDistribution;
float tiltAverage;
float tiltStd;

int rotationDistribution;
float rotationAverage;
Expand Down Expand Up @@ -372,20 +372,24 @@ vec2 cartesianToPolar(vec3 direction)

mat3 getRotationMatrix(void)
{
// Orientation of crystal C-axis
mat3 orientationMat;
if (crystalProperties.tiltDistribution == DISTRIBUTION_UNIFORM && crystalProperties.rotationDistribution == DISTRIBUTION_UNIFORM)
{
return getUniformRandomRotationMatrix();
}

// Tilt of the crystal C-axis
mat3 tiltMat;

// Rotation around crystal C-axis
mat3 rotationMat;

if (crystalProperties.polarAngleDistribution == DISTRIBUTION_UNIFORM) {
orientationMat = getUniformRandomRotationMatrix();
if (crystalProperties.tiltDistribution == DISTRIBUTION_UNIFORM) {
tiltMat = rotateAroundZ(rand() * 2.0 * PI);
} else {
float angleAverage = crystalProperties.polarAngleAverage;
float angleStd = crystalProperties.polarAngleStd;
float polarAngle = radians(angleAverage + angleStd * randn().x);
mat3 polarTiltMat = rotateAroundZ(polarAngle);
orientationMat = rotateAroundY(rand() * 2.0 * PI) * polarTiltMat;
float angleAverage = crystalProperties.tiltAverage;
float angleStd = crystalProperties.tiltStd;
float tiltAngle = radians(angleAverage + angleStd * randn().x);
tiltMat = rotateAroundZ(tiltAngle);
}

if (crystalProperties.rotationDistribution == DISTRIBUTION_UNIFORM)
Expand All @@ -398,7 +402,7 @@ mat3 getRotationMatrix(void)
rotationMat = rotateAroundY(rotationAngle);
}

return orientationMat * rotationMat;
return rotateAroundY(rand() * 2.0 * PI) * tiltMat * rotationMat;
}

float daylightEstimate(float wavelength)
Expand Down
6 changes: 3 additions & 3 deletions src/simulation/simulationEngine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,9 @@ void SimulationEngine::Run(unsigned int numRays)
glUniform1f(glGetUniformLocation(shaderHandle, "crystalProperties.caRatioAverage"), mCrystals.caRatioAverage);
glUniform1f(glGetUniformLocation(shaderHandle, "crystalProperties.caRatioStd"), mCrystals.caRatioStd);

glUniform1i(glGetUniformLocation(shaderHandle, "crystalProperties.polarAngleDistribution"), mCrystals.polarAngleDistribution);
glUniform1f(glGetUniformLocation(shaderHandle, "crystalProperties.polarAngleAverage"), mCrystals.polarAngleAverage);
glUniform1f(glGetUniformLocation(shaderHandle, "crystalProperties.polarAngleStd"), mCrystals.polarAngleStd);
glUniform1i(glGetUniformLocation(shaderHandle, "crystalProperties.tiltDistribution"), mCrystals.tiltDistribution);
glUniform1f(glGetUniformLocation(shaderHandle, "crystalProperties.tiltAverage"), mCrystals.tiltAverage);
glUniform1f(glGetUniformLocation(shaderHandle, "crystalProperties.tiltStd"), mCrystals.tiltStd);

glUniform1i(glGetUniformLocation(shaderHandle, "crystalProperties.rotationDistribution"), mCrystals.rotationDistribution);
glUniform1f(glGetUniformLocation(shaderHandle, "crystalProperties.rotationAverage"), mCrystals.rotationAverage);
Expand Down
12 changes: 6 additions & 6 deletions src/simulation/simulationEngine.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ struct CrystalPopulation
float caRatioAverage;
float caRatioStd;

int polarAngleDistribution;
float polarAngleAverage;
float polarAngleStd;
int tiltDistribution;
float tiltAverage;
float tiltStd;

int rotationDistribution;
float rotationAverage;
Expand All @@ -25,9 +25,9 @@ struct CrystalPopulation
{
return caRatioAverage == other.caRatioAverage &&
caRatioStd == other.caRatioStd &&
polarAngleDistribution == other.polarAngleDistribution &&
polarAngleAverage == other.polarAngleAverage &&
polarAngleStd == other.polarAngleStd &&
tiltDistribution == other.tiltDistribution &&
tiltAverage == other.tiltAverage &&
tiltStd == other.tiltStd &&
rotationDistribution == other.rotationDistribution &&
rotationAverage == other.rotationAverage &&
rotationStd == other.rotationStd;
Expand Down

0 comments on commit 955950f

Please sign in to comment.