passCube.fragment.fx 696 B

123456789101112131415161718192021222324252627
  1. // Samplers
  2. varying vec2 vUV;
  3. uniform samplerCube textureSampler;
  4. void main(void)
  5. {
  6. vec2 uv = vUV * 2.0 - 1.0;
  7. #ifdef POSITIVEX
  8. gl_FragColor = textureCube(textureSampler, vec3(1.001, uv.y, uv.x));
  9. #endif
  10. #ifdef NEGATIVEX
  11. gl_FragColor = textureCube(textureSampler, vec3(-1.001, uv.y, uv.x));
  12. #endif
  13. #ifdef POSITIVEY
  14. gl_FragColor = textureCube(textureSampler, vec3(uv.y, 1.001, uv.x));
  15. #endif
  16. #ifdef NEGATIVEY
  17. gl_FragColor = textureCube(textureSampler, vec3(uv.y, -1.001, uv.x));
  18. #endif
  19. #ifdef POSITIVEZ
  20. gl_FragColor = textureCube(textureSampler, vec3(uv, 1.001));
  21. #endif
  22. #ifdef NEGATIVEZ
  23. gl_FragColor = textureCube(textureSampler, vec3(uv, -1.001));
  24. #endif
  25. }