Skybox.glsl 604 B

1234567891011121314151617181920212223
  1. #include "Uniforms.glsl"
  2. #include "Samplers.glsl"
  3. #include "Transform.glsl"
  4. varying vec3 vTexCoord;
  5. void VS()
  6. {
  7. mat4 modelMatrix = iModelMatrix;
  8. vec3 worldPos = GetWorldPos(modelMatrix);
  9. gl_Position = GetClipPos(worldPos);
  10. gl_Position.z = gl_Position.w;
  11. vTexCoord = iPos.xyz;
  12. }
  13. void PS()
  14. {
  15. vec4 sky = cMatDiffColor * textureCube(sDiffCubeMap, vTexCoord);
  16. #ifdef HDRSCALE
  17. sky = pow(sky + clamp((cAmbientColor.a - 1.0) * 0.1, 0.0, 0.25), max(vec4(cAmbientColor.a), 1.0)) * clamp(cAmbientColor.a, 0.0, 1.0);
  18. #endif
  19. gl_FragColor = sky;
  20. }