[Bf-blender-cvs] [757cb52] fluid-mantaflow: changed obstacle type to int to match manta flag grid type

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


Commit: 757cb5223d19f4c6ed483f06696086705f8f4e01
Author: Sebastián Barschkis
Date:   Wed Nov 9 22:06:12 2016 +0200
Branches: fluid-mantaflow
https://developer.blender.org/rB757cb5223d19f4c6ed483f06696086705f8f4e01

changed obstacle type to int to match manta flag grid type

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

M	intern/mantaflow/extern/manta_fluid_API.h
M	intern/mantaflow/intern/FLUID.cpp
M	intern/mantaflow/intern/FLUID.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 665ca44..42064b7 100644
--- a/intern/mantaflow/extern/manta_fluid_API.h
+++ b/intern/mantaflow/extern/manta_fluid_API.h
@@ -44,7 +44,7 @@ void smoke_manta_export(struct FLUID* smoke, struct SmokeModifierData *smd);
 void smoke_step(struct FLUID *smoke, struct SmokeModifierData *smd);
 void smoke_dissolve(struct FLUID *smoke, int speed, int log);
 void smoke_dissolve_wavelet(struct FLUID *smoke, int speed, int log);
-void smoke_export(struct FLUID *smoke, float *dt, float *dx, float **dens, float **react, float **flame, float **fuel, float **heat, float **smoke_inflow, float **vx, float **vy, float **vz, float **r, float **g, float **b, unsigned char **obstacles);
+void smoke_export(struct FLUID *smoke, float *dt, float *dx, float **dens, float **react, float **flame, float **fuel, float **heat, float **smoke_inflow, float **vx, float **vy, float **vz, float **r, float **g, float **b, int **obstacles);
 void smoke_turbulence_export(struct FLUID *smoke, float **dens, float **react, float **flame, float **fuel, float **r, float **g, float **b , float **tcu, float **tcv, float **tcw, float **tcu2, float **tcv2, float **tcw2);
 float *smoke_get_density(struct FLUID *smoke);
 float *smoke_get_fuel(struct FLUID *smoke);
@@ -73,7 +73,7 @@ float *smoke_turbulence_get_color_b(struct FLUID *smoke);
 float *smoke_turbulence_get_flame(struct FLUID *smoke);
 void smoke_turbulence_get_res(struct FLUID *smoke, int *res);
 int smoke_turbulence_get_cells(struct FLUID *smoke);
-unsigned char *smoke_get_obstacle(struct FLUID *smoke);
+int *smoke_get_obstacle(struct FLUID *smoke);
 void smoke_get_ob_velocity(struct FLUID *smoke, float **x, float **y, float **z);
 void flame_get_spectrum(unsigned char *spec, int width, float t1, float t2);
 int smoke_has_heat(struct FLUID *smoke);
@@ -86,7 +86,7 @@ void smoke_ensure_fire(struct FLUID *smoke, struct SmokeModifierData *smd);
 void smoke_ensure_colors(struct FLUID *smoke, struct SmokeModifierData *smd);
 float *smoke_get_inflow_grid(struct FLUID *smoke);
 float *smoke_get_fuel_inflow(struct FLUID *smoke);
-unsigned char *smoke_turbulence_get_obstacle(struct FLUID *smoke);
+int *smoke_turbulence_get_obstacle(struct FLUID *smoke);
 
 float *liquid_get_phi(struct FLUID *liquid);
 float *liquid_get_phiinit(struct FLUID *liquid);
