wireframe.vs 463 B

1234567891011121314151617181920
  1. #version 100
  2. uniform mat4 view_model_matrix;
  3. uniform mat4 projection_matrix;
  4. uniform float offset;
  5. attribute vec3 v_position;
  6. attribute vec3 v_normal;
  7. attribute vec3 v_extra;
  8. varying vec3 barycentric;
  9. void main()
  10. {
  11. barycentric = v_extra;
  12. // Add small epsilon to z to solve z-fighting
  13. vec4 clip_position = projection_matrix * view_model_matrix * vec4(v_position, 1.0);
  14. clip_position.z -= offset * abs(clip_position.w);
  15. gl_Position = clip_position;
  16. }