diff options
author | Daniel Genrich <daniel.genrich@gmx.net> | 2010-07-27 19:33:21 +0400 |
---|---|---|
committer | Daniel Genrich <daniel.genrich@gmx.net> | 2010-07-27 19:33:21 +0400 |
commit | 78e5a299900233aa8779f87947edb9f37f9336bf (patch) | |
tree | f732163205b67ad4b719380cbdde488a3ae91407 /intern/smoke | |
parent | 614192cce3aa8f43323977c44cfdcf649d9414fb (diff) |
Smoke:
- Fix typo in tooltip
- Add timeframe independand timesteps
Diffstat (limited to 'intern/smoke')
-rw-r--r-- | intern/smoke/extern/smoke_API.h | 2 | ||||
-rw-r--r-- | intern/smoke/intern/smoke_API.cpp | 7 |
2 files changed, 6 insertions, 3 deletions
diff --git a/intern/smoke/extern/smoke_API.h b/intern/smoke/extern/smoke_API.h index d1012eef76e..b340c914519 100644 --- a/intern/smoke/extern/smoke_API.h +++ b/intern/smoke/extern/smoke_API.h @@ -42,7 +42,7 @@ struct FLUID_3D *smoke_init(int *res, float *p0); void smoke_free(struct FLUID_3D *fluid); void smoke_initBlenderRNA(struct FLUID_3D *fluid, float *alpha, float *beta, float *dt_factor, float *vorticity, int *border_colli); -void smoke_step(struct FLUID_3D *fluid, size_t framenr); +void smoke_step(struct FLUID_3D *fluid, size_t framenr, float fps); float *smoke_get_density(struct FLUID_3D *fluid); float *smoke_get_heat(struct FLUID_3D *fluid); diff --git a/intern/smoke/intern/smoke_API.cpp b/intern/smoke/intern/smoke_API.cpp index 23c12c17014..168395f370d 100644 --- a/intern/smoke/intern/smoke_API.cpp +++ b/intern/smoke/intern/smoke_API.cpp @@ -75,13 +75,13 @@ extern "C" size_t smoke_get_index2d(int x, int max_x, int y /*, int max_y, int z return x + y * max_x; } -extern "C" void smoke_step(FLUID_3D *fluid, size_t framenr) +extern "C" void smoke_step(FLUID_3D *fluid, size_t framenr, float fps) { /* stability values copied from wturbulence.cpp */ const int maxSubSteps = 25; const float maxVel = 0.5f; /* TODO: maybe 0.5 is still too high, please confirm! -dg */ - const float dt = DT_DEFAULT; + float dt = DT_DEFAULT; float maxVelMag = 0.0f; int totalSubsteps; int substep = 0; @@ -97,6 +97,9 @@ extern "C" void smoke_step(FLUID_3D *fluid, size_t framenr) maxVelMag = vtemp; } + /* adapt timestep for different framerates, dt = 0.1 is at 25fps */ + dt *= (25.0f / fps); + maxVelMag = sqrt(maxVelMag) * dt * (*(fluid->_dtFactor)); totalSubsteps = (int)((maxVelMag / maxVel) + 1.0f); /* always round up */ totalSubsteps = (totalSubsteps < 1) ? 1 : totalSubsteps; |