flat_clip.vs 797 B

1234567891011121314151617181920212223
  1. #version 140
  2. uniform mat4 view_model_matrix;
  3. uniform mat4 projection_matrix;
  4. uniform mat4 volume_world_matrix;
  5. // Clipping plane, x = min z, y = max z. Used by the FFF and SLA previews to clip with a top / bottom plane.
  6. uniform vec2 z_range;
  7. // Clipping plane - general orientation. Used by the SLA gizmo.
  8. uniform vec4 clipping_plane;
  9. in vec3 v_position;
  10. out vec3 clipping_planes_dots;
  11. void main()
  12. {
  13. // Fill in the scalars for fragment shader clipping. Fragments with any of these components lower than zero are discarded.
  14. vec4 world_pos = volume_world_matrix * vec4(v_position, 1.0);
  15. clipping_planes_dots = vec3(dot(world_pos, clipping_plane), world_pos.z - z_range.x, z_range.y - world_pos.z);
  16. gl_Position = projection_matrix * view_model_matrix * vec4(v_position, 1.0);
  17. }