@polygonjs/polygonjs
Version:
node-based WebGL 3D engine https://polygonjs.com
53 lines (52 loc) • 1.72 kB
JavaScript
;
import { SubnetSopNodeLike } from "./utils/subnet/SopSubnetChildrenDisplayController";
import { InputCloneMode } from "../../poly/InputCloneMode";
import { NodeParamsConfig, ParamConfig } from "../utils/params/ParamsConfig";
import { NetworkNodeType } from "../../poly/NodeContext";
export const DECOMPOSE_EVENT_TYPE = "decompose";
const DECOMPOSE_EVENT = { type: DECOMPOSE_EVENT_TYPE };
class DecomposeSopParamsConfig extends NodeParamsConfig {
constructor() {
super(...arguments);
/** @param decompose the input object */
this.decompose = ParamConfig.BUTTON(null, {
callback: (node) => {
DecomposeSopNode.PARAM_CALLBACK_decompose(node);
}
});
}
// /** @param toggle if you want to use an environment map */
// useEnvMap = ParamConfig.BOOLEAN(0, {
// separatorBefore: true,
// });
// /** @param specify the environment map COP node */
// envMap = ParamConfig.NODE_PATH('', {
// visibleIf: {useEnvMap: 1},
// nodeSelection: {context: NodeContext.COP},
// cook: false,
// });
// /** @param environment intensity */
// envMapIntensity = ParamConfig.FLOAT(1, {
// visibleIf: {useEnvMap: 1},
// });
}
const ParamsConfig = new DecomposeSopParamsConfig();
export class DecomposeSopNode extends SubnetSopNodeLike {
constructor() {
super(...arguments);
this.paramsConfig = ParamsConfig;
}
static type() {
return NetworkNodeType.DECOMPOSE;
}
initializeNode() {
this.io.inputs.setCount(1);
this.io.inputs.initInputsClonedState(InputCloneMode.ALWAYS);
}
static PARAM_CALLBACK_decompose(node) {
node._paramCallbackDecompose();
}
_paramCallbackDecompose() {
this.dispatchEvent(DECOMPOSE_EVENT);
}
}