From c69f2eaca97084e0e830756b574c9ec8a55c6643 Mon Sep 17 00:00:00 2001 From: Janne Karhu Date: Sat, 30 Oct 2010 17:13:03 +0000 Subject: Fix for [#24448] User Preferences - Interface - Mini Axis - Brightness, none working? * The axis draw function was changed by Campbell recently, but the brightness value was forgotten? * Solved currently by mapping the brightness value to axis alpha. --- source/blender/editors/space_view3d/view3d_draw.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'source/blender') diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c index 4c153c2d0c1..de373d54be6 100644 --- a/source/blender/editors/space_view3d/view3d_draw.c +++ b/source/blender/editors/space_view3d/view3d_draw.c @@ -579,6 +579,7 @@ static void draw_view_axis(RegionView3D *rv3d) const float toll = 0.5; /* used to see when view is quasi-orthogonal */ const float start = k + 1.0; /* axis center in screen coordinates, x=y */ float ydisp = 0.0; /* vertical displacement to allow obj info text */ + int bright = 25*(float)U.rvibright + 5; /* axis alpha (rvibright has range 0-10) */ float vec[3]; float dx, dy; @@ -586,6 +587,9 @@ static void draw_view_axis(RegionView3D *rv3d) /* thickness of lines is proportional to k */ glLineWidth(2); + glEnable(GL_BLEND); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + /* X */ vec[0] = 1; vec[1] = vec[2] = 0; @@ -593,7 +597,7 @@ static void draw_view_axis(RegionView3D *rv3d) dx = vec[0] * k; dy = vec[1] * k; - glColor3ub(220, 0, 0); + glColor4ub(220, 0, 0, bright); glBegin(GL_LINES); glVertex2f(start, start + ydisp); glVertex2f(start + dx, start + dy + ydisp); @@ -603,6 +607,9 @@ static void draw_view_axis(RegionView3D *rv3d) BLF_draw_default(start + dx + 2, start + dy + ydisp + 2, 0.0f, "x"); } + /* BLF_draw_default disables blending */ + glEnable(GL_BLEND); + /* Y */ vec[1] = 1; vec[0] = vec[2] = 0; @@ -610,7 +617,7 @@ static void draw_view_axis(RegionView3D *rv3d) dx = vec[0] * k; dy = vec[1] * k; - glColor3ub(0, 220, 0); + glColor4ub(0, 220, 0, bright); glBegin(GL_LINES); glVertex2f(start, start + ydisp); glVertex2f(start + dx, start + dy + ydisp); @@ -619,6 +626,8 @@ static void draw_view_axis(RegionView3D *rv3d) if (fabs(dx) > toll || fabs(dy) > toll) { BLF_draw_default(start + dx + 2, start + dy + ydisp + 2, 0.0f, "y"); } + + glEnable(GL_BLEND); /* Z */ vec[2] = 1; @@ -627,7 +636,7 @@ static void draw_view_axis(RegionView3D *rv3d) dx = vec[0] * k; dy = vec[1] * k; - glColor3ub(30, 30, 220); + glColor4ub(30, 30, 220, bright); glBegin(GL_LINES); glVertex2f(start, start + ydisp); glVertex2f(start + dx, start + dy + ydisp); @@ -640,6 +649,7 @@ static void draw_view_axis(RegionView3D *rv3d) /* restore line-width */ glLineWidth(1.0); + glDisable(GL_BLEND); } -- cgit v1.2.3