UNPKG

@polygonjs/polygonjs

Version:

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

39 lines (38 loc) 1.41 kB
"use strict"; import { TypedSopNode } from "./_Base"; import { UvTransformSopOperation } from "../../operations/sop/UvTransform"; import { NodeParamsConfig, ParamConfig } from "../utils/params/ParamsConfig"; import { SopType } from "../../poly/registers/nodes/types/Sop"; const DEFAULT = UvTransformSopOperation.DEFAULT_PARAMS; class UvTransformSopParamsConfig extends NodeParamsConfig { constructor() { super(...arguments); /** @param attribName */ this.attribName = ParamConfig.STRING(DEFAULT.attribName); /** @param translate */ this.t = ParamConfig.VECTOR2(DEFAULT.t.toArray()); /** @param scale */ this.s = ParamConfig.VECTOR2(DEFAULT.s.toArray()); /** @param pivot */ this.pivot = ParamConfig.VECTOR2(DEFAULT.pivot.toArray()); } } const ParamsConfig = new UvTransformSopParamsConfig(); export class UvTransformSopNode extends TypedSopNode { constructor() { super(...arguments); this.paramsConfig = ParamsConfig; } static type() { return SopType.UV_TRANSFORM; } initializeNode() { this.io.inputs.setCount(1); this.io.inputs.initInputsClonedState(UvTransformSopOperation.INPUT_CLONED_STATE); } cook(input_contents) { this._operation = this._operation || new UvTransformSopOperation(this.scene(), this.states, this); const core_group = this._operation.cook(input_contents, this.pv); this.setCoreGroup(core_group); } }