Cleanup: Fluid renaming from old 'manta' naming to new 'fluid' naming

Changed variable names from mmd, mds, mfs, and mes to fmd, fds, ffs, and fes. The author of this commits lights a candle for all the merge conflicts this will cause.
This commit is contained in:
2020-07-03 11:51:15 +02:00
parent 868d6ba1a7
commit b1d3850333
28 changed files with 2615 additions and 2615 deletions

View File

@@ -79,11 +79,11 @@ void GPU_free_images_anim(struct Main *bmain);
void GPU_free_images_old(struct Main *bmain);
/* gpu_draw_smoke.c */
void GPU_free_smoke(struct FluidModifierData *mmd);
void GPU_free_smoke_velocity(struct FluidModifierData *mmd);
void GPU_create_smoke(struct FluidModifierData *mmd, int highres);
void GPU_create_smoke_coba_field(struct FluidModifierData *mmd);
void GPU_create_smoke_velocity(struct FluidModifierData *mmd);
void GPU_free_smoke(struct FluidModifierData *fmd);
void GPU_free_smoke_velocity(struct FluidModifierData *fmd);
void GPU_create_smoke(struct FluidModifierData *fmd, int highres);
void GPU_create_smoke_coba_field(struct FluidModifierData *fmd);
void GPU_create_smoke_velocity(struct FluidModifierData *fmd);
/* Delayed free of OpenGL buffers by main thread */
void GPU_free_unused_buffers(void);

View File

