diff --git a/App/GameLayer.cpp b/App/GameLayer.cpp index e65120753642cd4eddfe8eb4d946bf1cecc13425..bf95ba27c8c0c68da6f8362800189ae5c9af3311 100644 --- a/App/GameLayer.cpp +++ b/App/GameLayer.cpp @@ -21,7 +21,7 @@ const std::string vertexShaderPath = "assets/shaders/particle.vert.glsl"; const std::string fragmentShaderPath = "assets/shaders/particle.frag.glsl"; -constexpr QPong::Particle::Properties initialParticleSettings = { +const QPong::Particle::Properties initialParticleSettings = { .size = 512, .position = {0.0, 0.0, 0.0}, .momentum = {0.0, 0.0, 0.0}, diff --git a/QPong/Particle.cpp b/QPong/Particle.cpp index 3673b87c7796b3c28ee00b4c5d6b7b2835ba5803..22cb841f4ea378d47ece574f7c5bd974ad9f3005 100644 --- a/QPong/Particle.cpp +++ b/QPong/Particle.cpp @@ -77,7 +77,7 @@ Particle::Particle(Properties properties, GameOptions &options, Player &playerOn if (options.game == true) { - calculateBorderPotential(m_staticBorders, m_yAt, m_properties.elements()); + calculateBorderPotential(m_staticBorders, m_xAt, m_yAt, m_properties.elements()); m_leftBat.moveToStartingPosition(); m_rightBat.moveToStartingPosition(); } diff --git a/QPong/Utils.cpp b/QPong/Utils.cpp index 7fa3285889b20adf1d55d0d7f29ad7c96584ca00..87244ee9079dfbe6a2dbb6b82d10d946a8224ce1 100644 --- a/QPong/Utils.cpp +++ b/QPong/Utils.cpp @@ -74,7 +74,7 @@ void calculateTriangleIndices(uint32_t *indices, int arraySize) } } -void calculateBorderPotential(float *potential, double *yAt, int arrayElements) +void calculateBorderPotential(float *potential, [[maybe_unused]] double *xAt, double *yAt, int arrayElements) { double y {0.0}; for (int i {0}; i < arrayElements; ++i) @@ -85,14 +85,6 @@ void calculateBorderPotential(float *potential, double *yAt, int arrayElements) } } -void calculateSchroedingerPotential(float *potential, double *xAt, double *yAt, int arrayElements) -{ - for (int i {0}; i < arrayElements; ++i) - { - potential[i] = ( pow2(pow2(xAt[i]) + pow2(yAt[i])) ) / 200.0; - } -} - void calculateGaussBox(float *potential, double *xAt, double *yAt, int arrayElements) { constexpr double grow = 0.1; diff --git a/QPong/Utils.hpp b/QPong/Utils.hpp index 54ecfcbbfb5c6174a874cdea2197ed39fbadbaae..c8ce49e14b6f10406d0f968a184226bd058d54df 100644 --- a/QPong/Utils.hpp +++ b/QPong/Utils.hpp @@ -16,7 +16,6 @@ const T pow2(const T v) void calculatePointPositions(float *points, int arraySize); void calculateMomentumViewPositions(float *points, int arraySize); void calculateTriangleIndices(uint32_t *indices, int arraySize); -void calculateBorderPotential(float *potential, double *yAt, int arrayElements); -void calculateSchroedingerPotential(float *potential, double *xAt, double *yAt, int arrayElements); +void calculateBorderPotential(float *potential, double *xAt, double *yAt, int arrayElements); void calculateGaussBox(float *potential, double *xAt, double *yAt, int arrayElemnts); #endif \ No newline at end of file diff --git a/assets/shaders/particle.vert.glsl b/assets/shaders/particle.vert.glsl index a4b37815b5b4376d2a489d8320884e064db40e35..9cd55d644a685a005400088b67f21e38c9500765 100644 --- a/assets/shaders/particle.vert.glsl +++ b/assets/shaders/particle.vert.glsl @@ -25,7 +25,7 @@ void main() gl_Position = u_viewProjection * vec4(pos, 1.0f); // Calculate "color" value of the momentum - float pot = potential * 120.0 * u_showPotential; + float pot = potential * 100.0 * u_showPotential; // Generate color from data float real = v_particle_complex[0]; @@ -35,6 +35,6 @@ void main() fragmentColor = vec3( sqrt(real2) * 5.0 + pot, // red - sqrt(real2) * 5.0 + sqrt(imag2) * 5.0 + pot, // green + (sqrt(real2) + sqrt(imag2)) * 5.0 + pot, // green sqrt(imag2) * 5.0 + pot); // blue -} \ No newline at end of file +}