CopyShader.js 790 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. ;(function () {
  2. /**
  3. * Full-screen textured quad shader
  4. */
  5. const CopyShader = {
  6. uniforms: {
  7. tDiffuse: {
  8. value: null,
  9. },
  10. opacity: {
  11. value: 1.0,
  12. },
  13. },
  14. vertexShader:
  15. /* glsl */
  16. `
  17. varying vec2 vUv;
  18. void main() {
  19. vUv = uv;
  20. gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
  21. }`,
  22. fragmentShader:
  23. /* glsl */
  24. `
  25. uniform float opacity;
  26. uniform sampler2D tDiffuse;
  27. varying vec2 vUv;
  28. void main() {
  29. gl_FragColor = texture2D( tDiffuse, vUv );
  30. gl_FragColor.a *= opacity;
  31. }`,
  32. }
  33. THREE.CopyShader = CopyShader
  34. })()