UNPKG

@polygonjs/polygonjs

Version:

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

38 lines (37 loc) 1.41 kB
"use strict"; import { BaseTriggerAndObjectJsNode } from "./_BaseTriggerAndObject"; import { Poly } from "../../Poly"; import { NodeParamsConfig, ParamConfig } from "../utils/params/ParamsConfig"; import { inputObject3D } from "./_BaseObject3D"; class SetClothConstraintPositionJsParamsConfig extends NodeParamsConfig { constructor() { super(...arguments); this.position = ParamConfig.VECTOR3([0, 0, 0]); this.lerp = ParamConfig.FLOAT(1, { range: [0, 1], rangeLocked: [true, true] }); } } const ParamsConfig = new SetClothConstraintPositionJsParamsConfig(); export class SetClothConstraintPositionJsNode extends BaseTriggerAndObjectJsNode { constructor() { super(...arguments); this.paramsConfig = ParamsConfig; } static type() { return "setClothConstraintPosition"; } setTriggerableLines(shadersCollectionController) { const object3D = inputObject3D(this, shadersCollectionController); const position = this.variableForInputParam(shadersCollectionController, this.p.position); const lerp = this.variableForInputParam(shadersCollectionController, this.p.lerp); const func = Poly.namedFunctionsRegister.getFunction( "clothConstraintSetPosition", this, shadersCollectionController ); const bodyLine = func.asString(object3D, position, lerp); shadersCollectionController.addTriggerableLines(this, [bodyLine]); } }