worldFragment.fs 635 B

123456789101112131415161718192021222324252627
  1. #version 430
  2. layout (location = 0) out vec3 worldPosition;
  3. layout (location = 1) out vec3 worldNormal;
  4. layout (location = 2) out vec4 worldColor;
  5. layout (location = 3) out float worldShadow;
  6. layout (binding = 0) uniform sampler2D samp;
  7. layout (binding = 1) uniform sampler2D shadowSamp;
  8. uniform mat4 proj;
  9. uniform mat4 view;
  10. uniform mat4 model;
  11. in vec3 varPosition;
  12. in vec2 varTex;
  13. in vec3 varNormal;
  14. in vec4 varShadow;
  15. void main(void)
  16. {
  17. worldPosition = varPosition;
  18. worldNormal = normalize(varNormal);
  19. worldShadow = float(varShadow.z < texture(shadowSamp, varShadow.xy).x);
  20. worldColor = texture(samp, varTex);
  21. }