[Bf-blender-cvs] [62a819202e7] master: Fluid: Refactored smoke noise system

Sebastián Barschkis noreply at git.blender.org
Mon Jul 20 18:39:53 CEST 2020


Commit: 62a819202e79ed41651a1e3d9b686a6363ef20cb
Author: Sebastián Barschkis
Date:   Mon Jul 20 18:35:29 2020 +0200
Branches: master
https://developer.blender.org/rB62a819202e79ed41651a1e3d9b686a6363ef20cb

Fluid: Refactored smoke noise system

This refactor is in response to reports in which the adaptive domain with noise caused a crash (e.g. T79009). It should also fix issues where the smoke appeared to be cut off when using the adaptive domain together with noise. It is also possible that some of these changes improve the lines issue from T74559.

===================================================================

M	intern/mantaflow/extern/manta_fluid_API.h
M	intern/mantaflow/intern/manta_fluid_API.cpp
M	intern/mantaflow/intern/strings/smoke_script.h
M	source/blender/blenkernel/intern/fluid.c
M	source/blender/gpu/intern/gpu_draw_smoke.c
M	source/blender/makesrna/intern/rna_fluid.c

===================================================================

diff --git a/intern/mantaflow/extern/manta_fluid_API.h b/intern/mantaflow/extern/manta_fluid_API.h
index 1dbfc6bdd9c..3da1d8f53f0 100644
--- a/intern/mantaflow/extern/manta_fluid_API.h
+++ b/intern/mantaflow/extern/manta_fluid_API.h
@@ -111,46 +111,16 @@ float *manta_get_phioutstatic_in(struct MANTA *fluid);
 
 /* Smoke functions */
 void manta_smoke_export_script(struct MANTA *smoke, struct FluidModifierData *fmd);
-void manta_smoke_export(struct MANTA *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 **flags,
-                        float **shadow);
-void manta_smoke_turbulence_export(struct MANTA *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);
 void manta_smoke_get_rgba(struct MANTA *smoke, float *data, int sequential);
-void manta_smoke_turbulence_get_rgba(struct MANTA *smoke, float *data, int sequential);
+void manta_noise_get_rgba(struct MANTA *smoke, float *data, int sequential);
 void manta_smoke_get_rgba_fixed_color(struct MANTA *smoke,
                                       float color[3],
                                       float *data,
                                       int sequential);
-void manta_smoke_turbulence_get_rgba_fixed_color(struct MANTA *smoke,
-                                                 float color[3],
-                                                 float *data,
-                                                 int sequential);
+void manta_noise_get_rgba_fixed_color(struct MANTA *smoke,
+                                      float color[3],
+                                      float *data,
+                                      int sequential);
 void manta_smoke_ensure_heat(struct MANTA *smoke, struct FluidModifierData *fmd);
 void manta_smoke_ensure_fire(struct MANTA *smoke, struct FluidModifierData *fmd);
 void manta_smoke_ensure_colors(struct MANTA *smoke, struct FluidModifierData *fmd);
@@ -177,17 +147,23 @@ float *manta_smoke_get_emission_in(struct MANTA *smoke);
 int manta_smoke_has_heat(struct MANTA *smoke);
 int manta_smoke_has_fuel(struct MANTA *smoke);
 int manta_smoke_has_colors(struct MANTA *smoke);
-float *manta_smoke_turbulence_get_density(struct MANTA *smoke);
-float *manta_smoke_turbulence_get_fuel(struct MANTA *smoke);
-float *manta_smoke_turbulence_get_react(struct MANTA *smoke);
-float *manta_smoke_turbulence_get_color_r(struct MANTA *smoke);
-float *manta_smoke_turbulence_get_color_g(struct MANTA *smoke);
-float *manta_smoke_turbulence_get_color_b(struct MANTA *smoke);
-float *manta_smoke_turbulence_get_flame(struct MANTA *smoke);
-int manta_smoke_turbulence_has_fuel(struct MANTA *smoke);
-int manta_smoke_turbulence_has_colors(struct MANTA *smoke);
-void manta_smoke_turbulence_get_res(struct MANTA *smoke, int *res);
-int manta_smoke_turbulence_get_cells(struct MANTA *smoke);
+float *manta_noise_get_density(struct MANTA *smoke);
+float *manta_noise_get_fuel(struct MANTA *smoke);
+float *manta_noise_get_react(struct MANTA *smoke);
+float *manta_noise_get_color_r(struct MANTA *smoke);
+float *manta_noise_get_color_g(struct MANTA *smoke);
+float *manta_noise_get_color_b(struct MANTA *smoke);
+float *manta_noise_get_texture_u(struct MANTA *smoke);
+float *manta_noise_get_texture_v(struct MANTA *smoke);
+float *manta_noise_get_texture_w(struct MANTA *smoke);
+float *manta_noise_get_texture_u2(struct MANTA *smoke);
+float *manta_noise_get_texture_v2(struct MANTA *smoke);
+float *manta_noise_get_texture_w2(struct MANTA *smoke);
+float *manta_noise_get_flame(struct MANTA *smoke);
+int manta_noise_has_fuel(struct MANTA *smoke);
+int manta_noise_has_colors(struct MANTA *smoke);
+void manta_noise_get_res(struct MANTA *smoke, int *res);
+int manta_noise_get_cells(struct MANTA *smoke);
 
 /* Liquid functions */
 void manta_liquid_export_script(struct MANTA *smoke, struct FluidModifierData *fmd);
