diff options
author | Matt Ebb <matt@mke3.net> | 2011-05-13 02:52:30 +0400 |
---|---|---|
committer | Matt Ebb <matt@mke3.net> | 2011-05-13 02:52:30 +0400 |
commit | b73fe01295636aea92bf3076874b5e3cbcba9057 (patch) | |
tree | 9e9d6688e346e5c3b1b09db6e02932cceb6eb8ed /source/blender/render | |
parent | 57c626d11c0b2d0ed7cce7e60c863477f87d8ebd (diff) |
* Enabled rna access to fluid sim velocity vectors
The main purpose for this is to allow rendering motion blurred blender fluids in external renderers (eg. http://vimeo.com/21870635 ).
Python code snippet for interpreting this data here: http://www.pasteall.org/21577 . Cleaned up some ugly hacks in this area too
* Also added read-only access to scene.subframe to RNA - setting current frame and subframe should still go via scene.frame_set()
Diffstat (limited to 'source/blender/render')
-rw-r--r-- | source/blender/render/intern/source/convertblender.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/source/blender/render/intern/source/convertblender.c b/source/blender/render/intern/source/convertblender.c index 74ce7957dd7..c1c2fb60abd 100644 --- a/source/blender/render/intern/source/convertblender.c +++ b/source/blender/render/intern/source/convertblender.c @@ -5387,7 +5387,7 @@ static int load_fluidsimspeedvectors(Render *re, ObjectInstanceRen *obi, float * float imat[4][4]; FluidsimModifierData *fluidmd = (FluidsimModifierData *)modifiers_findByType(fsob, eModifierType_Fluidsim); FluidsimSettings *fss; - float *velarray = NULL; + FluidVertexVelocity *velarray = NULL; /* only one step needed */ if(step) return 1; @@ -5401,14 +5401,14 @@ static int load_fluidsimspeedvectors(Render *re, ObjectInstanceRen *obi, float * invert_m4_m4(imat, mat); /* set first vertex OK */ - if(!fss->meshSurfNormals) return 0; + if(!fss->meshVelocities) return 0; - if( obr->totvert != GET_INT_FROM_POINTER(fss->meshSurface) ) { + if( obr->totvert != fss->totvert) { //fprintf(stderr, "load_fluidsimspeedvectors - modified fluidsim mesh, not using speed vectors (%d,%d)...\n", obr->totvert, fsob->fluidsimSettings->meshSurface->totvert); // DEBUG return 0; } - velarray = (float *)fss->meshSurfNormals; + velarray = fss->meshVelocities; if(obi->flag & R_TRANSFORMED) mul_m4_m4m4(winmat, obi->mat, re->winmat); @@ -5420,7 +5420,7 @@ static int load_fluidsimspeedvectors(Render *re, ObjectInstanceRen *obi, float * so that also small drops/little water volumes return a velocity != 0. But I had no luck in fixing that function - DG */ for(a=0; a<obr->totvert; a++) { - for(j=0;j<3;j++) avgvel[j] += velarray[3*a + j]; + for(j=0;j<3;j++) avgvel[j] += velarray[a].vel[j]; } for(j=0;j<3;j++) avgvel[j] /= (float)(obr->totvert); @@ -5435,7 +5435,7 @@ static int load_fluidsimspeedvectors(Render *re, ObjectInstanceRen *obi, float * // get fluid velocity fsvec[3] = 0.; //fsvec[0] = fsvec[1] = fsvec[2] = fsvec[3] = 0.; fsvec[2] = 2.; // NT fixed test - for(j=0;j<3;j++) fsvec[j] = velarray[3*a + j]; + for(j=0;j<3;j++) fsvec[j] = velarray[a].vel[j]; /* (bad) HACK insert average velocity if none is there (see previous comment) */ if((fsvec[0] == 0.0) && (fsvec[1] == 0.0) && (fsvec[2] == 0.0)) |