diff options
author | Martin Poirier <theeth@yahoo.com> | 2008-06-09 21:16:20 +0400 |
---|---|---|
committer | Martin Poirier <theeth@yahoo.com> | 2008-06-09 21:16:20 +0400 |
commit | ac0a91920af0c9de9f6dfbbf493ecb9e2509c15e (patch) | |
tree | 076b67eff10128d117a5580fe0cc7ae99758bb33 /source/blender/src/editparticle.c | |
parent | 83af2c1757d7ce76842dd13d92395d4bf5f0c410 (diff) |
Revision 14894 merged from apricot
----------------------------------
Arith:
- axis angle to quat conversion function
- short to float / float to short normals conversion function (eventually, we could go over the go and replace copy/pasted code everywhere)
- ray triangle intersection (to complement the line triangle intersection function)
View:
- viewray / viewline (get near plane point under mouse and ray normal/far point)
Particles:
- extract viewline from brush_add function
Diffstat (limited to 'source/blender/src/editparticle.c')
-rw-r--r-- | source/blender/src/editparticle.c | 36 |
1 files changed, 5 insertions, 31 deletions
diff --git a/source/blender/src/editparticle.c b/source/blender/src/editparticle.c index 95a4abe1f9d..f420d46c827 100644 --- a/source/blender/src/editparticle.c +++ b/source/blender/src/editparticle.c @@ -2273,9 +2273,9 @@ static void brush_add(Object *ob, ParticleSystem *psys, short *mval, short numbe ParticleEditSettings *pset= PE_settings(); ParticleEdit *edit = psys->edit; int i, k, n = 0, totpart = psys->totpart; + short mco[2]; short dmx = 0, dmy = 0; - short mx = mval[0] - curarea->winx / 2, my = mval[1] - curarea->winy / 2; - float co1[3], co2[3], vec[4], min_d, imat[4][4]; + float co1[3], co2[3], min_d, imat[4][4]; float framestep, timestep = psys_get_timestep(psys->part); short size = pset->brush[PE_BRUSH_ADD].size; short size2 = size*size; @@ -2302,35 +2302,9 @@ static void brush_add(Object *ob, ParticleSystem *psys, short *mval, short numbe } } - /* create intersection coordinates in view Z direction at mouse coordinates */ - /* Thanks to who ever wrote the "Mouse Location 3D Space" tutorial in "Blender 3D: Blending Into Python/Cookbook". */ - if(G.vd->persp != V3D_ORTHO){ - vec[0]= (2.0f*(mx+dmx)/curarea->winx); - vec[1]= (2.0f*(my+dmy)/curarea->winy); - vec[2]= -1.0f; - vec[3]= 1.0f; - - Mat4MulVec4fl(G.vd->persinv, vec); - VecMulf(vec, 1.0f/vec[3]); - - VECCOPY(co1, G.vd->viewinv[3]); - VECSUB(vec, vec, co1); - Normalize(vec); - - VECADDFAC(co1, G.vd->viewinv[3], vec, G.vd->near); - VECADDFAC(co2, G.vd->viewinv[3], vec, G.vd->far); - } - else { - vec[0] = 2.0f*(mx+dmx)/curarea->winx; - vec[1] = 2.0f*(my+dmy)/curarea->winy; - vec[2] = 0.0f; - vec[3] = 1.0f; - - Mat4MulVec4fl(G.vd->persinv,vec); - - VECADDFAC(co1,vec,G.vd->viewinv[2],1000.0f); - VECADDFAC(co2,vec,G.vd->viewinv[2],-1000.0f); - } + mco[0] = mval[0] + dmx; + mco[1] = mval[1] + dmy; + viewline(mco, co1, co2); Mat4MulVecfl(imat,co1); Mat4MulVecfl(imat,co2); |