UNPKG

@polygonjs/polygonjs

Version:

node-based WebGL 3D engine https://polygonjs.com

38 lines (37 loc) 1.38 kB
"use strict"; import { TypedSopNode } from "./_Base"; import { IcosahedronSopOperation } from "../../operations/sop/Icosahedron"; import { NodeParamsConfig, ParamConfig } from "../utils/params/ParamsConfig"; import { SopType } from "../../poly/registers/nodes/types/Sop"; const DEFAULT = IcosahedronSopOperation.DEFAULT_PARAMS; class IcosahedronSopParamsConfig extends NodeParamsConfig { constructor() { super(...arguments); /** @param radius of the icosahedron */ this.radius = ParamConfig.FLOAT(DEFAULT.radius); /** @param resolution of the icosahedron */ this.detail = ParamConfig.INTEGER(DEFAULT.detail, { range: [0, 32], rangeLocked: [true, false] }); /** @param do not create polygons, only points. */ this.pointsOnly = ParamConfig.BOOLEAN(DEFAULT.pointsOnly); /** @param center of the icosahedron */ this.center = ParamConfig.VECTOR3(DEFAULT.center); } } const ParamsConfig = new IcosahedronSopParamsConfig(); export class IcosahedronSopNode extends TypedSopNode { constructor() { super(...arguments); this.paramsConfig = ParamsConfig; } static type() { return SopType.ICOSAHEDRON; } cook() { this._operation = this._operation || new IcosahedronSopOperation(this._scene, this.states, this); const core_group = this._operation.cook([], this.pv); this.setCoreGroup(core_group); } }