Skip to content
Snippets Groups Projects
Verified Commit 06f5d24c authored by Tobias Frisch's avatar Tobias Frisch
Browse files

Avoid division by zero

parent 728faab7
No related branches found
No related tags found
1 merge request!103Added project wobble_bobble and refactored some parts of the framework
...@@ -64,10 +64,11 @@ void main() { ...@@ -64,10 +64,11 @@ void main() {
memoryBarrierShared(); memoryBarrierShared();
for (uint i = 0; i < SHARED_PARTICLES_BATCH_SIZE; i++) { for (uint i = 0; i < SHARED_PARTICLES_BATCH_SIZE; i++) {
float x = distance(shared_particles[i].position, position) / shared_particles[i].size; float s = shared_particles[i].size;
float x = distance(shared_particles[i].position, position);
if (x < 2.0f) { if (x < 2.0f * s) {
gridValue += vec4(shared_particles[i].velocity, shared_particles[i].mass) * weight_C(x); gridValue += vec4(shared_particles[i].velocity, shared_particles[i].mass) * weight_C(x / s);
} }
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment