CompositeShader.js 717 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. /**
  2. * @author bhouston / http://clara.io/
  3. *
  4. * Multi-Sample Anti-aliasing shader - for blending together sample buffers
  5. */
  6. THREE.CompositeShader = {
  7. shaderID: "composite",
  8. uniforms: {
  9. "tForeground": { type: "t", value: null },
  10. "scale": { type: "f", value: 1.0 }
  11. },
  12. vertexShader: [
  13. "varying vec2 vUv;",
  14. "void main() {",
  15. "vUv = uv;",
  16. "gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
  17. "}"
  18. ].join( '\n' ),
  19. fragmentShader: [
  20. "varying vec2 vUv;",
  21. "uniform sampler2D tForeground;",
  22. "uniform float scale;",
  23. "void main() {",
  24. "vec4 foreground = texture2D( tForeground, vUv );",
  25. "gl_FragColor = foreground * scale;",
  26. "}"
  27. ].join( '\n' )
  28. };