[Bf-blender-cvs] [17d51b6] fluid-mantaflow: cleanup liquid inflow functions
Sebastián Barschkis
noreply at git.blender.org
Thu Jun 30 00:39:27 CEST 2016
Commit: 17d51b6d097dd6a42134c36db1c62245f8b9438c
Author: Sebastián Barschkis
Date: Sat Jun 25 15:34:04 2016 +0200
Branches: fluid-mantaflow
https://developer.blender.org/rB17d51b6d097dd6a42134c36db1c62245f8b9438c
cleanup liquid inflow functions
===================================================================
M source/blender/blenkernel/intern/smoke.c
===================================================================
diff --git a/source/blender/blenkernel/intern/smoke.c b/source/blender/blenkernel/intern/smoke.c
index 9b2bcf1..8b72e02 100644
--- a/source/blender/blenkernel/intern/smoke.c
+++ b/source/blender/blenkernel/intern/smoke.c
@@ -1550,108 +1550,6 @@ static void sample_derivedmesh(
}
}
- /*****************************************************
- * Old inflow based on surface distance
- *****************************************************/
-
-// // 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);
-// hit.index = -1;
-// hit.dist = 9999;
-//
-// BLI_bvhtree_ray_cast(treeData->tree, ray_start, ray_dir, 0.0f, &hit, treeData->raycast_callback, treeData);
-//
-// if (hit.index != -1) {
-// opposite_hit = hit.dist;
-// inflow_map[index] = -MIN2(first_hit, opposite_hit); // Inside mesh
-// }
-// }
-// }
-
- /*****************************************************
- * Better liquid inflow based on raycasts in all 6 directions
- *****************************************************/
-
- // Reset hit tree
-// BVHTreeRayHit hit_x = {0};
-// BVHTreeRayHit hit_y = {0};
-// BVHTreeRayHit hit_z = {0};
-//
-// hit_x.index = -1;
-// hit_x.dist = 9999;
-//
-// hit_y.index = -1;
-// hit_y.dist = 9999;
-//
-// hit_z.index = -1;
-// hit_z.dist = 9999;
-//
-// float dist_x_pos, dist_y_pos, dist_z_pos, dist_x_neg, dist_y_neg, dist_z_neg;
-// float min_dist_x, min_dist_y, min_dist_z;
-// float ray_dir_x[3] = {1.0f, 0.0f, 0.0f};
-// float ray_dir_y[3] = {0.0f, 1.0f, 0.0f};
-// float ray_dir_z[3] = {0.0f, 0.0f, 1.0f};
-//
-// /* Calculate map which indicates whether point is inside a mesh or not */
-// if (BLI_bvhtree_ray_cast(treeData->tree, ray_start, ray_dir_x, 0.0f, &hit_x, treeData->raycast_callback, treeData) != -1 ||
-// BLI_bvhtree_ray_cast(treeData->tree, ray_start, ray_dir_y, 0.0f, &hit_y, treeData->raycast_callback, treeData) != -1 ||
-// BLI_bvhtree_ray_cast(treeData->tree, ray_start, ray_dir_z, 0.0f, &hit_z, treeData->raycast_callback, treeData) != -1)
-// {
-// dist_x_pos = hit_x.dist;
-// dist_y_pos = hit_y.dist;
-// dist_z_pos = hit_z.dist;
-//
-// float dot_x = ray_dir_x[0] * hit_x.no[0] + ray_dir_x[1] * hit_x.no[1] + ray_dir_x[2] * hit_x.no[2];
-// float dot_y = ray_dir_y[0] * hit_y.no[0] + ray_dir_y[1] * hit_y.no[1] + ray_dir_y[2] * hit_y.no[2];
-// float dot_z = ray_dir_z[0] * hit_z.no[0] + ray_dir_z[1] * hit_z.no[1] + ray_dir_z[2] * hit_z.no[2];
-//
-// if (dot_x >= 0 && dot_y >= 0 && dot_z >= 0) {
-//
-// /* Also cast a ray in opposite direction to make sure
-// * point is at least surrounded by two faces */
-// negate_v3(ray_dir_x);
-// negate_v3(ray_dir_y);
-// negate_v3(ray_dir_z);
-//
-// hit_x.index = -1;
-// hit_x.dist = 9999;
-//
-// hit_y.index = -1;
-// hit_y.dist = 9999;
-//
-// hit_z.index = -1;
-// hit_z.dist = 9999;
-//
-// if (BLI_bvhtree_ray_cast(treeData->tree, ray_start, ray_dir_x, 0.0f, &hit_x, treeData->raycast_callback, treeData) != -1 &&
-// BLI_bvhtree_ray_cast(treeData->tree, ray_start, ray_dir_y, 0.0f, &hit_y, treeData->raycast_callback, treeData) != -1 &&
-// BLI_bvhtree_ray_cast(treeData->tree, ray_start, ray_dir_z, 0.0f, &hit_z, treeData->raycast_callback, treeData) != -1)
-// {
-// dist_x_neg = hit_x.dist;
-// dist_y_neg = hit_y.dist;
-// dist_z_neg = hit_z.dist;
-//
-// min_dist_x = MIN2(dist_x_pos, dist_x_neg);
-// min_dist_y = MIN2(dist_y_pos, dist_y_neg);
-// min_dist_z = MIN2(dist_z_pos, dist_z_neg);
-//
-// inflow_map[index] = -MIN3(min_dist_x, min_dist_y, min_dist_z);
-// }
-// }
-// }
-
/*****************************************************/
/* Calculate map which indicates whether point is inside a mesh or not */
@@ -2283,7 +2181,7 @@ BLI_INLINE void apply_inflow_fields(SmokeFlowSettings *sfs, float emission_value
{
/* add liquid inflow */
if (phi) {
- if (inflow_value < 0) phi[index] = inflow_value; // Only copy values of points inside a mesh
+ phi[index] = inflow_value;
return;
}
int absolute_flow = (sfs->flags & MOD_SMOKE_FLOW_ABSOLUTE);
@@ -2950,6 +2848,7 @@ static DerivedMesh *createLiquidMesh(SmokeDomainSettings *sds, DerivedMesh *orgd
// Vertices
for (i = 0; i < num_verts; i++, mverts++)
{
+
mverts->co[0] = liquid_get_vertice_x_at(sds->fluid, i);
mverts->co[1] = liquid_get_vertice_y_at(sds->fluid, i);
mverts->co[2] = liquid_get_vertice_z_at(sds->fluid, i);
More information about the Bf-blender-cvs
mailing list