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:
authorClément Foucault <foucault.clem@gmail.com>2020-04-24 00:05:39 +0300
committerClément Foucault <foucault.clem@gmail.com>2020-04-24 00:07:48 +0300
commitd712f1f83af881be536ec0d183b7d3025c172684 (patch)
treeeabecb450ce2d4697468d2758df28fd990c14ed6 /source/blender/editors/gizmo_library/gizmo_types/move3d_gizmo.c
parentd0ff3434cffa2e056e4f191ead21226f32ea8c15 (diff)
GPU: Add Polyline shader (wide line emulation)
This new shader is able to emulate smooth wide lines drawing using a geometry shader. This shader needs viewportSize and lineWidth uniforms to be set. There is multiple variants to replace the usage of wide lines for most shaders. This patch only fix the gizmo_types files and the navigation gizmo. Other areas could be fixed afterward, I just limited the patch size. Fix T57570. Reviewed By: billreynish Differential Revision: https://developer.blender.org/D7487
Diffstat (limited to 'source/blender/editors/gizmo_library/gizmo_types/move3d_gizmo.c')
-rw-r--r--source/blender/editors/gizmo_library/gizmo_types/move3d_gizmo.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/source/blender/editors/gizmo_library/gizmo_types/move3d_gizmo.c b/source/blender/editors/gizmo_library/gizmo_types/move3d_gizmo.c
index 39e0712a511..9c95f82eaf2 100644
--- a/source/blender/editors/gizmo_library/gizmo_types/move3d_gizmo.c
+++ b/source/blender/editors/gizmo_library/gizmo_types/move3d_gizmo.c
@@ -110,12 +110,16 @@ static void move_geom_draw(const wmGizmo *gz,
ED_GIZMO_MOVE_DRAW_FLAG_FILL_SELECT) :
ED_GIZMO_MOVE_DRAW_FLAG_FILL)));
- GPU_line_width(gz->line_width);
-
GPUVertFormat *format = immVertexFormat();
uint pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT);
- immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR);
+ immBindBuiltinProgram(filled ? GPU_SHADER_3D_UNIFORM_COLOR :
+ GPU_SHADER_3D_POLYLINE_UNIFORM_COLOR);
+
+ float viewport[4];
+ GPU_viewport_size_get_f(viewport);
+ immUniform2fv("viewportSize", &viewport[2]);
+ immUniform1f("lineWidth", gz->line_width * U.pixelsize);
immUniformColor4fv(color);