polygonjs-engine
Version:
node-based webgl 3D engine https://polygonjs.com
37 lines (36 loc) • 1.32 kB
JavaScript
import {TypedSopNode} from "./_Base";
import {TorusSopOperation} from "../../../core/operations/sop/Torus";
import {NodeParamsConfig, ParamConfig} from "../utils/params/ParamsConfig";
const DEFAULT = TorusSopOperation.DEFAULT_PARAMS;
class TorusSopParamsConfig extends NodeParamsConfig {
constructor() {
super(...arguments);
this.radius = ParamConfig.FLOAT(DEFAULT.radius, {range: [0, 1]});
this.radiusTube = ParamConfig.FLOAT(DEFAULT.radiusTube, {range: [0, 1]});
this.segmentsRadial = ParamConfig.INTEGER(DEFAULT.segmentsRadial, {
range: [1, 50],
rangeLocked: [true, false]
});
this.segmentsTube = ParamConfig.INTEGER(DEFAULT.segmentsTube, {
range: [1, 50],
rangeLocked: [true, false]
});
this.direction = ParamConfig.VECTOR3(DEFAULT.direction);
this.center = ParamConfig.VECTOR3(DEFAULT.center);
}
}
const ParamsConfig2 = new TorusSopParamsConfig();
export class TorusSopNode extends TypedSopNode {
constructor() {
super(...arguments);
this.params_config = ParamsConfig2;
}
static type() {
return "torus";
}
cook(input_contents) {
this._operation = this._operation || new TorusSopOperation(this.scene(), this.states);
const core_group = this._operation.cook(input_contents, this.pv);
this.setCoreGroup(core_group);
}
}