[Bf-blender-cvs] [35c666b] fluid-mantaflow: made flag grid also accessible through manta api. needed for liquid outflow.

Sebastián Barschkis noreply at git.blender.org
Sat Aug 6 13:01:03 CEST 2016


Commit: 35c666b468950c997c98df5e41b713dd9f06983a
Author: Sebastián Barschkis
Date:   Fri Jul 29 23:16:32 2016 +0200
Branches: fluid-mantaflow
https://developer.blender.org/rB35c666b468950c997c98df5e41b713dd9f06983a

made flag grid also accessible through manta api. needed for liquid outflow.

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

M	intern/mantaflow/extern/manta_smoke_API.h
M	intern/mantaflow/intern/SMOKE.cpp
M	intern/mantaflow/intern/SMOKE.h
M	intern/mantaflow/intern/manta_smoke_API.cpp

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

diff --git a/intern/mantaflow/extern/manta_smoke_API.h b/intern/mantaflow/extern/manta_smoke_API.h
index b0a2a02..d6f3fbc 100644
--- a/intern/mantaflow/extern/manta_smoke_API.h
+++ b/intern/mantaflow/extern/manta_smoke_API.h
@@ -36,7 +36,6 @@ extern "C" {
 
 struct SMOKE;
 
-int *smoke_get_manta_flags(struct SMOKE *smoke);
 struct SMOKE *smoke_init(int *res, struct SmokeModifierData *smd);
 void smoke_free(struct SMOKE *smoke);
 size_t smoke_get_index(int x, int max_x, int y, int max_y, int z /*, int max_z */);
@@ -87,6 +86,8 @@ void smoke_ensure_fire(struct SMOKE *smoke, struct SmokeModifierData *smd);
 void smoke_ensure_colors(struct SMOKE *smoke, struct SmokeModifierData *smd);
 float *smoke_get_inflow_grid(struct SMOKE *smoke);
 float *smoke_get_fuel_inflow(struct SMOKE *smoke);
+int *smoke_get_flags(struct SMOKE *smoke);
+int *smoke_turbulence_get_flags(struct SMOKE *smoke);
 
 float *liquid_get_phi(struct SMOKE *liquid);
 float *liquid_get_phiinit(struct SMOKE *liquid);
diff --git a/intern/mantaflow/intern/SMOKE.cpp b/intern/mantaflow/intern/SMOKE.cpp
index f687bb1..2e3ffb6 100644
--- a/intern/mantaflow/intern/SMOKE.cpp
+++ b/intern/mantaflow/intern/SMOKE.cpp
@@ -76,6 +76,7 @@ SMOKE::SMOKE(int *res, SmokeModifierData *smd)
 	
 	// Low res grids
 	mDensity        = NULL;
+	mFlags          = NULL;
 	mHeat           = NULL;
 	mVelocityX      = NULL;
 	mVelocityY      = NULL;
@@ -94,7 +95,6 @@ SMOKE::SMOKE(int *res, SmokeModifierData *smd)
 	mColorB         = NULL;
 	mDensityInflow  = NULL;
 	mFuelInflow     = NULL;
-	mMantaFlags     = NULL;
 	mObstacles      = NULL;
 	
 	// High res grids
@@ -361,6 +361,7 @@ SMOKE::~SMOKE()
 	
 	// Reset pointers to avoid dangling pointers
 	mDensity        = NULL;
+	mFlags          = NULL;
 	mHeat           = NULL;
 	mVelocityX      = NULL;
 	mVelocityY      = NULL;
@@ -379,7 +380,6 @@ SMOKE::~SMOKE()
 	mColorB         = NULL;
 	mDensityInflow  = NULL;
 	mFuelInflow     = NULL;
-	mMantaFlags     = NULL;
 	mObstacles      = NULL;
 	
 	if (mUsingHighRes)
@@ -787,9 +787,11 @@ void SMOKE::updatePointers(SmokeModifierData *smd)
 {
 	std::cout << "Updating pointers low res" << std::endl;
 
+	mFlags = (int*) getGridPointer("flags", "s");
+	
 	// Liquid
 	if (mUsingLiquid) {
-		mPhi        = (float*)         getGridPointer("phi",         "s");
+		mPhi        = (float*)         getGridPointer("phi",             "s");
 		mPhiInit    = (float*)         getGridPointer("phiInit",         "s");
 		mDensity    = (float*)         getGridPointer("density",         "s");
 	}
diff --git a/intern/mantaflow/intern/SMOKE.h b/intern/mantaflow/intern/SMOKE.h
index d054a8f..39b4560 100644
--- a/intern/mantaflow/intern/SMOKE.h
+++ b/intern/mantaflow/intern/SMOKE.h
@@ -99,7 +99,7 @@ public:
 	inline float* getColorB() { return mColorB; }
 	inline float* getDensityInflow() { return mDensityInflow; }
 	inline float* getFuelInflow() { return mFuelInflow; }
-	inline int* getMantaFlags() { return mMantaFlags; }
+	inline int* getFlags() { return mFlags; }
 
 	inline float* getDensityHigh() { return mDensityHigh; }
 	inline float* getFlameHigh() { return mFlameHigh; }
@@ -114,6 +114,7 @@ public:
 	inline float* getTextureU2() { return mTextureU2; }
 	inline float* getTextureV2() { return mTextureV2; }
 	inline float* getTextureW2() { return mTextureW2; }
+	inline int* getFlagsHigh() { return mFlagsHigh; }
 	
 	inline float* getPhi()     { return mPhi; }
 	inline float* getPhiInit() { return mPhiInit; }
@@ -187,7 +188,7 @@ private:
 	float *mColorB;
 	float* mDensityInflow;
 	float* mFuelInflow;
-	int* mMantaFlags;
+	int* mFlags;
 
 	// Smoke grids high res
 	float* mDensityHigh;
@@ -203,6 +204,7 @@ private:
 	float* mTextureU2;
 	float* mTextureV2;
 	float* mTextureW2;
+	int* mFlagsHigh;
 	
 	// Liquids
 	float* mPhi;
diff --git a/intern/mantaflow/intern/manta_smoke_API.cpp b/intern/mantaflow/intern/manta_smoke_API.cpp
index 6d8caef..f54b448 100644
--- a/intern/mantaflow/intern/manta_smoke_API.cpp
+++ b/intern/mantaflow/intern/manta_smoke_API.cpp
@@ -33,10 +33,6 @@
 #include "manta_smoke_API.h"
 #include "spectrum.h"
 
-extern "C" int *smoke_get_manta_flags(struct SMOKE *smoke) {
-	return smoke->getMantaFlags();
-}
-
 extern "C" SMOKE *smoke_init(int *res, struct SmokeModifierData *smd)
 {
 	SMOKE *smoke = new SMOKE(res, smd);
@@ -199,6 +195,11 @@ extern "C" float *smoke_get_density(SMOKE *smoke)
 	return smoke->getDensity();
 }
 
+extern "C" int *smoke_get_flags(SMOKE *smoke)
+{
+	return smoke->getFlags();
+}
+
 extern "C" float *smoke_get_fuel(SMOKE *smoke)
 {
 	return smoke->getFuel();
@@ -342,6 +343,11 @@ extern "C" float *smoke_turbulence_get_density(SMOKE *smoke)
 	return (smoke && smoke->usingHighRes()) ? smoke->getDensityHigh() : NULL;
 }
 
+extern "C" int *smoke_turbulence_get_flags(SMOKE *smoke)
+{
+	return (smoke && smoke->usingHighRes()) ? smoke->getFlagsHigh() : NULL;
+}
+
 extern "C" float *smoke_turbulence_get_fuel(SMOKE *smoke)
 {
 	return (smoke && smoke->usingHighRes()) ? smoke->getFuelHigh() : NULL;




More information about the Bf-blender-cvs mailing list