Commit: e8863f0be170db77ecf6a425e909b31a8339d6f7
Author: Sebastián Barschkis
Date:   Sat Jun 11 00:53:13 2016 +0200
Branches: fluid-mantaflow
https://developer.blender.org/rBe8863f0be170db77ecf6a425e909b31a8339d6f7

trying out new liquid inflow values

===================================================================

M       source/blender/blenkernel/intern/smoke.c

===================================================================

diff --git a/source/blender/blenkernel/intern/smoke.c 
b/source/blender/blenkernel/intern/smoke.c
index 94e27e2..832ac1a 100644
--- a/source/blender/blenkernel/intern/smoke.c
+++ b/source/blender/blenkernel/intern/smoke.c
@@ -1550,11 +1550,18 @@ static void sample_derivedmesh(
                }
        }
        
+       // Reset hit tree
+       hit.index = -1;
+       hit.dist = 9999;
+       float first_hit, opposite_hit;
+       
        /* Calculate map which indicates whether point is inside a mesh or not 
*/
        if (BLI_bvhtree_ray_cast(treeData->tree, ray_start, ray_dir, 0.0f, 
&hit, treeData->raycast_callback, treeData) != -1) {
                float dot = ray_dir[0] * hit.no[0] + ray_dir[1] * hit.no[1] + 
ray_dir[2] * hit.no[2];
-
+               /*  If ray and hit face normal are facing same direction
+                *      hit point is inside a closed mesh. */
                if (dot >= 0) {
+                       first_hit = hit.dist;
                        /* Also cast a ray in opposite direction to make sure
                         * point is at least surrounded by two faces */
                        negate_v3(ray_dir);
@@ -1564,7 +1571,8 @@ static void sample_derivedmesh(
                        BLI_bvhtree_ray_cast(treeData->tree, ray_start, 
ray_dir, 0.0f, &hit, treeData->raycast_callback, treeData);
                        
                        if (hit.index != -1) {
-                               inflow_map[index] = -0.5; // Outside mesh (-0.5 
because of mantaflow convention)
+                               opposite_hit = hit.dist;
+                               inflow_map[index] = -MIN2(first_hit, 
opposite_hit); // Inside mesh
                        }
                }
        }

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to