@polygonjs/polygonjs
Version:
node-based WebGL 3D engine https://polygonjs.com
39 lines (38 loc) • 1.34 kB
JavaScript
;
import { TypedSopNode } from "./_Base";
import { DecalSopOperation } from "../../operations/sop/Decal";
import { NodeParamsConfig, ParamConfig } from "../utils/params/ParamsConfig";
import { SopType } from "../../poly/registers/nodes/types/Sop";
const DEFAULT = DecalSopOperation.DEFAULT_PARAMS;
class DecalSopParamsConfig extends NodeParamsConfig {
constructor() {
super(...arguments);
/** @param decal position */
this.t = ParamConfig.VECTOR3(DEFAULT.t);
/** @param decal rotation */
this.r = ParamConfig.VECTOR3(DEFAULT.r);
/** @param decal scale */
this.s = ParamConfig.VECTOR3(DEFAULT.s);
/** @param decal scale multipler */
this.scale = ParamConfig.FLOAT(DEFAULT.scale);
}
}
const ParamsConfig = new DecalSopParamsConfig();
export class DecalSopNode extends TypedSopNode {
constructor() {
super(...arguments);
this.paramsConfig = ParamsConfig;
}
static type() {
return SopType.DECAL;
}
initializeNode() {
this.io.inputs.setCount(0, 1);
this.io.inputs.initInputsClonedState(DecalSopOperation.INPUT_CLONED_STATE);
}
cook(input_contents) {
this._operation = this._operation || new DecalSopOperation(this._scene, this.states, this);
const core_group = this._operation.cook(input_contents, this.pv);
this.setCoreGroup(core_group);
}
}