diff --git a/projects/sph/shaders/updateData.comp b/projects/sph/shaders/updateData.comp index c80b1e1a8c0e2e1c988295eaabfe839df18a6d8b..38541cda36bb69a8700ae4b060a959099e7d74b5 100644 --- a/projects/sph/shaders/updateData.comp +++ b/projects/sph/shaders/updateData.comp @@ -1,7 +1,7 @@ #version 450 core #extension GL_ARB_separate_shader_objects : enable -#define absorbtion 0.9 +#define ABSORBTION 0.9 #define dt 0.0003 layout(local_size_x = 256) in; @@ -44,6 +44,43 @@ void main() { vec3 vel_new = inParticle[id].velocity + dt * accel; vec3 pos_new = inParticle[id].position + dt * vel_new; + // Überprüfe Randbedingungen x + if (inParticle[id].position.x < -0.6) + { + vel_new.x *= -ABSORBTION; + pos_new.x = -0.6; + } + else if (inParticle[id].position.x > 0.6) + { + vel_new.x *= -ABSORBTION; + pos_new.x = 0.6; + } + + // Überprüfe Randbedingungen y + if (inParticle[id].position.y < -0.8) + { + vel_new.y *= -ABSORBTION; + pos_new.y = -0.8; + + } + else if (inParticle[id].position.y > 0.8) + { + vel_new.y *= -ABSORBTION; + pos_new.y = 0.8; + } + + // Überprüfe Randbedingungen z + if (inParticle[id].position.z < -0.6 ) + { + vel_new.z *= -ABSORBTION; + pos_new.z = -0.6; + } + else if (inParticle[id].position.z > 0.6 ) + { + vel_new.z *= -ABSORBTION; + pos_new.z = 0.6; + } + outParticle[id].force = inParticle[id].force; outParticle[id].density = inParticle[id].density; outParticle[id].pressure = inParticle[id].pressure;