@polygonjs/polygonjs
Version:
node-based WebGL 3D engine https://polygonjs.com
45 lines (44 loc) • 1.56 kB
JavaScript
;
import { TypedSopNode } from "./_Base";
import { BVHVisualizerSopOperation } from "../../operations/sop/BVHVisualizer";
import { NodeParamsConfig, ParamConfig } from "../utils/params/ParamsConfig";
import { SopType } from "../../poly/registers/nodes/types/Sop";
const DEFAULT = BVHVisualizerSopOperation.DEFAULT_PARAMS;
class BVHVisualizerSopParamsConfig extends NodeParamsConfig {
constructor() {
super(...arguments);
/** @param depth */
this.depth = ParamConfig.INTEGER(DEFAULT.depth, {
range: [0, 128],
rangeLocked: [true, false]
});
/** @param opacity */
this.opacity = ParamConfig.FLOAT(DEFAULT.opacity, {
range: [0, 1],
rangeLocked: [true, true]
});
/** @param depth */
this.displayEdges = ParamConfig.BOOLEAN(DEFAULT.displayEdges);
/** @param depth */
this.displayParents = ParamConfig.BOOLEAN(DEFAULT.displayParents);
}
}
const ParamsConfig = new BVHVisualizerSopParamsConfig();
export class BVHVisualizerSopNode extends TypedSopNode {
constructor() {
super(...arguments);
this.paramsConfig = ParamsConfig;
}
static type() {
return SopType.BVH_VISUALIZER;
}
initializeNode() {
this.io.inputs.setCount(1);
this.io.inputs.initInputsClonedState(BVHVisualizerSopOperation.INPUT_CLONED_STATE);
}
cook(input_contents) {
this._operation = this._operation || new BVHVisualizerSopOperation(this._scene, this.states, this);
const core_group = this._operation.cook(input_contents, this.pv);
this.setCoreGroup(core_group);
}
}