CopyShader.js 640 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. /**
  2. * @author alteredq / http://alteredqualia.com/
  3. *
  4. * Full-screen textured quad shader
  5. */
  6. THREE.CopyShader = {
  7. uniforms: {
  8. "tDiffuse": { type: "t", value: null },
  9. "opacity": { type: "f", value: 1.0 }
  10. },
  11. vertexShader: [
  12. "varying vec2 vUv;",
  13. "void main() {",
  14. "vUv = uv;",
  15. "gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
  16. "}"
  17. ].join("\n"),
  18. fragmentShader: [
  19. "uniform float opacity;",
  20. "uniform sampler2D tDiffuse;",
  21. "varying vec2 vUv;",
  22. "void main() {",
  23. "vec4 texel = texture2D( tDiffuse, vUv );",
  24. "gl_FragColor = opacity * texel;",
  25. "}"
  26. ].join("\n")
  27. };