Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/intern
diff options
context:
space:
mode:
Diffstat (limited to 'intern')
-rw-r--r--intern/smoke/intern/FLUID_3D.cpp36
-rw-r--r--intern/smoke/intern/FLUID_3D.h3
-rw-r--r--intern/smoke/intern/smoke_API.cpp14
3 files changed, 36 insertions, 17 deletions
diff --git a/intern/smoke/intern/FLUID_3D.cpp b/intern/smoke/intern/FLUID_3D.cpp
index a43d94a7790..4faec894801 100644
--- a/intern/smoke/intern/FLUID_3D.cpp
+++ b/intern/smoke/intern/FLUID_3D.cpp
@@ -1587,7 +1587,7 @@ void FLUID_3D::advectMacCormackEnd2(int zBegin, int zEnd)
}
-void FLUID_3D::processBurn(float *fuel, float *smoke, float *react, float *flame, float *heat,
+void FLUID_3D::processBurn(float *fuel, float *smoke, float *react, float *heat,
float *r, float *g, float *b, int total_cells, float dt)
{
float burning_rate = *_burning_rate;
@@ -1600,7 +1600,7 @@ void FLUID_3D::processBurn(float *fuel, float *smoke, float *react, float *flame
float orig_fuel = fuel[index];
float orig_smoke = smoke[index];
float smoke_emit = 0.0f;
- float react_coord = 0.0f;
+ float flame = 0.0f;
/* process fuel */
fuel[index] -= burning_rate * dt;
@@ -1608,7 +1608,7 @@ void FLUID_3D::processBurn(float *fuel, float *smoke, float *react, float *flame
/* process reaction coordinate */
if (orig_fuel > FLT_EPSILON) {
react[index] *= fuel[index]/orig_fuel;
- react_coord = react[index];
+ flame = pow(react[index], 0.5f);
}
else {
react[index] = 0.0f;
@@ -1620,17 +1620,9 @@ void FLUID_3D::processBurn(float *fuel, float *smoke, float *react, float *flame
smoke[index] += smoke_emit;
CLAMP(smoke[index], 0.0f, 1.0f);
- /* model flame temperature curve from the reaction coordinate (fuel) */
- if (react_coord>0.0f) {
- /* do a smooth falloff for rest of the values */
- flame[index] = pow(react_coord, 0.5f);
- }
- else
- flame[index] = 0.0f;
-
/* set fluid temperature from the flame temperature profile */
- if (heat && flame[index])
- heat[index] = (1.0f-flame[index])*ignition_point + flame[index]*temp_max;
+ if (heat && flame)
+ heat[index] = (1.0f - flame)*ignition_point + flame*temp_max;
/* mix new color */
if (r && smoke_emit > FLT_EPSILON) {
@@ -1641,3 +1633,21 @@ void FLUID_3D::processBurn(float *fuel, float *smoke, float *react, float *flame
}
}
}
+
+void FLUID_3D::updateFlame(float *react, float *flame, int total_cells)
+{
+ for (int index = 0; index < total_cells; index++)
+ {
+ /* model flame temperature curve from the reaction coordinate (fuel)
+ * TODO: Would probably be best to get rid of whole "flame" data field.
+ * Currently it's just sqrt mirror of reaction coordinate, and therefore
+ * basically just waste of memory and disk space...
+ */
+ if (react[index]>0.0f) {
+ /* do a smooth falloff for rest of the values */
+ flame[index] = pow(react[index], 0.5f);
+ }
+ else
+ flame[index] = 0.0f;
+ }
+} \ No newline at end of file
diff --git a/intern/smoke/intern/FLUID_3D.h b/intern/smoke/intern/FLUID_3D.h
index d98a39930de..cd2147b2bee 100644
--- a/intern/smoke/intern/FLUID_3D.h
+++ b/intern/smoke/intern/FLUID_3D.h
@@ -209,8 +209,9 @@ struct FLUID_3D
float *_flame_vorticity; // RNA pointer
float *_ignition_temp; // RNA pointer
float *_max_temp; // RNA pointer
- void processBurn(float *fuel, float *smoke, float *react, float *flame, float *heat,
+ void processBurn(float *fuel, float *smoke, float *react, float *heat,
float *r, float *g, float *b, int total_cells, float dt);
+ void updateFlame(float *react, float *flame, int total_cells);
// boundary setting functions
static void copyBorderX(float* field, Vec3Int res, int zBegin, int zEnd);
diff --git a/intern/smoke/intern/smoke_API.cpp b/intern/smoke/intern/smoke_API.cpp
index e25dff00d23..d79aaf76d56 100644
--- a/intern/smoke/intern/smoke_API.cpp
+++ b/intern/smoke/intern/smoke_API.cpp
@@ -77,19 +77,27 @@ extern "C" size_t smoke_get_index2d(int x, int max_x, int y /*, int max_y, int z
extern "C" void smoke_step(FLUID_3D *fluid, float gravity[3], float dtSubdiv)
{
if (fluid->_fuel) {
- fluid->processBurn(fluid->_fuel, fluid->_density, fluid->_react, fluid->_flame, fluid->_heat,
+ fluid->processBurn(fluid->_fuel, fluid->_density, fluid->_react, fluid->_heat,
fluid->_color_r, fluid->_color_g, fluid->_color_b, fluid->_totalCells, (*fluid->_dtFactor)*dtSubdiv);
}
fluid->step(dtSubdiv, gravity);
+
+ if (fluid->_fuel) {
+ fluid->updateFlame(fluid->_react, fluid->_flame, fluid->_totalCells);
+ }
}
extern "C" void smoke_turbulence_step(WTURBULENCE *wt, FLUID_3D *fluid)
{
if (wt->_fuelBig) {
- fluid->processBurn(wt->_fuelBig, wt->_densityBig, wt->_reactBig, wt->_flameBig, 0,
+ fluid->processBurn(wt->_fuelBig, wt->_densityBig, wt->_reactBig, 0,
wt->_color_rBig, wt->_color_gBig, wt->_color_bBig, wt->_totalCellsBig, fluid->_dt);
}
- wt->stepTurbulenceFull(fluid->_dt/fluid->_dx, fluid->_xVelocity, fluid->_yVelocity, fluid->_zVelocity, fluid->_obstacles);
+ wt->stepTurbulenceFull(fluid->_dt/fluid->_dx, fluid->_xVelocity, fluid->_yVelocity, fluid->_zVelocity, fluid->_obstacles);
+
+ if (wt->_fuelBig) {
+ fluid->updateFlame(wt->_reactBig, wt->_flameBig, wt->_totalCellsBig);
+ }
}
extern "C" void smoke_initBlenderRNA(FLUID_3D *fluid, float *alpha, float *beta, float *dt_factor, float *vorticity, int *border_colli, float *burning_rate,