polygonjs-engine
Version:
node-based webgl 3D engine https://polygonjs.com
32 lines (31 loc) • 1.01 kB
JavaScript
import {TypedSopNode} from "./_Base";
import {NodeParamsConfig, ParamConfig} from "../utils/params/ParamsConfig";
import {SubdivideSopOperation} from "../../../core/operations/sop/Subdivide";
const DEFAULT = SubdivideSopOperation.DEFAULT_PARAMS;
class SubdivideSopParamsConfig extends NodeParamsConfig {
constructor() {
super(...arguments);
this.subdivisions = ParamConfig.INTEGER(DEFAULT.subdivisions, {
range: [0, 5],
rangeLocked: [true, false]
});
}
}
const ParamsConfig2 = new SubdivideSopParamsConfig();
export class SubdivideSopNode extends TypedSopNode {
constructor() {
super(...arguments);
this.params_config = ParamsConfig2;
}
static type() {
return "subdivide";
}
initializeNode() {
this.io.inputs.setCount(1);
}
cook(input_contents) {
this._operation = this._operation || new SubdivideSopOperation(this.scene(), this.states);
const core_group = this._operation.cook(input_contents, this.pv);
this.setCoreGroup(core_group);
}
}