[Bf-blender-cvs] [db26bdd] soc-2014-fluid: writing correct density emitter to file
Roman Pogribnyi
noreply at git.blender.org
Wed Oct 15 19:53:38 CEST 2014
Commit: db26bdd36fc7669778edbcfcbea808000c4cad6e
Author: Roman Pogribnyi
Date: Sat Sep 27 13:53:41 2014 +0200
Branches: soc-2014-fluid
https://developer.blender.org/rBdb26bdd36fc7669778edbcfcbea808000c4cad6e
writing correct density emitter to file
===================================================================
M intern/smoke/intern/scenarios/smoke.h
M source/blender/python/manta_pp/pwrapper/pymain.cpp
===================================================================
diff --git a/intern/smoke/intern/scenarios/smoke.h b/intern/smoke/intern/scenarios/smoke.h
index 270996e..1c9d72c 100644
--- a/intern/smoke/intern/scenarios/smoke.h
+++ b/intern/smoke/intern/scenarios/smoke.h
@@ -39,6 +39,7 @@ noise.timeAnim = 0.2\n\
flags.initDomain()\n\
flags.fillGrid()\n\
\n\
+source_grid = s.create(RealGrid)\n\
source = s.create(Mesh)\n\
forces = s.create(MACGrid)\n\
dict_loaded = dict()\n";
@@ -82,11 +83,9 @@ const string smoke_step_low = "def sim_step(t):\n\
print('First frame: loading flows and obstacles')\n\
source.load('manta_flow.obj')\n\
transform_back(source, gs)\n\
- if noise.valScale > 0.:\n\
- densityInflowMeshNoise( flags=flags, density=density, noise=noise, mesh=source, scale=3, sigma=0.5 )\n\
- else:\n\
- densityInflowMesh(flags=flags, density=density, mesh=source, value=1)\n\
- applyInflow=True\n\
+ #load emission data\n\
+ source_grid.load('manta_em_influence.uni')\n\
+ density.add(source_grid)\n\
\n\
\n\
advectSemiLagrange(flags=flags, vel=vel, grid=density, order=2)\n\
diff --git a/source/blender/python/manta_pp/pwrapper/pymain.cpp b/source/blender/python/manta_pp/pwrapper/pymain.cpp
index c33e417..50b6480 100644
--- a/source/blender/python/manta_pp/pwrapper/pymain.cpp
+++ b/source/blender/python/manta_pp/pwrapper/pymain.cpp
@@ -98,25 +98,22 @@ void export_em_fields(int min_x, int min_y, int min_z, int max_x, int max_y, int
// assert(vel != NULL);
FluidSolver dummy(Vec3i(d_x,d_y,d_z));
Grid<Real> em_inf_fields(&dummy, false);
+ em_inf_fields.clear();
Grid<Vec3> em_vel_fields(&dummy, false);
int index(0);
- for (int x=0; x < d_x; ++x)
+ Vec3i em_size(max_x - min_x, max_y - min_y, max_z - min_z);
+ int em_size_x =em_size[0];
+ int em_size_xy = em_size[0] * em_size[1];
+ for (int x=0; x < em_size[0]; ++x)
{
- for (int y=0; y < d_y; ++y)
+ for (int y=0; y < em_size[1]; ++y)
{
- for (int z=0; z < d_z; ++z)
+ for (int z=0; z < em_size[2]; ++z)
{
- if (x < min_x || y < min_y || z < min_z || x > max_x || y > max_y || z > max_z){
- em_inf_fields.get(x, y, z) = 0.;
- if(vel != NULL)
- em_vel_fields.get(x, y, z) = 0.;
- }
- else{
- index = x + y * d_x + z * d_x * d_y;
- em_inf_fields.get(x, y, z) = inf[index];//f_x[x],f_y[y],f_z[z]);
- if(vel != NULL)
- em_vel_fields.get(x, y, z) = Vec3(vel[index*3],vel[index*3+1],vel[index*3+2]);
- }
+ index = x + y * em_size_x + z * em_size_xy;
+ em_inf_fields.get(x + min_x, y + min_y, z + min_z) = inf[index];//f_x[x],f_y[y],f_z[z]);
+// if(vel != NULL)
+// em_vel_fields.get(x, y, z) = Vec3(vel[index*3],vel[index*3+1],vel[index*3+2]);
}
}
}
More information about the Bf-blender-cvs
mailing list