2
0

CopyShader.js 570 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. /**
  2. * Full-screen textured quad shader
  3. */
  4. THREE.CopyShader = {
  5. uniforms: {
  6. 'tDiffuse': { value: null },
  7. 'opacity': { value: 1.0 }
  8. },
  9. vertexShader: [
  10. 'varying vec2 vUv;',
  11. 'void main() {',
  12. ' vUv = uv;',
  13. ' gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );',
  14. '}'
  15. ].join( '\n' ),
  16. fragmentShader: [
  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. ].join( '\n' )
  25. };