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
This commit is contained in:
Jacques Lucke 2020-04-23 12:44:12 +02:00
parent 5afba30c69
commit 6524aaf685
Notes: blender-bot 2023-02-14 08:38:11 +01:00
Referenced by issue #76008, Fluid: Inflow with negative initial velocity is not working
1 changed files with 13 additions and 3 deletions

View File

@ -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];
}
}
}
}