diff options
author | Daniel Genrich <daniel.genrich@gmx.net> | 2010-01-25 18:10:14 +0300 |
---|---|---|
committer | Daniel Genrich <daniel.genrich@gmx.net> | 2010-01-25 18:10:14 +0300 |
commit | 83dfade37a746043dfc8d38f57514706d8505352 (patch) | |
tree | 71d291a00799e67ecc6d39a5c5fc2117037a1328 /source/blender/blenkernel/intern/smoke.c | |
parent | 4b71eaa4d14af6f43c15f97d8bf70506afad724b (diff) |
Smoke: The well known Miika Hämäläinen (aka MiikaH) patch (http://blenderartists.org/forum/showthread.php?t=158317&page=42)
* Better (and windows enabled) OpenMP handling (> 2x-5x speed)
* More Volumetric Texture mapping options (heat, etc) <-- Matt if that's not to your liking, just revert that part, it's separate anyway
* Initial velocity taken from particle settings (no more slow starting)
* Option to select compression method (there seem to be a bug in my high compression usage, at least it's been reported to result in exploding smoke - better use low compression for the time being)
It's been tested since a while but as usual please report any (new!) bugs. ;-)
Diffstat (limited to 'source/blender/blenkernel/intern/smoke.c')
-rw-r--r-- | source/blender/blenkernel/intern/smoke.c | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/source/blender/blenkernel/intern/smoke.c b/source/blender/blenkernel/intern/smoke.c index 0a106b1920d..e921dadb9ba 100644 --- a/source/blender/blenkernel/intern/smoke.c +++ b/source/blender/blenkernel/intern/smoke.c @@ -872,11 +872,13 @@ static void smoke_calc_domain(Scene *scene, Object *ob, SmokeModifierData *smd) heat[index] = sfs->temp; density[index] = sfs->density; - /* + + // Uses particle velocity as initial velocity for smoke + if(smd->domain->flags & MOD_SMOKE_INITVELOCITY) { velocity_x[index] = pa->state.vel[0]; velocity_y[index] = pa->state.vel[1]; velocity_z[index] = pa->state.vel[2]; - */ + } // obstacle[index] |= 2; // we need different handling for the high-res feature @@ -1396,8 +1398,9 @@ static void get_cell(float *p0, int res[3], float dx, float *pos, int *cell, int static void smoke_calc_transparency(float *result, float *input, float *p0, float *p1, int res[3], float dx, float *light, bresenham_callback cb, float correct) { - int x, y, z; + int z; float bv[6]; + int slabsize=res[0]*res[1]; memset(result, -1, sizeof(float)*res[0]*res[1]*res[2]); // x bv[0] = p0[0]; @@ -1409,19 +1412,20 @@ static void smoke_calc_transparency(float *result, float *input, float *p0, floa bv[4] = p0[2]; bv[5] = p1[2]; -#pragma omp parallel for schedule(static) private(y, z) - for(x = 0; x < res[0]; x++) +#pragma omp parallel for schedule(static,1) + for(z = 0; z < res[2]; z++) + { + size_t index = z*slabsize; + int x,y; + for(y = 0; y < res[1]; y++) - for(z = 0; z < res[2]; z++) + for(x = 0; x < res[0]; x++, index++) { float voxelCenter[3]; - size_t index; float pos[3]; int cell[3]; float tRay = 1.0; - index = smoke_get_index(x, res[0], y, res[1], z); - if(result[index] >= 0.0f) continue; voxelCenter[0] = p0[0] + dx * x + dx * 0.5; @@ -1446,5 +1450,6 @@ static void smoke_calc_transparency(float *result, float *input, float *p0, floa // #pragma omp critical result[index] = tRay; } + } } |