From adb63a5102cf6e82cc4fdc2b3761fac41f003c84 Mon Sep 17 00:00:00 2001 From: Yonatan Maor Date: Sat, 29 Apr 2023 22:06:39 +0200 Subject: [PATCH] Gizmo: Add anti aliasing to transform constraints Transform constraints were being drawn on screen without anti-aliasing, now fixed to make them look smoother. See #107038 Adding a comparison of before and after the change Pull Request: https://projects.blender.org/blender/blender/pulls/107394 --- source/blender/editors/transform/transform_constraints.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/source/blender/editors/transform/transform_constraints.c b/source/blender/editors/transform/transform_constraints.c index 9b92a37abdf..25034e0bb08 100644 --- a/source/blender/editors/transform/transform_constraints.c +++ b/source/blender/editors/transform/transform_constraints.c @@ -778,7 +778,14 @@ static void drawLine( uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 3, GPU_FETCH_FLOAT); - immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR); + float viewport[4]; + GPU_viewport_size_get_f(viewport); + GPU_blend(GPU_BLEND_ALPHA); + + immBindBuiltinProgram(GPU_SHADER_3D_POLYLINE_UNIFORM_COLOR); + immUniform2fv("viewportSize", &viewport[2]); + immUniform1f("lineWidth", U.pixelsize * 2.0f); + immUniformColor3ubv(col2); immBegin(GPU_PRIM_LINES, 2);