Commit: 90bad37c82eda5506d0c30fefa06117db568aae7
Author: Sebastián Barschkis
Date:   Fri Aug 19 14:01:34 2016 +0200
Branches: fluid-mantaflow
https://developer.blender.org/rB90bad37c82eda5506d0c30fefa06117db568aae7

fixed obstacles for liquids (=blender source - manta liquid script needs some 
more customizations)

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

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       intern/mantaflow/intern/strings/liquid_script.h
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 4a9dce5..69a2c68 100644
--- a/intern/mantaflow/extern/manta_fluid_API.h
+++ b/intern/mantaflow/extern/manta_fluid_API.h
@@ -86,8 +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);
-int *smoke_get_flags(struct FLUID *smoke);
-int *smoke_turbulence_get_flags(struct FLUID *smoke);
+unsigned char *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 f78e53d..06fa89e 100644
--- a/intern/mantaflow/intern/FLUID.cpp
+++ b/intern/mantaflow/intern/FLUID.cpp
@@ -76,7 +76,6 @@ FLUID::FLUID(int *res, SmokeModifierData *smd)
        
        // Smoke low res grids
        mDensity        = NULL;
-       mFlags          = NULL;
        mHeat           = NULL;
        mVelocityX      = NULL;
        mVelocityY      = NULL;
@@ -95,7 +94,7 @@ FLUID::FLUID(int *res, SmokeModifierData *smd)
        mColorB         = NULL;
        mDensityInflow  = NULL;
        mFuelInflow     = NULL;
-       mObstacles      = NULL;
+       mObstacle       = NULL;
        
        // Smoke high res grids
        mDensityHigh    = NULL;
@@ -402,7 +401,6 @@ FLUID::~FLUID()
        
        // Reset pointers to avoid dangling pointers
        mDensity        = NULL;
-       mFlags          = NULL;
        mHeat           = NULL;
        mVelocityX      = NULL;
        mVelocityY      = NULL;
@@ -421,24 +419,21 @@ FLUID::~FLUID()
        mColorB         = NULL;
        mDensityInflow  = NULL;
        mFuelInflow     = NULL;
-       mObstacles      = NULL;
+       mObstacle       = NULL;
        
-       if (mUsingHighRes)
-       {
-               mDensityHigh    = NULL;
-               mFlameHigh      = NULL;
-               mFuelHigh       = NULL;
-               mReactHigh      = NULL;
-               mColorRHigh     = NULL;
-               mColorGHigh     = NULL;
-               mColorBHigh     = NULL;
-               mTextureU       = NULL;
-               mTextureV       = NULL;
-               mTextureW       = NULL;
-               mTextureU2      = NULL;
-               mTextureV2      = NULL;
-               mTextureW2      = NULL;
-       }
+       mDensityHigh    = NULL;
+       mFlameHigh      = NULL;
+       mFuelHigh       = NULL;
+       mReactHigh      = NULL;
+       mColorRHigh     = NULL;
+       mColorGHigh     = NULL;
+       mColorBHigh     = NULL;
+       mTextureU       = NULL;
+       mTextureV       = NULL;
+       mTextureW       = NULL;
+       mTextureU2      = NULL;
+       mTextureV2      = NULL;
+       mTextureW2      = NULL;
        
        // Liquid
        mPhi     = NULL;