diff --git a/intern/mantaflow/intern/manta_fluid_API.cpp b/intern/mantaflow/intern/manta_fluid_API.cpp
index 1db3da63ecc..60546bc1183 100644
--- a/intern/mantaflow/intern/manta_fluid_API.cpp
+++ b/intern/mantaflow/intern/manta_fluid_API.cpp
@@ -368,89 +368,6 @@ void manta_smoke_export_script(MANTA *smoke, FluidModifierData *fmd)
   smoke->exportSmokeScript(fmd);
 }
 
-void manta_smoke_export(MANTA *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 **flags,
-                        float **shadow)
-{
-  if (dens)
-    *dens = smoke->getDensity();
-  if (fuel)
-    *fuel = smoke->getFuel();
-  if (react)
-    *react = smoke->getReact();
-  if (flame)
-    *flame = smoke->getFlame();
-  if (heat)
-    *heat = smoke->getHeat();
-  *vx = smoke->getVelocityX();
-  *vy = smoke->getVelocityY();
-  *vz = smoke->getVelocityZ();
-  if (r)
-    *r = smoke->getColorR();
-  if (g)
-    *g = smoke->getColorG();
-  if (b)
-    *b = smoke->getColorB();
-  *flags = smoke->getFlags();
-  if (shadow)
-    *shadow = smoke->getShadow();
-  *dt = 1;  // dummy value, not needed for smoke
-  *dx = 1;  // dummy value, not needed for smoke
-}
-
-void manta_smoke_turbulence_export(MANTA *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)
-{
-  if (!smoke && !(smoke->usingNoise()))
-    return;
-
-  *dens = smoke->getDensityHigh();
-  if (fuel)
-    *fuel = smoke->getFuelHigh();
-  if (react)
-    *react = smoke->getReactHigh();
-  if (flame)
-    *flame = smoke->getFlameHigh();
-  if (r)
-    *r = smoke->getColorRHigh();
-  if (g)
-    *g = smoke->getColorGHigh();
-  if (b)
-    *b = smoke->getColorBHigh();
-  *tcu = smoke->getTextureU();
-  *tcv = smoke->getTextureV();
-  *tcw = smoke->getTextureW();
-
-  *tcu2 = smoke->getTextureU2();
-  *tcv2 = smoke->getTextureV2();
-  *tcw2 = smoke->getTextureW2();
-}
-
 static void get_rgba(
     float *r, float *g, float *b, float *a, int total_cells, float *data, int sequential)
 {
@@ -484,7 +401,7 @@ void manta_smoke_get_rgba(MANTA *smoke, float *data, int sequential)
            sequential);
 }
 
-void manta_smoke_turbulence_get_rgba(MANTA *smoke, float *data, int sequential)
+void manta_noise_get_rgba(MANTA *smoke, float *data, int sequential)
 {
   get_rgba(smoke->getColorRHigh(),
            smoke->getColorGHigh(),
@@ -519,10 +436,7 @@ void manta_smoke_get_rgba_fixed_color(MANTA *smoke, float color[3], float *data,
   get_rgba_fixed_color(color, smoke->getTotalCells(), data, sequential);
 }
 
-void manta_smoke_turbulence_get_rgba_fixed_color(MANTA *smoke,
-                                                 float color[3],
-                                                 float *data,
-                                                 int sequential)
+void manta_noise_get_rgba_fixed_color(MANTA *smoke, float color[3], float *data, int sequential)
 {
   get_rgba_fixed_color(color, smoke->getTotalCellsHigh(), data, sequential);
 }
@@ -647,45 +561,69 @@ int manta_smoke_has_colors(MANTA *smoke)
   return (smoke->getColorR() && smoke->getColorG() && smoke->getColorB()) ? 1 : 0;
 }
 
-float *manta_smoke_turbulence_get_density(MANTA *smoke)
+float *manta_noise_get_density(MANTA *smoke)
 {
   return (smoke && smoke->usingNoise()) ? smoke->getDensityHigh() : nullptr;
 }
-float *manta_smoke_turbulence_get_fuel(MANTA *smoke)
+float *manta_noise_get_fuel(MANTA *smoke)
 {
   return (smoke && smoke->usingNoise()) ? smoke->getFuelHigh() : nullptr;
 }
-float *manta_smoke_turbulence_get_react(MANTA *smoke)
+float *manta_noise_get_react(MANTA *smoke)
 {
   return (smoke && smoke->usingNoise()) ? smoke->getReactHigh() : nullptr;
 }
-float *manta_smoke_turbulence_get_color_r(MANTA *smoke)
+float *manta_noise_get_color_r(MANTA *smoke)
 {
   return (smoke && smoke->usingNoise()) ? smoke->getColorRHigh() : nullptr;
 }
-float *manta_smoke_turbulence_get_color_g(MANTA *smoke)
+float *manta_noise_get_color_g(MANTA *smoke)
 {
   return (smoke && smoke->usingNoise()) ? smoke->getColorGHigh() : nullptr;
 }
-float *manta_smoke_turbulence_get_color_b(MANTA *smoke)
+float *manta_noise_get_color_b(MANTA *smoke)
 {
   return (smoke && smoke->usingNoise()) ? smoke->getColorBHigh() : nullptr;
 }
-float *manta_smoke_turbulence_get_flame(MANTA *smoke)
+float *manta_noise_get_flame(MANTA *smoke)
 {
   return (smoke && smoke-

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list