2
0

CopyShader.js 571 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. /**
  2. * Full-screen textured quad shader
  3. */
  4. const CopyShader = {
  5. name: 'CopyShader',
  6. uniforms: {
  7. 'tDiffuse': { value: null },
  8. 'opacity': { value: 1.0 }
  9. },
  10. vertexShader: /* glsl */`
  11. varying vec2 vUv;
  12. void main() {
  13. vUv = uv;
  14. gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
  15. }`,
  16. fragmentShader: /* glsl */`
  17. uniform float opacity;
  18. uniform sampler2D tDiffuse;
  19. varying vec2 vUv;
  20. void main() {
  21. vec4 texel = texture2D( tDiffuse, vUv );
  22. gl_FragColor = opacity * texel;
  23. }`
  24. };
  25. export { CopyShader };