Skip to content
Snippets Groups Projects
Verified Commit 978581ca authored by Josch Morgenstern's avatar Josch Morgenstern
Browse files

[#111] add boundary constraints

parent 736ec0a8
No related branches found
No related tags found
1 merge request!95Resolve "Wassersimulation mit Interaktion"
#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;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment