diff options
author | Daniel Dunbar <daniel@zuster.org> | 2005-08-15 08:10:02 +0400 |
---|---|---|
committer | Daniel Dunbar <daniel@zuster.org> | 2005-08-15 08:10:02 +0400 |
commit | 0c7f65d15230a530afae116c93c7d83a9a6a6e0c (patch) | |
tree | 0b4ff3989fe0429aab2b5a98b69508ab606b8150 /source/blender/src/editview.c | |
parent | 74623f33aa2e12da31b53423fc226ebf9e937df4 (diff) |
- added view3d_get_object_project_mat function, returns mat to project
object cos into screenspace without mucking with gl matrices.
- added view3d_project_ functions, take arguments instead of using
globals
- removed View3D.{mx,my,mxo,myo}
- switch drawobject foreachScreenVert functions to use new projection
functions
- switch edge slide to use new projection functions, fixes erratic
behavior (project was using wrong mat I believe)
- bug fix in edgeslide, nearest edge to start was one-off
Diffstat (limited to 'source/blender/src/editview.c')
-rw-r--r-- | source/blender/src/editview.c | 53 |
1 files changed, 25 insertions, 28 deletions
diff --git a/source/blender/src/editview.c b/source/blender/src/editview.c index 041aa894dcd..0710a1e8703 100644 --- a/source/blender/src/editview.c +++ b/source/blender/src/editview.c @@ -807,43 +807,40 @@ void mouse_cursor(void) if(gesture()) return; getmouseco_areawin(mval); + + mx= mval[0]; + my= mval[1]; + + fp= give_cursor(); - if(mval[0]!=G.vd->mx || mval[1]!=G.vd->my) { + if(G.obedit && ((G.qual & LR_CTRLKEY) || get_mbut()&R_MOUSE )) lr_click= 1; + VECCOPY(oldcurs, fp); + + project_short_noclip(fp, mval); - mx= mval[0]; - my= mval[1]; - - fp= give_cursor(); + initgrabz(fp[0], fp[1], fp[2]); + + if(mval[0]!=3200) { - if(G.obedit && ((G.qual & LR_CTRLKEY) || get_mbut()&R_MOUSE )) lr_click= 1; - VECCOPY(oldcurs, fp); + window_to_3d(dvec, mval[0]-mx, mval[1]-my); + VecSubf(fp, fp, dvec); - project_short_noclip(fp, mval); + } + else { - initgrabz(fp[0], fp[1], fp[2]); + dx= ((float)(mx-(curarea->winx/2)))*zfac/(curarea->winx/2); + dy= ((float)(my-(curarea->winy/2)))*zfac/(curarea->winy/2); - if(mval[0]!=3200) { - - window_to_3d(dvec, mval[0]-mx, mval[1]-my); - VecSubf(fp, fp, dvec); - - } - else { - - dx= ((float)(mx-(curarea->winx/2)))*zfac/(curarea->winx/2); - dy= ((float)(my-(curarea->winy/2)))*zfac/(curarea->winy/2); - - fz= G.vd->persmat[0][3]*fp[0]+ G.vd->persmat[1][3]*fp[1]+ G.vd->persmat[2][3]*fp[2]+ G.vd->persmat[3][3]; - fz= fz/zfac; - - fp[0]= (G.vd->persinv[0][0]*dx + G.vd->persinv[1][0]*dy+ G.vd->persinv[2][0]*fz)-G.vd->ofs[0]; - fp[1]= (G.vd->persinv[0][1]*dx + G.vd->persinv[1][1]*dy+ G.vd->persinv[2][1]*fz)-G.vd->ofs[1]; - fp[2]= (G.vd->persinv[0][2]*dx + G.vd->persinv[1][2]*dy+ G.vd->persinv[2][2]*fz)-G.vd->ofs[2]; - } + fz= G.vd->persmat[0][3]*fp[0]+ G.vd->persmat[1][3]*fp[1]+ G.vd->persmat[2][3]*fp[2]+ G.vd->persmat[3][3]; + fz= fz/zfac; - allqueue(REDRAWVIEW3D, 1); + fp[0]= (G.vd->persinv[0][0]*dx + G.vd->persinv[1][0]*dy+ G.vd->persinv[2][0]*fz)-G.vd->ofs[0]; + fp[1]= (G.vd->persinv[0][1]*dx + G.vd->persinv[1][1]*dy+ G.vd->persinv[2][1]*fz)-G.vd->ofs[1]; + fp[2]= (G.vd->persinv[0][2]*dx + G.vd->persinv[1][2]*dy+ G.vd->persinv[2][2]*fz)-G.vd->ofs[2]; } + allqueue(REDRAWVIEW3D, 1); + if(lr_click) { if(G.obedit->type==OB_MESH) addvert_mesh(); else if ELEM(G.obedit->type, OB_CURVE, OB_SURF) addvert_Nurb(0); |