Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2011-05-20 17:09:34 +0400
committerCampbell Barton <ideasman42@gmail.com>2011-05-20 17:09:34 +0400
commit53d5761c94b3ff561ecfd1edd0c97ffde62f0215 (patch)
tree3210ca9dc6cf56460171e55c8595aed1ac79bd62 /source/blender/editors/space_view3d
parente721d31b5d1ede7a12f0ab32365141e596cffcec (diff)
function rename to give clearer meaning that they change from window to 3d coordinates.
some functions had vague names, I even ended up re-writing some of these functions by accident! also added doxy comments. * ED_view3d_win_to_3d (was window_to_3d) * ED_view3d_win_to_delta (was window_to_3d_delta) * ED_view3d_win_to_vector (was window_to_3d_vector / viewvector) * ED_view3d_win_to_segment_clip (was viewline) * ED_view3d_win_to_ray (was viewray)
Diffstat (limited to 'source/blender/editors/space_view3d')
-rw-r--r--source/blender/editors/space_view3d/view3d_draw.c2
-rw-r--r--source/blender/editors/space_view3d/view3d_edit.c32
-rw-r--r--source/blender/editors/space_view3d/view3d_select.c2
-rw-r--r--source/blender/editors/space_view3d/view3d_view.c18
4 files changed, 27 insertions, 27 deletions
diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c
index 1059ad2b19f..e4511f60d8f 100644
--- a/source/blender/editors/space_view3d/view3d_draw.c
+++ b/source/blender/editors/space_view3d/view3d_draw.c
@@ -1410,7 +1410,7 @@ static void draw_bgpic(Scene *scene, ARegion *ar, View3D *v3d)
/* calc window coord */
initgrabz(rv3d, 0.0, 0.0, 0.0);
- window_to_3d_delta(ar, vec, 1, 0);
+ ED_view3d_win_to_delta(ar, 1, 0, vec);
fac= MAX3( fabs(vec[0]), fabs(vec[1]), fabs(vec[1]) );
fac= 1.0f/fac;
diff --git a/source/blender/editors/space_view3d/view3d_edit.c b/source/blender/editors/space_view3d/view3d_edit.c
index e86e56cfb8c..d9746dfc27d 100644
--- a/source/blender/editors/space_view3d/view3d_edit.c
+++ b/source/blender/editors/space_view3d/view3d_edit.c
@@ -383,7 +383,7 @@ static void viewops_data_create(bContext *C, wmOperator *op, wmEvent *event)
view3d_operator_needs_opengl(C); /* needed for zbuf drawing */
- if((vod->use_dyn_ofs=view_autodist(CTX_data_scene(C), vod->ar, vod->v3d, event->mval, vod->dyn_ofs))) {
+ if((vod->use_dyn_ofs=ED_view3d_autodist(CTX_data_scene(C), vod->ar, vod->v3d, event->mval, vod->dyn_ofs))) {
if (rv3d->is_persp) {
float my_origin[3]; /* original G.vd->ofs */
float my_pivot[3]; /* view */
@@ -419,7 +419,7 @@ static void viewops_data_create(bContext *C, wmOperator *op, wmEvent *event)
}
/* for dolly */
- window_to_3d_vector(vod->ar, vod->mousevec, event->mval[0], event->mval[1]);
+ ED_view3d_win_to_vector(vod->ar, event->mval[0], event->mval[1], vod->mousevec);
/* lookup, we dont pass on v3d to prevent confusement */
vod->grid= vod->v3d->grid;
@@ -929,7 +929,7 @@ static void viewmove_apply(ViewOpsData *vod, int x, int y)
else {
float dvec[3];
- window_to_3d_delta(vod->ar, dvec, x-vod->oldx, y-vod->oldy);
+ ED_view3d_win_to_delta(vod->ar, x-vod->oldx, y-vod->oldy, dvec);
add_v3_v3(vod->rv3d->ofs, dvec);
if(vod->rv3d->viewlock & RV3D_BOXVIEW)
@@ -1085,7 +1085,7 @@ static void view_zoom_mouseloc(ARegion *ar, float dfac, int mx, int my)
/* Project cursor position into 3D space */
initgrabz(rv3d, tpos[0], tpos[1], tpos[2]);
- window_to_3d_delta(ar, dvec, mouseloc[0]-vb[0]/2.0f, mouseloc[1]-vb[1]/2.0f);
+ ED_view3d_win_to_delta(ar, mouseloc[0]-vb[0]/2.0f, mouseloc[1]-vb[1]/2.0f, dvec);
/* Calculate view target position for dolly */
add_v3_v3v3(tvec, tpos, dvec);
@@ -2076,7 +2076,7 @@ static int view3d_zoom_border_exec(bContext *C, wmOperator *op)
initgrabz(rv3d, -new_ofs[0], -new_ofs[1], -new_ofs[2]);
- window_to_3d_delta(ar, dvec, (rect.xmin+rect.xmax-vb[0])/2, (rect.ymin+rect.ymax-vb[1])/2);
+ ED_view3d_win_to_delta(ar, (rect.xmin+rect.xmax-vb[0])/2, (rect.ymin+rect.ymax-vb[1])/2, dvec);
/* center the view to the center of the rectangle */
sub_v3_v3(new_ofs, dvec);
}
@@ -2484,10 +2484,10 @@ static int viewpan_exec(bContext *C, wmOperator *op)
pandir = RNA_enum_get(op->ptr, "type");
initgrabz(rv3d, 0.0, 0.0, 0.0);
- if(pandir == V3D_VIEW_PANRIGHT) window_to_3d_delta(ar, vec, -32, 0);
- else if(pandir == V3D_VIEW_PANLEFT) window_to_3d_delta(ar, vec, 32, 0);
- else if(pandir == V3D_VIEW_PANUP) window_to_3d_delta(ar, vec, 0, -25);
- else if(pandir == V3D_VIEW_PANDOWN) window_to_3d_delta(ar, vec, 0, 25);
+ if(pandir == V3D_VIEW_PANRIGHT) ED_view3d_win_to_delta(ar, -32, 0, vec);
+ else if(pandir == V3D_VIEW_PANLEFT) ED_view3d_win_to_delta(ar, 32, 0, vec);
+ else if(pandir == V3D_VIEW_PANUP) ED_view3d_win_to_delta(ar, 0, -25, vec);
+ else if(pandir == V3D_VIEW_PANDOWN) ED_view3d_win_to_delta(ar, 0, 25, vec);
add_v3_v3(rv3d->ofs, vec);
if(rv3d->viewlock & RV3D_BOXVIEW)
@@ -2806,12 +2806,12 @@ static int set_3dcursor_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *eve
if (U.uiflag & USER_ORBIT_ZBUF) { /* maybe this should be accessed some other way */
view3d_operator_needs_opengl(C);
- if (view_autodist(scene, ar, v3d, event->mval, fp))
+ if (ED_view3d_autodist(scene, ar, v3d, event->mval, fp))
depth_used= 1;
}
if(depth_used==0) {
- window_to_3d_delta(ar, dvec, mval[0]-event->mval[0], mval[1]-event->mval[1]);
+ ED_view3d_win_to_delta(ar, mval[0]-event->mval[0], mval[1]-event->mval[1], dvec);
sub_v3_v3(fp, dvec);
}
}
@@ -2961,7 +2961,7 @@ static float view_autodist_depth_margin(ARegion *ar, const int mval[2], int marg
}
/* XXX todo Zooms in on a border drawn by the user */
-int view_autodist(Scene *scene, ARegion *ar, View3D *v3d, const int mval[2], float mouse_worldloc[3] ) //, float *autodist )
+int ED_view3d_autodist(Scene *scene, ARegion *ar, View3D *v3d, const int mval[2], float mouse_worldloc[3] ) //, float *autodist )
{
bglMats mats; /* ZBuffer depth vars */
float depth_close= FLT_MAX;
@@ -2988,7 +2988,7 @@ int view_autodist(Scene *scene, ARegion *ar, View3D *v3d, const int mval[2], flo
return 1;
}
-int view_autodist_init(Scene *scene, ARegion *ar, View3D *v3d, int mode) //, float *autodist )
+int ED_view3d_autodist_init(Scene *scene, ARegion *ar, View3D *v3d, int mode) //, float *autodist )
{
/* Get Z Depths, needed for perspective, nice for ortho */
switch(mode) {
@@ -3004,7 +3004,7 @@ int view_autodist_init(Scene *scene, ARegion *ar, View3D *v3d, int mode) //, flo
}
// no 4x4 sampling, run view_autodist_init first
-int view_autodist_simple(ARegion *ar, const int mval[2], float mouse_worldloc[3], int margin, float *force_depth) //, float *autodist )
+int ED_view3d_autodist_simple(ARegion *ar, const int mval[2], float mouse_worldloc[3], int margin, float *force_depth) //, float *autodist )
{
bglMats mats; /* ZBuffer depth vars, could cache? */
float depth;
@@ -3032,7 +3032,7 @@ int view_autodist_simple(ARegion *ar, const int mval[2], float mouse_worldloc[3]
return 1;
}
-int view_autodist_depth(struct ARegion *ar, const int mval[2], int margin, float *depth)
+int ED_view3d_autodist_depth(struct ARegion *ar, const int mval[2], int margin, float *depth)
{
*depth= view_autodist_depth_margin(ar, mval, margin);
@@ -3059,7 +3059,7 @@ static int depth_segment_cb(int x, int y, void *userData)
}
}
-int view_autodist_depth_segment(struct ARegion *ar, const int mval_sta[2], const int mval_end[2], int margin, float *depth)
+int ED_view3d_autodist_depth_seg(struct ARegion *ar, const int mval_sta[2], const int mval_end[2], int margin, float *depth)
{
struct { struct ARegion *ar; int margin; float depth; } data = {NULL};
int p1[2];
diff --git a/source/blender/editors/space_view3d/view3d_select.c b/source/blender/editors/space_view3d/view3d_select.c
index c4999b961f0..1bae23b70dd 100644
--- a/source/blender/editors/space_view3d/view3d_select.c
+++ b/source/blender/editors/space_view3d/view3d_select.c
@@ -106,7 +106,7 @@ int view3d_get_view_aligned_coordinate(ViewContext *vc, float fp[3], const int m
initgrabz(vc->rv3d, fp[0], fp[1], fp[2]);
if(mval_cpy[0]!=IS_CLIPPED) {
- window_to_3d_delta(vc->ar, dvec, mval_cpy[0]-mval[0], mval_cpy[1]-mval[1]);
+ ED_view3d_win_to_delta(vc->ar, mval_cpy[0]-mval[0], mval_cpy[1]-mval[1], dvec);
sub_v3_v3(fp, dvec);
return TRUE;
diff --git a/source/blender/editors/space_view3d/view3d_view.c b/source/blender/editors/space_view3d/view3d_view.c
index a73985f1757..b47bf9a08ce 100644
--- a/source/blender/editors/space_view3d/view3d_view.c
+++ b/source/blender/editors/space_view3d/view3d_view.c
@@ -502,13 +502,13 @@ void view3d_calculate_clipping(BoundBox *bb, float planes[4][4], bglMats *mats,
}
/* create intersection coordinates in view Z direction at mouse coordinates */
-void viewline(ARegion *ar, View3D *v3d, const float mval[2], float ray_start[3], float ray_end[3])
+void ED_view3d_win_to_segment_clip(ARegion *ar, View3D *v3d, const float mval[2], float ray_start[3], float ray_end[3])
{
RegionView3D *rv3d= ar->regiondata;
if(rv3d->is_persp) {
float vec[3];
- window_to_3d_vector(ar, vec, mval[0], mval[1]);
+ ED_view3d_win_to_vector(ar, mval[0], mval[1], vec);
copy_v3_v3(ray_start, rv3d->viewinv[3]);
VECADDFAC(ray_start, rv3d->viewinv[3], vec, v3d->near);
@@ -537,16 +537,16 @@ void viewline(ARegion *ar, View3D *v3d, const float mval[2], float ray_start[3],
}
/* create intersection ray in view Z direction at mouse coordinates */
-void viewray(ARegion *ar, View3D *v3d, const float mval[2], float ray_start[3], float ray_normal[3])
+void ED_view3d_win_to_ray(ARegion *ar, View3D *v3d, const float mval[2], float ray_start[3], float ray_normal[3])
{
float ray_end[3];
- viewline(ar, v3d, mval, ray_start, ray_end);
+ ED_view3d_win_to_segment_clip(ar, v3d, mval, ray_start, ray_end);
sub_v3_v3v3(ray_normal, ray_end, ray_start);
normalize_v3(ray_normal);
}
-void viewvector(RegionView3D *rv3d, const float coord[3], float vec[3])
+void ED_view3d_global_to_vector(RegionView3D *rv3d, const float coord[3], float vec[3])
{
if (rv3d->is_persp) {
float p1[4], p2[4];
@@ -592,7 +592,7 @@ int initgrabz(RegionView3D *rv3d, float x, float y, float z)
return flip;
}
-void window_to_3d(ARegion *ar, float out[3], const float depth_pt[3], const float mx, const float my)
+void ED_view3d_win_to_3d(ARegion *ar, const float depth_pt[3], const float mx, const float my, float out[3])
{
RegionView3D *rv3d= ar->regiondata;
@@ -602,7 +602,7 @@ void window_to_3d(ARegion *ar, float out[3], const float depth_pt[3], const floa
if(rv3d->is_persp) {
float mousevec[3];
copy_v3_v3(line_sta, rv3d->viewinv[3]);
- window_to_3d_vector(ar, mousevec, mx, my);
+ ED_view3d_win_to_vector(ar, mx, my, mousevec);
add_v3_v3v3(line_end, line_sta, mousevec);
if(isect_line_plane_v3(out, line_sta, line_end, depth_pt, rv3d->viewinv[2], TRUE) == 0) {
@@ -624,7 +624,7 @@ void window_to_3d(ARegion *ar, float out[3], const float depth_pt[3], const floa
/* always call initgrabz */
/* only to detect delta motion */
-void window_to_3d_delta(ARegion *ar, float out[3], const float mx, const float my)
+void ED_view3d_win_to_delta(ARegion *ar, const float mx, const float my, float out[3])
{
RegionView3D *rv3d= ar->regiondata;
float dx, dy;
@@ -640,7 +640,7 @@ void window_to_3d_delta(ARegion *ar, float out[3], const float mx, const float m
/* doesn't rely on initgrabz */
/* for perspective view, get the vector direction to
* the mouse cursor as a normalized vector */
-void window_to_3d_vector(ARegion *ar, float out[3], const float mx, const float my)
+void ED_view3d_win_to_vector(ARegion *ar, const float mx, const float my, float out[3])
{
RegionView3D *rv3d= ar->regiondata;