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

constexpr fix

parent d1c431bd
No related branches found
No related tags found
No related merge requests found
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
const std::string vertexShaderPath = "assets/shaders/particle.vert.glsl"; const std::string vertexShaderPath = "assets/shaders/particle.vert.glsl";
const std::string fragmentShaderPath = "assets/shaders/particle.frag.glsl"; const std::string fragmentShaderPath = "assets/shaders/particle.frag.glsl";
constexpr QPong::Particle::Properties initialParticleSettings = { const QPong::Particle::Properties initialParticleSettings = {
.size = 512, .size = 512,
.position = {0.0, 0.0, 0.0}, .position = {0.0, 0.0, 0.0},
.momentum = {0.0, 0.0, 0.0}, .momentum = {0.0, 0.0, 0.0},
......
...@@ -77,7 +77,7 @@ Particle::Particle(Properties properties, GameOptions &options, Player &playerOn ...@@ -77,7 +77,7 @@ Particle::Particle(Properties properties, GameOptions &options, Player &playerOn
if (options.game == true) 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_leftBat.moveToStartingPosition();
m_rightBat.moveToStartingPosition(); m_rightBat.moveToStartingPosition();
} }
......
...@@ -74,7 +74,7 @@ void calculateTriangleIndices(uint32_t *indices, int arraySize) ...@@ -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}; double y {0.0};
for (int i {0}; i < arrayElements; ++i) for (int i {0}; i < arrayElements; ++i)
...@@ -85,14 +85,6 @@ void calculateBorderPotential(float *potential, double *yAt, int arrayElements) ...@@ -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) void calculateGaussBox(float *potential, double *xAt, double *yAt, int arrayElements)
{ {
constexpr double grow = 0.1; constexpr double grow = 0.1;
......
...@@ -16,7 +16,6 @@ const T pow2(const T v) ...@@ -16,7 +16,6 @@ const T pow2(const T v)
void calculatePointPositions(float *points, int arraySize); void calculatePointPositions(float *points, int arraySize);
void calculateMomentumViewPositions(float *points, int arraySize); void calculateMomentumViewPositions(float *points, int arraySize);
void calculateTriangleIndices(uint32_t *indices, int arraySize); void calculateTriangleIndices(uint32_t *indices, int arraySize);
void calculateBorderPotential(float *potential, double *yAt, int arrayElements); void calculateBorderPotential(float *potential, double *xAt, double *yAt, int arrayElements);
void calculateSchroedingerPotential(float *potential, double *xAt, double *yAt, int arrayElements);
void calculateGaussBox(float *potential, double *xAt, double *yAt, int arrayElemnts); void calculateGaussBox(float *potential, double *xAt, double *yAt, int arrayElemnts);
#endif #endif
\ No newline at end of file
...@@ -25,7 +25,7 @@ void main() ...@@ -25,7 +25,7 @@ void main()
gl_Position = u_viewProjection * vec4(pos, 1.0f); gl_Position = u_viewProjection * vec4(pos, 1.0f);
// Calculate "color" value of the momentum // Calculate "color" value of the momentum
float pot = potential * 120.0 * u_showPotential; float pot = potential * 100.0 * u_showPotential;
// Generate color from data // Generate color from data
float real = v_particle_complex[0]; float real = v_particle_complex[0];
...@@ -35,6 +35,6 @@ void main() ...@@ -35,6 +35,6 @@ void main()
fragmentColor = vec3( fragmentColor = vec3(
sqrt(real2) * 5.0 + pot, // red 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 sqrt(imag2) * 5.0 + pot); // blue
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment