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:
authorSebastián Barschkis <sebbas@sebbas.org>2020-03-17 20:20:08 +0300
committerSebastián Barschkis <sebbas@sebbas.org>2020-03-17 20:21:01 +0300
commitbf9c4af9bb7436468eaa4fc954ab06c7369738d2 (patch)
treea7f44ec516724547471327e501c5e8a0219a6d15
parent07d5b8b0231f45ec2cab8391074c7635478983d5 (diff)
Fix T74762: Mantaflow: Non emmiting flow source affects simulation
-rw-r--r--source/blender/blenkernel/intern/fluid.c68
1 files changed, 34 insertions, 34 deletions
diff --git a/source/blender/blenkernel/intern/fluid.c b/source/blender/blenkernel/intern/fluid.c
index 797e03e015a..dc872b933eb 100644
--- a/source/blender/blenkernel/intern/fluid.c
+++ b/source/blender/blenkernel/intern/fluid.c
@@ -1894,40 +1894,6 @@ static void sample_mesh(FluidFlowSettings *mfs,
v3 = mloop[mlooptri[f_index].tri[2]].v;
interp_weights_tri_v3(weights, mvert[v1].co, mvert[v2].co, mvert[v3].co, nearest.co);
- /* Initial velocity of flow object. */
- if (mfs->flags & FLUID_FLOW_INITVELOCITY && velocity_map) {
- /* Apply normal directional velocity. */
- if (mfs->vel_normal) {
- /* Interpolate vertex normal vectors to get nearest point normal. */
- normal_short_to_float_v3(n1, mvert[v1].no);
- normal_short_to_float_v3(n2, mvert[v2].no);
- normal_short_to_float_v3(n3, mvert[v3].no);
- interp_v3_v3v3v3(hit_normal, n1, n2, n3, weights);
- normalize_v3(hit_normal);
-
- /* Apply normal directional velocity. */
- velocity_map[index * 3] += hit_normal[0] * mfs->vel_normal * 0.25f;
- velocity_map[index * 3 + 1] += hit_normal[1] * mfs->vel_normal * 0.25f;
- velocity_map[index * 3 + 2] += hit_normal[2] * mfs->vel_normal * 0.25f;
- }
- /* Apply object velocity. */
- if (has_velocity && mfs->vel_multi) {
- float hit_vel[3];
- interp_v3_v3v3v3(
- hit_vel, &vert_vel[v1 * 3], &vert_vel[v2 * 3], &vert_vel[v3 * 3], weights);
- velocity_map[index * 3] += hit_vel[0] * mfs->vel_multi;
- velocity_map[index * 3 + 1] += hit_vel[1] * mfs->vel_multi;
- velocity_map[index * 3 + 2] += hit_vel[2] * mfs->vel_multi;
-# ifdef DEBUG_PRINT
- /* Debugging: Print flow object velocities. */
- printf("adding flow object vel: [%f, %f, %f]\n", hit_vel[0], hit_vel[1], hit_vel[2]);
-# endif
- }
- velocity_map[index * 3] += mfs->vel_coord[0];
- velocity_map[index * 3 + 1] += mfs->vel_coord[1];
- velocity_map[index * 3 + 2] += mfs->vel_coord[2];
- }
-
/* Compute emission strength for smoke flow. */
if (is_gas_flow) {
/* Emission from surface is based on UI configurable distance value. */
@@ -1977,6 +1943,40 @@ static void sample_mesh(FluidFlowSettings *mfs,
emission_strength *= texres.tin;
}
}
+
+ /* Initial velocity of flow object. Only compute velocity if emission is present. */
+ if (mfs->flags & FLUID_FLOW_INITVELOCITY && velocity_map && emission_strength != 0.0) {
+ /* Apply normal directional velocity. */
+ if (mfs->vel_normal) {
+ /* Interpolate vertex normal vectors to get nearest point normal. */
+ normal_short_to_float_v3(n1, mvert[v1].no);
+ normal_short_to_float_v3(n2, mvert[v2].no);
+ normal_short_to_float_v3(n3, mvert[v3].no);
+ interp_v3_v3v3v3(hit_normal, n1, n2, n3, weights);
+ normalize_v3(hit_normal);
+
+ /* Apply normal directional velocity. */
+ velocity_map[index * 3] += hit_normal[0] * mfs->vel_normal * 0.25f;
+ velocity_map[index * 3 + 1] += hit_normal[1] * mfs->vel_normal * 0.25f;
+ velocity_map[index * 3 + 2] += hit_normal[2] * mfs->vel_normal * 0.25f;
+ }
+ /* Apply object velocity. */
+ if (has_velocity && mfs->vel_multi) {
+ float hit_vel[3];
+ interp_v3_v3v3v3(
+ hit_vel, &vert_vel[v1 * 3], &vert_vel[v2 * 3], &vert_vel[v3 * 3], weights);
+ velocity_map[index * 3] += hit_vel[0] * mfs->vel_multi;
+ velocity_map[index * 3 + 1] += hit_vel[1] * mfs->vel_multi;
+ velocity_map[index * 3 + 2] += hit_vel[2] * mfs->vel_multi;
+# ifdef DEBUG_PRINT
+ /* Debugging: Print flow object velocities. */
+ printf("adding flow object vel: [%f, %f, %f]\n", hit_vel[0], hit_vel[1], hit_vel[2]);
+# endif
+ }
+ velocity_map[index * 3] += mfs->vel_coord[0];
+ velocity_map[index * 3 + 1] += mfs->vel_coord[1];
+ velocity_map[index * 3 + 2] += mfs->vel_coord[2];
+ }
}
/* Apply final influence value but also consider volume initialization factor. */