NormalEditor.js 696 B

123456789101112131415161718192021222324252627282930
  1. import { SelectInput, Element } from '../../libs/flow.module.js';
  2. import { BaseNode } from '../core/BaseNode.js';
  3. import { NormalNode } from 'three/nodes';
  4. export class NormalEditor extends BaseNode {
  5. constructor() {
  6. const node = new NormalNode();
  7. super( 'Normal', 3, node, 200 );
  8. const optionsField = new SelectInput( [
  9. { name: 'Local', value: NormalNode.LOCAL },
  10. { name: 'World', value: NormalNode.WORLD },
  11. { name: 'View', value: NormalNode.VIEW },
  12. { name: 'Geometry', value: NormalNode.GEOMETRY }
  13. ], NormalNode.LOCAL ).onChange( () => {
  14. node.scope = optionsField.getValue();
  15. this.invalidate();
  16. } );
  17. this.add( new Element().add( optionsField ) );
  18. }
  19. }