diff options
author | Nils Thuerey <nils@thuerey.de> | 2006-03-29 11:35:54 +0400 |
---|---|---|
committer | Nils Thuerey <nils@thuerey.de> | 2006-03-29 11:35:54 +0400 |
commit | 0a63b3c0ca032d7bb26a97164f034a49499eee68 (patch) | |
tree | c14cbc74d3b0e6136dc060fe4e8a1bf16804a90b /source/blender/src/fluidsim.c | |
parent | 0d2902b1fe50cd27f0046a4c0ecf140e6e1284a8 (diff) |
Several minor fixes:
- Added part of Austin's msvc8 fixes (vector::erase function
was "misused"), hopefully compiles better now.
- Ctrl-b now also bakes a selected fluidsim domain
similar to the softbodies.
- Added surface smoothing option for domains: default is
1, higher values result in a smoother surface (and probably
slightly higher comupation times), while 0 means the surface
is not modified at all.
- Added BLENDER_ELBEEMBOBJABORT environment variable in readBobj,
if >0 quits blender when a not yet existing fluidsim
frame should be loaded. Useful for rendering simulations
as far as possible from the command line.
- Surface normals pointer is now set to NULL in readfile.c
- Fixed win32 error string handling, now uses a function
to return the string from the solver.
- Fixed fluidsim particle halo scaling problem.
- Solver update
Diffstat (limited to 'source/blender/src/fluidsim.c')
-rw-r--r-- | source/blender/src/fluidsim.c | 49 |
1 files changed, 34 insertions, 15 deletions
diff --git a/source/blender/src/fluidsim.c b/source/blender/src/fluidsim.c index ef1d5fc3dc2..15e41beae69 100644 --- a/source/blender/src/fluidsim.c +++ b/source/blender/src/fluidsim.c @@ -84,6 +84,7 @@ #include "BSE_headerbuttons.h" #include "mydevice.h" +#include "blendef.h" #include "SDL.h" #include "SDL_thread.h" #include "SDL_mutex.h" @@ -109,9 +110,6 @@ void initElbeemMesh(struct Object *ob, int *numVertices, float **vertices, int * extern int start_progress_bar(void); extern void end_progress_bar(void); extern int progress_bar(float done, char *busy_info); -// global solver state -extern int gElbeemState; -extern char gElbeemErrorString[]; double fluidsimViscosityPreset[6] = { -1.0, /* unused */ @@ -197,9 +195,11 @@ FluidsimSettings *fluidsimSettingsNew(struct Object *srcob) fluidsimGetAxisAlignedBB(srcob->data, srcob->obmat, fss->bbStart, fss->bbSize, &fss->meshBB); fss->typeFlags = 0; + fss->domainNovecgen = 0; fss->partSlipValue = 0.0; fss->generateParticles = 0.0; + fss->surfaceSmoothing = 1.0; fss->particleInfSize = 0.0; fss->particleInfAlpha = 0.0; @@ -445,6 +445,24 @@ void fluidsimBake(struct Object *ob) return; } + /* no object pointer, find in selected ones.. */ + if(!ob) { + Base *base; + for(base=G.scene->base.first; base; base= base->next) { + if ( ((base)->flag & SELECT) + // ignore layer setting for now? && ((base)->lay & G.vd->lay) + ) { + if((!ob)&&(base->object->fluidsimFlag & OB_FLUIDSIM_ENABLE)&&(base->object->type==OB_MESH)) { + if(base->object->fluidsimSettings->type == OB_FLUIDSIM_DOMAIN) { + ob = base->object; + } + } + } + } + // no domains found? + if(!ob) return; + } + /* check if there's another domain... */ for(obit= G.main->object.first; obit; obit= obit->id.next) { if((obit->fluidsimFlag & OB_FLUIDSIM_ENABLE)&&(obit->type==OB_MESH)) { @@ -764,6 +782,8 @@ void fluidsimBake(struct Object *ob) fsset.gstar = domainSettings->gstar; fsset.maxRefine = domainSettings->maxRefine; // check <-> gridlevels fsset.generateParticles = domainSettings->generateParticles; + fsset.surfaceSmoothing = domainSettings->surfaceSmoothing; + fsset.farFieldSize = domainSettings->farFieldSize; strcpy( fsset.outputPath, targetFile); // domain channels @@ -778,8 +798,7 @@ void fluidsimBake(struct Object *ob) else if((domainSettings->typeFlags&OB_FSBND_PARTSLIP)) fsset.obstacleType = FLUIDSIM_OBSTACLE_PARTSLIP; else if((domainSettings->typeFlags&OB_FSBND_FREESLIP)) fsset.obstacleType = FLUIDSIM_OBSTACLE_FREESLIP; fsset.obstaclePartslip = domainSettings->partSlipValue; - fsset.generateVertexVectors = (int)(!(domainSettings->typeFlags&OB_FSDOMAIN_NOVECGEN)); - // fprintf(stderr," VVV %d %d \n",fsset.generateVertexVectors , (domainSettings->typeFlags&OB_FSDOMAIN_NOVECGEN)); // DEBUG + fsset.generateVertexVectors = (domainSettings->domainNovecgen==0); // init blender trafo matrix // fprintf(stderr,"elbeemInit - mpTrafo:\n"); @@ -950,8 +969,8 @@ void fluidsimBake(struct Object *ob) " size = " "%d" /* gridSize*/ "; \n" " surfacepreview = " "%d" /* previewSize*/ "; \n" " dump_velocities = " "%d" /* vector dump */ "; \n" - " smoothsurface = 1.0; \n" - " smoothnormals = 1.0; \n" + " smoothsurface = %f; \n" /* smoothing */ + " smoothnormals = %f; \n" " geoinitid = 1; \n" "\n" " isovalue = 0.4900; \n" " isoweightmethod = 1; \n" "\n" ; @@ -959,7 +978,7 @@ void fluidsimBake(struct Object *ob) fprintf(fileCfg, simString, (double)domainSettings->realsize, (double)domainSettings->animStart, (double)domainSettings->gstar, gridlevels, (int)domainSettings->resolutionxyz, (int)domainSettings->previewresxyz , - (int)(!(domainSettings->typeFlags&OB_FSDOMAIN_NOVECGEN)) + (int)(domainSettings->domainNovecgen==0), domainSettings->surfaceSmoothing ); if((domainSettings->typeFlags&OB_FSBND_NOSLIP)) bi=0; @@ -972,6 +991,7 @@ void fluidsimBake(struct Object *ob) fluidsimPrintChannel(fileCfg, channelDomainViscosity,allchannelSize,"p_viscosity",CHANNEL_FLOAT); fluidsimPrintChannel(fileCfg, channelDomainGravity, allchannelSize,"p_gravity",CHANNEL_VEC); + fprintf(fileCfg, " partgenprob = %f; \n", domainSettings->generateParticles); // debug test fprintf(fileCfg, "\n} \n" ); } @@ -1199,17 +1219,16 @@ void fluidsimBake(struct Object *ob) if(!simAborted) { char fsmessage[512]; + char elbeemerr[256]; strcpy(fsmessage,"Fluidsim Bake Error: "); // check if some error occurred if(globalBakeState==-2) { strcat(fsmessage,"Failed to initialize [Msg: "); -#ifndef WIN32 - // msvc seems to have problem accessing the gElbeemErrorString var - strcat(fsmessage,"[Msg: "); - strcat(fsmessage,gElbeemErrorString); - strcat(fsmessage,"]"); -#endif // WIN32 - strcat(fsmessage,"|OK%x0"); + + elbeemGetErrorString(elbeemerr); + strcat(fsmessage,elbeemerr); + + strcat(fsmessage,"] |OK%x0"); pupmenu(fsmessage); } // init error } |