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

Removed branching which is not necessary

parent ff2df739
No related branches found
No related tags found
1 merge request!103Added project wobble_bobble and refactored some parts of the framework
......@@ -30,11 +30,9 @@ void main() {
vec3 offset = vec3(i, j, k) / gridResolution;
vec3 voxel = minimal.position + offset;
if (length(offset) < minimal.size * 2.0f) {
vec4 gridSample = texture(sampler3D(gridImage, gridSampler), voxel);
vec4 gridSample = texture(sampler3D(gridImage, gridSampler), voxel);
mass += gridSample.w * voxel_particle_weight(voxel, minimal);
}
mass += gridSample.w * voxel_particle_weight(voxel, minimal);
}
}
}
......
......@@ -37,14 +37,12 @@ void main() {
vec3 offset = vec3(i, j, k) / gridResolution;
vec3 voxel = minimal.position + offset;
if (length(offset) < minimal.size * 2.0f) {
vec4 gridSample = texture(sampler3D(gridImage, gridSampler), voxel);
velocity_gradient += outerProduct(
gridSample.xyz,
voxel_particle_grad_weight(voxel, minimal)
);
}
vec4 gridSample = texture(sampler3D(gridImage, gridSampler), voxel);
velocity_gradient += outerProduct(
gridSample.xyz,
voxel_particle_grad_weight(voxel, minimal)
);
}
}
}
......
......@@ -43,19 +43,17 @@ void main() {
vec3 offset = vec3(i, j, k) / gridResolution;
vec3 voxel = minimal.position + offset;
if (length(offset) < minimal.size * 2.0f) {
vec4 gridSample = texture(sampler3D(gridImage, gridSampler), voxel);
vec4 gridOldSample = texture(sampler3D(gridOldImage, gridSampler), voxel);
vec4 gridSample = texture(sampler3D(gridImage, gridSampler), voxel);
vec4 gridOldSample = texture(sampler3D(gridOldImage, gridSampler), voxel);
float weight = voxel_particle_weight(voxel, minimal);
vec3 velocity = gridSample.xyz * weight;
float weight = voxel_particle_weight(voxel, minimal);
vec3 velocity = gridSample.xyz * weight;
affine_D += outerProduct(weight * offset, offset);
affine_B += outerProduct(velocity, offset);
affine_D += outerProduct(weight * offset, offset);
affine_B += outerProduct(velocity, offset);
velocity_pic += velocity;
velocity_flip += (gridSample.xyz - gridOldSample.xyz) * weight;
}
velocity_pic += velocity;
velocity_flip += (gridSample.xyz - gridOldSample.xyz) * weight;
}
}
}
......@@ -72,9 +70,7 @@ void main() {
for (k = -gridWindow.z; k <= gridWindow.z; k++) {
vec3 offset = vec3(i, j, k) / gridResolution;
if (length(offset) < minimal.size * 2.0f) {
velocity_apic += affine_C * offset;
}
velocity_apic += affine_C * offset;
}
}
}
......
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