@onerjs/core 8.51.3 → 8.51.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Animations/animationGroup.d.ts +2 -1
- package/Animations/animationGroup.js +3 -2
- package/Animations/animationGroup.js.map +1 -1
- package/Engines/WebGPU/webgpuSnapshotRendering.js +7 -3
- package/Engines/WebGPU/webgpuSnapshotRendering.js.map +1 -1
- package/Events/deviceInputEvents.d.ts +5 -0
- package/Events/deviceInputEvents.js.map +1 -1
- package/FlowGraph/Blocks/Data/flowGraphIsKeyPressedBlock.d.ts +65 -0
- package/FlowGraph/Blocks/Data/flowGraphIsKeyPressedBlock.js +74 -0
- package/FlowGraph/Blocks/Data/flowGraphIsKeyPressedBlock.js.map +1 -0
- package/FlowGraph/Blocks/Data/index.d.ts +1 -0
- package/FlowGraph/Blocks/Data/index.js +1 -0
- package/FlowGraph/Blocks/Data/index.js.map +1 -1
- package/FlowGraph/Blocks/Event/flowGraphKeyDownEventBlock.d.ts +39 -0
- package/FlowGraph/Blocks/Event/flowGraphKeyDownEventBlock.js +42 -0
- package/FlowGraph/Blocks/Event/flowGraphKeyDownEventBlock.js.map +1 -0
- package/FlowGraph/Blocks/Event/flowGraphKeyUpEventBlock.d.ts +19 -0
- package/FlowGraph/Blocks/Event/flowGraphKeyUpEventBlock.js +25 -0
- package/FlowGraph/Blocks/Event/flowGraphKeyUpEventBlock.js.map +1 -0
- package/FlowGraph/Blocks/Event/flowGraphKeyboardEventBlock.d.ts +64 -0
- package/FlowGraph/Blocks/Event/flowGraphKeyboardEventBlock.js +50 -0
- package/FlowGraph/Blocks/Event/flowGraphKeyboardEventBlock.js.map +1 -0
- package/FlowGraph/Blocks/Event/index.d.ts +3 -0
- package/FlowGraph/Blocks/Event/index.js +3 -0
- package/FlowGraph/Blocks/Event/index.js.map +1 -1
- package/FlowGraph/Blocks/flowGraphBlockFactory.js +7 -0
- package/FlowGraph/Blocks/flowGraphBlockFactory.js.map +1 -1
- package/FlowGraph/Blocks/flowGraphBlockNames.d.ts +3 -0
- package/FlowGraph/Blocks/flowGraphBlockNames.js +3 -0
- package/FlowGraph/Blocks/flowGraphBlockNames.js.map +1 -1
- package/FlowGraph/flowGraph.d.ts +6 -0
- package/FlowGraph/flowGraph.js +10 -1
- package/FlowGraph/flowGraph.js.map +1 -1
- package/FlowGraph/flowGraphContext.d.ts +8 -0
- package/FlowGraph/flowGraphContext.js.map +1 -1
- package/FlowGraph/flowGraphEventType.d.ts +2 -0
- package/FlowGraph/flowGraphEventType.js +2 -0
- package/FlowGraph/flowGraphEventType.js.map +1 -1
- package/FlowGraph/flowGraphSceneEventCoordinator.d.ts +14 -0
- package/FlowGraph/flowGraphSceneEventCoordinator.js +56 -0
- package/FlowGraph/flowGraphSceneEventCoordinator.js.map +1 -1
- package/FlowGraph/utils.d.ts +7 -0
- package/FlowGraph/utils.js +8 -0
- package/FlowGraph/utils.js.map +1 -1
- package/Materials/GaussianSplatting/gaussianSplattingMaterial.js +6 -0
- package/Materials/GaussianSplatting/gaussianSplattingMaterial.js.map +1 -1
- package/Meshes/GaussianSplatting/gaussianSplattingMeshBase.js +30 -8
- package/Meshes/GaussianSplatting/gaussianSplattingMeshBase.js.map +1 -1
- package/Misc/snapshotRenderingHelper.d.ts +4 -2
- package/Misc/snapshotRenderingHelper.js +33 -22
- package/Misc/snapshotRenderingHelper.js.map +1 -1
- package/Particles/thinParticleSystem.d.ts +6 -1
- package/Particles/thinParticleSystem.js +23 -6
- package/Particles/thinParticleSystem.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"flowGraphContext.js","sourceRoot":"","sources":["../../../../dev/core/src/FlowGraph/flowGraphContext.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAM1C,OAAO,EAAE,iCAAiC,EAAE,M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AI,CAAC,aAAa,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;gBACrD,SAAS,EAAE,IAAI,CAAC,aAAa,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;gBACxD,eAAe,EAAE,IAAI,CAAC,aAAa,CAAC,eAAe,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;gBACtE,UAAU,EAAE,IAAI,CAAC,aAAa,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;gBAC1D,cAAc,EAAE,IAAI,CAAC,aAAa,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;gBAClE,cAAc,EAAE,IAAI,CAAC,aAAa,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;aACrE,CAAC;QACN,CAAC;IACL,CAAC;IAED;;OAEG;IACI,YAAY;QACf,OAAO,kBAAkB,CAAC;IAC9B,CAAC;CACJ;AA5nBU;IADN,SAAS,EAAE;kDACmB;AAMxB;IADN,SAAS,EAAE;8CACa","sourcesContent":["import { serialize } from \"../Misc/decorators\";\r\nimport { RandomGUID } from \"../Misc/guid\";\r\nimport { type Scene } from \"../scene\";\r\nimport { type FlowGraphAsyncExecutionBlock } from \"./flowGraphAsyncExecutionBlock\";\r\nimport { type FlowGraphBlock } from \"./flowGraphBlock\";\r\nimport { type FlowGraphDataConnection } from \"./flowGraphDataConnection\";\r\nimport { type FlowGraph } from \"./flowGraph\";\r\nimport { defaultValueSerializationFunction } from \"./serialization\";\r\nimport { type FlowGraphCoordinator } from \"./flowGraphCoordinator\";\r\nimport { Observable } from \"../Misc/observable\";\r\nimport { type AssetType, type FlowGraphAssetType, GetFlowGraphAssetWithType } from \"./flowGraphAssetsContext\";\r\nimport { type IAssetContainer } from \"core/IAssetContainer\";\r\nimport { type Nullable } from \"core/types\";\r\nimport { FlowGraphAction, FlowGraphLogger } from \"./flowGraphLogger\";\r\nimport { type IFlowGraphOnTickEventPayload } from \"./Blocks/Event/flowGraphSceneTickEventBlock\";\r\nimport { type FlowGraphExecutionBlock } from \"./flowGraphExecutionBlock\";\r\nimport { type FlowGraphSignalConnection } from \"./flowGraphSignalConnection\";\r\n\r\n/**\r\n * Represents a pending signal activation that was paused by a breakpoint.\r\n */\r\nexport interface IFlowGraphPendingActivation {\r\n /** The block that was about to execute */\r\n readonly block: FlowGraphExecutionBlock;\r\n /** The context in which execution was paused */\r\n readonly context: FlowGraphContext;\r\n /** The signal connection that triggered the execution */\r\n readonly signal: FlowGraphSignalConnection;\r\n}\r\n/**\r\n * Construction parameters for the context.\r\n */\r\nexport interface IFlowGraphContextConfiguration {\r\n /**\r\n * The scene that the flow graph context belongs to.\r\n */\r\n readonly scene: Scene;\r\n /**\r\n * The event coordinator used by the flow graph context.\r\n */\r\n readonly coordinator: FlowGraphCoordinator;\r\n\r\n /**\r\n * The assets context used by the flow graph context.\r\n * If none is provided, a default one will be created.\r\n */\r\n readonly assetsContext?: IAssetContainer;\r\n}\r\n\r\n/**\r\n * Options for parsing a context.\r\n */\r\nexport interface IFlowGraphContextParseOptions {\r\n /**\r\n * A function that parses a value from a serialization object.\r\n * @param key the key of the value\r\n * @param serializationObject the object containing the value\r\n * @param assetsContainer the assets container\r\n * @param scene the current scene\r\n * @returns\r\n */\r\n readonly valueParseFunction?: (key: string, serializationObject: any, assetsContainer: IAssetContainer, scene: Scene) => any;\r\n /**\r\n * The graph that the context is being parsed in.\r\n */\r\n readonly graph: FlowGraph;\r\n}\r\n/**\r\n * The context represents the current state and execution of the flow graph.\r\n * It contains both user-defined variables, which are derived from\r\n * a more general variable definition, and execution variables that\r\n * are set by the blocks.\r\n */\r\nexport class FlowGraphContext {\r\n /**\r\n * A randomly generated GUID for each context.\r\n */\r\n @serialize()\r\n public uniqueId = RandomGUID();\r\n /**\r\n * An optional user-facing name for the context.\r\n * Defaults to an empty string; the editor may assign a label like \"Context 0\".\r\n */\r\n @serialize()\r\n public name: string = \"\";\r\n /**\r\n * These are the variables defined by a user.\r\n */\r\n private _userVariables: { [key: string]: any } = {};\r\n /**\r\n * Optional type annotations for user variables.\r\n * Keys are variable names; values are type name strings (e.g. \"number\", \"Vector3\", \"Mesh\").\r\n * This map is maintained by the editor and persisted through serialization so\r\n * that a variable's declared type survives even when its value is undefined.\r\n */\r\n private _variableTypes: { [key: string]: string } = {};\r\n /**\r\n * These are the variables set by the blocks.\r\n */\r\n private _executionVariables: { [key: string]: any } = {};\r\n\r\n /**\r\n * A context-specific global variables, available to all blocks in the context.\r\n */\r\n private _globalContextVariables: { [key: string]: any } = {};\r\n /**\r\n * These are the values for the data connection points\r\n */\r\n private _connectionValues: { [key: string]: any } = {};\r\n /**\r\n * These are the variables set by the graph.\r\n */\r\n private readonly _configuration: IFlowGraphContextConfiguration;\r\n /**\r\n * These are blocks that have currently pending tasks/listeners that need to be cleaned up.\r\n */\r\n private _pendingBlocks: FlowGraphAsyncExecutionBlock[] = [];\r\n /**\r\n * A monotonically increasing ID for each execution.\r\n * Incremented for every block executed.\r\n */\r\n private _executionId = 0;\r\n /**\r\n * Observable that is triggered when a node is executed.\r\n */\r\n public onNodeExecutedObservable: Observable<FlowGraphBlock> = new Observable<FlowGraphBlock>();\r\n\r\n /**\r\n * Observable triggered when a breakpoint is hit.\r\n * Observers receive the pending activation (block, context, signal) that was paused.\r\n */\r\n public onBreakpointHitObservable: Observable<IFlowGraphPendingActivation> = new Observable<IFlowGraphPendingActivation>();\r\n\r\n /**\r\n * A predicate called before each execution block runs.\r\n * If it returns true, execution is paused before the block and a\r\n * pending activation is stored, which can be resumed via\r\n * {@link continueExecution} or {@link stepExecution}.\r\n *\r\n * Set to `null` to disable breakpoint checking.\r\n */\r\n public breakpointPredicate: Nullable<(block: FlowGraphExecutionBlock) => boolean> = null;\r\n\r\n /**\r\n * The activation that is currently paused due to a breakpoint hit.\r\n * `null` when execution is not paused on a breakpoint.\r\n */\r\n private _pendingActivation: Nullable<IFlowGraphPendingActivation> = null;\r\n\r\n /**\r\n * When true, the next activation will pause regardless of the breakpoint predicate.\r\n * Set by {@link stepExecution}.\r\n */\r\n private _stepMode: boolean = false;\r\n\r\n /**\r\n * When set, the breakpoint check is skipped for this specific block uniqueId\r\n * on the very next call to {@link _shouldBreak}. Used by continue/step to avoid\r\n * immediately re-hitting the breakpoint on the block being resumed.\r\n */\r\n private _skipBreakpointForBlockId: Nullable<string> = null;\r\n\r\n /**\r\n * The assets context used by the flow graph context.\r\n * Note that it can be shared between flow graph contexts.\r\n */\r\n public assetsContext: IAssetContainer;\r\n\r\n /**\r\n * Whether to treat data as right-handed.\r\n * This is used when serializing data from a right-handed system, while running the context in a left-handed system, for example in glTF parsing.\r\n * Default is false.\r\n */\r\n public treatDataAsRightHanded = false;\r\n\r\n private _enableLogging = false;\r\n\r\n /**\r\n * The logger used by the context to log actions.\r\n */\r\n public logger: Nullable<FlowGraphLogger>;\r\n\r\n /**\r\n * Enable logging on this context\r\n */\r\n public get enableLogging() {\r\n return this._enableLogging;\r\n }\r\n\r\n public set enableLogging(value: boolean) {\r\n if (this._enableLogging === value) {\r\n return;\r\n }\r\n this._enableLogging = value;\r\n if (this._enableLogging) {\r\n this.logger = new FlowGraphLogger();\r\n this.logger.logToConsole = true;\r\n } else {\r\n this.logger = null;\r\n }\r\n }\r\n\r\n constructor(params: IFlowGraphContextConfiguration) {\r\n this._configuration = params;\r\n this.assetsContext = params.assetsContext ?? params.scene;\r\n }\r\n\r\n /**\r\n * Check if a user-defined variable is defined.\r\n * @param name the name of the variable\r\n * @returns true if the variable is defined\r\n */\r\n public hasVariable(name: string) {\r\n return name in this._userVariables;\r\n }\r\n\r\n /**\r\n * Set a user-defined variable.\r\n * @param name the name of the variable\r\n * @param value the value of the variable\r\n */\r\n public setVariable(name: string, value: any) {\r\n this._userVariables[name] = value;\r\n this.logger?.addLogItem({\r\n time: Date.now(),\r\n className: this.getClassName(),\r\n uniqueId: this.uniqueId,\r\n action: FlowGraphAction.ContextVariableSet,\r\n payload: {\r\n name,\r\n value,\r\n },\r\n });\r\n }\r\n\r\n /**\r\n * Get an assets from the assets context based on its type and index in the array\r\n * @param type The type of the asset\r\n * @param index The index of the asset\r\n * @returns The asset or null if not found\r\n */\r\n public getAsset<T extends FlowGraphAssetType>(type: T, index: number): Nullable<AssetType<T>> {\r\n return GetFlowGraphAssetWithType(this.assetsContext, type, index);\r\n }\r\n\r\n /**\r\n * Get a user-defined variable.\r\n * @param name the name of the variable\r\n * @returns the value of the variable\r\n */\r\n public getVariable(name: string): any {\r\n this.logger?.addLogItem({\r\n time: Date.now(),\r\n className: this.getClassName(),\r\n uniqueId: this.uniqueId,\r\n action: FlowGraphAction.ContextVariableGet,\r\n payload: {\r\n name,\r\n value: this._userVariables[name],\r\n },\r\n });\r\n return this._userVariables[name];\r\n }\r\n\r\n /**\r\n * Gets all user variables map\r\n */\r\n public get userVariables() {\r\n return this._userVariables;\r\n }\r\n\r\n /**\r\n * Set the declared type annotation for a user variable.\r\n * @param name - the variable name\r\n * @param typeName - the type name string (e.g. \"number\", \"Vector3\", \"Mesh\")\r\n */\r\n public setVariableType(name: string, typeName: string): void {\r\n this._variableTypes[name] = typeName;\r\n }\r\n\r\n /**\r\n * Get the declared type annotation for a user variable.\r\n * @param name - the variable name\r\n * @returns the type name string, or undefined if no type was declared\r\n */\r\n public getVariableType(name: string): string | undefined {\r\n return this._variableTypes[name];\r\n }\r\n\r\n /**\r\n * Gets all variable type annotations.\r\n */\r\n public get variableTypes(): { [key: string]: string } {\r\n return this._variableTypes;\r\n }\r\n\r\n /**\r\n * Get the scene that the context belongs to.\r\n * @returns the scene\r\n */\r\n public getScene() {\r\n return this._configuration.scene;\r\n }\r\n\r\n private _getUniqueIdPrefixedName(obj: FlowGraphBlock, name: string): string {\r\n return `${obj.uniqueId}_${name}`;\r\n }\r\n\r\n /**\r\n * @internal\r\n * @param name name of the variable\r\n * @param defaultValue default value to return if the variable is not defined\r\n * @returns the variable value or the default value if the variable is not defined\r\n */\r\n public _getGlobalContextVariable<T>(name: string, defaultValue: T): T {\r\n this.logger?.addLogItem({\r\n time: Date.now(),\r\n className: this.getClassName(),\r\n uniqueId: this.uniqueId,\r\n action: FlowGraphAction.GlobalVariableGet,\r\n payload: {\r\n name,\r\n defaultValue,\r\n possibleValue: this._globalContextVariables[name],\r\n },\r\n });\r\n if (this._hasGlobalContextVariable(name)) {\r\n return this._globalContextVariables[name];\r\n } else {\r\n return defaultValue;\r\n }\r\n }\r\n\r\n /**\r\n * Set a global context variable\r\n * @internal\r\n * @param name the name of the variable\r\n * @param value the value of the variable\r\n */\r\n public _setGlobalContextVariable<T>(name: string, value: T) {\r\n this.logger?.addLogItem({\r\n time: Date.now(),\r\n className: this.getClassName(),\r\n uniqueId: this.uniqueId,\r\n action: FlowGraphAction.GlobalVariableSet,\r\n payload: { name, value },\r\n });\r\n this._globalContextVariables[name] = value;\r\n }\r\n\r\n /**\r\n * Delete a global context variable\r\n * @internal\r\n * @param name the name of the variable\r\n */\r\n public _deleteGlobalContextVariable(name: string) {\r\n this.logger?.addLogItem({\r\n time: Date.now(),\r\n className: this.getClassName(),\r\n uniqueId: this.uniqueId,\r\n action: FlowGraphAction.GlobalVariableDelete,\r\n payload: { name },\r\n });\r\n delete this._globalContextVariables[name];\r\n }\r\n\r\n /**\r\n * Check if a global context variable is defined\r\n * @internal\r\n * @param name the name of the variable\r\n * @returns true if the variable is defined\r\n */\r\n public _hasGlobalContextVariable(name: string) {\r\n return name in this._globalContextVariables;\r\n }\r\n\r\n /**\r\n * Set an internal execution variable\r\n * @internal\r\n * @param name\r\n * @param value\r\n */\r\n public _setExecutionVariable(block: FlowGraphBlock, name: string, value: any) {\r\n this._executionVariables[this._getUniqueIdPrefixedName(block, name)] = value;\r\n }\r\n\r\n /**\r\n * Get an internal execution variable\r\n * @internal\r\n * @param name\r\n * @returns\r\n */\r\n public _getExecutionVariable<T>(block: FlowGraphBlock, name: string, defaultValue: T): T {\r\n if (this._hasExecutionVariable(block, name)) {\r\n return this._executionVariables[this._getUniqueIdPrefixedName(block, name)];\r\n } else {\r\n return defaultValue;\r\n }\r\n }\r\n\r\n /**\r\n * Delete an internal execution variable\r\n * @internal\r\n * @param block\r\n * @param name\r\n */\r\n public _deleteExecutionVariable(block: FlowGraphBlock, name: string) {\r\n delete this._executionVariables[this._getUniqueIdPrefixedName(block, name)];\r\n }\r\n\r\n /**\r\n * Check if an internal execution variable is defined\r\n * @internal\r\n * @param block\r\n * @param name\r\n * @returns\r\n */\r\n public _hasExecutionVariable(block: FlowGraphBlock, name: string) {\r\n return this._getUniqueIdPrefixedName(block, name) in this._executionVariables;\r\n }\r\n\r\n /**\r\n * Check if a connection value is defined\r\n * @internal\r\n * @param connectionPoint\r\n * @returns\r\n */\r\n public _hasConnectionValue(connectionPoint: FlowGraphDataConnection<any>) {\r\n return connectionPoint.uniqueId in this._connectionValues;\r\n }\r\n\r\n /**\r\n * Set a connection value\r\n * @internal\r\n * @param connectionPoint\r\n * @param value\r\n */\r\n public _setConnectionValue<T>(connectionPoint: FlowGraphDataConnection<T>, value: T) {\r\n this._connectionValues[connectionPoint.uniqueId] = value;\r\n this.logger?.addLogItem({\r\n time: Date.now(),\r\n className: this.getClassName(),\r\n uniqueId: this.uniqueId,\r\n action: FlowGraphAction.SetConnectionValue,\r\n payload: {\r\n connectionPointId: connectionPoint.uniqueId,\r\n value,\r\n },\r\n });\r\n }\r\n\r\n /**\r\n * Set a connection value by key\r\n * @internal\r\n * @param key the key of the connection value\r\n * @param value the value of the connection\r\n */\r\n public _setConnectionValueByKey<T>(key: string, value: T) {\r\n this._connectionValues[key] = value;\r\n }\r\n\r\n /**\r\n * Get a connection value\r\n * @internal\r\n * @param connectionPoint\r\n * @returns\r\n */\r\n public _getConnectionValue<T>(connectionPoint: FlowGraphDataConnection<T>): T {\r\n this.logger?.addLogItem({\r\n time: Date.now(),\r\n className: this.getClassName(),\r\n uniqueId: this.uniqueId,\r\n action: FlowGraphAction.GetConnectionValue,\r\n payload: {\r\n connectionPointId: connectionPoint.uniqueId,\r\n value: this._connectionValues[connectionPoint.uniqueId],\r\n },\r\n });\r\n return this._connectionValues[connectionPoint.uniqueId];\r\n }\r\n\r\n /**\r\n * Get the configuration\r\n * @internal\r\n * @param name\r\n * @param value\r\n */\r\n public get configuration() {\r\n return this._configuration;\r\n }\r\n\r\n /**\r\n * Check if there are any pending blocks in this context\r\n * @returns true if there are pending blocks\r\n */\r\n public get hasPendingBlocks() {\r\n return this._pendingBlocks.length > 0;\r\n }\r\n\r\n /**\r\n * Add a block to the list of blocks that have pending tasks.\r\n * @internal\r\n * @param block\r\n */\r\n public _addPendingBlock(block: FlowGraphAsyncExecutionBlock) {\r\n // check if block is already in the array\r\n if (this._pendingBlocks.includes(block)) {\r\n return;\r\n }\r\n this._pendingBlocks.push(block);\r\n // sort pending blocks by priority\r\n this._pendingBlocks.sort((a, b) => a.priority - b.priority);\r\n }\r\n\r\n /**\r\n * Remove a block from the list of blocks that have pending tasks.\r\n * @internal\r\n * @param block\r\n */\r\n public _removePendingBlock(block: FlowGraphAsyncExecutionBlock) {\r\n const index = this._pendingBlocks.indexOf(block);\r\n if (index !== -1) {\r\n this._pendingBlocks.splice(index, 1);\r\n }\r\n }\r\n\r\n /**\r\n * Clear all pending blocks.\r\n * @internal\r\n */\r\n public _clearPendingBlocks() {\r\n for (const block of this._pendingBlocks) {\r\n block._cancelPendingTasks(this);\r\n }\r\n this._pendingBlocks.length = 0;\r\n }\r\n\r\n /**\r\n * @internal\r\n * Function that notifies the node executed observable\r\n * @param node\r\n */\r\n public _notifyExecuteNode(node: FlowGraphBlock) {\r\n this.onNodeExecutedObservable.notifyObservers(node);\r\n this.logger?.addLogItem({\r\n time: Date.now(),\r\n className: node.getClassName(),\r\n uniqueId: node.uniqueId,\r\n action: FlowGraphAction.ExecuteBlock,\r\n });\r\n }\r\n\r\n public _notifyOnTick(framePayload: IFlowGraphOnTickEventPayload) {\r\n // set the values as global variables\r\n this._setGlobalContextVariable(\"timeSinceStart\", framePayload.timeSinceStart);\r\n this._setGlobalContextVariable(\"deltaTime\", framePayload.deltaTime);\r\n // iterate the pending blocks and run each one's onFrame function\r\n for (const block of this._pendingBlocks) {\r\n block._executeOnTick?.(this);\r\n }\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public _increaseExecutionId() {\r\n this._executionId++;\r\n }\r\n /**\r\n * A monotonically increasing ID for each execution.\r\n * Incremented for every block executed.\r\n */\r\n public get executionId() {\r\n return this._executionId;\r\n }\r\n\r\n // ── Breakpoint API ─────────────────────────────────────────────────\r\n\r\n /**\r\n * Check whether the given block should break before executing.\r\n * Called by the signal connection infrastructure.\r\n * @internal\r\n * @param block the block about to execute\r\n * @param signal the signal that is triggering the execution\r\n * @returns true if execution should be paused (breakpoint hit)\r\n */\r\n public _shouldBreak(block: FlowGraphExecutionBlock, signal: FlowGraphSignalConnection): boolean {\r\n // If continue/step just resumed this specific block, let it through\r\n if (this._skipBreakpointForBlockId === block.uniqueId) {\r\n this._skipBreakpointForBlockId = null;\r\n return false;\r\n }\r\n\r\n // If already paused on a breakpoint, silently block further execution\r\n // without overwriting the pending activation or re-notifying observers.\r\n if (this._pendingActivation) {\r\n return true;\r\n }\r\n\r\n if (this._stepMode) {\r\n this._stepMode = false;\r\n this._pendingActivation = { block, context: this, signal };\r\n this.onBreakpointHitObservable.notifyObservers(this._pendingActivation);\r\n return true;\r\n }\r\n if (this.breakpointPredicate && this.breakpointPredicate(block)) {\r\n this._pendingActivation = { block, context: this, signal };\r\n this.onBreakpointHitObservable.notifyObservers(this._pendingActivation);\r\n return true;\r\n }\r\n return false;\r\n }\r\n\r\n /**\r\n * Returns the currently paused activation, or null if not paused.\r\n */\r\n public get pendingActivation(): Nullable<IFlowGraphPendingActivation> {\r\n return this._pendingActivation;\r\n }\r\n\r\n /**\r\n * Resume execution from a breakpoint hit.\r\n * The paused block and all downstream blocks will execute normally until\r\n * the next breakpoint (if any) is hit.\r\n */\r\n public continueExecution(): void {\r\n const pending = this._pendingActivation;\r\n if (!pending) {\r\n return;\r\n }\r\n this._pendingActivation = null;\r\n // Tell _shouldBreak to skip the breakpoint for this block on re-entry\r\n this._skipBreakpointForBlockId = pending.block.uniqueId;\r\n pending.signal._activateSignal(this);\r\n // Clear in case no re-entry happened (shouldn't linger)\r\n this._skipBreakpointForBlockId = null;\r\n }\r\n\r\n /**\r\n * Execute exactly the paused block and then pause again before the next\r\n * execution block fires. If no activation is pending, this is a no-op.\r\n */\r\n public stepExecution(): void {\r\n const pending = this._pendingActivation;\r\n if (!pending) {\r\n return;\r\n }\r\n this._pendingActivation = null;\r\n // Enable step mode so the very next input-signal activation will pause\r\n this._stepMode = true;\r\n // Tell _shouldBreak to skip the breakpoint for this block on re-entry\r\n this._skipBreakpointForBlockId = pending.block.uniqueId;\r\n pending.signal._activateSignal(this);\r\n // If nothing further executed (end of chain), clear step mode\r\n this._stepMode = false;\r\n this._skipBreakpointForBlockId = null;\r\n }\r\n\r\n /**\r\n * Discard any pending breakpoint activation without resuming.\r\n * Used when stopping or resetting the graph.\r\n * @internal\r\n */\r\n public _clearPendingActivation(): void {\r\n this._pendingActivation = null;\r\n this._stepMode = false;\r\n this._skipBreakpointForBlockId = null;\r\n }\r\n\r\n /**\r\n * Serializes a context\r\n * @param serializationObject the object to write the values in\r\n * @param valueSerializationFunction a function to serialize complex values\r\n */\r\n public serialize(serializationObject: any = {}, valueSerializationFunction: (key: string, value: any, serializationObject: any) => void = defaultValueSerializationFunction) {\r\n serializationObject.uniqueId = this.uniqueId;\r\n serializationObject.name = this.name;\r\n serializationObject._userVariables = {};\r\n for (const key in this._userVariables) {\r\n valueSerializationFunction(key, this._userVariables[key], serializationObject._userVariables);\r\n }\r\n // Persist variable type annotations (editor metadata)\r\n if (Object.keys(this._variableTypes).length > 0) {\r\n serializationObject._variableTypes = { ...this._variableTypes };\r\n }\r\n serializationObject._connectionValues = {};\r\n for (const key in this._connectionValues) {\r\n valueSerializationFunction(key, this._connectionValues[key], serializationObject._connectionValues);\r\n }\r\n // serialize assets context, if not scene\r\n if (this.assetsContext !== this.getScene()) {\r\n serializationObject._assetsContext = {\r\n meshes: this.assetsContext.meshes.map((m) => m.id),\r\n materials: this.assetsContext.materials.map((m) => m.id),\r\n textures: this.assetsContext.textures.map((m) => m.name),\r\n animations: this.assetsContext.animations.map((m) => m.name),\r\n lights: this.assetsContext.lights.map((m) => m.id),\r\n cameras: this.assetsContext.cameras.map((m) => m.id),\r\n sounds: this.assetsContext.sounds?.map((m) => m.name),\r\n skeletons: this.assetsContext.skeletons.map((m) => m.id),\r\n particleSystems: this.assetsContext.particleSystems.map((m) => m.name),\r\n geometries: this.assetsContext.geometries.map((m) => m.id),\r\n multiMaterials: this.assetsContext.multiMaterials.map((m) => m.id),\r\n transformNodes: this.assetsContext.transformNodes.map((m) => m.id),\r\n };\r\n }\r\n }\r\n\r\n /**\r\n * @returns the class name of the object.\r\n */\r\n public getClassName() {\r\n return \"FlowGraphContext\";\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"flowGraphContext.js","sourceRoot":"","sources":["../../../../dev/core/src/FlowGraph/flowGraphContext.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAM1C,OAAO,EAAE,iCAAiC,EAAE,MAAM,iBAAiB,CAAC;AAGpE,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAA2C,yBAAyB,EAAE,MAAM,0BAA0B,CAAC;AAG9G,OAAO,EAAmB,eAAe,EAAE,MAAM,mBAAmB,CAAC;AA8DrE;;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AE,CAAC,CAAC,CAAC,EAAE,CAAC;gBACxD,eAAe,EAAE,IAAI,CAAC,aAAa,CAAC,eAAe,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;gBACtE,UAAU,EAAE,IAAI,CAAC,aAAa,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;gBAC1D,cAAc,EAAE,IAAI,CAAC,aAAa,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;gBAClE,cAAc,EAAE,IAAI,CAAC,aAAa,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;aACrE,CAAC;QACN,CAAC;IACL,CAAC;IAED;;OAEG;IACI,YAAY;QACf,OAAO,kBAAkB,CAAC;IAC9B,CAAC;CACJ;AA5nBU;IADN,SAAS,EAAE;kDACmB;AAMxB;IADN,SAAS,EAAE;8CACa","sourcesContent":["import { serialize } from \"../Misc/decorators\";\r\nimport { RandomGUID } from \"../Misc/guid\";\r\nimport { type Scene } from \"../scene\";\r\nimport { type FlowGraphAsyncExecutionBlock } from \"./flowGraphAsyncExecutionBlock\";\r\nimport { type FlowGraphBlock } from \"./flowGraphBlock\";\r\nimport { type FlowGraphDataConnection } from \"./flowGraphDataConnection\";\r\nimport { type FlowGraph } from \"./flowGraph\";\r\nimport { defaultValueSerializationFunction } from \"./serialization\";\r\nimport { type FlowGraphCoordinator } from \"./flowGraphCoordinator\";\r\nimport { type FlowGraphSceneEventCoordinator } from \"./flowGraphSceneEventCoordinator\";\r\nimport { Observable } from \"../Misc/observable\";\r\nimport { type AssetType, type FlowGraphAssetType, GetFlowGraphAssetWithType } from \"./flowGraphAssetsContext\";\r\nimport { type IAssetContainer } from \"core/IAssetContainer\";\r\nimport { type Nullable } from \"core/types\";\r\nimport { FlowGraphAction, FlowGraphLogger } from \"./flowGraphLogger\";\r\nimport { type IFlowGraphOnTickEventPayload } from \"./Blocks/Event/flowGraphSceneTickEventBlock\";\r\nimport { type FlowGraphExecutionBlock } from \"./flowGraphExecutionBlock\";\r\nimport { type FlowGraphSignalConnection } from \"./flowGraphSignalConnection\";\r\n\r\n/**\r\n * Represents a pending signal activation that was paused by a breakpoint.\r\n */\r\nexport interface IFlowGraphPendingActivation {\r\n /** The block that was about to execute */\r\n readonly block: FlowGraphExecutionBlock;\r\n /** The context in which execution was paused */\r\n readonly context: FlowGraphContext;\r\n /** The signal connection that triggered the execution */\r\n readonly signal: FlowGraphSignalConnection;\r\n}\r\n/**\r\n * Construction parameters for the context.\r\n */\r\nexport interface IFlowGraphContextConfiguration {\r\n /**\r\n * The scene that the flow graph context belongs to.\r\n */\r\n readonly scene: Scene;\r\n /**\r\n * The event coordinator used by the flow graph context.\r\n */\r\n readonly coordinator: FlowGraphCoordinator;\r\n\r\n /**\r\n * The scene event coordinator that tracks runtime event state\r\n * (e.g. currently pressed keyboard keys).\r\n * When not provided, keyboard polling blocks (e.g. IsKeyPressed) will\r\n * report no keys pressed.\r\n */\r\n readonly sceneEventCoordinator?: FlowGraphSceneEventCoordinator;\r\n\r\n /**\r\n * The assets context used by the flow graph context.\r\n * If none is provided, a default one will be created.\r\n */\r\n readonly assetsContext?: IAssetContainer;\r\n}\r\n\r\n/**\r\n * Options for parsing a context.\r\n */\r\nexport interface IFlowGraphContextParseOptions {\r\n /**\r\n * A function that parses a value from a serialization object.\r\n * @param key the key of the value\r\n * @param serializationObject the object containing the value\r\n * @param assetsContainer the assets container\r\n * @param scene the current scene\r\n * @returns\r\n */\r\n readonly valueParseFunction?: (key: string, serializationObject: any, assetsContainer: IAssetContainer, scene: Scene) => any;\r\n /**\r\n * The graph that the context is being parsed in.\r\n */\r\n readonly graph: FlowGraph;\r\n}\r\n/**\r\n * The context represents the current state and execution of the flow graph.\r\n * It contains both user-defined variables, which are derived from\r\n * a more general variable definition, and execution variables that\r\n * are set by the blocks.\r\n */\r\nexport class FlowGraphContext {\r\n /**\r\n * A randomly generated GUID for each context.\r\n */\r\n @serialize()\r\n public uniqueId = RandomGUID();\r\n /**\r\n * An optional user-facing name for the context.\r\n * Defaults to an empty string; the editor may assign a label like \"Context 0\".\r\n */\r\n @serialize()\r\n public name: string = \"\";\r\n /**\r\n * These are the variables defined by a user.\r\n */\r\n private _userVariables: { [key: string]: any } = {};\r\n /**\r\n * Optional type annotations for user variables.\r\n * Keys are variable names; values are type name strings (e.g. \"number\", \"Vector3\", \"Mesh\").\r\n * This map is maintained by the editor and persisted through serialization so\r\n * that a variable's declared type survives even when its value is undefined.\r\n */\r\n private _variableTypes: { [key: string]: string } = {};\r\n /**\r\n * These are the variables set by the blocks.\r\n */\r\n private _executionVariables: { [key: string]: any } = {};\r\n\r\n /**\r\n * A context-specific global variables, available to all blocks in the context.\r\n */\r\n private _globalContextVariables: { [key: string]: any } = {};\r\n /**\r\n * These are the values for the data connection points\r\n */\r\n private _connectionValues: { [key: string]: any } = {};\r\n /**\r\n * These are the variables set by the graph.\r\n */\r\n private readonly _configuration: IFlowGraphContextConfiguration;\r\n /**\r\n * These are blocks that have currently pending tasks/listeners that need to be cleaned up.\r\n */\r\n private _pendingBlocks: FlowGraphAsyncExecutionBlock[] = [];\r\n /**\r\n * A monotonically increasing ID for each execution.\r\n * Incremented for every block executed.\r\n */\r\n private _executionId = 0;\r\n /**\r\n * Observable that is triggered when a node is executed.\r\n */\r\n public onNodeExecutedObservable: Observable<FlowGraphBlock> = new Observable<FlowGraphBlock>();\r\n\r\n /**\r\n * Observable triggered when a breakpoint is hit.\r\n * Observers receive the pending activation (block, context, signal) that was paused.\r\n */\r\n public onBreakpointHitObservable: Observable<IFlowGraphPendingActivation> = new Observable<IFlowGraphPendingActivation>();\r\n\r\n /**\r\n * A predicate called before each execution block runs.\r\n * If it returns true, execution is paused before the block and a\r\n * pending activation is stored, which can be resumed via\r\n * {@link continueExecution} or {@link stepExecution}.\r\n *\r\n * Set to `null` to disable breakpoint checking.\r\n */\r\n public breakpointPredicate: Nullable<(block: FlowGraphExecutionBlock) => boolean> = null;\r\n\r\n /**\r\n * The activation that is currently paused due to a breakpoint hit.\r\n * `null` when execution is not paused on a breakpoint.\r\n */\r\n private _pendingActivation: Nullable<IFlowGraphPendingActivation> = null;\r\n\r\n /**\r\n * When true, the next activation will pause regardless of the breakpoint predicate.\r\n * Set by {@link stepExecution}.\r\n */\r\n private _stepMode: boolean = false;\r\n\r\n /**\r\n * When set, the breakpoint check is skipped for this specific block uniqueId\r\n * on the very next call to {@link _shouldBreak}. Used by continue/step to avoid\r\n * immediately re-hitting the breakpoint on the block being resumed.\r\n */\r\n private _skipBreakpointForBlockId: Nullable<string> = null;\r\n\r\n /**\r\n * The assets context used by the flow graph context.\r\n * Note that it can be shared between flow graph contexts.\r\n */\r\n public assetsContext: IAssetContainer;\r\n\r\n /**\r\n * Whether to treat data as right-handed.\r\n * This is used when serializing data from a right-handed system, while running the context in a left-handed system, for example in glTF parsing.\r\n * Default is false.\r\n */\r\n public treatDataAsRightHanded = false;\r\n\r\n private _enableLogging = false;\r\n\r\n /**\r\n * The logger used by the context to log actions.\r\n */\r\n public logger: Nullable<FlowGraphLogger>;\r\n\r\n /**\r\n * Enable logging on this context\r\n */\r\n public get enableLogging() {\r\n return this._enableLogging;\r\n }\r\n\r\n public set enableLogging(value: boolean) {\r\n if (this._enableLogging === value) {\r\n return;\r\n }\r\n this._enableLogging = value;\r\n if (this._enableLogging) {\r\n this.logger = new FlowGraphLogger();\r\n this.logger.logToConsole = true;\r\n } else {\r\n this.logger = null;\r\n }\r\n }\r\n\r\n constructor(params: IFlowGraphContextConfiguration) {\r\n this._configuration = params;\r\n this.assetsContext = params.assetsContext ?? params.scene;\r\n }\r\n\r\n /**\r\n * Check if a user-defined variable is defined.\r\n * @param name the name of the variable\r\n * @returns true if the variable is defined\r\n */\r\n public hasVariable(name: string) {\r\n return name in this._userVariables;\r\n }\r\n\r\n /**\r\n * Set a user-defined variable.\r\n * @param name the name of the variable\r\n * @param value the value of the variable\r\n */\r\n public setVariable(name: string, value: any) {\r\n this._userVariables[name] = value;\r\n this.logger?.addLogItem({\r\n time: Date.now(),\r\n className: this.getClassName(),\r\n uniqueId: this.uniqueId,\r\n action: FlowGraphAction.ContextVariableSet,\r\n payload: {\r\n name,\r\n value,\r\n },\r\n });\r\n }\r\n\r\n /**\r\n * Get an assets from the assets context based on its type and index in the array\r\n * @param type The type of the asset\r\n * @param index The index of the asset\r\n * @returns The asset or null if not found\r\n */\r\n public getAsset<T extends FlowGraphAssetType>(type: T, index: number): Nullable<AssetType<T>> {\r\n return GetFlowGraphAssetWithType(this.assetsContext, type, index);\r\n }\r\n\r\n /**\r\n * Get a user-defined variable.\r\n * @param name the name of the variable\r\n * @returns the value of the variable\r\n */\r\n public getVariable(name: string): any {\r\n this.logger?.addLogItem({\r\n time: Date.now(),\r\n className: this.getClassName(),\r\n uniqueId: this.uniqueId,\r\n action: FlowGraphAction.ContextVariableGet,\r\n payload: {\r\n name,\r\n value: this._userVariables[name],\r\n },\r\n });\r\n return this._userVariables[name];\r\n }\r\n\r\n /**\r\n * Gets all user variables map\r\n */\r\n public get userVariables() {\r\n return this._userVariables;\r\n }\r\n\r\n /**\r\n * Set the declared type annotation for a user variable.\r\n * @param name - the variable name\r\n * @param typeName - the type name string (e.g. \"number\", \"Vector3\", \"Mesh\")\r\n */\r\n public setVariableType(name: string, typeName: string): void {\r\n this._variableTypes[name] = typeName;\r\n }\r\n\r\n /**\r\n * Get the declared type annotation for a user variable.\r\n * @param name - the variable name\r\n * @returns the type name string, or undefined if no type was declared\r\n */\r\n public getVariableType(name: string): string | undefined {\r\n return this._variableTypes[name];\r\n }\r\n\r\n /**\r\n * Gets all variable type annotations.\r\n */\r\n public get variableTypes(): { [key: string]: string } {\r\n return this._variableTypes;\r\n }\r\n\r\n /**\r\n * Get the scene that the context belongs to.\r\n * @returns the scene\r\n */\r\n public getScene() {\r\n return this._configuration.scene;\r\n }\r\n\r\n private _getUniqueIdPrefixedName(obj: FlowGraphBlock, name: string): string {\r\n return `${obj.uniqueId}_${name}`;\r\n }\r\n\r\n /**\r\n * @internal\r\n * @param name name of the variable\r\n * @param defaultValue default value to return if the variable is not defined\r\n * @returns the variable value or the default value if the variable is not defined\r\n */\r\n public _getGlobalContextVariable<T>(name: string, defaultValue: T): T {\r\n this.logger?.addLogItem({\r\n time: Date.now(),\r\n className: this.getClassName(),\r\n uniqueId: this.uniqueId,\r\n action: FlowGraphAction.GlobalVariableGet,\r\n payload: {\r\n name,\r\n defaultValue,\r\n possibleValue: this._globalContextVariables[name],\r\n },\r\n });\r\n if (this._hasGlobalContextVariable(name)) {\r\n return this._globalContextVariables[name];\r\n } else {\r\n return defaultValue;\r\n }\r\n }\r\n\r\n /**\r\n * Set a global context variable\r\n * @internal\r\n * @param name the name of the variable\r\n * @param value the value of the variable\r\n */\r\n public _setGlobalContextVariable<T>(name: string, value: T) {\r\n this.logger?.addLogItem({\r\n time: Date.now(),\r\n className: this.getClassName(),\r\n uniqueId: this.uniqueId,\r\n action: FlowGraphAction.GlobalVariableSet,\r\n payload: { name, value },\r\n });\r\n this._globalContextVariables[name] = value;\r\n }\r\n\r\n /**\r\n * Delete a global context variable\r\n * @internal\r\n * @param name the name of the variable\r\n */\r\n public _deleteGlobalContextVariable(name: string) {\r\n this.logger?.addLogItem({\r\n time: Date.now(),\r\n className: this.getClassName(),\r\n uniqueId: this.uniqueId,\r\n action: FlowGraphAction.GlobalVariableDelete,\r\n payload: { name },\r\n });\r\n delete this._globalContextVariables[name];\r\n }\r\n\r\n /**\r\n * Check if a global context variable is defined\r\n * @internal\r\n * @param name the name of the variable\r\n * @returns true if the variable is defined\r\n */\r\n public _hasGlobalContextVariable(name: string) {\r\n return name in this._globalContextVariables;\r\n }\r\n\r\n /**\r\n * Set an internal execution variable\r\n * @internal\r\n * @param name\r\n * @param value\r\n */\r\n public _setExecutionVariable(block: FlowGraphBlock, name: string, value: any) {\r\n this._executionVariables[this._getUniqueIdPrefixedName(block, name)] = value;\r\n }\r\n\r\n /**\r\n * Get an internal execution variable\r\n * @internal\r\n * @param name\r\n * @returns\r\n */\r\n public _getExecutionVariable<T>(block: FlowGraphBlock, name: string, defaultValue: T): T {\r\n if (this._hasExecutionVariable(block, name)) {\r\n return this._executionVariables[this._getUniqueIdPrefixedName(block, name)];\r\n } else {\r\n return defaultValue;\r\n }\r\n }\r\n\r\n /**\r\n * Delete an internal execution variable\r\n * @internal\r\n * @param block\r\n * @param name\r\n */\r\n public _deleteExecutionVariable(block: FlowGraphBlock, name: string) {\r\n delete this._executionVariables[this._getUniqueIdPrefixedName(block, name)];\r\n }\r\n\r\n /**\r\n * Check if an internal execution variable is defined\r\n * @internal\r\n * @param block\r\n * @param name\r\n * @returns\r\n */\r\n public _hasExecutionVariable(block: FlowGraphBlock, name: string) {\r\n return this._getUniqueIdPrefixedName(block, name) in this._executionVariables;\r\n }\r\n\r\n /**\r\n * Check if a connection value is defined\r\n * @internal\r\n * @param connectionPoint\r\n * @returns\r\n */\r\n public _hasConnectionValue(connectionPoint: FlowGraphDataConnection<any>) {\r\n return connectionPoint.uniqueId in this._connectionValues;\r\n }\r\n\r\n /**\r\n * Set a connection value\r\n * @internal\r\n * @param connectionPoint\r\n * @param value\r\n */\r\n public _setConnectionValue<T>(connectionPoint: FlowGraphDataConnection<T>, value: T) {\r\n this._connectionValues[connectionPoint.uniqueId] = value;\r\n this.logger?.addLogItem({\r\n time: Date.now(),\r\n className: this.getClassName(),\r\n uniqueId: this.uniqueId,\r\n action: FlowGraphAction.SetConnectionValue,\r\n payload: {\r\n connectionPointId: connectionPoint.uniqueId,\r\n value,\r\n },\r\n });\r\n }\r\n\r\n /**\r\n * Set a connection value by key\r\n * @internal\r\n * @param key the key of the connection value\r\n * @param value the value of the connection\r\n */\r\n public _setConnectionValueByKey<T>(key: string, value: T) {\r\n this._connectionValues[key] = value;\r\n }\r\n\r\n /**\r\n * Get a connection value\r\n * @internal\r\n * @param connectionPoint\r\n * @returns\r\n */\r\n public _getConnectionValue<T>(connectionPoint: FlowGraphDataConnection<T>): T {\r\n this.logger?.addLogItem({\r\n time: Date.now(),\r\n className: this.getClassName(),\r\n uniqueId: this.uniqueId,\r\n action: FlowGraphAction.GetConnectionValue,\r\n payload: {\r\n connectionPointId: connectionPoint.uniqueId,\r\n value: this._connectionValues[connectionPoint.uniqueId],\r\n },\r\n });\r\n return this._connectionValues[connectionPoint.uniqueId];\r\n }\r\n\r\n /**\r\n * Get the configuration\r\n * @internal\r\n * @param name\r\n * @param value\r\n */\r\n public get configuration() {\r\n return this._configuration;\r\n }\r\n\r\n /**\r\n * Check if there are any pending blocks in this context\r\n * @returns true if there are pending blocks\r\n */\r\n public get hasPendingBlocks() {\r\n return this._pendingBlocks.length > 0;\r\n }\r\n\r\n /**\r\n * Add a block to the list of blocks that have pending tasks.\r\n * @internal\r\n * @param block\r\n */\r\n public _addPendingBlock(block: FlowGraphAsyncExecutionBlock) {\r\n // check if block is already in the array\r\n if (this._pendingBlocks.includes(block)) {\r\n return;\r\n }\r\n this._pendingBlocks.push(block);\r\n // sort pending blocks by priority\r\n this._pendingBlocks.sort((a, b) => a.priority - b.priority);\r\n }\r\n\r\n /**\r\n * Remove a block from the list of blocks that have pending tasks.\r\n * @internal\r\n * @param block\r\n */\r\n public _removePendingBlock(block: FlowGraphAsyncExecutionBlock) {\r\n const index = this._pendingBlocks.indexOf(block);\r\n if (index !== -1) {\r\n this._pendingBlocks.splice(index, 1);\r\n }\r\n }\r\n\r\n /**\r\n * Clear all pending blocks.\r\n * @internal\r\n */\r\n public _clearPendingBlocks() {\r\n for (const block of this._pendingBlocks) {\r\n block._cancelPendingTasks(this);\r\n }\r\n this._pendingBlocks.length = 0;\r\n }\r\n\r\n /**\r\n * @internal\r\n * Function that notifies the node executed observable\r\n * @param node\r\n */\r\n public _notifyExecuteNode(node: FlowGraphBlock) {\r\n this.onNodeExecutedObservable.notifyObservers(node);\r\n this.logger?.addLogItem({\r\n time: Date.now(),\r\n className: node.getClassName(),\r\n uniqueId: node.uniqueId,\r\n action: FlowGraphAction.ExecuteBlock,\r\n });\r\n }\r\n\r\n public _notifyOnTick(framePayload: IFlowGraphOnTickEventPayload) {\r\n // set the values as global variables\r\n this._setGlobalContextVariable(\"timeSinceStart\", framePayload.timeSinceStart);\r\n this._setGlobalContextVariable(\"deltaTime\", framePayload.deltaTime);\r\n // iterate the pending blocks and run each one's onFrame function\r\n for (const block of this._pendingBlocks) {\r\n block._executeOnTick?.(this);\r\n }\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public _increaseExecutionId() {\r\n this._executionId++;\r\n }\r\n /**\r\n * A monotonically increasing ID for each execution.\r\n * Incremented for every block executed.\r\n */\r\n public get executionId() {\r\n return this._executionId;\r\n }\r\n\r\n // ── Breakpoint API ─────────────────────────────────────────────────\r\n\r\n /**\r\n * Check whether the given block should break before executing.\r\n * Called by the signal connection infrastructure.\r\n * @internal\r\n * @param block the block about to execute\r\n * @param signal the signal that is triggering the execution\r\n * @returns true if execution should be paused (breakpoint hit)\r\n */\r\n public _shouldBreak(block: FlowGraphExecutionBlock, signal: FlowGraphSignalConnection): boolean {\r\n // If continue/step just resumed this specific block, let it through\r\n if (this._skipBreakpointForBlockId === block.uniqueId) {\r\n this._skipBreakpointForBlockId = null;\r\n return false;\r\n }\r\n\r\n // If already paused on a breakpoint, silently block further execution\r\n // without overwriting the pending activation or re-notifying observers.\r\n if (this._pendingActivation) {\r\n return true;\r\n }\r\n\r\n if (this._stepMode) {\r\n this._stepMode = false;\r\n this._pendingActivation = { block, context: this, signal };\r\n this.onBreakpointHitObservable.notifyObservers(this._pendingActivation);\r\n return true;\r\n }\r\n if (this.breakpointPredicate && this.breakpointPredicate(block)) {\r\n this._pendingActivation = { block, context: this, signal };\r\n this.onBreakpointHitObservable.notifyObservers(this._pendingActivation);\r\n return true;\r\n }\r\n return false;\r\n }\r\n\r\n /**\r\n * Returns the currently paused activation, or null if not paused.\r\n */\r\n public get pendingActivation(): Nullable<IFlowGraphPendingActivation> {\r\n return this._pendingActivation;\r\n }\r\n\r\n /**\r\n * Resume execution from a breakpoint hit.\r\n * The paused block and all downstream blocks will execute normally until\r\n * the next breakpoint (if any) is hit.\r\n */\r\n public continueExecution(): void {\r\n const pending = this._pendingActivation;\r\n if (!pending) {\r\n return;\r\n }\r\n this._pendingActivation = null;\r\n // Tell _shouldBreak to skip the breakpoint for this block on re-entry\r\n this._skipBreakpointForBlockId = pending.block.uniqueId;\r\n pending.signal._activateSignal(this);\r\n // Clear in case no re-entry happened (shouldn't linger)\r\n this._skipBreakpointForBlockId = null;\r\n }\r\n\r\n /**\r\n * Execute exactly the paused block and then pause again before the next\r\n * execution block fires. If no activation is pending, this is a no-op.\r\n */\r\n public stepExecution(): void {\r\n const pending = this._pendingActivation;\r\n if (!pending) {\r\n return;\r\n }\r\n this._pendingActivation = null;\r\n // Enable step mode so the very next input-signal activation will pause\r\n this._stepMode = true;\r\n // Tell _shouldBreak to skip the breakpoint for this block on re-entry\r\n this._skipBreakpointForBlockId = pending.block.uniqueId;\r\n pending.signal._activateSignal(this);\r\n // If nothing further executed (end of chain), clear step mode\r\n this._stepMode = false;\r\n this._skipBreakpointForBlockId = null;\r\n }\r\n\r\n /**\r\n * Discard any pending breakpoint activation without resuming.\r\n * Used when stopping or resetting the graph.\r\n * @internal\r\n */\r\n public _clearPendingActivation(): void {\r\n this._pendingActivation = null;\r\n this._stepMode = false;\r\n this._skipBreakpointForBlockId = null;\r\n }\r\n\r\n /**\r\n * Serializes a context\r\n * @param serializationObject the object to write the values in\r\n * @param valueSerializationFunction a function to serialize complex values\r\n */\r\n public serialize(serializationObject: any = {}, valueSerializationFunction: (key: string, value: any, serializationObject: any) => void = defaultValueSerializationFunction) {\r\n serializationObject.uniqueId = this.uniqueId;\r\n serializationObject.name = this.name;\r\n serializationObject._userVariables = {};\r\n for (const key in this._userVariables) {\r\n valueSerializationFunction(key, this._userVariables[key], serializationObject._userVariables);\r\n }\r\n // Persist variable type annotations (editor metadata)\r\n if (Object.keys(this._variableTypes).length > 0) {\r\n serializationObject._variableTypes = { ...this._variableTypes };\r\n }\r\n serializationObject._connectionValues = {};\r\n for (const key in this._connectionValues) {\r\n valueSerializationFunction(key, this._connectionValues[key], serializationObject._connectionValues);\r\n }\r\n // serialize assets context, if not scene\r\n if (this.assetsContext !== this.getScene()) {\r\n serializationObject._assetsContext = {\r\n meshes: this.assetsContext.meshes.map((m) => m.id),\r\n materials: this.assetsContext.materials.map((m) => m.id),\r\n textures: this.assetsContext.textures.map((m) => m.name),\r\n animations: this.assetsContext.animations.map((m) => m.name),\r\n lights: this.assetsContext.lights.map((m) => m.id),\r\n cameras: this.assetsContext.cameras.map((m) => m.id),\r\n sounds: this.assetsContext.sounds?.map((m) => m.name),\r\n skeletons: this.assetsContext.skeletons.map((m) => m.id),\r\n particleSystems: this.assetsContext.particleSystems.map((m) => m.name),\r\n geometries: this.assetsContext.geometries.map((m) => m.id),\r\n multiMaterials: this.assetsContext.multiMaterials.map((m) => m.id),\r\n transformNodes: this.assetsContext.transformNodes.map((m) => m.id),\r\n };\r\n }\r\n }\r\n\r\n /**\r\n * @returns the class name of the object.\r\n */\r\n public getClassName() {\r\n return \"FlowGraphContext\";\r\n }\r\n}\r\n"]}
|
|
@@ -13,6 +13,8 @@ export var FlowGraphEventType;
|
|
|
13
13
|
FlowGraphEventType["PointerMove"] = "PointerMove";
|
|
14
14
|
FlowGraphEventType["PointerOver"] = "PointerOver";
|
|
15
15
|
FlowGraphEventType["PointerOut"] = "PointerOut";
|
|
16
|
+
FlowGraphEventType["KeyDown"] = "KeyDown";
|
|
17
|
+
FlowGraphEventType["KeyUp"] = "KeyUp";
|
|
16
18
|
FlowGraphEventType["NoTrigger"] = "NoTrigger";
|
|
17
19
|
})(FlowGraphEventType || (FlowGraphEventType = {}));
|
|
18
20
|
//# sourceMappingURL=flowGraphEventType.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"flowGraphEventType.js","sourceRoot":"","sources":["../../../../dev/core/src/FlowGraph/flowGraphEventType.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,CAAN,IAAkB,
|
|
1
|
+
{"version":3,"file":"flowGraphEventType.js","sourceRoot":"","sources":["../../../../dev/core/src/FlowGraph/flowGraphEventType.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,CAAN,IAAkB,kBAcjB;AAdD,WAAkB,kBAAkB;IAChC,+CAAyB,CAAA;IACzB,mDAA6B,CAAA;IAC7B,6DAAuC,CAAA;IACvC,2DAAqC,CAAA;IACrC,2CAAqB,CAAA;IACrB,iDAA2B,CAAA;IAC3B,6CAAuB,CAAA;IACvB,iDAA2B,CAAA;IAC3B,iDAA2B,CAAA;IAC3B,+CAAyB,CAAA;IACzB,yCAAmB,CAAA;IACnB,qCAAe,CAAA;IACf,6CAAuB,CAAA;AAC3B,CAAC,EAdiB,kBAAkB,KAAlB,kBAAkB,QAcnC","sourcesContent":["/**\n * Event types supported by the FlowGraph.\n */\nexport const enum FlowGraphEventType {\n SceneReady = \"SceneReady\",\n SceneDispose = \"SceneDispose\",\n SceneBeforeRender = \"SceneBeforeRender\",\n SceneAfterRender = \"SceneAfterRender\",\n MeshPick = \"MeshPick\",\n PointerDown = \"PointerDown\",\n PointerUp = \"PointerUp\",\n PointerMove = \"PointerMove\",\n PointerOver = \"PointerOver\",\n PointerOut = \"PointerOut\",\n KeyDown = \"KeyDown\",\n KeyUp = \"KeyUp\",\n NoTrigger = \"NoTrigger\",\n}\n"]}
|
|
@@ -41,6 +41,20 @@ export declare class FlowGraphSceneEventCoordinator {
|
|
|
41
41
|
private _pointerUpObserver;
|
|
42
42
|
private _pointerMoveObserver;
|
|
43
43
|
private _pointerUnderMeshState;
|
|
44
|
+
private _keyDownObserver;
|
|
45
|
+
private _keyUpObserver;
|
|
46
|
+
private _onBlurHandler;
|
|
47
|
+
/**
|
|
48
|
+
* The set of keys currently pressed, keyed by `event.code`.
|
|
49
|
+
* Keyboard event blocks use this to determine whether a key is held.
|
|
50
|
+
*
|
|
51
|
+
* In addition to physical key codes, a virtual `"CommandOrControl"` entry
|
|
52
|
+
* is maintained: it tracks Meta (Cmd) on macOS and Ctrl on Windows/Linux,
|
|
53
|
+
* enabling platform-agnostic shortcut checks via the IsKeyPressed block.
|
|
54
|
+
*/
|
|
55
|
+
readonly pressedKeys: Set<string>;
|
|
56
|
+
/** The physical key codes that map to the virtual CommandOrControl key on this platform. */
|
|
57
|
+
private static readonly _COMMAND_OR_CTRL_CODES;
|
|
44
58
|
private _startingTime;
|
|
45
59
|
constructor(scene: Scene);
|
|
46
60
|
private _initialize;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { PointerEventTypes } from "../Events/pointerEvents.js";
|
|
2
|
+
import { KeyboardEventTypes } from "../Events/keyboardEvents.js";
|
|
2
3
|
import { Observable } from "../Misc/observable.js";
|
|
4
|
+
import { _IsMacPlatform } from "./utils.js";
|
|
3
5
|
/**
|
|
4
6
|
* This class is responsible for coordinating the events that are triggered in the scene.
|
|
5
7
|
* It registers all observers needed to track certain events and triggers the blocks that are listening to them.
|
|
@@ -16,6 +18,16 @@ export class FlowGraphSceneEventCoordinator {
|
|
|
16
18
|
*/
|
|
17
19
|
this.sceneReadyTriggered = false;
|
|
18
20
|
this._pointerUnderMeshState = {};
|
|
21
|
+
this._onBlurHandler = null;
|
|
22
|
+
/**
|
|
23
|
+
* The set of keys currently pressed, keyed by `event.code`.
|
|
24
|
+
* Keyboard event blocks use this to determine whether a key is held.
|
|
25
|
+
*
|
|
26
|
+
* In addition to physical key codes, a virtual `"CommandOrControl"` entry
|
|
27
|
+
* is maintained: it tracks Meta (Cmd) on macOS and Ctrl on Windows/Linux,
|
|
28
|
+
* enabling platform-agnostic shortcut checks via the IsKeyPressed block.
|
|
29
|
+
*/
|
|
30
|
+
this.pressedKeys = new Set();
|
|
19
31
|
this._startingTime = 0;
|
|
20
32
|
this._scene = scene;
|
|
21
33
|
this._initialize();
|
|
@@ -73,6 +85,40 @@ export class FlowGraphSceneEventCoordinator {
|
|
|
73
85
|
}
|
|
74
86
|
this._pointerUnderMeshState[pointerId] = mesh;
|
|
75
87
|
}, PointerEventTypes.POINTERMOVE);
|
|
88
|
+
this._keyDownObserver = this._scene.onKeyboardObservable.add((keyboardInfo) => {
|
|
89
|
+
const code = keyboardInfo.event.code;
|
|
90
|
+
this.pressedKeys.add(code);
|
|
91
|
+
if (FlowGraphSceneEventCoordinator._COMMAND_OR_CTRL_CODES.has(code)) {
|
|
92
|
+
this.pressedKeys.add("CommandOrControl");
|
|
93
|
+
}
|
|
94
|
+
this.onEventTriggeredObservable.notifyObservers({ type: "KeyDown" /* FlowGraphEventType.KeyDown */, payload: keyboardInfo });
|
|
95
|
+
}, KeyboardEventTypes.KEYDOWN);
|
|
96
|
+
this._keyUpObserver = this._scene.onKeyboardObservable.add((keyboardInfo) => {
|
|
97
|
+
const code = keyboardInfo.event.code;
|
|
98
|
+
this.pressedKeys.delete(code);
|
|
99
|
+
if (FlowGraphSceneEventCoordinator._COMMAND_OR_CTRL_CODES.has(code)) {
|
|
100
|
+
// Only remove CommandOrControl if neither left nor right is still held
|
|
101
|
+
let stillHeld = false;
|
|
102
|
+
for (const c of Array.from(FlowGraphSceneEventCoordinator._COMMAND_OR_CTRL_CODES)) {
|
|
103
|
+
if (c !== code && this.pressedKeys.has(c)) {
|
|
104
|
+
stillHeld = true;
|
|
105
|
+
break;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
if (!stillHeld) {
|
|
109
|
+
this.pressedKeys.delete("CommandOrControl");
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
this.onEventTriggeredObservable.notifyObservers({ type: "KeyUp" /* FlowGraphEventType.KeyUp */, payload: keyboardInfo });
|
|
113
|
+
}, KeyboardEventTypes.KEYUP);
|
|
114
|
+
// Clear all tracked keys when the window/tab loses focus.
|
|
115
|
+
// Without this, held keys would appear "stuck" after an Alt-Tab
|
|
116
|
+
// because the keyup event fires in the other window.
|
|
117
|
+
const canvas = this._scene.getEngine().getRenderingCanvas();
|
|
118
|
+
if (canvas) {
|
|
119
|
+
this._onBlurHandler = () => this.pressedKeys.clear();
|
|
120
|
+
canvas.addEventListener("blur", this._onBlurHandler);
|
|
121
|
+
}
|
|
76
122
|
}
|
|
77
123
|
dispose() {
|
|
78
124
|
this._sceneDisposeObserver?.remove();
|
|
@@ -83,7 +129,17 @@ export class FlowGraphSceneEventCoordinator {
|
|
|
83
129
|
this._pointerDownObserver?.remove();
|
|
84
130
|
this._pointerUpObserver?.remove();
|
|
85
131
|
this._pointerMoveObserver?.remove();
|
|
132
|
+
this._keyDownObserver?.remove();
|
|
133
|
+
this._keyUpObserver?.remove();
|
|
134
|
+
if (this._onBlurHandler) {
|
|
135
|
+
const canvas = this._scene.getEngine().getRenderingCanvas();
|
|
136
|
+
canvas?.removeEventListener("blur", this._onBlurHandler);
|
|
137
|
+
this._onBlurHandler = null;
|
|
138
|
+
}
|
|
139
|
+
this.pressedKeys.clear();
|
|
86
140
|
this.onEventTriggeredObservable.clear();
|
|
87
141
|
}
|
|
88
142
|
}
|
|
143
|
+
/** The physical key codes that map to the virtual CommandOrControl key on this platform. */
|
|
144
|
+
FlowGraphSceneEventCoordinator._COMMAND_OR_CTRL_CODES = _IsMacPlatform ? new Set(["MetaLeft", "MetaRight"]) : new Set(["ControlLeft", "ControlRight"]);
|
|
89
145
|
//# sourceMappingURL=flowGraphSceneEventCoordinator.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"flowGraphSceneEventCoordinator.js","sourceRoot":"","sources":["../../../../dev/core/src/FlowGraph/flowGraphSceneEventCoordinator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoB,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAEhF,OAAO,EAAiB,UAAU,EAAE,MAAM,sBAAsB,CAAC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QACrC,IAAI,CAAC,mBAAmB,EAAE,MAAM,EAAE,CAAC;QACnC,IAAI,CAAC,4BAA4B,EAAE,MAAM,EAAE,CAAC;QAC5C,IAAI,CAAC,mBAAmB,EAAE,MAAM,EAAE,CAAC;QACnC,IAAI,CAAC,yBAAyB,EAAE,MAAM,EAAE,CAAC;QACzC,IAAI,CAAC,oBAAoB,EAAE,MAAM,EAAE,CAAC;QACpC,IAAI,CAAC,kBAAkB,EAAE,MAAM,EAAE,CAAC;QAClC,IAAI,CAAC,oBAAoB,EAAE,MAAM,EAAE,CAAC;QACpC,IAAI,CAAC,0BAA0B,CAAC,KAAK,EAAE,CAAC;IAC5C,CAAC;CACJ","sourcesContent":["import { type PointerInfo, PointerEventTypes } from \"core/Events/pointerEvents\";\nimport { type AbstractMesh } from \"core/Meshes/abstractMesh\";\nimport { type Observer, Observable } from \"core/Misc/observable\";\nimport { type Scene } from \"core/scene\";\nimport { type Nullable } from \"core/types\";\nimport { FlowGraphEventType } from \"./flowGraphEventType\";\n\n/**\n * the interface of the object the scene event coordinator will trigger.\n */\nexport interface IFlowGraphEventTrigger {\n /**\n * The type of the event\n */\n type: FlowGraphEventType;\n /**\n * The data of the event\n */\n payload?: any;\n}\n\n/**\n * This class is responsible for coordinating the events that are triggered in the scene.\n * It registers all observers needed to track certain events and triggers the blocks that are listening to them.\n * Abstracting the events from the class will allow us to easily change the events that are being listened to, and trigger them in any order.\n */\nexport class FlowGraphSceneEventCoordinator {\n /**\n * @internal\n */\n public readonly _scene: Scene;\n\n /**\n * register to this observable to get flow graph event notifications.\n */\n public onEventTriggeredObservable: Observable<IFlowGraphEventTrigger> = new Observable();\n\n /**\n * Was scene-ready already triggered?\n */\n public sceneReadyTriggered: boolean = false;\n\n private _sceneDisposeObserver: Nullable<Observer<Scene>>;\n private _sceneReadyObserver: Nullable<Observer<Scene>>;\n private _sceneOnBeforeRenderObserver: Nullable<Observer<Scene>>;\n private _meshPickedObserver: Nullable<Observer<PointerInfo>>;\n private _meshUnderPointerObserver: Nullable<Observer<{ mesh: Nullable<AbstractMesh>; pointerId: number }>>;\n private _pointerDownObserver: Nullable<Observer<PointerInfo>>;\n private _pointerUpObserver: Nullable<Observer<PointerInfo>>;\n private _pointerMoveObserver: Nullable<Observer<PointerInfo>>;\n private _pointerUnderMeshState: { [pointerId: number]: Nullable<AbstractMesh> } = {};\n\n private _startingTime: number = 0;\n\n constructor(scene: Scene) {\n this._scene = scene;\n this._initialize();\n }\n\n private _initialize() {\n this._sceneReadyObserver = this._scene.onReadyObservable.addOnce(() => {\n if (!this.sceneReadyTriggered) {\n this.onEventTriggeredObservable.notifyObservers({ type: FlowGraphEventType.SceneReady });\n this.sceneReadyTriggered = true;\n }\n });\n\n this._sceneDisposeObserver = this._scene.onDisposeObservable.add(() => {\n this.onEventTriggeredObservable.notifyObservers({ type: FlowGraphEventType.SceneDispose });\n });\n this._sceneOnBeforeRenderObserver = this._scene.onBeforeRenderObservable.add(() => {\n const deltaTime = this._scene.getEngine().getDeltaTime() / 1000; // set in seconds\n this.onEventTriggeredObservable.notifyObservers({\n type: FlowGraphEventType.SceneBeforeRender,\n payload: {\n timeSinceStart: this._startingTime,\n deltaTime,\n },\n });\n this._startingTime += deltaTime;\n });\n\n this._meshPickedObserver = this._scene.onPointerObservable.add((pointerInfo) => {\n this.onEventTriggeredObservable.notifyObservers({ type: FlowGraphEventType.MeshPick, payload: pointerInfo });\n }, PointerEventTypes.POINTERPICK); // should it be pointerdown?\n\n this._pointerDownObserver = this._scene.onPointerObservable.add((pointerInfo) => {\n this.onEventTriggeredObservable.notifyObservers({ type: FlowGraphEventType.PointerDown, payload: pointerInfo });\n }, PointerEventTypes.POINTERDOWN);\n\n this._pointerUpObserver = this._scene.onPointerObservable.add((pointerInfo) => {\n this.onEventTriggeredObservable.notifyObservers({ type: FlowGraphEventType.PointerUp, payload: pointerInfo });\n }, PointerEventTypes.POINTERUP);\n\n this._pointerMoveObserver = this._scene.onPointerObservable.add((pointerInfo) => {\n this.onEventTriggeredObservable.notifyObservers({ type: FlowGraphEventType.PointerMove, payload: pointerInfo });\n }, PointerEventTypes.POINTERMOVE);\n\n this._meshUnderPointerObserver = this._scene.onMeshUnderPointerUpdatedObservable.add((data) => {\n // check if the data has changed. Check the state of the last change and see if it is a mesh or null.\n // if it is a mesh and the previous state was null, trigger over event. If it is null and the previous state was a mesh, trigger out event.\n // if it is a mesh and the previous state was a mesh, trigger out from the old mesh and over the new mesh\n // if it is null and the previous state was null, do nothing.\n const pointerId = data.pointerId;\n const mesh = data.mesh;\n const previousState = this._pointerUnderMeshState[pointerId];\n if (!previousState && mesh) {\n this.onEventTriggeredObservable.notifyObservers({ type: FlowGraphEventType.PointerOver, payload: { pointerId, mesh } });\n } else if (previousState && !mesh) {\n this.onEventTriggeredObservable.notifyObservers({ type: FlowGraphEventType.PointerOut, payload: { pointerId, mesh: previousState } });\n } else if (previousState && mesh && previousState !== mesh) {\n this.onEventTriggeredObservable.notifyObservers({ type: FlowGraphEventType.PointerOut, payload: { pointerId, mesh: previousState, over: mesh } });\n this.onEventTriggeredObservable.notifyObservers({ type: FlowGraphEventType.PointerOver, payload: { pointerId, mesh, out: previousState } });\n }\n this._pointerUnderMeshState[pointerId] = mesh;\n }, PointerEventTypes.POINTERMOVE);\n }\n\n public dispose() {\n this._sceneDisposeObserver?.remove();\n this._sceneReadyObserver?.remove();\n this._sceneOnBeforeRenderObserver?.remove();\n this._meshPickedObserver?.remove();\n this._meshUnderPointerObserver?.remove();\n this._pointerDownObserver?.remove();\n this._pointerUpObserver?.remove();\n this._pointerMoveObserver?.remove();\n this.onEventTriggeredObservable.clear();\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"flowGraphSceneEventCoordinator.js","sourceRoot":"","sources":["../../../../dev/core/src/FlowGraph/flowGraphSceneEventCoordinator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoB,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAChF,OAAO,EAAqB,kBAAkB,EAAE,MAAM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,CAAC,cAAc,EAAE,CAAC;YACtB,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,SAAS,EAAE,CAAC,kBAAkB,EAAE,CAAC;YAC5D,MAAM,EAAE,mBAAmB,CAAC,MAAM,EAAE,IAAI,CAAC,cAAc,CAAC,CAAC;YACzD,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC;QAC/B,CAAC;QACD,IAAI,CAAC,WAAW,CAAC,KAAK,EAAE,CAAC;QACzB,IAAI,CAAC,0BAA0B,CAAC,KAAK,EAAE,CAAC;IAC5C,CAAC;;AA5HD,4FAA4F;AACpE,qDAAsB,GAAwB,cAAc,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC,CAAC,UAAU,EAAE,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC,CAAC,aAAa,EAAE,cAAc,CAAC,CAAC,AAAtH,CAAuH","sourcesContent":["import { type PointerInfo, PointerEventTypes } from \"core/Events/pointerEvents\";\nimport { type KeyboardInfo, KeyboardEventTypes } from \"core/Events/keyboardEvents\";\nimport { type AbstractMesh } from \"core/Meshes/abstractMesh\";\nimport { type Observer, Observable } from \"core/Misc/observable\";\nimport { type Scene } from \"core/scene\";\nimport { type Nullable } from \"core/types\";\nimport { FlowGraphEventType } from \"./flowGraphEventType\";\nimport { _IsMacPlatform } from \"./utils\";\n\n/**\n * the interface of the object the scene event coordinator will trigger.\n */\nexport interface IFlowGraphEventTrigger {\n /**\n * The type of the event\n */\n type: FlowGraphEventType;\n /**\n * The data of the event\n */\n payload?: any;\n}\n\n/**\n * This class is responsible for coordinating the events that are triggered in the scene.\n * It registers all observers needed to track certain events and triggers the blocks that are listening to them.\n * Abstracting the events from the class will allow us to easily change the events that are being listened to, and trigger them in any order.\n */\nexport class FlowGraphSceneEventCoordinator {\n /**\n * @internal\n */\n public readonly _scene: Scene;\n\n /**\n * register to this observable to get flow graph event notifications.\n */\n public onEventTriggeredObservable: Observable<IFlowGraphEventTrigger> = new Observable();\n\n /**\n * Was scene-ready already triggered?\n */\n public sceneReadyTriggered: boolean = false;\n\n private _sceneDisposeObserver: Nullable<Observer<Scene>>;\n private _sceneReadyObserver: Nullable<Observer<Scene>>;\n private _sceneOnBeforeRenderObserver: Nullable<Observer<Scene>>;\n private _meshPickedObserver: Nullable<Observer<PointerInfo>>;\n private _meshUnderPointerObserver: Nullable<Observer<{ mesh: Nullable<AbstractMesh>; pointerId: number }>>;\n private _pointerDownObserver: Nullable<Observer<PointerInfo>>;\n private _pointerUpObserver: Nullable<Observer<PointerInfo>>;\n private _pointerMoveObserver: Nullable<Observer<PointerInfo>>;\n private _pointerUnderMeshState: { [pointerId: number]: Nullable<AbstractMesh> } = {};\n private _keyDownObserver: Nullable<Observer<KeyboardInfo>>;\n private _keyUpObserver: Nullable<Observer<KeyboardInfo>>;\n private _onBlurHandler: (() => void) | null = null;\n\n /**\n * The set of keys currently pressed, keyed by `event.code`.\n * Keyboard event blocks use this to determine whether a key is held.\n *\n * In addition to physical key codes, a virtual `\"CommandOrControl\"` entry\n * is maintained: it tracks Meta (Cmd) on macOS and Ctrl on Windows/Linux,\n * enabling platform-agnostic shortcut checks via the IsKeyPressed block.\n */\n public readonly pressedKeys: Set<string> = new Set<string>();\n\n /** The physical key codes that map to the virtual CommandOrControl key on this platform. */\n private static readonly _COMMAND_OR_CTRL_CODES: ReadonlySet<string> = _IsMacPlatform ? new Set([\"MetaLeft\", \"MetaRight\"]) : new Set([\"ControlLeft\", \"ControlRight\"]);\n\n private _startingTime: number = 0;\n\n constructor(scene: Scene) {\n this._scene = scene;\n this._initialize();\n }\n\n private _initialize() {\n this._sceneReadyObserver = this._scene.onReadyObservable.addOnce(() => {\n if (!this.sceneReadyTriggered) {\n this.onEventTriggeredObservable.notifyObservers({ type: FlowGraphEventType.SceneReady });\n this.sceneReadyTriggered = true;\n }\n });\n\n this._sceneDisposeObserver = this._scene.onDisposeObservable.add(() => {\n this.onEventTriggeredObservable.notifyObservers({ type: FlowGraphEventType.SceneDispose });\n });\n this._sceneOnBeforeRenderObserver = this._scene.onBeforeRenderObservable.add(() => {\n const deltaTime = this._scene.getEngine().getDeltaTime() / 1000; // set in seconds\n this.onEventTriggeredObservable.notifyObservers({\n type: FlowGraphEventType.SceneBeforeRender,\n payload: {\n timeSinceStart: this._startingTime,\n deltaTime,\n },\n });\n this._startingTime += deltaTime;\n });\n\n this._meshPickedObserver = this._scene.onPointerObservable.add((pointerInfo) => {\n this.onEventTriggeredObservable.notifyObservers({ type: FlowGraphEventType.MeshPick, payload: pointerInfo });\n }, PointerEventTypes.POINTERPICK); // should it be pointerdown?\n\n this._pointerDownObserver = this._scene.onPointerObservable.add((pointerInfo) => {\n this.onEventTriggeredObservable.notifyObservers({ type: FlowGraphEventType.PointerDown, payload: pointerInfo });\n }, PointerEventTypes.POINTERDOWN);\n\n this._pointerUpObserver = this._scene.onPointerObservable.add((pointerInfo) => {\n this.onEventTriggeredObservable.notifyObservers({ type: FlowGraphEventType.PointerUp, payload: pointerInfo });\n }, PointerEventTypes.POINTERUP);\n\n this._pointerMoveObserver = this._scene.onPointerObservable.add((pointerInfo) => {\n this.onEventTriggeredObservable.notifyObservers({ type: FlowGraphEventType.PointerMove, payload: pointerInfo });\n }, PointerEventTypes.POINTERMOVE);\n\n this._meshUnderPointerObserver = this._scene.onMeshUnderPointerUpdatedObservable.add((data) => {\n // check if the data has changed. Check the state of the last change and see if it is a mesh or null.\n // if it is a mesh and the previous state was null, trigger over event. If it is null and the previous state was a mesh, trigger out event.\n // if it is a mesh and the previous state was a mesh, trigger out from the old mesh and over the new mesh\n // if it is null and the previous state was null, do nothing.\n const pointerId = data.pointerId;\n const mesh = data.mesh;\n const previousState = this._pointerUnderMeshState[pointerId];\n if (!previousState && mesh) {\n this.onEventTriggeredObservable.notifyObservers({ type: FlowGraphEventType.PointerOver, payload: { pointerId, mesh } });\n } else if (previousState && !mesh) {\n this.onEventTriggeredObservable.notifyObservers({ type: FlowGraphEventType.PointerOut, payload: { pointerId, mesh: previousState } });\n } else if (previousState && mesh && previousState !== mesh) {\n this.onEventTriggeredObservable.notifyObservers({ type: FlowGraphEventType.PointerOut, payload: { pointerId, mesh: previousState, over: mesh } });\n this.onEventTriggeredObservable.notifyObservers({ type: FlowGraphEventType.PointerOver, payload: { pointerId, mesh, out: previousState } });\n }\n this._pointerUnderMeshState[pointerId] = mesh;\n }, PointerEventTypes.POINTERMOVE);\n\n this._keyDownObserver = this._scene.onKeyboardObservable.add((keyboardInfo) => {\n const code = keyboardInfo.event.code;\n this.pressedKeys.add(code);\n if (FlowGraphSceneEventCoordinator._COMMAND_OR_CTRL_CODES.has(code)) {\n this.pressedKeys.add(\"CommandOrControl\");\n }\n this.onEventTriggeredObservable.notifyObservers({ type: FlowGraphEventType.KeyDown, payload: keyboardInfo });\n }, KeyboardEventTypes.KEYDOWN);\n\n this._keyUpObserver = this._scene.onKeyboardObservable.add((keyboardInfo) => {\n const code = keyboardInfo.event.code;\n this.pressedKeys.delete(code);\n if (FlowGraphSceneEventCoordinator._COMMAND_OR_CTRL_CODES.has(code)) {\n // Only remove CommandOrControl if neither left nor right is still held\n let stillHeld = false;\n for (const c of Array.from(FlowGraphSceneEventCoordinator._COMMAND_OR_CTRL_CODES)) {\n if (c !== code && this.pressedKeys.has(c)) {\n stillHeld = true;\n break;\n }\n }\n if (!stillHeld) {\n this.pressedKeys.delete(\"CommandOrControl\");\n }\n }\n this.onEventTriggeredObservable.notifyObservers({ type: FlowGraphEventType.KeyUp, payload: keyboardInfo });\n }, KeyboardEventTypes.KEYUP);\n\n // Clear all tracked keys when the window/tab loses focus.\n // Without this, held keys would appear \"stuck\" after an Alt-Tab\n // because the keyup event fires in the other window.\n const canvas = this._scene.getEngine().getRenderingCanvas();\n if (canvas) {\n this._onBlurHandler = () => this.pressedKeys.clear();\n canvas.addEventListener(\"blur\", this._onBlurHandler);\n }\n }\n\n public dispose() {\n this._sceneDisposeObserver?.remove();\n this._sceneReadyObserver?.remove();\n this._sceneOnBeforeRenderObserver?.remove();\n this._meshPickedObserver?.remove();\n this._meshUnderPointerObserver?.remove();\n this._pointerDownObserver?.remove();\n this._pointerUpObserver?.remove();\n this._pointerMoveObserver?.remove();\n this._keyDownObserver?.remove();\n this._keyUpObserver?.remove();\n if (this._onBlurHandler) {\n const canvas = this._scene.getEngine().getRenderingCanvas();\n canvas?.removeEventListener(\"blur\", this._onBlurHandler);\n this._onBlurHandler = null;\n }\n this.pressedKeys.clear();\n this.onEventTriggeredObservable.clear();\n }\n}\n"]}
|
package/FlowGraph/utils.d.ts
CHANGED
|
@@ -2,6 +2,13 @@ import { type Matrix, type Quaternion, type Vector2, type Vector3, type Vector4
|
|
|
2
2
|
import { type Node } from "../node.js";
|
|
3
3
|
import { type FlowGraphInteger } from "./CustomTypes/flowGraphInteger.js";
|
|
4
4
|
import { type FlowGraphMatrix2D, type FlowGraphMatrix3D } from "./CustomTypes/flowGraphMatrix.js";
|
|
5
|
+
/**
|
|
6
|
+
* Whether the current platform is macOS / iOS.
|
|
7
|
+
* Used by keyboard blocks to resolve the platform-appropriate
|
|
8
|
+
* "command or control" modifier (Cmd on Mac, Ctrl elsewhere).
|
|
9
|
+
* @internal
|
|
10
|
+
*/
|
|
11
|
+
export declare const _IsMacPlatform: boolean;
|
|
5
12
|
/**
|
|
6
13
|
* @internal
|
|
7
14
|
* Returns if mesh1 is a descendant of mesh2
|
package/FlowGraph/utils.js
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
import { IsNavigatorAvailable } from "../Misc/domManagement.js";
|
|
2
|
+
/**
|
|
3
|
+
* Whether the current platform is macOS / iOS.
|
|
4
|
+
* Used by keyboard blocks to resolve the platform-appropriate
|
|
5
|
+
* "command or control" modifier (Cmd on Mac, Ctrl elsewhere).
|
|
6
|
+
* @internal
|
|
7
|
+
*/
|
|
8
|
+
export const _IsMacPlatform = IsNavigatorAvailable() && /(Mac|iPhone|iPod|iPad)/i.test(navigator.platform);
|
|
1
9
|
/**
|
|
2
10
|
* @internal
|
|
3
11
|
* Returns if mesh1 is a descendant of mesh2
|
package/FlowGraph/utils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../../dev/core/src/FlowGraph/utils.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../../dev/core/src/FlowGraph/utils.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAE/D;;;;;GAKG;AACH,MAAM,CAAC,MAAM,cAAc,GAAY,oBAAoB,EAAE,IAAI,yBAAyB,CAAC,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC;AAEpH;;;;;;GAMG;AACH,MAAM,UAAU,eAAe,CAAC,KAAW,EAAE,KAAW;IACpD,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,IAAI,CAAC,KAAK,CAAC,MAAM,KAAK,KAAK,IAAI,eAAe,CAAC,KAAK,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC;AAChG,CAAC;AAOD;;GAEG;AACH,MAAM,UAAU,eAAe,CAAC,CAAM;IAClC,IAAI,CAAC,CAAC,YAAY,EAAE,CAAC;QACjB,OAAO,CAAC,CAAC,YAAY,EAAE,CAAC;IAC5B,CAAC;IACD,OAAO;AACX,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,+BAA+B,CAAC,SAAiB,EAAE,UAAkB;IACjF,OAAO,CACH,SAAS,KAAK,UAAU;QACxB,CAAC,SAAS,2CAA2B,IAAI,SAAS,2CAA2B,IAAI,SAAS,2CAA2B,IAAI,SAAS,iDAA8B,CAAC,CACpK,CAAC;AACN,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,mBAAmB,CAAC,SAAiB,EAAE,UAAkB;IACrE,OAAO,SAAS,KAAK,UAAU,IAAI,CAAC,SAAS,yCAA0B,IAAI,SAAS,6CAA4B,IAAI,SAAS,6CAA4B,CAAC,CAAC;AAC/J,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,oBAAoB,CAAC,SAAiB,EAAE,UAAkB;IACtE,OAAO,SAAS,KAAK,kBAAkB,IAAI,UAAU,KAAK,kBAAkB,CAAC;AACjF,CAAC;AAED;;;;;GAKG;AACH,gEAAgE;AAChE,MAAM,UAAU,SAAS,CAAC,CAA6B,EAAE,UAAoB;IACzE,MAAM,SAAS,GAAG,OAAO,CAAC,KAAK,QAAQ,IAAI,OAAQ,CAAsB,EAAE,KAAK,KAAK,QAAQ,CAAC;IAC9F,IAAI,SAAS,IAAI,CAAC,UAAU,EAAE,CAAC;QAC3B,OAAO,CAAC,KAAK,CAAC,eAAe,CAAC,CAAoB,CAAC,CAAC,CAAC;IACzD,CAAC;IACD,OAAO,SAAS,CAAC;AACrB,CAAC;AAED;;;;GAIG;AACH,gEAAgE;AAChE,MAAM,UAAU,eAAe,CAAC,CAAkB;IAC9C,OAAO,OAAO,CAAC,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;AAC/C,CAAC","sourcesContent":["import { type Matrix, type Quaternion, type Vector2, type Vector3, type Vector4 } from \"core/Maths/math.vector\";\r\nimport { type Node } from \"../node\";\r\nimport { type FlowGraphInteger } from \"./CustomTypes/flowGraphInteger\";\r\nimport { type FlowGraphMatrix2D, type FlowGraphMatrix3D } from \"./CustomTypes/flowGraphMatrix\";\r\nimport { FlowGraphTypes } from \"./flowGraphRichTypes\";\r\nimport { IsNavigatorAvailable } from \"core/Misc/domManagement\";\r\n\r\n/**\r\n * Whether the current platform is macOS / iOS.\r\n * Used by keyboard blocks to resolve the platform-appropriate\r\n * \"command or control\" modifier (Cmd on Mac, Ctrl elsewhere).\r\n * @internal\r\n */\r\nexport const _IsMacPlatform: boolean = IsNavigatorAvailable() && /(Mac|iPhone|iPod|iPad)/i.test(navigator.platform);\r\n\r\n/**\r\n * @internal\r\n * Returns if mesh1 is a descendant of mesh2\r\n * @param mesh1\r\n * @param mesh2\r\n * @returns\r\n */\r\nexport function _IsDescendantOf(mesh1: Node, mesh2: Node): boolean {\r\n return !!(mesh1.parent && (mesh1.parent === mesh2 || _IsDescendantOf(mesh1.parent, mesh2)));\r\n}\r\n\r\nexport type FlowGraphNumber = number | FlowGraphInteger;\r\nexport type FlowGraphVector = Vector2 | Vector3 | Vector4 | Quaternion;\r\nexport type FlowGraphMatrix = Matrix | FlowGraphMatrix2D | FlowGraphMatrix3D;\r\nexport type FlowGraphMathOperationType = FlowGraphNumber | FlowGraphVector | FlowGraphMatrix | boolean;\r\n\r\n/**\r\n * @internal\r\n */\r\nexport function _GetClassNameOf(v: any) {\r\n if (v.getClassName) {\r\n return v.getClassName();\r\n }\r\n return;\r\n}\r\n\r\n/**\r\n * @internal\r\n * Check if two classname are the same and are vector or quaternion classes.\r\n * @param className the first class name\r\n * @param className2 the second class name\r\n * @returns whether the two class names are the same and are vector or quaternion classes.\r\n */\r\nexport function _AreSameVectorOrQuaternionClass(className: string, className2: string) {\r\n return (\r\n className === className2 &&\r\n (className === FlowGraphTypes.Vector2 || className === FlowGraphTypes.Vector3 || className === FlowGraphTypes.Vector4 || className === FlowGraphTypes.Quaternion)\r\n );\r\n}\r\n\r\n/**\r\n * @internal\r\n * Check if two classname are the same and are matrix classes.\r\n * @param className the first class name\r\n * @param className2 the second class name\r\n * @returns whether the two class names are the same and are matrix classes.\r\n */\r\nexport function _AreSameMatrixClass(className: string, className2: string) {\r\n return className === className2 && (className === FlowGraphTypes.Matrix || className === FlowGraphTypes.Matrix2D || className === FlowGraphTypes.Matrix3D);\r\n}\r\n\r\n/**\r\n * @internal\r\n * Check if two classname are the same and are integer classes.\r\n * @param className the first class name\r\n * @param className2 the second class name\r\n * @returns whether the two class names are the same and are integer classes.\r\n */\r\nexport function _AreSameIntegerClass(className: string, className2: string) {\r\n return className === \"FlowGraphInteger\" && className2 === \"FlowGraphInteger\";\r\n}\r\n\r\n/**\r\n * Check if an object has a numeric value.\r\n * @param a the object to check if it is a number.\r\n * @param validIfNaN whether to consider NaN as a valid number.\r\n * @returns whether a is a FlowGraphNumber (Integer or number).\r\n */\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nexport function isNumeric(a: FlowGraphMathOperationType, validIfNaN?: boolean): a is FlowGraphNumber {\r\n const isNumeric = typeof a === \"number\" || typeof (a as FlowGraphInteger)?.value === \"number\";\r\n if (isNumeric && !validIfNaN) {\r\n return !isNaN(getNumericValue(a as FlowGraphNumber));\r\n }\r\n return isNumeric;\r\n}\r\n\r\n/**\r\n * Get the numeric value of a FlowGraphNumber.\r\n * @param a the object to get the numeric value from.\r\n * @returns the numeric value.\r\n */\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nexport function getNumericValue(a: FlowGraphNumber): number {\r\n return typeof a === \"number\" ? a : a.value;\r\n}\r\n"]}
|
|
@@ -183,8 +183,14 @@ export class GaussianSplattingMaterial extends PushMaterial {
|
|
|
183
183
|
PrepareDefinesForMisc(mesh, scene, this._useLogarithmicDepth, this.pointsCloud, this.fogEnabled, false, defines, undefined, undefined, undefined, this._isVertexOutputInvariant);
|
|
184
184
|
// Values that need to be evaluated on every frame
|
|
185
185
|
PrepareDefinesForFrameBoundValues(scene, engine, this, defines, useInstances, null, true);
|
|
186
|
+
// External config
|
|
187
|
+
this._eventInfo.defines = defines;
|
|
188
|
+
this._eventInfo.mesh = mesh;
|
|
189
|
+
this._callbackPluginEventPrepareDefinesBeforeAttributes(this._eventInfo);
|
|
186
190
|
// Attribs
|
|
187
191
|
PrepareDefinesForAttributes(mesh, defines, false, false);
|
|
192
|
+
// External config
|
|
193
|
+
this._callbackPluginEventPrepareDefines(this._eventInfo);
|
|
188
194
|
// SH is disabled for webGL1
|
|
189
195
|
if (engine.version > 1 || engine.isWebGPU) {
|
|
190
196
|
defines["SH_DEGREE"] = gsMesh.shDegree;
|