diff options
author | Matt Ebb <matt@mke3.net> | 2010-07-28 12:05:39 +0400 |
---|---|---|
committer | Matt Ebb <matt@mke3.net> | 2010-07-28 12:05:39 +0400 |
commit | 79dd2cc8e9073039d3518c41d90adb006d344201 (patch) | |
tree | 987c59346ea6fff84f5c9f0bf5b738a2239b3302 /source/blender | |
parent | 70bca0405dbb45d34db9c4bdcc407a42832da002 (diff) |
Fix [#22197] empty XYZ text size changing according to distance from origin
Partial revert for commit r 27946
Empty/axis xyz text is now purely aligned to object space. Previous 3d view matrix manipulation
stuff that I added wasn't correct, and causing more problems than it solved. Perhaps someone
can tweak this later to be fixed size/screen aligned, but for now this is less annoying.
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/editors/space_view3d/drawarmature.c | 11 | ||||
-rw-r--r-- | source/blender/editors/space_view3d/drawobject.c | 43 | ||||
-rw-r--r-- | source/blender/editors/space_view3d/view3d_intern.h | 2 |
3 files changed, 15 insertions, 41 deletions
diff --git a/source/blender/editors/space_view3d/drawarmature.c b/source/blender/editors/space_view3d/drawarmature.c index d16f89e5785..5e0c49e6224 100644 --- a/source/blender/editors/space_view3d/drawarmature.c +++ b/source/blender/editors/space_view3d/drawarmature.c @@ -1882,15 +1882,12 @@ static void draw_pose_bones(Scene *scene, View3D *v3d, ARegion *ar, Base *base, /* Draw additional axes on the bone tail */ if ( (arm->flag & ARM_DRAWAXES) && (arm->flag & ARM_POSEMODE) ) { - float mat[4][4]; glPushMatrix(); copy_m4_m4(bmat, pchan->pose_mat); bone_matrix_translate_y(bmat, pchan->bone->length); glMultMatrixf(bmat); - mul_m4_m4m4(mat, bmat, rv3d->viewmatob); - - drawaxes(rv3d, mat, pchan->bone->length*0.25f, 0, OB_ARROWS); + drawaxes(pchan->bone->length*0.25f, 0, OB_ARROWS); glPopMatrix(); } @@ -2078,16 +2075,12 @@ static void draw_ebones(View3D *v3d, ARegion *ar, Object *ob, int dt) } /* Draw additional axes */ if (arm->flag & ARM_DRAWAXES) { - float mat[4][4]; glPushMatrix(); get_matrix_editbone(eBone, bmat); bone_matrix_translate_y(bmat, eBone->length); glMultMatrixf(bmat); - mul_m4_m4m4(mat, bmat, rv3d->viewmatob); - - /* do cached text draw immediate to include transform */ - drawaxes(rv3d, mat, eBone->length*0.25f, 0, OB_ARROWS); + drawaxes(eBone->length*0.25f, 0, OB_ARROWS); glPopMatrix(); } diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c index 30bfa123007..5bb1ea2cc9f 100644 --- a/source/blender/editors/space_view3d/drawobject.c +++ b/source/blender/editors/space_view3d/drawobject.c @@ -321,31 +321,12 @@ static float cosval[32] ={ 1.00000000 }; -static void draw_xyz_wire(RegionView3D *rv3d, float mat[][4], float *c, float size, int axis) +static void draw_xyz_wire(float *c, float size, int axis) { float v1[3]= {0.f, 0.f, 0.f}, v2[3] = {0.f, 0.f, 0.f}; - float imat[4][4]; - float dim; - float dx[3], dy[3]; - - /* hrms, really only works properly after glLoadMatrixf(rv3d->viewmat); */ - float pixscale= rv3d->persmat[0][3]*c[0]+ rv3d->persmat[1][3]*c[1]+ rv3d->persmat[2][3]*c[2] + rv3d->persmat[3][3]; - pixscale*= rv3d->pixsize; - - /* halfway blend between fixed size in worldspace vs viewspace - - * alleviates some of the weirdness due to not using viewmat for gl matrix */ - dim = (0.05*size*0.5) + (size*10.f*pixscale*0.5); - - invert_m4_m4(imat, mat); - normalize_v3(imat[0]); - normalize_v3(imat[1]); - - copy_v3_v3(dx, imat[0]); - copy_v3_v3(dy, imat[1]); + float dim = size * 0.1; + float dx[3]={dim, 0.0, 0.0}, dy[3]={0.0, dim, 0.0}, dz[3]={0.0, 0.0, dim}; - mul_v3_fl(dx, dim); - mul_v3_fl(dy, dim); - switch(axis) { case 0: /* x axis */ glBegin(GL_LINES); @@ -397,7 +378,7 @@ static void draw_xyz_wire(RegionView3D *rv3d, float mat[][4], float *c, float si /* start at top left */ sub_v3_v3v3(v1, c, dx); - add_v3_v3v3(v1, c, dy); + add_v3_v3v3(v1, c, dz); glVertex3fv(v1); @@ -406,9 +387,9 @@ static void draw_xyz_wire(RegionView3D *rv3d, float mat[][4], float *c, float si glVertex3fv(v1); - mul_v3_fl(dy, 2.f); + mul_v3_fl(dz, 2.f); sub_v3_v3(v1, dx); - sub_v3_v3(v1, dy); + sub_v3_v3(v1, dz); glVertex3fv(v1); @@ -423,7 +404,7 @@ static void draw_xyz_wire(RegionView3D *rv3d, float mat[][4], float *c, float si } /* flag is same as for draw_object */ -void drawaxes(RegionView3D *rv3d, float mat[][4], float size, int flag, char drawtype) +void drawaxes(float size, int flag, char drawtype) { int axis; float v1[3]= {0.0, 0.0, 0.0}; @@ -522,7 +503,7 @@ void drawaxes(RegionView3D *rv3d, float mat[][4], float size, int flag, char dra v2[axis]+= size*0.125; - draw_xyz_wire(rv3d, mat, v2, size, axis); + draw_xyz_wire(v2, size, axis); } break; } @@ -5925,7 +5906,7 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag) } case OB_EMPTY: if((v3d->flag2 & V3D_RENDER_OVERRIDE)==0) - drawaxes(rv3d, rv3d->viewmatob, ob->empty_drawsize, flag, ob->empty_drawtype); + drawaxes(ob->empty_drawsize, flag, ob->empty_drawtype); break; case OB_LAMP: if((v3d->flag2 & V3D_RENDER_OVERRIDE)==0) { @@ -5951,7 +5932,7 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag) break; default: if((v3d->flag2 & V3D_RENDER_OVERRIDE)==0) { - drawaxes(rv3d, rv3d->viewmatob, 1.0, flag, OB_ARROWS); + drawaxes(1.0, flag, OB_ARROWS); } } @@ -6151,7 +6132,7 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag) if(dtx && (G.f & G_RENDER_OGL)==0) { if(dtx & OB_AXIS) { - drawaxes(rv3d, rv3d->viewmatob, 1.0f, flag, OB_ARROWS); + drawaxes(1.0f, flag, OB_ARROWS); } if(dtx & OB_BOUNDBOX) { if((v3d->flag2 & V3D_RENDER_OVERRIDE)==0) @@ -6525,7 +6506,7 @@ void draw_object_instance(Scene *scene, View3D *v3d, RegionView3D *rv3d, Object draw_object_mesh_instance(scene, v3d, rv3d, ob, dt, outline); break; case OB_EMPTY: - drawaxes(rv3d, rv3d->viewmatob, ob->empty_drawsize, 0, ob->empty_drawtype); + drawaxes(ob->empty_drawsize, 0, ob->empty_drawtype); break; } } diff --git a/source/blender/editors/space_view3d/view3d_intern.h b/source/blender/editors/space_view3d/view3d_intern.h index 846300ff9a6..fd78c8298e9 100644 --- a/source/blender/editors/space_view3d/view3d_intern.h +++ b/source/blender/editors/space_view3d/view3d_intern.h @@ -105,7 +105,7 @@ void draw_object(Scene *scene, struct ARegion *ar, View3D *v3d, Base *base, int int draw_glsl_material(Scene *scene, Object *ob, View3D *v3d, int dt); void draw_object_instance(Scene *scene, View3D *v3d, RegionView3D *rv3d, Object *ob, int dt, int outline); void draw_object_backbufsel(Scene *scene, View3D *v3d, RegionView3D *rv3d, Object *ob); -void drawaxes(struct RegionView3D *rv3d, float mat[][4], float size, int flag, char drawtype); +void drawaxes(float size, int flag, char drawtype); void view3d_cached_text_draw_begin(void); void view3d_cached_text_draw_add(float x, float y, float z, char *str, short xoffs, short flag); |