FogNode.js 619 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. import Node, { addNodeClass } from '../core/Node.js';
  2. import { mix } from '../math/MathNode.js';
  3. import { addNodeElement, nodeProxy } from '../shadernode/ShaderNode.js';
  4. class FogNode extends Node {
  5. constructor( colorNode, factorNode ) {
  6. super( 'float' );
  7. this.isFogNode = true;
  8. this.colorNode = colorNode;
  9. this.factorNode = factorNode;
  10. }
  11. mixAssign( outputNode ) {
  12. return mix( outputNode, this.colorNode, this );
  13. }
  14. setup() {
  15. return this.factorNode;
  16. }
  17. }
  18. export default FogNode;
  19. export const fog = nodeProxy( FogNode );
  20. addNodeElement( 'fog', fog );
  21. addNodeClass( 'FogNode', FogNode );