@polygonjs/polygonjs
Version:
node-based WebGL 3D engine https://polygonjs.com
36 lines (35 loc) • 1.23 kB
JavaScript
;
import { TypedSopNode } from "./_Base";
import { MeasureSopOperation } from "../../operations/sop/Measure";
import { NodeParamsConfig, ParamConfig } from "../utils/params/ParamsConfig";
import { SopType } from "../../poly/registers/nodes/types/Sop";
const DEFAULT = MeasureSopOperation.DEFAULT_PARAMS;
class MeasureSopParamConfig extends NodeParamsConfig {
constructor() {
super(...arguments);
/** @param group to assign the material to */
this.group = ParamConfig.STRING(DEFAULT.group, {
objectMask: true
});
this.attribName = ParamConfig.STRING(DEFAULT.attribName);
}
}
const ParamsConfig = new MeasureSopParamConfig();
export class MeasureSopNode extends TypedSopNode {
constructor() {
super(...arguments);
this.paramsConfig = ParamsConfig;
}
static type() {
return SopType.MEASURE;
}
initializeNode() {
this.io.inputs.setCount(1);
this.io.inputs.initInputsClonedState(MeasureSopOperation.INPUT_CLONED_STATE);
}
cook(inputCoreGroups) {
this._operation = this._operation || new MeasureSopOperation(this.scene(), this.states, this);
const coreGroup = this._operation.cook(inputCoreGroups, this.pv);
this.setCoreGroup(coreGroup);
}
}