AONode.js 449 B

12345678910111213141516171819202122232425
  1. import LightingNode from './LightingNode.js';
  2. import { float, add, mul, sub } from '../shadernode/ShaderNodeElements.js';
  3. class AONode extends LightingNode {
  4. constructor( aoNode = null ) {
  5. super();
  6. this.aoNode = aoNode;
  7. }
  8. construct( builder ) {
  9. const aoIntensity = 1;
  10. const aoNode = add( mul( sub( float( this.aoNode ), 1.0 ), aoIntensity ), 1.0 );
  11. builder.context.ambientOcclusion.mul( aoNode );
  12. }
  13. }
  14. export default AONode;