UNPKG

@polygonjs/polygonjs

Version:

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

40 lines (39 loc) 1.24 kB
"use strict"; import { TypedJsNode } from "./_Base"; import { NodeParamsConfig, ParamConfig } from "../utils/params/ParamsConfig"; import { JsConnectionPoint, JsConnectionPointType } from "../utils/io/connections/Js"; const OUTPUT_NAME = JsConnectionPointType.VECTOR3; class Vector4JsParamsConfig extends NodeParamsConfig { constructor() { super(...arguments); /** @param vector value */ this.Vector4 = ParamConfig.VECTOR4([0, 0, 0, 0]); } } const ParamsConfig = new Vector4JsParamsConfig(); export class Vector4JsNode extends TypedJsNode { constructor() { super(...arguments); this.paramsConfig = ParamsConfig; } static type() { return "vector4"; } initializeNode() { super.initializeNode(); this.io.outputs.setNamedOutputConnectionPoints([ new JsConnectionPoint(OUTPUT_NAME, JsConnectionPointType.VECTOR4) ]); } setLines(shadersCollectionController) { const inputValue = this.variableForInputParam(shadersCollectionController, this.p.Vector4); const varName = this.jsVarName(OUTPUT_NAME); shadersCollectionController.addBodyOrComputed(this, [ { dataType: JsConnectionPointType.VECTOR4, varName, value: inputValue } ]); } }