mm_contour.vs 402 B

123456789101112131415
  1. #version 140
  2. uniform mat4 view_model_matrix;
  3. uniform mat4 projection_matrix;
  4. uniform float offset;
  5. in vec3 v_position;
  6. void main()
  7. {
  8. // Add small epsilon to z to solve z-fighting between painted triangles and contour lines.
  9. vec4 clip_position = projection_matrix * view_model_matrix * vec4(v_position, 1.0);
  10. clip_position.z -= offset * abs(clip_position.w);
  11. gl_Position = clip_position;
  12. }