@@ -841,29 +836,31 @@ void FLUID::updatePointers(SmokeModifierData *smd)
 {
        std::cout << "Updating pointers low res" << std::endl;
 
-       mFlags = (int*) getGridPointer("flags", "s");
+       mObstacle = (unsigned char*) getGridPointer("flags", "s");
+       
+       mVelocityX = (float*) getGridPointer("x_vel", "s");
+       mVelocityY = (float*) getGridPointer("y_vel", "s");
+       mVelocityZ = (float*) getGridPointer("z_vel", "s");
+       
+       mObVelocityX = (float*) getGridPointer("x_obvel", "s");
+       mObVelocityY = (float*) getGridPointer("y_obvel", "s");
+       mObVelocityZ = (float*) getGridPointer("z_obvel", "s");
+       
+       mForceX    = (float*) getGridPointer("x_force", "s");
+       mForceY    = (float*) getGridPointer("y_force", "s");
+       mForceZ    = (float*) getGridPointer("z_force", "s");
        
        // Liquid
        if (mUsingLiquid) {
-               mPhi        = (float*)         getGridPointer("phi",            
 "s");
-               mPhiInit    = (float*)         getGridPointer("phiInit",        
 "s");
+               mPhi        = (float*) getGridPointer("phi",     "s");
+               mPhiInit    = (float*) getGridPointer("phiInit", "s");
        }
        
        // Smoke
        if (mUsingSmoke) {
-               mDensity        = (float*)         getGridPointer("density",    
 "s");
-               mVelocityX      = (float*)         getGridPointer("x_vel",      
 "s");
-               mVelocityY      = (float*)         getGridPointer("y_vel",      
 "s");
-               mVelocityZ      = (float*)         getGridPointer("z_vel",      
 "s");
-               mObVelocityX    = (float*)         getGridPointer("x_obvel",    
 "s");
-               mObVelocityY    = (float*)         getGridPointer("y_obvel",    
 "s");
-               mObVelocityZ    = (float*)         getGridPointer("z_obvel",    
 "s");
-               mForceX         = (float*)         getGridPointer("x_force",    
 "s");
-               mForceY         = (float*)         getGridPointer("y_force",    
 "s");
-               mForceZ         = (float*)         getGridPointer("z_force",    
 "s");
-               mDensityInflow  = (float*)         
getGridPointer("inflow_grid", "s");
-               mFuelInflow     = (float*)         
getGridPointer("fuel_inflow", "s");
-               mObstacles      = (unsigned char*) getGridPointer("flags",      
 "s");
+               mDensity        = (float*) getGridPointer("density",     "s");
+               mDensityInflow  = (float*) getGridPointer("inflow_grid", "s");
+               mFuelInflow     = (float*) getGridPointer("fuel_inflow", "s");
                
                if (mUsingHeat) {
                        mHeat       = (float*) getGridPointer("heat",    "s");
@@ -884,6 +881,8 @@ void FLUID::updatePointers(SmokeModifierData *smd)
 void FLUID::updatePointersHigh(SmokeModifierData *smd)
 {
        std::cout << "Updating pointers high res" << std::endl;
+       
+       mObstacleHigh = (unsigned char*) getGridPointer("xl_flags", "s");
 
        // Liquid
        if (mUsingLiquid) {
diff --git a/intern/mantaflow/intern/FLUID.h b/intern/mantaflow/intern/FLUID.h
index 185d741..e99937b 100644
--- a/intern/mantaflow/intern/FLUID.h
+++ b/intern/mantaflow/intern/FLUID.h
@@ -90,7 +90,7 @@ public:
        inline float* getForceX() { return mForceX; }
        inline float* getForceY() { return mForceY; }
        inline float* getForceZ() { return mForceZ; }
-       inline unsigned char* getObstacles() { return mObstacles; }
+       inline unsigned char* getObstacle() { return mObstacle; }
        inline unsigned char* getObstaclesAnim() { return mObstaclesAnim; }
        inline float* getFlame() { return mFlame; }
        inline float* getFuel() { return mFuel; }
@@ -100,7 +100,6 @@ public:
        inline float* getColorB() { return mColorB; }
        inline float* getDensityInflow() { return mDensityInflow; }
        inline float* getFuelInflow() { return mFuelInflow; }
-       inline int* getFlags() { return mFlags; }
 
        inline float* getDensityHigh() { return mDensityHigh; }
        inline float* getFlameHigh() { return mFlameHigh; }
@@ -115,7 +114,7 @@ public:
        inline float* getTextureU2() { return mTextureU2; }
        inline float* getTextureV2() { return mTextureV2; }
        inline float* getTextureW2() { return mTextureW2; }
-       inline int* getFlagsHigh() { return mFlagsHigh; }
+       inline unsigned char* getObstacleHigh() { return mObstacleHigh; }
        
        inline float* getPhi()     { return mPhi; }
        inline float* getPhiInit() { return mPhiInit; }
@@ -179,7 +178,7 @@ private:
        float* mForceX;
        float* mForceY;
        float* mForceZ;
-       unsigned char* mObstacles; /* only used (useful) for static obstacles 
like domain boundaries */
+       unsigned char* mObstacle; /* only used (useful) for static obstacles 
like domain boundaries */
        unsigned char* mObstaclesAnim;
        float *mFlame;
        float *mFuel;
@@ -189,7 +188,6 @@ private:
        float *mColorB;
        float* mDensityInflow;
        float* mFuelInflow;
-       int* mFlags;
 
        // Smoke grids high res
        float* mDensityHigh;
@@ -205,7 +203,7 @@ private:
        float* mTextureU2;
        float* mTextureV2;
        float* mTextureW2;
-       int* mFlagsHigh;
+       unsigned char* mObstacleHigh;
        
        // Liquids
        float* mPhi;
diff --git a/intern/mantaflow/intern/manta_fluid_API.cpp 
b/intern/mantaflow/intern/manta_fluid_API.cpp
index fd07158..a5f2b6d 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 **obstacles)
+                                                        float **smoke_inflow, 
float **vx, float **vy, float **vz, float **r, float **g, float **b, unsigned 
char **obstacle)
 {
        *dens = smoke->getDensity();
        if (fuel)
@@ -157,7 +157,7 @@ extern "C" void smoke_export(FLUID *smoke, float *dt, float 
*dx, float **dens, f
                *g = smoke->getColorG();
        if (b)
                *b = smoke->getColorB();
-       *obstacles = smoke->getObstacles();
+       *obstacle = smoke->getObstacle();
        *dt = 1; //dummy value, not needed for smoke
        *dx = 1; //dummy value, not needed for smoke
 }
@@ -195,11 +195,6 @@ extern "C" float *smoke_get_density(FLUID *smoke)
        return smoke->getDensity();
 }
 
-extern "C" int *smoke_get_flags(FLUID *smoke)
-{
-       return smoke->getFlags();
-}
-
 extern "C" float *smoke_get_fuel(FLUID *smoke)
 {
        return smoke->getFuel();
@@ -343,9 +338,9 @@ extern "C" float *smoke_turbulence_get_density(FLUID *smoke)
        return (smoke && smoke->usingHighRes()) ? smoke->getDensityHigh() : 
NULL;
 }
 
-extern "C" int *smoke_turbulence_get_flags(FLUID *smoke)
+extern "C" unsigned char *smoke_turbulence_get_obstacle(FLUID *smoke)
 {
-       return (smoke && smoke->usingHighRes()) ? smoke->getFlagsHigh() : NULL;
+       return (smoke && smoke->usingHighRes()) ? smoke->getObstacleHigh() : 
NULL;
 }
 
 extern "C" float *smoke_turbulence_get_fuel(FLUID *smoke)
@@ -400,7 +395,7 @@ extern "C" int smoke_turbulence_get_cells(FLUID *smoke)
 
 extern "C" unsigned char *smoke_get_obstacle(FLUID *smoke)
 {
-       return smoke->getObstacles();
+       return smoke->getObstacle();
 }
 
 extern "C" void smoke_get_ob_velocity(FLUID *smoke, float **x, float **y, 
float **z)
diff --git a/intern/mantaflow/intern/strings/liquid_script.h 
b/intern/mantaflow/intern/strings/liquid_script.h
index 3109e9b..8d6dbe4 100644
--- a/intern/mantaflow/intern/strings/liquid_script.h
+++ b/intern/mantaflow/intern/strings/liquid_script.h
@@ -86,6 +86,13 @@ phiInit    = s.create(LevelsetGrid)\n\
 pressure   = s.create(RealGrid)\n\
 \n\
 vel        = s.create(MACGrid)\n\
+x_vel      = s.create(RealGrid)\n\
+y_vel      = s.create(RealGrid)\n\
+z_vel      = s.create(RealGrid)\n\
+obvel      = s.create(MACGrid)\n\
+x_obvel    = s.create(RealGrid)\n\
+y_obvel    = s.create(RealGrid)\n\
+z_obvel    = s.create(RealGrid)\n\
 velOld     = s.create(MACGrid)\n\
 velParts   = s.create(MACGrid)\n\
 mapWeights = s.create(MACGrid)\n\
@@ -146,6 +153,10 @@ def manta_step(star

@@ Diff output truncated at 10240 characters. @@

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

Reply via email to