@polygonjs/polygonjs
Version:
node-based WebGL 3D engine https://polygonjs.com
44 lines (43 loc) • 1.63 kB
JavaScript
;
import { TypedSopNode } from "./_Base";
import { NodeContext } from "../../poly/NodeContext";
import { ParticlesSystemGpuMaterialSopOperation } from "../../operations/sop/ParticlesSystemGpuMaterial";
import { NodeParamsConfig, ParamConfig } from "../utils/params/ParamsConfig";
import { SopType } from "../../poly/registers/nodes/types/Sop";
const DEFAULT = ParticlesSystemGpuMaterialSopOperation.DEFAULT_PARAMS;
class ParticlesSystemGpuMaterialSopParamsConfig extends NodeParamsConfig {
constructor() {
super(...arguments);
/** @param group to assign the material to */
this.group = ParamConfig.STRING(DEFAULT.group, {
objectMask: true
});
/** @param the material node */
this.material = ParamConfig.NODE_PATH("", {
nodeSelection: {
context: NodeContext.MAT
},
dependentOnFoundNode: false,
visibleIf: { assignMat: 1 }
});
}
}
const ParamsConfig = new ParticlesSystemGpuMaterialSopParamsConfig();
export class ParticlesSystemGpuMaterialSopNode extends TypedSopNode {
constructor() {
super(...arguments);
this.paramsConfig = ParamsConfig;
}
static type() {
return SopType.PARTICLES_SYSTEM_GPU_MATERIAL;
}
initializeNode() {
this.io.inputs.setCount(1);
this.io.inputs.initInputsClonedState(ParticlesSystemGpuMaterialSopOperation.INPUT_CLONED_STATE);
}
async cook(inputCoreGroups) {
this._operation = this._operation || new ParticlesSystemGpuMaterialSopOperation(this._scene, this.states, this);
const coreGroup = await this._operation.cook(inputCoreGroups, this.pv);
this.setCoreGroup(coreGroup);
}
}