CopyShader.js 597 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  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: /* glsl */`
  15. varying vec2 vUv;
  16. void main() {
  17. vUv = uv;
  18. gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
  19. }`,
  20. fragmentShader: /* glsl */`
  21. uniform float opacity;
  22. uniform sampler2D tDiffuse;
  23. varying vec2 vUv;
  24. void main() {
  25. gl_FragColor = texture2D( tDiffuse, vUv );
  26. gl_FragColor.a *= opacity;
  27. }`
  28. };
  29. THREE.CopyShader = CopyShader;
  30. } )();