You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

38 lines
976 B

2 years ago
import { NumberInput, LabelElement } from '../../libs/flow.module.js';
import { BaseNode } from '../core/BaseNode.js';
import { Vector4 } from 'three';
import { UniformNode } from 'three/nodes';
export class Vector4Editor extends BaseNode {
constructor() {
const node = new UniformNode( new Vector4() );
super( 'Vector 4', 4, node, 350 );
const onUpdate = () => {
node.value.x = fieldX.getValue();
node.value.y = fieldY.getValue();
node.value.z = fieldZ.getValue();
node.value.w = fieldW.getValue();
};
const fieldX = new NumberInput().setTagColor( 'red' ).onChange( onUpdate );
const fieldY = new NumberInput().setTagColor( 'green' ).onChange( onUpdate );
const fieldZ = new NumberInput().setTagColor( 'blue' ).onChange( onUpdate );
const fieldW = new NumberInput( 1 ).setTagColor( 'white' ).onChange( onUpdate );
this.add( new LabelElement( 'XYZW' )
.add( fieldX )
.add( fieldY )
.add( fieldZ )
.add( fieldW )
);
}
}