depth_cube.frag 759 B

12345678910111213141516171819202122232425262728293031323334
  1. /* depth_cube.frag -- Fragment shader used for omni-lights shadow mapping
  2. *
  3. * Copyright (c) 2025-2026 Le Juez Victor
  4. *
  5. * This software is provided 'as-is', without any express or implied warranty.
  6. * For conditions of distribution and use, see accompanying LICENSE file.
  7. */
  8. #version 330 core
  9. /* === Varyings === */
  10. smooth in vec3 vPosition;
  11. smooth in vec2 vTexCoord;
  12. smooth in vec4 vColor;
  13. /* === Uniforms === */
  14. uniform sampler2D uAlbedoMap;
  15. uniform float uAlphaCutoff;
  16. uniform vec3 uViewPosition;
  17. uniform float uFar;
  18. /* === User override === */
  19. #include "../include/user/scene.frag"
  20. /* === Main function === */
  21. void main()
  22. {
  23. SceneFragment(vTexCoord, mat3(1.0), uAlphaCutoff);
  24. gl_FragDepth = length(vPosition - uViewPosition) / uFar;
  25. }