@polygonjs/polygonjs
Version:
node-based WebGL 3D engine https://polygonjs.com
122 lines (121 loc) • 4.19 kB
JavaScript
;
import { TypedJsNode } from "./_Base";
import { JsConnectionPointType, JsConnectionPoint } from "../utils/io/connections/Js";
import { NodeParamsConfig, ParamConfig } from "../utils/params/ParamsConfig";
import { Poly } from "../../Poly";
class IntToBoolJsParamsConfig extends NodeParamsConfig {
constructor() {
super(...arguments);
this.int = ParamConfig.INTEGER(0);
}
}
const ParamsConfig_IntToBool = new IntToBoolJsParamsConfig();
export class IntToBoolJsNode extends TypedJsNode {
constructor() {
super(...arguments);
this.paramsConfig = ParamsConfig_IntToBool;
}
static type() {
return "intToBool";
}
initializeNode() {
this.io.outputs.setNamedOutputConnectionPoints([
new JsConnectionPoint(JsConnectionPointType.BOOLEAN, JsConnectionPointType.BOOLEAN)
]);
}
setLines(linesController) {
const arg0 = this.variableForInputParam(linesController, this.p.int);
const varName = this.jsVarName(JsConnectionPointType.BOOLEAN);
const func = Poly.namedFunctionsRegister.getFunction("intToBool", this, linesController);
linesController.addBodyOrComputed(this, [
{ dataType: JsConnectionPointType.VECTOR3, varName, value: func.asString(arg0) }
]);
}
}
class BoolToIntJsParamsConfig extends NodeParamsConfig {
constructor() {
super(...arguments);
this.bool = ParamConfig.BOOLEAN(0);
}
}
const ParamsConfig_BoolToInt = new BoolToIntJsParamsConfig();
export class BoolToIntJsNode extends TypedJsNode {
constructor() {
super(...arguments);
this.paramsConfig = ParamsConfig_BoolToInt;
}
static type() {
return "boolToInt";
}
initializeNode() {
this.io.outputs.setNamedOutputConnectionPoints([
new JsConnectionPoint(JsConnectionPointType.INT, JsConnectionPointType.INT)
]);
}
setLines(linesController) {
const arg0 = this.variableForInputParam(linesController, this.p.bool);
const varName = this.jsVarName(JsConnectionPointType.INT);
const func = Poly.namedFunctionsRegister.getFunction("boolToInt", this, linesController);
linesController.addBodyOrComputed(this, [
{ dataType: JsConnectionPointType.VECTOR3, varName, value: func.asString(arg0) }
]);
}
}
class IntToFloatJsParamsConfig extends NodeParamsConfig {
constructor() {
super(...arguments);
this.int = ParamConfig.INTEGER(0);
}
}
const ParamsConfig_IntToFloat = new IntToFloatJsParamsConfig();
export class IntToFloatJsNode extends TypedJsNode {
constructor() {
super(...arguments);
this.paramsConfig = ParamsConfig_IntToFloat;
}
static type() {
return "intToFloat";
}
initializeNode() {
this.io.outputs.setNamedOutputConnectionPoints([
new JsConnectionPoint(JsConnectionPointType.FLOAT, JsConnectionPointType.FLOAT)
]);
}
setLines(linesController) {
const arg0 = this.variableForInputParam(linesController, this.p.int);
const varName = this.jsVarName(JsConnectionPointType.FLOAT);
const func = Poly.namedFunctionsRegister.getFunction("intToFloat", this, linesController);
linesController.addBodyOrComputed(this, [
{ dataType: JsConnectionPointType.VECTOR3, varName, value: func.asString(arg0) }
]);
}
}
class FloatToIntJsParamsConfig extends NodeParamsConfig {
constructor() {
super(...arguments);
this.float = ParamConfig.FLOAT(0);
}
}
const ParamsConfig_FloatToInt = new FloatToIntJsParamsConfig();
export class FloatToIntJsNode extends TypedJsNode {
constructor() {
super(...arguments);
this.paramsConfig = ParamsConfig_FloatToInt;
}
static type() {
return "floatToInt";
}
initializeNode() {
this.io.outputs.setNamedOutputConnectionPoints([
new JsConnectionPoint(JsConnectionPointType.INT, JsConnectionPointType.INT)
]);
}
setLines(linesController) {
const arg0 = this.variableForInputParam(linesController, this.p.float);
const varName = this.jsVarName(JsConnectionPointType.INT);
const func = Poly.namedFunctionsRegister.getFunction("floatToInt", this, linesController);
linesController.addBodyOrComputed(this, [
{ dataType: JsConnectionPointType.VECTOR3, varName, value: func.asString(arg0) }
]);
}
}