@polygonjs/polygonjs
Version:
node-based WebGL 3D engine https://polygonjs.com
44 lines (43 loc) • 1.69 kB
JavaScript
;
import { BaseTriggerAndObjectJsNode } from "./_BaseTriggerAndObject";
import { Poly } from "../../Poly";
import { NodeParamsConfig, ParamConfig } from "../utils/params/ParamsConfig";
import { inputObject3D } from "./_BaseObject3D";
import { JsType } from "../../poly/registers/nodes/types/Js";
class SetSoftBodyConstraintPositionJsParamsConfig extends NodeParamsConfig {
constructor() {
super(...arguments);
this.id = ParamConfig.INTEGER(0, {
range: [-1, 100],
rangeLocked: [true, false]
});
this.position = ParamConfig.VECTOR3([0, 0, 0]);
this.lerp = ParamConfig.FLOAT(1, {
range: [0, 1],
rangeLocked: [true, true]
});
}
}
const ParamsConfig = new SetSoftBodyConstraintPositionJsParamsConfig();
export class SetSoftBodyConstraintPositionJsNode extends BaseTriggerAndObjectJsNode {
constructor() {
super(...arguments);
this.paramsConfig = ParamsConfig;
}
static type() {
return JsType.SET_SOFT_BODY_CONSTRAINT_POSITION;
}
setTriggerableLines(shadersCollectionController) {
const object3D = inputObject3D(this, shadersCollectionController);
const id = this.variableForInputParam(shadersCollectionController, this.p.id);
const position = this.variableForInputParam(shadersCollectionController, this.p.position);
const lerp = this.variableForInputParam(shadersCollectionController, this.p.lerp);
const func = Poly.namedFunctionsRegister.getFunction(
"softBodyConstraintSetPosition",
this,
shadersCollectionController
);
const bodyLine = func.asString(object3D, id, position, lerp);
shadersCollectionController.addTriggerableLines(this, [bodyLine]);
}
}