diff --git a/intern/mantaflow/intern/FLUID.cpp b/intern/mantaflow/intern/FLUID.cpp
index 098bccd..f41faf2 100644
--- a/intern/mantaflow/intern/FLUID.cpp
+++ b/intern/mantaflow/intern/FLUID.cpp
@@ -899,7 +899,7 @@ void FLUID::updatePointers(SmokeModifierData *smd)
 {
 	std::cout << "Updating pointers low res" << std::endl;
 
-	mObstacle = (unsigned char*) getGridPointer("flags", "s");
+	mObstacle = (int*) getGridPointer("flags", "s");
 	
 	mVelocityX = (float*) getGridPointer("x_vel", "s");
 	mVelocityY = (float*) getGridPointer("y_vel", "s");
@@ -946,7 +946,7 @@ void FLUID::updatePointersHigh(SmokeModifierData *smd)
 {
 	std::cout << "Updating pointers high res" << std::endl;
 	
-	mObstacleHigh = (unsigned char*) getGridPointer("xl_flags", "s");
+	mObstacleHigh = (int*) getGridPointer("xl_flags", "s");
 
 	// Liquid
 	if (mUsingLiquid) {
diff --git a/intern/mantaflow/intern/FLUID.h b/intern/mantaflow/intern/FLUID.h
index 59f315b..2dc27bb 100644
--- a/intern/mantaflow/intern/FLUID.h
+++ b/intern/mantaflow/intern/FLUID.h
@@ -97,7 +97,7 @@ public:
 	inline float* getForceX() { return mForceX; }
 	inline float* getForceY() { return mForceY; }
 	inline float* getForceZ() { return mForceZ; }
-	inline unsigned char* getObstacle() { return mObstacle; }
+	inline int* getObstacle() { return mObstacle; }
 	inline unsigned char* getObstaclesAnim() { return mObstaclesAnim; }
 	inline float* getFlame() { return mFlame; }
 	inline float* getFuel() { return mFuel; }
@@ -121,7 +121,7 @@ public:
 	inline float* getTextureU2() { return mTextureU2; }
 	inline float* getTextureV2() { return mTextureV2; }
 	inline float* getTextureW2() { return mTextureW2; }
-	inline unsigned char* getObstacleHigh() { return mObstacleHigh; }
+	inline int* getObstacleHigh() { return mObstacleHigh; }
 	
 	inline float* getPhi()        { return mPhi; }
 	inline float* getPhiInit()    { return mPhiInit; }
@@ -186,7 +186,7 @@ private:
 	float* mForceX;
 	float* mForceY;
 	float* mForceZ;
-	unsigned char* mObstacle; /* only used (useful) for static obstacles like domain boundaries */
+	int* mObstacle; /* only used (useful) for static obstacles like domain boundaries */
 	unsigned char* mObstaclesAnim;
 	float *mFlame;
 	float *mFuel;
@@ -211,7 +211,7 @@ private:
 	float* mTextureU2;
 	float* mTextureV2;
 	float* mTextureW2;
-	unsigned char* mObstacleHigh;
+	int* mObstacleHigh;
 	
 	// Liquids
 	float* mPhi;
diff --git a/intern/mantaflow/intern/manta_fluid_API.cpp b/intern/mantaflow/intern/manta_fluid_API.cpp
index 90d729b..b860b1e 100644
--- a/intern/mantaflow/intern/manta_fluid_API.cpp
+++ b/intern/mantaflow/intern/manta_fluid_API.cpp
@@ -135,7 +135,7 @@ extern "C" void smoke_dissolve_wavelet(FLUID *smoke, int speed, int log)
 }
 
 extern "C" void smoke_export(FLUID *smoke, float *dt, float *dx, float **dens, float **react, float **flame, float **fuel, float **heat, 
-							 float **smoke_inflow, float **vx, float **vy, float **vz, float **r, float **g, float **b, unsigned char **obstacle)
+							 float **smoke_inflow, float **vx, float **vy, float **vz, float **r, float **g, float **b, int **obstacle)
 {
 	*dens = smoke->getDensity();
 	if (fuel)
@@ -338,7 +338,7 @@ extern "C" float *smoke_turbulence_get_density(FLUID *smoke)
 	return (smoke && smoke->usingHighRes()) ? smoke->getDensityHigh() : NULL;
 }
 
-extern "C" unsigned char *smoke_turbulence_get_obstacle(FLUID *smoke)
+extern "C" int *smoke_turbulence_get_obstacle(FLUID *smoke)
 {
 	return (smoke && smoke->usingHighRes()) ? smoke->getObstacleHigh() : NULL;
 }
@@ -393,7 +393,7 @@ extern "C" int smoke_turbulence_get_cells(FLUID *smoke)
 	return (smoke && smoke->usingHighRes()) ? total_cells_high : 0;
 }
 
-extern "C" unsigned char *smoke_get_obstacle(FLUID *smoke)
+extern "C" int *smoke_get_obstacle(FLUID *smoke)
 {
 	return smoke->getObstacle();
 }
