@babylonjs/core 8.16.0 → 8.16.1

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.
@@ -28,6 +28,10 @@ export declare class FrameGraph {
28
28
  * Name of the frame graph
29
29
  */
30
30
  name: string;
31
+ /**
32
+ * Gets the unique id of the frame graph
33
+ */
34
+ readonly uniqueId: number;
31
35
  /**
32
36
  * Gets or sets a boolean indicating that texture allocation should be optimized (that is, reuse existing textures when possible to limit GPU memory usage) (default: true)
33
37
  */
@@ -7,6 +7,7 @@ import { FrameGraphTextureManager } from "./frameGraphTextureManager.js";
7
7
  import { Observable } from "../Misc/observable.js";
8
8
  import { _RetryWithInterval } from "../Misc/timingTools.js";
9
9
  import { Logger } from "../Misc/logger.js";
10
+ import { UniqueIdGenerator } from "../Misc/uniqueIdGenerator.js";
10
11
  import "../Engines/Extensions/engine.multiRender.js";
11
12
  import "../Engines/WebGPU/Extensions/engine.multiRender.js";
12
13
  var FrameGraphPassType;
@@ -60,6 +61,10 @@ export class FrameGraph {
60
61
  * Name of the frame graph
61
62
  */
62
63
  this.name = "Frame Graph";
64
+ /**
65
+ * Gets the unique id of the frame graph
66
+ */
67
+ this.uniqueId = UniqueIdGenerator.UniqueId;
63
68
  /**
64
69
  * Gets or sets a boolean indicating that texture allocation should be optimized (that is, reuse existing textures when possible to limit GPU memory usage) (default: true)
65
70
  */
@@ -73,7 +78,7 @@ export class FrameGraph {
73
78
  this.textureManager = new FrameGraphTextureManager(this._engine, debugTextures, scene);
74
79
  this._passContext = new FrameGraphContext(this._engine, this.textureManager, scene);
75
80
  this._renderContext = new FrameGraphRenderContext(this._engine, this.textureManager, scene);
76
- this._scene.frameGraphs.push(this);
81
+ this._scene.addFrameGraph(this);
77
82
  }
78
83
  /**
79
84
  * Gets the class name of the frame graph
@@ -264,10 +269,7 @@ export class FrameGraph {
264
269
  this.clear();
265
270
  this.textureManager._dispose();
266
271
  this._renderContext._dispose();
267
- const index = this._scene.frameGraphs.indexOf(this);
268
- if (index !== -1) {
269
- this._scene.frameGraphs.splice(index, 1);
270
- }
272
+ this._scene.removeFrameGraph(this);
271
273
  }
272
274
  }
273
275
  //# sourceMappingURL=frameGraph.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"frameGraph.js","sourceRoot":"","sources":["../../../../dev/core/src/FrameGraph/frameGraph.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AACvD,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AACpE,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AACtE,OAAO,EAAE,UAAU,EAAE,8BAA6B;AAClD,OAAO,EAAE,kBAAkB,EAAE,+BAA8B;AAC3D,OAAO,EAAE,MAAM,EAAE,0BAAyB;AAE1C,qDAAoD;AACpD,4DAA2D;AAE3D,IAAK,kBAIJ;AAJD,WAAK,kBAAkB;IACnB,+DAAU,CAAA;IACV,+DAAU,CAAA;IACV,2DAAQ,CAAA;AACZ,CAAC,EAJI,kBAAkB,KAAlB,kBAAkB,QAItB;AAED;;;GAGG;AACH,MAAM,OAAO,UAAU;IA6BnB;;OAEG;IACH,IAAW,MAAM;QACb,OAAO,IAAI,CAAC,OAAO,CAAC;IACxB,CAAC;IAED;;OAEG;IACH,IAAW,KAAK;QACZ,OAAO,IAAI,CAAC,MAAM,CAAC;IACvB,CAAC;IAED;;OAEG;IACH,IAAW,KAAK;QACZ,OAAO,IAAI,CAAC,MAAM,CAAC;IACvB,CAAC;IAED;;;OAGG;IACI,wBAAwB;QAC3B,OAAO,IAAI,CAAC,sBAAsB,CAAC;IACvC,CAAC;IAED;;;;;OAKG;IACH,YACI,KAAY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M,GAAG,CAAC,CAAC;QACvB,IAAI,CAAC,cAAc,CAAC,gBAAgB,EAAE,CAAC;QACvC,IAAI,CAAC,qBAAqB,GAAG,IAAI,CAAC;IACtC,CAAC;IAED;;OAEG;IACI,OAAO;QACV,IAAI,CAAC,qBAAqB,EAAE,EAAE,CAAC;QAC/B,IAAI,CAAC,qBAAqB,GAAG,IAAI,CAAC;QAClC,IAAI,CAAC,KAAK,EAAE,CAAC;QACb,IAAI,CAAC,cAAc,CAAC,QAAQ,EAAE,CAAC;QAC/B,IAAI,CAAC,cAAc,CAAC,QAAQ,EAAE,CAAC;QAE/B,MAAM,KAAK,GAAG,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QACpD,IAAI,KAAK,KAAK,CAAC,CAAC,EAAE,CAAC;YACf,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;QAC7C,CAAC;IACL,CAAC;CACJ","sourcesContent":["import type { Scene, AbstractEngine, FrameGraphTask, Nullable, NodeRenderGraph } from \"core/index\";\r\nimport { FrameGraphPass } from \"./Passes/pass\";\r\nimport { FrameGraphRenderPass } from \"./Passes/renderPass\";\r\nimport { FrameGraphCullPass } from \"./Passes/cullPass\";\r\nimport { FrameGraphRenderContext } from \"./frameGraphRenderContext\";\r\nimport { FrameGraphContext } from \"./frameGraphContext\";\r\nimport { FrameGraphTextureManager } from \"./frameGraphTextureManager\";\r\nimport { Observable } from \"core/Misc/observable\";\r\nimport { _RetryWithInterval } from \"core/Misc/timingTools\";\r\nimport { Logger } from \"core/Misc/logger\";\r\n\r\nimport \"core/Engines/Extensions/engine.multiRender\";\r\nimport \"core/Engines/WebGPU/Extensions/engine.multiRender\";\r\n\r\nenum FrameGraphPassType {\r\n Normal = 0,\r\n Render = 1,\r\n Cull = 2,\r\n}\r\n\r\n/**\r\n * Class used to implement a frame graph\r\n * @experimental\r\n */\r\nexport class FrameGraph {\r\n /**\r\n * Gets the texture manager used by the frame graph\r\n */\r\n public readonly textureManager: FrameGraphTextureManager;\r\n\r\n private readonly _engine: AbstractEngine;\r\n private readonly _scene: Scene;\r\n private readonly _tasks: FrameGraphTask[] = [];\r\n private readonly _passContext: FrameGraphContext;\r\n private readonly _renderContext: FrameGraphRenderContext;\r\n private _currentProcessedTask: FrameGraphTask | null = null;\r\n private _whenReadyAsyncCancel: Nullable<() => void> = null;\r\n\r\n /**\r\n * Name of the frame graph\r\n */\r\n public name = \"Frame Graph\";\r\n\r\n /**\r\n * Gets or sets a boolean indicating that texture allocation should be optimized (that is, reuse existing textures when possible to limit GPU memory usage) (default: true)\r\n */\r\n public optimizeTextureAllocation = true;\r\n\r\n /**\r\n * Observable raised when the node render graph is built\r\n */\r\n public onBuildObservable = new Observable<FrameGraph>();\r\n\r\n /**\r\n * Gets the engine used by the frame graph\r\n */\r\n public get engine() {\r\n return this._engine;\r\n }\r\n\r\n /**\r\n * Gets the scene used by the frame graph\r\n */\r\n public get scene() {\r\n return this._scene;\r\n }\r\n\r\n /**\r\n * Gets the list of tasks in the frame graph\r\n */\r\n public get tasks() {\r\n return this._tasks;\r\n }\r\n\r\n /**\r\n * Gets the node render graph linked to the frame graph (if any)\r\n * @returns the linked node render graph or null if none\r\n */\r\n public getLinkedNodeRenderGraph(): Nullable<NodeRenderGraph> {\r\n return this._linkedNodeRenderGraph;\r\n }\r\n\r\n /**\r\n * Constructs the frame graph\r\n * @param scene defines the scene the frame graph is associated with\r\n * @param debugTextures defines a boolean indicating that textures created by the frame graph should be visible in the inspector (default is false)\r\n * @param _linkedNodeRenderGraph defines the linked node render graph (if any)\r\n */\r\n constructor(\r\n scene: Scene,\r\n debugTextures = false,\r\n private readonly _linkedNodeRenderGraph: Nullable<NodeRenderGraph> = null\r\n ) {\r\n this._scene = scene;\r\n this._engine = scene.getEngine();\r\n this.textureManager = new FrameGraphTextureManager(this._engine, debugTextures, scene);\r\n this._passContext = new FrameGraphContext(this._engine, this.textureManager, scene);\r\n this._renderContext = new FrameGraphRenderContext(this._engine, this.textureManager, scene);\r\n\r\n this._scene.frameGraphs.push(this);\r\n }\r\n\r\n /**\r\n * Gets the class name of the frame graph\r\n * @returns the class name\r\n */\r\n public getClassName() {\r\n return \"FrameGraph\";\r\n }\r\n\r\n /**\r\n * Gets a task by name\r\n * @param name Name of the task to get\r\n * @returns The task or undefined if not found\r\n */\r\n public getTaskByName<T extends FrameGraphTask>(name: string): T | undefined {\r\n return this._tasks.find((t) => t.name === name) as T;\r\n }\r\n\r\n /**\r\n * Gets all tasks of a specific type\r\n * @param taskType Type of the task(s) to get\r\n * @returns The list of tasks of the specified type\r\n */\r\n public getTasksByType<T extends FrameGraphTask>(taskType: new (...args: any[]) => T): T[] {\r\n return this._tasks.filter((t) => t instanceof taskType) as T[];\r\n }\r\n\r\n /**\r\n * Adds a task to the frame graph\r\n * @param task Task to add\r\n */\r\n public addTask(task: FrameGraphTask): void {\r\n if (this._currentProcessedTask !== null) {\r\n throw new Error(`FrameGraph.addTask: Can't add the task \"${task.name}\" while another task is currently building (task: ${this._currentProcessedTask.name}).`);\r\n }\r\n\r\n this._tasks.push(task);\r\n }\r\n\r\n /**\r\n * Adds a pass to a task. This method can only be called during a Task.record execution.\r\n * @param name The name of the pass\r\n * @param whenTaskDisabled If true, the pass will be added to the list of passes to execute when the task is disabled (default is false)\r\n * @returns The render pass created\r\n */\r\n public addPass(name: string, whenTaskDisabled = false): FrameGraphPass<FrameGraphContext> {\r\n return this._addPass(name, FrameGraphPassType.Normal, whenTaskDisabled) as FrameGraphPass<FrameGraphContext>;\r\n }\r\n\r\n /**\r\n * Adds a render pass to a task. This method can only be called during a Task.record execution.\r\n * @param name The name of the pass\r\n * @param whenTaskDisabled If true, the pass will be added to the list of passes to execute when the task is disabled (default is false)\r\n * @returns The render pass created\r\n */\r\n public addRenderPass(name: string, whenTaskDisabled = false): FrameGraphRenderPass {\r\n return this._addPass(name, FrameGraphPassType.Render, whenTaskDisabled) as FrameGraphRenderPass;\r\n }\r\n\r\n /**\r\n * Adds a cull pass to a task. This method can only be called during a Task.record execution.\r\n * @param name The name of the pass\r\n * @param whenTaskDisabled If true, the pass will be added to the list of passes to execute when the task is disabled (default is false)\r\n * @returns The cull pass created\r\n */\r\n public addCullPass(name: string, whenTaskDisabled = false): FrameGraphCullPass {\r\n return this._addPass(name, FrameGraphPassType.Cull, whenTaskDisabled) as FrameGraphCullPass;\r\n }\r\n\r\n private _addPass(name: string, passType: FrameGraphPassType, whenTaskDisabled = false): FrameGraphPass<FrameGraphContext> | FrameGraphRenderPass {\r\n if (!this._currentProcessedTask) {\r\n throw new Error(\"FrameGraph: A pass must be created during a Task.record execution only.\");\r\n }\r\n\r\n let pass: FrameGraphPass<FrameGraphContext> | FrameGraphRenderPass;\r\n\r\n switch (passType) {\r\n case FrameGraphPassType.Render:\r\n pass = new FrameGraphRenderPass(name, this._currentProcessedTask, this._renderContext, this._engine);\r\n break;\r\n case FrameGraphPassType.Cull:\r\n pass = new FrameGraphCullPass(name, this._currentProcessedTask, this._passContext, this._engine);\r\n break;\r\n default:\r\n pass = new FrameGraphPass(name, this._currentProcessedTask, this._passContext);\r\n break;\r\n }\r\n\r\n this._currentProcessedTask._addPass(pass, whenTaskDisabled);\r\n\r\n return pass;\r\n }\r\n\r\n /**\r\n * Builds the frame graph.\r\n * This method should be called after all tasks have been added to the frame graph (FrameGraph.addTask) and before the graph is executed (FrameGraph.execute).\r\n */\r\n public build(): void {\r\n this.textureManager._releaseTextures(false);\r\n\r\n try {\r\n for (const task of this._tasks) {\r\n task._reset();\r\n\r\n this._currentProcessedTask = task;\r\n this.textureManager._isRecordingTask = true;\r\n\r\n task.record();\r\n\r\n this.textureManager._isRecordingTask = false;\r\n this._currentProcessedTask = null;\r\n }\r\n\r\n this.textureManager._allocateTextures(this.optimizeTextureAllocation ? this._tasks : undefined);\r\n\r\n for (const task of this._tasks) {\r\n task._checkTask();\r\n }\r\n\r\n for (const task of this._tasks) {\r\n task.onTexturesAllocatedObservable.notifyObservers(this._renderContext);\r\n }\r\n\r\n this.onBuildObservable.notifyObservers(this);\r\n } catch (e) {\r\n this._tasks.length = 0;\r\n this._currentProcessedTask = null;\r\n this.textureManager._isRecordingTask = false;\r\n throw e;\r\n }\r\n }\r\n\r\n /**\r\n * Returns a promise that resolves when the frame graph is ready to be executed\r\n * This method must be called after the graph has been built (FrameGraph.build called)!\r\n * @param timeStep Time step in ms between retries (default is 16)\r\n * @param maxTimeout Maximum time in ms to wait for the graph to be ready (default is 30000)\r\n * @returns The promise that resolves when the graph is ready\r\n */\r\n public async whenReadyAsync(timeStep = 16, maxTimeout = 30000): Promise<void> {\r\n let firstNotReadyTask: FrameGraphTask | null = null;\r\n return await new Promise((resolve) => {\r\n this._whenReadyAsyncCancel = _RetryWithInterval(\r\n () => {\r\n let ready = this._renderContext._isReady();\r\n for (const task of this._tasks) {\r\n const taskIsReady = task.isReady();\r\n if (!taskIsReady && !firstNotReadyTask) {\r\n firstNotReadyTask = task;\r\n }\r\n ready &&= taskIsReady;\r\n }\r\n return ready;\r\n },\r\n () => {\r\n this._whenReadyAsyncCancel = null;\r\n resolve();\r\n },\r\n (err, isTimeout) => {\r\n this._whenReadyAsyncCancel = null;\r\n if (!isTimeout) {\r\n Logger.Error(\"FrameGraph: An unexpected error occurred while waiting for the frame graph to be ready.\");\r\n if (err) {\r\n Logger.Error(err);\r\n if (err.stack) {\r\n Logger.Error(err.stack);\r\n }\r\n }\r\n } else {\r\n Logger.Error(\r\n `FrameGraph: Timeout while waiting for the frame graph to be ready.${firstNotReadyTask ? ` First task not ready: ${firstNotReadyTask.name}` : \"\"}`\r\n );\r\n if (err) {\r\n Logger.Error(err);\r\n }\r\n }\r\n },\r\n timeStep,\r\n maxTimeout\r\n );\r\n });\r\n }\r\n\r\n /**\r\n * Executes the frame graph.\r\n */\r\n public execute(): void {\r\n this._renderContext.bindRenderTarget();\r\n\r\n this.textureManager._updateHistoryTextures();\r\n\r\n for (const task of this._tasks) {\r\n const passes = task._getPasses();\r\n\r\n for (const pass of passes) {\r\n pass._execute();\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Clears the frame graph (remove the tasks and release the textures).\r\n * The frame graph can be built again after this method is called.\r\n */\r\n public clear(): void {\r\n this._whenReadyAsyncCancel?.();\r\n this._whenReadyAsyncCancel = null;\r\n\r\n for (const task of this._tasks) {\r\n task._reset();\r\n }\r\n\r\n this._tasks.length = 0;\r\n this.textureManager._releaseTextures();\r\n this._currentProcessedTask = null;\r\n }\r\n\r\n /**\r\n * Disposes the frame graph\r\n */\r\n public dispose(): void {\r\n this._whenReadyAsyncCancel?.();\r\n this._whenReadyAsyncCancel = null;\r\n this.clear();\r\n this.textureManager._dispose();\r\n this._renderContext._dispose();\r\n\r\n const index = this._scene.frameGraphs.indexOf(this);\r\n if (index !== -1) {\r\n this._scene.frameGraphs.splice(index, 1);\r\n }\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"frameGraph.js","sourceRoot":"","sources":["../../../../dev/core/src/FrameGraph/frameGraph.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AACvD,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AACpE,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AACtE,OAAO,EAAE,UAAU,EAAE,8BAA6B;AAClD,OAAO,EAAE,kBAAkB,EAAE,+BAA8B;AAC3D,OAAO,EAAE,MAAM,EAAE,0BAAyB;AAC1C,OAAO,EAAE,iBAAiB,EAAE,qCAAoC;AAEhE,qDAAoD;AACpD,4DAA2D;AAE3D,IAAK,kBAIJ;AAJD,WAAK,kBAAkB;IACnB,+DAAU,C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C,sBAAsB,EAAE,CAAC;QAE7C,KAAK,MAAM,IAAI,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC;YAC7B,MAAM,MAAM,GAAG,IAAI,CAAC,UAAU,EAAE,CAAC;YAEjC,KAAK,MAAM,IAAI,IAAI,MAAM,EAAE,CAAC;gBACxB,IAAI,CAAC,QAAQ,EAAE,CAAC;YACpB,CAAC;QACL,CAAC;IACL,CAAC;IAED;;;OAGG;IACI,KAAK;QACR,IAAI,CAAC,qBAAqB,EAAE,EAAE,CAAC;QAC/B,IAAI,CAAC,qBAAqB,GAAG,IAAI,CAAC;QAElC,KAAK,MAAM,IAAI,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC;YAC7B,IAAI,CAAC,MAAM,EAAE,CAAC;QAClB,CAAC;QAED,IAAI,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC;QACvB,IAAI,CAAC,cAAc,CAAC,gBAAgB,EAAE,CAAC;QACvC,IAAI,CAAC,qBAAqB,GAAG,IAAI,CAAC;IACtC,CAAC;IAED;;OAEG;IACI,OAAO;QACV,IAAI,CAAC,qBAAqB,EAAE,EAAE,CAAC;QAC/B,IAAI,CAAC,qBAAqB,GAAG,IAAI,CAAC;QAClC,IAAI,CAAC,KAAK,EAAE,CAAC;QACb,IAAI,CAAC,cAAc,CAAC,QAAQ,EAAE,CAAC;QAC/B,IAAI,CAAC,cAAc,CAAC,QAAQ,EAAE,CAAC;QAE/B,IAAI,CAAC,MAAM,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC;IACvC,CAAC;CACJ","sourcesContent":["import type { Scene, AbstractEngine, FrameGraphTask, Nullable, NodeRenderGraph } from \"core/index\";\r\nimport { FrameGraphPass } from \"./Passes/pass\";\r\nimport { FrameGraphRenderPass } from \"./Passes/renderPass\";\r\nimport { FrameGraphCullPass } from \"./Passes/cullPass\";\r\nimport { FrameGraphRenderContext } from \"./frameGraphRenderContext\";\r\nimport { FrameGraphContext } from \"./frameGraphContext\";\r\nimport { FrameGraphTextureManager } from \"./frameGraphTextureManager\";\r\nimport { Observable } from \"core/Misc/observable\";\r\nimport { _RetryWithInterval } from \"core/Misc/timingTools\";\r\nimport { Logger } from \"core/Misc/logger\";\r\nimport { UniqueIdGenerator } from \"core/Misc/uniqueIdGenerator\";\r\n\r\nimport \"core/Engines/Extensions/engine.multiRender\";\r\nimport \"core/Engines/WebGPU/Extensions/engine.multiRender\";\r\n\r\nenum FrameGraphPassType {\r\n Normal = 0,\r\n Render = 1,\r\n Cull = 2,\r\n}\r\n\r\n/**\r\n * Class used to implement a frame graph\r\n * @experimental\r\n */\r\nexport class FrameGraph {\r\n /**\r\n * Gets the texture manager used by the frame graph\r\n */\r\n public readonly textureManager: FrameGraphTextureManager;\r\n\r\n private readonly _engine: AbstractEngine;\r\n private readonly _scene: Scene;\r\n private readonly _tasks: FrameGraphTask[] = [];\r\n private readonly _passContext: FrameGraphContext;\r\n private readonly _renderContext: FrameGraphRenderContext;\r\n private _currentProcessedTask: FrameGraphTask | null = null;\r\n private _whenReadyAsyncCancel: Nullable<() => void> = null;\r\n\r\n /**\r\n * Name of the frame graph\r\n */\r\n public name = \"Frame Graph\";\r\n\r\n /**\r\n * Gets the unique id of the frame graph\r\n */\r\n public readonly uniqueId = UniqueIdGenerator.UniqueId;\r\n\r\n /**\r\n * Gets or sets a boolean indicating that texture allocation should be optimized (that is, reuse existing textures when possible to limit GPU memory usage) (default: true)\r\n */\r\n public optimizeTextureAllocation = true;\r\n\r\n /**\r\n * Observable raised when the node render graph is built\r\n */\r\n public onBuildObservable = new Observable<FrameGraph>();\r\n\r\n /**\r\n * Gets the engine used by the frame graph\r\n */\r\n public get engine() {\r\n return this._engine;\r\n }\r\n\r\n /**\r\n * Gets the scene used by the frame graph\r\n */\r\n public get scene() {\r\n return this._scene;\r\n }\r\n\r\n /**\r\n * Gets the list of tasks in the frame graph\r\n */\r\n public get tasks() {\r\n return this._tasks;\r\n }\r\n\r\n /**\r\n * Gets the node render graph linked to the frame graph (if any)\r\n * @returns the linked node render graph or null if none\r\n */\r\n public getLinkedNodeRenderGraph(): Nullable<NodeRenderGraph> {\r\n return this._linkedNodeRenderGraph;\r\n }\r\n\r\n /**\r\n * Constructs the frame graph\r\n * @param scene defines the scene the frame graph is associated with\r\n * @param debugTextures defines a boolean indicating that textures created by the frame graph should be visible in the inspector (default is false)\r\n * @param _linkedNodeRenderGraph defines the linked node render graph (if any)\r\n */\r\n constructor(\r\n scene: Scene,\r\n debugTextures = false,\r\n private readonly _linkedNodeRenderGraph: Nullable<NodeRenderGraph> = null\r\n ) {\r\n this._scene = scene;\r\n this._engine = scene.getEngine();\r\n this.textureManager = new FrameGraphTextureManager(this._engine, debugTextures, scene);\r\n this._passContext = new FrameGraphContext(this._engine, this.textureManager, scene);\r\n this._renderContext = new FrameGraphRenderContext(this._engine, this.textureManager, scene);\r\n\r\n this._scene.addFrameGraph(this);\r\n }\r\n\r\n /**\r\n * Gets the class name of the frame graph\r\n * @returns the class name\r\n */\r\n public getClassName() {\r\n return \"FrameGraph\";\r\n }\r\n\r\n /**\r\n * Gets a task by name\r\n * @param name Name of the task to get\r\n * @returns The task or undefined if not found\r\n */\r\n public getTaskByName<T extends FrameGraphTask>(name: string): T | undefined {\r\n return this._tasks.find((t) => t.name === name) as T;\r\n }\r\n\r\n /**\r\n * Gets all tasks of a specific type\r\n * @param taskType Type of the task(s) to get\r\n * @returns The list of tasks of the specified type\r\n */\r\n public getTasksByType<T extends FrameGraphTask>(taskType: new (...args: any[]) => T): T[] {\r\n return this._tasks.filter((t) => t instanceof taskType) as T[];\r\n }\r\n\r\n /**\r\n * Adds a task to the frame graph\r\n * @param task Task to add\r\n */\r\n public addTask(task: FrameGraphTask): void {\r\n if (this._currentProcessedTask !== null) {\r\n throw new Error(`FrameGraph.addTask: Can't add the task \"${task.name}\" while another task is currently building (task: ${this._currentProcessedTask.name}).`);\r\n }\r\n\r\n this._tasks.push(task);\r\n }\r\n\r\n /**\r\n * Adds a pass to a task. This method can only be called during a Task.record execution.\r\n * @param name The name of the pass\r\n * @param whenTaskDisabled If true, the pass will be added to the list of passes to execute when the task is disabled (default is false)\r\n * @returns The render pass created\r\n */\r\n public addPass(name: string, whenTaskDisabled = false): FrameGraphPass<FrameGraphContext> {\r\n return this._addPass(name, FrameGraphPassType.Normal, whenTaskDisabled) as FrameGraphPass<FrameGraphContext>;\r\n }\r\n\r\n /**\r\n * Adds a render pass to a task. This method can only be called during a Task.record execution.\r\n * @param name The name of the pass\r\n * @param whenTaskDisabled If true, the pass will be added to the list of passes to execute when the task is disabled (default is false)\r\n * @returns The render pass created\r\n */\r\n public addRenderPass(name: string, whenTaskDisabled = false): FrameGraphRenderPass {\r\n return this._addPass(name, FrameGraphPassType.Render, whenTaskDisabled) as FrameGraphRenderPass;\r\n }\r\n\r\n /**\r\n * Adds a cull pass to a task. This method can only be called during a Task.record execution.\r\n * @param name The name of the pass\r\n * @param whenTaskDisabled If true, the pass will be added to the list of passes to execute when the task is disabled (default is false)\r\n * @returns The cull pass created\r\n */\r\n public addCullPass(name: string, whenTaskDisabled = false): FrameGraphCullPass {\r\n return this._addPass(name, FrameGraphPassType.Cull, whenTaskDisabled) as FrameGraphCullPass;\r\n }\r\n\r\n private _addPass(name: string, passType: FrameGraphPassType, whenTaskDisabled = false): FrameGraphPass<FrameGraphContext> | FrameGraphRenderPass {\r\n if (!this._currentProcessedTask) {\r\n throw new Error(\"FrameGraph: A pass must be created during a Task.record execution only.\");\r\n }\r\n\r\n let pass: FrameGraphPass<FrameGraphContext> | FrameGraphRenderPass;\r\n\r\n switch (passType) {\r\n case FrameGraphPassType.Render:\r\n pass = new FrameGraphRenderPass(name, this._currentProcessedTask, this._renderContext, this._engine);\r\n break;\r\n case FrameGraphPassType.Cull:\r\n pass = new FrameGraphCullPass(name, this._currentProcessedTask, this._passContext, this._engine);\r\n break;\r\n default:\r\n pass = new FrameGraphPass(name, this._currentProcessedTask, this._passContext);\r\n break;\r\n }\r\n\r\n this._currentProcessedTask._addPass(pass, whenTaskDisabled);\r\n\r\n return pass;\r\n }\r\n\r\n /**\r\n * Builds the frame graph.\r\n * This method should be called after all tasks have been added to the frame graph (FrameGraph.addTask) and before the graph is executed (FrameGraph.execute).\r\n */\r\n public build(): void {\r\n this.textureManager._releaseTextures(false);\r\n\r\n try {\r\n for (const task of this._tasks) {\r\n task._reset();\r\n\r\n this._currentProcessedTask = task;\r\n this.textureManager._isRecordingTask = true;\r\n\r\n task.record();\r\n\r\n this.textureManager._isRecordingTask = false;\r\n this._currentProcessedTask = null;\r\n }\r\n\r\n this.textureManager._allocateTextures(this.optimizeTextureAllocation ? this._tasks : undefined);\r\n\r\n for (const task of this._tasks) {\r\n task._checkTask();\r\n }\r\n\r\n for (const task of this._tasks) {\r\n task.onTexturesAllocatedObservable.notifyObservers(this._renderContext);\r\n }\r\n\r\n this.onBuildObservable.notifyObservers(this);\r\n } catch (e) {\r\n this._tasks.length = 0;\r\n this._currentProcessedTask = null;\r\n this.textureManager._isRecordingTask = false;\r\n throw e;\r\n }\r\n }\r\n\r\n /**\r\n * Returns a promise that resolves when the frame graph is ready to be executed\r\n * This method must be called after the graph has been built (FrameGraph.build called)!\r\n * @param timeStep Time step in ms between retries (default is 16)\r\n * @param maxTimeout Maximum time in ms to wait for the graph to be ready (default is 30000)\r\n * @returns The promise that resolves when the graph is ready\r\n */\r\n public async whenReadyAsync(timeStep = 16, maxTimeout = 30000): Promise<void> {\r\n let firstNotReadyTask: FrameGraphTask | null = null;\r\n return await new Promise((resolve) => {\r\n this._whenReadyAsyncCancel = _RetryWithInterval(\r\n () => {\r\n let ready = this._renderContext._isReady();\r\n for (const task of this._tasks) {\r\n const taskIsReady = task.isReady();\r\n if (!taskIsReady && !firstNotReadyTask) {\r\n firstNotReadyTask = task;\r\n }\r\n ready &&= taskIsReady;\r\n }\r\n return ready;\r\n },\r\n () => {\r\n this._whenReadyAsyncCancel = null;\r\n resolve();\r\n },\r\n (err, isTimeout) => {\r\n this._whenReadyAsyncCancel = null;\r\n if (!isTimeout) {\r\n Logger.Error(\"FrameGraph: An unexpected error occurred while waiting for the frame graph to be ready.\");\r\n if (err) {\r\n Logger.Error(err);\r\n if (err.stack) {\r\n Logger.Error(err.stack);\r\n }\r\n }\r\n } else {\r\n Logger.Error(\r\n `FrameGraph: Timeout while waiting for the frame graph to be ready.${firstNotReadyTask ? ` First task not ready: ${firstNotReadyTask.name}` : \"\"}`\r\n );\r\n if (err) {\r\n Logger.Error(err);\r\n }\r\n }\r\n },\r\n timeStep,\r\n maxTimeout\r\n );\r\n });\r\n }\r\n\r\n /**\r\n * Executes the frame graph.\r\n */\r\n public execute(): void {\r\n this._renderContext.bindRenderTarget();\r\n\r\n this.textureManager._updateHistoryTextures();\r\n\r\n for (const task of this._tasks) {\r\n const passes = task._getPasses();\r\n\r\n for (const pass of passes) {\r\n pass._execute();\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Clears the frame graph (remove the tasks and release the textures).\r\n * The frame graph can be built again after this method is called.\r\n */\r\n public clear(): void {\r\n this._whenReadyAsyncCancel?.();\r\n this._whenReadyAsyncCancel = null;\r\n\r\n for (const task of this._tasks) {\r\n task._reset();\r\n }\r\n\r\n this._tasks.length = 0;\r\n this.textureManager._releaseTextures();\r\n this._currentProcessedTask = null;\r\n }\r\n\r\n /**\r\n * Disposes the frame graph\r\n */\r\n public dispose(): void {\r\n this._whenReadyAsyncCancel?.();\r\n this._whenReadyAsyncCancel = null;\r\n this.clear();\r\n this.textureManager._dispose();\r\n this._renderContext._dispose();\r\n\r\n this._scene.removeFrameGraph(this);\r\n }\r\n}\r\n"]}
@@ -17,6 +17,10 @@ import type { AbstractMesh } from "../Meshes/abstractMesh.js";
17
17
  * A particle system represents a way to manage particles from their emission to their animation and rendering.
18
18
  */
19
19
  export interface IParticleSystem {
20
+ /**
21
+ * Gets or sets the unique id of the particle system.
22
+ */
23
+ uniqueId: number;
20
24
  /**
21
25
  * List of animations used by the particle system.
22
26
  */
@@ -1 +1 @@
1
- {"version":3,"file":"IParticleSystem.js","sourceRoot":"","sources":["../../../../dev/core/src/Particles/IParticleSystem.ts"],"names":[],"mappings":"","sourcesContent":["import type { Immutable, Nullable } from \"../types\";\r\nimport type { Vector2, Vector3, Matrix } from \"../Maths/math.vector\";\r\nimport type { Color3, Color4 } from \"../Maths/math.color\";\r\nimport type { BaseTexture } from \"../Materials/Textures/baseTexture\";\r\nimport type {\r\n BoxParticleEmitter,\r\n IParticleEmitterType,\r\n PointParticleEmitter,\r\n HemisphericParticleEmitter,\r\n SphereParticleEmitter,\r\n SphereDirectedParticleEmitter,\r\n CylinderParticleEmitter,\r\n CylinderDirectedParticleEmitter,\r\n ConeParticleEmitter,\r\n ConeDirectedParticleEmitter,\r\n} from \"../Particles/EmitterTypes/index\";\r\nimport type { Scene } from \"../scene\";\r\nimport type { ColorGradient, FactorGradient, Color3Gradient } from \"../Misc/gradients\";\r\nimport type { Effect } from \"../Materials/effect\";\r\nimport type { Observable } from \"../Misc/observable\";\r\nimport type { VertexBuffer } from \"../Buffers/buffer\";\r\nimport type { DataBuffer } from \"../Buffers/dataBuffer\";\r\n\r\nimport type { Animation } from \"../Animations/animation\";\r\nimport type { AbstractMesh } from \"../Meshes/abstractMesh\";\r\n\r\n/**\r\n * Interface representing a particle system in Babylon.js.\r\n * This groups the common functionalities that needs to be implemented in order to create a particle system.\r\n * A particle system represents a way to manage particles from their emission to their animation and rendering.\r\n */\r\nexport interface IParticleSystem {\r\n /**\r\n * List of animations used by the particle system.\r\n */\r\n animations: Animation[];\r\n /**\r\n * The id of the Particle system.\r\n */\r\n id: string;\r\n /**\r\n * The name of the Particle system.\r\n */\r\n name: string;\r\n /**\r\n * The emitter represents the Mesh or position we are attaching the particle system to.\r\n */\r\n emitter: Nullable<AbstractMesh | Vector3>;\r\n /**\r\n * Gets or sets a boolean indicating if the particles must be rendered as billboard or aligned with the direction\r\n */\r\n isBillboardBased: boolean;\r\n /**\r\n * The rendering group used by the Particle system to chose when to render.\r\n */\r\n renderingGroupId: number;\r\n /**\r\n * The layer mask we are rendering the particles through.\r\n */\r\n layerMask: number;\r\n\r\n /**\r\n * The overall motion speed (0.01 is default update speed, faster updates = faster animation)\r\n */\r\n updateSpeed: number;\r\n\r\n /**\r\n * The amount of time the particle system is running (depends of the overall update speed).\r\n */\r\n targetStopDuration: number;\r\n\r\n /**\r\n * The texture used to render each particle. (this can be a spritesheet)\r\n */\r\n particleTexture: Nullable<BaseTexture>;\r\n\r\n /**\r\n * Blend mode use to render the particle. It can be any of the ParticleSystem.BLENDMODE_* constants\r\n */\r\n blendMode: number;\r\n\r\n /**\r\n * Minimum life time of emitting particles.\r\n */\r\n minLifeTime: number;\r\n /**\r\n * Maximum life time of emitting particles.\r\n */\r\n maxLifeTime: number;\r\n\r\n /**\r\n * Minimum Size of emitting particles.\r\n */\r\n minSize: number;\r\n /**\r\n * Maximum Size of emitting particles.\r\n */\r\n maxSize: number;\r\n\r\n /**\r\n * Minimum scale of emitting particles on X axis.\r\n */\r\n minScaleX: number;\r\n /**\r\n * Maximum scale of emitting particles on X axis.\r\n */\r\n maxScaleX: number;\r\n\r\n /**\r\n * Minimum scale of emitting particles on Y axis.\r\n */\r\n minScaleY: number;\r\n /**\r\n * Maximum scale of emitting particles on Y axis.\r\n */\r\n maxScaleY: number;\r\n\r\n /**\r\n * Random color of each particle after it has been emitted, between color1 and color2 vectors.\r\n */\r\n color1: Color4;\r\n /**\r\n * Random color of each particle after it has been emitted, between color1 and color2 vectors.\r\n */\r\n color2: Color4;\r\n\r\n /**\r\n * Color the particle will have at the end of its lifetime.\r\n */\r\n colorDead: Color4;\r\n\r\n /**\r\n * The maximum number of particles to emit per frame until we reach the activeParticleCount value\r\n */\r\n emitRate: number;\r\n\r\n /**\r\n * You can use gravity if you want to give an orientation to your particles.\r\n */\r\n gravity: Vector3;\r\n\r\n /**\r\n * Minimum power of emitting particles.\r\n */\r\n minEmitPower: number;\r\n /**\r\n * Maximum power of emitting particles.\r\n */\r\n maxEmitPower: number;\r\n /**\r\n * Minimum angular speed of emitting particles (Z-axis rotation for each particle).\r\n */\r\n minAngularSpeed: number;\r\n /**\r\n * Maximum angular speed of emitting particles (Z-axis rotation for each particle).\r\n */\r\n maxAngularSpeed: number;\r\n /**\r\n * Gets or sets the minimal initial rotation in radians.\r\n */\r\n minInitialRotation: number;\r\n /**\r\n * Gets or sets the maximal initial rotation in radians.\r\n */\r\n maxInitialRotation: number;\r\n /**\r\n * The particle emitter type defines the emitter used by the particle system.\r\n * It can be for example box, sphere, or cone...\r\n */\r\n particleEmitterType: Nullable<IParticleEmitterType>;\r\n /**\r\n * Defines the delay in milliseconds before starting the system (0 by default)\r\n */\r\n startDelay: number;\r\n /**\r\n * Gets or sets a value indicating how many cycles (or frames) must be executed before first rendering (this value has to be set before starting the system). Default is 0\r\n */\r\n preWarmCycles: number;\r\n /**\r\n * Gets or sets a value indicating the time step multiplier to use in pre-warm mode (default is 1)\r\n */\r\n preWarmStepOffset: number;\r\n\r\n /**\r\n * If using a spritesheet (isAnimationSheetEnabled) defines the speed of the sprite loop (default is 1 meaning the animation will play once during the entire particle lifetime)\r\n */\r\n spriteCellChangeSpeed: number;\r\n /**\r\n * If using a spritesheet (isAnimationSheetEnabled) defines the first sprite cell to display\r\n */\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n startSpriteCellID: number;\r\n /**\r\n * If using a spritesheet (isAnimationSheetEnabled) defines the last sprite cell to display\r\n */\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n endSpriteCellID: number;\r\n /**\r\n * If using a spritesheet (isAnimationSheetEnabled), defines whether the sprite animation is looping\r\n */\r\n spriteCellLoop: boolean;\r\n /**\r\n * If using a spritesheet (isAnimationSheetEnabled), defines the sprite cell width to use\r\n */\r\n spriteCellWidth: number;\r\n /**\r\n * If using a spritesheet (isAnimationSheetEnabled), defines the sprite cell height to use\r\n */\r\n spriteCellHeight: number;\r\n /**\r\n * This allows the system to random pick the start cell ID between startSpriteCellID and endSpriteCellID\r\n */\r\n spriteRandomStartCell: boolean;\r\n\r\n /**\r\n * Gets or sets a boolean indicating if a spritesheet is used to animate the particles texture\r\n */\r\n isAnimationSheetEnabled: boolean;\r\n\r\n /** Gets or sets a Vector2 used to move the pivot (by default (0,0)) */\r\n translationPivot: Vector2;\r\n\r\n /**\r\n * Gets or sets a texture used to add random noise to particle positions\r\n */\r\n noiseTexture: Nullable<BaseTexture>;\r\n\r\n /** Gets or sets the strength to apply to the noise value (default is (10, 10, 10)) */\r\n noiseStrength: Vector3;\r\n\r\n /**\r\n * Gets or sets the billboard mode to use when isBillboardBased = true.\r\n * Value can be: ParticleSystem.BILLBOARDMODE_ALL, ParticleSystem.BILLBOARDMODE_Y, ParticleSystem.BILLBOARDMODE_STRETCHED\r\n */\r\n billboardMode: number;\r\n\r\n /**\r\n * Gets or sets a boolean enabling the use of logarithmic depth buffers, which is good for wide depth buffers.\r\n */\r\n useLogarithmicDepth: boolean;\r\n\r\n /** Gets or sets a value indicating the damping to apply if the limit velocity factor is reached */\r\n limitVelocityDamping: number;\r\n\r\n /**\r\n * Gets or sets a boolean indicating that hosted animations (in the system.animations array) must be started when system.start() is called\r\n */\r\n beginAnimationOnStart: boolean;\r\n\r\n /**\r\n * Gets or sets the frame to start the animation from when beginAnimationOnStart is true\r\n */\r\n beginAnimationFrom: number;\r\n\r\n /**\r\n * Gets or sets the frame to end the animation on when beginAnimationOnStart is true\r\n */\r\n beginAnimationTo: number;\r\n\r\n /**\r\n * Gets or sets a boolean indicating if animations must loop when beginAnimationOnStart is true\r\n */\r\n beginAnimationLoop: boolean;\r\n\r\n /**\r\n * Specifies whether the particle system will be disposed once it reaches the end of the animation.\r\n */\r\n disposeOnStop: boolean;\r\n\r\n /**\r\n * If you want to launch only a few particles at once, that can be done, as well.\r\n */\r\n manualEmitCount: number;\r\n\r\n /**\r\n * Specifies if the particles are updated in emitter local space or world space\r\n */\r\n isLocal: boolean;\r\n\r\n /** Snippet ID if the particle system was created from the snippet server */\r\n snippetId: string;\r\n\r\n /** Gets or sets a matrix to use to compute projection */\r\n defaultProjectionMatrix: Matrix;\r\n\r\n /** Indicates that the update of particles is done in the animate function (and not in render) */\r\n updateInAnimate: boolean;\r\n\r\n /** @internal */\r\n _wasDispatched: boolean;\r\n\r\n /**\r\n * Returns true if the particle system was generated by a node particle system set\r\n */\r\n isNodeGenerated: boolean;\r\n\r\n /**\r\n * Gets the maximum number of particles active at the same time.\r\n * @returns The max number of active particles.\r\n */\r\n getCapacity(): number;\r\n\r\n /**\r\n * Gets the number of particles active at the same time.\r\n * @returns The number of active particles.\r\n */\r\n getActiveCount(): number;\r\n\r\n /**\r\n * Gets if the system has been started. (Note: this will still be true after stop is called)\r\n * @returns True if it has been started, otherwise false.\r\n */\r\n isStarted(): boolean;\r\n\r\n /**\r\n * Animates the particle system for this frame.\r\n */\r\n animate(): void;\r\n /**\r\n * Renders the particle system in its current state.\r\n * @returns the current number of particles\r\n */\r\n render(): number;\r\n /**\r\n * Dispose the particle system and frees its associated resources.\r\n * @param disposeTexture defines if the particle texture must be disposed as well (true by default)\r\n * @param disposeAttachedSubEmitters defines if the attached sub-emitters must be disposed as well (false by default)\r\n * @param disposeEndSubEmitters defines if the end type sub-emitters must be disposed as well (false by default)\r\n */\r\n dispose(disposeTexture?: boolean, disposeAttachedSubEmitters?: boolean, disposeEndSubEmitters?: boolean): void;\r\n /**\r\n * An event triggered when the system is disposed\r\n */\r\n onDisposeObservable: Observable<IParticleSystem>;\r\n /**\r\n * An event triggered when the system is stopped\r\n */\r\n onStoppedObservable: Observable<IParticleSystem>;\r\n /**\r\n * An event triggered when the system is started\r\n */\r\n onStartedObservable: Observable<IParticleSystem>;\r\n /**\r\n * Clones the particle system.\r\n * @param name The name of the cloned object\r\n * @param newEmitter The new emitter to use\r\n * @returns the cloned particle system\r\n */\r\n clone(name: string, newEmitter: any): Nullable<IParticleSystem>;\r\n /**\r\n * Serializes the particle system to a JSON object\r\n * @param serializeTexture defines if the texture must be serialized as well\r\n * @returns the JSON object\r\n */\r\n serialize(serializeTexture: boolean): any;\r\n /**\r\n * Rebuild the particle system\r\n */\r\n rebuild(): void;\r\n\r\n /** Force the system to rebuild all gradients that need to be resync */\r\n forceRefreshGradients(): void;\r\n\r\n /**\r\n * Starts the particle system and begins to emit\r\n * @param delay defines the delay in milliseconds before starting the system (0 by default)\r\n */\r\n start(delay?: number): void;\r\n\r\n /**\r\n * Stops the particle system.\r\n */\r\n stop(): void;\r\n\r\n /**\r\n * Remove all active particles\r\n */\r\n reset(): void;\r\n\r\n /**\r\n * Gets a boolean indicating that the system is stopping\r\n * @returns true if the system is currently stopping\r\n */\r\n isStopping(): boolean;\r\n\r\n /**\r\n * Is this system ready to be used/rendered\r\n * @returns true if the system is ready\r\n */\r\n isReady(): boolean;\r\n /**\r\n * Returns the string \"ParticleSystem\"\r\n * @returns a string containing the class name\r\n */\r\n getClassName(): string;\r\n /**\r\n * Gets the custom effect used to render the particles\r\n * @param blendMode Blend mode for which the effect should be retrieved\r\n * @returns The effect\r\n */\r\n getCustomEffect(blendMode: number): Nullable<Effect>;\r\n /**\r\n * Sets the custom effect used to render the particles\r\n * @param effect The effect to set\r\n * @param blendMode Blend mode for which the effect should be set\r\n */\r\n setCustomEffect(effect: Nullable<Effect>, blendMode: number): void;\r\n\r\n /**\r\n * Fill the defines array according to the current settings of the particle system\r\n * @param defines Array to be updated\r\n * @param blendMode blend mode to take into account when updating the array\r\n * @param fillImageProcessing fills the image processing defines\r\n */\r\n fillDefines(defines: Array<string>, blendMode: number, fillImageProcessing?: boolean): void;\r\n /**\r\n * Fill the uniforms, attributes and samplers arrays according to the current settings of the particle system\r\n * @param uniforms Uniforms array to fill\r\n * @param attributes Attributes array to fill\r\n * @param samplers Samplers array to fill\r\n */\r\n fillUniformsAttributesAndSamplerNames(uniforms: Array<string>, attributes: Array<string>, samplers: Array<string>): void;\r\n /**\r\n * Observable that will be called just before the particles are drawn\r\n */\r\n onBeforeDrawParticlesObservable: Observable<Nullable<Effect>>;\r\n /**\r\n * Gets the name of the particle vertex shader\r\n */\r\n vertexShaderName: string;\r\n\r\n /**\r\n * Gets the vertex buffers used by the particle system\r\n */\r\n vertexBuffers: Immutable<{ [key: string]: VertexBuffer }>;\r\n /**\r\n * Gets the index buffer used by the particle system (or null if no index buffer is used)\r\n */\r\n indexBuffer: Nullable<DataBuffer>;\r\n\r\n /**\r\n * Adds a new color gradient\r\n * @param gradient defines the gradient to use (between 0 and 1)\r\n * @param color1 defines the color to affect to the specified gradient\r\n * @param color2 defines an additional color used to define a range ([color, color2]) with main color to pick the final color from\r\n * @returns the current particle system\r\n */\r\n addColorGradient(gradient: number, color1: Color4, color2?: Color4): IParticleSystem;\r\n /**\r\n * Remove a specific color gradient\r\n * @param gradient defines the gradient to remove\r\n * @returns the current particle system\r\n */\r\n removeColorGradient(gradient: number): IParticleSystem;\r\n /**\r\n * Adds a new size gradient\r\n * @param gradient defines the gradient to use (between 0 and 1)\r\n * @param factor defines the size factor to affect to the specified gradient\r\n * @param factor2 defines an additional factor used to define a range ([factor, factor2]) with main value to pick the final value from\r\n * @returns the current particle system\r\n */\r\n addSizeGradient(gradient: number, factor: number, factor2?: number): IParticleSystem;\r\n /**\r\n * Remove a specific size gradient\r\n * @param gradient defines the gradient to remove\r\n * @returns the current particle system\r\n */\r\n removeSizeGradient(gradient: number): IParticleSystem;\r\n /**\r\n * Gets the current list of color gradients.\r\n * You must use addColorGradient and removeColorGradient to update this list\r\n * @returns the list of color gradients\r\n */\r\n getColorGradients(): Nullable<Array<ColorGradient>>;\r\n /**\r\n * Gets the current list of size gradients.\r\n * You must use addSizeGradient and removeSizeGradient to update this list\r\n * @returns the list of size gradients\r\n */\r\n getSizeGradients(): Nullable<Array<FactorGradient>>;\r\n /**\r\n * Gets the current list of angular speed gradients.\r\n * You must use addAngularSpeedGradient and removeAngularSpeedGradient to update this list\r\n * @returns the list of angular speed gradients\r\n */\r\n getAngularSpeedGradients(): Nullable<Array<FactorGradient>>;\r\n /**\r\n * Adds a new angular speed gradient\r\n * @param gradient defines the gradient to use (between 0 and 1)\r\n * @param factor defines the angular speed to affect to the specified gradient\r\n * @param factor2 defines an additional factor used to define a range ([factor, factor2]) with main value to pick the final value from\r\n * @returns the current particle system\r\n */\r\n addAngularSpeedGradient(gradient: number, factor: number, factor2?: number): IParticleSystem;\r\n /**\r\n * Remove a specific angular speed gradient\r\n * @param gradient defines the gradient to remove\r\n * @returns the current particle system\r\n */\r\n removeAngularSpeedGradient(gradient: number): IParticleSystem;\r\n /**\r\n * Gets the current list of velocity gradients.\r\n * You must use addVelocityGradient and removeVelocityGradient to update this list\r\n * @returns the list of velocity gradients\r\n */\r\n getVelocityGradients(): Nullable<Array<FactorGradient>>;\r\n /**\r\n * Adds a new velocity gradient\r\n * @param gradient defines the gradient to use (between 0 and 1)\r\n * @param factor defines the velocity to affect to the specified gradient\r\n * @param factor2 defines an additional factor used to define a range ([factor, factor2]) with main value to pick the final value from\r\n * @returns the current particle system\r\n */\r\n addVelocityGradient(gradient: number, factor: number, factor2?: number): IParticleSystem;\r\n /**\r\n * Remove a specific velocity gradient\r\n * @param gradient defines the gradient to remove\r\n * @returns the current particle system\r\n */\r\n removeVelocityGradient(gradient: number): IParticleSystem;\r\n /**\r\n * Gets the current list of limit velocity gradients.\r\n * You must use addLimitVelocityGradient and removeLimitVelocityGradient to update this list\r\n * @returns the list of limit velocity gradients\r\n */\r\n getLimitVelocityGradients(): Nullable<Array<FactorGradient>>;\r\n /**\r\n * Adds a new limit velocity gradient\r\n * @param gradient defines the gradient to use (between 0 and 1)\r\n * @param factor defines the limit velocity to affect to the specified gradient\r\n * @param factor2 defines an additional factor used to define a range ([factor, factor2]) with main value to pick the final value from\r\n * @returns the current particle system\r\n */\r\n addLimitVelocityGradient(gradient: number, factor: number, factor2?: number): IParticleSystem;\r\n /**\r\n * Remove a specific limit velocity gradient\r\n * @param gradient defines the gradient to remove\r\n * @returns the current particle system\r\n */\r\n removeLimitVelocityGradient(gradient: number): IParticleSystem;\r\n /**\r\n * Adds a new drag gradient\r\n * @param gradient defines the gradient to use (between 0 and 1)\r\n * @param factor defines the drag to affect to the specified gradient\r\n * @param factor2 defines an additional factor used to define a range ([factor, factor2]) with main value to pick the final value from\r\n * @returns the current particle system\r\n */\r\n addDragGradient(gradient: number, factor: number, factor2?: number): IParticleSystem;\r\n /**\r\n * Remove a specific drag gradient\r\n * @param gradient defines the gradient to remove\r\n * @returns the current particle system\r\n */\r\n removeDragGradient(gradient: number): IParticleSystem;\r\n /**\r\n * Gets the current list of drag gradients.\r\n * You must use addDragGradient and removeDragGradient to update this list\r\n * @returns the list of drag gradients\r\n */\r\n getDragGradients(): Nullable<Array<FactorGradient>>;\r\n /**\r\n * Adds a new emit rate gradient (please note that this will only work if you set the targetStopDuration property)\r\n * @param gradient defines the gradient to use (between 0 and 1)\r\n * @param factor defines the emit rate to affect to the specified gradient\r\n * @param factor2 defines an additional factor used to define a range ([factor, factor2]) with main value to pick the final value from\r\n * @returns the current particle system\r\n */\r\n addEmitRateGradient(gradient: number, factor: number, factor2?: number): IParticleSystem;\r\n /**\r\n * Remove a specific emit rate gradient\r\n * @param gradient defines the gradient to remove\r\n * @returns the current particle system\r\n */\r\n removeEmitRateGradient(gradient: number): IParticleSystem;\r\n /**\r\n * Gets the current list of emit rate gradients.\r\n * You must use addEmitRateGradient and removeEmitRateGradient to update this list\r\n * @returns the list of emit rate gradients\r\n */\r\n getEmitRateGradients(): Nullable<Array<FactorGradient>>;\r\n\r\n /**\r\n * Adds a new start size gradient (please note that this will only work if you set the targetStopDuration property)\r\n * @param gradient defines the gradient to use (between 0 and 1)\r\n * @param factor defines the start size to affect to the specified gradient\r\n * @param factor2 defines an additional factor used to define a range ([factor, factor2]) with main value to pick the final value from\r\n * @returns the current particle system\r\n */\r\n addStartSizeGradient(gradient: number, factor: number, factor2?: number): IParticleSystem;\r\n /**\r\n * Remove a specific start size gradient\r\n * @param gradient defines the gradient to remove\r\n * @returns the current particle system\r\n */\r\n removeStartSizeGradient(gradient: number): IParticleSystem;\r\n /**\r\n * Gets the current list of start size gradients.\r\n * You must use addStartSizeGradient and removeStartSizeGradient to update this list\r\n * @returns the list of start size gradients\r\n */\r\n getStartSizeGradients(): Nullable<Array<FactorGradient>>;\r\n\r\n /**\r\n * Adds a new life time gradient\r\n * @param gradient defines the gradient to use (between 0 and 1)\r\n * @param factor defines the life time factor to affect to the specified gradient\r\n * @param factor2 defines an additional factor used to define a range ([factor, factor2]) with main value to pick the final value from\r\n * @returns the current particle system\r\n */\r\n addLifeTimeGradient(gradient: number, factor: number, factor2?: number): IParticleSystem;\r\n /**\r\n * Remove a specific life time gradient\r\n * @param gradient defines the gradient to remove\r\n * @returns the current particle system\r\n */\r\n removeLifeTimeGradient(gradient: number): IParticleSystem;\r\n /**\r\n * Gets the current list of life time gradients.\r\n * You must use addLifeTimeGradient and removeLifeTimeGradient to update this list\r\n * @returns the list of life time gradients\r\n */\r\n getLifeTimeGradients(): Nullable<Array<FactorGradient>>;\r\n\r\n /**\r\n * Gets the current list of color gradients.\r\n * You must use addColorGradient and removeColorGradient to update this list\r\n * @returns the list of color gradients\r\n */\r\n getColorGradients(): Nullable<Array<ColorGradient>>;\r\n\r\n /**\r\n * Adds a new ramp gradient used to remap particle colors\r\n * @param gradient defines the gradient to use (between 0 and 1)\r\n * @param color defines the color to affect to the specified gradient\r\n * @returns the current particle system\r\n */\r\n addRampGradient(gradient: number, color: Color3): IParticleSystem;\r\n /**\r\n * Gets the current list of ramp gradients.\r\n * You must use addRampGradient and removeRampGradient to update this list\r\n * @returns the list of ramp gradients\r\n */\r\n getRampGradients(): Nullable<Array<Color3Gradient>>;\r\n\r\n /** Gets or sets a boolean indicating that ramp gradients must be used\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/particles/particle_system/ramps_and_blends\r\n */\r\n useRampGradients: boolean;\r\n\r\n /**\r\n * Adds a new color remap gradient\r\n * @param gradient defines the gradient to use (between 0 and 1)\r\n * @param min defines the color remap minimal range\r\n * @param max defines the color remap maximal range\r\n * @returns the current particle system\r\n */\r\n addColorRemapGradient(gradient: number, min: number, max: number): IParticleSystem;\r\n /**\r\n * Gets the current list of color remap gradients.\r\n * You must use addColorRemapGradient and removeColorRemapGradient to update this list\r\n * @returns the list of color remap gradients\r\n */\r\n getColorRemapGradients(): Nullable<Array<FactorGradient>>;\r\n\r\n /**\r\n * Adds a new alpha remap gradient\r\n * @param gradient defines the gradient to use (between 0 and 1)\r\n * @param min defines the alpha remap minimal range\r\n * @param max defines the alpha remap maximal range\r\n * @returns the current particle system\r\n */\r\n addAlphaRemapGradient(gradient: number, min: number, max: number): IParticleSystem;\r\n /**\r\n * Gets the current list of alpha remap gradients.\r\n * You must use addAlphaRemapGradient and removeAlphaRemapGradient to update this list\r\n * @returns the list of alpha remap gradients\r\n */\r\n getAlphaRemapGradients(): Nullable<Array<FactorGradient>>;\r\n\r\n /**\r\n * Creates a Point Emitter for the particle system (emits directly from the emitter position)\r\n * @param direction1 Particles are emitted between the direction1 and direction2 from within the box\r\n * @param direction2 Particles are emitted between the direction1 and direction2 from within the box\r\n * @returns the emitter\r\n */\r\n createPointEmitter(direction1: Vector3, direction2: Vector3): PointParticleEmitter;\r\n\r\n /**\r\n * Creates a Hemisphere Emitter for the particle system (emits along the hemisphere radius)\r\n * @param radius The radius of the hemisphere to emit from\r\n * @param radiusRange The range of the hemisphere to emit from [0-1] 0 Surface Only, 1 Entire Radius\r\n * @returns the emitter\r\n */\r\n createHemisphericEmitter(radius: number, radiusRange: number): HemisphericParticleEmitter;\r\n\r\n /**\r\n * Creates a Sphere Emitter for the particle system (emits along the sphere radius)\r\n * @param radius The radius of the sphere to emit from\r\n * @param radiusRange The range of the sphere to emit from [0-1] 0 Surface Only, 1 Entire Radius\r\n * @returns the emitter\r\n */\r\n createSphereEmitter(radius: number, radiusRange: number): SphereParticleEmitter;\r\n\r\n /**\r\n * Creates a Directed Sphere Emitter for the particle system (emits between direction1 and direction2)\r\n * @param radius The radius of the sphere to emit from\r\n * @param direction1 Particles are emitted between the direction1 and direction2 from within the sphere\r\n * @param direction2 Particles are emitted between the direction1 and direction2 from within the sphere\r\n * @returns the emitter\r\n */\r\n createDirectedSphereEmitter(radius: number, direction1: Vector3, direction2: Vector3): SphereDirectedParticleEmitter;\r\n\r\n /**\r\n * Creates a Cylinder Emitter for the particle system (emits from the cylinder to the particle position)\r\n * @param radius The radius of the emission cylinder\r\n * @param height The height of the emission cylinder\r\n * @param radiusRange The range of emission [0-1] 0 Surface only, 1 Entire Radius\r\n * @param directionRandomizer How much to randomize the particle direction [0-1]\r\n * @returns the emitter\r\n */\r\n createCylinderEmitter(radius: number, height: number, radiusRange: number, directionRandomizer: number): CylinderParticleEmitter;\r\n\r\n /**\r\n * Creates a Directed Cylinder Emitter for the particle system (emits between direction1 and direction2)\r\n * @param radius The radius of the cylinder to emit from\r\n * @param height The height of the emission cylinder\r\n * @param radiusRange the range of the emission cylinder [0-1] 0 Surface only, 1 Entire Radius (1 by default)\r\n * @param direction1 Particles are emitted between the direction1 and direction2 from within the cylinder\r\n * @param direction2 Particles are emitted between the direction1 and direction2 from within the cylinder\r\n * @returns the emitter\r\n */\r\n createDirectedCylinderEmitter(radius: number, height: number, radiusRange: number, direction1: Vector3, direction2: Vector3): CylinderDirectedParticleEmitter;\r\n\r\n /**\r\n * Creates a Cone Emitter for the particle system (emits from the cone to the particle position)\r\n * @param radius The radius of the cone to emit from\r\n * @param angle The base angle of the cone\r\n * @returns the emitter\r\n */\r\n createConeEmitter(radius: number, angle: number): ConeParticleEmitter;\r\n\r\n createDirectedConeEmitter(radius: number, angle: number, direction1: Vector3, direction2: Vector3): ConeDirectedParticleEmitter;\r\n\r\n /**\r\n * Creates a Box Emitter for the particle system. (emits between direction1 and direction2 from withing the box defined by minEmitBox and maxEmitBox)\r\n * @param direction1 Particles are emitted between the direction1 and direction2 from within the box\r\n * @param direction2 Particles are emitted between the direction1 and direction2 from within the box\r\n * @param minEmitBox Particles are emitted from the box between minEmitBox and maxEmitBox\r\n * @param maxEmitBox Particles are emitted from the box between minEmitBox and maxEmitBox\r\n * @returns the emitter\r\n */\r\n createBoxEmitter(direction1: Vector3, direction2: Vector3, minEmitBox: Vector3, maxEmitBox: Vector3): BoxParticleEmitter;\r\n\r\n /**\r\n * Get hosting scene\r\n * @returns the scene\r\n */\r\n getScene(): Nullable<Scene>;\r\n}\r\n"]}
1
+ {"version":3,"file":"IParticleSystem.js","sourceRoot":"","sources":["../../../../dev/core/src/Particles/IParticleSystem.ts"],"names":[],"mappings":"","sourcesContent":["import type { Immutable, Nullable } from \"../types\";\r\nimport type { Vector2, Vector3, Matrix } from \"../Maths/math.vector\";\r\nimport type { Color3, Color4 } from \"../Maths/math.color\";\r\nimport type { BaseTexture } from \"../Materials/Textures/baseTexture\";\r\nimport type {\r\n BoxParticleEmitter,\r\n IParticleEmitterType,\r\n PointParticleEmitter,\r\n HemisphericParticleEmitter,\r\n SphereParticleEmitter,\r\n SphereDirectedParticleEmitter,\r\n CylinderParticleEmitter,\r\n CylinderDirectedParticleEmitter,\r\n ConeParticleEmitter,\r\n ConeDirectedParticleEmitter,\r\n} from \"../Particles/EmitterTypes/index\";\r\nimport type { Scene } from \"../scene\";\r\nimport type { ColorGradient, FactorGradient, Color3Gradient } from \"../Misc/gradients\";\r\nimport type { Effect } from \"../Materials/effect\";\r\nimport type { Observable } from \"../Misc/observable\";\r\nimport type { VertexBuffer } from \"../Buffers/buffer\";\r\nimport type { DataBuffer } from \"../Buffers/dataBuffer\";\r\n\r\nimport type { Animation } from \"../Animations/animation\";\r\nimport type { AbstractMesh } from \"../Meshes/abstractMesh\";\r\n\r\n/**\r\n * Interface representing a particle system in Babylon.js.\r\n * This groups the common functionalities that needs to be implemented in order to create a particle system.\r\n * A particle system represents a way to manage particles from their emission to their animation and rendering.\r\n */\r\nexport interface IParticleSystem {\r\n /**\r\n * Gets or sets the unique id of the particle system.\r\n */\r\n uniqueId: number;\r\n\r\n /**\r\n * List of animations used by the particle system.\r\n */\r\n animations: Animation[];\r\n /**\r\n * The id of the Particle system.\r\n */\r\n id: string;\r\n /**\r\n * The name of the Particle system.\r\n */\r\n name: string;\r\n /**\r\n * The emitter represents the Mesh or position we are attaching the particle system to.\r\n */\r\n emitter: Nullable<AbstractMesh | Vector3>;\r\n /**\r\n * Gets or sets a boolean indicating if the particles must be rendered as billboard or aligned with the direction\r\n */\r\n isBillboardBased: boolean;\r\n /**\r\n * The rendering group used by the Particle system to chose when to render.\r\n */\r\n renderingGroupId: number;\r\n /**\r\n * The layer mask we are rendering the particles through.\r\n */\r\n layerMask: number;\r\n\r\n /**\r\n * The overall motion speed (0.01 is default update speed, faster updates = faster animation)\r\n */\r\n updateSpeed: number;\r\n\r\n /**\r\n * The amount of time the particle system is running (depends of the overall update speed).\r\n */\r\n targetStopDuration: number;\r\n\r\n /**\r\n * The texture used to render each particle. (this can be a spritesheet)\r\n */\r\n particleTexture: Nullable<BaseTexture>;\r\n\r\n /**\r\n * Blend mode use to render the particle. It can be any of the ParticleSystem.BLENDMODE_* constants\r\n */\r\n blendMode: number;\r\n\r\n /**\r\n * Minimum life time of emitting particles.\r\n */\r\n minLifeTime: number;\r\n /**\r\n * Maximum life time of emitting particles.\r\n */\r\n maxLifeTime: number;\r\n\r\n /**\r\n * Minimum Size of emitting particles.\r\n */\r\n minSize: number;\r\n /**\r\n * Maximum Size of emitting particles.\r\n */\r\n maxSize: number;\r\n\r\n /**\r\n * Minimum scale of emitting particles on X axis.\r\n */\r\n minScaleX: number;\r\n /**\r\n * Maximum scale of emitting particles on X axis.\r\n */\r\n maxScaleX: number;\r\n\r\n /**\r\n * Minimum scale of emitting particles on Y axis.\r\n */\r\n minScaleY: number;\r\n /**\r\n * Maximum scale of emitting particles on Y axis.\r\n */\r\n maxScaleY: number;\r\n\r\n /**\r\n * Random color of each particle after it has been emitted, between color1 and color2 vectors.\r\n */\r\n color1: Color4;\r\n /**\r\n * Random color of each particle after it has been emitted, between color1 and color2 vectors.\r\n */\r\n color2: Color4;\r\n\r\n /**\r\n * Color the particle will have at the end of its lifetime.\r\n */\r\n colorDead: Color4;\r\n\r\n /**\r\n * The maximum number of particles to emit per frame until we reach the activeParticleCount value\r\n */\r\n emitRate: number;\r\n\r\n /**\r\n * You can use gravity if you want to give an orientation to your particles.\r\n */\r\n gravity: Vector3;\r\n\r\n /**\r\n * Minimum power of emitting particles.\r\n */\r\n minEmitPower: number;\r\n /**\r\n * Maximum power of emitting particles.\r\n */\r\n maxEmitPower: number;\r\n /**\r\n * Minimum angular speed of emitting particles (Z-axis rotation for each particle).\r\n */\r\n minAngularSpeed: number;\r\n /**\r\n * Maximum angular speed of emitting particles (Z-axis rotation for each particle).\r\n */\r\n maxAngularSpeed: number;\r\n /**\r\n * Gets or sets the minimal initial rotation in radians.\r\n */\r\n minInitialRotation: number;\r\n /**\r\n * Gets or sets the maximal initial rotation in radians.\r\n */\r\n maxInitialRotation: number;\r\n /**\r\n * The particle emitter type defines the emitter used by the particle system.\r\n * It can be for example box, sphere, or cone...\r\n */\r\n particleEmitterType: Nullable<IParticleEmitterType>;\r\n /**\r\n * Defines the delay in milliseconds before starting the system (0 by default)\r\n */\r\n startDelay: number;\r\n /**\r\n * Gets or sets a value indicating how many cycles (or frames) must be executed before first rendering (this value has to be set before starting the system). Default is 0\r\n */\r\n preWarmCycles: number;\r\n /**\r\n * Gets or sets a value indicating the time step multiplier to use in pre-warm mode (default is 1)\r\n */\r\n preWarmStepOffset: number;\r\n\r\n /**\r\n * If using a spritesheet (isAnimationSheetEnabled) defines the speed of the sprite loop (default is 1 meaning the animation will play once during the entire particle lifetime)\r\n */\r\n spriteCellChangeSpeed: number;\r\n /**\r\n * If using a spritesheet (isAnimationSheetEnabled) defines the first sprite cell to display\r\n */\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n startSpriteCellID: number;\r\n /**\r\n * If using a spritesheet (isAnimationSheetEnabled) defines the last sprite cell to display\r\n */\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n endSpriteCellID: number;\r\n /**\r\n * If using a spritesheet (isAnimationSheetEnabled), defines whether the sprite animation is looping\r\n */\r\n spriteCellLoop: boolean;\r\n /**\r\n * If using a spritesheet (isAnimationSheetEnabled), defines the sprite cell width to use\r\n */\r\n spriteCellWidth: number;\r\n /**\r\n * If using a spritesheet (isAnimationSheetEnabled), defines the sprite cell height to use\r\n */\r\n spriteCellHeight: number;\r\n /**\r\n * This allows the system to random pick the start cell ID between startSpriteCellID and endSpriteCellID\r\n */\r\n spriteRandomStartCell: boolean;\r\n\r\n /**\r\n * Gets or sets a boolean indicating if a spritesheet is used to animate the particles texture\r\n */\r\n isAnimationSheetEnabled: boolean;\r\n\r\n /** Gets or sets a Vector2 used to move the pivot (by default (0,0)) */\r\n translationPivot: Vector2;\r\n\r\n /**\r\n * Gets or sets a texture used to add random noise to particle positions\r\n */\r\n noiseTexture: Nullable<BaseTexture>;\r\n\r\n /** Gets or sets the strength to apply to the noise value (default is (10, 10, 10)) */\r\n noiseStrength: Vector3;\r\n\r\n /**\r\n * Gets or sets the billboard mode to use when isBillboardBased = true.\r\n * Value can be: ParticleSystem.BILLBOARDMODE_ALL, ParticleSystem.BILLBOARDMODE_Y, ParticleSystem.BILLBOARDMODE_STRETCHED\r\n */\r\n billboardMode: number;\r\n\r\n /**\r\n * Gets or sets a boolean enabling the use of logarithmic depth buffers, which is good for wide depth buffers.\r\n */\r\n useLogarithmicDepth: boolean;\r\n\r\n /** Gets or sets a value indicating the damping to apply if the limit velocity factor is reached */\r\n limitVelocityDamping: number;\r\n\r\n /**\r\n * Gets or sets a boolean indicating that hosted animations (in the system.animations array) must be started when system.start() is called\r\n */\r\n beginAnimationOnStart: boolean;\r\n\r\n /**\r\n * Gets or sets the frame to start the animation from when beginAnimationOnStart is true\r\n */\r\n beginAnimationFrom: number;\r\n\r\n /**\r\n * Gets or sets the frame to end the animation on when beginAnimationOnStart is true\r\n */\r\n beginAnimationTo: number;\r\n\r\n /**\r\n * Gets or sets a boolean indicating if animations must loop when beginAnimationOnStart is true\r\n */\r\n beginAnimationLoop: boolean;\r\n\r\n /**\r\n * Specifies whether the particle system will be disposed once it reaches the end of the animation.\r\n */\r\n disposeOnStop: boolean;\r\n\r\n /**\r\n * If you want to launch only a few particles at once, that can be done, as well.\r\n */\r\n manualEmitCount: number;\r\n\r\n /**\r\n * Specifies if the particles are updated in emitter local space or world space\r\n */\r\n isLocal: boolean;\r\n\r\n /** Snippet ID if the particle system was created from the snippet server */\r\n snippetId: string;\r\n\r\n /** Gets or sets a matrix to use to compute projection */\r\n defaultProjectionMatrix: Matrix;\r\n\r\n /** Indicates that the update of particles is done in the animate function (and not in render) */\r\n updateInAnimate: boolean;\r\n\r\n /** @internal */\r\n _wasDispatched: boolean;\r\n\r\n /**\r\n * Returns true if the particle system was generated by a node particle system set\r\n */\r\n isNodeGenerated: boolean;\r\n\r\n /**\r\n * Gets the maximum number of particles active at the same time.\r\n * @returns The max number of active particles.\r\n */\r\n getCapacity(): number;\r\n\r\n /**\r\n * Gets the number of particles active at the same time.\r\n * @returns The number of active particles.\r\n */\r\n getActiveCount(): number;\r\n\r\n /**\r\n * Gets if the system has been started. (Note: this will still be true after stop is called)\r\n * @returns True if it has been started, otherwise false.\r\n */\r\n isStarted(): boolean;\r\n\r\n /**\r\n * Animates the particle system for this frame.\r\n */\r\n animate(): void;\r\n /**\r\n * Renders the particle system in its current state.\r\n * @returns the current number of particles\r\n */\r\n render(): number;\r\n /**\r\n * Dispose the particle system and frees its associated resources.\r\n * @param disposeTexture defines if the particle texture must be disposed as well (true by default)\r\n * @param disposeAttachedSubEmitters defines if the attached sub-emitters must be disposed as well (false by default)\r\n * @param disposeEndSubEmitters defines if the end type sub-emitters must be disposed as well (false by default)\r\n */\r\n dispose(disposeTexture?: boolean, disposeAttachedSubEmitters?: boolean, disposeEndSubEmitters?: boolean): void;\r\n /**\r\n * An event triggered when the system is disposed\r\n */\r\n onDisposeObservable: Observable<IParticleSystem>;\r\n /**\r\n * An event triggered when the system is stopped\r\n */\r\n onStoppedObservable: Observable<IParticleSystem>;\r\n /**\r\n * An event triggered when the system is started\r\n */\r\n onStartedObservable: Observable<IParticleSystem>;\r\n /**\r\n * Clones the particle system.\r\n * @param name The name of the cloned object\r\n * @param newEmitter The new emitter to use\r\n * @returns the cloned particle system\r\n */\r\n clone(name: string, newEmitter: any): Nullable<IParticleSystem>;\r\n /**\r\n * Serializes the particle system to a JSON object\r\n * @param serializeTexture defines if the texture must be serialized as well\r\n * @returns the JSON object\r\n */\r\n serialize(serializeTexture: boolean): any;\r\n /**\r\n * Rebuild the particle system\r\n */\r\n rebuild(): void;\r\n\r\n /** Force the system to rebuild all gradients that need to be resync */\r\n forceRefreshGradients(): void;\r\n\r\n /**\r\n * Starts the particle system and begins to emit\r\n * @param delay defines the delay in milliseconds before starting the system (0 by default)\r\n */\r\n start(delay?: number): void;\r\n\r\n /**\r\n * Stops the particle system.\r\n */\r\n stop(): void;\r\n\r\n /**\r\n * Remove all active particles\r\n */\r\n reset(): void;\r\n\r\n /**\r\n * Gets a boolean indicating that the system is stopping\r\n * @returns true if the system is currently stopping\r\n */\r\n isStopping(): boolean;\r\n\r\n /**\r\n * Is this system ready to be used/rendered\r\n * @returns true if the system is ready\r\n */\r\n isReady(): boolean;\r\n /**\r\n * Returns the string \"ParticleSystem\"\r\n * @returns a string containing the class name\r\n */\r\n getClassName(): string;\r\n /**\r\n * Gets the custom effect used to render the particles\r\n * @param blendMode Blend mode for which the effect should be retrieved\r\n * @returns The effect\r\n */\r\n getCustomEffect(blendMode: number): Nullable<Effect>;\r\n /**\r\n * Sets the custom effect used to render the particles\r\n * @param effect The effect to set\r\n * @param blendMode Blend mode for which the effect should be set\r\n */\r\n setCustomEffect(effect: Nullable<Effect>, blendMode: number): void;\r\n\r\n /**\r\n * Fill the defines array according to the current settings of the particle system\r\n * @param defines Array to be updated\r\n * @param blendMode blend mode to take into account when updating the array\r\n * @param fillImageProcessing fills the image processing defines\r\n */\r\n fillDefines(defines: Array<string>, blendMode: number, fillImageProcessing?: boolean): void;\r\n /**\r\n * Fill the uniforms, attributes and samplers arrays according to the current settings of the particle system\r\n * @param uniforms Uniforms array to fill\r\n * @param attributes Attributes array to fill\r\n * @param samplers Samplers array to fill\r\n */\r\n fillUniformsAttributesAndSamplerNames(uniforms: Array<string>, attributes: Array<string>, samplers: Array<string>): void;\r\n /**\r\n * Observable that will be called just before the particles are drawn\r\n */\r\n onBeforeDrawParticlesObservable: Observable<Nullable<Effect>>;\r\n /**\r\n * Gets the name of the particle vertex shader\r\n */\r\n vertexShaderName: string;\r\n\r\n /**\r\n * Gets the vertex buffers used by the particle system\r\n */\r\n vertexBuffers: Immutable<{ [key: string]: VertexBuffer }>;\r\n /**\r\n * Gets the index buffer used by the particle system (or null if no index buffer is used)\r\n */\r\n indexBuffer: Nullable<DataBuffer>;\r\n\r\n /**\r\n * Adds a new color gradient\r\n * @param gradient defines the gradient to use (between 0 and 1)\r\n * @param color1 defines the color to affect to the specified gradient\r\n * @param color2 defines an additional color used to define a range ([color, color2]) with main color to pick the final color from\r\n * @returns the current particle system\r\n */\r\n addColorGradient(gradient: number, color1: Color4, color2?: Color4): IParticleSystem;\r\n /**\r\n * Remove a specific color gradient\r\n * @param gradient defines the gradient to remove\r\n * @returns the current particle system\r\n */\r\n removeColorGradient(gradient: number): IParticleSystem;\r\n /**\r\n * Adds a new size gradient\r\n * @param gradient defines the gradient to use (between 0 and 1)\r\n * @param factor defines the size factor to affect to the specified gradient\r\n * @param factor2 defines an additional factor used to define a range ([factor, factor2]) with main value to pick the final value from\r\n * @returns the current particle system\r\n */\r\n addSizeGradient(gradient: number, factor: number, factor2?: number): IParticleSystem;\r\n /**\r\n * Remove a specific size gradient\r\n * @param gradient defines the gradient to remove\r\n * @returns the current particle system\r\n */\r\n removeSizeGradient(gradient: number): IParticleSystem;\r\n /**\r\n * Gets the current list of color gradients.\r\n * You must use addColorGradient and removeColorGradient to update this list\r\n * @returns the list of color gradients\r\n */\r\n getColorGradients(): Nullable<Array<ColorGradient>>;\r\n /**\r\n * Gets the current list of size gradients.\r\n * You must use addSizeGradient and removeSizeGradient to update this list\r\n * @returns the list of size gradients\r\n */\r\n getSizeGradients(): Nullable<Array<FactorGradient>>;\r\n /**\r\n * Gets the current list of angular speed gradients.\r\n * You must use addAngularSpeedGradient and removeAngularSpeedGradient to update this list\r\n * @returns the list of angular speed gradients\r\n */\r\n getAngularSpeedGradients(): Nullable<Array<FactorGradient>>;\r\n /**\r\n * Adds a new angular speed gradient\r\n * @param gradient defines the gradient to use (between 0 and 1)\r\n * @param factor defines the angular speed to affect to the specified gradient\r\n * @param factor2 defines an additional factor used to define a range ([factor, factor2]) with main value to pick the final value from\r\n * @returns the current particle system\r\n */\r\n addAngularSpeedGradient(gradient: number, factor: number, factor2?: number): IParticleSystem;\r\n /**\r\n * Remove a specific angular speed gradient\r\n * @param gradient defines the gradient to remove\r\n * @returns the current particle system\r\n */\r\n removeAngularSpeedGradient(gradient: number): IParticleSystem;\r\n /**\r\n * Gets the current list of velocity gradients.\r\n * You must use addVelocityGradient and removeVelocityGradient to update this list\r\n * @returns the list of velocity gradients\r\n */\r\n getVelocityGradients(): Nullable<Array<FactorGradient>>;\r\n /**\r\n * Adds a new velocity gradient\r\n * @param gradient defines the gradient to use (between 0 and 1)\r\n * @param factor defines the velocity to affect to the specified gradient\r\n * @param factor2 defines an additional factor used to define a range ([factor, factor2]) with main value to pick the final value from\r\n * @returns the current particle system\r\n */\r\n addVelocityGradient(gradient: number, factor: number, factor2?: number): IParticleSystem;\r\n /**\r\n * Remove a specific velocity gradient\r\n * @param gradient defines the gradient to remove\r\n * @returns the current particle system\r\n */\r\n removeVelocityGradient(gradient: number): IParticleSystem;\r\n /**\r\n * Gets the current list of limit velocity gradients.\r\n * You must use addLimitVelocityGradient and removeLimitVelocityGradient to update this list\r\n * @returns the list of limit velocity gradients\r\n */\r\n getLimitVelocityGradients(): Nullable<Array<FactorGradient>>;\r\n /**\r\n * Adds a new limit velocity gradient\r\n * @param gradient defines the gradient to use (between 0 and 1)\r\n * @param factor defines the limit velocity to affect to the specified gradient\r\n * @param factor2 defines an additional factor used to define a range ([factor, factor2]) with main value to pick the final value from\r\n * @returns the current particle system\r\n */\r\n addLimitVelocityGradient(gradient: number, factor: number, factor2?: number): IParticleSystem;\r\n /**\r\n * Remove a specific limit velocity gradient\r\n * @param gradient defines the gradient to remove\r\n * @returns the current particle system\r\n */\r\n removeLimitVelocityGradient(gradient: number): IParticleSystem;\r\n /**\r\n * Adds a new drag gradient\r\n * @param gradient defines the gradient to use (between 0 and 1)\r\n * @param factor defines the drag to affect to the specified gradient\r\n * @param factor2 defines an additional factor used to define a range ([factor, factor2]) with main value to pick the final value from\r\n * @returns the current particle system\r\n */\r\n addDragGradient(gradient: number, factor: number, factor2?: number): IParticleSystem;\r\n /**\r\n * Remove a specific drag gradient\r\n * @param gradient defines the gradient to remove\r\n * @returns the current particle system\r\n */\r\n removeDragGradient(gradient: number): IParticleSystem;\r\n /**\r\n * Gets the current list of drag gradients.\r\n * You must use addDragGradient and removeDragGradient to update this list\r\n * @returns the list of drag gradients\r\n */\r\n getDragGradients(): Nullable<Array<FactorGradient>>;\r\n /**\r\n * Adds a new emit rate gradient (please note that this will only work if you set the targetStopDuration property)\r\n * @param gradient defines the gradient to use (between 0 and 1)\r\n * @param factor defines the emit rate to affect to the specified gradient\r\n * @param factor2 defines an additional factor used to define a range ([factor, factor2]) with main value to pick the final value from\r\n * @returns the current particle system\r\n */\r\n addEmitRateGradient(gradient: number, factor: number, factor2?: number): IParticleSystem;\r\n /**\r\n * Remove a specific emit rate gradient\r\n * @param gradient defines the gradient to remove\r\n * @returns the current particle system\r\n */\r\n removeEmitRateGradient(gradient: number): IParticleSystem;\r\n /**\r\n * Gets the current list of emit rate gradients.\r\n * You must use addEmitRateGradient and removeEmitRateGradient to update this list\r\n * @returns the list of emit rate gradients\r\n */\r\n getEmitRateGradients(): Nullable<Array<FactorGradient>>;\r\n\r\n /**\r\n * Adds a new start size gradient (please note that this will only work if you set the targetStopDuration property)\r\n * @param gradient defines the gradient to use (between 0 and 1)\r\n * @param factor defines the start size to affect to the specified gradient\r\n * @param factor2 defines an additional factor used to define a range ([factor, factor2]) with main value to pick the final value from\r\n * @returns the current particle system\r\n */\r\n addStartSizeGradient(gradient: number, factor: number, factor2?: number): IParticleSystem;\r\n /**\r\n * Remove a specific start size gradient\r\n * @param gradient defines the gradient to remove\r\n * @returns the current particle system\r\n */\r\n removeStartSizeGradient(gradient: number): IParticleSystem;\r\n /**\r\n * Gets the current list of start size gradients.\r\n * You must use addStartSizeGradient and removeStartSizeGradient to update this list\r\n * @returns the list of start size gradients\r\n */\r\n getStartSizeGradients(): Nullable<Array<FactorGradient>>;\r\n\r\n /**\r\n * Adds a new life time gradient\r\n * @param gradient defines the gradient to use (between 0 and 1)\r\n * @param factor defines the life time factor to affect to the specified gradient\r\n * @param factor2 defines an additional factor used to define a range ([factor, factor2]) with main value to pick the final value from\r\n * @returns the current particle system\r\n */\r\n addLifeTimeGradient(gradient: number, factor: number, factor2?: number): IParticleSystem;\r\n /**\r\n * Remove a specific life time gradient\r\n * @param gradient defines the gradient to remove\r\n * @returns the current particle system\r\n */\r\n removeLifeTimeGradient(gradient: number): IParticleSystem;\r\n /**\r\n * Gets the current list of life time gradients.\r\n * You must use addLifeTimeGradient and removeLifeTimeGradient to update this list\r\n * @returns the list of life time gradients\r\n */\r\n getLifeTimeGradients(): Nullable<Array<FactorGradient>>;\r\n\r\n /**\r\n * Gets the current list of color gradients.\r\n * You must use addColorGradient and removeColorGradient to update this list\r\n * @returns the list of color gradients\r\n */\r\n getColorGradients(): Nullable<Array<ColorGradient>>;\r\n\r\n /**\r\n * Adds a new ramp gradient used to remap particle colors\r\n * @param gradient defines the gradient to use (between 0 and 1)\r\n * @param color defines the color to affect to the specified gradient\r\n * @returns the current particle system\r\n */\r\n addRampGradient(gradient: number, color: Color3): IParticleSystem;\r\n /**\r\n * Gets the current list of ramp gradients.\r\n * You must use addRampGradient and removeRampGradient to update this list\r\n * @returns the list of ramp gradients\r\n */\r\n getRampGradients(): Nullable<Array<Color3Gradient>>;\r\n\r\n /** Gets or sets a boolean indicating that ramp gradients must be used\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/particles/particle_system/ramps_and_blends\r\n */\r\n useRampGradients: boolean;\r\n\r\n /**\r\n * Adds a new color remap gradient\r\n * @param gradient defines the gradient to use (between 0 and 1)\r\n * @param min defines the color remap minimal range\r\n * @param max defines the color remap maximal range\r\n * @returns the current particle system\r\n */\r\n addColorRemapGradient(gradient: number, min: number, max: number): IParticleSystem;\r\n /**\r\n * Gets the current list of color remap gradients.\r\n * You must use addColorRemapGradient and removeColorRemapGradient to update this list\r\n * @returns the list of color remap gradients\r\n */\r\n getColorRemapGradients(): Nullable<Array<FactorGradient>>;\r\n\r\n /**\r\n * Adds a new alpha remap gradient\r\n * @param gradient defines the gradient to use (between 0 and 1)\r\n * @param min defines the alpha remap minimal range\r\n * @param max defines the alpha remap maximal range\r\n * @returns the current particle system\r\n */\r\n addAlphaRemapGradient(gradient: number, min: number, max: number): IParticleSystem;\r\n /**\r\n * Gets the current list of alpha remap gradients.\r\n * You must use addAlphaRemapGradient and removeAlphaRemapGradient to update this list\r\n * @returns the list of alpha remap gradients\r\n */\r\n getAlphaRemapGradients(): Nullable<Array<FactorGradient>>;\r\n\r\n /**\r\n * Creates a Point Emitter for the particle system (emits directly from the emitter position)\r\n * @param direction1 Particles are emitted between the direction1 and direction2 from within the box\r\n * @param direction2 Particles are emitted between the direction1 and direction2 from within the box\r\n * @returns the emitter\r\n */\r\n createPointEmitter(direction1: Vector3, direction2: Vector3): PointParticleEmitter;\r\n\r\n /**\r\n * Creates a Hemisphere Emitter for the particle system (emits along the hemisphere radius)\r\n * @param radius The radius of the hemisphere to emit from\r\n * @param radiusRange The range of the hemisphere to emit from [0-1] 0 Surface Only, 1 Entire Radius\r\n * @returns the emitter\r\n */\r\n createHemisphericEmitter(radius: number, radiusRange: number): HemisphericParticleEmitter;\r\n\r\n /**\r\n * Creates a Sphere Emitter for the particle system (emits along the sphere radius)\r\n * @param radius The radius of the sphere to emit from\r\n * @param radiusRange The range of the sphere to emit from [0-1] 0 Surface Only, 1 Entire Radius\r\n * @returns the emitter\r\n */\r\n createSphereEmitter(radius: number, radiusRange: number): SphereParticleEmitter;\r\n\r\n /**\r\n * Creates a Directed Sphere Emitter for the particle system (emits between direction1 and direction2)\r\n * @param radius The radius of the sphere to emit from\r\n * @param direction1 Particles are emitted between the direction1 and direction2 from within the sphere\r\n * @param direction2 Particles are emitted between the direction1 and direction2 from within the sphere\r\n * @returns the emitter\r\n */\r\n createDirectedSphereEmitter(radius: number, direction1: Vector3, direction2: Vector3): SphereDirectedParticleEmitter;\r\n\r\n /**\r\n * Creates a Cylinder Emitter for the particle system (emits from the cylinder to the particle position)\r\n * @param radius The radius of the emission cylinder\r\n * @param height The height of the emission cylinder\r\n * @param radiusRange The range of emission [0-1] 0 Surface only, 1 Entire Radius\r\n * @param directionRandomizer How much to randomize the particle direction [0-1]\r\n * @returns the emitter\r\n */\r\n createCylinderEmitter(radius: number, height: number, radiusRange: number, directionRandomizer: number): CylinderParticleEmitter;\r\n\r\n /**\r\n * Creates a Directed Cylinder Emitter for the particle system (emits between direction1 and direction2)\r\n * @param radius The radius of the cylinder to emit from\r\n * @param height The height of the emission cylinder\r\n * @param radiusRange the range of the emission cylinder [0-1] 0 Surface only, 1 Entire Radius (1 by default)\r\n * @param direction1 Particles are emitted between the direction1 and direction2 from within the cylinder\r\n * @param direction2 Particles are emitted between the direction1 and direction2 from within the cylinder\r\n * @returns the emitter\r\n */\r\n createDirectedCylinderEmitter(radius: number, height: number, radiusRange: number, direction1: Vector3, direction2: Vector3): CylinderDirectedParticleEmitter;\r\n\r\n /**\r\n * Creates a Cone Emitter for the particle system (emits from the cone to the particle position)\r\n * @param radius The radius of the cone to emit from\r\n * @param angle The base angle of the cone\r\n * @returns the emitter\r\n */\r\n createConeEmitter(radius: number, angle: number): ConeParticleEmitter;\r\n\r\n createDirectedConeEmitter(radius: number, angle: number, direction1: Vector3, direction2: Vector3): ConeDirectedParticleEmitter;\r\n\r\n /**\r\n * Creates a Box Emitter for the particle system. (emits between direction1 and direction2 from withing the box defined by minEmitBox and maxEmitBox)\r\n * @param direction1 Particles are emitted between the direction1 and direction2 from within the box\r\n * @param direction2 Particles are emitted between the direction1 and direction2 from within the box\r\n * @param minEmitBox Particles are emitted from the box between minEmitBox and maxEmitBox\r\n * @param maxEmitBox Particles are emitted from the box between minEmitBox and maxEmitBox\r\n * @returns the emitter\r\n */\r\n createBoxEmitter(direction1: Vector3, direction2: Vector3, minEmitBox: Vector3, maxEmitBox: Vector3): BoxParticleEmitter;\r\n\r\n /**\r\n * Get hosting scene\r\n * @returns the scene\r\n */\r\n getScene(): Nullable<Scene>;\r\n}\r\n"]}
@@ -13,7 +13,7 @@ import type { Ray } from "../Culling/ray.js";
13
13
  */
14
14
  export interface ISpriteManager extends IDisposable {
15
15
  /**
16
- * Gets or sets the unique id of the texture
16
+ * Gets or sets the unique id of the sprite manager
17
17
  */
18
18
  uniqueId: number;
19
19
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"spriteManager.js","sourceRoot":"","sources":["../../../../dev/core/src/Sprites/spriteManager.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AACnE,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAE9D,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAExD,OAAO,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AACxD,OAAO,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;A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O,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,UAAU,GAAG,GAAG,GAAG,SAAS,CAAC,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC,CAAC;YAC1E,OAAO,CAAC,IAAI,EAAE,CAAC;QACnB,CAAC,CAAC,CAAC;IACP,CAAC;;AA7sBD,sCAAsC;AACxB,wBAAU,GAAG,SAAS,CAAC,UAAU,AAAvB,CAAwB;AA8sBhD;;;;;;;GAOG;AACW,oCAAsB,GAAG,aAAa,CAAC,qBAAqB,AAAtC,CAAuC","sourcesContent":["import type { IDisposable, Scene } from \"../scene\";\r\nimport type { Nullable } from \"../types\";\r\nimport type { Observer } from \"../Misc/observable\";\r\nimport { Observable } from \"../Misc/observable\";\r\nimport { Vector3, TmpVectors, Matrix } from \"../Maths/math.vector\";\r\nimport { Sprite } from \"./sprite\";\r\nimport { SpriteSceneComponent } from \"./spriteSceneComponent\";\r\nimport type { InternalSpriteAugmentedScene } from \"./spriteSceneComponent\";\r\nimport { PickingInfo } from \"../Collisions/pickingInfo\";\r\nimport type { Camera } from \"../Cameras/camera\";\r\nimport { Texture } from \"../Materials/Textures/texture\";\r\nimport { SceneComponentConstants } from \"../sceneComponent\";\r\nimport { Logger } from \"../Misc/logger\";\r\nimport { Tools } from \"../Misc/tools\";\r\nimport { WebRequest } from \"../Misc/webRequest\";\r\nimport type { SpriteRendererOptions } from \"./spriteRenderer\";\r\nimport { SpriteRenderer } from \"./spriteRenderer\";\r\nimport type { ThinSprite } from \"./thinSprite\";\r\nimport type { ISize } from \"../Maths/math.size\";\r\nimport { EngineStore } from \"../Engines/engineStore\";\r\nimport { Constants } from \"../Engines/constants\";\r\n\r\nimport type { Ray } from \"../Culling/ray\";\r\n\r\n// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Reflect\r\ndeclare const Reflect: any;\r\n\r\n/**\r\n * Defines the minimum interface to fulfill in order to be a sprite manager.\r\n */\r\nexport interface ISpriteManager extends IDisposable {\r\n /**\r\n * Gets or sets the unique id of the texture\r\n */\r\n uniqueId: number;\r\n\r\n /**\r\n * Gets manager's name\r\n */\r\n name: string;\r\n\r\n /**\r\n * Restricts the camera to viewing objects with the same layerMask.\r\n * A camera with a layerMask of 1 will render spriteManager.layerMask & camera.layerMask!== 0\r\n */\r\n layerMask: number;\r\n\r\n /**\r\n * Gets or sets a boolean indicating if the mesh can be picked (by scene.pick for instance or through actions). Default is true\r\n */\r\n isPickable: boolean;\r\n\r\n /**\r\n * Gets the hosting scene\r\n */\r\n scene: Scene;\r\n\r\n /**\r\n * Specifies the rendering group id for this mesh (0 by default)\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/materials/advanced/transparent_rendering#rendering-groups\r\n */\r\n renderingGroupId: number;\r\n\r\n /**\r\n * Defines the list of sprites managed by the manager.\r\n */\r\n sprites: Array<Sprite>;\r\n\r\n /**\r\n * Gets or sets the spritesheet texture\r\n */\r\n texture: Texture;\r\n\r\n /** Defines the default width of a cell in the spritesheet */\r\n cellWidth: number;\r\n /** Defines the default height of a cell in the spritesheet */\r\n cellHeight: number;\r\n\r\n /** @internal */\r\n _wasDispatched: boolean;\r\n\r\n /**\r\n * Tests the intersection of a sprite with a specific ray.\r\n * @param ray The ray we are sending to test the collision\r\n * @param camera The camera space we are sending rays in\r\n * @param predicate A predicate allowing excluding sprites from the list of object to test\r\n * @param fastCheck defines if the first intersection will be used (and not the closest)\r\n * @returns picking info or null.\r\n */\r\n intersects(ray: Ray, camera: Camera, predicate?: (sprite: Sprite) => boolean, fastCheck?: boolean): Nullable<PickingInfo>;\r\n\r\n /**\r\n * Intersects the sprites with a ray\r\n * @param ray defines the ray to intersect with\r\n * @param camera defines the current active camera\r\n * @param predicate defines a predicate used to select candidate sprites\r\n * @returns null if no hit or a PickingInfo array\r\n */\r\n multiIntersects(ray: Ray, camera: Camera, predicate?: (sprite: Sprite) => boolean): Nullable<PickingInfo[]>;\r\n\r\n /**\r\n * Renders the list of sprites on screen.\r\n */\r\n render(): void;\r\n\r\n /**\r\n * Rebuilds the manager (after a context lost, for eg)\r\n */\r\n rebuild(): void;\r\n\r\n /**\r\n * Serializes the sprite manager to a JSON object\r\n */\r\n serialize(serializeTexture?: boolean): any;\r\n}\r\n\r\n/**\r\n * Options for the SpriteManager\r\n */\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nexport interface SpriteManagerOptions {\r\n /** Options for the sprite renderer */\r\n spriteRendererOptions: SpriteRendererOptions;\r\n}\r\n\r\n/**\r\n * Class used to manage multiple sprites on the same spritesheet\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/sprites\r\n */\r\nexport class SpriteManager implements ISpriteManager {\r\n /** Define the Url to load snippets */\r\n public static SnippetUrl = Constants.SnippetUrl;\r\n\r\n /** Snippet ID if the manager was created from the snippet server */\r\n public snippetId: string;\r\n\r\n /** Gets the list of sprites */\r\n public sprites: Sprite[] = [];\r\n /** Gets or sets the rendering group id (0 by default) */\r\n public renderingGroupId = 0;\r\n /** Gets or sets camera layer mask */\r\n public layerMask: number = 0x0fffffff;\r\n /** Gets or sets a boolean indicating if the sprites are pickable */\r\n public isPickable = false;\r\n\r\n /**\r\n * Gets or sets an object used to store user defined information for the sprite manager\r\n */\r\n public metadata: any = null;\r\n\r\n /** @internal */\r\n public _wasDispatched = false;\r\n\r\n /**\r\n * An event triggered when the manager is disposed.\r\n */\r\n public onDisposeObservable = new Observable<SpriteManager>();\r\n\r\n /**\r\n * Callback called when the manager is disposed\r\n */\r\n public set onDispose(callback: () => void) {\r\n if (this._onDisposeObserver) {\r\n this.onDisposeObservable.remove(this._onDisposeObserver);\r\n }\r\n this._onDisposeObserver = this.onDisposeObservable.add(callback);\r\n }\r\n\r\n /**\r\n * Gets or sets the unique id of the sprite\r\n */\r\n public uniqueId: number;\r\n\r\n /**\r\n * Gets the array of sprites\r\n */\r\n public get children() {\r\n return this.sprites;\r\n }\r\n\r\n /**\r\n * Gets the hosting scene\r\n */\r\n public get scene() {\r\n return this._scene;\r\n }\r\n\r\n /**\r\n * Gets the capacity of the manager\r\n */\r\n public get capacity() {\r\n return this._spriteRenderer.capacity;\r\n }\r\n\r\n /**\r\n * Gets or sets the spritesheet texture\r\n */\r\n public get texture(): Texture {\r\n return this._spriteRenderer.texture as Texture;\r\n }\r\n public set texture(value: Texture) {\r\n value.wrapU = Texture.CLAMP_ADDRESSMODE;\r\n value.wrapV = Texture.CLAMP_ADDRESSMODE;\r\n this._spriteRenderer.texture = value;\r\n this._textureContent = null;\r\n }\r\n\r\n /** Defines the default width of a cell in the spritesheet */\r\n public get cellWidth(): number {\r\n return this._spriteRenderer.cellWidth;\r\n }\r\n public set cellWidth(value: number) {\r\n this._spriteRenderer.cellWidth = value;\r\n }\r\n\r\n /** Defines the default height of a cell in the spritesheet */\r\n public get cellHeight(): number {\r\n return this._spriteRenderer.cellHeight;\r\n }\r\n public set cellHeight(value: number) {\r\n this._spriteRenderer.cellHeight = value;\r\n }\r\n\r\n /** Gets or sets a boolean indicating if the manager must consider scene fog when rendering */\r\n public get fogEnabled(): boolean {\r\n return this._spriteRenderer.fogEnabled;\r\n }\r\n public set fogEnabled(value: boolean) {\r\n this._spriteRenderer.fogEnabled = value;\r\n }\r\n\r\n /** Gets or sets a boolean indicating if the manager must use logarithmic depth when rendering */\r\n public get useLogarithmicDepth(): boolean {\r\n return this._spriteRenderer.useLogarithmicDepth;\r\n }\r\n public set useLogarithmicDepth(value: boolean) {\r\n this._spriteRenderer.useLogarithmicDepth = value;\r\n }\r\n\r\n /**\r\n * Blend mode use to render the particle, it can be any of\r\n * the static Constants.ALPHA_x properties provided in this class.\r\n * Default value is Constants.ALPHA_COMBINE\r\n */\r\n public get blendMode() {\r\n return this._spriteRenderer.blendMode;\r\n }\r\n public set blendMode(blendMode: number) {\r\n this._spriteRenderer.blendMode = blendMode;\r\n }\r\n\r\n private _disableDepthWrite: boolean = false;\r\n /** Disables writing to the depth buffer when rendering the sprites.\r\n * It can be handy to disable depth writing when using textures without alpha channel\r\n * and setting some specific blend modes.\r\n */\r\n public get disableDepthWrite() {\r\n return this._disableDepthWrite;\r\n }\r\n\r\n public set disableDepthWrite(value: boolean) {\r\n this._disableDepthWrite = value;\r\n this._spriteRenderer.disableDepthWrite = value;\r\n }\r\n\r\n /**\r\n * Gets or sets a boolean indicating if the renderer must render sprites with pixel perfect rendering\r\n * In this mode, sprites are rendered as \"pixel art\", which means that they appear as pixelated but remain stable when moving or when rotated or scaled.\r\n * Note that for this mode to work as expected, the sprite texture must use the BILINEAR sampling mode, not NEAREST!\r\n */\r\n public get pixelPerfect() {\r\n return this._spriteRenderer.pixelPerfect;\r\n }\r\n\r\n public set pixelPerfect(value: boolean) {\r\n this._spriteRenderer.pixelPerfect = value;\r\n if (value && this.texture.samplingMode !== Constants.TEXTURE_TRILINEAR_SAMPLINGMODE) {\r\n this.texture.updateSamplingMode(Constants.TEXTURE_TRILINEAR_SAMPLINGMODE);\r\n }\r\n }\r\n\r\n private _spriteRenderer: SpriteRenderer;\r\n /** Associative array from JSON sprite data file */\r\n private _cellData: any;\r\n /** Array of sprite names from JSON sprite data file */\r\n private _spriteMap: Array<string>;\r\n /** True when packed cell data from JSON file is ready*/\r\n private _packedAndReady: boolean = false;\r\n private _textureContent: Nullable<Uint8Array>;\r\n private _onDisposeObserver: Nullable<Observer<SpriteManager>>;\r\n private _fromPacked: boolean;\r\n private _scene: InternalSpriteAugmentedScene;\r\n\r\n /**\r\n * Creates a new sprite manager\r\n * @param name defines the manager's name\r\n * @param imgUrl defines the sprite sheet url\r\n * @param capacity defines the maximum allowed number of sprites\r\n * @param cellSize defines the size of a sprite cell\r\n * @param scene defines the hosting scene\r\n * @param epsilon defines the epsilon value to align texture (0.01 by default)\r\n * @param samplingMode defines the sampling mode to use with spritesheet\r\n * @param fromPacked set to false; do not alter\r\n * @param spriteJSON null otherwise a JSON object defining sprite sheet data; do not alter\r\n * @param options options used to create the SpriteManager instance\r\n */\r\n constructor(\r\n /** defines the manager's name */\r\n public name: string,\r\n imgUrl: string,\r\n capacity: number,\r\n cellSize: any,\r\n scene: Scene,\r\n epsilon: number = 0.01,\r\n samplingMode: number = Texture.TRILINEAR_SAMPLINGMODE,\r\n fromPacked: boolean = false,\r\n spriteJSON: null | string = null,\r\n options?: SpriteManagerOptions\r\n ) {\r\n if (!scene) {\r\n scene = EngineStore.LastCreatedScene!;\r\n }\r\n\r\n if (!scene._getComponent(SceneComponentConstants.NAME_SPRITE)) {\r\n scene._addComponent(new SpriteSceneComponent(scene));\r\n }\r\n this._fromPacked = fromPacked;\r\n\r\n this._scene = scene as InternalSpriteAugmentedScene;\r\n const engine = this._scene.getEngine();\r\n this._spriteRenderer = new SpriteRenderer(engine, capacity, epsilon, scene, options?.spriteRendererOptions);\r\n\r\n if (cellSize.width && cellSize.height) {\r\n this.cellWidth = cellSize.width;\r\n this.cellHeight = cellSize.height;\r\n } else if (cellSize !== undefined) {\r\n this.cellWidth = cellSize;\r\n this.cellHeight = cellSize;\r\n } else {\r\n this._spriteRenderer = <any>null;\r\n return;\r\n }\r\n\r\n this._scene.spriteManagers && this._scene.spriteManagers.push(this);\r\n this.uniqueId = this.scene.getUniqueId();\r\n\r\n if (imgUrl) {\r\n this.texture = new Texture(imgUrl, scene, true, false, samplingMode);\r\n }\r\n\r\n if (this._fromPacked) {\r\n this._makePacked(imgUrl, spriteJSON);\r\n }\r\n\r\n this._scene._onNewSpriteManagerAddedObservable?.notifyObservers(this);\r\n }\r\n\r\n /**\r\n * Returns the string \"SpriteManager\"\r\n * @returns \"SpriteManager\"\r\n */\r\n public getClassName(): string {\r\n return \"SpriteManager\";\r\n }\r\n\r\n private _makePacked(imgUrl: string, spriteJSON: any) {\r\n if (spriteJSON !== null) {\r\n try {\r\n //Get the JSON and Check its structure. If its an array parse it if its a JSON string etc...\r\n let celldata: any;\r\n if (typeof spriteJSON === \"string\") {\r\n celldata = JSON.parse(spriteJSON);\r\n } else {\r\n celldata = spriteJSON;\r\n }\r\n\r\n if (celldata.frames.length) {\r\n const frametemp: any = {};\r\n for (let i = 0; i < celldata.frames.length; i++) {\r\n const _f = celldata.frames[i];\r\n if (typeof Object.keys(_f)[0] !== \"string\") {\r\n throw new Error(\"Invalid JSON Format. Check the frame values and make sure the name is the first parameter.\");\r\n }\r\n\r\n const name: string = _f[Object.keys(_f)[0]];\r\n frametemp[name] = _f;\r\n }\r\n celldata.frames = frametemp;\r\n }\r\n\r\n const spritemap = <string[]>Reflect.ownKeys(celldata.frames);\r\n\r\n this._spriteMap = spritemap;\r\n this._packedAndReady = true;\r\n this._cellData = celldata.frames;\r\n } catch (e) {\r\n this._fromPacked = false;\r\n this._packedAndReady = false;\r\n throw new Error(\"Invalid JSON from string. Spritesheet managed with constant cell size.\");\r\n }\r\n } else {\r\n const re = /\\./g;\r\n let li: number;\r\n do {\r\n li = re.lastIndex;\r\n re.test(imgUrl);\r\n } while (re.lastIndex > 0);\r\n const jsonUrl = imgUrl.substring(0, li - 1) + \".json\";\r\n const onerror = () => {\r\n Logger.Error(\"JSON ERROR: Unable to load JSON file.\");\r\n this._fromPacked = false;\r\n this._packedAndReady = false;\r\n };\r\n const onload = (data: string | ArrayBuffer) => {\r\n try {\r\n const celldata = JSON.parse(data as string);\r\n const spritemap = <string[]>Reflect.ownKeys(celldata.frames);\r\n this._spriteMap = spritemap;\r\n this._packedAndReady = true;\r\n this._cellData = celldata.frames;\r\n } catch (e) {\r\n this._fromPacked = false;\r\n this._packedAndReady = false;\r\n throw new Error(\"Invalid JSON format. Please check documentation for format specifications.\");\r\n }\r\n };\r\n Tools.LoadFile(jsonUrl, onload, undefined, undefined, false, onerror);\r\n }\r\n }\r\n\r\n private _checkTextureAlpha(sprite: Sprite, ray: Ray, distance: number, min: Vector3, max: Vector3) {\r\n if (!sprite.useAlphaForPicking || !this.texture?.isReady()) {\r\n return true;\r\n }\r\n\r\n const textureSize = this.texture.getSize();\r\n if (!this._textureContent) {\r\n this._textureContent = new Uint8Array(textureSize.width * textureSize.height * 4);\r\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\r\n this.texture.readPixels(0, 0, this._textureContent);\r\n }\r\n\r\n const contactPoint = TmpVectors.Vector3[0];\r\n\r\n contactPoint.copyFrom(ray.direction);\r\n\r\n contactPoint.normalize();\r\n contactPoint.scaleInPlace(distance);\r\n contactPoint.addInPlace(ray.origin);\r\n\r\n const contactPointU = (contactPoint.x - min.x) / (max.x - min.x);\r\n const contactPointV = 1.0 - (contactPoint.y - min.y) / (max.y - min.y);\r\n\r\n const u = (sprite._xOffset * textureSize.width + contactPointU * sprite._xSize) | 0;\r\n const v = (sprite._yOffset * textureSize.height + contactPointV * sprite._ySize) | 0;\r\n\r\n const alpha = this._textureContent[(u + v * textureSize.width) * 4 + 3];\r\n\r\n return alpha > 0.5;\r\n }\r\n\r\n /**\r\n * Intersects the sprites with a ray\r\n * @param ray defines the ray to intersect with\r\n * @param camera defines the current active camera\r\n * @param predicate defines a predicate used to select candidate sprites\r\n * @param fastCheck defines if a fast check only must be done (the first potential sprite is will be used and not the closer)\r\n * @returns null if no hit or a PickingInfo\r\n */\r\n public intersects(ray: Ray, camera: Camera, predicate?: (sprite: Sprite) => boolean, fastCheck?: boolean): Nullable<PickingInfo> {\r\n const count = Math.min(this.capacity, this.sprites.length);\r\n const min = Vector3.Zero();\r\n const max = Vector3.Zero();\r\n let distance = Number.MAX_VALUE;\r\n let currentSprite: Nullable<Sprite> = null;\r\n const pickedPoint = TmpVectors.Vector3[0];\r\n const cameraSpacePosition = TmpVectors.Vector3[1];\r\n const cameraView = camera.getViewMatrix();\r\n let activeRay: Ray = ray;\r\n let pickedRay: Ray = ray;\r\n\r\n for (let index = 0; index < count; index++) {\r\n const sprite = this.sprites[index];\r\n if (!sprite) {\r\n continue;\r\n }\r\n\r\n if (predicate) {\r\n if (!predicate(sprite)) {\r\n continue;\r\n }\r\n } else if (!sprite.isPickable) {\r\n continue;\r\n }\r\n\r\n Vector3.TransformCoordinatesToRef(sprite.position, cameraView, cameraSpacePosition);\r\n\r\n if (sprite.angle) {\r\n // Create a rotation matrix to rotate the ray to the sprite's rotation\r\n Matrix.TranslationToRef(-cameraSpacePosition.x, -cameraSpacePosition.y, 0, TmpVectors.Matrix[1]);\r\n Matrix.TranslationToRef(cameraSpacePosition.x, cameraSpacePosition.y, 0, TmpVectors.Matrix[2]);\r\n Matrix.RotationZToRef(-sprite.angle, TmpVectors.Matrix[3]);\r\n\r\n // inv translation x rotation x translation\r\n TmpVectors.Matrix[1].multiplyToRef(TmpVectors.Matrix[3], TmpVectors.Matrix[4]);\r\n TmpVectors.Matrix[4].multiplyToRef(TmpVectors.Matrix[2], TmpVectors.Matrix[0]);\r\n\r\n activeRay = ray.clone();\r\n Vector3.TransformCoordinatesToRef(ray.origin, TmpVectors.Matrix[0], activeRay.origin);\r\n Vector3.TransformNormalToRef(ray.direction, TmpVectors.Matrix[0], activeRay.direction);\r\n } else {\r\n activeRay = ray;\r\n }\r\n\r\n min.copyFromFloats(cameraSpacePosition.x - sprite.width / 2, cameraSpacePosition.y - sprite.height / 2, cameraSpacePosition.z);\r\n max.copyFromFloats(cameraSpacePosition.x + sprite.width / 2, cameraSpacePosition.y + sprite.height / 2, cameraSpacePosition.z);\r\n\r\n if (activeRay.intersectsBoxMinMax(min, max)) {\r\n const currentDistance = Vector3.Distance(cameraSpacePosition, activeRay.origin);\r\n\r\n if (distance > currentDistance) {\r\n if (!this._checkTextureAlpha(sprite, activeRay, currentDistance, min, max)) {\r\n continue;\r\n }\r\n\r\n pickedRay = activeRay;\r\n distance = currentDistance;\r\n currentSprite = sprite;\r\n\r\n if (fastCheck) {\r\n break;\r\n }\r\n }\r\n }\r\n }\r\n\r\n if (currentSprite) {\r\n const result = new PickingInfo();\r\n\r\n cameraView.invertToRef(TmpVectors.Matrix[0]);\r\n result.hit = true;\r\n result.pickedSprite = currentSprite;\r\n result.distance = distance;\r\n\r\n // Get picked point\r\n const direction = TmpVectors.Vector3[2];\r\n direction.copyFrom(pickedRay.direction);\r\n direction.normalize();\r\n direction.scaleInPlace(distance);\r\n\r\n pickedRay.origin.addToRef(direction, pickedPoint);\r\n result.pickedPoint = Vector3.TransformCoordinates(pickedPoint, TmpVectors.Matrix[0]);\r\n\r\n return result;\r\n }\r\n\r\n return null;\r\n }\r\n\r\n /**\r\n * Intersects the sprites with a ray\r\n * @param ray defines the ray to intersect with\r\n * @param camera defines the current active camera\r\n * @param predicate defines a predicate used to select candidate sprites\r\n * @returns null if no hit or a PickingInfo array\r\n */\r\n public multiIntersects(ray: Ray, camera: Camera, predicate?: (sprite: Sprite) => boolean): Nullable<PickingInfo[]> {\r\n const count = Math.min(this.capacity, this.sprites.length);\r\n const min = Vector3.Zero();\r\n const max = Vector3.Zero();\r\n let distance: number;\r\n const results: Nullable<PickingInfo[]> = [];\r\n const pickedPoint = TmpVectors.Vector3[0].copyFromFloats(0, 0, 0);\r\n const cameraSpacePosition = TmpVectors.Vector3[1].copyFromFloats(0, 0, 0);\r\n const cameraView = camera.getViewMatrix();\r\n\r\n for (let index = 0; index < count; index++) {\r\n const sprite = this.sprites[index];\r\n if (!sprite) {\r\n continue;\r\n }\r\n\r\n if (predicate) {\r\n if (!predicate(sprite)) {\r\n continue;\r\n }\r\n } else if (!sprite.isPickable) {\r\n continue;\r\n }\r\n\r\n Vector3.TransformCoordinatesToRef(sprite.position, cameraView, cameraSpacePosition);\r\n\r\n min.copyFromFloats(cameraSpacePosition.x - sprite.width / 2, cameraSpacePosition.y - sprite.height / 2, cameraSpacePosition.z);\r\n max.copyFromFloats(cameraSpacePosition.x + sprite.width / 2, cameraSpacePosition.y + sprite.height / 2, cameraSpacePosition.z);\r\n\r\n if (ray.intersectsBoxMinMax(min, max)) {\r\n distance = Vector3.Distance(cameraSpacePosition, ray.origin);\r\n\r\n if (!this._checkTextureAlpha(sprite, ray, distance, min, max)) {\r\n continue;\r\n }\r\n\r\n const result = new PickingInfo();\r\n results.push(result);\r\n\r\n cameraView.invertToRef(TmpVectors.Matrix[0]);\r\n result.hit = true;\r\n result.pickedSprite = sprite;\r\n result.distance = distance;\r\n\r\n // Get picked point\r\n const direction = TmpVectors.Vector3[2];\r\n direction.copyFrom(ray.direction);\r\n direction.normalize();\r\n direction.scaleInPlace(distance);\r\n\r\n ray.origin.addToRef(direction, pickedPoint);\r\n result.pickedPoint = Vector3.TransformCoordinates(pickedPoint, TmpVectors.Matrix[0]);\r\n }\r\n }\r\n\r\n return results;\r\n }\r\n\r\n /**\r\n * Render all child sprites\r\n */\r\n public render(): void {\r\n // Check\r\n if (this._fromPacked && (!this._packedAndReady || !this._spriteMap || !this._cellData)) {\r\n return;\r\n }\r\n\r\n const engine = this._scene.getEngine();\r\n const deltaTime = engine.getDeltaTime();\r\n if (this._packedAndReady) {\r\n this._spriteRenderer.render(this.sprites, deltaTime, this._scene.getViewMatrix(), this._scene.getProjectionMatrix(), this._customUpdate);\r\n } else {\r\n this._spriteRenderer.render(this.sprites, deltaTime, this._scene.getViewMatrix(), this._scene.getProjectionMatrix());\r\n }\r\n }\r\n\r\n private _customUpdate = (sprite: ThinSprite, baseSize: ISize): void => {\r\n if (!sprite.cellRef) {\r\n sprite.cellIndex = 0;\r\n }\r\n const num = sprite.cellIndex;\r\n if (typeof num === \"number\" && isFinite(num) && Math.floor(num) === num) {\r\n sprite.cellRef = this._spriteMap[sprite.cellIndex];\r\n }\r\n sprite._xOffset = this._cellData[sprite.cellRef].frame.x / baseSize.width;\r\n sprite._yOffset = this._cellData[sprite.cellRef].frame.y / baseSize.height;\r\n sprite._xSize = this._cellData[sprite.cellRef].frame.w;\r\n sprite._ySize = this._cellData[sprite.cellRef].frame.h;\r\n };\r\n\r\n /**\r\n * Rebuilds the manager (after a context lost, for eg)\r\n */\r\n public rebuild(): void {\r\n this._spriteRenderer?.rebuild();\r\n }\r\n\r\n /**\r\n * Release associated resources\r\n */\r\n public dispose(): void {\r\n if (this._spriteRenderer) {\r\n this._spriteRenderer.dispose();\r\n (<any>this._spriteRenderer) = null;\r\n }\r\n\r\n this._textureContent = null;\r\n\r\n // Remove from scene\r\n if (this._scene.spriteManagers) {\r\n const index = this._scene.spriteManagers.indexOf(this);\r\n this._scene.spriteManagers.splice(index, 1);\r\n this._scene._onSpriteManagerRemovedObservable?.notifyObservers(this);\r\n }\r\n\r\n // Callback\r\n this.onDisposeObservable.notifyObservers(this);\r\n this.onDisposeObservable.clear();\r\n\r\n this.metadata = null;\r\n }\r\n\r\n /**\r\n * Serializes the sprite manager to a JSON object\r\n * @param serializeTexture defines if the texture must be serialized as well\r\n * @returns the JSON object\r\n */\r\n public serialize(serializeTexture = false): any {\r\n const serializationObject: any = {};\r\n\r\n serializationObject.name = this.name;\r\n serializationObject.capacity = this.capacity;\r\n serializationObject.cellWidth = this.cellWidth;\r\n serializationObject.cellHeight = this.cellHeight;\r\n serializationObject.fogEnabled = this.fogEnabled;\r\n serializationObject.blendMode = this.blendMode;\r\n serializationObject.disableDepthWrite = this.disableDepthWrite;\r\n serializationObject.pixelPerfect = this.pixelPerfect;\r\n serializationObject.useLogarithmicDepth = this.useLogarithmicDepth;\r\n\r\n if (this.texture) {\r\n if (serializeTexture) {\r\n serializationObject.texture = this.texture.serialize();\r\n } else {\r\n serializationObject.textureUrl = this.texture.name;\r\n serializationObject.invertY = this.texture._invertY;\r\n }\r\n }\r\n\r\n serializationObject.sprites = [];\r\n\r\n for (const sprite of this.sprites) {\r\n serializationObject.sprites.push(sprite.serialize());\r\n }\r\n\r\n serializationObject.metadata = this.metadata;\r\n\r\n return serializationObject;\r\n }\r\n\r\n /**\r\n * Parses a JSON object to create a new sprite manager.\r\n * @param parsedManager The JSON object to parse\r\n * @param scene The scene to create the sprite manager\r\n * @param rootUrl The root url to use to load external dependencies like texture\r\n * @returns the new sprite manager\r\n */\r\n public static Parse(parsedManager: any, scene: Scene, rootUrl: string): SpriteManager {\r\n const manager = new SpriteManager(\r\n parsedManager.name,\r\n \"\",\r\n parsedManager.capacity,\r\n {\r\n width: parsedManager.cellWidth,\r\n height: parsedManager.cellHeight,\r\n },\r\n scene\r\n );\r\n\r\n if (parsedManager.fogEnabled !== undefined) {\r\n manager.fogEnabled = parsedManager.fogEnabled;\r\n }\r\n if (parsedManager.blendMode !== undefined) {\r\n manager.blendMode = parsedManager.blendMode;\r\n }\r\n if (parsedManager.disableDepthWrite !== undefined) {\r\n manager.disableDepthWrite = parsedManager.disableDepthWrite;\r\n }\r\n if (parsedManager.pixelPerfect !== undefined) {\r\n manager.pixelPerfect = parsedManager.pixelPerfect;\r\n }\r\n if (parsedManager.useLogarithmicDepth !== undefined) {\r\n manager.useLogarithmicDepth = parsedManager.useLogarithmicDepth;\r\n }\r\n\r\n if (parsedManager.metadata !== undefined) {\r\n manager.metadata = parsedManager.metadata;\r\n }\r\n\r\n if (parsedManager.texture) {\r\n manager.texture = Texture.Parse(parsedManager.texture, scene, rootUrl) as Texture;\r\n } else if (parsedManager.textureName) {\r\n manager.texture = new Texture(rootUrl + parsedManager.textureUrl, scene, false, parsedManager.invertY !== undefined ? parsedManager.invertY : true);\r\n }\r\n\r\n for (const parsedSprite of parsedManager.sprites) {\r\n Sprite.Parse(parsedSprite, manager);\r\n }\r\n\r\n return manager;\r\n }\r\n\r\n /**\r\n * Creates a sprite manager from a snippet saved in a remote file\r\n * @param name defines the name of the sprite manager to create (can be null or empty to use the one from the json data)\r\n * @param url defines the url to load from\r\n * @param scene defines the hosting scene\r\n * @param rootUrl defines the root URL to use to load textures and relative dependencies\r\n * @returns a promise that will resolve to the new sprite manager\r\n */\r\n public static async ParseFromFileAsync(name: Nullable<string>, url: string, scene: Scene, rootUrl: string = \"\"): Promise<SpriteManager> {\r\n return await new Promise((resolve, reject) => {\r\n const request = new WebRequest();\r\n request.addEventListener(\"readystatechange\", () => {\r\n if (request.readyState == 4) {\r\n if (request.status == 200) {\r\n const serializationObject = JSON.parse(request.responseText);\r\n const output = SpriteManager.Parse(serializationObject, scene || EngineStore.LastCreatedScene, rootUrl);\r\n\r\n if (name) {\r\n output.name = name;\r\n }\r\n\r\n resolve(output);\r\n } else {\r\n // eslint-disable-next-line @typescript-eslint/prefer-promise-reject-errors\r\n reject(\"Unable to load the sprite manager\");\r\n }\r\n }\r\n });\r\n\r\n request.open(\"GET\", url);\r\n request.send();\r\n });\r\n }\r\n\r\n /**\r\n * Creates a sprite manager from a snippet saved by the sprite editor\r\n * @param snippetId defines the snippet to load (can be set to _BLANK to create a default one)\r\n * @param scene defines the hosting scene\r\n * @param rootUrl defines the root URL to use to load textures and relative dependencies\r\n * @returns a promise that will resolve to the new sprite manager\r\n */\r\n // eslint-disable-next-line @typescript-eslint/promise-function-async, no-restricted-syntax\r\n public static ParseFromSnippetAsync(snippetId: string, scene: Scene, rootUrl: string = \"\"): Promise<SpriteManager> {\r\n if (snippetId === \"_BLANK\") {\r\n return Promise.resolve(new SpriteManager(\"Default sprite manager\", \"//playground.babylonjs.com/textures/player.png\", 500, 64, scene));\r\n }\r\n\r\n return new Promise((resolve, reject) => {\r\n const request = new WebRequest();\r\n request.addEventListener(\"readystatechange\", () => {\r\n if (request.readyState == 4) {\r\n if (request.status == 200) {\r\n const snippet = JSON.parse(JSON.parse(request.responseText).jsonPayload);\r\n const serializationObject = JSON.parse(snippet.spriteManager);\r\n const output = SpriteManager.Parse(serializationObject, scene || EngineStore.LastCreatedScene, rootUrl);\r\n\r\n output.snippetId = snippetId;\r\n\r\n resolve(output);\r\n } else {\r\n // eslint-disable-next-line @typescript-eslint/prefer-promise-reject-errors\r\n reject(\"Unable to load the snippet \" + snippetId);\r\n }\r\n }\r\n });\r\n\r\n request.open(\"GET\", this.SnippetUrl + \"/\" + snippetId.replace(/#/g, \"/\"));\r\n request.send();\r\n });\r\n }\r\n\r\n /**\r\n * Creates a sprite manager from a snippet saved by the sprite editor\r\n * @deprecated Please use ParseFromSnippetAsync instead\r\n * @param snippetId defines the snippet to load (can be set to _BLANK to create a default one)\r\n * @param scene defines the hosting scene\r\n * @param rootUrl defines the root URL to use to load textures and relative dependencies\r\n * @returns a promise that will resolve to the new sprite manager\r\n */\r\n public static CreateFromSnippetAsync = SpriteManager.ParseFromSnippetAsync;\r\n}\r\n"]}
1
+ {"version":3,"file":"spriteManager.js","sourceRoot":"","sources":["../../../../dev/core/src/Sprites/spriteManager.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AACnE,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAE9D,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAExD,OAAO,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AACxD,OAAO,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AACxC,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACtC,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAEhD,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAGlD,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAyGjD;;;GAGG;AACH,MAAM,OAAO,aAAa;IA6BtB;;OAEG;IACH,IAAW,SAAS,CAAC,QAAoB;QACrC,IAAI,IAAI,CAAC,kBAAkB,EAAE,CAAC;YAC1B,IAAI,CAAC,mBAAmB,CAAC,MAAM,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC;QAC7D,CAAC;QACD,IAAI,CAAC,kBAAkB,GAAG,IAAI,CAAC,mBAAmB,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;IACrE,CAAC;IAOD;;OAEG;IACH,IAAW,QAAQ;QACf,OAAO,IAAI,CAAC,OAAO,CAAC;IACxB,CAAC;IAED;;O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,EAAE,CAAC;wBACxB,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC,WAAW,CAAC,CAAC;wBACzE,MAAM,mBAAmB,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC;wBAC9D,MAAM,MAAM,GAAG,aAAa,CAAC,KAAK,CAAC,mBAAmB,EAAE,KAAK,IAAI,WAAW,CAAC,gBAAgB,EAAE,OAAO,CAAC,CAAC;wBAExG,MAAM,CAAC,SAAS,GAAG,SAAS,CAAC;wBAE7B,OAAO,CAAC,MAAM,CAAC,CAAC;oBACpB,CAAC;yBAAM,CAAC;wBACJ,2EAA2E;wBAC3E,MAAM,CAAC,6BAA6B,GAAG,SAAS,CAAC,CAAC;oBACtD,CAAC;gBACL,CAAC;YACL,CAAC,CAAC,CAAC;YAEH,OAAO,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,UAAU,GAAG,GAAG,GAAG,SAAS,CAAC,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC,CAAC;YAC1E,OAAO,CAAC,IAAI,EAAE,CAAC;QACnB,CAAC,CAAC,CAAC;IACP,CAAC;;AA7sBD,sCAAsC;AACxB,wBAAU,GAAG,SAAS,CAAC,UAAU,AAAvB,CAAwB;AA8sBhD;;;;;;;GAOG;AACW,oCAAsB,GAAG,aAAa,CAAC,qBAAqB,AAAtC,CAAuC","sourcesContent":["import type { IDisposable, Scene } from \"../scene\";\r\nimport type { Nullable } from \"../types\";\r\nimport type { Observer } from \"../Misc/observable\";\r\nimport { Observable } from \"../Misc/observable\";\r\nimport { Vector3, TmpVectors, Matrix } from \"../Maths/math.vector\";\r\nimport { Sprite } from \"./sprite\";\r\nimport { SpriteSceneComponent } from \"./spriteSceneComponent\";\r\nimport type { InternalSpriteAugmentedScene } from \"./spriteSceneComponent\";\r\nimport { PickingInfo } from \"../Collisions/pickingInfo\";\r\nimport type { Camera } from \"../Cameras/camera\";\r\nimport { Texture } from \"../Materials/Textures/texture\";\r\nimport { SceneComponentConstants } from \"../sceneComponent\";\r\nimport { Logger } from \"../Misc/logger\";\r\nimport { Tools } from \"../Misc/tools\";\r\nimport { WebRequest } from \"../Misc/webRequest\";\r\nimport type { SpriteRendererOptions } from \"./spriteRenderer\";\r\nimport { SpriteRenderer } from \"./spriteRenderer\";\r\nimport type { ThinSprite } from \"./thinSprite\";\r\nimport type { ISize } from \"../Maths/math.size\";\r\nimport { EngineStore } from \"../Engines/engineStore\";\r\nimport { Constants } from \"../Engines/constants\";\r\n\r\nimport type { Ray } from \"../Culling/ray\";\r\n\r\n// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Reflect\r\ndeclare const Reflect: any;\r\n\r\n/**\r\n * Defines the minimum interface to fulfill in order to be a sprite manager.\r\n */\r\nexport interface ISpriteManager extends IDisposable {\r\n /**\r\n * Gets or sets the unique id of the sprite manager\r\n */\r\n uniqueId: number;\r\n\r\n /**\r\n * Gets manager's name\r\n */\r\n name: string;\r\n\r\n /**\r\n * Restricts the camera to viewing objects with the same layerMask.\r\n * A camera with a layerMask of 1 will render spriteManager.layerMask & camera.layerMask!== 0\r\n */\r\n layerMask: number;\r\n\r\n /**\r\n * Gets or sets a boolean indicating if the mesh can be picked (by scene.pick for instance or through actions). Default is true\r\n */\r\n isPickable: boolean;\r\n\r\n /**\r\n * Gets the hosting scene\r\n */\r\n scene: Scene;\r\n\r\n /**\r\n * Specifies the rendering group id for this mesh (0 by default)\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/materials/advanced/transparent_rendering#rendering-groups\r\n */\r\n renderingGroupId: number;\r\n\r\n /**\r\n * Defines the list of sprites managed by the manager.\r\n */\r\n sprites: Array<Sprite>;\r\n\r\n /**\r\n * Gets or sets the spritesheet texture\r\n */\r\n texture: Texture;\r\n\r\n /** Defines the default width of a cell in the spritesheet */\r\n cellWidth: number;\r\n /** Defines the default height of a cell in the spritesheet */\r\n cellHeight: number;\r\n\r\n /** @internal */\r\n _wasDispatched: boolean;\r\n\r\n /**\r\n * Tests the intersection of a sprite with a specific ray.\r\n * @param ray The ray we are sending to test the collision\r\n * @param camera The camera space we are sending rays in\r\n * @param predicate A predicate allowing excluding sprites from the list of object to test\r\n * @param fastCheck defines if the first intersection will be used (and not the closest)\r\n * @returns picking info or null.\r\n */\r\n intersects(ray: Ray, camera: Camera, predicate?: (sprite: Sprite) => boolean, fastCheck?: boolean): Nullable<PickingInfo>;\r\n\r\n /**\r\n * Intersects the sprites with a ray\r\n * @param ray defines the ray to intersect with\r\n * @param camera defines the current active camera\r\n * @param predicate defines a predicate used to select candidate sprites\r\n * @returns null if no hit or a PickingInfo array\r\n */\r\n multiIntersects(ray: Ray, camera: Camera, predicate?: (sprite: Sprite) => boolean): Nullable<PickingInfo[]>;\r\n\r\n /**\r\n * Renders the list of sprites on screen.\r\n */\r\n render(): void;\r\n\r\n /**\r\n * Rebuilds the manager (after a context lost, for eg)\r\n */\r\n rebuild(): void;\r\n\r\n /**\r\n * Serializes the sprite manager to a JSON object\r\n */\r\n serialize(serializeTexture?: boolean): any;\r\n}\r\n\r\n/**\r\n * Options for the SpriteManager\r\n */\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nexport interface SpriteManagerOptions {\r\n /** Options for the sprite renderer */\r\n spriteRendererOptions: SpriteRendererOptions;\r\n}\r\n\r\n/**\r\n * Class used to manage multiple sprites on the same spritesheet\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/sprites\r\n */\r\nexport class SpriteManager implements ISpriteManager {\r\n /** Define the Url to load snippets */\r\n public static SnippetUrl = Constants.SnippetUrl;\r\n\r\n /** Snippet ID if the manager was created from the snippet server */\r\n public snippetId: string;\r\n\r\n /** Gets the list of sprites */\r\n public sprites: Sprite[] = [];\r\n /** Gets or sets the rendering group id (0 by default) */\r\n public renderingGroupId = 0;\r\n /** Gets or sets camera layer mask */\r\n public layerMask: number = 0x0fffffff;\r\n /** Gets or sets a boolean indicating if the sprites are pickable */\r\n public isPickable = false;\r\n\r\n /**\r\n * Gets or sets an object used to store user defined information for the sprite manager\r\n */\r\n public metadata: any = null;\r\n\r\n /** @internal */\r\n public _wasDispatched = false;\r\n\r\n /**\r\n * An event triggered when the manager is disposed.\r\n */\r\n public onDisposeObservable = new Observable<SpriteManager>();\r\n\r\n /**\r\n * Callback called when the manager is disposed\r\n */\r\n public set onDispose(callback: () => void) {\r\n if (this._onDisposeObserver) {\r\n this.onDisposeObservable.remove(this._onDisposeObserver);\r\n }\r\n this._onDisposeObserver = this.onDisposeObservable.add(callback);\r\n }\r\n\r\n /**\r\n * Gets or sets the unique id of the sprite\r\n */\r\n public uniqueId: number;\r\n\r\n /**\r\n * Gets the array of sprites\r\n */\r\n public get children() {\r\n return this.sprites;\r\n }\r\n\r\n /**\r\n * Gets the hosting scene\r\n */\r\n public get scene() {\r\n return this._scene;\r\n }\r\n\r\n /**\r\n * Gets the capacity of the manager\r\n */\r\n public get capacity() {\r\n return this._spriteRenderer.capacity;\r\n }\r\n\r\n /**\r\n * Gets or sets the spritesheet texture\r\n */\r\n public get texture(): Texture {\r\n return this._spriteRenderer.texture as Texture;\r\n }\r\n public set texture(value: Texture) {\r\n value.wrapU = Texture.CLAMP_ADDRESSMODE;\r\n value.wrapV = Texture.CLAMP_ADDRESSMODE;\r\n this._spriteRenderer.texture = value;\r\n this._textureContent = null;\r\n }\r\n\r\n /** Defines the default width of a cell in the spritesheet */\r\n public get cellWidth(): number {\r\n return this._spriteRenderer.cellWidth;\r\n }\r\n public set cellWidth(value: number) {\r\n this._spriteRenderer.cellWidth = value;\r\n }\r\n\r\n /** Defines the default height of a cell in the spritesheet */\r\n public get cellHeight(): number {\r\n return this._spriteRenderer.cellHeight;\r\n }\r\n public set cellHeight(value: number) {\r\n this._spriteRenderer.cellHeight = value;\r\n }\r\n\r\n /** Gets or sets a boolean indicating if the manager must consider scene fog when rendering */\r\n public get fogEnabled(): boolean {\r\n return this._spriteRenderer.fogEnabled;\r\n }\r\n public set fogEnabled(value: boolean) {\r\n this._spriteRenderer.fogEnabled = value;\r\n }\r\n\r\n /** Gets or sets a boolean indicating if the manager must use logarithmic depth when rendering */\r\n public get useLogarithmicDepth(): boolean {\r\n return this._spriteRenderer.useLogarithmicDepth;\r\n }\r\n public set useLogarithmicDepth(value: boolean) {\r\n this._spriteRenderer.useLogarithmicDepth = value;\r\n }\r\n\r\n /**\r\n * Blend mode use to render the particle, it can be any of\r\n * the static Constants.ALPHA_x properties provided in this class.\r\n * Default value is Constants.ALPHA_COMBINE\r\n */\r\n public get blendMode() {\r\n return this._spriteRenderer.blendMode;\r\n }\r\n public set blendMode(blendMode: number) {\r\n this._spriteRenderer.blendMode = blendMode;\r\n }\r\n\r\n private _disableDepthWrite: boolean = false;\r\n /** Disables writing to the depth buffer when rendering the sprites.\r\n * It can be handy to disable depth writing when using textures without alpha channel\r\n * and setting some specific blend modes.\r\n */\r\n public get disableDepthWrite() {\r\n return this._disableDepthWrite;\r\n }\r\n\r\n public set disableDepthWrite(value: boolean) {\r\n this._disableDepthWrite = value;\r\n this._spriteRenderer.disableDepthWrite = value;\r\n }\r\n\r\n /**\r\n * Gets or sets a boolean indicating if the renderer must render sprites with pixel perfect rendering\r\n * In this mode, sprites are rendered as \"pixel art\", which means that they appear as pixelated but remain stable when moving or when rotated or scaled.\r\n * Note that for this mode to work as expected, the sprite texture must use the BILINEAR sampling mode, not NEAREST!\r\n */\r\n public get pixelPerfect() {\r\n return this._spriteRenderer.pixelPerfect;\r\n }\r\n\r\n public set pixelPerfect(value: boolean) {\r\n this._spriteRenderer.pixelPerfect = value;\r\n if (value && this.texture.samplingMode !== Constants.TEXTURE_TRILINEAR_SAMPLINGMODE) {\r\n this.texture.updateSamplingMode(Constants.TEXTURE_TRILINEAR_SAMPLINGMODE);\r\n }\r\n }\r\n\r\n private _spriteRenderer: SpriteRenderer;\r\n /** Associative array from JSON sprite data file */\r\n private _cellData: any;\r\n /** Array of sprite names from JSON sprite data file */\r\n private _spriteMap: Array<string>;\r\n /** True when packed cell data from JSON file is ready*/\r\n private _packedAndReady: boolean = false;\r\n private _textureContent: Nullable<Uint8Array>;\r\n private _onDisposeObserver: Nullable<Observer<SpriteManager>>;\r\n private _fromPacked: boolean;\r\n private _scene: InternalSpriteAugmentedScene;\r\n\r\n /**\r\n * Creates a new sprite manager\r\n * @param name defines the manager's name\r\n * @param imgUrl defines the sprite sheet url\r\n * @param capacity defines the maximum allowed number of sprites\r\n * @param cellSize defines the size of a sprite cell\r\n * @param scene defines the hosting scene\r\n * @param epsilon defines the epsilon value to align texture (0.01 by default)\r\n * @param samplingMode defines the sampling mode to use with spritesheet\r\n * @param fromPacked set to false; do not alter\r\n * @param spriteJSON null otherwise a JSON object defining sprite sheet data; do not alter\r\n * @param options options used to create the SpriteManager instance\r\n */\r\n constructor(\r\n /** defines the manager's name */\r\n public name: string,\r\n imgUrl: string,\r\n capacity: number,\r\n cellSize: any,\r\n scene: Scene,\r\n epsilon: number = 0.01,\r\n samplingMode: number = Texture.TRILINEAR_SAMPLINGMODE,\r\n fromPacked: boolean = false,\r\n spriteJSON: null | string = null,\r\n options?: SpriteManagerOptions\r\n ) {\r\n if (!scene) {\r\n scene = EngineStore.LastCreatedScene!;\r\n }\r\n\r\n if (!scene._getComponent(SceneComponentConstants.NAME_SPRITE)) {\r\n scene._addComponent(new SpriteSceneComponent(scene));\r\n }\r\n this._fromPacked = fromPacked;\r\n\r\n this._scene = scene as InternalSpriteAugmentedScene;\r\n const engine = this._scene.getEngine();\r\n this._spriteRenderer = new SpriteRenderer(engine, capacity, epsilon, scene, options?.spriteRendererOptions);\r\n\r\n if (cellSize.width && cellSize.height) {\r\n this.cellWidth = cellSize.width;\r\n this.cellHeight = cellSize.height;\r\n } else if (cellSize !== undefined) {\r\n this.cellWidth = cellSize;\r\n this.cellHeight = cellSize;\r\n } else {\r\n this._spriteRenderer = <any>null;\r\n return;\r\n }\r\n\r\n this._scene.spriteManagers && this._scene.spriteManagers.push(this);\r\n this.uniqueId = this.scene.getUniqueId();\r\n\r\n if (imgUrl) {\r\n this.texture = new Texture(imgUrl, scene, true, false, samplingMode);\r\n }\r\n\r\n if (this._fromPacked) {\r\n this._makePacked(imgUrl, spriteJSON);\r\n }\r\n\r\n this._scene._onNewSpriteManagerAddedObservable?.notifyObservers(this);\r\n }\r\n\r\n /**\r\n * Returns the string \"SpriteManager\"\r\n * @returns \"SpriteManager\"\r\n */\r\n public getClassName(): string {\r\n return \"SpriteManager\";\r\n }\r\n\r\n private _makePacked(imgUrl: string, spriteJSON: any) {\r\n if (spriteJSON !== null) {\r\n try {\r\n //Get the JSON and Check its structure. If its an array parse it if its a JSON string etc...\r\n let celldata: any;\r\n if (typeof spriteJSON === \"string\") {\r\n celldata = JSON.parse(spriteJSON);\r\n } else {\r\n celldata = spriteJSON;\r\n }\r\n\r\n if (celldata.frames.length) {\r\n const frametemp: any = {};\r\n for (let i = 0; i < celldata.frames.length; i++) {\r\n const _f = celldata.frames[i];\r\n if (typeof Object.keys(_f)[0] !== \"string\") {\r\n throw new Error(\"Invalid JSON Format. Check the frame values and make sure the name is the first parameter.\");\r\n }\r\n\r\n const name: string = _f[Object.keys(_f)[0]];\r\n frametemp[name] = _f;\r\n }\r\n celldata.frames = frametemp;\r\n }\r\n\r\n const spritemap = <string[]>Reflect.ownKeys(celldata.frames);\r\n\r\n this._spriteMap = spritemap;\r\n this._packedAndReady = true;\r\n this._cellData = celldata.frames;\r\n } catch (e) {\r\n this._fromPacked = false;\r\n this._packedAndReady = false;\r\n throw new Error(\"Invalid JSON from string. Spritesheet managed with constant cell size.\");\r\n }\r\n } else {\r\n const re = /\\./g;\r\n let li: number;\r\n do {\r\n li = re.lastIndex;\r\n re.test(imgUrl);\r\n } while (re.lastIndex > 0);\r\n const jsonUrl = imgUrl.substring(0, li - 1) + \".json\";\r\n const onerror = () => {\r\n Logger.Error(\"JSON ERROR: Unable to load JSON file.\");\r\n this._fromPacked = false;\r\n this._packedAndReady = false;\r\n };\r\n const onload = (data: string | ArrayBuffer) => {\r\n try {\r\n const celldata = JSON.parse(data as string);\r\n const spritemap = <string[]>Reflect.ownKeys(celldata.frames);\r\n this._spriteMap = spritemap;\r\n this._packedAndReady = true;\r\n this._cellData = celldata.frames;\r\n } catch (e) {\r\n this._fromPacked = false;\r\n this._packedAndReady = false;\r\n throw new Error(\"Invalid JSON format. Please check documentation for format specifications.\");\r\n }\r\n };\r\n Tools.LoadFile(jsonUrl, onload, undefined, undefined, false, onerror);\r\n }\r\n }\r\n\r\n private _checkTextureAlpha(sprite: Sprite, ray: Ray, distance: number, min: Vector3, max: Vector3) {\r\n if (!sprite.useAlphaForPicking || !this.texture?.isReady()) {\r\n return true;\r\n }\r\n\r\n const textureSize = this.texture.getSize();\r\n if (!this._textureContent) {\r\n this._textureContent = new Uint8Array(textureSize.width * textureSize.height * 4);\r\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\r\n this.texture.readPixels(0, 0, this._textureContent);\r\n }\r\n\r\n const contactPoint = TmpVectors.Vector3[0];\r\n\r\n contactPoint.copyFrom(ray.direction);\r\n\r\n contactPoint.normalize();\r\n contactPoint.scaleInPlace(distance);\r\n contactPoint.addInPlace(ray.origin);\r\n\r\n const contactPointU = (contactPoint.x - min.x) / (max.x - min.x);\r\n const contactPointV = 1.0 - (contactPoint.y - min.y) / (max.y - min.y);\r\n\r\n const u = (sprite._xOffset * textureSize.width + contactPointU * sprite._xSize) | 0;\r\n const v = (sprite._yOffset * textureSize.height + contactPointV * sprite._ySize) | 0;\r\n\r\n const alpha = this._textureContent[(u + v * textureSize.width) * 4 + 3];\r\n\r\n return alpha > 0.5;\r\n }\r\n\r\n /**\r\n * Intersects the sprites with a ray\r\n * @param ray defines the ray to intersect with\r\n * @param camera defines the current active camera\r\n * @param predicate defines a predicate used to select candidate sprites\r\n * @param fastCheck defines if a fast check only must be done (the first potential sprite is will be used and not the closer)\r\n * @returns null if no hit or a PickingInfo\r\n */\r\n public intersects(ray: Ray, camera: Camera, predicate?: (sprite: Sprite) => boolean, fastCheck?: boolean): Nullable<PickingInfo> {\r\n const count = Math.min(this.capacity, this.sprites.length);\r\n const min = Vector3.Zero();\r\n const max = Vector3.Zero();\r\n let distance = Number.MAX_VALUE;\r\n let currentSprite: Nullable<Sprite> = null;\r\n const pickedPoint = TmpVectors.Vector3[0];\r\n const cameraSpacePosition = TmpVectors.Vector3[1];\r\n const cameraView = camera.getViewMatrix();\r\n let activeRay: Ray = ray;\r\n let pickedRay: Ray = ray;\r\n\r\n for (let index = 0; index < count; index++) {\r\n const sprite = this.sprites[index];\r\n if (!sprite) {\r\n continue;\r\n }\r\n\r\n if (predicate) {\r\n if (!predicate(sprite)) {\r\n continue;\r\n }\r\n } else if (!sprite.isPickable) {\r\n continue;\r\n }\r\n\r\n Vector3.TransformCoordinatesToRef(sprite.position, cameraView, cameraSpacePosition);\r\n\r\n if (sprite.angle) {\r\n // Create a rotation matrix to rotate the ray to the sprite's rotation\r\n Matrix.TranslationToRef(-cameraSpacePosition.x, -cameraSpacePosition.y, 0, TmpVectors.Matrix[1]);\r\n Matrix.TranslationToRef(cameraSpacePosition.x, cameraSpacePosition.y, 0, TmpVectors.Matrix[2]);\r\n Matrix.RotationZToRef(-sprite.angle, TmpVectors.Matrix[3]);\r\n\r\n // inv translation x rotation x translation\r\n TmpVectors.Matrix[1].multiplyToRef(TmpVectors.Matrix[3], TmpVectors.Matrix[4]);\r\n TmpVectors.Matrix[4].multiplyToRef(TmpVectors.Matrix[2], TmpVectors.Matrix[0]);\r\n\r\n activeRay = ray.clone();\r\n Vector3.TransformCoordinatesToRef(ray.origin, TmpVectors.Matrix[0], activeRay.origin);\r\n Vector3.TransformNormalToRef(ray.direction, TmpVectors.Matrix[0], activeRay.direction);\r\n } else {\r\n activeRay = ray;\r\n }\r\n\r\n min.copyFromFloats(cameraSpacePosition.x - sprite.width / 2, cameraSpacePosition.y - sprite.height / 2, cameraSpacePosition.z);\r\n max.copyFromFloats(cameraSpacePosition.x + sprite.width / 2, cameraSpacePosition.y + sprite.height / 2, cameraSpacePosition.z);\r\n\r\n if (activeRay.intersectsBoxMinMax(min, max)) {\r\n const currentDistance = Vector3.Distance(cameraSpacePosition, activeRay.origin);\r\n\r\n if (distance > currentDistance) {\r\n if (!this._checkTextureAlpha(sprite, activeRay, currentDistance, min, max)) {\r\n continue;\r\n }\r\n\r\n pickedRay = activeRay;\r\n distance = currentDistance;\r\n currentSprite = sprite;\r\n\r\n if (fastCheck) {\r\n break;\r\n }\r\n }\r\n }\r\n }\r\n\r\n if (currentSprite) {\r\n const result = new PickingInfo();\r\n\r\n cameraView.invertToRef(TmpVectors.Matrix[0]);\r\n result.hit = true;\r\n result.pickedSprite = currentSprite;\r\n result.distance = distance;\r\n\r\n // Get picked point\r\n const direction = TmpVectors.Vector3[2];\r\n direction.copyFrom(pickedRay.direction);\r\n direction.normalize();\r\n direction.scaleInPlace(distance);\r\n\r\n pickedRay.origin.addToRef(direction, pickedPoint);\r\n result.pickedPoint = Vector3.TransformCoordinates(pickedPoint, TmpVectors.Matrix[0]);\r\n\r\n return result;\r\n }\r\n\r\n return null;\r\n }\r\n\r\n /**\r\n * Intersects the sprites with a ray\r\n * @param ray defines the ray to intersect with\r\n * @param camera defines the current active camera\r\n * @param predicate defines a predicate used to select candidate sprites\r\n * @returns null if no hit or a PickingInfo array\r\n */\r\n public multiIntersects(ray: Ray, camera: Camera, predicate?: (sprite: Sprite) => boolean): Nullable<PickingInfo[]> {\r\n const count = Math.min(this.capacity, this.sprites.length);\r\n const min = Vector3.Zero();\r\n const max = Vector3.Zero();\r\n let distance: number;\r\n const results: Nullable<PickingInfo[]> = [];\r\n const pickedPoint = TmpVectors.Vector3[0].copyFromFloats(0, 0, 0);\r\n const cameraSpacePosition = TmpVectors.Vector3[1].copyFromFloats(0, 0, 0);\r\n const cameraView = camera.getViewMatrix();\r\n\r\n for (let index = 0; index < count; index++) {\r\n const sprite = this.sprites[index];\r\n if (!sprite) {\r\n continue;\r\n }\r\n\r\n if (predicate) {\r\n if (!predicate(sprite)) {\r\n continue;\r\n }\r\n } else if (!sprite.isPickable) {\r\n continue;\r\n }\r\n\r\n Vector3.TransformCoordinatesToRef(sprite.position, cameraView, cameraSpacePosition);\r\n\r\n min.copyFromFloats(cameraSpacePosition.x - sprite.width / 2, cameraSpacePosition.y - sprite.height / 2, cameraSpacePosition.z);\r\n max.copyFromFloats(cameraSpacePosition.x + sprite.width / 2, cameraSpacePosition.y + sprite.height / 2, cameraSpacePosition.z);\r\n\r\n if (ray.intersectsBoxMinMax(min, max)) {\r\n distance = Vector3.Distance(cameraSpacePosition, ray.origin);\r\n\r\n if (!this._checkTextureAlpha(sprite, ray, distance, min, max)) {\r\n continue;\r\n }\r\n\r\n const result = new PickingInfo();\r\n results.push(result);\r\n\r\n cameraView.invertToRef(TmpVectors.Matrix[0]);\r\n result.hit = true;\r\n result.pickedSprite = sprite;\r\n result.distance = distance;\r\n\r\n // Get picked point\r\n const direction = TmpVectors.Vector3[2];\r\n direction.copyFrom(ray.direction);\r\n direction.normalize();\r\n direction.scaleInPlace(distance);\r\n\r\n ray.origin.addToRef(direction, pickedPoint);\r\n result.pickedPoint = Vector3.TransformCoordinates(pickedPoint, TmpVectors.Matrix[0]);\r\n }\r\n }\r\n\r\n return results;\r\n }\r\n\r\n /**\r\n * Render all child sprites\r\n */\r\n public render(): void {\r\n // Check\r\n if (this._fromPacked && (!this._packedAndReady || !this._spriteMap || !this._cellData)) {\r\n return;\r\n }\r\n\r\n const engine = this._scene.getEngine();\r\n const deltaTime = engine.getDeltaTime();\r\n if (this._packedAndReady) {\r\n this._spriteRenderer.render(this.sprites, deltaTime, this._scene.getViewMatrix(), this._scene.getProjectionMatrix(), this._customUpdate);\r\n } else {\r\n this._spriteRenderer.render(this.sprites, deltaTime, this._scene.getViewMatrix(), this._scene.getProjectionMatrix());\r\n }\r\n }\r\n\r\n private _customUpdate = (sprite: ThinSprite, baseSize: ISize): void => {\r\n if (!sprite.cellRef) {\r\n sprite.cellIndex = 0;\r\n }\r\n const num = sprite.cellIndex;\r\n if (typeof num === \"number\" && isFinite(num) && Math.floor(num) === num) {\r\n sprite.cellRef = this._spriteMap[sprite.cellIndex];\r\n }\r\n sprite._xOffset = this._cellData[sprite.cellRef].frame.x / baseSize.width;\r\n sprite._yOffset = this._cellData[sprite.cellRef].frame.y / baseSize.height;\r\n sprite._xSize = this._cellData[sprite.cellRef].frame.w;\r\n sprite._ySize = this._cellData[sprite.cellRef].frame.h;\r\n };\r\n\r\n /**\r\n * Rebuilds the manager (after a context lost, for eg)\r\n */\r\n public rebuild(): void {\r\n this._spriteRenderer?.rebuild();\r\n }\r\n\r\n /**\r\n * Release associated resources\r\n */\r\n public dispose(): void {\r\n if (this._spriteRenderer) {\r\n this._spriteRenderer.dispose();\r\n (<any>this._spriteRenderer) = null;\r\n }\r\n\r\n this._textureContent = null;\r\n\r\n // Remove from scene\r\n if (this._scene.spriteManagers) {\r\n const index = this._scene.spriteManagers.indexOf(this);\r\n this._scene.spriteManagers.splice(index, 1);\r\n this._scene._onSpriteManagerRemovedObservable?.notifyObservers(this);\r\n }\r\n\r\n // Callback\r\n this.onDisposeObservable.notifyObservers(this);\r\n this.onDisposeObservable.clear();\r\n\r\n this.metadata = null;\r\n }\r\n\r\n /**\r\n * Serializes the sprite manager to a JSON object\r\n * @param serializeTexture defines if the texture must be serialized as well\r\n * @returns the JSON object\r\n */\r\n public serialize(serializeTexture = false): any {\r\n const serializationObject: any = {};\r\n\r\n serializationObject.name = this.name;\r\n serializationObject.capacity = this.capacity;\r\n serializationObject.cellWidth = this.cellWidth;\r\n serializationObject.cellHeight = this.cellHeight;\r\n serializationObject.fogEnabled = this.fogEnabled;\r\n serializationObject.blendMode = this.blendMode;\r\n serializationObject.disableDepthWrite = this.disableDepthWrite;\r\n serializationObject.pixelPerfect = this.pixelPerfect;\r\n serializationObject.useLogarithmicDepth = this.useLogarithmicDepth;\r\n\r\n if (this.texture) {\r\n if (serializeTexture) {\r\n serializationObject.texture = this.texture.serialize();\r\n } else {\r\n serializationObject.textureUrl = this.texture.name;\r\n serializationObject.invertY = this.texture._invertY;\r\n }\r\n }\r\n\r\n serializationObject.sprites = [];\r\n\r\n for (const sprite of this.sprites) {\r\n serializationObject.sprites.push(sprite.serialize());\r\n }\r\n\r\n serializationObject.metadata = this.metadata;\r\n\r\n return serializationObject;\r\n }\r\n\r\n /**\r\n * Parses a JSON object to create a new sprite manager.\r\n * @param parsedManager The JSON object to parse\r\n * @param scene The scene to create the sprite manager\r\n * @param rootUrl The root url to use to load external dependencies like texture\r\n * @returns the new sprite manager\r\n */\r\n public static Parse(parsedManager: any, scene: Scene, rootUrl: string): SpriteManager {\r\n const manager = new SpriteManager(\r\n parsedManager.name,\r\n \"\",\r\n parsedManager.capacity,\r\n {\r\n width: parsedManager.cellWidth,\r\n height: parsedManager.cellHeight,\r\n },\r\n scene\r\n );\r\n\r\n if (parsedManager.fogEnabled !== undefined) {\r\n manager.fogEnabled = parsedManager.fogEnabled;\r\n }\r\n if (parsedManager.blendMode !== undefined) {\r\n manager.blendMode = parsedManager.blendMode;\r\n }\r\n if (parsedManager.disableDepthWrite !== undefined) {\r\n manager.disableDepthWrite = parsedManager.disableDepthWrite;\r\n }\r\n if (parsedManager.pixelPerfect !== undefined) {\r\n manager.pixelPerfect = parsedManager.pixelPerfect;\r\n }\r\n if (parsedManager.useLogarithmicDepth !== undefined) {\r\n manager.useLogarithmicDepth = parsedManager.useLogarithmicDepth;\r\n }\r\n\r\n if (parsedManager.metadata !== undefined) {\r\n manager.metadata = parsedManager.metadata;\r\n }\r\n\r\n if (parsedManager.texture) {\r\n manager.texture = Texture.Parse(parsedManager.texture, scene, rootUrl) as Texture;\r\n } else if (parsedManager.textureName) {\r\n manager.texture = new Texture(rootUrl + parsedManager.textureUrl, scene, false, parsedManager.invertY !== undefined ? parsedManager.invertY : true);\r\n }\r\n\r\n for (const parsedSprite of parsedManager.sprites) {\r\n Sprite.Parse(parsedSprite, manager);\r\n }\r\n\r\n return manager;\r\n }\r\n\r\n /**\r\n * Creates a sprite manager from a snippet saved in a remote file\r\n * @param name defines the name of the sprite manager to create (can be null or empty to use the one from the json data)\r\n * @param url defines the url to load from\r\n * @param scene defines the hosting scene\r\n * @param rootUrl defines the root URL to use to load textures and relative dependencies\r\n * @returns a promise that will resolve to the new sprite manager\r\n */\r\n public static async ParseFromFileAsync(name: Nullable<string>, url: string, scene: Scene, rootUrl: string = \"\"): Promise<SpriteManager> {\r\n return await new Promise((resolve, reject) => {\r\n const request = new WebRequest();\r\n request.addEventListener(\"readystatechange\", () => {\r\n if (request.readyState == 4) {\r\n if (request.status == 200) {\r\n const serializationObject = JSON.parse(request.responseText);\r\n const output = SpriteManager.Parse(serializationObject, scene || EngineStore.LastCreatedScene, rootUrl);\r\n\r\n if (name) {\r\n output.name = name;\r\n }\r\n\r\n resolve(output);\r\n } else {\r\n // eslint-disable-next-line @typescript-eslint/prefer-promise-reject-errors\r\n reject(\"Unable to load the sprite manager\");\r\n }\r\n }\r\n });\r\n\r\n request.open(\"GET\", url);\r\n request.send();\r\n });\r\n }\r\n\r\n /**\r\n * Creates a sprite manager from a snippet saved by the sprite editor\r\n * @param snippetId defines the snippet to load (can be set to _BLANK to create a default one)\r\n * @param scene defines the hosting scene\r\n * @param rootUrl defines the root URL to use to load textures and relative dependencies\r\n * @returns a promise that will resolve to the new sprite manager\r\n */\r\n // eslint-disable-next-line @typescript-eslint/promise-function-async, no-restricted-syntax\r\n public static ParseFromSnippetAsync(snippetId: string, scene: Scene, rootUrl: string = \"\"): Promise<SpriteManager> {\r\n if (snippetId === \"_BLANK\") {\r\n return Promise.resolve(new SpriteManager(\"Default sprite manager\", \"//playground.babylonjs.com/textures/player.png\", 500, 64, scene));\r\n }\r\n\r\n return new Promise((resolve, reject) => {\r\n const request = new WebRequest();\r\n request.addEventListener(\"readystatechange\", () => {\r\n if (request.readyState == 4) {\r\n if (request.status == 200) {\r\n const snippet = JSON.parse(JSON.parse(request.responseText).jsonPayload);\r\n const serializationObject = JSON.parse(snippet.spriteManager);\r\n const output = SpriteManager.Parse(serializationObject, scene || EngineStore.LastCreatedScene, rootUrl);\r\n\r\n output.snippetId = snippetId;\r\n\r\n resolve(output);\r\n } else {\r\n // eslint-disable-next-line @typescript-eslint/prefer-promise-reject-errors\r\n reject(\"Unable to load the snippet \" + snippetId);\r\n }\r\n }\r\n });\r\n\r\n request.open(\"GET\", this.SnippetUrl + \"/\" + snippetId.replace(/#/g, \"/\"));\r\n request.send();\r\n });\r\n }\r\n\r\n /**\r\n * Creates a sprite manager from a snippet saved by the sprite editor\r\n * @deprecated Please use ParseFromSnippetAsync instead\r\n * @param snippetId defines the snippet to load (can be set to _BLANK to create a default one)\r\n * @param scene defines the hosting scene\r\n * @param rootUrl defines the root URL to use to load textures and relative dependencies\r\n * @returns a promise that will resolve to the new sprite manager\r\n */\r\n public static CreateFromSnippetAsync = SpriteManager.ParseFromSnippetAsync;\r\n}\r\n"]}