From e038b25579af0a540cc2b41c03e6771c12044d2b Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sat, 21 May 2011 08:56:37 +0000 Subject: [PATCH] view3d function naming, no functional changes. --- source/blender/editors/gpencil/drawgpencil.c | 2 +- source/blender/editors/gpencil/gpencil_edit.c | 2 +- .../blender/editors/gpencil/gpencil_paint.c | 2 +- source/blender/editors/include/ED_view3d.h | 28 ++++++++++--------- source/blender/editors/mesh/editmesh_mods.c | 2 +- source/blender/editors/mesh/editmesh_tools.c | 8 +++--- .../blender/editors/physics/particle_edit.c | 2 +- source/blender/editors/render/render_opengl.c | 2 +- .../editors/sculpt_paint/paint_image.c | 10 +++---- source/blender/editors/sculpt_paint/sculpt.c | 6 ++-- .../blender/editors/space_view3d/drawobject.c | 18 ++++++------ .../editors/space_view3d/view3d_draw.c | 14 +++++----- .../editors/space_view3d/view3d_edit.c | 28 +++++++++---------- .../editors/space_view3d/view3d_intern.h | 4 +-- .../editors/space_view3d/view3d_view.c | 28 ++++++++++--------- source/blender/editors/transform/transform.c | 10 +++---- .../editors/transform/transform_manipulator.c | 2 +- .../editors/transform/transform_snap.c | 4 +-- 18 files changed, 87 insertions(+), 85 deletions(-) diff --git a/source/blender/editors/gpencil/drawgpencil.c b/source/blender/editors/gpencil/drawgpencil.c index b93e4b07302..a275a5f908a 100644 --- a/source/blender/editors/gpencil/drawgpencil.c +++ b/source/blender/editors/gpencil/drawgpencil.c @@ -790,7 +790,7 @@ void draw_gpencil_view3d_ext (Scene *scene, View3D *v3d, ARegion *ar, short only * deal with the camera border, otherwise map the coords to the camera border. */ if ((rv3d->persp == RV3D_CAMOB) && !(G.f & G_RENDER_OGL)) { rctf rectf; - view3d_calc_camera_border(scene, ar, rv3d, v3d, &rectf, -1); /* negative shift */ + ED_view3d_calc_camera_border(scene, ar, v3d, rv3d, &rectf, -1); /* negative shift */ BLI_copy_rcti_rctf(&rect, &rectf); } else { diff --git a/source/blender/editors/gpencil/gpencil_edit.c b/source/blender/editors/gpencil/gpencil_edit.c index 83dec47bf8b..27f2598d515 100644 --- a/source/blender/editors/gpencil/gpencil_edit.c +++ b/source/blender/editors/gpencil/gpencil_edit.c @@ -453,7 +453,7 @@ static int gp_camera_view_subrect(bContext *C, rctf *subrect) /* for camera view set the subrect */ if (rv3d->persp == RV3D_CAMOB) { - view3d_calc_camera_border(scene, ar, NULL, v3d, subrect, -1); /* negative shift */ + ED_view3d_calc_camera_border(scene, ar, v3d, NULL, subrect, -1); /* negative shift */ return 1; } } diff --git a/source/blender/editors/gpencil/gpencil_paint.c b/source/blender/editors/gpencil/gpencil_paint.c index c13feec5785..2a4b583276e 100644 --- a/source/blender/editors/gpencil/gpencil_paint.c +++ b/source/blender/editors/gpencil/gpencil_paint.c @@ -1131,7 +1131,7 @@ static void gp_paint_initstroke (tGPsdata *p, short paintmode) /* for camera view set the subrect */ if (rv3d->persp == RV3D_CAMOB) { - view3d_calc_camera_border(p->scene, p->ar, NULL, v3d, &p->subrect_data, -1); /* negative shift */ + ED_view3d_calc_camera_border(p->scene, p->ar, v3d, NULL, &p->subrect_data, -1); /* negative shift */ p->subrect= &p->subrect_data; } } diff --git a/source/blender/editors/include/ED_view3d.h b/source/blender/editors/include/ED_view3d.h index 2f99cf16093..028ba503dba 100644 --- a/source/blender/editors/include/ED_view3d.h +++ b/source/blender/editors/include/ED_view3d.h @@ -147,17 +147,19 @@ void ED_view3d_win_to_ray(struct ARegion *ar, struct View3D *v3d, const float mv */ void ED_view3d_global_to_vector(struct RegionView3D *rv3d, const float coord[3], float vec[3]); +#if 0 /* UNUSED */ void view3d_unproject(struct bglMats *mats, float out[3], const short x, const short y, const float z); +#endif /* Depth buffer */ -void view3d_update_depths(struct ARegion *ar); -float read_cached_depth(struct ViewContext *vc, int x, int y); -void request_depth_update(struct RegionView3D *rv3d); +void ED_view3d_depth_update(struct ARegion *ar); +float ED_view3d_depth_read_cached(struct ViewContext *vc, int x, int y); +void ED_view3d_depth_tag_update(struct RegionView3D *rv3d); /* Projection */ #define IS_CLIPPED 12000 -void view3d_calculate_clipping(struct BoundBox *bb, float planes[4][4], struct bglMats *mats, struct rcti *rect); +void ED_view3d_calc_clipping(struct BoundBox *bb, float planes[4][4], struct bglMats *mats, struct rcti *rect); void project_short(struct ARegion *ar, const float vec[3], short adr[2]); void project_short_noclip(struct ARegion *ar, const float vec[3], short adr[2]); @@ -168,12 +170,12 @@ void project_int_noclip(struct ARegion *ar, const float vec[3], int adr[2]); void project_float(struct ARegion *ar, const float vec[3], float adr[2]); void project_float_noclip(struct ARegion *ar, const float vec[3], float adr[2]); -void get_object_clip_range(struct Object *ob, float *lens, float *clipsta, float *clipend); -int get_view3d_cliprange(struct View3D *v3d, struct RegionView3D *rv3d, float *clipsta, float *clipend); -int get_view3d_viewplane(struct View3D *v3d, struct RegionView3D *rv3d, int winxi, int winyi, struct rctf *viewplane, float *clipsta, float *clipend, float *pixsize); -void view3d_get_object_project_mat(struct RegionView3D *v3d, struct Object *ob, float pmat[4][4]); -void view3d_project_float(struct ARegion *a, const float vec[3], float adr[2], float mat[4][4]); -void view3d_calc_camera_border(struct Scene *scene, struct ARegion *ar, struct RegionView3D *rv3d, struct View3D *v3d, struct rctf *viewborder_r, short do_shift); +void ED_view3d_ob_clip_range_get(struct Object *ob, float *lens, float *clipsta, float *clipend); +int ED_view3d_clip_range_get(struct View3D *v3d, struct RegionView3D *rv3d, float *clipsta, float *clipend); +int ED_view3d_viewplane_get(struct View3D *v3d, struct RegionView3D *rv3d, int winxi, int winyi, struct rctf *viewplane, float *clipsta, float *clipend, float *pixsize); +void ED_view3d_ob_project_mat_get(struct RegionView3D *v3d, struct Object *ob, float pmat[4][4]); +void ED_view3d_project_float(struct ARegion *a, const float vec[3], float adr[2], float mat[4][4]); +void ED_view3d_calc_camera_border(struct Scene *scene, struct ARegion *ar, struct View3D *v3d, struct RegionView3D *rv3d, struct rctf *viewborder_r, short do_shift); /* drawobject.c iterators */ void mesh_foreachScreenVert(struct ViewContext *vc, void (*func)(void *userData, struct EditVert *eve, int x, int y, int index), void *userData, int clipVerts); @@ -183,9 +185,9 @@ void nurbs_foreachScreenVert(struct ViewContext *vc, void (*func)(void *userData void lattice_foreachScreenVert(struct ViewContext *vc, void (*func)(void *userData, struct BPoint *bp, int x, int y), void *userData); void ED_view3d_local_clipping(struct RegionView3D *rv3d, float mat[][4]); -int view3d_test_clipping(struct RegionView3D *rv3d, const float vec[3], const int local); -void view3d_align_axis_to_vector(struct View3D *v3d, struct RegionView3D *rv3d, int axisidx, float vec[3]); -float view3d_pixel_size(struct RegionView3D *rv3d, const float co[3]); +int ED_view3d_test_clipping(struct RegionView3D *rv3d, const float vec[3], const int local); +void ED_view3d_align_axis_to_vector(struct View3D *v3d, struct RegionView3D *rv3d, int axisidx, float vec[3]); +float ED_view3d_pixel_size(struct RegionView3D *rv3d, const float co[3]); void drawcircball(int mode, const float cent[3], float rad, float tmat[][4]); diff --git a/source/blender/editors/mesh/editmesh_mods.c b/source/blender/editors/mesh/editmesh_mods.c index bd49fab1de1..18f3b807f86 100644 --- a/source/blender/editors/mesh/editmesh_mods.c +++ b/source/blender/editors/mesh/editmesh_mods.c @@ -504,7 +504,7 @@ static void findnearestedge__doClosest(void *userData, EditEdge *eed, int x0, in vec[1]= eed->v1->co[1] + labda*(eed->v2->co[1] - eed->v1->co[1]); vec[2]= eed->v1->co[2] + labda*(eed->v2->co[2] - eed->v1->co[2]); - if(view3d_test_clipping(data->vc.rv3d, vec, 1)==0) { + if(ED_view3d_test_clipping(data->vc.rv3d, vec, 1)==0) { data->dist = distance; data->closest = eed; } diff --git a/source/blender/editors/mesh/editmesh_tools.c b/source/blender/editors/mesh/editmesh_tools.c index 11e7d64c667..dfd1ac730ac 100644 --- a/source/blender/editors/mesh/editmesh_tools.c +++ b/source/blender/editors/mesh/editmesh_tools.c @@ -4871,8 +4871,8 @@ static float mesh_rip_edgedist(ARegion *ar, float mat[][4], float *co1, float *c { float vec1[3], vec2[3], mvalf[2]; - view3d_project_float(ar, co1, vec1, mat); - view3d_project_float(ar, co2, vec2, mat); + ED_view3d_project_float(ar, co1, vec1, mat); + ED_view3d_project_float(ar, co2, vec2, mat); mvalf[0]= (float)mval[0]; mvalf[1]= (float)mval[1]; @@ -4916,7 +4916,7 @@ static int mesh_rip_invoke(bContext *C, wmOperator *op, wmEvent *event) /* select flush... vertices are important */ EM_selectmode_set(em); - view3d_get_object_project_mat(rv3d, obedit, projectMat); + ED_view3d_ob_project_mat_get(rv3d, obedit, projectMat); /* find best face, exclude triangles and break on face select or faces with 2 edges select */ mindist= 1000000.0f; @@ -4933,7 +4933,7 @@ static int mesh_rip_invoke(bContext *C, wmOperator *op, wmEvent *event) if(totsel>1) break; - view3d_project_float(ar, efa->cent, vec, projectMat); + ED_view3d_project_float(ar, efa->cent, vec, projectMat); dist= sqrt( (vec[0]-mval[0])*(vec[0]-mval[0]) + (vec[1]-mval[1])*(vec[1]-mval[1]) ); if(distdepths->dirty = 1; */ - view3d_update_depths(data->vc.ar); + ED_view3d_depth_update(data->vc.ar); } } } diff --git a/source/blender/editors/render/render_opengl.c b/source/blender/editors/render/render_opengl.c index 0a279e412f6..98463ce955f 100644 --- a/source/blender/editors/render/render_opengl.c +++ b/source/blender/editors/render/render_opengl.c @@ -149,7 +149,7 @@ static void screen_opengl_render_apply(OGLRender *oglrender) rctf viewplane; float clipsta, clipend; - int is_ortho= get_view3d_viewplane(v3d, rv3d, sizex, sizey, &viewplane, &clipsta, &clipend, NULL); + int is_ortho= ED_view3d_viewplane_get(v3d, rv3d, sizex, sizey, &viewplane, &clipsta, &clipend, NULL); if(is_ortho) orthographic_m4(winmat, viewplane.xmin, viewplane.xmax, viewplane.ymin, viewplane.ymax, -clipend, clipend); else perspective_m4(winmat, viewplane.xmin, viewplane.xmax, viewplane.ymin, viewplane.ymax, clipsta, clipend); } diff --git a/source/blender/editors/sculpt_paint/paint_image.c b/source/blender/editors/sculpt_paint/paint_image.c index 2b0da72c2a1..db0d2314ad0 100644 --- a/source/blender/editors/sculpt_paint/paint_image.c +++ b/source/blender/editors/sculpt_paint/paint_image.c @@ -766,7 +766,7 @@ static int project_paint_occlude_ptv_clip( if (side) interp_v3_v3v3v3(wco, ps->dm_mvert[mf->v1].co, ps->dm_mvert[mf->v3].co, ps->dm_mvert[mf->v4].co, w); else interp_v3_v3v3v3(wco, ps->dm_mvert[mf->v1].co, ps->dm_mvert[mf->v2].co, ps->dm_mvert[mf->v3].co, w); - if(!view3d_test_clipping(ps->rv3d, wco, 1)) { + if(!ED_view3d_test_clipping(ps->rv3d, wco, 1)) { return 1; } @@ -2349,7 +2349,7 @@ static void project_paint_face_init(const ProjPaintState *ps, const int thread_i /* a pitty we need to get the worldspace pixel location here */ if(do_clip) { interp_v3_v3v3v3(wco, ps->dm_mvert[ (*(&mf->v1 + i1)) ].co, ps->dm_mvert[ (*(&mf->v1 + i2)) ].co, ps->dm_mvert[ (*(&mf->v1 + i3)) ].co, w); - if(view3d_test_clipping(ps->rv3d, wco, 1)) { + if(ED_view3d_test_clipping(ps->rv3d, wco, 1)) { continue; /* Watch out that no code below this needs to run */ } } @@ -2572,7 +2572,7 @@ static void project_paint_face_init(const ProjPaintState *ps, const int thread_i if (side) interp_v3_v3v3v3(wco, ps->dm_mvert[mf->v1].co, ps->dm_mvert[mf->v3].co, ps->dm_mvert[mf->v4].co, w); else interp_v3_v3v3v3(wco, ps->dm_mvert[mf->v1].co, ps->dm_mvert[mf->v2].co, ps->dm_mvert[mf->v3].co, w); - if(view3d_test_clipping(ps->rv3d, wco, 1)) { + if(ED_view3d_test_clipping(ps->rv3d, wco, 1)) { continue; /* Watch out that no code below this needs to run */ } } @@ -2814,7 +2814,7 @@ static void project_paint_delayed_face_init(ProjPaintState *ps, const MFace *mf, static int project_paint_view_clip(View3D *v3d, RegionView3D *rv3d, float *clipsta, float *clipend) { - int orth= get_view3d_cliprange(v3d, rv3d, clipsta, clipend); + int orth= ED_view3d_clip_range_get(v3d, rv3d, clipsta, clipend); if (orth) { /* only needed for ortho */ float fac = 2.0f / ((*clipend) - (*clipsta)); @@ -2953,7 +2953,7 @@ static void project_paint_begin(ProjPaintState *ps) copy_m4_m4(viewmat, ps->rv3d->viewmat); copy_m4_m4(viewinv, ps->rv3d->viewinv); - view3d_get_object_project_mat(ps->rv3d, ps->ob, ps->projectMat); + ED_view3d_ob_project_mat_get(ps->rv3d, ps->ob, ps->projectMat); ps->is_ortho= project_paint_view_clip(ps->v3d, ps->rv3d, &ps->clipsta, &ps->clipend); } diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c index fa9f2fd340e..20e74702067 100644 --- a/source/blender/editors/sculpt_paint/sculpt.c +++ b/source/blender/editors/sculpt_paint/sculpt.c @@ -281,7 +281,7 @@ static int sculpt_get_redraw_rect(ARegion *ar, RegionView3D *rv3d, float bb_min[3], bb_max[3], pmat[4][4]; int i, j, k; - view3d_get_object_project_mat(rv3d, ob, pmat); + ED_view3d_ob_project_mat_get(rv3d, ob, pmat); if(!pbvh) return 0; @@ -301,7 +301,7 @@ static int sculpt_get_redraw_rect(ARegion *ar, RegionView3D *rv3d, vec[0] = i ? bb_min[0] : bb_max[0]; vec[1] = j ? bb_min[1] : bb_max[1]; vec[2] = k ? bb_min[2] : bb_max[2]; - view3d_project_float(ar, vec, proj, pmat); + ED_view3d_project_float(ar, vec, proj, pmat); rect->xmin = MIN2(rect->xmin, proj[0]); rect->xmax = MAX2(rect->xmax, proj[0]); rect->ymin = MIN2(rect->ymin, proj[1]); @@ -357,7 +357,7 @@ void sculpt_get_redraw_planes(float planes[4][4], ARegion *ar, rect.ymax -= 2; #endif - view3d_calculate_clipping(&bb, planes, &mats, &rect); + ED_view3d_calc_clipping(&bb, planes, &mats, &rect); mul_m4_fl(planes, -1.0f); /* clear redraw flag from nodes */ diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c index e88ee7dd69a..ccfc45826cf 100644 --- a/source/blender/editors/space_view3d/drawobject.c +++ b/source/blender/editors/space_view3d/drawobject.c @@ -147,7 +147,7 @@ static void view3d_project_short_clip(ARegion *ar, float *vec, short *adr, int l /* clipplanes in eye space */ if(rv3d->rflag & RV3D_CLIPPING) { - if(view3d_test_clipping(rv3d, vec, local)) + if(ED_view3d_test_clipping(rv3d, vec, local)) return; } @@ -630,7 +630,7 @@ void drawcircball(int mode, const float cent[3], float rad, float tmat[][4]) /* circle for object centers, special_color is for library or ob users */ static void drawcentercircle(View3D *v3d, RegionView3D *rv3d, const float co[3], int selstate, int special_color) { - const float size= view3d_pixel_size(rv3d, co) * (float)U.obcenter_dia * 0.5f; + const float size= ED_view3d_pixel_size(rv3d, co) * (float)U.obcenter_dia * 0.5f; /* using gldepthfunc guarantees that it does write z values, but not checks for it, so centers remain visible independt order of drawing */ if(v3d->zbuf) glDepthFunc(GL_ALWAYS); @@ -1015,7 +1015,7 @@ static void draw_transp_spot_volume(Lamp *la, float x, float z) static void drawlamp(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base, int dt, int flag) { Object *ob= base->object; - const float pixsize= view3d_pixel_size(rv3d, ob->obmat[3]); + const float pixsize= ED_view3d_pixel_size(rv3d, ob->obmat[3]); Lamp *la= ob->data; float vec[3], lvec[3], vvec[3], circrad, x,y,z; float lampsize; @@ -2886,7 +2886,7 @@ static int draw_mesh_object(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D } else { /* don't create boundbox here with mesh_get_bb(), the derived system will make it, puts deformed bb's OK */ - if(me->totface<=4 || boundbox_clip(rv3d, ob->obmat, (ob->bb)? ob->bb: me->bb)) { + if(me->totface<=4 || ED_view3d_boundbox_clip(rv3d, ob->obmat, (ob->bb)? ob->bb: me->bb)) { glsl = draw_glsl_material(scene, ob, v3d, dt); check_alpha = check_material_alpha(base, me, glsl); @@ -3672,7 +3672,7 @@ static void draw_new_particle_system(Scene *scene, View3D *v3d, RegionView3D *rv case PART_DRAW_CROSS: case PART_DRAW_AXIS: /* lets calculate the scale: */ - pixsize= view3d_pixel_size(rv3d, ob->obmat[3]); + pixsize= ED_view3d_pixel_size(rv3d, ob->obmat[3]); if(part->draw_size==0.0) pixsize *= 2.0f; @@ -5522,7 +5522,7 @@ static void drawObjectSelect(Scene *scene, View3D *v3d, ARegion *ar, Base *base) hasfaces= displist_has_faces(&ob->disp); } - if (hasfaces && boundbox_clip(rv3d, ob->obmat, ob->bb ? ob->bb : cu->bb)) { + if (hasfaces && ED_view3d_boundbox_clip(rv3d, ob->obmat, ob->bb ? ob->bb : cu->bb)) { draw_index_wire= 0; if (dm) { draw_mesh_object_outline(v3d, ob, dm); @@ -5575,7 +5575,7 @@ static void drawWireExtra(Scene *scene, RegionView3D *rv3d, Object *ob) if (ELEM3(ob->type, OB_FONT, OB_CURVE, OB_SURF)) { Curve *cu = ob->data; - if (boundbox_clip(rv3d, ob->obmat, ob->bb ? ob->bb : cu->bb)) { + if (ED_view3d_boundbox_clip(rv3d, ob->obmat, ob->bb ? ob->bb : cu->bb)) { if (ob->type==OB_CURVE) draw_index_wire= 0; @@ -6010,7 +6010,7 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag) if((v3d->flag2 & V3D_RENDER_OVERRIDE && v3d->drawtype >= OB_WIRE)==0) draw_bounding_volume(scene, ob); } - else if(boundbox_clip(rv3d, ob->obmat, ob->bb ? ob->bb : cu->bb)) + else if(ED_view3d_boundbox_clip(rv3d, ob->obmat, ob->bb ? ob->bb : cu->bb)) empty_object= drawDispList(scene, v3d, rv3d, base, dt); break; @@ -6026,7 +6026,7 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag) if((v3d->flag2 & V3D_RENDER_OVERRIDE && v3d->drawtype >= OB_WIRE)==0) draw_bounding_volume(scene, ob); } - else if(boundbox_clip(rv3d, ob->obmat, ob->bb ? ob->bb : cu->bb)) { + else if(ED_view3d_boundbox_clip(rv3d, ob->obmat, ob->bb ? ob->bb : cu->bb)) { empty_object= drawDispList(scene, v3d, rv3d, base, dt); //XXX old animsys if(cu->path) diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c index adce40f58ce..7e9c219fdaa 100644 --- a/source/blender/editors/space_view3d/view3d_draw.c +++ b/source/blender/editors/space_view3d/view3d_draw.c @@ -206,7 +206,7 @@ static int test_clipping(const float vec[3], float clip[][4]) /* for 'local' ED_view3d_local_clipping must run first * then all comparisons can be done in localspace */ -int view3d_test_clipping(RegionView3D *rv3d, const float vec[3], const int local) +int ED_view3d_test_clipping(RegionView3D *rv3d, const float vec[3], const int local) { return test_clipping(vec, local ? rv3d->clip_local : rv3d->clip); } @@ -869,7 +869,7 @@ void view3d_viewborder_size_get(Scene *scene, ARegion *ar, float size_r[2]) } } -void view3d_calc_camera_border(Scene *scene, ARegion *ar, RegionView3D *rv3d, View3D *v3d, rctf *viewborder_r, short do_shift) +void ED_view3d_calc_camera_border(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D *rv3d, rctf *viewborder_r, short do_shift) { const float zoomfac= BKE_screen_view3d_zoom_to_fac((float)rv3d->camzoom); float size[2]; @@ -998,7 +998,7 @@ static void drawviewborder(Scene *scene, ARegion *ar, View3D *v3d) if(v3d->camera->type==OB_CAMERA) ca = v3d->camera->data; - view3d_calc_camera_border(scene, ar, rv3d, v3d, &viewborder, FALSE); + ED_view3d_calc_camera_border(scene, ar, v3d, rv3d, &viewborder, FALSE); /* the offsets */ x1= viewborder.xmin; y1= viewborder.ymin; @@ -1398,7 +1398,7 @@ static void draw_bgpic(Scene *scene, ARegion *ar, View3D *v3d) if(rv3d->persp==RV3D_CAMOB) { rctf vb; - view3d_calc_camera_border(scene, ar, rv3d, v3d, &vb, FALSE); + ED_view3d_calc_camera_border(scene, ar, v3d, rv3d, &vb, FALSE); x1= vb.xmin; y1= vb.ymin; @@ -1418,7 +1418,7 @@ static void draw_bgpic(Scene *scene, ARegion *ar, View3D *v3d) asp= ( (float)ibuf->y)/(float)ibuf->x; vec[0] = vec[1] = vec[2] = 0.0; - view3d_project_float(ar, vec, sco, rv3d->persmat); + ED_view3d_project_float(ar, vec, sco, rv3d->persmat); cx = sco[0]; cy = sco[1]; @@ -1678,7 +1678,7 @@ static void draw_dupli_objects_color(Scene *scene, ARegion *ar, View3D *v3d, Bas } if(use_displist) { glMultMatrixf(dob->mat); - if(boundbox_clip(rv3d, dob->mat, &bb)) + if(ED_view3d_boundbox_clip(rv3d, dob->mat, &bb)) glCallList(displist); glLoadMatrixf(rv3d->viewmat); } @@ -1768,7 +1768,7 @@ void view3d_update_depths_rect(ARegion *ar, ViewDepths *d, rcti *rect) } /* note, with nouveau drivers the glReadPixels() is very slow. [#24339] */ -void view3d_update_depths(ARegion *ar) +void ED_view3d_depth_update(ARegion *ar) { RegionView3D *rv3d= ar->regiondata; diff --git a/source/blender/editors/space_view3d/view3d_edit.c b/source/blender/editors/space_view3d/view3d_edit.c index 95e845b3462..ae020b91cdf 100644 --- a/source/blender/editors/space_view3d/view3d_edit.c +++ b/source/blender/editors/space_view3d/view3d_edit.c @@ -783,7 +783,7 @@ static int viewrotate_modal(bContext *C, wmOperator *op, wmEvent *event) viewrotate_apply(vod, event->x, event->y); } else if (event_code==VIEW_CONFIRM) { - request_depth_update(vod->rv3d); + ED_view3d_depth_tag_update(vod->rv3d); viewops_data_free(C, op); return OPERATOR_FINISHED; @@ -831,7 +831,7 @@ static int viewrotate_invoke(bContext *C, wmOperator *op, wmEvent *event) if (event->type == MOUSEPAN) { viewrotate_apply(vod, event->prevx, event->prevy); - request_depth_update(rv3d); + ED_view3d_depth_tag_update(rv3d); viewops_data_free(C, op); @@ -840,7 +840,7 @@ static int viewrotate_invoke(bContext *C, wmOperator *op, wmEvent *event) else if (event->type == MOUSEROTATE) { /* MOUSEROTATE performs orbital rotation, so y axis delta is set to 0 */ viewrotate_apply(vod, event->prevx, event->y); - request_depth_update(rv3d); + ED_view3d_depth_tag_update(rv3d); viewops_data_free(C, op); @@ -986,7 +986,7 @@ static int viewmove_modal(bContext *C, wmOperator *op, wmEvent *event) viewmove_apply(vod, event->x, event->y); } else if (event_code==VIEW_CONFIRM) { - request_depth_update(vod->rv3d); + ED_view3d_depth_tag_update(vod->rv3d); viewops_data_free(C, op); @@ -1006,7 +1006,7 @@ static int viewmove_invoke(bContext *C, wmOperator *op, wmEvent *event) if (event->type == MOUSEPAN) { viewmove_apply(vod, event->prevx, event->prevy); - request_depth_update(vod->rv3d); + ED_view3d_depth_tag_update(vod->rv3d); viewops_data_free(C, op); @@ -1224,7 +1224,7 @@ static int viewzoom_modal(bContext *C, wmOperator *op, wmEvent *event) viewzoom_apply(vod, event->x, event->y, U.viewzoom, (U.uiflag & USER_ZOOM_INVERT) != 0); } else if (event_code==VIEW_CONFIRM) { - request_depth_update(vod->rv3d); + ED_view3d_depth_tag_update(vod->rv3d); viewops_data_free(C, op); return OPERATOR_FINISHED; @@ -1286,7 +1286,7 @@ static int viewzoom_exec(bContext *C, wmOperator *op) if(rv3d->viewlock & RV3D_BOXVIEW) view3d_boxview_sync(sa, ar); - request_depth_update(rv3d); + ED_view3d_depth_tag_update(rv3d); ED_view3d_camera_lock_sync(v3d, rv3d); @@ -1329,7 +1329,7 @@ static int viewzoom_invoke(bContext *C, wmOperator *op, wmEvent *event) vod->origy = vod->oldy = vod->origy + event->x - event->prevx; viewzoom_apply(vod, event->prevx, event->prevy, USER_ZOOM_DOLLY, FALSE); } - request_depth_update(vod->rv3d); + ED_view3d_depth_tag_update(vod->rv3d); viewops_data_free(C, op); return OPERATOR_FINISHED; @@ -1445,7 +1445,7 @@ static int viewdolly_modal(bContext *C, wmOperator *op, wmEvent *event) viewdolly_apply(vod, event->x, event->y, (U.uiflag & USER_ZOOM_INVERT) != 0); } else if (event_code==VIEW_CONFIRM) { - request_depth_update(vod->rv3d); + ED_view3d_depth_tag_update(vod->rv3d); viewops_data_free(C, op); return OPERATOR_FINISHED; @@ -1496,7 +1496,7 @@ static int viewdolly_exec(bContext *C, wmOperator *op) if(rv3d->viewlock & RV3D_BOXVIEW) view3d_boxview_sync(sa, ar); - request_depth_update(rv3d); + ED_view3d_depth_tag_update(rv3d); ED_region_tag_redraw(ar); viewops_data_free(C, op); @@ -1543,7 +1543,7 @@ static int viewdolly_invoke(bContext *C, wmOperator *op, wmEvent *event) vod->origy = vod->oldy = vod->origy + event->x - event->prevx; viewdolly_apply(vod, event->prevx, event->prevy, FALSE); } - request_depth_update(vod->rv3d); + ED_view3d_depth_tag_update(vod->rv3d); viewops_data_free(C, op); return OPERATOR_FINISHED; @@ -1940,7 +1940,7 @@ static int render_border_exec(bContext *C, wmOperator *op) rect.ymax= RNA_int_get(op->ptr, "ymax"); /* calculate range */ - view3d_calc_camera_border(scene, ar, rv3d, v3d, &vb, FALSE); + ED_view3d_calc_camera_border(scene, ar, v3d, rv3d, &vb, FALSE); scene->r.border.xmin= ((float)rect.xmin-vb.xmin)/(vb.xmax-vb.xmin); scene->r.border.ymin= ((float)rect.ymin-vb.ymin)/(vb.ymax-vb.ymin); @@ -2740,7 +2740,7 @@ static int view3d_clipping_exec(bContext *C, wmOperator *op) view3d_set_viewcontext(C, &vc); view3d_get_transformation(vc.ar, vc.rv3d, NULL, &mats); /* NULL because we don't want it in object space */ - view3d_calculate_clipping(rv3d->clipbb, rv3d->clip, &mats, &rect); + ED_view3d_calc_clipping(rv3d->clipbb, rv3d->clip, &mats, &rect); return OPERATOR_FINISHED; } @@ -3550,7 +3550,7 @@ void ED_view3d_from_object(Object *ob, float ofs[3], float quat[4], float *dist, ED_view3d_from_m4(ob->obmat, ofs, quat, dist); if (lens) { - get_object_clip_range(ob, lens, NULL, NULL); + ED_view3d_ob_clip_range_get(ob, lens, NULL, NULL); } } diff --git a/source/blender/editors/space_view3d/view3d_intern.h b/source/blender/editors/space_view3d/view3d_intern.h index 717e46800b1..f4d198f7515 100644 --- a/source/blender/editors/space_view3d/view3d_intern.h +++ b/source/blender/editors/space_view3d/view3d_intern.h @@ -154,9 +154,7 @@ void VIEW3D_OT_localview(struct wmOperatorType *ot); void VIEW3D_OT_game_start(struct wmOperatorType *ot); -int boundbox_clip(RegionView3D *rv3d, float obmat[][4], struct BoundBox *bb); - -void centerview(struct ARegion *ar, View3D *v3d); +int ED_view3d_boundbox_clip(RegionView3D *rv3d, float obmat[][4], struct BoundBox *bb); void smooth_view(struct bContext *C, struct View3D *v3d, struct ARegion *ar, struct Object *, struct Object *, float *ofs, float *quat, float *dist, float *lens); diff --git a/source/blender/editors/space_view3d/view3d_view.c b/source/blender/editors/space_view3d/view3d_view.c index 678ffc09e39..32e8ae81f90 100644 --- a/source/blender/editors/space_view3d/view3d_view.c +++ b/source/blender/editors/space_view3d/view3d_view.c @@ -106,7 +106,7 @@ float *give_cursor(Scene *scene, View3D *v3d) /* Gets the lens and clipping values from a camera of lamp type object */ -void get_object_clip_range(Object *ob, float *lens, float *clipsta, float *clipend) +void ED_view3d_ob_clip_range_get(Object *ob, float *lens, float *clipsta, float *clipend) { if(ob->type==OB_LAMP ) { Lamp *la = ob->data; @@ -463,7 +463,7 @@ void VIEW3D_OT_object_as_camera(wmOperatorType *ot) /* ********************************** */ -void view3d_calculate_clipping(BoundBox *bb, float planes[4][4], bglMats *mats, rcti *rect) +void ED_view3d_calc_clipping(BoundBox *bb, float planes[4][4], bglMats *mats, rcti *rect) { double xs, ys, p[3]; short val; @@ -657,7 +657,7 @@ void ED_view3d_win_to_vector(ARegion *ar, const float mval[2], float out[3]) normalize_v3(out); } -float read_cached_depth(ViewContext *vc, int x, int y) +float ED_view3d_depth_read_cached(ViewContext *vc, int x, int y) { ViewDepths *vd = vc->rv3d->depths; @@ -670,13 +670,13 @@ float read_cached_depth(ViewContext *vc, int x, int y) return 1; } -void request_depth_update(RegionView3D *rv3d) +void ED_view3d_depth_tag_update(RegionView3D *rv3d) { if(rv3d->depths) rv3d->depths->damaged= 1; } -void view3d_get_object_project_mat(RegionView3D *rv3d, Object *ob, float pmat[4][4]) +void ED_view3d_ob_project_mat_get(RegionView3D *rv3d, Object *ob, float pmat[4][4]) { float vmat[4][4]; @@ -684,6 +684,7 @@ void view3d_get_object_project_mat(RegionView3D *rv3d, Object *ob, float pmat[4] mul_m4_m4m4(pmat, vmat, rv3d->winmat); } +#if 0 /* Uses window coordinates (x,y) and depth component z to find a point in modelspace */ void view3d_unproject(bglMats *mats, float out[3], const short x, const short y, const float z) @@ -696,9 +697,10 @@ void view3d_unproject(bglMats *mats, float out[3], const short x, const short y, out[1] = uy; out[2] = uz; } +#endif /* use above call to get projecting mat */ -void view3d_project_float(ARegion *ar, const float vec[3], float adr[2], float mat[4][4]) +void ED_view3d_project_float(ARegion *ar, const float vec[3], float adr[2], float mat[4][4]) { float vec4[4]; @@ -716,7 +718,7 @@ void view3d_project_float(ARegion *ar, const float vec[3], float adr[2], float m } } -int boundbox_clip(RegionView3D *rv3d, float obmat[][4], BoundBox *bb) +int ED_view3d_boundbox_clip(RegionView3D *rv3d, float obmat[][4], BoundBox *bb) { /* return 1: draw */ @@ -759,7 +761,7 @@ void project_short(ARegion *ar, const float vec[3], short adr[2]) /* clips */ adr[0]= IS_CLIPPED; if(rv3d->rflag & RV3D_CLIPPING) { - if(view3d_test_clipping(rv3d, vec, 0)) + if(ED_view3d_test_clipping(rv3d, vec, 0)) return; } @@ -896,7 +898,7 @@ void project_float_noclip(ARegion *ar, const float vec[3], float adr[2]) } /* copies logic of get_view3d_viewplane(), keep in sync */ -int get_view3d_cliprange(View3D *v3d, RegionView3D *rv3d, float *clipsta, float *clipend) +int ED_view3d_clip_range_get(View3D *v3d, RegionView3D *rv3d, float *clipsta, float *clipend) { int orth= 0; @@ -931,7 +933,7 @@ int get_view3d_cliprange(View3D *v3d, RegionView3D *rv3d, float *clipsta, float } /* also exposed in previewrender.c */ -int get_view3d_viewplane(View3D *v3d, RegionView3D *rv3d, int winxi, int winyi, rctf *viewplane, float *clipsta, float *clipend, float *pixsize) +int ED_view3d_viewplane_get(View3D *v3d, RegionView3D *rv3d, int winxi, int winyi, rctf *viewplane, float *clipsta, float *clipend, float *pixsize) { Camera *cam=NULL; float lens, fac, x1, y1, x2, y2; @@ -1064,7 +1066,7 @@ void setwinmatrixview3d(ARegion *ar, View3D *v3d, rctf *rect) /* rect: for pick float clipsta, clipend, x1, y1, x2, y2; int orth; - orth= get_view3d_viewplane(v3d, rv3d, ar->winx, ar->winy, &viewplane, &clipsta, &clipend, NULL); + orth= ED_view3d_viewplane_get(v3d, rv3d, ar->winx, ar->winy, &viewplane, &clipsta, &clipend, NULL); rv3d->is_persp= !orth; // printf("%d %d %f %f %f %f %f %f\n", winx, winy, viewplane.xmin, viewplane.ymin, viewplane.xmax, viewplane.ymax, clipsta, clipend); @@ -1775,7 +1777,7 @@ static int game_engine_exec(bContext *C, wmOperator *op) if(rv3d->persp==RV3D_CAMOB && startscene->gm.framing.type == SCE_GAMEFRAMING_BARS && startscene->gm.stereoflag != STEREO_DOME) { /* Letterbox */ rctf cam_framef; - view3d_calc_camera_border(startscene, ar, rv3d, CTX_wm_view3d(C), &cam_framef, FALSE); + ED_view3d_calc_camera_border(startscene, ar, CTX_wm_view3d(C), rv3d, &cam_framef, FALSE); cam_frame.xmin = cam_framef.xmin + ar->winrct.xmin; cam_frame.xmax = cam_framef.xmax + ar->winrct.xmin; cam_frame.ymin = cam_framef.ymin + ar->winrct.ymin; @@ -1873,7 +1875,7 @@ void view3d_align_axis_to_vector(View3D *v3d, RegionView3D *rv3d, int axisidx, f } } -float view3d_pixel_size(struct RegionView3D *rv3d, const float co[3]) +float ED_view3d_pixel_size(struct RegionView3D *rv3d, const float co[3]) { return (rv3d->persmat[3][3] + ( rv3d->persmat[0][3]*co[0] + diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c index 608ba3fc1f9..27ca345e132 100644 --- a/source/blender/editors/transform/transform.c +++ b/source/blender/editors/transform/transform.c @@ -4319,7 +4319,7 @@ static int createSlideVerts(TransInfo *t) /*ok, let's try to survive this*/ unit_m4(projectMat); } else { - view3d_get_object_project_mat(v3d, t->obedit, projectMat); + ED_view3d_ob_project_mat_get(v3d, t->obedit, projectMat); } numsel =0; @@ -4612,8 +4612,8 @@ static int createSlideVerts(TransInfo *t) } if (v3d) { - view3d_project_float(t->ar, tempsv->up->v1->co, co, projectMat); - view3d_project_float(t->ar, tempsv->up->v2->co, co2, projectMat); + ED_view3d_project_float(t->ar, tempsv->up->v1->co, co, projectMat); + ED_view3d_project_float(t->ar, tempsv->up->v2->co, co2, projectMat); } if (ev == tempsv->up->v1) { @@ -4625,8 +4625,8 @@ static int createSlideVerts(TransInfo *t) add_v3_v3(start, tvec); if (v3d) { - view3d_project_float(t->ar, tempsv->down->v1->co, co, projectMat); - view3d_project_float(t->ar, tempsv->down->v2->co, co2, projectMat); + ED_view3d_project_float(t->ar, tempsv->down->v1->co, co, projectMat); + ED_view3d_project_float(t->ar, tempsv->down->v2->co, co2, projectMat); } if (ev == tempsv->down->v1) { diff --git a/source/blender/editors/transform/transform_manipulator.c b/source/blender/editors/transform/transform_manipulator.c index b6bb7e54855..65cd285cf48 100644 --- a/source/blender/editors/transform/transform_manipulator.c +++ b/source/blender/editors/transform/transform_manipulator.c @@ -1457,7 +1457,7 @@ void BIF_draw_manipulator(const bContext *C) break; } - mul_mat3_m4_fl(rv3d->twmat, view3d_pixel_size(rv3d, rv3d->twmat[3]) * U.tw_size * 5.0f); + mul_mat3_m4_fl(rv3d->twmat, ED_view3d_pixel_size(rv3d, rv3d->twmat[3]) * U.tw_size * 5.0f); } test_manipulator_axis(C); diff --git a/source/blender/editors/transform/transform_snap.c b/source/blender/editors/transform/transform_snap.c index 6510c9174c6..5c58ca53cb4 100644 --- a/source/blender/editors/transform/transform_snap.c +++ b/source/blender/editors/transform/transform_snap.c @@ -162,11 +162,11 @@ void drawSnapping(const struct bContext *C, TransInfo *t) invert_m4_m4(imat, rv3d->viewmat); for (p = t->tsnap.points.first; p; p = p->next) { - drawcircball(GL_LINE_LOOP, p->co, view3d_pixel_size(rv3d, p->co) * size, imat); + drawcircball(GL_LINE_LOOP, p->co, ED_view3d_pixel_size(rv3d, p->co) * size, imat); } if (t->tsnap.status & POINT_INIT) { - drawcircball(GL_LINE_LOOP, t->tsnap.snapPoint, view3d_pixel_size(rv3d, t->tsnap.snapPoint) * size, imat); + drawcircball(GL_LINE_LOOP, t->tsnap.snapPoint, ED_view3d_pixel_size(rv3d, t->tsnap.snapPoint) * size, imat); } /* draw normal if needed */