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
diff options
context:
space:
mode:
authorDaniel Genrich <daniel.genrich@gmx.net>2009-10-08 14:18:14 +0400
committerDaniel Genrich <daniel.genrich@gmx.net>2009-10-08 14:18:14 +0400
commit14f62c132136ba8696cf204fb421ba4f10414a6a (patch)
tree9d9755adabded42deb5156e73ac9881c50a1e68a /intern/smoke
parent8f154364f28d53c58b9a0022f8c36ab787477492 (diff)
Smoke:
* Enable external forces like e.g. wind
Diffstat (limited to 'intern/smoke')
-rw-r--r--intern/smoke/extern/smoke_API.h4
-rw-r--r--intern/smoke/intern/FLUID_3D.cpp14
-rw-r--r--intern/smoke/intern/smoke_API.cpp15
3 files changed, 26 insertions, 7 deletions
diff --git a/intern/smoke/extern/smoke_API.h b/intern/smoke/extern/smoke_API.h
index 5607df70cf3..ea106c81303 100644
--- a/intern/smoke/extern/smoke_API.h
+++ b/intern/smoke/extern/smoke_API.h
@@ -50,6 +50,10 @@ float *smoke_get_velocity_x(struct FLUID_3D *fluid);
float *smoke_get_velocity_y(struct FLUID_3D *fluid);
float *smoke_get_velocity_z(struct FLUID_3D *fluid);
+float *smoke_get_force_x(struct FLUID_3D *fluid);
+float *smoke_get_force_y(struct FLUID_3D *fluid);
+float *smoke_get_force_z(struct FLUID_3D *fluid);
+
unsigned char *smoke_get_obstacle(struct FLUID_3D *fluid);
size_t smoke_get_index(int x, int max_x, int y, int max_y, int z);
diff --git a/intern/smoke/intern/FLUID_3D.cpp b/intern/smoke/intern/FLUID_3D.cpp
index bb2227801c7..729d73bb4f3 100644
--- a/intern/smoke/intern/FLUID_3D.cpp
+++ b/intern/smoke/intern/FLUID_3D.cpp
@@ -184,13 +184,6 @@ void FLUID_3D::step()
{
// addSmokeTestCase(_density, _res);
// addSmokeTestCase(_heat, _res);
-
- // wipe forces
- for (int i = 0; i < _totalCells; i++)
- {
- _xForce[i] = _yForce[i] = _zForce[i] = 0.0f;
- // _obstacles[i] &= ~2;
- }
wipeBoundaries();
@@ -232,6 +225,13 @@ void FLUID_3D::step()
// todo xxx dg: only clear obstacles, not boundaries
// memset(_obstacles, 0, sizeof(unsigned char)*_xRes*_yRes*_zRes);
+
+ // wipe forces
+ // for external forces we can't do it at the beginning of this function but at the end
+ for (int i = 0; i < _totalCells; i++)
+ {
+ _xForce[i] = _yForce[i] = _zForce[i] = 0.0f;
+ }
}
//////////////////////////////////////////////////////////////////////
diff --git a/intern/smoke/intern/smoke_API.cpp b/intern/smoke/intern/smoke_API.cpp
index 67df6e805d8..2d1d590fcc0 100644
--- a/intern/smoke/intern/smoke_API.cpp
+++ b/intern/smoke/intern/smoke_API.cpp
@@ -235,6 +235,21 @@ extern "C" float *smoke_get_velocity_z(FLUID_3D *fluid)
return fluid->_zVelocity;
}
+extern "C" float *smoke_get_force_x(FLUID_3D *fluid)
+{
+ return fluid->_xForce;
+}
+
+extern "C" float *smoke_get_force_y(FLUID_3D *fluid)
+{
+ return fluid->_yForce;
+}
+
+extern "C" float *smoke_get_force_z(FLUID_3D *fluid)
+{
+ return fluid->_zForce;
+}
+
extern "C" float *smoke_turbulence_get_density(WTURBULENCE *wt)
{
return wt ? wt->getDensityBig() : NULL;