diff options
author | Campbell Barton <ideasman42@gmail.com> | 2019-05-30 13:02:05 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2019-05-30 13:02:05 +0300 |
commit | 671827549a3d013a2037e0b9814708214c59271c (patch) | |
tree | 7f15acb0cfbc4a5ad6b49cd072d9c7564f8df95b /source/blender/gpu | |
parent | 8cc1154aa257f1cc7fe6c5e0d139cdc0afd6b604 (diff) |
3D View: Support light probe data clipping
Diffstat (limited to 'source/blender/gpu')
-rw-r--r-- | source/blender/gpu/intern/gpu_shader.c | 6 | ||||
-rw-r--r-- | source/blender/gpu/shaders/gpu_shader_instance_variying_size_variying_id_vert.glsl | 10 |
2 files changed, 14 insertions, 2 deletions
diff --git a/source/blender/gpu/intern/gpu_shader.c b/source/blender/gpu/intern/gpu_shader.c index 7201025ad8a..a7eb6726364 100644 --- a/source/blender/gpu/intern/gpu_shader.c +++ b/source/blender/gpu/intern/gpu_shader.c @@ -1319,13 +1319,17 @@ GPUShader *GPU_shader_get_builtin_shader_with_config(eGPUBuiltinShader shader, GPU_SHADER_3D_POINT_UNIFORM_SIZE_UNIFORM_COLOR_AA, GPU_SHADER_3D_SCREENSPACE_VARIYING_COLOR, GPU_SHADER_3D_INSTANCE_SCREEN_ALIGNED, + 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) || - ELEM(shader, GPU_SHADER_3D_FLAT_COLOR, GPU_SHADER_3D_LINE_DASHED_UNIFORM_COLOR)); + ELEM(shader, + GPU_SHADER_3D_FLAT_COLOR, + GPU_SHADER_3D_LINE_DASHED_UNIFORM_COLOR, + GPU_SHADER_INSTANCE_VARIYING_ID_VARIYING_SIZE)); const char *world_clip_lib = datatoc_gpu_shader_cfg_world_clip_lib_glsl; const char *world_clip_def = "#define USE_WORLD_CLIP_PLANES\n"; /* In rare cases geometry shaders calculate clipping themselves. */ diff --git a/source/blender/gpu/shaders/gpu_shader_instance_variying_size_variying_id_vert.glsl b/source/blender/gpu/shaders/gpu_shader_instance_variying_size_variying_id_vert.glsl index edcff5e5d87..130f46e1e33 100644 --- a/source/blender/gpu/shaders/gpu_shader_instance_variying_size_variying_id_vert.glsl +++ b/source/blender/gpu/shaders/gpu_shader_instance_variying_size_variying_id_vert.glsl @@ -1,5 +1,8 @@ uniform mat4 ViewProjectionMatrix; +#ifdef USE_WORLD_CLIP_PLANES +uniform mat4 ModelMatrix; +#endif uniform int baseId; /* ---- Instantiated Attrs ---- */ @@ -18,6 +21,11 @@ flat out uint finalId; void main() { - gl_Position = ViewProjectionMatrix * InstanceModelMatrix * vec4(pos * size, 1.0); + vec4 pos_4d = vec4(pos * size, 1.0); + gl_Position = ViewProjectionMatrix * InstanceModelMatrix * pos_4d; finalId = uint(baseId + callId); + +#ifdef USE_WORLD_CLIP_PLANES + world_clip_planes_calc_clip_distance((ModelMatrix * InstanceModelMatrix * pos_4d).xyz); +#endif } |