@polygonjs/polygonjs
Version:
node-based WebGL 3D engine https://polygonjs.com
50 lines (49 loc) • 1.7 kB
JavaScript
"use strict";
import { JsConnectionPointType } from "../utils/io/connections/Js";
import { TypedJsNode } from "./_Base";
import { NodeParamsConfig } from "../utils/params/ParamsConfig";
class NullJsParamsConfig extends NodeParamsConfig {
}
const ParamsConfig = new NullJsParamsConfig();
export class NullJsNode extends TypedJsNode {
constructor() {
super(...arguments);
this.paramsConfig = ParamsConfig;
}
static type() {
return "null";
}
initializeNode() {
super.initializeNode();
this.io.connection_points.set_expected_input_types_function(this._expectedInputTypes.bind(this));
this.io.connection_points.set_expected_output_types_function(this._expectedOutputTypes.bind(this));
this.io.connection_points.set_input_name_function(this._expectedInputName.bind(this));
this.io.connection_points.set_output_name_function(this._expectedOutputName.bind(this));
}
_expectedInputTypes() {
const firstType = this.io.connection_points.first_input_connection_type() || JsConnectionPointType.FLOAT_ARRAY;
return [firstType];
}
_expectedInputName(index) {
return "in";
}
_expectedOutputName(index) {
return "out";
}
_expectedOutputTypes() {
const firstType = this._expectedInputTypes()[0];
return [firstType];
}
setLines(shadersCollectionController) {
const inputValue = this.variableForInput(shadersCollectionController, this._expectedInputName(0));
const dataType = this._expectedInputTypes()[0];
const varName = this.jsVarName(this._expectedOutputName(0));
shadersCollectionController.addBodyOrComputed(this, [
{
dataType,
varName,
value: inputValue
}
]);
}
}