fs_texture_cube.sc 563 B

1234567891011121314151617181920212223
  1. $input v_texcoord0, v_color0
  2. /*
  3. * Copyright 2011-2019 Branimir Karadzic. All rights reserved.
  4. * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause
  5. */
  6. #include "common.sh"
  7. SAMPLERCUBE(s_texColor, 0);
  8. uniform mat4 u_mtx;
  9. void main()
  10. {
  11. vec3 dir = vec3( (v_texcoord0.xy*2.0 - 1.0) * vec2(1.0, -1.0), 1.0);
  12. dir = normalize(mul(u_mtx, vec4(dir, 0.0) ).xyz);
  13. vec4 color = textureCubeLod(s_texColor, dir, u_textureLod);
  14. color.xyz = applyExposure(color.xyz);
  15. color *= v_color0;
  16. gl_FragColor = toOutput(color, u_outputFormat, u_sdrWhiteNits);
  17. }