mm_gouraud.vs 914 B

123456789101112131415161718192021222324252627282930
  1. #version 110
  2. const vec3 ZERO = vec3(0.0, 0.0, 0.0);
  3. uniform mat4 volume_world_matrix;
  4. // Clipping plane, x = min z, y = max z. Used by the FFF and SLA previews to clip with a top / bottom plane.
  5. uniform vec2 z_range;
  6. // Clipping plane - general orientation. Used by the SLA gizmo.
  7. uniform vec4 clipping_plane;
  8. varying vec3 clipping_planes_dots;
  9. varying vec4 model_pos;
  10. struct SlopeDetection
  11. {
  12. bool actived;
  13. float normal_z;
  14. mat3 volume_world_normal_matrix;
  15. };
  16. uniform SlopeDetection slope;
  17. void main()
  18. {
  19. model_pos = gl_Vertex;
  20. // Point in homogenous coordinates.
  21. vec4 world_pos = volume_world_matrix * gl_Vertex;
  22. gl_Position = ftransform();
  23. // Fill in the scalars for fragment shader clipping. Fragments with any of these components lower than zero are discarded.
  24. clipping_planes_dots = vec3(dot(world_pos, clipping_plane), world_pos.z - z_range.x, z_range.y - world_pos.z);
  25. }