CopyShader.js 606 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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:
  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. vec4 texel = texture2D( tDiffuse, vUv );
  30. gl_FragColor = opacity * texel;
  31. }`
  32. };
  33. THREE.CopyShader = CopyShader;
  34. } )();