Revision: 38736
          
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=38736
Author:   merwin
Date:     2011-07-26 16:17:00 +0000 (Tue, 26 Jul 2011)
Log Message:
-----------
onscreen ndof rotation guide (center + axis)

Modified Paths:
--------------
    branches/merwin-spacenav/source/blender/editors/space_view3d/view3d_draw.c
    branches/merwin-spacenav/source/blender/editors/space_view3d/view3d_edit.c

Modified: 
branches/merwin-spacenav/source/blender/editors/space_view3d/view3d_draw.c
===================================================================
--- branches/merwin-spacenav/source/blender/editors/space_view3d/view3d_draw.c  
2011-07-26 16:01:09 UTC (rev 38735)
+++ branches/merwin-spacenav/source/blender/editors/space_view3d/view3d_draw.c  
2011-07-26 16:17:00 UTC (rev 38736)
@@ -690,10 +690,13 @@
        glShadeModel(GL_SMOOTH);
        glPointSize(5);
        glEnable(GL_POINT_SMOOTH);
+       glDepthMask(0); // don't overwrite zbuf
 
        if (rv3d->rot_angle != 0.f) {
+               // -- draw rotation axis --
                float scaled_axis[3];
-               mul_v3_v3fl(scaled_axis, rv3d->rot_axis, 3.f);
+               const float scale = rv3d->dist;
+               mul_v3_v3fl(scaled_axis, rv3d->rot_axis, scale);
        
                glBegin(GL_LINE_STRIP);
                        color[3] = 0; // more transparent toward the ends
@@ -701,7 +704,10 @@
                        add_v3_v3v3(end, o, scaled_axis);
                        glVertex3fv(end);
        
-                       color[3] = 0.2f + rv3d->rot_angle; // more opaque 
toward the center
+                       // color[3] = 0.2f + fabsf(rv3d->rot_angle); // 
modulate opacity with angle
+                       // ^^ neat idea, but angle is frame-rate dependent, so 
it's usually close to 0.2
+
+                       color[3] = 0.5f; // more opaque toward the center
                        glColor4fv(color);
                        glVertex3fv(o);
        
@@ -716,6 +722,7 @@
        else
                color[3] = 0.5; // see-through dot
 
+       // -- draw rotation center --
        glColor4fv(color);
        glBegin(GL_POINTS);
                glVertex3fv(o);
@@ -728,6 +735,7 @@
 
        glDisable(GL_BLEND);
        glDisable(GL_POINT_SMOOTH);
+       glDepthMask(1);
 }
 
 static void draw_view_icon(RegionView3D *rv3d)
@@ -2672,10 +2680,10 @@
                BDR_drawSketch(C);
        }
 
-#if 0 // not yet...
+//#if 0 // not yet...
        if (U.ndof_flag & NDOF_SHOW_GUIDE)
                draw_rotation_guide(rv3d);
-#endif
+//#endif
 
        ED_region_pixelspace(ar);
        

Modified: 
branches/merwin-spacenav/source/blender/editors/space_view3d/view3d_edit.c
===================================================================
--- branches/merwin-spacenav/source/blender/editors/space_view3d/view3d_edit.c  
2011-07-26 16:01:09 UTC (rev 38735)
+++ branches/merwin-spacenav/source/blender/editors/space_view3d/view3d_edit.c  
2011-07-26 16:17:00 UTC (rev 38736)
@@ -1053,13 +1053,13 @@
                                if (invert)
                                        angle = -angle;
        
+                               // transform rotation axis from view to world 
coordinates
+                               mul_qt_v3(view_inv, axis);
+       
                                // update the onscreen doo-dad
                                rv3d->rot_angle = angle;
                                copy_v3_v3(rv3d->rot_axis, axis);
        
-                               // transform rotation axis from view to world 
coordinates
-                               mul_qt_v3(view_inv, axis);
-       
                                axis_angle_to_quat(rot, axis, angle);
        #endif  // --------------------------------------------
                                // apply rotation

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to