Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Erwin <significant.bit@gmail.com>2017-03-23 08:45:46 +0300
committerMike Erwin <significant.bit@gmail.com>2017-03-23 08:46:14 +0300
commit09ad6842499f638ecd944714c0a82ba8deebb073 (patch)
treef3f3f3be2571d530497850b9196e0c23ff3e8093 /source/blender/editors/transform
parentc2366009c06ad7bdda29d182f8f3b4550cc0e123 (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')
-rw-r--r--source/blender/editors/transform/transform.c14
-rw-r--r--source/blender/editors/transform/transform_manipulator.c44
2 files changed, 26 insertions, 32 deletions
diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c
index c0726757bdf..bbf4ebb4eb1 100644
--- a/source/blender/editors/transform/transform.c
+++ b/source/blender/editors/transform/transform.c
@@ -1717,7 +1717,7 @@ static void drawHelpline(bContext *UNUSED(C), int x, int y, void *customdata)
projectFloatViewEx(t, vecrot, cent, V3D_PROJ_TEST_CLIP_ZERO);
- gpuMatrixBegin3D_legacy(); /* TODO(merwin): finish the 2D matrix API & use here */
+ gpuPushMatrix();
unsigned pos = add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT);
UNUSED_VARS(pos); /* silence warning */
@@ -1825,7 +1825,7 @@ static void drawHelpline(bContext *UNUSED(C), int x, int y, void *customdata)
}
immUnbindProgram();
- gpuMatrixEnd();
+ gpuPopMatrix();
}
}
@@ -6873,8 +6873,7 @@ static void drawEdgeSlide(TransInfo *t)
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
- gpuMatrixBegin3D_legacy();
-
+ gpuPushMatrix();
gpuMultMatrix3D(t->obedit->obmat);
unsigned pos = add_attrib(immVertexFormat(), "pos", COMP_F32, 3, KEEP_FLOAT);
@@ -6962,7 +6961,7 @@ static void drawEdgeSlide(TransInfo *t)
immUnbindProgram();
- gpuMatrixEnd();
+ gpuPopMatrix();
glDisable(GL_BLEND);
@@ -7486,8 +7485,7 @@ static void drawVertSlide(TransInfo *t)
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
- gpuMatrixBegin3D_legacy();
-
+ gpuPushMatrix();
gpuMultMatrix3D(t->obedit->obmat);
glLineWidth(line_size);
@@ -7566,7 +7564,7 @@ static void drawVertSlide(TransInfo *t)
immUnbindProgram();
- gpuMatrixEnd();
+ gpuPopMatrix();
if (v3d && v3d->zbuf)
glEnable(GL_DEPTH_TEST);
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();
}