@polygonjs/polygonjs
Version:
node-based WebGL 3D engine https://polygonjs.com
40 lines (39 loc) • 1.24 kB
JavaScript
;
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 Vector3JsParamsConfig extends NodeParamsConfig {
constructor() {
super(...arguments);
/** @param vector value */
this.Vector3 = ParamConfig.VECTOR3([0, 0, 0]);
}
}
const ParamsConfig = new Vector3JsParamsConfig();
export class Vector3JsNode extends TypedJsNode {
constructor() {
super(...arguments);
this.paramsConfig = ParamsConfig;
}
static type() {
return "vector3";
}
initializeNode() {
super.initializeNode();
this.io.outputs.setNamedOutputConnectionPoints([
new JsConnectionPoint(OUTPUT_NAME, JsConnectionPointType.VECTOR3)
]);
}
setLines(shadersCollectionController) {
const inputValue = this.variableForInputParam(shadersCollectionController, this.p.Vector3);
const varName = this.jsVarName(OUTPUT_NAME);
shadersCollectionController.addBodyOrComputed(this, [
{
dataType: JsConnectionPointType.VECTOR3,
varName,
value: inputValue
}
]);
}
}