[Bf-blender-cvs] [672caef66fa] fluid-mantaflow: big cleanup for manta directives
Sebastián Barschkis
noreply at git.blender.org
Sat Jul 1 00:51:41 CEST 2017
Commit: 672caef66faefbb615ceb7b442b502c73f50ae5e
Author: Sebastián Barschkis
Date: Sat Jun 24 16:22:58 2017 +0200
Branches: fluid-mantaflow
https://developer.blender.org/rB672caef66faefbb615ceb7b442b502c73f50ae5e
big cleanup for manta directives
very early in the project these directives where set to preserve the functionality of the original smoke code. keeping up this dual compatibility would be an overkill for this branch.
===================================================================
M source/blender/blenkernel/BKE_smoke.h
M source/blender/blenkernel/intern/particle_system.c
M source/blender/blenkernel/intern/pointcache.c
M source/blender/blenkernel/intern/smoke.c
M source/blender/editors/physics/CMakeLists.txt
M source/blender/editors/physics/physics_fluid.c
M source/blender/editors/space_view3d/drawvolume.c
M source/blender/gpu/intern/gpu_draw.c
M source/blender/makesrna/intern/rna_smoke.c
M source/blender/render/intern/source/voxeldata.c
===================================================================
diff --git a/source/blender/blenkernel/BKE_smoke.h b/source/blender/blenkernel/BKE_smoke.h
index 20366f00df6..b4de2f21eb8 100644
--- a/source/blender/blenkernel/BKE_smoke.h
+++ b/source/blender/blenkernel/BKE_smoke.h
@@ -41,7 +41,6 @@ void smoke_reallocate_fluid(struct SmokeDomainSettings *sds, float dx, int res[3
void smoke_reallocate_highres_fluid(struct SmokeDomainSettings *sds, float dx, int res[3], int free_old);
void smokeModifier_free(struct SmokeModifierData *smd);
void smokeModifier_reset(struct SmokeModifierData *smd);
-void smokeModifier_reset_turbulence(struct SmokeModifierData *smd);
void smokeModifier_createType(struct SmokeModifierData *smd);
void smokeModifier_copy(struct SmokeModifierData *smd, struct SmokeModifierData *tsmd);
diff --git a/source/blender/blenkernel/intern/particle_system.c b/source/blender/blenkernel/intern/particle_system.c
index af2e312f48c..48a5dd69c78 100644
--- a/source/blender/blenkernel/intern/particle_system.c
+++ b/source/blender/blenkernel/intern/particle_system.c
@@ -105,8 +105,8 @@
/* manta sim particle import */
#ifdef WITH_MANTA
- #include "DNA_smoke_types.h"
- #include "manta_fluid_API.h"
+# include "DNA_smoke_types.h"
+# include "manta_fluid_API.h"
#endif // WITH_MANTA
static ThreadRWMutex psys_bvhtree_rwlock = BLI_RWLOCK_INITIALIZER;
diff --git a/source/blender/blenkernel/intern/pointcache.c b/source/blender/blenkernel/intern/pointcache.c
index 8e80b269a7c..58da1525c44 100644
--- a/source/blender/blenkernel/intern/pointcache.c
+++ b/source/blender/blenkernel/intern/pointcache.c
@@ -77,10 +77,8 @@
/* both in intern */
#ifdef WITH_SMOKE
-#ifndef WITH_MANTA
- #include "smoke_API.h"
-#else
- #include "manta_fluid_API.h"
+#ifdef WITH_MANTA
+# include "manta_fluid_API.h"
#endif
#endif
@@ -647,11 +645,7 @@ static int ptcache_smoke_write(PTCacheFile *pf, void *smoke_v)
ret = 1;
}
-#ifndef WITH_MANTA
- if (sds->wt) {
-#else
if (sds->fluid && sds->flags & MOD_SMOKE_HIGHRES) {
-#endif
int res_big_array[3];
int res_big;
int res = sds->res[0]*sds->res[1]*sds->res[2];
@@ -661,11 +655,8 @@ static int ptcache_smoke_write(PTCacheFile *pf, void *smoke_v)
unsigned char *out;
int mode;
-#ifndef WITH_MANTA
- smoke_turbulence_get_res(sds->wt, res_big_array);
-#else
smoke_turbulence_get_res(sds->fluid, res_big_array);
-#endif
+
res_big = res_big_array[0]*res_big_array[1]*res_big_array[2];
//mode = res_big >= 1000000 ? 2 : 1;
mode = 1; // light
@@ -673,11 +664,7 @@ static int ptcache_smoke_write(PTCacheFile *pf, void *smoke_v)
in_len_big = sizeof(float) * (unsigned int)res_big;
-#ifndef WITH_MANTA
- smoke_turbulence_export(sds->wt, &dens, &react, &flame, &fuel, &r, &g, &b, &tcu, &tcv, &tcw);
-#else
smoke_turbulence_export(sds->fluid, &dens, &react, &flame, &fuel, &r, &g, &b, &tcu, &tcv, &tcw, &tcu2, &tcv2, &tcw2);
-#endif
out = (unsigned char *)MEM_callocN(LZO_OUT_LEN(in_len_big), "pointcache_lzo_buffer");
ptcache_file_compressed_write(pf, (unsigned char *)dens, in_len_big, out, mode);
@@ -698,11 +685,10 @@ static int ptcache_smoke_write(PTCacheFile *pf, void *smoke_v)
ptcache_file_compressed_write(pf, (unsigned char *)tcv, in_len, out, mode);
ptcache_file_compressed_write(pf, (unsigned char *)tcw, in_len, out, mode);
-#ifdef WITH_MANTA
ptcache_file_compressed_write(pf, (unsigned char *)tcu2, in_len, out, mode);
ptcache_file_compressed_write(pf, (unsigned char *)tcv2, in_len, out, mode);
ptcache_file_compressed_write(pf, (unsigned char *)tcw2, in_len, out, mode);
-#endif
+
MEM_freeN(out);
ret = 1;
@@ -762,30 +748,20 @@ static int ptcache_smoke_read_old(PTCacheFile *pf, void *smoke_v)
MEM_freeN(tmp_array);
-#ifndef WITH_MANTA
- if (pf->data_types & (1<<BPHYS_DATA_SMOKE_HIGH) && sds->wt) {
-#else
if (pf->data_types & (1<<BPHYS_DATA_SMOKE_HIGH) && sds->fluid && sds->flags & MOD_SMOKE_HIGHRES) {
-#endif
int res_big, res_big_array[3];
float *tcu, *tcv, *tcw, *tcu2, *tcv2, *tcw2;
unsigned int out_len_big;
unsigned char *tmp_array_big;
-#ifndef WITH_MANTA
- smoke_turbulence_get_res(sds->wt, res_big_array);
-#else
+
smoke_turbulence_get_res(sds->fluid, res_big_array);
-#endif
+
res_big = res_big_array[0]*res_big_array[1]*res_big_array[2];
out_len_big = sizeof(float) * (unsigned int)res_big;
tmp_array_big = MEM_callocN(out_len_big, "Smoke old cache tmp");
-#ifndef WITH_MANTA
- smoke_turbulence_export(sds->wt, &dens, NULL, NULL, NULL, NULL, NULL, NULL, &tcu, &tcv, &tcw);
-#else
smoke_turbulence_export(sds->fluid, &dens, NULL, NULL, NULL, NULL, NULL, NULL, &tcu, &tcv, &tcw, &tcu2, &tcv2, &tcw2);
-#endif
ptcache_file_compressed_read(pf, (unsigned char*)dens, out_len_big);
ptcache_file_compressed_read(pf, (unsigned char*)tmp_array_big, out_len_big);
@@ -794,11 +770,9 @@ static int ptcache_smoke_read_old(PTCacheFile *pf, void *smoke_v)
ptcache_file_compressed_read(pf, (unsigned char*)tcv, out_len);
ptcache_file_compressed_read(pf, (unsigned char*)tcw, out_len);
-#ifdef WITH_MANTA
ptcache_file_compressed_read(pf, (unsigned char*)tcu2, out_len);
ptcache_file_compressed_read(pf, (unsigned char*)tcv2, out_len);
ptcache_file_compressed_read(pf, (unsigned char*)tcw2, out_len);
-#endif
MEM_freeN(tmp_array_big);
}
@@ -906,30 +880,20 @@ static int ptcache_smoke_read(PTCacheFile *pf, void *smoke_v)
ptcache_file_read(pf, &sds->active_color, 3, sizeof(float));
}
-#ifndef WITH_MANTA
- if (pf->data_types & (1<<BPHYS_DATA_SMOKE_HIGH) && sds->wt) {
-#else
if (pf->data_types & (1<<BPHYS_DATA_SMOKE_HIGH) && sds->fluid && sds->flags & MOD_SMOKE_HIGHRES) {
-#endif
int res = sds->res[0]*sds->res[1]*sds->res[2];
int res_big, res_big_array[3];
float *dens, *react, *fuel, *flame, *tcu, *tcv, *tcw, *tcu2, *tcv2, *tcw2, *r, *g, *b;
unsigned int out_len = sizeof(float)*(unsigned int)res;
unsigned int out_len_big;
-#ifndef WITH_MANTA
- smoke_turbulence_get_res(sds->wt, res_big_array);
-#else
smoke_turbulence_get_res(sds->fluid, res_big_array);
-#endif
+
res_big = res_big_array[0]*res_big_array[1]*res_big_array[2];
out_len_big = sizeof(float) * (unsigned int)res_big;
-#ifndef WITH_MANTA
- smoke_turbulence_export(sds->wt, &dens, &react, &flame, &fuel, &r, &g, &b, &tcu, &tcv, &tcw);
-#else
smoke_turbulence_export(sds->fluid, &dens, &react, &flame, &fuel, &r, &g, &b, &tcu, &tcv, &tcw, &tcu2, &tcv2, &tcw2);
-#endif
+
ptcache_file_compressed_read(pf, (unsigned char *)dens, out_len_big);
if (cache_fields & SM_ACTIVE_FIRE) {
ptcache_file_compressed_read(pf, (unsigned char *)flame, out_len_big);
@@ -946,11 +910,9 @@ static int ptcache_smoke_read(PTCacheFile *pf, void *smoke_v)
ptcache_file_compressed_read(pf, (unsigned char *)tcv, out_len);
ptcache_file_compressed_read(pf, (unsigned char *)tcw, out_len);
-#ifdef WITH_MANTA
ptcache_file_compressed_read(pf, (unsigned char *)tcu2, out_len);
ptcache_file_compressed_read(pf, (unsigned char *)tcv2, out_len);
ptcache_file_compressed_read(pf, (unsigned char *)tcw2, out_len);
-#endif
}
return 1;
@@ -992,11 +954,7 @@ static void compute_fluid_matrices(SmokeDomainSettings *sds)
mul_m4_m4m4(sds->fluidmat, sds->obmat, sds->fluidmat);
-#ifndef WITH_MANTA
- if (sds->wt) {
-#else
if (sds->fluid && sds->flags & MOD_SMOKE_HIGHRES) {
-#endif
float voxel_size_high[3];
/* construct high res matrix */
mul_v3_v3fl(voxel_size_high, sds->cell_size, 1.0f / (float)(sds->amplify + 1));
@@ -1042,19 +1000,11 @@ static int ptcache_smoke_openvdb_write(struct OpenVDBWriter *writer, void *smoke
OpenVDBWriter_add_meta_int(writer, "blender/smoke/fluid_fields", fluid_fields);
-#ifndef WITH_MANTA
- if (sds->wt) {
-#else
if (sds->fluid && sds->flags & MOD_SMOKE_HIGHRES) {
-#endif
struct OpenVDBFloatGrid *wt_density_grid;
float *dens, *react, *fuel, *flame, *tcu, *tcv, *tcw, *tcu2, *tcv2, *tcw2, *r, *g, *b;
-#ifndef WITH_MANTA
- smoke_turbulence_export(sds->wt, &dens, &react, &flame, &fuel, &r, &g, &b, &tcu, &tcv, &tcw);
-#else
smoke_turbulence_export(sds->fluid, &dens, &react, &flame, &fuel, &r, &g, &b, &tcu, &tcv, &tcw, &tcu2, &tcv2, &tcw2);
-#endif
wt_density_grid = OpenVDB_export_grid_fl(writer, "density", dens, sds->res_wt, sds->fluidmat_wt, NULL);
clip_grid = wt_density_grid;
@@ -1214,18 +1164,10 @@ static int ptcache_smoke_openvdb_read(struct OpenVDBReader *reader, void *smoke_
OpenVDB_import_grid_ch(reader, "obstacles", &obstacles, sds->res);
}
-#ifndef WITH_MANTA
- if (sds->wt) {
-#else
if (sds->fluid && sds->flags & MOD_SMOKE_HIGHRES) {
-#endif
float *dens, *react, *fuel, *flame, *tcu, *tcv, *tcw, *tcu2, *tcv2, *tcw2, *r, *g, *b;
-#ifndef WITH_MANTA
- smoke_turbulence_export(sds->wt, &dens, &react, &flame, &fuel, &r, &g, &b, &tcu, &tcv, &tcw);
-#else
smoke_turbulence_export(sds->fluid, &dens, &react, &flame, &fuel, &r, &g, &b, &tcu, &tcv, &tcw, &tcu2, &tcv2, &tcw2);
-#endif
OpenVDB_import_grid_fl(reader, "density", &dens, sds->res_wt);
@@ -1846,13 +1788,8 @@ void BKE_ptcache_id_from_smoke(PTCacheID *pid, struct Object *ob, struct SmokeMo
if (sds->fluid)
pid->data_types |= (1<<BPHYS_DATA_SMOKE_LOW);
-#ifndef WITH_MANTA
- if (sds->wt)
- pid->data_types |= (1<<BPHYS_DATA_SMOKE_HIGH);
-#else
if (sds->fluid && sds->flags & MOD_SMOKE_HIGHRES)
pid->data_types |= (1<<BPHYS_DATA_SMOKE_HIGH);
-#endif
pid->default_step = 1;
pid->max_step = 1;
diff --git a/source/blender/blenkernel/intern/smoke.c b/source/blender/blenkernel/intern/smoke.c
index ade5e36bc87..196982d46d8 100644
--- a/source/blender/blenkernel/intern/smoke.c
+++ b/source/blender/blenkernel/intern/smoke.c
@@ -96,10 +96,8 @@
# include "PIL_time.h"
#endif
-#ifndef WITH_MANTA
- #include "smoke_API.h"
-#else
- #include "manta_fluid_API.h"
+#ifdef WITH_MANTA
+# include "manta_fluid_API.h"
#endif
#ifdef WITH_SMOKE
@@ -140,22 +138,6 @@ float smoke_get_velocity_at(struct Object *UNUSED(ob), float UNUSED(position[3])
void smoke_reallocate_fluid(SmokeDomainSettings *sds, float dx, int res[3], int free_old)
{
-#ifndef WITH_MANTA
- int use_heat = (sds->active_fields & SM_ACTIVE_HEAT);
- int use_fire = (sds->active_fields & SM_A
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list