FXAAPass.js 738 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. import { FXAAShader } from '../shaders/FXAAShader.js';
  2. import { ShaderPass } from './ShaderPass.js';
  3. /**
  4. * A pass for applying FXAA.
  5. *
  6. * ```js
  7. * const fxaaPass = new FXAAPass();
  8. * composer.addPass( fxaaPass );
  9. * ```
  10. *
  11. * @augments ShaderPass
  12. * @three_import import { FXAAPass } from 'three/addons/postprocessing/FXAAPass.js';
  13. */
  14. class FXAAPass extends ShaderPass {
  15. /**
  16. * Constructs a new FXAA pass.
  17. */
  18. constructor() {
  19. super( FXAAShader );
  20. }
  21. /**
  22. * Sets the size of the pass.
  23. *
  24. * @param {number} width - The width to set.
  25. * @param {number} height - The height to set.
  26. */
  27. setSize( width, height ) {
  28. this.material.uniforms[ 'resolution' ].value.set( 1 / width, 1 / height );
  29. }
  30. }
  31. export { FXAAPass };
粤ICP备19079148号