@polygonjs/polygonjs
Version:
node-based WebGL 3D engine https://polygonjs.com
304 lines (303 loc) • 18.6 kB
TypeScript
import { Plane } from '@jscad/modeling/src/maths/plane';
import { AnimationAction, AnimationMixer, Box3, Camera, CatmullRomCurve3, Color, Matrix4, Quaternion, Vector2, Vector3, Vector4, Intersection, Material, Object3D, Ray, Sphere, Texture, Euler } from 'three';
import { ParamInitValuesTypeMap } from '../../../../params/types/ParamInitValuesTypeMap';
import { ParamType } from '../../../../poly/ParamType';
import { BaseConnectionPoint } from './_Base';
import { BaseParamType } from '../../../../params/_Base';
import { BaseNodeType } from '../../../_Base';
export declare enum JsConnectionPointType {
ANIMATION_MIXER = "AnimationMixer",
ANIMATION_ACTION = "AnimationAction",
BOOLEAN = "boolean",
BOOLEAN_ARRAY = "boolean[]",
BOX3 = "Box3",
CAMERA = "Camera",
CATMULL_ROM_CURVE3 = "CatmullRomCurve3",
COLOR = "Color",
COLOR_ARRAY = "Color[]",
EULER = "Euler",
EULER_ARRAY = "Euler[]",
FLOAT = "float",
FLOAT_ARRAY = "float[]",
INT = "int",
INT_ARRAY = "int[]",
INTERSECTION = "Intersection",
INTERSECTION_ARRAY = "Intersection[]",
MATERIAL = "Material",
MATRIX4 = "Matrix4",
MATRIX4_ARRAY = "Matrix4[]",
NODE = "Node",
OBJECT_3D = "Object3D",
OBJECT_3D_ARRAY = "Object3D[]",
PARAM = "Param",
PLANE = "Plane",
QUATERNION = "Quaternion",
QUATERNION_ARRAY = "Quaternion[]",
RAY = "Ray",
SPHERE = "Sphere",
STRING = "string",
STRING_ARRAY = "string[]",
TEXTURE = "Texture",
TEXTURE_ARRAY = "Texture[]",
TRIGGER = "trigger",
VECTOR2 = "Vector2",
VECTOR2_ARRAY = "Vector2[]",
VECTOR3 = "Vector3",
VECTOR3_ARRAY = "Vector3[]",
VECTOR4 = "Vector4",
VECTOR4_ARRAY = "Vector4[]"
}
export type PrimitiveArrayElement = boolean | number | string;
export type VectorArrayElement = Color | Euler | Matrix4 | Quaternion | Vector2 | Vector3 | Vector4;
export declare const JS_CONNECTION_TYPES_FOR_CONSTANT: JsConnectionPointType[];
export declare function isJsConnectionPointNumber(type: JsConnectionPointType): boolean;
export declare function isJsConnectionPointPrimitive(type: JsConnectionPointType): boolean;
export declare function isJsConnectionPointVector(type: JsConnectionPointType): boolean;
export declare function isJsConnectionPointArray(type: JsConnectionPointType): boolean;
export declare const JS_CONNECTION_POINT_TYPES: Array<JsConnectionPointType>;
type JsConnectionPointTypeToArrayTypeMapGeneric = {
[]: JsConnectionPointType;
};
export interface JsIConnectionPointTypeToArrayTypeMap extends JsConnectionPointTypeToArrayTypeMapGeneric {
[]: JsConnectionPointType.ANIMATION_MIXER;
[]: JsConnectionPointType.ANIMATION_ACTION;
[]: JsConnectionPointType.BOOLEAN_ARRAY;
[]: JsConnectionPointType.BOOLEAN_ARRAY;
[]: JsConnectionPointType.BOX3;
[]: JsConnectionPointType.CAMERA;
[]: JsConnectionPointType.CATMULL_ROM_CURVE3;
[]: JsConnectionPointType.COLOR_ARRAY;
[]: JsConnectionPointType.COLOR_ARRAY;
[]: JsConnectionPointType.EULER_ARRAY;
[]: JsConnectionPointType.EULER_ARRAY;
[]: JsConnectionPointType.FLOAT_ARRAY;
[]: JsConnectionPointType.FLOAT_ARRAY;
[]: JsConnectionPointType.INT_ARRAY;
[]: JsConnectionPointType.INT_ARRAY;
[]: JsConnectionPointType.INTERSECTION_ARRAY;
[]: JsConnectionPointType.INTERSECTION_ARRAY;
[]: JsConnectionPointType.MATERIAL;
[]: JsConnectionPointType.MATRIX4_ARRAY;
[]: JsConnectionPointType.MATRIX4_ARRAY;
[]: JsConnectionPointType.NODE;
[]: JsConnectionPointType.OBJECT_3D_ARRAY;
[]: JsConnectionPointType.OBJECT_3D_ARRAY;
[]: JsConnectionPointType.PARAM;
[]: JsConnectionPointType.PLANE;
[]: JsConnectionPointType.QUATERNION_ARRAY;
[]: JsConnectionPointType.QUATERNION_ARRAY;
[]: JsConnectionPointType.RAY;
[]: JsConnectionPointType.SPHERE;
[]: JsConnectionPointType.STRING_ARRAY;
[]: JsConnectionPointType.STRING_ARRAY;
[]: JsConnectionPointType.TEXTURE_ARRAY;
[]: JsConnectionPointType.TEXTURE_ARRAY;
[]: JsConnectionPointType.TRIGGER;
[]: JsConnectionPointType.VECTOR2_ARRAY;
[]: JsConnectionPointType.VECTOR2_ARRAY;
[]: JsConnectionPointType.VECTOR3_ARRAY;
[]: JsConnectionPointType.VECTOR3_ARRAY;
[]: JsConnectionPointType.VECTOR4_ARRAY;
[]: JsConnectionPointType.VECTOR4_ARRAY;
}
export declare const JsConnectionPointTypeToArrayTypeMap: JsIConnectionPointTypeToArrayTypeMap;
type JsConnectionPointTypeFromArrayTypeMapGeneric = {
[]: JsConnectionPointType;
};
export interface JsIConnectionPointTypeFromArrayTypeMap extends JsConnectionPointTypeFromArrayTypeMapGeneric {
[]: JsConnectionPointType.ANIMATION_MIXER;
[]: JsConnectionPointType.ANIMATION_ACTION;
[]: JsConnectionPointType.BOOLEAN;
[]: JsConnectionPointType.BOOLEAN;
[]: JsConnectionPointType.BOX3;
[]: JsConnectionPointType.CAMERA;
[]: JsConnectionPointType.CATMULL_ROM_CURVE3;
[]: JsConnectionPointType.COLOR;
[]: JsConnectionPointType.COLOR;
[]: JsConnectionPointType.EULER;
[]: JsConnectionPointType.EULER;
[]: JsConnectionPointType.FLOAT;
[]: JsConnectionPointType.FLOAT;
[]: JsConnectionPointType.INT;
[]: JsConnectionPointType.INT;
[]: JsConnectionPointType.INTERSECTION;
[]: JsConnectionPointType.INTERSECTION;
[]: JsConnectionPointType.MATERIAL;
[]: JsConnectionPointType.MATRIX4;
[]: JsConnectionPointType.MATRIX4;
[]: JsConnectionPointType.NODE;
[]: JsConnectionPointType.OBJECT_3D;
[]: JsConnectionPointType.OBJECT_3D;
[]: JsConnectionPointType.PARAM;
[]: JsConnectionPointType.PLANE;
[]: JsConnectionPointType.QUATERNION;
[]: JsConnectionPointType.QUATERNION;
[]: JsConnectionPointType.RAY;
[]: JsConnectionPointType.SPHERE;
[]: JsConnectionPointType.STRING;
[]: JsConnectionPointType.STRING;
[]: JsConnectionPointType.TEXTURE;
[]: JsConnectionPointType.TEXTURE;
[]: JsConnectionPointType.TRIGGER;
[]: JsConnectionPointType.VECTOR2;
[]: JsConnectionPointType.VECTOR2;
[]: JsConnectionPointType.VECTOR3;
[]: JsConnectionPointType.VECTOR3;
[]: JsConnectionPointType.VECTOR4;
[]: JsConnectionPointType.VECTOR4;
}
export declare const JsConnectionPointTypeFromArrayTypeMap: JsIConnectionPointTypeFromArrayTypeMap;
export type ArrayableConnectionPointType = JsConnectionPointType.BOOLEAN | JsConnectionPointType.COLOR | JsConnectionPointType.FLOAT | JsConnectionPointType.INT | JsConnectionPointType.INTERSECTION | JsConnectionPointType.MATRIX4 | JsConnectionPointType.QUATERNION | JsConnectionPointType.STRING | JsConnectionPointType.TEXTURE | JsConnectionPointType.VECTOR2 | JsConnectionPointType.VECTOR3 | JsConnectionPointType.VECTOR4;
export declare const ARRAYABLE_CONNECTION_TYPES: Set<ArrayableConnectionPointType>;
export type JsConnectionPointTypeArray = JsConnectionPointType.BOOLEAN_ARRAY | JsConnectionPointType.COLOR_ARRAY | JsConnectionPointType.FLOAT_ARRAY | JsConnectionPointType.INT_ARRAY | JsConnectionPointType.INTERSECTION_ARRAY | JsConnectionPointType.MATRIX4_ARRAY | JsConnectionPointType.OBJECT_3D_ARRAY | JsConnectionPointType.QUATERNION_ARRAY | JsConnectionPointType.STRING_ARRAY | JsConnectionPointType.TEXTURE_ARRAY | JsConnectionPointType.VECTOR2_ARRAY | JsConnectionPointType.VECTOR3_ARRAY | JsConnectionPointType.VECTOR4_ARRAY;
export declare const ARRAY_JS_CONNECTION_TYPES: Array<JsConnectionPointTypeArray>;
export declare const ARRAY_JS_CONNECTION_TYPES_SET: Set<JsConnectionPointTypeArray>;
export type ParamConvertibleJsType = JsConnectionPointType.BOOLEAN | JsConnectionPointType.COLOR | JsConnectionPointType.FLOAT | JsConnectionPointType.INT | JsConnectionPointType.STRING | JsConnectionPointType.VECTOR2 | JsConnectionPointType.VECTOR3 | JsConnectionPointType.VECTOR4;
export declare const PARAM_CONVERTIBLE_JS_CONNECTION_POINT_TYPES: Array<ParamConvertibleJsType>;
export type PointAttributeJsType = JsConnectionPointType.COLOR | JsConnectionPointType.FLOAT | JsConnectionPointType.INT | JsConnectionPointType.VECTOR2 | JsConnectionPointType.VECTOR3 | JsConnectionPointType.VECTOR4;
export declare const POINT_ATTRIBUTE_JS_CONNECTION_POINT_TYPES: Array<PointAttributeJsType>;
export type JsDataType = PrimitiveArrayElement | Array<PrimitiveArrayElement> | VectorArrayElement | Array<VectorArrayElement> | AnimationMixer | AnimationAction | Box3 | Camera | CatmullRomCurve3 | Euler | Euler[] | Intersection | Array<Intersection> | Material | Object3D | Array<Object3D> | Ray | Sphere | Texture | Array<Texture> | BaseNodeType | BaseParamType | null;
type JSConnectionPointTypeToDataTypeMapGeneric = {
[]: JsDataType;
};
export interface JsIConnectionPointTypeToDataTypeMap extends JSConnectionPointTypeToDataTypeMapGeneric {
[]: AnimationMixer;
[]: AnimationAction;
[]: boolean;
[]: boolean[];
[]: Box3;
[]: Camera;
[]: CatmullRomCurve3;
[]: Color;
[]: Color[];
[]: Euler;
[]: Euler[];
[]: number;
[]: number[];
[]: number;
[]: number[];
[]: Intersection;
[]: Intersection[];
[]: Material;
[]: Matrix4;
[]: Matrix4[];
[]: BaseNodeType;
[]: Object3D;
[]: Object3D[];
[]: BaseParamType;
[]: Plane;
[]: Quaternion;
[]: Quaternion[];
[]: Ray;
[]: Sphere;
[]: string;
[]: string[];
[]: Texture;
[]: Texture[];
[]: null;
[]: Vector2;
[]: Vector2[];
[]: Vector3;
[]: Vector3[];
[]: Vector4;
[]: Vector4[];
}
type JSConnectionPointTypeToParamTypeMapGeneric = {
[]: ParamType | undefined;
};
export interface JsIConnectionPointTypeToParamTypeMap extends JSConnectionPointTypeToParamTypeMapGeneric {
[]: ParamType.BUTTON;
[]: ParamType.BUTTON;
[]: ParamType.BOOLEAN;
[]: ParamType.BUTTON;
[]: ParamType.BUTTON;
[]: ParamType.BUTTON;
[]: ParamType.BUTTON;
[]: ParamType.COLOR;
[]: ParamType.BUTTON;
[]: ParamType.BUTTON;
[]: ParamType.BUTTON;
[]: ParamType.FLOAT;
[]: ParamType.BUTTON;
[]: ParamType.INTEGER;
[]: ParamType.BUTTON;
[]: ParamType.BUTTON;
[]: ParamType.BUTTON;
[]: ParamType.BUTTON;
[]: ParamType.BUTTON;
[]: ParamType.BUTTON;
[]: ParamType.NODE_PATH;
[]: ParamType.BUTTON;
[]: ParamType.BUTTON;
[]: ParamType.PARAM_PATH;
[]: ParamType.BUTTON;
[]: ParamType.BUTTON;
[]: ParamType.BUTTON;
[]: ParamType.BUTTON;
[]: ParamType.BUTTON;
[]: ParamType.STRING;
[]: ParamType.BUTTON;
[]: ParamType.BUTTON;
[]: ParamType.BUTTON;
[]: ParamType.BUTTON;
[]: ParamType.VECTOR2;
[]: ParamType.BUTTON;
[]: ParamType.VECTOR3;
[]: ParamType.BUTTON;
[]: ParamType.VECTOR4;
[]: ParamType.BUTTON;
}
export declare const JsConnectionPointTypeToParamTypeMap: JsIConnectionPointTypeToParamTypeMap;
type JsParamTypeToConnectionPointTypeMapGeneric = {
[]: JsConnectionPointType | undefined;
};
export interface IJsParamTypeToConnectionPointTypeMap extends JsParamTypeToConnectionPointTypeMapGeneric {
[]: JsConnectionPointType.BOOLEAN;
[]: JsConnectionPointType.COLOR;
[]: JsConnectionPointType.FLOAT;
[]: JsConnectionPointType.INT;
[]: undefined;
[]: JsConnectionPointType.VECTOR2;
[]: JsConnectionPointType.VECTOR3;
[]: JsConnectionPointType.VECTOR4;
[]: undefined;
[]: JsConnectionPointType.NODE;
[]: JsConnectionPointType.PARAM;
[]: undefined;
[]: JsConnectionPointType.STRING;
}
export declare const JsParamTypeToConnectionPointTypeMap: IJsParamTypeToConnectionPointTypeMap;
export type ConnectionPointInitValueMapGeneric = {
[]: ParamInitValuesTypeMap[JsIConnectionPointTypeToParamTypeMap[key]];
};
export declare const JsConnectionPointInitValueMap: ConnectionPointInitValueMapGeneric;
export type ConnectionPointComponentsCountMapGeneric = {
[]: number;
};
export declare const JsConnectionPointComponentsCountMap: ConnectionPointComponentsCountMapGeneric;
export interface JsConnectionPointData<T extends JsConnectionPointType> {
name: string;
type: T;
isArray?: boolean;
}
interface JsConnectionPointOptions<T extends JsConnectionPointType> {
inNodeDefinition?: boolean;
init_value?: ConnectionPointInitValueMapGeneric[T];
}
export declare const JS_CONNECTION_POINT_IN_NODE_DEF: JsConnectionPointOptions<JsConnectionPointType>;
export declare class JsConnectionPoint<T extends JsConnectionPointType> extends BaseConnectionPoint {
protected _type: T;
protected _options?: JsConnectionPointOptions<T> | undefined;
protected _json: JsConnectionPointData<T> | undefined;
protected _init_value?: ConnectionPointInitValueMapGeneric[T];
protected _isArray: boolean;
constructor(_name: string, _type: T, _options?: JsConnectionPointOptions<T> | undefined);
type(): T;
are_types_matched(src_type: string, dest_type: string): boolean;
get param_type(): JsIConnectionPointTypeToParamTypeMap[T];
get init_value(): ConnectionPointInitValueMapGeneric[T] | undefined;
toJSON(): JsConnectionPointData<T>;
protected _createJSON(): JsConnectionPointData<T>;
}
export type BaseJsConnectionPoint = JsConnectionPoint<JsConnectionPointType>;
export {};