diff options
author | mano-wii <germano.costa@ig.com.br> | 2019-07-30 12:46:59 +0300 |
---|---|---|
committer | mano-wii <germano.costa@ig.com.br> | 2019-07-30 12:46:59 +0300 |
commit | 651d8bfd98db11eb58018412cc030cfe2705c519 (patch) | |
tree | c1d0dbd948383c61636261a1ad113d094577e97e /source/blender/gpu | |
parent | a85963bed86bb25b29a70f893cc9e9279a0b9d15 (diff) |
3D View: Move selection API to a Selection engine.
This commit moves the API of selecting faces, vertices and edges to a DRW manager engine.
Reviewers: campbellbarton, fclem
Subscribers: jbakker, brecht
Differential Revision: https://developer.blender.org/D5090
Diffstat (limited to 'source/blender/gpu')
-rw-r--r-- | source/blender/gpu/CMakeLists.txt | 3 | ||||
-rw-r--r-- | source/blender/gpu/GPU_shader.h | 5 | ||||
-rw-r--r-- | source/blender/gpu/intern/gpu_shader.c | 19 | ||||
-rw-r--r-- | source/blender/gpu/shaders/gpu_shader_3D_selection_id_vert.glsl | 26 | ||||
-rw-r--r-- | source/blender/gpu/shaders/gpu_shader_selection_id_frag.glsl | 13 |
5 files changed, 2 insertions, 64 deletions
diff --git a/source/blender/gpu/CMakeLists.txt b/source/blender/gpu/CMakeLists.txt index f30eff1484b..c620644a5f8 100644 --- a/source/blender/gpu/CMakeLists.txt +++ b/source/blender/gpu/CMakeLists.txt @@ -221,9 +221,6 @@ data_to_c_simple(shaders/gpu_shader_2D_edituvs_edges_vert.glsl SRC) data_to_c_simple(shaders/gpu_shader_2D_edituvs_faces_vert.glsl SRC) data_to_c_simple(shaders/gpu_shader_2D_edituvs_stretch_vert.glsl SRC) -data_to_c_simple(shaders/gpu_shader_3D_selection_id_vert.glsl SRC) -data_to_c_simple(shaders/gpu_shader_selection_id_frag.glsl SRC) - data_to_c_simple(shaders/gpu_shader_text_simple_vert.glsl SRC) data_to_c_simple(shaders/gpu_shader_text_simple_geom.glsl SRC) data_to_c_simple(shaders/gpu_shader_text_vert.glsl SRC) diff --git a/source/blender/gpu/GPU_shader.h b/source/blender/gpu/GPU_shader.h index cae2392e503..124f1f1ff8a 100644 --- a/source/blender/gpu/GPU_shader.h +++ b/source/blender/gpu/GPU_shader.h @@ -355,11 +355,8 @@ typedef enum eGPUBuiltinShader { GPU_SHADER_2D_UV_FACES, GPU_SHADER_2D_UV_FACES_STRETCH_AREA, GPU_SHADER_2D_UV_FACES_STRETCH_ANGLE, - /* Selection */ - GPU_SHADER_3D_FLAT_SELECT_ID, - GPU_SHADER_3D_UNIFORM_SELECT_ID, } eGPUBuiltinShader; -#define GPU_SHADER_BUILTIN_LEN (GPU_SHADER_3D_UNIFORM_SELECT_ID + 1) +#define GPU_SHADER_BUILTIN_LEN (GPU_SHADER_2D_UV_FACES_STRETCH_ANGLE + 1) /** Support multiple configurations. */ typedef enum eGPUShaderConfig { diff --git a/source/blender/gpu/intern/gpu_shader.c b/source/blender/gpu/intern/gpu_shader.c index c142d8ccba2..3e930d19696 100644 --- a/source/blender/gpu/intern/gpu_shader.c +++ b/source/blender/gpu/intern/gpu_shader.c @@ -139,9 +139,6 @@ extern char datatoc_gpu_shader_2D_edituvs_edges_vert_glsl[]; extern char datatoc_gpu_shader_2D_edituvs_faces_vert_glsl[]; extern char datatoc_gpu_shader_2D_edituvs_stretch_vert_glsl[]; -extern char datatoc_gpu_shader_3D_selection_id_vert_glsl[]; -extern char datatoc_gpu_shader_selection_id_frag_glsl[]; - extern char datatoc_gpu_shader_2D_line_dashed_uniform_color_vert_glsl[]; extern char datatoc_gpu_shader_2D_line_dashed_frag_glsl[]; extern char datatoc_gpu_shader_2D_line_dashed_geom_glsl[]; @@ -1312,18 +1309,6 @@ static const GPUShaderStages builtin_shader_stages[GPU_SHADER_BUILTIN_LEN] = { .defs = "#define STRETCH_ANGLE\n", }, - [GPU_SHADER_3D_FLAT_SELECT_ID] = - { - .vert = datatoc_gpu_shader_3D_selection_id_vert_glsl, - .frag = datatoc_gpu_shader_selection_id_frag_glsl, - }, - [GPU_SHADER_3D_UNIFORM_SELECT_ID] = - { - .vert = datatoc_gpu_shader_3D_selection_id_vert_glsl, - .frag = datatoc_gpu_shader_selection_id_frag_glsl, - .defs = "#define UNIFORM_ID\n", - }, - [GPU_SHADER_GPENCIL_STROKE] = { .vert = datatoc_gpu_shader_gpencil_stroke_vert_glsl, @@ -1370,9 +1355,7 @@ GPUShader *GPU_shader_get_builtin_shader_with_config(eGPUBuiltinShader shader, GPU_SHADER_3D_GROUNDLINE, GPU_SHADER_3D_GROUNDPOINT, GPU_SHADER_DISTANCE_LINES, - GPU_SHADER_INSTANCE_EDGES_VARIYING_COLOR, - GPU_SHADER_3D_FLAT_SELECT_ID, - GPU_SHADER_3D_UNIFORM_SELECT_ID) || + GPU_SHADER_INSTANCE_EDGES_VARIYING_COLOR) || ELEM(shader, GPU_SHADER_3D_FLAT_COLOR, GPU_SHADER_3D_LINE_DASHED_UNIFORM_COLOR, diff --git a/source/blender/gpu/shaders/gpu_shader_3D_selection_id_vert.glsl b/source/blender/gpu/shaders/gpu_shader_3D_selection_id_vert.glsl deleted file mode 100644 index 0d58909efd8..00000000000 --- a/source/blender/gpu/shaders/gpu_shader_3D_selection_id_vert.glsl +++ /dev/null @@ -1,26 +0,0 @@ - -uniform mat4 ModelViewProjectionMatrix; - -in vec3 pos; - -#ifndef UNIFORM_ID -uniform uint offset; -in uint color; - -flat out uint id; -#endif - -void main() -{ -#ifndef UNIFORM_ID - id = offset + color; -#endif - - vec4 pos_4d = vec4(pos, 1.0); - gl_Position = ModelViewProjectionMatrix * pos_4d; - -#ifdef USE_WORLD_CLIP_PLANES - /* Warning: ModelMatrix is typically used but select drawing is different. */ - world_clip_planes_calc_clip_distance(pos); -#endif -} diff --git a/source/blender/gpu/shaders/gpu_shader_selection_id_frag.glsl b/source/blender/gpu/shaders/gpu_shader_selection_id_frag.glsl deleted file mode 100644 index 1f22b9cb0b4..00000000000 --- a/source/blender/gpu/shaders/gpu_shader_selection_id_frag.glsl +++ /dev/null @@ -1,13 +0,0 @@ - -#ifdef UNIFORM_ID -uniform uint id; -#else -flat in uint id; -#endif - -out uint fragColor; - -void main() -{ - fragColor = id; -} |