@@ -132,74 +132,74 @@ static void swizzle_texture_channel_single(GPUTexture *tex)
GPU_texture_unbind(tex);
}
static GPUTexture *create_field_texture(FluidDomainSettings *mds)
static GPUTexture *create_field_texture(FluidDomainSettings *fds)
{
float *field = NULL;
switch (mds->coba_field) {
switch (fds->coba_field) {
case FLUID_DOMAIN_FIELD_DENSITY:
field = manta_smoke_get_density(mds->fluid);
field = manta_smoke_get_density(fds->fluid);
break;
case FLUID_DOMAIN_FIELD_HEAT:
field = manta_smoke_get_heat(mds->fluid);
field = manta_smoke_get_heat(fds->fluid);
break;
case FLUID_DOMAIN_FIELD_FUEL:
field = manta_smoke_get_fuel(mds->fluid);
field = manta_smoke_get_fuel(fds->fluid);
break;
case FLUID_DOMAIN_FIELD_REACT:
field = manta_smoke_get_react(mds->fluid);
field = manta_smoke_get_react(fds->fluid);
break;
case FLUID_DOMAIN_FIELD_FLAME:
field = manta_smoke_get_flame(mds->fluid);
field = manta_smoke_get_flame(fds->fluid);
break;
case FLUID_DOMAIN_FIELD_VELOCITY_X:
field = manta_get_velocity_x(mds->fluid);
field = manta_get_velocity_x(fds->fluid);
break;
case FLUID_DOMAIN_FIELD_VELOCITY_Y:
field = manta_get_velocity_y(mds->fluid);
field = manta_get_velocity_y(fds->fluid);
break;
case FLUID_DOMAIN_FIELD_VELOCITY_Z:
field = manta_get_velocity_z(mds->fluid);
field = manta_get_velocity_z(fds->fluid);
break;
case FLUID_DOMAIN_FIELD_COLOR_R:
field = manta_smoke_get_color_r(mds->fluid);
field = manta_smoke_get_color_r(fds->fluid);
break;
case FLUID_DOMAIN_FIELD_COLOR_G:
field = manta_smoke_get_color_g(mds->fluid);
field = manta_smoke_get_color_g(fds->fluid);
break;
case FLUID_DOMAIN_FIELD_COLOR_B:
field = manta_smoke_get_color_b(mds->fluid);
field = manta_smoke_get_color_b(fds->fluid);
break;
case FLUID_DOMAIN_FIELD_FORCE_X:
field = manta_get_force_x(mds->fluid);
field = manta_get_force_x(fds->fluid);
break;
case FLUID_DOMAIN_FIELD_FORCE_Y:
field = manta_get_force_y(mds->fluid);
field = manta_get_force_y(fds->fluid);
break;
case FLUID_DOMAIN_FIELD_FORCE_Z:
field = manta_get_force_z(mds->fluid);
field = manta_get_force_z(fds->fluid);
break;
default:
return NULL;
}
GPUTexture *tex = GPU_texture_create_nD(
mds->res[0], mds->res[1], mds->res[2], 3, field, GPU_R8, GPU_DATA_FLOAT, 0, true, NULL);
fds->res[0], fds->res[1], fds->res[2], 3, field, GPU_R8, GPU_DATA_FLOAT, 0, true, NULL);
swizzle_texture_channel_single(tex);
return tex;
}
static GPUTexture *create_density_texture(FluidDomainSettings *mds, int highres)
static GPUTexture *create_density_texture(FluidDomainSettings *fds, int highres)
{
int *dim = (highres) ? mds->res_noise : mds->res;
int *dim = (highres) ? fds->res_noise : fds->res;
float *data;
if (highres) {
data = manta_smoke_turbulence_get_density(mds->fluid);
data = manta_smoke_turbulence_get_density(fds->fluid);
}
else {
data = manta_smoke_get_density(mds->fluid);
data = manta_smoke_get_density(fds->fluid);
}
GPUTexture *tex = GPU_texture_create_nD(
@@ -210,17 +210,17 @@ static GPUTexture *create_density_texture(FluidDomainSettings *mds, int highres)
return tex;
}
static GPUTexture *create_color_texture(FluidDomainSettings *mds, int highres)
static GPUTexture *create_color_texture(FluidDomainSettings *fds, int highres)
{
const bool has_color = (highres) ? manta_smoke_turbulence_has_colors(mds->fluid) :
manta_smoke_has_colors(mds->fluid);
const bool has_color = (highres) ? manta_smoke_turbulence_has_colors(fds->fluid) :
manta_smoke_has_colors(fds->fluid);
if (!has_color) {
return NULL;
}
int cell_count = (highres) ? manta_smoke_turbulence_get_cells(mds->fluid) : mds->total_cells;
int *dim = (highres) ? mds->res_noise : mds->res;
int cell_count = (highres) ? manta_smoke_turbulence_get_cells(fds->fluid) : fds->total_cells;
int *dim = (highres) ? fds->res_noise : fds->res;
float *data = MEM_callocN(sizeof(float) * cell_count * 4, "smokeColorTexture");
if (data == NULL) {
@@ -228,10 +228,10 @@ static GPUTexture *create_color_texture(FluidDomainSettings *mds, int highres)
}
if (highres) {
manta_smoke_turbulence_get_rgba(mds->fluid, data, 0);
manta_smoke_turbulence_get_rgba(fds->fluid, data, 0);
}
else {
manta_smoke_get_rgba(mds->fluid, data, 0);
manta_smoke_get_rgba(fds->fluid, data, 0);
}
GPUTexture *tex = GPU_texture_create_nD(
@@ -242,22 +242,22 @@ static GPUTexture *create_color_texture(FluidDomainSettings *mds, int highres)
return tex;
}
static GPUTexture *create_flame_texture(FluidDomainSettings *mds, int highres)
static GPUTexture *create_flame_texture(FluidDomainSettings *fds, int highres)
{
float *source = NULL;
const bool has_fuel = (highres) ? manta_smoke_turbulence_has_fuel(mds->fluid) :
manta_smoke_has_fuel(mds->fluid);
int *dim = (highres) ? mds->res_noise : mds->res;
const bool has_fuel = (highres) ? manta_smoke_turbulence_has_fuel(fds->fluid) :
manta_smoke_has_fuel(fds->fluid);
int *dim = (highres) ? fds->res_noise : fds->res;
if (!has_fuel) {
return NULL;
}
if (highres) {
source = manta_smoke_turbulence_get_flame(mds->fluid);
source = manta_smoke_turbulence_get_flame(fds->fluid);
}
else {
source = manta_smoke_get_flame(mds->fluid);
source = manta_smoke_get_flame(fds->fluid);
}
GPUTexture *tex = GPU_texture_create_nD(
@@ -276,90 +276,90 @@ static GPUTexture *create_flame_texture(FluidDomainSettings *mds, int highres)
/** \name Public API
* \{ */
void GPU_free_smoke(FluidModifierData *mmd)
void GPU_free_smoke(FluidModifierData *fmd)
{
if (mmd->type & MOD_FLUID_TYPE_DOMAIN && mmd->domain) {
if (mmd->domain->tex_density) {
GPU_texture_free(mmd->domain->tex_density);
mmd->domain->tex_density = NULL;
if (fmd->type & MOD_FLUID_TYPE_DOMAIN && fmd->domain) {
if (fmd->domain->tex_density) {
GPU_texture_free(fmd->domain->tex_density);
fmd->domain->tex_density = NULL;
}
if (mmd->domain->tex_color) {
GPU_texture_free(mmd->domain->tex_color);
mmd->domain->tex_color = NULL;
if (fmd->domain->tex_color) {
GPU_texture_free(fmd->domain->tex_color);
fmd->domain->tex_color = NULL;
}
if (mmd->domain->tex_shadow) {
GPU_texture_free(mmd->domain->tex_shadow);
mmd->domain->tex_shadow = NULL;
if (fmd->domain->tex_shadow) {
GPU_texture_free(fmd->domain->tex_shadow);
fmd->domain->tex_shadow = NULL;
}
if (mmd->domain->tex_flame) {
GPU_texture_free(mmd->domain->tex_flame);
mmd->domain->tex_flame = NULL;
if (fmd->domain->tex_flame) {
GPU_texture_free(fmd->domain->tex_flame);
fmd->domain->tex_flame = NULL;
}
if (mmd->domain->tex_flame_coba) {
GPU_texture_free(mmd->domain->tex_flame_coba);
mmd->domain->tex_flame_coba = NULL;
if (fmd->domain->tex_flame_coba) {
GPU_texture_free(fmd->domain->tex_flame_coba);
fmd->domain->tex_flame_coba = NULL;
}
if (mmd->domain->tex_coba) {
GPU_texture_free(mmd->domain->tex_coba);
mmd->domain->tex_coba = NULL;
if (fmd->domain->tex_coba) {
GPU_texture_free(fmd->domain->tex_coba);
fmd->domain->tex_coba = NULL;
}
if (mmd->domain->tex_field) {
GPU_texture_free(mmd->domain->tex_field);
mmd->domain->tex_field = NULL;
if (fmd->domain->tex_field) {
GPU_texture_free(fmd->domain->tex_field);
fmd->domain->tex_field = NULL;
}
}
}
void GPU_create_smoke_coba_field(FluidModifierData *mmd)
void GPU_create_smoke_coba_field(FluidModifierData *fmd)
{
#ifndef WITH_FLUID
UNUSED_VARS(mmd);
UNUSED_VARS(fmd);
#else
if (mmd->type & MOD_FLUID_TYPE_DOMAIN) {
FluidDomainSettings *mds = mmd->domain;
if (fmd->type & MOD_FLUID_TYPE_DOMAIN) {
FluidDomainSettings *fds = fmd->domain;
if (!mds->tex_field) {
mds->tex_field = create_field_texture(mds);
if (!fds->tex_field) {
fds->tex_field = create_field_texture(fds);
}
if (!mds->tex_coba) {
mds->tex_coba = create_transfer_function(TFUNC_COLOR_RAMP, mds->coba);
if (!fds->tex_coba) {
fds->tex_coba = create_transfer_function(TFUNC_COLOR_RAMP, fds->coba);
}
}
#endif
}
void GPU_create_smoke(FluidModifierData *mmd, int highres)
void GPU_create_smoke(FluidModifierData *fmd, int highres)
{
#ifndef WITH_FLUID
UNUSED_VARS(mmd, highres);
UNUSED_VARS(fmd, highres);
#else
if (mmd->type & MOD_FLUID_TYPE_DOMAIN) {
FluidDomainSettings *mds = mmd->domain;
if (fmd->type & MOD_FLUID_TYPE_DOMAIN) {
FluidDomainSettings *fds = fmd->domain;
if (!mds->tex_density) {
mds->tex_density = create_density_texture(mds, highres);
if (!fds->tex_density) {
fds->tex_density = create_density_texture(fds, highres);
}
if (!mds->tex_color) {
mds->tex_color = create_color_texture(mds, highres);
if (!fds->tex_color) {
fds->tex_color = create_color_texture(fds, highres);
}
if (!mds->tex_flame) {
mds->tex_flame = create_flame_texture(mds, highres);
if (!fds->tex_flame) {
fds->tex_flame = create_flame_texture(fds, highres);
}
if (!mds->tex_flame_coba && mds->tex_flame) {
mds->tex_flame_coba = create_transfer_function(TFUNC_FLAME_SPECTRUM, NULL);
if (!fds->tex_flame_coba && fds->tex_flame) {
fds->tex_flame_coba = create_transfer_function(TFUNC_FLAME_SPECTRUM, NULL);
}
if (!mds->tex_shadow) {
mds->tex_shadow = GPU_texture_create_nD(mds->res[0],
mds->res[1],
mds->res[2],
if (!fds->tex_shadow) {
fds->tex_shadow = GPU_texture_create_nD(fds->res[0],
fds->res[1],
fds->res[2],
3,
manta_smoke_get_shadow(mds->fluid),
manta_smoke_get_shadow(fds->fluid),
GPU_R8,
GPU_DATA_FLOAT,
0,
@@ -370,53 +370,53 @@ void GPU_create_smoke(FluidModifierData *mmd, int highres)
#endif /* WITH_FLUID */
}
void GPU_create_smoke_velocity(FluidModifierData *mmd)
void GPU_create_smoke_velocity(FluidModifierData *fmd)
{
#ifndef WITH_FLUID
UNUSED_VARS(mmd);
UNUSED_VARS(fmd);
#else
if (mmd->type & MOD_FLUID_TYPE_DOMAIN) {
FluidDomainSettings *mds = mmd->domain;
if (fmd->type & MOD_FLUID_TYPE_DOMAIN) {
FluidDomainSettings *fds = fmd->domain;
const float *vel_x = manta_get_velocity_x(mds->fluid);
const float *vel_y = manta_get_velocity_y(mds->fluid);
const float *vel_z = manta_get_velocity_z(mds->fluid);
const float *vel_x = manta_get_velocity_x(fds->fluid);
const float *vel_y = manta_get_velocity_y(fds->fluid);
const float *vel_z = manta_get_velocity_z(fds->fluid);
if (ELEM(NULL, vel_x, vel_y, vel_z)) {
return;
}
if (!mds->tex_velocity_x) {
mds->tex_velocity_x = GPU_texture_create_3d(
mds->res[0], mds->res[1], mds->res[2], GPU_R16F, vel_x, NULL);
mds->tex_velocity_y = GPU_texture_create_3d(
mds->res[0], mds->res[1], mds->res[2], GPU_R16F, vel_y, NULL);
mds->tex_velocity_z = GPU_texture_create_3d(
mds->res[0], mds->res[1], mds->res[2], GPU_R16F, vel_z, NULL);
if (!fds->tex_velocity_x) {
fds->tex_velocity_x = GPU_texture_create_3d(
fds->res[0], fds->res[1], fds->res[2], GPU_R16F, vel_x, NULL);
fds->tex_velocity_y = GPU_texture_create_3d(
fds->res[0], fds->res[1], fds->res[2], GPU_R16F, vel_y, NULL);
fds->tex_velocity_z = GPU_texture_create_3d(
fds->res[0], fds->res[1], fds->res[2], GPU_R16F, vel_z, NULL);
}
}
#endif /* WITH_FLUID */
}
/* TODO Unify with the other GPU_free_smoke. */
void GPU_free_smoke_velocity(FluidModifierData *mmd)
void GPU_free_smoke_velocity(FluidModifierData *fmd)
{
if (mmd->type & MOD_FLUID_TYPE_DOMAIN && mmd->domain) {
if (mmd->domain->tex_velocity_x) {
GPU_texture_free(mmd->domain->tex_velocity_x);
if (fmd->type & MOD_FLUID_TYPE_DOMAIN && fmd->domain) {
if (fmd->domain->tex_velocity_x) {
GPU_texture_free(fmd->domain->tex_velocity_x);
}
if (mmd->domain->tex_velocity_y) {
GPU_texture_free(mmd->domain->tex_velocity_y);
if (fmd->domain->tex_velocity_y) {
GPU_texture_free(fmd->domain->tex_velocity_y);
}
if (mmd->domain->tex_velocity_z) {
GPU_texture_free(mmd->domain->tex_velocity_z);
if (fmd->domain->tex_velocity_z) {
GPU_texture_free(fmd->domain->tex_velocity_z);
}
mmd->domain->tex_velocity_x = NULL;
mmd->domain->tex_velocity_y = NULL;
mmd->domain->tex_velocity_z = NULL;
fmd->domain->tex_velocity_x = NULL;
fmd->domain->tex_velocity_y = NULL;
fmd->domain->tex_velocity_z = NULL;
}
}