diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2019-06-07 17:51:18 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2019-08-17 15:48:48 +0300 |
commit | 08ac184ef0acdc0571c154e65974821ff7b5f139 (patch) | |
tree | 006e35a153f7a3f0c9b3c3726b19c4e44cca65a0 | |
parent | 4649deaab7c5f66005cce844c73bc275c60aea0a (diff) |
Edit Curve: Fix curve normals
-rw-r--r-- | source/blender/draw/modes/edit_curve_mode.c | 2 | ||||
-rw-r--r-- | source/blender/draw/modes/shaders/common_view_lib.glsl | 13 |
2 files changed, 11 insertions, 4 deletions
diff --git a/source/blender/draw/modes/edit_curve_mode.c b/source/blender/draw/modes/edit_curve_mode.c index e68e03c2438..8933767bda8 100644 --- a/source/blender/draw/modes/edit_curve_mode.c +++ b/source/blender/draw/modes/edit_curve_mode.c @@ -126,7 +126,7 @@ static void EDIT_CURVE_engine_init(void *UNUSED(vedata)) datatoc_edit_curve_overlay_normals_vert_glsl, NULL}, .frag = (const char *[]){datatoc_gpu_shader_uniform_color_frag_glsl, NULL}, - .defs = (const char *[]){sh_cfg_data->def, NULL}, + .defs = (const char *[]){sh_cfg_data->def, "#define IN_PLACE_INSTANCES\n", NULL}, }); } diff --git a/source/blender/draw/modes/shaders/common_view_lib.glsl b/source/blender/draw/modes/shaders/common_view_lib.glsl index 4cbb2c34aeb..be7a660decd 100644 --- a/source/blender/draw/modes/shaders/common_view_lib.glsl +++ b/source/blender/draw/modes/shaders/common_view_lib.glsl @@ -28,13 +28,20 @@ uniform int resourceChunk; #ifdef GPU_VERTEX_SHADER # ifdef GL_ARB_shader_draw_parameters -# define resource_id (gl_BaseInstanceARB + gl_InstanceID) - +# define baseInstance gl_BaseInstanceARB # else /* no ARB_shader_draw_parameters */ uniform int baseInstance; -# define resource_id (baseInstance + gl_InstanceID) +# endif +# ifdef IN_PLACE_INSTANCES +/* When drawing instances of an object at the same position. */ +# define instanceId 0 +# else +# define instanceId gl_InstanceID # endif + +# define resource_id (baseInstance + instanceId) + /* Use this to declare and pass the value if * the fragment shader uses the resource_id. */ # define RESOURCE_ID_VARYING flat out int resourceIDFrag; |