[Bf-blender-cvs] [08ac184ef0a] tmp-drw-callbatching: Edit Curve: Fix curve normals

Clément Foucault noreply at git.blender.org
Sat Aug 17 14:50:17 CEST 2019


Commit: 08ac184ef0acdc0571c154e65974821ff7b5f139
Author: Clément Foucault
Date:   Fri Jun 7 16:51:18 2019 +0200
Branches: tmp-drw-callbatching
https://developer.blender.org/rB08ac184ef0acdc0571c154e65974821ff7b5f139

Edit Curve: Fix curve normals

===================================================================

M	source/blender/draw/modes/edit_curve_mode.c
M	source/blender/draw/modes/shaders/common_view_lib.glsl

===================================================================

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;



More information about the Bf-blender-cvs mailing list