diff options
author | Mike Erwin <significant.bit@gmail.com> | 2017-03-23 08:45:46 +0300 |
---|---|---|
committer | Mike Erwin <significant.bit@gmail.com> | 2017-03-23 08:46:14 +0300 |
commit | 09ad6842499f638ecd944714c0a82ba8deebb073 (patch) | |
tree | f3f3f3be2571d530497850b9196e0c23ff3e8093 /source/blender/editors/transform/transform_manipulator.c | |
parent | c2366009c06ad7bdda29d182f8f3b4550cc0e123 (diff) |
cleanup use of GPU matrix API
Take advantage of 2D functions, rotation about the X Y or Z axis, uniform scale factors.
We no longer need to call gpuMatrixBegin_legacy() before using the new API locally in functions.
related to T49450
Diffstat (limited to 'source/blender/editors/transform/transform_manipulator.c')
-rw-r--r-- | source/blender/editors/transform/transform_manipulator.c | 44 |
1 files changed, 20 insertions, 24 deletions
diff --git a/source/blender/editors/transform/transform_manipulator.c b/source/blender/editors/transform/transform_manipulator.c index a78bf1551bc..a9b3363e0c8 100644 --- a/source/blender/editors/transform/transform_manipulator.c +++ b/source/blender/editors/transform/transform_manipulator.c @@ -988,7 +988,6 @@ static void draw_manipulator_rotate( /* prepare for screen aligned draw */ size = len_v3(rv3d->twmat[0]); - gpuMatrixBegin3D_legacy(); gpuPushMatrix(); gpuTranslate3fv(rv3d->twmat[3]); @@ -1114,9 +1113,10 @@ static void draw_manipulator_rotate( preOrthoFront(ortho, matt, 0); if (is_picksel) GPU_select_load_id(MAN_ROT_X); else manipulator_setcolor(v3d, 'X', colcode, 255); - gpuRotate3f(90.0, 0.0, 1.0, 0.0); + gpuPushMatrix(); + gpuRotateAxis(90.0, 'Y'); imm_drawcircball(unitmat[3], 1.0, unitmat, pos); - gpuRotate3f(-90.0, 0.0, 1.0, 0.0); + gpuPopMatrix(); postOrtho(ortho); } /* Y circle */ @@ -1124,9 +1124,10 @@ static void draw_manipulator_rotate( preOrthoFront(ortho, matt, 1); if (is_picksel) GPU_select_load_id(MAN_ROT_Y); else manipulator_setcolor(v3d, 'Y', colcode, 255); - gpuRotate3f(-90.0, 1.0, 0.0, 0.0); + gpuPushMatrix(); + gpuRotateAxis(-90.0, 'X'); imm_drawcircball(unitmat[3], 1.0, unitmat, pos); - gpuRotate3f(90.0, 1.0, 0.0, 0.0); + gpuPopMatrix(); postOrtho(ortho); } } @@ -1147,9 +1148,10 @@ static void draw_manipulator_rotate( preOrthoFront(ortho, rv3d->twmat, 0); if (is_picksel) GPU_select_load_id(MAN_ROT_X); else manipulator_setcolor(v3d, 'X', colcode, 255); - gpuRotate3f(90.0, 0.0, 1.0, 0.0); + gpuPushMatrix(); + gpuRotateAxis(90.0, 'Y'); partial_doughnut(pos, cusize / 4.0f, 1.0f, 0, 48, 8, 48); - gpuRotate3f(-90.0, 0.0, 1.0, 0.0); + gpuPopMatrix(); postOrtho(ortho); } /* Y circle */ @@ -1157,9 +1159,10 @@ static void draw_manipulator_rotate( preOrthoFront(ortho, rv3d->twmat, 1); if (is_picksel) GPU_select_load_id(MAN_ROT_Y); else manipulator_setcolor(v3d, 'Y', colcode, 255); - gpuRotate3f(-90.0, 1.0, 0.0, 0.0); + gpuPushMatrix(); + gpuRotateAxis(-90.0, 'X'); partial_doughnut(pos, cusize / 4.0f, 1.0f, 0, 48, 8, 48); - gpuRotate3f(90.0, 1.0, 0.0, 0.0); + gpuPopMatrix(); postOrtho(ortho); } @@ -1188,8 +1191,8 @@ static void draw_manipulator_rotate( if (is_picksel) GPU_select_load_id(MAN_ROT_Y); else manipulator_setcolor(v3d, 'Y', colcode, 255); - gpuRotate3f(90.0, 1.0, 0.0, 0.0); - gpuRotate3f(90.0, 0.0, 0.0, 1.0); + gpuRotateAxis(90.0, 'X'); + gpuRotateAxis(90.0, 'Z'); partial_doughnut(pos, 0.7f * cusize, 1.0f, 31, 33, 8, 64); gpuPopMatrix(); @@ -1203,8 +1206,8 @@ static void draw_manipulator_rotate( if (is_picksel) GPU_select_load_id(MAN_ROT_X); else manipulator_setcolor(v3d, 'X', colcode, 255); - gpuRotate3f(-90.0, 0.0, 1.0, 0.0); - gpuRotate3f(90.0, 0.0, 0.0, 1.0); + gpuRotateAxis(-90.0, 'Y'); + gpuRotateAxis(90.0, 'Z'); partial_doughnut(pos, 0.7f * cusize, 1.0f, 31, 33, 8, 64); gpuPopMatrix(); @@ -1218,7 +1221,6 @@ static void draw_manipulator_rotate( if (v3d->zbuf) glEnable(GL_DEPTH_TEST); immUnbindProgram(); - gpuMatrixEnd(); } static void drawsolidcube(unsigned int pos, float size) @@ -1276,7 +1278,6 @@ static void draw_manipulator_scale( immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR); - gpuMatrixBegin3D_legacy(); gpuPushMatrix(); /* not in combo mode */ @@ -1375,7 +1376,6 @@ static void draw_manipulator_scale( if (v3d->zbuf) glEnable(GL_DEPTH_TEST); glFrontFace(GL_CCW); - gpuMatrixEnd(); immUnbindProgram(); } @@ -1468,7 +1468,6 @@ static void draw_manipulator_translate( immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR); - gpuMatrixBegin3D_legacy(); gpuPushMatrix(); /* center circle, do not add to selection when shift is pressed (planar constraint) */ @@ -1517,7 +1516,7 @@ static void draw_manipulator_translate( gpuTranslate3f(dz, 0.0, 0.0); if (is_picksel) GPU_select_load_id(MAN_TRANS_X); else manipulator_setcolor(v3d, 'X', colcode, axisBlendAngle(rv3d->tw_idot[0])); - gpuRotate3f(90.0, 0.0, 1.0, 0.0); + gpuRotateAxis(90.0, 'Y'); draw_cone(pos, cylen, cywid); gpuPopMatrix(); } @@ -1528,7 +1527,7 @@ static void draw_manipulator_translate( gpuTranslate3f(0.0, dz, 0.0); if (is_picksel) GPU_select_load_id(MAN_TRANS_Y); else manipulator_setcolor(v3d, 'Y', colcode, axisBlendAngle(rv3d->tw_idot[1])); - gpuRotate3f(-90.0, 1.0, 0.0, 0.0); + gpuRotateAxis(-90.0, 'X'); draw_cone(pos, cylen, cywid); gpuPopMatrix(); } @@ -1541,7 +1540,6 @@ static void draw_manipulator_translate( if (v3d->zbuf) glEnable(GL_DEPTH_TEST); immUnbindProgram(); - gpuMatrixEnd(); } static void draw_manipulator_rotate_cyl( @@ -1563,7 +1561,6 @@ static void draw_manipulator_rotate_cyl( immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR); - gpuMatrixBegin3D_legacy(); gpuPushMatrix(); /* prepare for screen aligned draw */ @@ -1629,7 +1626,7 @@ static void draw_manipulator_rotate_cyl( gpuPushMatrix(); gpuTranslate3f(1.0, 0.0, 0.0); if (is_picksel) GPU_select_load_id(MAN_ROT_X); - gpuRotate3f(90.0, 0.0, 1.0, 0.0); + gpuRotateAxis(90.0, 'Y'); manipulator_setcolor(v3d, 'X', colcode, 255); draw_cylinder(pos, cylen, cywid); gpuPopMatrix(); @@ -1640,7 +1637,7 @@ static void draw_manipulator_rotate_cyl( gpuPushMatrix(); gpuTranslate3f(0.0, 1.0, 0.0); if (is_picksel) GPU_select_load_id(MAN_ROT_Y); - gpuRotate3f(-90.0, 1.0, 0.0, 0.0); + gpuRotateAxis(-90.0, 'X'); manipulator_setcolor(v3d, 'Y', colcode, 255); draw_cylinder(pos, cylen, cywid); gpuPopMatrix(); @@ -1664,7 +1661,6 @@ static void draw_manipulator_rotate_cyl( if (v3d->zbuf) glEnable(GL_DEPTH_TEST); - gpuMatrixEnd(); immUnbindProgram(); } |