diff options
Diffstat (limited to 'source/blender/gpu/shaders/gpu_shader_instance_screen_aligned_vert.glsl')
-rw-r--r-- | source/blender/gpu/shaders/gpu_shader_instance_screen_aligned_vert.glsl | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/source/blender/gpu/shaders/gpu_shader_instance_screen_aligned_vert.glsl b/source/blender/gpu/shaders/gpu_shader_instance_screen_aligned_vert.glsl index 429b648ca53..f4f5b269b96 100644 --- a/source/blender/gpu/shaders/gpu_shader_instance_screen_aligned_vert.glsl +++ b/source/blender/gpu/shaders/gpu_shader_instance_screen_aligned_vert.glsl @@ -1,5 +1,8 @@ uniform mat4 ViewProjectionMatrix; +#ifdef USE_WORLD_CLIP_PLANES +uniform mat4 ModelMatrix; +#endif uniform vec3 screen_vecs[2]; /* ---- Instantiated Attribs ---- */ @@ -27,6 +30,11 @@ void main() #endif vec3 screen_pos = screen_vecs[0].xyz * pos.x + screen_vecs[1].xyz * pos.y; - gl_Position = ViewProjectionMatrix * (InstanceModelMatrix * vec4(offset, 1.0) + vec4(screen_pos * size, 0.0)); + vec4 pos_4d = InstanceModelMatrix * vec4(offset, 1.0) + vec4(screen_pos * size, 0.0); + gl_Position = ViewProjectionMatrix * pos_4d; finalColor = vec4(color, 1.0); + +#ifdef USE_WORLD_CLIP_PLANES + world_clip_planes_calc_clip_distance((ModelMatrix * pos_4d).xyz); +#endif } |