Skip to content
Snippets Groups Projects
Commit 3641f27d authored by Armin Co's avatar Armin Co
Browse files

Refactoring

parent e8c5b3d2
Branches
No related tags found
No related merge requests found
......@@ -29,12 +29,12 @@ const QPong::Particle::Properties initialParticleSettings = {
.size = 512,
.position = {0.0, 0.0, 0.0},
.momentum = {0.0, 0.0, 0.0},
.pointUnsharpness = 64.0,
.sharpness = 64.0,
.startValue = 0.01,
.hbar = 0.000125
};
const QPong::Particle::GameOptions intialOptions = {
const QPong::Particle::GameOptions initialOptions = {
.potentialsEnabled = true,
.absorbtionEnabled = true,
.momentumEnabled = false
......@@ -46,7 +46,7 @@ QPong::GameLayer::GameLayer(int resolution, int threads)
, m_propagate{false}
, m_leftBat(-0.8, 0.0, Key::W, Key::S)
, m_rightBat(0.8, 0.0, Key::Up, Key::Down)
, m_options{intialOptions}
, m_options{initialOptions}
, m_properties {initialParticleSettings}
, m_speedScale{5.0f}
, m_randomMomentum {true}
......@@ -245,14 +245,14 @@ void QPong::GameLayer::onGuiRender()
ImGui::DragFloat2("Momentum [x,y]", glm::value_ptr(m_properties.momentum), 0.01f, -3.0f, 3.0f);
ImGui::Checkbox("Random Momentum", &m_randomMomentum);
float pointUnsharpness = m_properties.pointUnsharpness;
if (ImGui::DragFloat("Sharpness", &pointUnsharpness, 1.0f, 5.0f, 1000.0f))
float sharpness = m_properties.sharpness;
if (ImGui::DragFloat("Sharpness", &sharpness, 1.0f, 5.0f, 1000.0f))
{
m_properties.pointUnsharpness = pointUnsharpness;
m_properties.sharpness = sharpness;
}
// Select hbar, changes apply on the fly.
float hbar = m_properties.hbar;
if (ImGui::DragFloat("hbar", &hbar, 0.000001f, 0.000001f, 1.0f, "%.6f"))
if (ImGui::DragFloat("hbar", &hbar, 0.0000001f, 0.0000001f, 1.0f, "%.7f"))
{
m_properties.hbar = hbar;
}
......
......@@ -154,7 +154,7 @@ void Particle::initialiseParticleMomentum()
const double py0 = m_properties.momentum.y / 20.0;
const double x0 = m_properties.position.x;
const double y0 = m_properties.position.y;
const double lambda = m_properties.pointUnsharpness;
const double lambda = m_properties.sharpness;
double sum{0.0};
double m_particleAbsoluteSumStart = 0.0;
......
......@@ -33,7 +33,7 @@ namespace QPong
int size;
glm::vec3 position;
glm::vec3 momentum;
double pointUnsharpness;
double sharpness;
double startValue;
double hbar;
int threads;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment