[Bf-blender-cvs] [8c39247] fluid-mantaflow: added obstacle access functions and cleaned up a bit

Sebastián Barschkis noreply at git.blender.org
Thu Dec 1 13:37:54 CET 2016


Commit: 8c39247db15e3b3dfb336eff2e147161604ba20b
Author: Sebastián Barschkis
Date:   Wed Nov 9 22:09:47 2016 +0200
Branches: fluid-mantaflow
https://developer.blender.org/rB8c39247db15e3b3dfb336eff2e147161604ba20b

added obstacle access functions and cleaned up a bit

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

M	intern/mantaflow/extern/manta_fluid_API.h
M	intern/mantaflow/intern/manta_fluid_API.cpp
M	source/blender/blenkernel/intern/smoke.c

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

diff --git a/intern/mantaflow/extern/manta_fluid_API.h b/intern/mantaflow/extern/manta_fluid_API.h
index 42064b7..6a3fb1b 100644
--- a/intern/mantaflow/extern/manta_fluid_API.h
+++ b/intern/mantaflow/extern/manta_fluid_API.h
@@ -53,6 +53,9 @@ float *smoke_get_heat(struct FLUID *smoke);
 float *smoke_get_velocity_x(struct FLUID *smoke);
 float *smoke_get_velocity_y(struct FLUID *smoke);
 float *smoke_get_velocity_z(struct FLUID *smoke);
+float *smoke_get_ob_velocity_x(struct FLUID *fluid);
+float *smoke_get_ob_velocity_y(struct FLUID *fluid);
+float *smoke_get_ob_velocity_z(struct FLUID *fluid);
 float *smoke_get_force_x(struct FLUID *smoke);
 float *smoke_get_force_y(struct FLUID *smoke);
 float *smoke_get_force_z(struct FLUID *smoke);
diff --git a/intern/mantaflow/intern/manta_fluid_API.cpp b/intern/mantaflow/intern/manta_fluid_API.cpp
index b860b1e..f6bcc44 100644
--- a/intern/mantaflow/intern/manta_fluid_API.cpp
+++ b/intern/mantaflow/intern/manta_fluid_API.cpp
@@ -225,6 +225,21 @@ extern "C" float *smoke_get_velocity_z(FLUID *smoke)
 	return smoke->getVelocityZ();
 }
 
+extern "C" float *smoke_get_ob_velocity_x(FLUID *fluid)
+{
+	return fluid->getObVelocityX();
+}
+
+extern "C" float *smoke_get_ob_velocity_y(FLUID *fluid)
+{
+	return fluid->getObVelocityY();
+}
+
+extern "C" float *smoke_get_ob_velocity_z(FLUID *fluid)
+{
+	return fluid->getObVelocityZ();
+}
+
 extern "C" float *smoke_get_force_x(FLUID *smoke)
 {
 	return smoke->getForceX();
diff --git a/source/blender/blenkernel/intern/smoke.c b/source/blender/blenkernel/intern/smoke.c
index e8ad6ce..7f386d6 100644
--- a/source/blender/blenkernel/intern/smoke.c
+++ b/source/blender/blenkernel/intern/smoke.c
@@ -973,9 +973,9 @@ static void update_obstacles(Scene *scene, Object *ob, SmokeDomainSettings *sds,
 
 	unsigned int collIndex;
 	int *obstacles = smoke_get_obstacle(sds->fluid);
-	float *velx = NULL;
-	float *vely = NULL;
-	float *velz = NULL;
+	float *velx = smoke_get_ob_velocity_x(sds->fluid);
+	float *vely = smoke_get_ob_velocity_y(sds->fluid);
+	float *velz = smoke_get_ob_velocity_z(sds->fluid);
 	float *velxOrig = smoke_get_velocity_x(sds->fluid);
 	float *velyOrig = smoke_get_velocity_y(sds->fluid);
 	float *velzOrig = smoke_get_velocity_z(sds->fluid);
@@ -990,8 +990,6 @@ static void update_obstacles(Scene *scene, Object *ob, SmokeDomainSettings *sds,
 
 	int *num_obstacles = MEM_callocN(sizeof(int) * sds->res[0] * sds->res[1] * sds->res[2], "smoke_num_obstacles");
 
-	smoke_get_ob_velocity(sds->fluid, &velx, &vely, &velz);
-
 	// TODO: delete old obstacle flags
 	for (z = 0; z < sds->res[0] * sds->res[1] * sds->res[2]; z++)
 	{




More information about the Bf-blender-cvs mailing list