smoke:
authorDaniel Genrich <daniel.genrich@gmx.net>
Fri, 7 Aug 2009 13:19:17 +0000 (13:19 +0000)
committerDaniel Genrich <daniel.genrich@gmx.net>
Fri, 7 Aug 2009 13:19:17 +0000 (13:19 +0000)
- Bugfix: a bit too fast ;-) Better do it right too (problem with res > 150)
- fixing high res view button which disappeared sometimes
- fixing tooltip

intern/smoke/intern/FLUID_3D_SOLVERS.cpp
source/blender/blenkernel/intern/smoke.c
source/blender/makesrna/intern/rna_smoke.c

index c6142bbb4bc84a4a98e49c918c5b854f46220bc1..51929e1194b90c7854e309fee4130ffe1a55ef66 100644 (file)
@@ -85,7 +85,7 @@ void FLUID_3D::solvePressurePre(float* field, float* b, unsigned char* skip)
   //while ((i < _iterations) && (deltaNew > eps*delta0))
   float maxR = 2.0f * eps;
   // while (i < _iterations)
-  while ((i < _iterations) && (maxR > eps))
+  while ((i < _iterations) && (maxR > 0.001*eps))
   {
     // (s) q = Ad (p)
     index = _slabSize + _xRes + 1;
@@ -183,7 +183,7 @@ void FLUID_3D::solvePressurePre(float* field, float* b, unsigned char* skip)
     // i = i + 1
     i++;
   }
-  cout << i << " iterations converged to " << maxR << endl;
+  // cout << i << " iterations converged to " << sqrt(maxR) << endl;
 }
 
 //////////////////////////////////////////////////////////////////////
@@ -330,7 +330,7 @@ void FLUID_3D::solvePressure(float* field, float* b, unsigned char* skip)
     // i = i + 1
     i++;
   }
-  cout << i << " iterations converged to " << maxR << endl;
+  // cout << i << " iterations converged to " << maxR << endl;
 }
 
 //////////////////////////////////////////////////////////////////////
index 3b9f19c5386259fca136a904b4f832c436555f12..0d46e4baa88b75df6ffe5a76453b70a9f8c01544 100644 (file)
@@ -126,82 +126,6 @@ void calcTriangleDivs(Object *ob, MVert *verts, int numverts, MFace *tris, int n
 
 #define TRI_UVOFFSET (1./4.)
 
-
-BVHTree *bvhtree_build_from_smoke ( float mat[4][4], MFace *mfaces, unsigned int numfaces, MVert *x, unsigned int numverts, float epsilon )
-{
-       BVHTree *tree;
-       float co[12];
-       int i;
-       MFace *tface = mfaces;
-
-       // calc quads 
-       // todo
-
-       tree = BLI_bvhtree_new ( numfaces, epsilon, 2, 6 );
-
-       // fill tree
-       for ( i = 0; i < numfaces; i++, tface++ )
-       {
-               VECCOPY ( &co[0*3], x[tface->v1].co );
-               Mat4MulVecfl (mat, &co[0*3]);
-               VECCOPY ( &co[1*3], x[tface->v2].co );
-               Mat4MulVecfl (mat, &co[1*3]);
-               VECCOPY ( &co[2*3], x[tface->v3].co );
-               Mat4MulVecfl (mat, &co[2*3]);
-
-               if ( tface->v4 )
-               {
-                       VECCOPY ( &co[3*3], x[tface->v4].co );
-                       Mat4MulVecfl (mat, &co[3*3]);
-               }
-
-               BLI_bvhtree_insert ( tree, i, co, ( mfaces->v4 ? 4 : 3 ) );
-       }
-
-       // balance tree
-       BLI_bvhtree_balance ( tree );
-
-       return tree;
-}
-
-void bvhtree_update_from_smoke ( float mat[4][4], BVHTree * bvhtree, MFace *faces, int numfaces, MVert *x, int numverts)
-{
-       int i;
-       MFace *mfaces = faces;
-       float co[12];
-       int ret = 0;
-
-       if ( !bvhtree )
-               return;
-
-       if ( x )
-       {
-               for ( i = 0; i < numfaces; i++, mfaces++ )
-               {
-                       VECCOPY ( &co[0*3], x[mfaces->v1].co );
-                       Mat4MulVecfl (mat, &co[0*3]);
-                       VECCOPY ( &co[1*3], x[mfaces->v2].co );
-                       Mat4MulVecfl (mat, &co[1*3]);
-                       VECCOPY ( &co[2*3], x[mfaces->v3].co );
-                       Mat4MulVecfl (mat, &co[2*3]);
-
-                       if ( mfaces->v4 )
-                       {
-                               VECCOPY ( &co[3*3], x[mfaces->v4].co );
-                               Mat4MulVecfl (mat, &co[3*3]);
-                       }
-
-                       ret = BLI_bvhtree_update_node ( bvhtree, i, co, NULL, ( mfaces->v4 ? 4 : 3 ) );
-
-                       // check if tree is already full
-                       if ( !ret )
-                               break;
-               }
-
-               BLI_bvhtree_update_tree ( bvhtree );
-       }
-}
-
 int smokeModifier_init (SmokeModifierData *smd, Object *ob, Scene *scene, DerivedMesh *dm)
 {
        if((smd->type & MOD_SMOKE_TYPE_DOMAIN) && smd->domain && !smd->domain->fluid)
@@ -641,7 +565,14 @@ void smokeModifier_reset(struct SmokeModifierData *smd)
                                smd->domain->bind = NULL;
                        }
                        smd->domain->max_textures = 0;
-                       smd->domain->viewsettings = 0; // reset view for new frame
+                       if(smd->domain->viewsettings < MOD_SMOKE_VIEW_USEBIG)
+                       {
+                               smd->domain->viewsettings = 0;
+                       }
+                       else
+                       {
+                               smd->domain->viewsettings = MOD_SMOKE_VIEW_USEBIG;
+                       }
 
                        if(smd->domain->tray)
                                MEM_freeN(smd->domain->tray);
@@ -795,11 +726,6 @@ void smokeModifier_do(SmokeModifierData *smd, Scene *scene, Object *ob, DerivedM
                        // XXX TODO
                        smd->time = scene->r.cfra;
                        
-                       if(smd->coll->bvhtree)
-                               bvhtree_update_from_smoke ( ob->obmat, smd->coll->bvhtree, dm->getFaceArray(dm), dm->getNumFaces(dm), dm->getVertArray(dm), dm->getNumVerts(dm));
-                       else
-                               printf("smoke coll with no bvh\n");
-
                        if(smd->coll->dm)
                                smd->coll->dm->release(smd->coll->dm);
 
index eb9d09564ae0eb876cc8ad409bc33258c80420c7..eefafcc32b49d6914f5f0a689fd6b32da2a273e0 100644 (file)
@@ -155,7 +155,7 @@ static void rna_def_smoke_domain_settings(BlenderRNA *brna)
 
        prop= RNA_def_property(srna, "viewhighres", PROP_BOOLEAN, PROP_NONE);
        RNA_def_property_boolean_sdna(prop, NULL, "viewsettings", MOD_SMOKE_VIEW_USEBIG);
-       RNA_def_property_ui_text(prop, "Show high res", "Show high resolution (using amplification).");
+       RNA_def_property_ui_text(prop, "Show High Resolution", "Show high resolution (using amplification).");
        RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_Smoke_redraw");
 
        prop= RNA_def_property(srna, "noise_type", PROP_ENUM, PROP_NONE);