FogRangeNode.js 515 B

123456789101112131415161718192021222324252627
  1. import FogNode from './FogNode.js';
  2. import { smoothstep, negate, positionView } from '../shadernode/ShaderNodeBaseElements.js';
  3. class FogRangeNode extends FogNode {
  4. constructor( colorNode, nearNode, farNode ) {
  5. super( colorNode );
  6. this.isFogRangeNode = true;
  7. this.nearNode = nearNode;
  8. this.farNode = farNode;
  9. }
  10. generate( builder ) {
  11. this.factorNode = smoothstep( this.nearNode, this.farNode, negate( positionView.z ) );
  12. return super.generate( builder );
  13. }
  14. }
  15. export default FogRangeNode;