NormalizeEditor.js 563 B

123456789101112131415161718192021222324252627
  1. import { LabelElement } from '../../libs/flow.module.js';
  2. import { BaseNode } from '../core/BaseNode.js';
  3. import { MathNode, Vector3Node } from 'three-nodes/Nodes.js';
  4. const DEFAULT_VALUE = new Vector3Node();
  5. export class NormalizeEditor extends BaseNode {
  6. constructor() {
  7. const node = new MathNode( MathNode.NORMALIZE, DEFAULT_VALUE );
  8. super( 'Normalize', 3, node, 175 );
  9. const input = new LabelElement( 'A' ).setInput( 3 );
  10. input.onConnect( () => {
  11. node.aNode = input.getLinkedObject() || DEFAULT_VALUE;
  12. } );
  13. this.add( input );
  14. }
  15. }