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-04-07 10:08:00 +0300
committerMike Erwin <significant.bit@gmail.com>2017-04-07 10:08:00 +0300
commit9c01aaa3dd7456d6811bad4f37190833fa5a04a0 (patch)
tree7b20374688d11ebcf70bf9834edab5baa756eba8 /source/blender/editors/transform
parentc986a2c7aa33423cfdda575d8ed2b50caf053495 (diff)
OpenGL: disable rotate manipulator clipping on Mac
This fixes T51143. gl_ClipDistance is part of GLSL version 1.3 but Mac is stuck on 1.2 for now. This workaround uses GPU_SHADER_3D_UNIFORM_COLOR for the entire rotation widget, ignoring any clipping plane. The CLIPPING shader only works on GLSL 1.3+ so I removed its 1.2 cruft. A legacy implementation using gl_ClipVertex might be possible, but is not worth the effort. This problem (and workaround) goes away when all platforms move to 3.3 core profile.
Diffstat (limited to 'source/blender/editors/transform')
-rw-r--r--source/blender/editors/transform/transform_manipulator.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/source/blender/editors/transform/transform_manipulator.c b/source/blender/editors/transform/transform_manipulator.c
index 384bdb3b258..624cd7db679 100644
--- a/source/blender/editors/transform/transform_manipulator.c
+++ b/source/blender/editors/transform/transform_manipulator.c
@@ -1133,18 +1133,24 @@ static void draw_manipulator_rotate(
// donut arcs
if (arcs) {
float axis_model_mat[4][4];
+
+#if !APPLE_LEGACY
float clip_plane[4];
copy_v3_v3(clip_plane, rv3d->viewinv[2]);
clip_plane[3] = -dot_v3v3(rv3d->viewinv[2], rv3d->twmat[3]);
clip_plane[3] -= 0.02f * size; /* clip just a bit more so view aligned arcs are not visible */
+#endif
gpuPopMatrix(); /* we setup our own matrix, pop previously set twmat */
+
+#if !APPLE_LEGACY
immUnbindProgram();
immBindBuiltinProgram(GPU_SHADER_3D_CLIPPED_UNIFORM_COLOR);
immUniform4fv("ClipPlane", clip_plane);
glEnable(GL_CLIP_DISTANCE0);
+#endif
/* Z circle */
if (drawflags & MAN_ROT_Z) {
@@ -1152,7 +1158,9 @@ static void draw_manipulator_rotate(
else manipulator_setcolor(v3d, 'Z', colcode, 255);
twmat_to_rotation_axis_mat(rv3d->twmat, 2, ortho, axis_model_mat);
+#if !APPLE_LEGACY
immUniformMatrix4fv("ModelMatrix", axis_model_mat);
+#endif
gpuPushMatrix();
gpuMultMatrix3D(axis_model_mat);
@@ -1165,7 +1173,9 @@ static void draw_manipulator_rotate(
else manipulator_setcolor(v3d, 'X', colcode, 255);
twmat_to_rotation_axis_mat(rv3d->twmat, 0, ortho, axis_model_mat);
+#if !APPLE_LEGACY
immUniformMatrix4fv("ModelMatrix", axis_model_mat);
+#endif
gpuPushMatrix();
gpuMultMatrix3D(axis_model_mat);
@@ -1178,7 +1188,9 @@ static void draw_manipulator_rotate(
else manipulator_setcolor(v3d, 'Y', colcode, 255);
twmat_to_rotation_axis_mat(rv3d->twmat, 1, ortho, axis_model_mat);
+#if !APPLE_LEGACY
immUniformMatrix4fv("ModelMatrix", axis_model_mat);
+#endif
gpuPushMatrix();
gpuMultMatrix3D(axis_model_mat);
@@ -1186,7 +1198,10 @@ static void draw_manipulator_rotate(
gpuPopMatrix();
}
+#if !APPLE_LEGACY
glDisable(GL_CLIP_DISTANCE0);
+#endif
+
gpuPushMatrix(); /* to balance final pop at end of function */
}
else {