Smoke:
[blender.git] / intern / smoke / intern / FLUID_3D_STATIC.cpp
index a72009b9abf7d0e5b1944a5820c4fdb3a0b2ec84..f2bbcf3307546e188fa506e6a146e92522cba3e5 100644 (file)
@@ -104,26 +104,14 @@ void FLUID_3D::setNeumannY(float* field, Vec3Int res)
        for (int z = 0; z < res[2]; z++)
                for (int x = 0; x < res[0]; x++)
                {
-                       // bottom slab
+                       // front slab
                        index = x + z * slabSize;
                        field[index] = field[index + 2 * res[0]];
 
-                       // top slab
+                       // back slab
                        index += slabSize - res[0];
                        field[index] = field[index - 2 * res[0]];
                }
-
-       // fix, force top slab to only allow outwards flux
-       for (int z = 0; z < res[2]; z++)
-               for (int x = 0; x < res[0]; x++)
-               {
-                       // top slab
-                       index = x + z * slabSize;
-                       index += slabSize - res[0];
-                       if(field[index]<0.) field[index] = 0.;
-                       index -= res[0];
-                       if(field[index]<0.) field[index] = 0.;
-               }
 }
 
 //////////////////////////////////////////////////////////////////////
@@ -137,14 +125,26 @@ void FLUID_3D::setNeumannZ(float* field, Vec3Int res)
        for (int y = 0; y < res[1]; y++)
                for (int x = 0; x < res[0]; x++)
                {
-                       // front slab
+                       // bottom slab
                        index = x + y * res[0];
                        field[index] = field[index + 2 * slabSize];
 
-                       // back slab
+                       // top slab
                        index += totalCells - slabSize;
                        field[index] = field[index - 2 * slabSize];
                }
+
+       // fix, force top slab to only allow outwards flux
+       for (int y = 0; y < res[1]; y++)
+               for (int x = 0; x < res[0]; x++)
+               {
+                       // top slab
+                       index = x + y * res[0];
+                       index += totalCells - slabSize;
+                       if(field[index]<0.) field[index] = 0.;
+                       index -= slabSize;
+                       if(field[index]<0.) field[index] = 0.;
+               }
 }
 
 //////////////////////////////////////////////////////////////////////