diff options
Diffstat (limited to 'source/blender/draw/engines/select/shaders')
-rw-r--r-- | source/blender/draw/engines/select/shaders/selection_id_3D_vert.glsl | 26 | ||||
-rw-r--r-- | source/blender/draw/engines/select/shaders/selection_id_frag.glsl | 14 |
2 files changed, 40 insertions, 0 deletions
diff --git a/source/blender/draw/engines/select/shaders/selection_id_3D_vert.glsl b/source/blender/draw/engines/select/shaders/selection_id_3D_vert.glsl new file mode 100644 index 00000000000..9b0107cffdb --- /dev/null +++ b/source/blender/draw/engines/select/shaders/selection_id_3D_vert.glsl @@ -0,0 +1,26 @@ + +uniform float sizeVertex; + +in vec3 pos; + +#ifndef UNIFORM_ID +uniform int offset; +in uint color; + +flat out uint id; +#endif + +void main() +{ +#ifndef UNIFORM_ID + id = floatBitsToUint(intBitsToFloat(offset)) + color; +#endif + + vec3 world_pos = point_object_to_world(pos); + gl_Position = point_world_to_ndc(world_pos); + gl_PointSize = sizeVertex; + +#ifdef USE_WORLD_CLIP_PLANES + world_clip_planes_calc_clip_distance(world_pos); +#endif +} diff --git a/source/blender/draw/engines/select/shaders/selection_id_frag.glsl b/source/blender/draw/engines/select/shaders/selection_id_frag.glsl new file mode 100644 index 00000000000..ea86ddc7301 --- /dev/null +++ b/source/blender/draw/engines/select/shaders/selection_id_frag.glsl @@ -0,0 +1,14 @@ + +#ifdef UNIFORM_ID +uniform int id; +# define id floatBitsToUint(intBitsToFloat(id)) +#else +flat in uint id; +#endif + +out uint fragColor; + +void main() +{ + fragColor = id; +} |