Commit: e506b450e008422252c851086a0d0c5df926238a
Author: Sebastián Barschkis
Date:   Sat May 21 02:17:50 2016 +0200
Branches: fluid-mantaflow
https://developer.blender.org/rBe506b450e008422252c851086a0d0c5df926238a

liquid grid pointer exchange functions (lets blender write the inflow to the 
mantaflow grid)

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

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 e28c9eb..eef9ef2 100644
--- a/intern/mantaflow/extern/manta_smoke_API.h
+++ b/intern/mantaflow/extern/manta_smoke_API.h
@@ -88,6 +88,8 @@ 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);
 
+float *liquid_get_phi(struct SMOKE *liquid);
+
 #ifdef __cplusplus
 }
 #endif
diff --git a/intern/mantaflow/intern/SMOKE.cpp 
b/intern/mantaflow/intern/SMOKE.cpp
index 3d0e73f..2ffe341 100644
--- a/intern/mantaflow/intern/SMOKE.cpp
+++ b/intern/mantaflow/intern/SMOKE.cpp
@@ -109,12 +109,22 @@ SMOKE::SMOKE(int *res, SmokeModifierData *smd)
        mTextureU2      = NULL;
        mTextureV2      = NULL;
        mTextureW2      = NULL;
+       
+       // Liquids
+       mPhi            = NULL;
 
        // Only start Mantaflow once. No need to start whenever new SMOKE 
objected is allocated
        if (!mantaInitialized)
                startMantaflow();
        
        // Initialize Mantaflow variables in Python
+       // Liquid
+       if (mUsingLiquid) {
+               initLiquid(smd);
+               updatePointers(smd);
+               return;
+       }
+       
        // Smoke
        if (mUsingSmoke) {
                initSetup(smd);
@@ -285,7 +295,13 @@ SMOKE::~SMOKE()
 
        // Destruction in Python
        mCommands.clear();
-
+       
+       // Liquid
+       if (mUsingLiquid) {
+               mCommands.push_back(del_liquid_grids);
+               mCommands.push_back(del_liquid_vars);
+       }
+       
        // Smoke
        if (mUsingSmoke) {
                mCommands.push_back(del_base_grids_low);
@@ -351,6 +367,9 @@ SMOKE::~SMOKE()
                mTextureW2      = NULL;
        }
        
+       // Liquid
+       mPhi = NULL;
+       
        // Reset flags
        mUsingHeat    = false;
        mUsingFire    = false;
@@ -648,6 +667,10 @@ void SMOKE::updatePointers(SmokeModifierData *smd)
 {
        std::cout << "Updating pointers low res" << std::endl;
 
+       if (mUsingLiquid) {
+               mPhi        = (float*)         getGridPointer("phi",         
"s");
+       }
+       
        // Smoke
        if (mUsingSmoke) {
                mDensity        = (float*)         getGridPointer("density",    
 "s");
diff --git a/intern/mantaflow/intern/SMOKE.h b/intern/mantaflow/intern/SMOKE.h
index 40917fd..2487c67 100644
--- a/intern/mantaflow/intern/SMOKE.h
+++ b/intern/mantaflow/intern/SMOKE.h
@@ -106,6 +106,8 @@ public:
        inline float* getTextureU2() { return mTextureU2; }
        inline float* getTextureV2() { return mTextureV2; }
        inline float* getTextureW2() { return mTextureW2; }
+       
+       inline float* getPhi() { return mPhi; }
 
        static bool mantaInitialized;
 
@@ -172,6 +174,9 @@ private:
        float* mTextureV2;
        float* mTextureW2;
        
+       // Liquids
+       float* mPhi;
+       
        void initSetup(struct SmokeModifierData *smd);
        void initSetupHigh(struct SmokeModifierData *smd);
        void initLiquid(SmokeModifierData *smd);
diff --git a/intern/mantaflow/intern/manta_smoke_API.cpp 
b/intern/mantaflow/intern/manta_smoke_API.cpp
index cd4f7b4..c356aa4 100644
--- a/intern/mantaflow/intern/manta_smoke_API.cpp
+++ b/intern/mantaflow/intern/manta_smoke_API.cpp
@@ -478,3 +478,8 @@ extern "C" float *smoke_get_fuel_inflow(SMOKE *smoke)
 {
        return smoke->getFuelInflow();
 }
+
+extern "C" float *liquid_get_phi(SMOKE *liquid)
+{
+       return liquid->getPhi();
+}

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to