lodCube.ts 961 B

1234567891011121314151617181920212223242526272829303132333435
  1. import { Effect } from "babylonjs/Materials/effect";
  2. let name = 'lodCubePixelShader';
  3. let shader = `
  4. precision highp float;
  5. varying vec2 vUV;
  6. uniform samplerCube textureSampler;
  7. uniform float lod;
  8. void main(void)
  9. {
  10. vec2 uv=vUV*2.0-1.0;
  11. #ifdef POSITIVEX
  12. gl_FragColor=textureCube(textureSampler,vec3(1.001,uv.y,uv.x),lod);
  13. #endif
  14. #ifdef NEGATIVEX
  15. gl_FragColor=textureCube(textureSampler,vec3(-1.001,uv.y,uv.x),lod);
  16. #endif
  17. #ifdef POSITIVEY
  18. gl_FragColor=textureCube(textureSampler,vec3(uv.y,1.001,uv.x),lod);
  19. #endif
  20. #ifdef NEGATIVEY
  21. gl_FragColor=textureCube(textureSampler,vec3(uv.y,-1.001,uv.x),lod);
  22. #endif
  23. #ifdef POSITIVEZ
  24. gl_FragColor=textureCube(textureSampler,vec3(uv,1.001),lod);
  25. #endif
  26. #ifdef NEGATIVEZ
  27. gl_FragColor=textureCube(textureSampler,vec3(uv,-1.001),lod);
  28. #endif
  29. }`;
  30. Effect.ShadersStore[name] = shader;
  31. /** @hidden */
  32. export var lodCubePixelShader = { name, shader };