Smoke simulator: add more float precision checks to make sure other data types don't get messed up either. (Relating previous fire fixes)

This commit is contained in:
Miika Hamalainen 2013-02-11 20:22:47 +00:00
parent 3dfd736d45
commit 1c4f704d5c

@ -1654,7 +1654,7 @@ void FLUID_3D::processBurn(float *fuel, float *smoke, float *react, float *flame
fuel[index] -= burning_rate * dt;
if (fuel[index] < 0.0f) fuel[index] = 0.0f;
/* process reaction coordinate */
if (orig_fuel) {
if (orig_fuel > FLT_EPSILON) {
react[index] *= fuel[index]/orig_fuel;
react_coord = react[index];
}
@ -1681,7 +1681,7 @@ void FLUID_3D::processBurn(float *fuel, float *smoke, float *react, float *flame
heat[index] = (1.0f-flame[index])*ignition_point + flame[index]*temp_max;
/* mix new color */
if (r && smoke_emit) {
if (r && smoke_emit > FLT_EPSILON) {
float smoke_factor = smoke[index]/(orig_smoke+smoke_emit);
r[index] = (r[index] + _flame_smoke_color[0] * smoke_emit) * smoke_factor;
g[index] = (g[index] + _flame_smoke_color[1] * smoke_emit) * smoke_factor;