import * as React from "react"; import { Nullable } from 'babylonjs/types'; import { Vector2, Vector3, Vector4, Matrix } from 'babylonjs/Maths/math'; import { DefaultNodeModel } from '../defaultNodeModel'; import { DiagramModel } from 'storm-react-diagrams/dist/@types/src/models/DiagramModel'; import { GraphEditor, NodeCreationOptions } from '../../../graphEditor'; import { GlobalState } from '../../../globalState'; import { TextLineComponent } from '../../../sharedComponents/textLineComponent'; import { LineContainerComponent } from '../../../sharedComponents/lineContainerComponent'; import { TextInputLineComponent } from '../../../sharedComponents/textInputLineComponent'; import { CheckBoxLineComponent } from '../../../sharedComponents/checkBoxLineComponent'; import { TransformBlock } from 'babylonjs/Materials/Node/Blocks/transformBlock'; /** * Generic node model which stores information about a node editor block */ export class GenericNodeModel extends DefaultNodeModel { /** * Vector2 for the node if it exists */ public vector2: Nullable = null; /** * Vector3 for the node if it exists */ public vector3: Nullable = null; /** * Vector4 for the node if it exists */ public vector4: Nullable = null; /** * Matrix for the node if it exists */ public matrix: Nullable = null; /** * Constructs the node model */ constructor() { super("generic"); } prepare(options: NodeCreationOptions, nodes: Array, model: DiagramModel, graphEditor: GraphEditor) { super.prepare(options, nodes, model, graphEditor); } renderProperties(globalState: GlobalState) { return (
globalState.onUpdateRequiredObservable.notifyObservers()} /> { this.block!.getClassName() === "TransformBlock" && { let transformBlock = this.block as TransformBlock; if (value) { transformBlock.complementW = 0; } else { transformBlock.complementW = 1; } globalState.onRebuildRequiredObservable.notifyObservers(); }} isSelected={() => (this.block as TransformBlock).complementW === 0} /> } { this.block!.getClassName() === "PerturbNormalBlock" && globalState.onRebuildRequiredObservable.notifyObservers()} /> globalState.onRebuildRequiredObservable.notifyObservers()}/> }
); } }