Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacques Lucke <jacques@blender.org>2020-04-23 13:44:12 +0300
committerJacques Lucke <jacques@blender.org>2020-04-23 16:00:48 +0300
commit6524aaf685638ef5f9fdca03ae682a0b4d18c6f6 (patch)
tree4935889b2b0ad4979f4da4e03b0d9fe94066cc53 /source/blender/blenkernel
parent5afba30c69b1fc67bbf071efe8ac70c4ec9ec28b (diff)
Fix T76008: Fluid inflow with negative initial velocity is not working
This is a regression introduced in rBa0fe22095e6d9b8b194c2cf6f9a7c7b419d7e61c. I changed it so that the velocity with the highest magnitude is considered and not the highest value per coordinate. Reviewers: sebbas Differential Revision: https://developer.blender.org/D7502
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r--source/blender/blenkernel/intern/fluid.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/source/blender/blenkernel/intern/fluid.c b/source/blender/blenkernel/intern/fluid.c
index a26feb2d06b..83a431306f4 100644
--- a/source/blender/blenkernel/intern/fluid.c
+++ b/source/blender/blenkernel/intern/fluid.c
@@ -3110,9 +3110,19 @@ static void update_flowsfluids(struct Depsgraph *depsgraph,
levelset,
emission_in);
if (mfs->flags & FLUID_FLOW_INITVELOCITY) {
- velx_initial[d_index] = MAX2(velx_initial[d_index], velocity_map[e_index * 3]);
- vely_initial[d_index] = MAX2(vely_initial[d_index], velocity_map[e_index * 3 + 1]);
- velz_initial[d_index] = MAX2(velz_initial[d_index], velocity_map[e_index * 3 + 2]);
+ /* Use the initial velocity from the inflow object with the highest velocity for
+ * now. */
+ float vel_initial[3];
+ vel_initial[0] = velx_initial[d_index];
+ vel_initial[1] = vely_initial[d_index];
+ vel_initial[2] = velz_initial[d_index];
+ float vel_initial_strength = len_squared_v3(vel_initial);
+ float vel_map_strength = len_squared_v3(velocity_map + 3 * e_index);
+ if (vel_map_strength > vel_initial_strength) {
+ velx_initial[d_index] = velocity_map[e_index * 3];
+ vely_initial[d_index] = velocity_map[e_index * 3 + 1];
+ velz_initial[d_index] = velocity_map[e_index * 3 + 2];
+ }
}
}
}