[Bf-blender-cvs] [2c46cadd186] fluid-mantaflow: cleanup in pointcache
Sebastián Barschkis
noreply at git.blender.org
Sun Mar 26 20:41:19 CEST 2017
Commit: 2c46cadd186c53fc5cc553a61a1a78d388664df2
Author: Sebastián Barschkis
Date: Thu Mar 16 17:04:26 2017 +0200
Branches: fluid-mantaflow
https://developer.blender.org/rB2c46cadd186c53fc5cc553a61a1a78d388664df2
cleanup in pointcache
===================================================================
M intern/mantaflow/extern/manta_fluid_API.h
M intern/mantaflow/intern/manta_fluid_API.cpp
M source/blender/blenkernel/intern/pointcache.c
M source/blender/blenkernel/intern/smoke.c
===================================================================
diff --git a/intern/mantaflow/extern/manta_fluid_API.h b/intern/mantaflow/extern/manta_fluid_API.h
index 3ed51e98fc3..134be315393 100644
--- a/intern/mantaflow/extern/manta_fluid_API.h
+++ b/intern/mantaflow/extern/manta_fluid_API.h
@@ -44,7 +44,7 @@ void smoke_manta_export(struct FLUID* smoke, struct SmokeModifierData *smd);
void smoke_step(struct FLUID *smoke, struct SmokeModifierData *smd);
void smoke_dissolve(struct FLUID *smoke, int speed, int log);
void smoke_dissolve_wavelet(struct FLUID *smoke, int speed, int log);
-void smoke_export(struct FLUID *smoke, float *dt, float *dx, float **dens, float **react, float **flame, float **fuel, float **heat, float **smoke_inflow, float **vx, float **vy, float **vz, float **r, float **g, float **b, int **obstacles);
+void smoke_export(struct FLUID *smoke, float *dt, float *dx, float **dens, float **react, float **flame, float **fuel, float **heat, float **vx, float **vy, float **vz, float **r, float **g, float **b, int **obstacles);
void smoke_turbulence_export(struct FLUID *smoke, float **dens, float **react, float **flame, float **fuel, float **r, float **g, float **b , float **tcu, float **tcv, float **tcw, float **tcu2, float **tcv2, float **tcw2);
float *smoke_get_density(struct FLUID *smoke);
float *smoke_get_fuel(struct FLUID *smoke);
diff --git a/intern/mantaflow/intern/manta_fluid_API.cpp b/intern/mantaflow/intern/manta_fluid_API.cpp
index 24c3fc6dbc5..70bbfc632a8 100644
--- a/intern/mantaflow/intern/manta_fluid_API.cpp
+++ b/intern/mantaflow/intern/manta_fluid_API.cpp
@@ -134,7 +134,7 @@ extern "C" void smoke_dissolve_wavelet(FLUID *smoke, int speed, int log)
}
extern "C" void smoke_export(FLUID *smoke, float *dt, float *dx, float **dens, float **react, float **flame, float **fuel, float **heat,
- float **smoke_inflow, float **vx, float **vy, float **vz, float **r, float **g, float **b, int **obstacle)
+ float **vx, float **vy, float **vz, float **r, float **g, float **b, int **obstacle)
{
*dens = smoke->getDensity();
if (fuel)
@@ -145,8 +145,6 @@ extern "C" void smoke_export(FLUID *smoke, float *dt, float *dx, float **dens, f
*flame = smoke->getFlame();
if( heat)
*heat = smoke->getHeat();
- if (smoke_inflow)
- *smoke_inflow = smoke->getDensityInflow();
*vx = smoke->getVelocityX();
*vy = smoke->getVelocityY();
*vz = smoke->getVelocityZ();
diff --git a/source/blender/blenkernel/intern/pointcache.c b/source/blender/blenkernel/intern/pointcache.c
index 2a33b810eaf..6e72496945c 100644
--- a/source/blender/blenkernel/intern/pointcache.c
+++ b/source/blender/blenkernel/intern/pointcache.c
@@ -595,21 +595,20 @@ static int ptcache_smoke_write(PTCacheFile *pf, void *smoke_v)
if (sds->fluid) {
size_t res = sds->res[0]*sds->res[1]*sds->res[2];
- float dt, dx, *dens, *react, *fuel, *flame, *heat, *heatold, *vx, *vy, *vz, *r, *g, *b;
- unsigned char *obstacles;
+ float dt, dx, *dens, *react, *fuel, *flame, *heat, *vx, *vy, *vz, *r, *g, *b;
+ int *obstacles;
unsigned int in_len = sizeof(float)*(unsigned int)res;
unsigned char *out = (unsigned char *)MEM_callocN(LZO_OUT_LEN(in_len) * 4, "pointcache_lzo_buffer");
//int mode = res >= 1000000 ? 2 : 1;
int mode=1; // light
if (sds->cache_comp == SM_CACHE_HEAVY) mode=2; // heavy
- smoke_export(sds->fluid, &dt, &dx, &dens, &react, &flame, &fuel, &heat, &heatold, &vx, &vy, &vz, &r, &g, &b, &obstacles);
+ smoke_export(sds->fluid, &dt, &dx, &dens, &react, &flame, &fuel, &heat, &vx, &vy, &vz, &r, &g, &b, &obstacles);
ptcache_file_compressed_write(pf, (unsigned char *)sds->shadow, in_len, out, mode);
ptcache_file_compressed_write(pf, (unsigned char *)dens, in_len, out, mode);
if (fluid_fields & SM_ACTIVE_HEAT) {
ptcache_file_compressed_write(pf, (unsigned char *)heat, in_len, out, mode);
- ptcache_file_compressed_write(pf, (unsigned char *)heatold, in_len, out, mode);
}
if (fluid_fields & SM_ACTIVE_FIRE) {
ptcache_file_compressed_write(pf, (unsigned char *)flame, in_len, out, mode);
@@ -716,8 +715,8 @@ static int ptcache_smoke_read_old(PTCacheFile *pf, void *smoke_v)
if (sds->fluid) {
const size_t res = sds->res[0] * sds->res[1] * sds->res[2];
const unsigned int out_len = (unsigned int)res * sizeof(float);
- float dt, dx, *dens, *heat, *heatold, *vx, *vy, *vz;
- unsigned char *obstacles;
+ float dt, dx, *dens, *heat, *vx, *vy, *vz;
+ int *obstacles;
float *tmp_array = MEM_callocN(out_len, "Smoke old cache tmp");
int fluid_fields = smoke_get_data_flags(sds);
@@ -727,7 +726,7 @@ static int ptcache_smoke_read_old(PTCacheFile *pf, void *smoke_v)
sds->active_color[1] = 0.7f;
sds->active_color[2] = 0.7f;
- smoke_export(sds->fluid, &dt, &dx, &dens, NULL, NULL, NULL, &heat, &heatold, &vx, &vy, &vz, NULL, NULL, NULL, &obstacles);
+ smoke_export(sds->fluid, &dt, &dx, &dens, NULL, NULL, NULL, &heat, &vx, &vy, &vz, NULL, NULL, NULL, &obstacles);
ptcache_file_compressed_read(pf, (unsigned char *)sds->shadow, out_len);
ptcache_file_compressed_read(pf, (unsigned char*)dens, out_len);
@@ -736,7 +735,6 @@ static int ptcache_smoke_read_old(PTCacheFile *pf, void *smoke_v)
if (fluid_fields & SM_ACTIVE_HEAT)
{
ptcache_file_compressed_read(pf, (unsigned char*)heat, out_len);
- ptcache_file_compressed_read(pf, (unsigned char*)heatold, out_len);
}
else
{
@@ -855,17 +853,16 @@ static int ptcache_smoke_read(PTCacheFile *pf, void *smoke_v)
if (sds->fluid) {
size_t res = sds->res[0]*sds->res[1]*sds->res[2];
- float dt, dx, *dens, *react, *fuel, *flame, *heat, *heatold, *vx, *vy, *vz, *r, *g, *b;
- unsigned char *obstacles;
+ float dt, dx, *dens, *react, *fuel, *flame, *heat, *vx, *vy, *vz, *r, *g, *b;
+ int *obstacles;
unsigned int out_len = (unsigned int)res * sizeof(float);
- smoke_export(sds->fluid, &dt, &dx, &dens, &react, &flame, &fuel, &heat, &heatold, &vx, &vy, &vz, &r, &g, &b, &obstacles);
+ smoke_export(sds->fluid, &dt, &dx, &dens, &react, &flame, &fuel, &heat, &vx, &vy, &vz, &r, &g, &b, &obstacles);
ptcache_file_compressed_read(pf, (unsigned char *)sds->shadow, out_len);
ptcache_file_compressed_read(pf, (unsigned char *)dens, out_len);
if (cache_fields & SM_ACTIVE_HEAT) {
ptcache_file_compressed_read(pf, (unsigned char *)heat, out_len);
- ptcache_file_compressed_read(pf, (unsigned char *)heatold, out_len);
}
if (cache_fields & SM_ACTIVE_FIRE) {
ptcache_file_compressed_read(pf, (unsigned char *)flame, out_len);
@@ -1059,11 +1056,10 @@ static int ptcache_smoke_openvdb_write(struct OpenVDBWriter *writer, void *smoke
if (sds->fluid) {
struct OpenVDBFloatGrid *density_grid;
- float dt, dx, *dens, *react, *fuel, *flame, *heat, *heatold, *vx, *vy, *vz, *r, *g, *b;
- unsigned char *obstacles;
+ float dt, dx, *dens, *react, *fuel, *flame, *heat, *vx, *vy, *vz, *r, *g, *b;
+ int *obstacles;
- smoke_export(sds->fluid, &dt, &dx, &dens, &react, &flame, &fuel, &heat,
- &heatold, &vx, &vy, &vz, &r, &g, &b, &obstacles);
+ smoke_export(sds->fluid, &dt, &dx, &dens, &react, &flame, &fuel, &heat, &vx, &vy, &vz, &r, &g, &b, &obstacles);
OpenVDBWriter_add_meta_fl(writer, "blender/smoke/dx", dx);
OpenVDBWriter_add_meta_fl(writer, "blender/smoke/dt", dt);
@@ -1076,7 +1072,6 @@ static int ptcache_smoke_openvdb_write(struct OpenVDBWriter *writer, void *smoke
if (fluid_fields & SM_ACTIVE_HEAT) {
OpenVDB_export_grid_fl(writer, "heat", heat, sds->res, sds->fluidmat, clip_grid);
- OpenVDB_export_grid_fl(writer, "heat old", heatold, sds->res, sds->fluidmat, clip_grid);
}
if (fluid_fields & SM_ACTIVE_FIRE) {
@@ -1163,11 +1158,10 @@ static int ptcache_smoke_openvdb_read(struct OpenVDBReader *reader, void *smoke_
}
if (sds->fluid) {
- float dt, dx, *dens, *react, *fuel, *flame, *heat, *heatold, *vx, *vy, *vz, *r, *g, *b;
- unsigned char *obstacles;
+ float dt, dx, *dens, *react, *fuel, *flame, *heat, *vx, *vy, *vz, *r, *g, *b;
+ int *obstacles;
- smoke_export(sds->fluid, &dt, &dx, &dens, &react, &flame, &fuel, &heat,
- &heatold, &vx, &vy, &vz, &r, &g, &b, &obstacles);
+ smoke_export(sds->fluid, &dt, &dx, &dens, &react, &flame, &fuel, &heat, &vx, &vy, &vz, &r, &g, &b, &obstacles);
OpenVDBReader_get_meta_fl(reader, "blender/smoke/dt", &dt);
@@ -1178,7 +1172,6 @@ static int ptcache_smoke_openvdb_read(struct OpenVDBReader *reader, void *smoke_
if (cache_fields & SM_ACTIVE_HEAT) {
OpenVDB_import_grid_fl(reader, "heat", &heat, sds->res);
- OpenVDB_import_grid_fl(reader, "heat old", &heatold, sds->res);
}
if (cache_fields & SM_ACTIVE_FIRE) {
diff --git a/source/blender/blenkernel/intern/smoke.c b/source/blender/blenkernel/intern/smoke.c
index 6214d0d6d46..37c1e0e5a31 100644
--- a/source/blender/blenkernel/intern/smoke.c
+++ b/source/blender/blenkernel/intern/smoke.c
@@ -2163,7 +2163,7 @@ static void adjustDomainResolution(SmokeDomainSettings *sds, int new_shift[3], E
struct FLUID_3D *fluid_old = sds->fluid;
struct WTURBULENCE *turb_old = sds->wt;
#else
- struct SMOKE *fluid_old = sds->fluid;
+ struct FLUID *fluid_old = sds->fluid;
#endif
/* allocate new fluid data */
smoke_reallocate_fluid(sds, sds->dx, res, 0);
@@ -2174,17 +2174,17 @@ static void adjustDomainResolution(SmokeDomainSettings *sds, int new_shift[3], E
/* copy values from old fluid to new */
if (sds->total_cells > 1 && total_cells > 1) {
/* low res smoke */
- float *o_dens, *o_react, *o_flame, *o_fuel, *o_heat, *o_heatold, *o_vx, *o_vy, *o_vz, *o_r, *o_g, *o_b;
- float *n_dens, *n_react, *n_flame, *n_fuel, *n_heat, *n_heatold, *n_vx, *n_vy, *n_vz, *n_r, *n_g, *n_b;
+ float *o_dens, *o_react, *o_flame, *o_fuel, *o_heat, *o_vx, *o_vy, *o_vz, *o_r, *o_g, *o_b;
+ float *n_dens, *n_react, *n_flame, *n_fuel, *n_heat, *n_vx, *n_vy, *n_vz, *n_r, *n_g, *n_b;
float dummy;
- unsigned char *dummy_p;
+ int *dummy_p;
/* high res smoke */
int wt_res_old[3];
float *o_wt_dens, *o_wt_react, *o_wt_flame, *o_wt_fuel, *o_wt_tcu, *o_wt_tcv, *o_wt_tcw, *o_wt_tcu2, *o_wt_tcv2, *o_wt_tcw2, *o_wt_r, *o_wt_g, *o_wt_b;
float *n_wt_dens, *n_wt_react, *n_wt_flame, *n_wt_fuel, *n_wt_tcu, *n_wt_tcv, *n_wt_tcw, *n_wt_t
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list