UNPKG

@polygonjs/polygonjs

Version:

node-based WebGL 3D engine https://polygonjs.com

135 lines (134 loc) 7.01 kB
import { BaseJsNodeType } from '../_Base'; import { TypedJsDefinitionCollection } from './JsDefinitionCollection'; import { JsConnectionPointType } from '../../utils/io/connections/Js'; import { JsLinesCollectionController } from '../code/utils/JsLinesCollectionController'; import { LineType } from '../code/utils/LineType'; import { EvaluatorMethodName } from '../code/assemblers/actor/ActorEvaluator'; export declare enum JsDefinitionType { LOCAL_FUNCTION = "localFunction", COMPUTED = "computed", CONSTANT = "constant", REF = "ref", WATCH = "watch", INIT_FUNCTION = "initFunction", TRIGGERING = "triggering", TRIGGERABLE = "triggerable" } export declare abstract class TypedJsDefinition<T extends JsDefinitionType> { protected _definitionType: T; protected _node: BaseJsNodeType; protected _shaderCollectionController: JsLinesCollectionController; protected _dataType: JsConnectionPointType; protected _name: string; constructor(_definitionType: T, _node: BaseJsNodeType, _shaderCollectionController: JsLinesCollectionController, _dataType: JsConnectionPointType, _name: string); static gather(definitions: BaseJsDefinition[], linesForShader: Map<LineType, string[]>, lineType: LineType): void; definitionType(): T; dataType(): JsConnectionPointType; node(): BaseJsNodeType; name(): string; abstract line(): string; collectionInstance(): TypedJsDefinitionCollection<T>; } export declare class LocalFunctionJsDefinition extends TypedJsDefinition<JsDefinitionType.LOCAL_FUNCTION> { protected _node: BaseJsNodeType; protected _shaderCollectionController: JsLinesCollectionController; protected _dataType: JsConnectionPointType; protected _name: string; protected _functionDefinition: string; constructor(_node: BaseJsNodeType, _shaderCollectionController: JsLinesCollectionController, _dataType: JsConnectionPointType, _name: string, _functionDefinition: string); line(): string; } export declare class ComputedValueJsDefinition extends TypedJsDefinition<JsDefinitionType.COMPUTED> { protected _node: BaseJsNodeType; protected _shaderCollectionController: JsLinesCollectionController; protected _dataType: JsConnectionPointType; protected _name: string; protected _value: string; constructor(_node: BaseJsNodeType, _shaderCollectionController: JsLinesCollectionController, _dataType: JsConnectionPointType, _name: string, _value: string); line(): string; } export declare class ConstantJsDefinition extends TypedJsDefinition<JsDefinitionType.CONSTANT> { protected _node: BaseJsNodeType; protected _shaderCollectionController: JsLinesCollectionController; protected _dataType: JsConnectionPointType; protected _name: string; protected _value: string; constructor(_node: BaseJsNodeType, _shaderCollectionController: JsLinesCollectionController, _dataType: JsConnectionPointType, _name: string, _value: string); line(): string; } export declare class RefJsDefinition extends TypedJsDefinition<JsDefinitionType.REF> { protected _node: BaseJsNodeType; protected _shaderCollectionController: JsLinesCollectionController; protected _dataType: JsConnectionPointType; protected _name: string; protected _value: string; constructor(_node: BaseJsNodeType, _shaderCollectionController: JsLinesCollectionController, _dataType: JsConnectionPointType, _name: string, _value: string); line(): string; } interface WatchedValueJsDefinitionOptions { deep?: boolean; } export declare class WatchedValueJsDefinition extends TypedJsDefinition<JsDefinitionType.WATCH> { protected _node: BaseJsNodeType; protected _shaderCollectionController: JsLinesCollectionController; protected _dataType: JsConnectionPointType; protected _name: string; protected _value: string; protected _options: WatchedValueJsDefinitionOptions; constructor(_node: BaseJsNodeType, _shaderCollectionController: JsLinesCollectionController, _dataType: JsConnectionPointType, _name: string, _value: string, _options: WatchedValueJsDefinitionOptions); line(): string; } export declare class InitFunctionJsDefinition extends TypedJsDefinition<JsDefinitionType.INIT_FUNCTION> { protected _node: BaseJsNodeType; protected _shaderCollectionController: JsLinesCollectionController; protected _dataType: JsConnectionPointType; protected _name: string; protected _value: string; constructor(_node: BaseJsNodeType, _shaderCollectionController: JsLinesCollectionController, _dataType: JsConnectionPointType, _name: string, _value: string); line(): string; } interface TriggeringJsDefinitionOptions { triggeringMethodName: EvaluatorMethodName; gatherable: boolean; nodeMethodName?: string; perPoint?: boolean; } export declare class TriggeringJsDefinition extends TypedJsDefinition<JsDefinitionType.TRIGGERING> { protected _node: BaseJsNodeType; protected _shaderCollectionController: JsLinesCollectionController; protected _dataType: JsConnectionPointType; protected _name: string; protected _value: string; protected _options: TriggeringJsDefinitionOptions; constructor(_node: BaseJsNodeType, _shaderCollectionController: JsLinesCollectionController, _dataType: JsConnectionPointType, _name: string, _value: string, _options: TriggeringJsDefinitionOptions); name(): string; line(): string; static gather(_definitions: TypedJsDefinition<JsDefinitionType>[], linesForShader: Map<LineType, string[]>, lineType: LineType): void; } export interface TriggerableJsDefinitionOptions { async?: boolean; methodName?: string; } export declare class TriggerableJsDefinition extends TypedJsDefinition<JsDefinitionType.TRIGGERABLE> { protected _node: BaseJsNodeType; protected _shaderCollectionController: JsLinesCollectionController; protected _dataType: JsConnectionPointType; protected _name: string; protected _value: string; protected _options?: TriggerableJsDefinitionOptions | undefined; constructor(_node: BaseJsNodeType, _shaderCollectionController: JsLinesCollectionController, _dataType: JsConnectionPointType, _name: string, _value: string, _options?: TriggerableJsDefinitionOptions | undefined); line(): string; } export interface DefinitionTypeMap { [JsDefinitionType.LOCAL_FUNCTION]: typeof LocalFunctionJsDefinition; [JsDefinitionType.COMPUTED]: typeof ComputedValueJsDefinition; [JsDefinitionType.CONSTANT]: typeof ConstantJsDefinition; [JsDefinitionType.REF]: typeof RefJsDefinition; [JsDefinitionType.WATCH]: typeof WatchedValueJsDefinition; [JsDefinitionType.INIT_FUNCTION]: typeof InitFunctionJsDefinition; [JsDefinitionType.TRIGGERING]: typeof TriggeringJsDefinition; [JsDefinitionType.TRIGGERABLE]: typeof TriggerableJsDefinition; } export declare const JsDefinitionTypeMap: DefinitionTypeMap; export type BaseJsDefinition = TypedJsDefinition<JsDefinitionType>; export {};