CopyShader.js 604 B

123456789101112131415161718192021
  1. ( function () {
  2. /**
  3. * Full-screen textured quad shader
  4. */
  5. var CopyShader = {
  6. uniforms: {
  7. 'tDiffuse': {
  8. value: null
  9. },
  10. 'opacity': {
  11. value: 1.0
  12. }
  13. },
  14. vertexShader: [ 'varying vec2 vUv;', 'void main() {', ' vUv = uv;', ' gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );', '}' ].join( '\n' ),
  15. fragmentShader: [ 'uniform float opacity;', 'uniform sampler2D tDiffuse;', 'varying vec2 vUv;', 'void main() {', ' vec4 texel = texture2D( tDiffuse, vUv );', ' gl_FragColor = opacity * texel;', '}' ].join( '\n' )
  16. };
  17. THREE.CopyShader = CopyShader;
  18. } )();