Introduced quality to GUI, not yet tested (WIP commit)
authorDaniel Genrich <daniel.genrich@gmx.net>
Tue, 8 Jul 2008 17:38:33 +0000 (17:38 +0000)
committerDaniel Genrich <daniel.genrich@gmx.net>
Tue, 8 Jul 2008 17:38:33 +0000 (17:38 +0000)
intern/elbeem/extern/elbeem.h
intern/elbeem/intern/elbeem.cpp
intern/elbeem/intern/ntl_geometryobject.cpp
intern/elbeem/intern/ntl_geometryobject.h
intern/elbeem/intern/solver_control.cpp
source/blender/makesdna/DNA_object_fluidsim.h
source/blender/src/buttons_object.c
source/blender/src/fluidsim.c

index 5370196..2cee22a 100644 (file)
@@ -162,6 +162,7 @@ typedef struct elbeemMesh {
        /* fluid control settings */
        float cpsTimeStart;
        float cpsTimeEnd;
+       float cpsQuality;
        
        int channelSizeAttractforceStrength;
        float *channelAttractforceStrength;
index 00fc9ef..0deed50 100644 (file)
@@ -163,6 +163,7 @@ void elbeemResetMesh(elbeemMesh *mesh) {
        /* fluid control settings */
        mesh->cpsTimeStart = 0;
        mesh->cpsTimeEnd = 0;
+       mesh->cpsQuality = 0;
        
        mesh->channelSizeAttractforceStrength = 0;
        mesh->channelAttractforceStrength = NULL;
@@ -215,6 +216,7 @@ int elbeemAddMesh(elbeemMesh *mesh) {
        /* fluid control features */
        obj->setCpsTimeStart(mesh->cpsTimeStart);
        obj->setCpsTimeEnd(mesh->cpsTimeEnd);
+       obj->setCpsQuality(mesh->cpsQuality);
        
        if((mesh->volumeInitType<VOLUMEINIT_VOLUME)||(mesh->volumeInitType>VOLUMEINIT_BOTH)) mesh->volumeInitType = VOLUMEINIT_VOLUME;
        obj->setVolumeInit(mesh->volumeInitType);
index 32433df..c7a222a 100644 (file)
@@ -42,6 +42,7 @@ ntlGeometryObject::ntlGeometryObject() :
        mTriangleDivs1(), mTriangleDivs2(), mTriangleDivs3(),
        mMovPntsInited(-100.0), mMaxMovPnt(-1),
        mcGeoActive(1.),
+       mCpsTimeStart(0.), mCpsTimeEnd(1.0), mCpsQuality(10.),
        mcAttrFStr(0.),mcAttrFRad(0.), mcVelFStr(0.), mcVelFRad(0.)
 { 
 };
index 436e511..6667983 100644 (file)
@@ -109,6 +109,10 @@ class ntlGeometryObject : public ntlGeometryClass
                inline float getCpsTimeEnd() const { return mCpsTimeEnd; }
                inline void setCpsTimeEnd(float set) { mCpsTimeEnd=set; }
                
+               /*! Set/get the particle control set quality */
+               inline float getCpsQuality() const { return mCpsQuality; }
+               inline void setCpsQuality(float set) { mCpsQuality=set; }
+               
                inline AnimChannel<float> getCpsAttrFStr() const { return mcAttrFStr; }
                inline AnimChannel<float> getCpsAttrFRad() const { return mcAttrFRad; }
                inline AnimChannel<float> getCpsVelFStr() const { return mcVelFStr; }
@@ -228,6 +232,7 @@ class ntlGeometryObject : public ntlGeometryClass
                /* fluid control settings */
                float mCpsTimeStart;
                float mCpsTimeEnd;
+               float mCpsQuality;
                AnimChannel<float> mcAttrFStr, mcAttrFRad, mcVelFStr, mcVelFRad;
 
        public:
index bda464f..3dc9b70 100644 (file)
@@ -242,6 +242,9 @@ LbmFsgrSolver::initCpdata()
                        cset->mCparts->setCPSTimeStart(obj->getCpsTimeStart());
                        cset->mCparts->setCPSTimeEnd(obj->getCpsTimeEnd());
                        
+                       if(obj->getCpsQuality() > LBM_EPSILON)
+                               cset->mCparts->setCPSWith(1.0 / obj->getCpsQuality());
+                       
                        // this value can be left at 0.5:
                        cset->mCparts->setCPSMvmWeightFac(0.5);
 
index 0c0eff0..3426b14 100644 (file)
@@ -121,6 +121,7 @@ typedef struct FluidsimSettings {
        /* Fluid control settings */
        float cpsTimeStart;
        float cpsTimeEnd;
+       float cpsQuality;
        
        float attractforceStrength;
        float attractforceRadius;
index 3a0c9e8..6146fb0 100644 (file)
@@ -5069,7 +5069,7 @@ static void object_panel_fluidsim(Object *ob)
 
                                        if(fss->typeFlags&OB_FSBND_PARTSLIP) {
                                                uiDefBut(block, LABEL, 0, "PartSlipValue:",             0,yline,200,objHeight, NULL, 0.0, 0, 0, 0, "");
-                                               uiDefButF(block, NUM, B_DIFF, "", 200, yline,100,objHeight, &fss->partSlipValue, 0.0, 1.0, 10,0, ".");
+                                               uiDefButF(block, NUM, B_DIFF, "Amount of mixing between no- and free-slip, 0=stickier, 1=same as free slip.", 200, yline,100,objHeight, &fss->partSlipValue, 0.0, 1.0, 10,0, ".");
                                                yline -= lineHeight;
                                        } else { 
                                                //uiDefBut(block, LABEL, 0, "-",        200,yline,100,objHeight, NULL, 0.0, 0, 0, 0, ""); 
@@ -5216,8 +5216,8 @@ static void object_panel_fluidsim(Object *ob)
                        }
                        else if(fss->type == OB_FLUIDSIM_CONTROL) {
                                
-                               uiDefButF(block, NUM, B_DIFF, "Time Sta:", 0, yline,150,20, &fss->cpsTimeStart, 0.0, 2.0,   10,0, "Specifies time when the control particles are activated.");
-                               uiDefButF(block, NUM, B_DIFF, "Time End:", 150, yline,150,20, &fss->cpsTimeEnd, 0.0, 2.0,   10,0, "Specifies time when the control particles are deactivated.");
+                               uiDefButF(block, NUM, B_DIFF, "Time Sta:", 0, yline,150,20, &fss->cpsTimeStart, 0.0, 100.0,   10,0, "Specifies time when the control particles are activated.");
+                               uiDefButF(block, NUM, B_DIFF, "Time End:", 150, yline,150,20, &fss->cpsTimeEnd, 0.0, 100.0,   10,0, "Specifies time when the control particles are deactivated.");
                                
                                yline -= lineHeight;
                                
@@ -5230,6 +5230,9 @@ static void object_panel_fluidsim(Object *ob)
                                yline -= lineHeight;
                                uiDefButF(block, NUM, B_DIFF, "Strength:", 0, yline,150,20, &fss->velocityforceStrength, 0.0, 2.0,   10,0, "");
                                uiDefButF(block, NUM, B_DIFF, "Radius:", 150, yline,150,20, &fss->velocityforceRadius, 0.0, 2.0,   10,0, "");
+                               
+                               yline -= lineHeight;
+                               uiDefButF(block, NUM, B_DIFF, "Quality:", 0, yline,150,20, &fss->cpsQuality, 1.0, 100.0,   10,0, "Specifies the quality which is used for object sampling.");
                        }
                        else {
                                yline -= lineHeight + 5;
index 0d38e8b..4504ae8 100644 (file)
@@ -221,6 +221,7 @@ FluidsimSettings *fluidsimSettingsNew(struct Object *srcob)
        fss->velocityforceRadius = 0.75;
        fss->cpsTimeStart = fss->animStart;
        fss->cpsTimeEnd = fss->animEnd;
+       fss->cpsQuality = 10.0; // 1.0 / 10.0 => means 0.1 width
 
        return fss;
 }
@@ -1073,6 +1074,7 @@ void fluidsimBake(struct Object *ob)
                                        
                                        fsmesh.cpsTimeStart = obit->fluidsimSettings->cpsTimeStart;
                                        fsmesh.cpsTimeEnd = obit->fluidsimSettings->cpsTimeEnd;
+                                       fsmesh.cpsQuality = obit->fluidsimSettings->cpsQuality;
                                        
                                        fsmesh.channelSizeAttractforceRadius = 
                                        fsmesh.channelSizeVelocityforceStrength = 
@@ -1084,7 +1086,7 @@ void fluidsimBake(struct Object *ob)
                                        fsmesh.channelVelocityforceStrength = channelVelocityforceStrength[o];
                                        fsmesh.channelVelocityforceRadius = channelVelocityforceRadius[o];
                                }
-                               else*/
+                               else */
                                {
                                        // set channels to 0
                                        fsmesh.channelAttractforceStrength =