depth.lua 402 B

1234567891011121314151617
  1. return function()
  2. return lovr.graphics.newShader([[
  3. out float depth;
  4. vec4 position(mat4 projection, mat4 transform, vec4 vertex) {
  5. vec4 result = projection * transform * vertex;
  6. depth = result.z / result.w;
  7. return result;
  8. }
  9. ]], [[
  10. in float depth;
  11. vec4 color(vec4 graphicsColor, sampler2D image, vec2 uv) {
  12. return vec4(vec3(depth), 1.);
  13. }
  14. ]])
  15. end