diff options
author | Campbell Barton <ideasman42@gmail.com> | 2019-01-26 07:00:03 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2019-01-26 07:49:14 +0300 |
commit | 77b66a96663c8e995160cc07287ccfea0e1a2b9b (patch) | |
tree | 5fb1d18486bb975e97e8814f79b2af0917eda1e9 /source/blender/gpu | |
parent | 9b40da94a3e354265c692579f47a8f294e3b8196 (diff) |
DRW: support clipping for empty object
Diffstat (limited to 'source/blender/gpu')
-rw-r--r-- | source/blender/gpu/shaders/gpu_shader_instance_camera_vert.glsl | 2 | ||||
-rw-r--r-- | source/blender/gpu/shaders/gpu_shader_instance_variying_size_variying_color_vert.glsl | 9 |
2 files changed, 9 insertions, 2 deletions
diff --git a/source/blender/gpu/shaders/gpu_shader_instance_camera_vert.glsl b/source/blender/gpu/shaders/gpu_shader_instance_camera_vert.glsl index 07328385838..9a7815cc9d7 100644 --- a/source/blender/gpu/shaders/gpu_shader_instance_camera_vert.glsl +++ b/source/blender/gpu/shaders/gpu_shader_instance_camera_vert.glsl @@ -52,6 +52,6 @@ void main() finalColor = vec4(color, 1.0); #ifdef USE_WORLD_CLIP_PLANES - world_clip_planes_calc_clip_distance((ModelMatrix * InstanceModelMatrix * vec4(pPos, 1.0)).xyz); + world_clip_planes_calc_clip_distance((ModelMatrix * InstanceModelMatrix * vec4(pPos, 1.0)).xyz); #endif } diff --git a/source/blender/gpu/shaders/gpu_shader_instance_variying_size_variying_color_vert.glsl b/source/blender/gpu/shaders/gpu_shader_instance_variying_size_variying_color_vert.glsl index 0d0413fef94..fed00389fc1 100644 --- a/source/blender/gpu/shaders/gpu_shader_instance_variying_size_variying_color_vert.glsl +++ b/source/blender/gpu/shaders/gpu_shader_instance_variying_size_variying_color_vert.glsl @@ -1,5 +1,6 @@ uniform mat4 ViewProjectionMatrix; +uniform mat4 ModelMatrix; /* ---- Instantiated Attribs ---- */ in vec3 pos; @@ -17,6 +18,12 @@ flat out vec4 finalColor; void main() { - gl_Position = ViewProjectionMatrix * InstanceModelMatrix * vec4(pos * size, 1.0); finalColor = color; + + vec4 pos_4d = vec4(pos * size, 1.0); + gl_Position = ViewProjectionMatrix * InstanceModelMatrix * pos_4d; + +#ifdef USE_WORLD_CLIP_PLANES + world_clip_planes_calc_clip_distance((ModelMatrix * InstanceModelMatrix * pos_4d).xyz); +#endif } |