polygonjs-engine
Version:
node-based webgl 3D engine https://polygonjs.com
90 lines (89 loc) • 2.98 kB
JavaScript
import {ParamType as ParamType2} from "../../../../poly/ParamType";
export var JsConnectionPointType;
(function(JsConnectionPointType2) {
JsConnectionPointType2["BOOL"] = "bool";
JsConnectionPointType2["INT"] = "int";
JsConnectionPointType2["FLOAT"] = "float";
JsConnectionPointType2["VEC2"] = "vec2";
JsConnectionPointType2["VEC3"] = "vec3";
JsConnectionPointType2["VEC4"] = "vec4";
})(JsConnectionPointType || (JsConnectionPointType = {}));
export const JS_CONNECTION_POINT_TYPES = [
JsConnectionPointType.BOOL,
JsConnectionPointType.INT,
JsConnectionPointType.FLOAT,
JsConnectionPointType.VEC2,
JsConnectionPointType.VEC3,
JsConnectionPointType.VEC4
];
export const JsConnectionPointTypeToParamTypeMap = {
[]: ParamType2.BOOLEAN,
[]: ParamType2.INTEGER,
[]: ParamType2.FLOAT,
[]: ParamType2.VECTOR2,
[]: ParamType2.VECTOR3,
[]: ParamType2.VECTOR4
};
export const JsParamTypeToConnectionPointTypeMap = {
[]: JsConnectionPointType.BOOL,
[]: JsConnectionPointType.VEC3,
[]: JsConnectionPointType.INT,
[]: JsConnectionPointType.FLOAT,
[]: void 0,
[]: JsConnectionPointType.VEC2,
[]: JsConnectionPointType.VEC3,
[]: JsConnectionPointType.VEC4,
[]: void 0,
[]: void 0,
[]: void 0,
[]: void 0,
[]: void 0,
[]: void 0,
[]: void 0
};
export const JsConnectionPointInitValueMap = {
[]: false,
[]: 0,
[]: 0,
[]: [0, 0],
[]: [0, 0, 0],
[]: [0, 0, 0, 0]
};
export const GlConnectionPointComponentsCountMap = {
[]: 1,
[]: 1,
[]: 1,
[]: 2,
[]: 3,
[]: 4
};
import {BaseConnectionPoint} from "./_Base";
export class JsConnectionPoint extends BaseConnectionPoint {
constructor(_name, _type) {
super(_name, _type);
this._name = _name;
this._type = _type;
this._init_value = JsConnectionPointInitValueMap[this._type];
}
type() {
return this._type;
}
are_types_matched(src_type, dest_type) {
return src_type == dest_type;
}
get param_type() {
return JsConnectionPointTypeToParamTypeMap[this._type];
}
get init_value() {
return this._init_value;
}
toJSON() {
return this._json = this._json || this._create_json();
}
_create_json() {
return {
name: this._name,
type: this._type
};
}
}