[Bf-blender-cvs] [c131e0059c6] fluid-mantaflow: fix for levelset generation

Sebastián Barschkis noreply at git.blender.org
Sun Nov 19 18:52:05 CET 2017


Commit: c131e0059c6606e06b9bd6d7bc6ad7f0214aa92d
Author: Sebastián Barschkis
Date:   Sun Nov 19 18:51:29 2017 +0100
Branches: fluid-mantaflow
https://developer.blender.org/rBc131e0059c6606e06b9bd6d7bc6ad7f0214aa92d

fix for levelset generation

bad array init prevented outer levelset region from being set correctly

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

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

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

diff --git a/source/blender/blenkernel/intern/smoke.c b/source/blender/blenkernel/intern/smoke.c
index 455b93cb6b8..029875df47f 100644
--- a/source/blender/blenkernel/intern/smoke.c
+++ b/source/blender/blenkernel/intern/smoke.c
@@ -1244,7 +1244,7 @@ static void em_allocateData(EmissionMap *em, bool use_velocity, int hires_mul)
 		em->velocity = MEM_callocN(sizeof(float) * em->total_cells * 3, "smoke_flow_velocity");
 	
 	em->distances = MEM_callocN(sizeof(float) * em->total_cells, "fluid_flow_distances");
-	memset(em->distances, 9999, sizeof(float) * em->total_cells);
+	memset(em->distances, 0x7f7f7f7f, sizeof(float) * em->total_cells); // init to inf
 
 	/* allocate high resolution map if required */
 	if (hires_mul > 1) {
@@ -1258,7 +1258,7 @@ static void em_allocateData(EmissionMap *em, bool use_velocity, int hires_mul)
 
 		em->influence_high = MEM_callocN(sizeof(float) * total_cells_high, "smoke_flow_influence_high");
 		em->distances_high = MEM_callocN(sizeof(float) * total_cells_high, "fluid_flow_distances_high");
-		memset(em->distances_high, 9999, sizeof(float) * total_cells_high);
+		memset(em->distances_high, 0x7f7f7f7f, sizeof(float) * total_cells_high); // init to inf
 	}
 	em->valid = 1;
 }
@@ -1628,7 +1628,7 @@ static void emit_from_particles(
 /* Calculate map of (minimum) distances to flow/obstacle surface. Distances outside mesh are positive, inside negative */
 static void update_mesh_distances(int index, float *mesh_distances, BVHTreeFromMesh *treeData, const float ray_start[3], float surface_thickness) {
 
-	float min_dist = 9999;
+	float min_dist = 9999.f;
 
 	/* Raycasts in 26 directions (6 main axis + 12 quadrant diagonals (2D) + 8 octant diagonals (3D)) */
 	float ray_dirs[26][3] = { {  1.0f, 0.0f,  0.0f }, { 0.0f,  1.0f,  0.0f }, {  0.0f,  0.0f,  1.0f },



More information about the Bf-blender-cvs mailing list