diff --git a/source/blender/blenkernel/intern/smoke.c b/source/blender/blenkernel/intern/smoke.c
index dc9bdd8..e8ad6ce 100644
--- a/source/blender/blenkernel/intern/smoke.c
+++ b/source/blender/blenkernel/intern/smoke.c
@@ -809,7 +809,7 @@ typedef struct ObstaclesFromDMData {
 	const MLoop *mloop;
 	const MLoopTri *looptri;
 	BVHTreeFromMesh *tree;
-	unsigned char *obstacle_map;
+	int *obstacle_map;
 
 	bool has_velocity;
 	float *vert_vel;
@@ -879,7 +879,7 @@ static void obstacles_from_derivedmesh_task_cb(void *userdata, const int z)
 
 static void obstacles_from_derivedmesh(
         Object *coll_ob, SmokeDomainSettings *sds, SmokeCollSettings *scs,
-        unsigned char *obstacle_map, float *distances_map, float *velocityX, float *velocityY, float *velocityZ, int *num_obstacles, float dt)
+        int *obstacle_map, float *distances_map, float *velocityX, float *velocityY, float *velocityZ, int *num_obstacles, float dt)
 {
 	if (!scs->dm) return;
 	{
@@ -972,7 +972,7 @@ static void update_obstacles(Scene *scene, Object *ob, SmokeDomainSettings *sds,
 	unsigned int numcollobj = 0;
 
 	unsigned int collIndex;
-	unsigned char *obstacles = smoke_get_obstacle(sds->fluid);
+	int *obstacles = smoke_get_obstacle(sds->fluid);
 	float *velx = NULL;
 	float *vely = NULL;
 	float *velz = NULL;
@@ -2285,7 +2285,7 @@ static void adjustDomainResolution(SmokeDomainSettings *sds, int new_shift[3], E
 	}
 }
 
-BLI_INLINE void apply_outflow_fields(int index, float inflow_value, float *density, float *heat, float *fuel, float *react, float *color_r, float *color_g, float *color_b, float *phi, float *phiobsinit, unsigned char *obstacle)
+BLI_INLINE void apply_outflow_fields(int index, float inflow_value, float *density, float *heat, float *fuel, float *react, float *color_r, float *color_g, float *color_b, float *phi, float *phiobsinit, int *obstacle)
 {
 	/* set liquid outflow */
 	if (phi) {
@@ -2636,7 +2636,7 @@ static void update_flowsfluids(Scene *scene, Object *ob, SmokeDomainSettings *sd
 				float *bigcolor_g = smoke_turbulence_get_color_g(sds->fluid);
 				float *bigcolor_b = smoke_turbulence_get_color_b(sds->fluid);
 				float *bigphi = liquid_turbulence_get_phi(sds->fluid);
-				unsigned char *bigobstacle = smoke_turbulence_get_obstacle(sds->fluid);
+				int *bigobstacle = smoke_turbulence_get_obstacle(sds->fluid);
 #endif
 				float *heat = smoke_get_heat(sds->fluid);
 				float *velocity_x = smoke_get_velocity_x(sds->fluid);
@@ -2644,7 +2644,7 @@ static void update_flowsfluids(Scene *scene, Object *ob, SmokeDomainSettings *sd
 				float *velocity_z = smoke_get_velocity_z(sds->fluid);
 				float *phiinit = liquid_get_phiinit(sds->fluid);
 				float *phiobsinit = liquid_get_phiobsinit(sds->fluid);
-				unsigned char *obstacle = smoke_get_obstacle(sds->fluid);
+				int *obstacle = smoke_get_obstacle(sds->fluid);
 				// DG TODO UNUSED unsigned char *obstacleAnim = smoke_get_obstacle_anim(sds->fluid);
 				int bigres[3];
 				float *velocity_map = em->velocity;
@@ -2813,7 +2813,7 @@ typedef struct UpdateEffectorsData {
 	float *velocity_x;
 	float *velocity_y;
 	float *velocity_z;
-	unsigned char *obstacle;
+	int *obstacle;
 	float *phi;
 } UpdateEffectorsData;
 
@@ -2833,7 +2833,7 @@ static void update_effectors_task_cb(void *userdata, const int x)
 			if ((data->fuel && MAX2(data->density[index], data->fuel[index]) < FLT_EPSILON) ||
 				(data->density && data->density[index] < FLT_EPSILON) ||
 				(data->phi     && data->phi[index] < 0.0f) ||
-				data->obstacle[index])
+				 data->obstacle[index])
 			{
 				continue;
 			}




More information about the Bf-blender-cvs mailing list