[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [22152] branches/blender2.5/blender/source /blender/blenkernel/intern/smoke.c: Smoke: (hopefully) fix collision high-res smoke disappearance

Daniel Genrich daniel.genrich at gmx.net
Sun Aug 2 20:32:56 CEST 2009


Revision: 22152
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=22152
Author:   genscher
Date:     2009-08-02 20:32:56 +0200 (Sun, 02 Aug 2009)

Log Message:
-----------
Smoke: (hopefully) fix collision high-res smoke disappearance 

Modified Paths:
--------------
    branches/blender2.5/blender/source/blender/blenkernel/intern/smoke.c

Modified: branches/blender2.5/blender/source/blender/blenkernel/intern/smoke.c
===================================================================
--- branches/blender2.5/blender/source/blender/blenkernel/intern/smoke.c	2009-08-02 18:25:26 UTC (rev 22151)
+++ branches/blender2.5/blender/source/blender/blenkernel/intern/smoke.c	2009-08-02 18:32:56 UTC (rev 22152)
@@ -769,7 +769,6 @@
 								for(p=0, pa=psys->particles; p<psys->totpart; p++, pa++)
 								{
 									int cell[3];
-									int valid = 1;
 									size_t i = 0;
 									size_t index = 0;
 									
@@ -786,12 +785,11 @@
 								
 									// check if cell is valid (in the domain boundary)
 									for(i = 0; i < 3; i++)
+									{
 										if((cell[i] > sds->res[i] - 1) || (cell[i] < 0))
-											valid = 0;
+											continue;
+									}
 									
-									if(!valid)
-										continue;
-									
 									// 2. set cell values (heat, density and velocity)
 									index = smoke_get_index(cell[0], sds->res[0], cell[1], sds->res[1], cell[2]);
 									
@@ -1218,15 +1216,15 @@
 
 	if(correct)
 	{
-		cell[0] = MIN2(smd->domain->res[0] - 1, MAX2(0, (int)(tmp[0] + 0.5)));
-		cell[1] = MIN2(smd->domain->res[1] - 1, MAX2(0, (int)(tmp[1] + 0.5)));
-		cell[2] = MIN2(smd->domain->res[2] - 1, MAX2(0, (int)(tmp[2] + 0.5)));
+		cell[0] = MIN2(smd->domain->res[0] - 1, MAX2(0, (int)floor(tmp[0])));
+		cell[1] = MIN2(smd->domain->res[1] - 1, MAX2(0, (int)floor(tmp[1])));
+		cell[2] = MIN2(smd->domain->res[2] - 1, MAX2(0, (int)floor(tmp[2])));
 	}
 	else
 	{
-		cell[0] = (int)(tmp[0] + 0.5);
-		cell[1] = (int)(tmp[1] + 0.5);
-		cell[2] = (int)(tmp[2] + 0.5);
+		cell[0] = (int)floor(tmp[0]);
+		cell[1] = (int)floor(tmp[1]);
+		cell[2] = (int)floor(tmp[2]);
 	}
 }
 static void get_bigcell(struct SmokeModifierData *smd, float *pos, int *cell, int correct)
@@ -1241,15 +1239,15 @@
 
 	if(correct)
 	{
-		cell[0] = MIN2(res[0] - 1, MAX2(0, (int)(tmp[0] + 0.5)));
-		cell[1] = MIN2(res[1] - 1, MAX2(0, (int)(tmp[1] + 0.5)));
-		cell[2] = MIN2(res[2] - 1, MAX2(0, (int)(tmp[2] + 0.5)));
+		cell[0] = MIN2(res[0] - 1, MAX2(0, (int)floor(tmp[0])));
+		cell[1] = MIN2(res[1] - 1, MAX2(0, (int)floor(tmp[1])));
+		cell[2] = MIN2(res[2] - 1, MAX2(0, (int)floor(tmp[2])));
 	}
 	else
 	{
-		cell[0] = (int)(tmp[0] + 0.5);
-		cell[1] = (int)(tmp[1] + 0.5);
-		cell[2] = (int)(tmp[2] + 0.5);
+		cell[0] = (int)floor(tmp[0]);
+		cell[1] = (int)floor(tmp[1]);
+		cell[2] = (int)floor(tmp[2]);
 	}
 }
 





More information about the Bf-blender-cvs mailing list