@polygonjs/polygonjs
Version:
node-based WebGL 3D engine https://polygonjs.com
32 lines (31 loc) • 1.15 kB
JavaScript
;
import { TypedSopNode } from "./_Base";
import { TextureCopySopOperation } from "../../operations/sop/TextureCopy";
import { NodeParamsConfig, ParamConfig } from "../utils/params/ParamsConfig";
import { SopType } from "../../poly/registers/nodes/types/Sop";
const DEFAULT = TextureCopySopOperation.DEFAULT_PARAMS;
class TextureCopySopParamsConfig extends NodeParamsConfig {
constructor() {
super(...arguments);
this.textureName = ParamConfig.STRING(DEFAULT.textureName);
}
}
const ParamsConfig = new TextureCopySopParamsConfig();
export class TextureCopySopNode extends TypedSopNode {
constructor() {
super(...arguments);
this.paramsConfig = ParamsConfig;
}
static type() {
return SopType.TEXTURE_COPY;
}
initializeNode() {
this.io.inputs.setCount(2);
this.io.inputs.initInputsClonedState(TextureCopySopOperation.INPUT_CLONED_STATE);
}
async cook(input_contents) {
this._operation = this._operation || new TextureCopySopOperation(this.scene(), this.states, this);
const core_group = await this._operation.cook(input_contents, this.pv);
this.setCoreGroup(core_group);
}
}