@babylonjs/core 7.26.2 → 7.26.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (60) hide show
  1. package/Animations/animationGroup.d.ts +1 -0
  2. package/Animations/animationGroup.js +1 -0
  3. package/Animations/animationGroup.js.map +1 -1
  4. package/Audio/audioSceneComponent.d.ts +1 -1
  5. package/Audio/audioSceneComponent.js +2 -2
  6. package/Audio/audioSceneComponent.js.map +1 -1
  7. package/Engines/abstractEngine.js +2 -2
  8. package/Engines/abstractEngine.js.map +1 -1
  9. package/Engines/engine.d.ts +2 -67
  10. package/Layers/effectLayerSceneComponent.js +2 -1
  11. package/Layers/effectLayerSceneComponent.js.map +1 -1
  12. package/LensFlares/lensFlareSystemSceneComponent.js +2 -1
  13. package/LensFlares/lensFlareSystemSceneComponent.js.map +1 -1
  14. package/Lights/Shadows/shadowGeneratorSceneComponent.d.ts +1 -1
  15. package/Lights/Shadows/shadowGeneratorSceneComponent.js +2 -2
  16. package/Lights/Shadows/shadowGeneratorSceneComponent.js.map +1 -1
  17. package/Loading/Plugins/babylonFileLoader.js +3 -3
  18. package/Loading/Plugins/babylonFileLoader.js.map +1 -1
  19. package/Loading/Plugins/babylonFileParser.function.d.ts +45 -0
  20. package/Loading/Plugins/babylonFileParser.function.js +61 -0
  21. package/Loading/Plugins/babylonFileParser.function.js.map +1 -0
  22. package/Loading/Plugins/index.d.ts +1 -0
  23. package/Loading/Plugins/index.js +1 -0
  24. package/Loading/Plugins/index.js.map +1 -1
  25. package/Loading/loadingScreen.js +0 -2
  26. package/Loading/loadingScreen.js.map +1 -1
  27. package/Materials/Node/Blocks/Fragment/heightToNormalBlock.js +1 -1
  28. package/Materials/Node/Blocks/Fragment/heightToNormalBlock.js.map +1 -1
  29. package/Materials/Node/nodeMaterialBuildState.d.ts +3 -3
  30. package/Materials/Textures/videoTexture.js +0 -4
  31. package/Materials/Textures/videoTexture.js.map +1 -1
  32. package/Materials/effect.js +4 -0
  33. package/Materials/effect.js.map +1 -1
  34. package/Maths/math.scalar.d.ts +1 -4
  35. package/Meshes/GaussianSplatting/gaussianSplattingMesh.d.ts +2 -1
  36. package/Meshes/GaussianSplatting/gaussianSplattingMesh.js +29 -17
  37. package/Meshes/GaussianSplatting/gaussianSplattingMesh.js.map +1 -1
  38. package/Meshes/mesh.js +9 -2
  39. package/Meshes/mesh.js.map +1 -1
  40. package/Meshes/meshUtils.js +4 -0
  41. package/Meshes/meshUtils.js.map +1 -1
  42. package/Misc/timingTools.js +1 -0
  43. package/Misc/timingTools.js.map +1 -1
  44. package/Misc/videoRecorder.d.ts +1 -0
  45. package/Misc/videoRecorder.js +4 -4
  46. package/Misc/videoRecorder.js.map +1 -1
  47. package/Particles/particleSystemComponent.js +4 -4
  48. package/Particles/particleSystemComponent.js.map +1 -1
  49. package/Rendering/subSurfaceSceneComponent.js +2 -2
  50. package/Rendering/subSurfaceSceneComponent.js.map +1 -1
  51. package/Sprites/spriteRenderer.d.ts +0 -2
  52. package/Sprites/spriteRenderer.js +11 -4
  53. package/Sprites/spriteRenderer.js.map +1 -1
  54. package/abstractScene.d.ts +0 -52
  55. package/abstractScene.js +0 -60
  56. package/abstractScene.js.map +1 -1
  57. package/package.json +1 -1
  58. package/Shaders/blur.fragment.d.ts +0 -5
  59. package/Shaders/blur.fragment.js +0 -14
  60. package/Shaders/blur.fragment.js.map +0 -1
@@ -2987,24 +2987,8 @@ var OffscreenCanvasRenderingContext2D: {
2987
2987
  /* eslint-disable @typescript-eslint/naming-convention */
2988
2988
  // Mixins
2989
2989
  interface Window {
2990
- mozIndexedDB: IDBFactory;
2991
- webkitIndexedDB: IDBFactory;
2992
- msIndexedDB: IDBFactory;
2993
- webkitURL: typeof URL;
2994
- mozRequestAnimationFrame(callback: FrameRequestCallback): number;
2995
- oRequestAnimationFrame(callback: FrameRequestCallback): number;
2996
- WebGLRenderingContext: WebGLRenderingContext;
2997
2990
  CANNON: any;
2998
- AudioContext: AudioContext;
2999
- webkitAudioContext: AudioContext;
3000
- PointerEvent: any;
3001
- Math: Math;
3002
- Uint8Array: Uint8ArrayConstructor;
3003
- Float32Array: Float32ArrayConstructor;
3004
- mozURL: typeof URL;
3005
- msURL: typeof URL;
3006
2991
  DracoDecoderModule: any;
3007
- setImmediate(handler: (...args: any[]) => void): number;
3008
2992
  }
3009
2993
 
3010
2994
  interface WorkerGlobalScope {
@@ -3013,62 +2997,11 @@ interface WorkerGlobalScope {
3013
2997
 
3014
2998
  type WorkerSelf = WindowOrWorkerGlobalScope & WorkerGlobalScope;
3015
2999
 
3016
- interface HTMLCanvasElement {
3017
- /** Track whether a record is in progress */
3018
- isRecording: boolean;
3019
- /** Capture Stream method defined by some browsers */
3020
- captureStream(fps?: number): MediaStream;
3021
- }
3022
-
3023
- interface CanvasRenderingContext2D {
3024
- msImageSmoothingEnabled: boolean;
3025
- }
3026
-
3027
3000
  // Babylon Extension to enable UIEvents to work with our IUIEvents
3028
3001
  interface UIEvent {
3029
3002
  inputIndex: number;
3030
3003
  }
3031
3004
 
3032
- interface MouseEvent {
3033
- mozMovementX: number;
3034
- mozMovementY: number;
3035
- webkitMovementX: number;
3036
- webkitMovementY: number;
3037
- msMovementX: number;
3038
- msMovementY: number;
3039
- }
3040
-
3041
- interface Navigator {
3042
- mozGetVRDevices: (any: any) => any;
3043
- webkitGetUserMedia(constraints: MediaStreamConstraints, successCallback: any, errorCallback: any): void;
3044
- mozGetUserMedia(constraints: MediaStreamConstraints, successCallback: any, errorCallback: any): void;
3045
- msGetUserMedia(constraints: MediaStreamConstraints, successCallback: any, errorCallback: any): void;
3046
-
3047
- webkitGetGamepads(): Gamepad[];
3048
- msGetGamepads(): Gamepad[];
3049
- webkitGamepads(): Gamepad[];
3050
- }
3051
-
3052
- interface HTMLVideoElement {
3053
- mozSrcObject: any;
3054
- }
3055
-
3056
- interface Math {
3057
- fround(x: number): number;
3058
- imul(a: number, b: number): number;
3059
- log2(x: number): number;
3060
- }
3061
-
3062
- interface OffscreenCanvas extends EventTarget {
3063
- width: number;
3064
- height: number;
3065
- }
3066
-
3067
- var OffscreenCanvas: {
3068
- prototype: OffscreenCanvas;
3069
- new (width: number, height: number): OffscreenCanvas;
3070
- };
3071
-
3072
3005
  // Experimental Pressure API https://wicg.github.io/compute-pressure/
3073
3006
  type PressureSource = "cpu";
3074
3007
 
@@ -3076,6 +3009,7 @@ type PressureState = "nominal" | "fair" | "serious" | "critical";
3076
3009
 
3077
3010
  type PressureFactor = "thermal" | "power-supply";
3078
3011
 
3012
+ // Not available in Firefox, Safari, Not baseline.
3079
3013
  interface PressureRecord {
3080
3014
  source: PressureSource;
3081
3015
  state: PressureState;
@@ -3083,6 +3017,7 @@ interface PressureRecord {
3083
3017
  time: number;
3084
3018
  }
3085
3019
 
3020
+ // Not available in Firefox, Safari
3086
3021
  interface PressureObserver {
3087
3022
  observe(source: PressureSource): void;
3088
3023
  unobserve(source: PressureSource): void;
@@ -3,8 +3,9 @@ import { SceneComponentConstants } from "../sceneComponent.js";
3
3
  import { EffectLayer } from "./effectLayer.js";
4
4
  import { AbstractScene } from "../abstractScene.js";
5
5
  import { EngineStore } from "../Engines/engineStore.js";
6
+ import { AddParser } from "../Loading/Plugins/babylonFileParser.function.js";
6
7
  // Adds the parser to the scene parsers.
7
- AbstractScene.AddParser(SceneComponentConstants.NAME_EFFECTLAYER, (parsedData, scene, container, rootUrl) => {
8
+ AddParser(SceneComponentConstants.NAME_EFFECTLAYER, (parsedData, scene, container, rootUrl) => {
8
9
  if (parsedData.effectLayers) {
9
10
  if (!container.effectLayers) {
10
11
  container.effectLayers = [];
@@ -1 +1 @@
1
- {"version":3,"file":"effectLayerSceneComponent.js","sourceRoot":"","sources":["../../../../dev/core/src/Layers/effectLayerSceneComponent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAM3C,OAAO,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAA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AC;YAEnC,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC;YACvC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;gBACpC,MAAM,WAAW,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;gBAC9B,IAAI,WAAW,CAAC,gBAAgB,KAAK,gBAAgB,EAAE;oBACnD,IAAI,WAAW,CAAC,YAAY,EAAE,EAAE;wBAC5B,WAAW,CAAC,MAAM,EAAE,CAAC;qBACxB;iBACJ;aACJ;YACD,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC;SACrC;IACL,CAAC;IAEO,WAAW;QACf,IAAI,IAAI,CAAC,cAAc,EAAE;YACrB,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;SAClB;IACL,CAAC;IACO,mBAAmB,CAAC,KAAa;QACrC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,0BAA0B,EAAE,IAAI,IAAI,CAAC,cAAc,EAAE;YACjE,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;SACrB;IACL,CAAC;CACJ;AAED,WAAW,CAAC,6BAA6B,GAAG,CAAC,KAAY,EAAE,EAAE;IACzD,IAAI,SAAS,GAAG,KAAK,CAAC,aAAa,CAAC,uBAAuB,CAAC,gBAAgB,CAA8B,CAAC;IAC3G,IAAI,CAAC,SAAS,EAAE;QACZ,SAAS,GAAG,IAAI,yBAAyB,CAAC,KAAK,CAAC,CAAC;QACjD,KAAK,CAAC,aAAa,CAAC,SAAS,CAAC,CAAC;KAClC;AACL,CAAC,CAAC","sourcesContent":["import { Camera } from \"../Cameras/camera\";\r\nimport type { Scene } from \"../scene\";\r\nimport type { AbstractEngine } from \"../Engines/abstractEngine\";\r\nimport type { AbstractMesh } from \"../Meshes/abstractMesh\";\r\nimport type { RenderTargetTexture } from \"../Materials/Textures/renderTargetTexture\";\r\nimport type { ISceneSerializableComponent } from \"../sceneComponent\";\r\nimport { SceneComponentConstants } from \"../sceneComponent\";\r\nimport { EffectLayer } from \"./effectLayer\";\r\nimport { AbstractScene } from \"../abstractScene\";\r\nimport type { AssetContainer } from \"../assetContainer\";\r\nimport { EngineStore } from \"../Engines/engineStore\";\r\n// Adds the parser to the scene parsers.\r\nAbstractScene.AddParser(SceneComponentConstants.NAME_EFFECTLAYER, (parsedData: any, scene: Scene, container: AssetContainer, rootUrl: string) => {\r\n if (parsedData.effectLayers) {\r\n if (!container.effectLayers) {\r\n container.effectLayers = [] as EffectLayer[];\r\n }\r\n\r\n for (let index = 0; index < parsedData.effectLayers.length; index++) {\r\n const effectLayer = EffectLayer.Parse(parsedData.effectLayers[index], scene, rootUrl);\r\n container.effectLayers.push(effectLayer);\r\n }\r\n }\r\n});\r\n\r\ndeclare module \"../abstractScene\" {\r\n export interface AbstractScene {\r\n /**\r\n * The list of effect layers (highlights/glow) added to the scene\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/highlightLayer\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/glowLayer\r\n */\r\n effectLayers: Array<EffectLayer>;\r\n\r\n /**\r\n * Removes the given effect layer from this scene.\r\n * @param toRemove defines the effect layer to remove\r\n * @returns the index of the removed effect layer\r\n */\r\n removeEffectLayer(toRemove: EffectLayer): number;\r\n\r\n /**\r\n * Adds the given effect layer to this scene\r\n * @param newEffectLayer defines the effect layer to add\r\n */\r\n addEffectLayer(newEffectLayer: EffectLayer): void;\r\n }\r\n}\r\n\r\nAbstractScene.prototype.removeEffectLayer = function (toRemove: EffectLayer): number {\r\n const index = this.effectLayers.indexOf(toRemove);\r\n if (index !== -1) {\r\n this.effectLayers.splice(index, 1);\r\n }\r\n\r\n return index;\r\n};\r\n\r\nAbstractScene.prototype.addEffectLayer = function (newEffectLayer: EffectLayer): void {\r\n this.effectLayers.push(newEffectLayer);\r\n};\r\n\r\n/**\r\n * Defines the layer scene component responsible to manage any effect layers\r\n * in a given scene.\r\n */\r\nexport class EffectLayerSceneComponent implements ISceneSerializableComponent {\r\n /**\r\n * The component name helpful to identify the component in the list of scene components.\r\n */\r\n public readonly name = SceneComponentConstants.NAME_EFFECTLAYER;\r\n\r\n /**\r\n * The scene the component belongs to.\r\n */\r\n public scene: Scene;\r\n\r\n private _engine: AbstractEngine;\r\n private _renderEffects = false;\r\n private _needStencil = false;\r\n private _previousStencilState = false;\r\n\r\n /**\r\n * Creates a new instance of the component for the given scene\r\n * @param scene Defines the scene to register the component in\r\n */\r\n constructor(scene?: Scene) {\r\n this.scene = scene || <Scene>EngineStore.LastCreatedScene;\r\n if (!this.scene) {\r\n return;\r\n }\r\n this._engine = this.scene.getEngine();\r\n this.scene.effectLayers = [] as EffectLayer[];\r\n }\r\n\r\n /**\r\n * Registers the component in a given scene\r\n */\r\n public register(): void {\r\n this.scene._isReadyForMeshStage.registerStep(SceneComponentConstants.STEP_ISREADYFORMESH_EFFECTLAYER, this, this._isReadyForMesh);\r\n\r\n this.scene._cameraDrawRenderTargetStage.registerStep(SceneComponentConstants.STEP_CAMERADRAWRENDERTARGET_EFFECTLAYER, this, this._renderMainTexture);\r\n\r\n this.scene._beforeCameraDrawStage.registerStep(SceneComponentConstants.STEP_BEFORECAMERADRAW_EFFECTLAYER, this, this._setStencil);\r\n\r\n this.scene._afterRenderingGroupDrawStage.registerStep(SceneComponentConstants.STEP_AFTERRENDERINGGROUPDRAW_EFFECTLAYER_DRAW, this, this._drawRenderingGroup);\r\n\r\n this.scene._afterCameraDrawStage.registerStep(SceneComponentConstants.STEP_AFTERCAMERADRAW_EFFECTLAYER, this, this._setStencilBack);\r\n this.scene._afterCameraDrawStage.registerStep(SceneComponentConstants.STEP_AFTERCAMERADRAW_EFFECTLAYER_DRAW, this, this._drawCamera);\r\n }\r\n\r\n /**\r\n * Rebuilds the elements related to this component in case of\r\n * context lost for instance.\r\n */\r\n public rebuild(): void {\r\n const layers = this.scene.effectLayers;\r\n for (const effectLayer of layers) {\r\n effectLayer._rebuild();\r\n }\r\n }\r\n\r\n /**\r\n * Serializes the component data to the specified json object\r\n * @param serializationObject The object to serialize to\r\n */\r\n public serialize(serializationObject: any): void {\r\n // Effect layers\r\n serializationObject.effectLayers = [];\r\n\r\n const layers = this.scene.effectLayers;\r\n for (const effectLayer of layers) {\r\n if (effectLayer.serialize) {\r\n serializationObject.effectLayers.push(effectLayer.serialize());\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Adds all the elements from the container to the scene\r\n * @param container the container holding the elements\r\n */\r\n public addFromContainer(container: AbstractScene): void {\r\n if (!container.effectLayers) {\r\n return;\r\n }\r\n container.effectLayers.forEach((o) => {\r\n this.scene.addEffectLayer(o);\r\n });\r\n }\r\n\r\n /**\r\n * Removes all the elements in the container from the scene\r\n * @param container contains the elements to remove\r\n * @param dispose if the removed element should be disposed (default: false)\r\n */\r\n public removeFromContainer(container: AbstractScene, dispose?: boolean): void {\r\n if (!container.effectLayers) {\r\n return;\r\n }\r\n container.effectLayers.forEach((o) => {\r\n this.scene.removeEffectLayer(o);\r\n if (dispose) {\r\n o.dispose();\r\n }\r\n });\r\n }\r\n\r\n /**\r\n * Disposes the component and the associated resources.\r\n */\r\n public dispose(): void {\r\n const layers = this.scene.effectLayers;\r\n while (layers.length) {\r\n layers[0].dispose();\r\n }\r\n }\r\n\r\n private _isReadyForMesh(mesh: AbstractMesh, hardwareInstancedRendering: boolean): boolean {\r\n const currentRenderPassId = this._engine.currentRenderPassId;\r\n const layers = this.scene.effectLayers;\r\n for (const layer of layers) {\r\n if (!layer.hasMesh(mesh)) {\r\n continue;\r\n }\r\n\r\n const renderTarget = <RenderTargetTexture>(<any>layer)._mainTexture;\r\n this._engine.currentRenderPassId = renderTarget.renderPassId;\r\n\r\n for (const subMesh of mesh.subMeshes) {\r\n if (!layer.isReady(subMesh, hardwareInstancedRendering)) {\r\n this._engine.currentRenderPassId = currentRenderPassId;\r\n return false;\r\n }\r\n }\r\n }\r\n this._engine.currentRenderPassId = currentRenderPassId;\r\n return true;\r\n }\r\n\r\n private _renderMainTexture(camera: Camera): boolean {\r\n this._renderEffects = false;\r\n this._needStencil = false;\r\n\r\n let needRebind = false;\r\n\r\n const layers = this.scene.effectLayers;\r\n if (layers && layers.length > 0) {\r\n this._previousStencilState = this._engine.getStencilBuffer();\r\n for (const effectLayer of layers) {\r\n if (\r\n effectLayer.shouldRender() &&\r\n (!effectLayer.camera ||\r\n (effectLayer.camera.cameraRigMode === Camera.RIG_MODE_NONE && camera === effectLayer.camera) ||\r\n (effectLayer.camera.cameraRigMode !== Camera.RIG_MODE_NONE && effectLayer.camera._rigCameras.indexOf(camera) > -1))\r\n ) {\r\n this._renderEffects = true;\r\n this._needStencil = this._needStencil || effectLayer.needStencil();\r\n\r\n const renderTarget = <RenderTargetTexture>(<any>effectLayer)._mainTexture;\r\n if (renderTarget._shouldRender()) {\r\n this.scene.incrementRenderId();\r\n renderTarget.render(false, false);\r\n needRebind = true;\r\n }\r\n }\r\n }\r\n\r\n this.scene.incrementRenderId();\r\n }\r\n\r\n return needRebind;\r\n }\r\n\r\n private _setStencil() {\r\n // Activate effect Layer stencil\r\n if (this._needStencil) {\r\n this._engine.setStencilBuffer(true);\r\n }\r\n }\r\n\r\n private _setStencilBack() {\r\n // Restore effect Layer stencil\r\n if (this._needStencil) {\r\n this._engine.setStencilBuffer(this._previousStencilState);\r\n }\r\n }\r\n\r\n private _draw(renderingGroupId: number): void {\r\n if (this._renderEffects) {\r\n this._engine.setDepthBuffer(false);\r\n\r\n const layers = this.scene.effectLayers;\r\n for (let i = 0; i < layers.length; i++) {\r\n const effectLayer = layers[i];\r\n if (effectLayer.renderingGroupId === renderingGroupId) {\r\n if (effectLayer.shouldRender()) {\r\n effectLayer.render();\r\n }\r\n }\r\n }\r\n this._engine.setDepthBuffer(true);\r\n }\r\n }\r\n\r\n private _drawCamera(): void {\r\n if (this._renderEffects) {\r\n this._draw(-1);\r\n }\r\n }\r\n private _drawRenderingGroup(index: number): void {\r\n if (!this.scene._isInIntermediateRendering() && this._renderEffects) {\r\n this._draw(index);\r\n }\r\n }\r\n}\r\n\r\nEffectLayer._SceneComponentInitialization = (scene: Scene) => {\r\n let component = scene._getComponent(SceneComponentConstants.NAME_EFFECTLAYER) as EffectLayerSceneComponent;\r\n if (!component) {\r\n component = new EffectLayerSceneComponent(scene);\r\n scene._addComponent(component);\r\n }\r\n};\r\n"]}
1
+ {"version":3,"file":"effectLayerSceneComponent.js","sourceRoot":"","sources":["../../../../dev/core/src/Layers/effectLayerSceneComponent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAM3C,OAAO,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEjD,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,EAAE,SAAS,EAAE,yDAAwD;AAE5E,wCAAwC;AACxC,SAAS,CAAC,uBAAuB,CAAC,gBAAgB,EAAE,CAAC,UAAe,EAAE,KAAY,EAAE,SAAyB,EAAE,OAAe,EAAE,EAAE;IAC9H,IAAI,UAAU,CAAC,YAAY,EAAE;QACzB,IAAI,CAAC,SAAS,CAAC,YAAY,EAAE;YACzB,SAAS,CAAC,YAAY,GAAG,EAAmB,CAAC;SAChD;QAED,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,UAAU,CAAC,YAAY,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE;YACjE,MAAM,WAAW,GAAG,WAAW,CAAC,KAAK,CAAC,UAAU,CAAC,YAAY,CAAC,KAAK,CAAC,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;YACtF,SAAS,CAAC,YAAY,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;SAC5C;KACJ;AACL,CAAC,CA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K,CAAC,CAAC;SACrB;IACL,CAAC;CACJ;AAED,WAAW,CAAC,6BAA6B,GAAG,CAAC,KAAY,EAAE,EAAE;IACzD,IAAI,SAAS,GAAG,KAAK,CAAC,aAAa,CAAC,uBAAuB,CAAC,gBAAgB,CAA8B,CAAC;IAC3G,IAAI,CAAC,SAAS,EAAE;QACZ,SAAS,GAAG,IAAI,yBAAyB,CAAC,KAAK,CAAC,CAAC;QACjD,KAAK,CAAC,aAAa,CAAC,SAAS,CAAC,CAAC;KAClC;AACL,CAAC,CAAC","sourcesContent":["import { Camera } from \"../Cameras/camera\";\r\nimport type { Scene } from \"../scene\";\r\nimport type { AbstractEngine } from \"../Engines/abstractEngine\";\r\nimport type { AbstractMesh } from \"../Meshes/abstractMesh\";\r\nimport type { RenderTargetTexture } from \"../Materials/Textures/renderTargetTexture\";\r\nimport type { ISceneSerializableComponent } from \"../sceneComponent\";\r\nimport { SceneComponentConstants } from \"../sceneComponent\";\r\nimport { EffectLayer } from \"./effectLayer\";\r\nimport { AbstractScene } from \"../abstractScene\";\r\nimport type { AssetContainer } from \"../assetContainer\";\r\nimport { EngineStore } from \"../Engines/engineStore\";\r\nimport { AddParser } from \"core/Loading/Plugins/babylonFileParser.function\";\r\n\r\n// Adds the parser to the scene parsers.\r\nAddParser(SceneComponentConstants.NAME_EFFECTLAYER, (parsedData: any, scene: Scene, container: AssetContainer, rootUrl: string) => {\r\n if (parsedData.effectLayers) {\r\n if (!container.effectLayers) {\r\n container.effectLayers = [] as EffectLayer[];\r\n }\r\n\r\n for (let index = 0; index < parsedData.effectLayers.length; index++) {\r\n const effectLayer = EffectLayer.Parse(parsedData.effectLayers[index], scene, rootUrl);\r\n container.effectLayers.push(effectLayer);\r\n }\r\n }\r\n});\r\n\r\ndeclare module \"../abstractScene\" {\r\n export interface AbstractScene {\r\n /**\r\n * The list of effect layers (highlights/glow) added to the scene\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/highlightLayer\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/glowLayer\r\n */\r\n effectLayers: Array<EffectLayer>;\r\n\r\n /**\r\n * Removes the given effect layer from this scene.\r\n * @param toRemove defines the effect layer to remove\r\n * @returns the index of the removed effect layer\r\n */\r\n removeEffectLayer(toRemove: EffectLayer): number;\r\n\r\n /**\r\n * Adds the given effect layer to this scene\r\n * @param newEffectLayer defines the effect layer to add\r\n */\r\n addEffectLayer(newEffectLayer: EffectLayer): void;\r\n }\r\n}\r\n\r\nAbstractScene.prototype.removeEffectLayer = function (toRemove: EffectLayer): number {\r\n const index = this.effectLayers.indexOf(toRemove);\r\n if (index !== -1) {\r\n this.effectLayers.splice(index, 1);\r\n }\r\n\r\n return index;\r\n};\r\n\r\nAbstractScene.prototype.addEffectLayer = function (newEffectLayer: EffectLayer): void {\r\n this.effectLayers.push(newEffectLayer);\r\n};\r\n\r\n/**\r\n * Defines the layer scene component responsible to manage any effect layers\r\n * in a given scene.\r\n */\r\nexport class EffectLayerSceneComponent implements ISceneSerializableComponent {\r\n /**\r\n * The component name helpful to identify the component in the list of scene components.\r\n */\r\n public readonly name = SceneComponentConstants.NAME_EFFECTLAYER;\r\n\r\n /**\r\n * The scene the component belongs to.\r\n */\r\n public scene: Scene;\r\n\r\n private _engine: AbstractEngine;\r\n private _renderEffects = false;\r\n private _needStencil = false;\r\n private _previousStencilState = false;\r\n\r\n /**\r\n * Creates a new instance of the component for the given scene\r\n * @param scene Defines the scene to register the component in\r\n */\r\n constructor(scene?: Scene) {\r\n this.scene = scene || <Scene>EngineStore.LastCreatedScene;\r\n if (!this.scene) {\r\n return;\r\n }\r\n this._engine = this.scene.getEngine();\r\n this.scene.effectLayers = [] as EffectLayer[];\r\n }\r\n\r\n /**\r\n * Registers the component in a given scene\r\n */\r\n public register(): void {\r\n this.scene._isReadyForMeshStage.registerStep(SceneComponentConstants.STEP_ISREADYFORMESH_EFFECTLAYER, this, this._isReadyForMesh);\r\n\r\n this.scene._cameraDrawRenderTargetStage.registerStep(SceneComponentConstants.STEP_CAMERADRAWRENDERTARGET_EFFECTLAYER, this, this._renderMainTexture);\r\n\r\n this.scene._beforeCameraDrawStage.registerStep(SceneComponentConstants.STEP_BEFORECAMERADRAW_EFFECTLAYER, this, this._setStencil);\r\n\r\n this.scene._afterRenderingGroupDrawStage.registerStep(SceneComponentConstants.STEP_AFTERRENDERINGGROUPDRAW_EFFECTLAYER_DRAW, this, this._drawRenderingGroup);\r\n\r\n this.scene._afterCameraDrawStage.registerStep(SceneComponentConstants.STEP_AFTERCAMERADRAW_EFFECTLAYER, this, this._setStencilBack);\r\n this.scene._afterCameraDrawStage.registerStep(SceneComponentConstants.STEP_AFTERCAMERADRAW_EFFECTLAYER_DRAW, this, this._drawCamera);\r\n }\r\n\r\n /**\r\n * Rebuilds the elements related to this component in case of\r\n * context lost for instance.\r\n */\r\n public rebuild(): void {\r\n const layers = this.scene.effectLayers;\r\n for (const effectLayer of layers) {\r\n effectLayer._rebuild();\r\n }\r\n }\r\n\r\n /**\r\n * Serializes the component data to the specified json object\r\n * @param serializationObject The object to serialize to\r\n */\r\n public serialize(serializationObject: any): void {\r\n // Effect layers\r\n serializationObject.effectLayers = [];\r\n\r\n const layers = this.scene.effectLayers;\r\n for (const effectLayer of layers) {\r\n if (effectLayer.serialize) {\r\n serializationObject.effectLayers.push(effectLayer.serialize());\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Adds all the elements from the container to the scene\r\n * @param container the container holding the elements\r\n */\r\n public addFromContainer(container: AbstractScene): void {\r\n if (!container.effectLayers) {\r\n return;\r\n }\r\n container.effectLayers.forEach((o) => {\r\n this.scene.addEffectLayer(o);\r\n });\r\n }\r\n\r\n /**\r\n * Removes all the elements in the container from the scene\r\n * @param container contains the elements to remove\r\n * @param dispose if the removed element should be disposed (default: false)\r\n */\r\n public removeFromContainer(container: AbstractScene, dispose?: boolean): void {\r\n if (!container.effectLayers) {\r\n return;\r\n }\r\n container.effectLayers.forEach((o) => {\r\n this.scene.removeEffectLayer(o);\r\n if (dispose) {\r\n o.dispose();\r\n }\r\n });\r\n }\r\n\r\n /**\r\n * Disposes the component and the associated resources.\r\n */\r\n public dispose(): void {\r\n const layers = this.scene.effectLayers;\r\n while (layers.length) {\r\n layers[0].dispose();\r\n }\r\n }\r\n\r\n private _isReadyForMesh(mesh: AbstractMesh, hardwareInstancedRendering: boolean): boolean {\r\n const currentRenderPassId = this._engine.currentRenderPassId;\r\n const layers = this.scene.effectLayers;\r\n for (const layer of layers) {\r\n if (!layer.hasMesh(mesh)) {\r\n continue;\r\n }\r\n\r\n const renderTarget = <RenderTargetTexture>(<any>layer)._mainTexture;\r\n this._engine.currentRenderPassId = renderTarget.renderPassId;\r\n\r\n for (const subMesh of mesh.subMeshes) {\r\n if (!layer.isReady(subMesh, hardwareInstancedRendering)) {\r\n this._engine.currentRenderPassId = currentRenderPassId;\r\n return false;\r\n }\r\n }\r\n }\r\n this._engine.currentRenderPassId = currentRenderPassId;\r\n return true;\r\n }\r\n\r\n private _renderMainTexture(camera: Camera): boolean {\r\n this._renderEffects = false;\r\n this._needStencil = false;\r\n\r\n let needRebind = false;\r\n\r\n const layers = this.scene.effectLayers;\r\n if (layers && layers.length > 0) {\r\n this._previousStencilState = this._engine.getStencilBuffer();\r\n for (const effectLayer of layers) {\r\n if (\r\n effectLayer.shouldRender() &&\r\n (!effectLayer.camera ||\r\n (effectLayer.camera.cameraRigMode === Camera.RIG_MODE_NONE && camera === effectLayer.camera) ||\r\n (effectLayer.camera.cameraRigMode !== Camera.RIG_MODE_NONE && effectLayer.camera._rigCameras.indexOf(camera) > -1))\r\n ) {\r\n this._renderEffects = true;\r\n this._needStencil = this._needStencil || effectLayer.needStencil();\r\n\r\n const renderTarget = <RenderTargetTexture>(<any>effectLayer)._mainTexture;\r\n if (renderTarget._shouldRender()) {\r\n this.scene.incrementRenderId();\r\n renderTarget.render(false, false);\r\n needRebind = true;\r\n }\r\n }\r\n }\r\n\r\n this.scene.incrementRenderId();\r\n }\r\n\r\n return needRebind;\r\n }\r\n\r\n private _setStencil() {\r\n // Activate effect Layer stencil\r\n if (this._needStencil) {\r\n this._engine.setStencilBuffer(true);\r\n }\r\n }\r\n\r\n private _setStencilBack() {\r\n // Restore effect Layer stencil\r\n if (this._needStencil) {\r\n this._engine.setStencilBuffer(this._previousStencilState);\r\n }\r\n }\r\n\r\n private _draw(renderingGroupId: number): void {\r\n if (this._renderEffects) {\r\n this._engine.setDepthBuffer(false);\r\n\r\n const layers = this.scene.effectLayers;\r\n for (let i = 0; i < layers.length; i++) {\r\n const effectLayer = layers[i];\r\n if (effectLayer.renderingGroupId === renderingGroupId) {\r\n if (effectLayer.shouldRender()) {\r\n effectLayer.render();\r\n }\r\n }\r\n }\r\n this._engine.setDepthBuffer(true);\r\n }\r\n }\r\n\r\n private _drawCamera(): void {\r\n if (this._renderEffects) {\r\n this._draw(-1);\r\n }\r\n }\r\n private _drawRenderingGroup(index: number): void {\r\n if (!this.scene._isInIntermediateRendering() && this._renderEffects) {\r\n this._draw(index);\r\n }\r\n }\r\n}\r\n\r\nEffectLayer._SceneComponentInitialization = (scene: Scene) => {\r\n let component = scene._getComponent(SceneComponentConstants.NAME_EFFECTLAYER) as EffectLayerSceneComponent;\r\n if (!component) {\r\n component = new EffectLayerSceneComponent(scene);\r\n scene._addComponent(component);\r\n }\r\n};\r\n"]}
@@ -2,8 +2,9 @@ import { Tools } from "../Misc/tools.js";
2
2
  import { SceneComponentConstants } from "../sceneComponent.js";
3
3
  import { AbstractScene } from "../abstractScene.js";
4
4
  import { LensFlareSystem } from "./lensFlareSystem.js";
5
+ import { AddParser } from "../Loading/Plugins/babylonFileParser.function.js";
5
6
  // Adds the parser to the scene parsers.
6
- AbstractScene.AddParser(SceneComponentConstants.NAME_LENSFLARESYSTEM, (parsedData, scene, container, rootUrl) => {
7
+ AddParser(SceneComponentConstants.NAME_LENSFLARESYSTEM, (parsedData, scene, container, rootUrl) => {
7
8
  // Lens flares
8
9
  if (parsedData.lensFlareSystems !== undefined && parsedData.lensFlareSystems !== null) {
9
10
  if (!container.lensFlareSystems) {
@@ -1 +1 @@
1
- {"version":3,"file":"lensFlareSystemSceneComponent.js","sourceRoot":"","sources":["../../../../dev/core/src/LensFlares/lensFlareSystemSceneComponent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAKtC,OAAO,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEjD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,wCAAwC;AACxC,aAAa,CAAC,SAAS,CAAC,uBAAuB,CAAC,oBAAoB,EAAE,CAAC,UAAe,EAAE,KAAY,EAAE,SAAyB,EAAE,OAAe,EAAE,EAAE;IAChJ,cAAc;IACd,IAAI,UAAU,CAAC,gBAAgB,KAAK,SAAS,IAAI,UAAU,CAAC,gBAAgB,KAAK,IAAI,EAAE;QACnF,IAAI,CAAC,SAAS,CAAC,gBAAgB,EAAE;YAC7B,SAAS,CAAC,gBAAgB,GAAG,EAAuB,CAAC;SACxD;QAED,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,UAAU,CAAC,gBAAgB,CAAC,MAAM,EAAE,KAAK,GAAG,KAAK,EAAE,KAAK,EAAE,EAAE;YACpF,MAAM,qBAAqB,GAAG,UAAU,CAAC,gBAAgB,CAAC,KAAK,CAAC,CAAC;YACjE,MAAM,EAAE,GAAG,eAAe,CAAC,KAAK,CAAC,qBAAqB,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;YACxE,SAAS,CAAC,gBAAgB,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;SACvC;KACJ;AACL,CAAC,CAAC,CAAC;AA+CH,aAAa,CAAC,SAAS,CAAC,wBAAwB,GAAG,UAAU,IAAY;IACrE,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,IAAI,CAAC,gBA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;QACrD,KAAK,CAAC,aAAa,CAAC,SAAS,CAAC,CAAC;KAClC;AACL,CAAC,CAAC","sourcesContent":["import { Tools } from \"../Misc/tools\";\r\nimport type { Nullable } from \"../types\";\r\nimport type { Camera } from \"../Cameras/camera\";\r\nimport type { Scene } from \"../scene\";\r\nimport type { ISceneSerializableComponent } from \"../sceneComponent\";\r\nimport { SceneComponentConstants } from \"../sceneComponent\";\r\nimport { AbstractScene } from \"../abstractScene\";\r\nimport type { AssetContainer } from \"../assetContainer\";\r\nimport { LensFlareSystem } from \"./lensFlareSystem\";\r\n// Adds the parser to the scene parsers.\r\nAbstractScene.AddParser(SceneComponentConstants.NAME_LENSFLARESYSTEM, (parsedData: any, scene: Scene, container: AssetContainer, rootUrl: string) => {\r\n // Lens flares\r\n if (parsedData.lensFlareSystems !== undefined && parsedData.lensFlareSystems !== null) {\r\n if (!container.lensFlareSystems) {\r\n container.lensFlareSystems = [] as LensFlareSystem[];\r\n }\r\n\r\n for (let index = 0, cache = parsedData.lensFlareSystems.length; index < cache; index++) {\r\n const parsedLensFlareSystem = parsedData.lensFlareSystems[index];\r\n const lf = LensFlareSystem.Parse(parsedLensFlareSystem, scene, rootUrl);\r\n container.lensFlareSystems.push(lf);\r\n }\r\n }\r\n});\r\n\r\ndeclare module \"../abstractScene\" {\r\n export interface AbstractScene {\r\n /**\r\n * The list of lens flare system added to the scene\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/environment/lenseFlare\r\n */\r\n lensFlareSystems: Array<LensFlareSystem>;\r\n\r\n /**\r\n * Removes the given lens flare system from this scene.\r\n * @param toRemove The lens flare system to remove\r\n * @returns The index of the removed lens flare system\r\n */\r\n removeLensFlareSystem(toRemove: LensFlareSystem): number;\r\n\r\n /**\r\n * Adds the given lens flare system to this scene\r\n * @param newLensFlareSystem The lens flare system to add\r\n */\r\n addLensFlareSystem(newLensFlareSystem: LensFlareSystem): void;\r\n\r\n /**\r\n * Gets a lens flare system using its name\r\n * @param name defines the name to look for\r\n * @returns the lens flare system or null if not found\r\n */\r\n getLensFlareSystemByName(name: string): Nullable<LensFlareSystem>;\r\n\r\n /**\r\n * Gets a lens flare system using its Id\r\n * @param id defines the Id to look for\r\n * @returns the lens flare system or null if not found\r\n * @deprecated Please use getLensFlareSystemById instead\r\n */\r\n getLensFlareSystemByID(id: string): Nullable<LensFlareSystem>;\r\n\r\n /**\r\n * Gets a lens flare system using its Id\r\n * @param id defines the Id to look for\r\n * @returns the lens flare system or null if not found\r\n */\r\n getLensFlareSystemById(id: string): Nullable<LensFlareSystem>;\r\n }\r\n}\r\n\r\nAbstractScene.prototype.getLensFlareSystemByName = function (name: string): Nullable<LensFlareSystem> {\r\n for (let index = 0; index < this.lensFlareSystems.length; index++) {\r\n if (this.lensFlareSystems[index].name === name) {\r\n return this.lensFlareSystems[index];\r\n }\r\n }\r\n\r\n return null;\r\n};\r\n\r\nAbstractScene.prototype.getLensFlareSystemById = function (id: string): Nullable<LensFlareSystem> {\r\n for (let index = 0; index < this.lensFlareSystems.length; index++) {\r\n if (this.lensFlareSystems[index].id === id) {\r\n return this.lensFlareSystems[index];\r\n }\r\n }\r\n\r\n return null;\r\n};\r\n\r\nAbstractScene.prototype.getLensFlareSystemByID = function (id: string): Nullable<LensFlareSystem> {\r\n return this.getLensFlareSystemById(id);\r\n};\r\n\r\nAbstractScene.prototype.removeLensFlareSystem = function (toRemove: LensFlareSystem): number {\r\n const index = this.lensFlareSystems.indexOf(toRemove);\r\n if (index !== -1) {\r\n this.lensFlareSystems.splice(index, 1);\r\n }\r\n return index;\r\n};\r\n\r\nAbstractScene.prototype.addLensFlareSystem = function (newLensFlareSystem: LensFlareSystem): void {\r\n this.lensFlareSystems.push(newLensFlareSystem);\r\n};\r\n\r\n/**\r\n * Defines the lens flare scene component responsible to manage any lens flares\r\n * in a given scene.\r\n */\r\nexport class LensFlareSystemSceneComponent implements ISceneSerializableComponent {\r\n /**\r\n * The component name helpful to identify the component in the list of scene components.\r\n */\r\n public readonly name = SceneComponentConstants.NAME_LENSFLARESYSTEM;\r\n\r\n /**\r\n * The scene the component belongs to.\r\n */\r\n public scene: Scene;\r\n\r\n /**\r\n * Creates a new instance of the component for the given scene\r\n * @param scene Defines the scene to register the component in\r\n */\r\n constructor(scene: Scene) {\r\n this.scene = scene;\r\n\r\n scene.lensFlareSystems = [] as LensFlareSystem[];\r\n }\r\n\r\n /**\r\n * Registers the component in a given scene\r\n */\r\n public register(): void {\r\n this.scene._afterCameraDrawStage.registerStep(SceneComponentConstants.STEP_AFTERCAMERADRAW_LENSFLARESYSTEM, this, this._draw);\r\n }\r\n\r\n /**\r\n * Rebuilds the elements related to this component in case of\r\n * context lost for instance.\r\n */\r\n public rebuild(): void {\r\n for (let index = 0; index < this.scene.lensFlareSystems.length; index++) {\r\n this.scene.lensFlareSystems[index].rebuild();\r\n }\r\n }\r\n\r\n /**\r\n * Adds all the elements from the container to the scene\r\n * @param container the container holding the elements\r\n */\r\n public addFromContainer(container: AbstractScene): void {\r\n if (!container.lensFlareSystems) {\r\n return;\r\n }\r\n container.lensFlareSystems.forEach((o) => {\r\n this.scene.addLensFlareSystem(o);\r\n });\r\n }\r\n\r\n /**\r\n * Removes all the elements in the container from the scene\r\n * @param container contains the elements to remove\r\n * @param dispose if the removed element should be disposed (default: false)\r\n */\r\n public removeFromContainer(container: AbstractScene, dispose?: boolean): void {\r\n if (!container.lensFlareSystems) {\r\n return;\r\n }\r\n container.lensFlareSystems.forEach((o) => {\r\n this.scene.removeLensFlareSystem(o);\r\n if (dispose) {\r\n o.dispose();\r\n }\r\n });\r\n }\r\n\r\n /**\r\n * Serializes the component data to the specified json object\r\n * @param serializationObject The object to serialize to\r\n */\r\n public serialize(serializationObject: any): void {\r\n // Lens flares\r\n serializationObject.lensFlareSystems = [];\r\n const lensFlareSystems = this.scene.lensFlareSystems;\r\n for (const lensFlareSystem of lensFlareSystems) {\r\n serializationObject.lensFlareSystems.push(lensFlareSystem.serialize());\r\n }\r\n }\r\n\r\n /**\r\n * Disposes the component and the associated resources.\r\n */\r\n public dispose(): void {\r\n const lensFlareSystems = this.scene.lensFlareSystems;\r\n while (lensFlareSystems.length) {\r\n lensFlareSystems[0].dispose();\r\n }\r\n }\r\n\r\n private _draw(camera: Camera): void {\r\n // Lens flares\r\n if (this.scene.lensFlaresEnabled) {\r\n const lensFlareSystems = this.scene.lensFlareSystems;\r\n Tools.StartPerformanceCounter(\"Lens flares\", lensFlareSystems.length > 0);\r\n for (const lensFlareSystem of lensFlareSystems) {\r\n if ((camera.layerMask & lensFlareSystem.layerMask) !== 0) {\r\n lensFlareSystem.render();\r\n }\r\n }\r\n Tools.EndPerformanceCounter(\"Lens flares\", lensFlareSystems.length > 0);\r\n }\r\n }\r\n}\r\n\r\nLensFlareSystem._SceneComponentInitialization = (scene: Scene) => {\r\n let component = scene._getComponent(SceneComponentConstants.NAME_LENSFLARESYSTEM) as LensFlareSystemSceneComponent;\r\n if (!component) {\r\n component = new LensFlareSystemSceneComponent(scene);\r\n scene._addComponent(component);\r\n }\r\n};\r\n"]}
1
+ {"version":3,"file":"lensFlareSystemSceneComponent.js","sourceRoot":"","sources":["../../../../dev/core/src/LensFlares/lensFlareSystemSceneComponent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAKtC,OAAO,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEjD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,SAAS,EAAE,yDAAwD;AAE5E,wCAAwC;AACxC,SAAS,CAAC,uBAAuB,CAAC,oBAAoB,EAAE,CAAC,UAAe,EAAE,KAAY,EAAE,SAAyB,EAAE,OAAe,EAAE,EAAE;IAClI,cAAc;IACd,IAAI,UAAU,CAAC,gBAAgB,KAAK,SAAS,IAAI,UAAU,CAAC,gBAAgB,KAAK,IAAI,EAAE;QACnF,IAAI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rD,KAAK,CAAC,uBAAuB,CAAC,aAAa,EAAE,gBAAgB,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;YAC1E,KAAK,MAAM,eAAe,IAAI,gBAAgB,EAAE;gBAC5C,IAAI,CAAC,MAAM,CAAC,SAAS,GAAG,eAAe,CAAC,SAAS,CAAC,KAAK,CAAC,EAAE;oBACtD,eAAe,CAAC,MAAM,EAAE,CAAC;iBAC5B;aACJ;YACD,KAAK,CAAC,qBAAqB,CAAC,aAAa,EAAE,gBAAgB,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;SAC3E;IACL,CAAC;CACJ;AAED,eAAe,CAAC,6BAA6B,GAAG,CAAC,KAAY,EAAE,EAAE;IAC7D,IAAI,SAAS,GAAG,KAAK,CAAC,aAAa,CAAC,uBAAuB,CAAC,oBAAoB,CAAkC,CAAC;IACnH,IAAI,CAAC,SAAS,EAAE;QACZ,SAAS,GAAG,IAAI,6BAA6B,CAAC,KAAK,CAAC,CAAC;QACrD,KAAK,CAAC,aAAa,CAAC,SAAS,CAAC,CAAC;KAClC;AACL,CAAC,CAAC","sourcesContent":["import { Tools } from \"../Misc/tools\";\r\nimport type { Nullable } from \"../types\";\r\nimport type { Camera } from \"../Cameras/camera\";\r\nimport type { Scene } from \"../scene\";\r\nimport type { ISceneSerializableComponent } from \"../sceneComponent\";\r\nimport { SceneComponentConstants } from \"../sceneComponent\";\r\nimport { AbstractScene } from \"../abstractScene\";\r\nimport type { AssetContainer } from \"../assetContainer\";\r\nimport { LensFlareSystem } from \"./lensFlareSystem\";\r\nimport { AddParser } from \"core/Loading/Plugins/babylonFileParser.function\";\r\n\r\n// Adds the parser to the scene parsers.\r\nAddParser(SceneComponentConstants.NAME_LENSFLARESYSTEM, (parsedData: any, scene: Scene, container: AssetContainer, rootUrl: string) => {\r\n // Lens flares\r\n if (parsedData.lensFlareSystems !== undefined && parsedData.lensFlareSystems !== null) {\r\n if (!container.lensFlareSystems) {\r\n container.lensFlareSystems = [] as LensFlareSystem[];\r\n }\r\n\r\n for (let index = 0, cache = parsedData.lensFlareSystems.length; index < cache; index++) {\r\n const parsedLensFlareSystem = parsedData.lensFlareSystems[index];\r\n const lf = LensFlareSystem.Parse(parsedLensFlareSystem, scene, rootUrl);\r\n container.lensFlareSystems.push(lf);\r\n }\r\n }\r\n});\r\n\r\ndeclare module \"../abstractScene\" {\r\n export interface AbstractScene {\r\n /**\r\n * The list of lens flare system added to the scene\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/environment/lenseFlare\r\n */\r\n lensFlareSystems: Array<LensFlareSystem>;\r\n\r\n /**\r\n * Removes the given lens flare system from this scene.\r\n * @param toRemove The lens flare system to remove\r\n * @returns The index of the removed lens flare system\r\n */\r\n removeLensFlareSystem(toRemove: LensFlareSystem): number;\r\n\r\n /**\r\n * Adds the given lens flare system to this scene\r\n * @param newLensFlareSystem The lens flare system to add\r\n */\r\n addLensFlareSystem(newLensFlareSystem: LensFlareSystem): void;\r\n\r\n /**\r\n * Gets a lens flare system using its name\r\n * @param name defines the name to look for\r\n * @returns the lens flare system or null if not found\r\n */\r\n getLensFlareSystemByName(name: string): Nullable<LensFlareSystem>;\r\n\r\n /**\r\n * Gets a lens flare system using its Id\r\n * @param id defines the Id to look for\r\n * @returns the lens flare system or null if not found\r\n * @deprecated Please use getLensFlareSystemById instead\r\n */\r\n getLensFlareSystemByID(id: string): Nullable<LensFlareSystem>;\r\n\r\n /**\r\n * Gets a lens flare system using its Id\r\n * @param id defines the Id to look for\r\n * @returns the lens flare system or null if not found\r\n */\r\n getLensFlareSystemById(id: string): Nullable<LensFlareSystem>;\r\n }\r\n}\r\n\r\nAbstractScene.prototype.getLensFlareSystemByName = function (name: string): Nullable<LensFlareSystem> {\r\n for (let index = 0; index < this.lensFlareSystems.length; index++) {\r\n if (this.lensFlareSystems[index].name === name) {\r\n return this.lensFlareSystems[index];\r\n }\r\n }\r\n\r\n return null;\r\n};\r\n\r\nAbstractScene.prototype.getLensFlareSystemById = function (id: string): Nullable<LensFlareSystem> {\r\n for (let index = 0; index < this.lensFlareSystems.length; index++) {\r\n if (this.lensFlareSystems[index].id === id) {\r\n return this.lensFlareSystems[index];\r\n }\r\n }\r\n\r\n return null;\r\n};\r\n\r\nAbstractScene.prototype.getLensFlareSystemByID = function (id: string): Nullable<LensFlareSystem> {\r\n return this.getLensFlareSystemById(id);\r\n};\r\n\r\nAbstractScene.prototype.removeLensFlareSystem = function (toRemove: LensFlareSystem): number {\r\n const index = this.lensFlareSystems.indexOf(toRemove);\r\n if (index !== -1) {\r\n this.lensFlareSystems.splice(index, 1);\r\n }\r\n return index;\r\n};\r\n\r\nAbstractScene.prototype.addLensFlareSystem = function (newLensFlareSystem: LensFlareSystem): void {\r\n this.lensFlareSystems.push(newLensFlareSystem);\r\n};\r\n\r\n/**\r\n * Defines the lens flare scene component responsible to manage any lens flares\r\n * in a given scene.\r\n */\r\nexport class LensFlareSystemSceneComponent implements ISceneSerializableComponent {\r\n /**\r\n * The component name helpful to identify the component in the list of scene components.\r\n */\r\n public readonly name = SceneComponentConstants.NAME_LENSFLARESYSTEM;\r\n\r\n /**\r\n * The scene the component belongs to.\r\n */\r\n public scene: Scene;\r\n\r\n /**\r\n * Creates a new instance of the component for the given scene\r\n * @param scene Defines the scene to register the component in\r\n */\r\n constructor(scene: Scene) {\r\n this.scene = scene;\r\n\r\n scene.lensFlareSystems = [] as LensFlareSystem[];\r\n }\r\n\r\n /**\r\n * Registers the component in a given scene\r\n */\r\n public register(): void {\r\n this.scene._afterCameraDrawStage.registerStep(SceneComponentConstants.STEP_AFTERCAMERADRAW_LENSFLARESYSTEM, this, this._draw);\r\n }\r\n\r\n /**\r\n * Rebuilds the elements related to this component in case of\r\n * context lost for instance.\r\n */\r\n public rebuild(): void {\r\n for (let index = 0; index < this.scene.lensFlareSystems.length; index++) {\r\n this.scene.lensFlareSystems[index].rebuild();\r\n }\r\n }\r\n\r\n /**\r\n * Adds all the elements from the container to the scene\r\n * @param container the container holding the elements\r\n */\r\n public addFromContainer(container: AbstractScene): void {\r\n if (!container.lensFlareSystems) {\r\n return;\r\n }\r\n container.lensFlareSystems.forEach((o) => {\r\n this.scene.addLensFlareSystem(o);\r\n });\r\n }\r\n\r\n /**\r\n * Removes all the elements in the container from the scene\r\n * @param container contains the elements to remove\r\n * @param dispose if the removed element should be disposed (default: false)\r\n */\r\n public removeFromContainer(container: AbstractScene, dispose?: boolean): void {\r\n if (!container.lensFlareSystems) {\r\n return;\r\n }\r\n container.lensFlareSystems.forEach((o) => {\r\n this.scene.removeLensFlareSystem(o);\r\n if (dispose) {\r\n o.dispose();\r\n }\r\n });\r\n }\r\n\r\n /**\r\n * Serializes the component data to the specified json object\r\n * @param serializationObject The object to serialize to\r\n */\r\n public serialize(serializationObject: any): void {\r\n // Lens flares\r\n serializationObject.lensFlareSystems = [];\r\n const lensFlareSystems = this.scene.lensFlareSystems;\r\n for (const lensFlareSystem of lensFlareSystems) {\r\n serializationObject.lensFlareSystems.push(lensFlareSystem.serialize());\r\n }\r\n }\r\n\r\n /**\r\n * Disposes the component and the associated resources.\r\n */\r\n public dispose(): void {\r\n const lensFlareSystems = this.scene.lensFlareSystems;\r\n while (lensFlareSystems.length) {\r\n lensFlareSystems[0].dispose();\r\n }\r\n }\r\n\r\n private _draw(camera: Camera): void {\r\n // Lens flares\r\n if (this.scene.lensFlaresEnabled) {\r\n const lensFlareSystems = this.scene.lensFlareSystems;\r\n Tools.StartPerformanceCounter(\"Lens flares\", lensFlareSystems.length > 0);\r\n for (const lensFlareSystem of lensFlareSystems) {\r\n if ((camera.layerMask & lensFlareSystem.layerMask) !== 0) {\r\n lensFlareSystem.render();\r\n }\r\n }\r\n Tools.EndPerformanceCounter(\"Lens flares\", lensFlareSystems.length > 0);\r\n }\r\n }\r\n}\r\n\r\nLensFlareSystem._SceneComponentInitialization = (scene: Scene) => {\r\n let component = scene._getComponent(SceneComponentConstants.NAME_LENSFLARESYSTEM) as LensFlareSystemSceneComponent;\r\n if (!component) {\r\n component = new LensFlareSystemSceneComponent(scene);\r\n scene._addComponent(component);\r\n }\r\n};\r\n"]}
@@ -1,6 +1,6 @@
1
1
  import type { Scene } from "../../scene";
2
2
  import type { ISceneSerializableComponent } from "../../sceneComponent";
3
- import { AbstractScene } from "../../abstractScene";
3
+ import type { AbstractScene } from "../../abstractScene";
4
4
  /**
5
5
  * Defines the shadow generator component responsible to manage any shadow generators
6
6
  * in a given scene.
@@ -1,9 +1,9 @@
1
1
  import { ShadowGenerator } from "./shadowGenerator.js";
2
2
  import { CascadedShadowGenerator } from "./cascadedShadowGenerator.js";
3
3
  import { SceneComponentConstants } from "../../sceneComponent.js";
4
- import { AbstractScene } from "../../abstractScene.js";
4
+ import { AddParser } from "../../Loading/Plugins/babylonFileParser.function.js";
5
5
  // Adds the parser to the scene parsers.
6
- AbstractScene.AddParser(SceneComponentConstants.NAME_SHADOWGENERATOR, (parsedData, scene) => {
6
+ AddParser(SceneComponentConstants.NAME_SHADOWGENERATOR, (parsedData, scene) => {
7
7
  // Shadows
8
8
  if (parsedData.shadowGenerators !== undefined && parsedData.shadowGenerators !== null) {
9
9
  for (let index = 0, cache = parsedData.shadowGenerators.length; index < cache; index++) {
@@ -1 +1 @@
1
- {"version":3,"file":"shadowGeneratorSceneComponent.js","sourceRoot":"","sources":["../../../../../dev/core/src/Lights/Shadows/shadowGeneratorSceneComponent.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AAEpE,OAAO,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;AAC/D,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,wCAAwC;AACxC,aAAa,CAAC,SAAS,CAAC,uBAAuB,CAAC,oBAAoB,EAAE,CAAC,UAAe,EAAE,KAAY,EAAE,EAAE;IACpG,UAAU;IACV,IAAI,UAAU,CAAC,gBAAgB,KAAK,SAA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AAM,eAAe,GAAG,GAAG,CAAC,KAAK,CAAC;wBAClC,MAAM,SAAS,GAAwB,eAAe,CAAC,YAAY,EAAE,CAAC;wBACtE,IAAI,KAAK,CAAC,QAAQ,CAAC,OAAO,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,EAAE;4BAC1C,aAAa,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;yBACjC;qBACJ;iBACJ;aACJ;SACJ;IACL,CAAC;CACJ;AAED,eAAe,CAAC,6BAA6B,GAAG,CAAC,KAAY,EAAE,EAAE;IAC7D,IAAI,SAAS,GAAG,KAAK,CAAC,aAAa,CAAC,uBAAuB,CAAC,oBAAoB,CAAC,CAAC;IAClF,IAAI,CAAC,SAAS,EAAE;QACZ,SAAS,GAAG,IAAI,6BAA6B,CAAC,KAAK,CAAC,CAAC;QACrD,KAAK,CAAC,aAAa,CAAC,SAAS,CAAC,CAAC;KAClC;AACL,CAAC,CAAC","sourcesContent":["import type { SmartArrayNoDuplicate } from \"../../Misc/smartArray\";\r\nimport type { Scene } from \"../../scene\";\r\nimport type { RenderTargetTexture } from \"../../Materials/Textures/renderTargetTexture\";\r\nimport { ShadowGenerator } from \"./shadowGenerator\";\r\nimport { CascadedShadowGenerator } from \"./cascadedShadowGenerator\";\r\nimport type { ISceneSerializableComponent } from \"../../sceneComponent\";\r\nimport { SceneComponentConstants } from \"../../sceneComponent\";\r\nimport { AbstractScene } from \"../../abstractScene\";\r\n// Adds the parser to the scene parsers.\r\nAbstractScene.AddParser(SceneComponentConstants.NAME_SHADOWGENERATOR, (parsedData: any, scene: Scene) => {\r\n // Shadows\r\n if (parsedData.shadowGenerators !== undefined && parsedData.shadowGenerators !== null) {\r\n for (let index = 0, cache = parsedData.shadowGenerators.length; index < cache; index++) {\r\n const parsedShadowGenerator = parsedData.shadowGenerators[index];\r\n if (parsedShadowGenerator.className === CascadedShadowGenerator.CLASSNAME) {\r\n CascadedShadowGenerator.Parse(parsedShadowGenerator, scene);\r\n } else {\r\n ShadowGenerator.Parse(parsedShadowGenerator, scene);\r\n }\r\n // SG would be available on their associated lights\r\n }\r\n }\r\n});\r\n\r\n/**\r\n * Defines the shadow generator component responsible to manage any shadow generators\r\n * in a given scene.\r\n */\r\nexport class ShadowGeneratorSceneComponent implements ISceneSerializableComponent {\r\n /**\r\n * The component name helpful to identify the component in the list of scene components.\r\n */\r\n public readonly name = SceneComponentConstants.NAME_SHADOWGENERATOR;\r\n\r\n /**\r\n * The scene the component belongs to.\r\n */\r\n public scene: Scene;\r\n\r\n /**\r\n * Creates a new instance of the component for the given scene\r\n * @param scene Defines the scene to register the component in\r\n */\r\n constructor(scene: Scene) {\r\n this.scene = scene;\r\n }\r\n\r\n /**\r\n * Registers the component in a given scene\r\n */\r\n public register(): void {\r\n this.scene._gatherRenderTargetsStage.registerStep(SceneComponentConstants.STEP_GATHERRENDERTARGETS_SHADOWGENERATOR, this, this._gatherRenderTargets);\r\n }\r\n\r\n /**\r\n * Rebuilds the elements related to this component in case of\r\n * context lost for instance.\r\n */\r\n public rebuild(): void {\r\n // Nothing To Do Here.\r\n }\r\n\r\n /**\r\n * Serializes the component data to the specified json object\r\n * @param serializationObject The object to serialize to\r\n */\r\n public serialize(serializationObject: any): void {\r\n // Shadows\r\n serializationObject.shadowGenerators = [];\r\n const lights = this.scene.lights;\r\n for (const light of lights) {\r\n const shadowGenerators = light.getShadowGenerators();\r\n if (shadowGenerators) {\r\n const iterator = shadowGenerators.values();\r\n for (let key = iterator.next(); key.done !== true; key = iterator.next()) {\r\n const shadowGenerator = key.value;\r\n serializationObject.shadowGenerators.push(shadowGenerator.serialize());\r\n }\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Adds all the elements from the container to the scene\r\n * @param container the container holding the elements\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n public addFromContainer(container: AbstractScene): void {\r\n // Nothing To Do Here. (directly attached to a light)\r\n }\r\n\r\n /**\r\n * Removes all the elements in the container from the scene\r\n * @param container contains the elements to remove\r\n * @param dispose if the removed element should be disposed (default: false)\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n public removeFromContainer(container: AbstractScene, dispose?: boolean): void {\r\n // Nothing To Do Here. (directly attached to a light)\r\n }\r\n\r\n /**\r\n * Rebuilds the elements related to this component in case of\r\n * context lost for instance.\r\n */\r\n public dispose(): void {\r\n // Nothing To Do Here.\r\n }\r\n\r\n private _gatherRenderTargets(renderTargets: SmartArrayNoDuplicate<RenderTargetTexture>): void {\r\n // Shadows\r\n const scene = this.scene;\r\n if (this.scene.shadowsEnabled) {\r\n for (let lightIndex = 0; lightIndex < scene.lights.length; lightIndex++) {\r\n const light = scene.lights[lightIndex];\r\n const shadowGenerators = light.getShadowGenerators();\r\n\r\n if (light.isEnabled() && light.shadowEnabled && shadowGenerators) {\r\n const iterator = shadowGenerators.values();\r\n for (let key = iterator.next(); key.done !== true; key = iterator.next()) {\r\n const shadowGenerator = key.value;\r\n const shadowMap = <RenderTargetTexture>shadowGenerator.getShadowMap();\r\n if (scene.textures.indexOf(shadowMap) !== -1) {\r\n renderTargets.push(shadowMap);\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n}\r\n\r\nShadowGenerator._SceneComponentInitialization = (scene: Scene) => {\r\n let component = scene._getComponent(SceneComponentConstants.NAME_SHADOWGENERATOR);\r\n if (!component) {\r\n component = new ShadowGeneratorSceneComponent(scene);\r\n scene._addComponent(component);\r\n }\r\n};\r\n"]}
1
+ {"version":3,"file":"shadowGeneratorSceneComponent.js","sourceRoot":"","sources":["../../../../../dev/core/src/Lights/Shadows/shadowGeneratorSceneComponent.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AAEpE,OAAO,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;AAE/D,OAAO,EAAE,SAAS,EAAE,4DAAwD;AAE5E,wCAAwC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IAAI,GAAG,GAAG,QAAQ,CAAC,IAAI,EAAE,EAAE,GAAG,CAAC,IAAI,KAAK,IAAI,EAAE,GAAG,GAAG,QAAQ,CAAC,IAAI,EAAE,EAAE;wBACtE,MAAM,eAAe,GAAG,GAAG,CAAC,KAAK,CAAC;wBAClC,MAAM,SAAS,GAAwB,eAAe,CAAC,YAAY,EAAE,CAAC;wBACtE,IAAI,KAAK,CAAC,QAAQ,CAAC,OAAO,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,EAAE;4BAC1C,aAAa,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;yBACjC;qBACJ;iBACJ;aACJ;SACJ;IACL,CAAC;CACJ;AAED,eAAe,CAAC,6BAA6B,GAAG,CAAC,KAAY,EAAE,EAAE;IAC7D,IAAI,SAAS,GAAG,KAAK,CAAC,aAAa,CAAC,uBAAuB,CAAC,oBAAoB,CAAC,CAAC;IAClF,IAAI,CAAC,SAAS,EAAE;QACZ,SAAS,GAAG,IAAI,6BAA6B,CAAC,KAAK,CAAC,CAAC;QACrD,KAAK,CAAC,aAAa,CAAC,SAAS,CAAC,CAAC;KAClC;AACL,CAAC,CAAC","sourcesContent":["import type { SmartArrayNoDuplicate } from \"../../Misc/smartArray\";\r\nimport type { Scene } from \"../../scene\";\r\nimport type { RenderTargetTexture } from \"../../Materials/Textures/renderTargetTexture\";\r\nimport { ShadowGenerator } from \"./shadowGenerator\";\r\nimport { CascadedShadowGenerator } from \"./cascadedShadowGenerator\";\r\nimport type { ISceneSerializableComponent } from \"../../sceneComponent\";\r\nimport { SceneComponentConstants } from \"../../sceneComponent\";\r\nimport type { AbstractScene } from \"../../abstractScene\";\r\nimport { AddParser } from \"core/Loading/Plugins/babylonFileParser.function\";\r\n\r\n// Adds the parser to the scene parsers.\r\nAddParser(SceneComponentConstants.NAME_SHADOWGENERATOR, (parsedData: any, scene: Scene) => {\r\n // Shadows\r\n if (parsedData.shadowGenerators !== undefined && parsedData.shadowGenerators !== null) {\r\n for (let index = 0, cache = parsedData.shadowGenerators.length; index < cache; index++) {\r\n const parsedShadowGenerator = parsedData.shadowGenerators[index];\r\n if (parsedShadowGenerator.className === CascadedShadowGenerator.CLASSNAME) {\r\n CascadedShadowGenerator.Parse(parsedShadowGenerator, scene);\r\n } else {\r\n ShadowGenerator.Parse(parsedShadowGenerator, scene);\r\n }\r\n // SG would be available on their associated lights\r\n }\r\n }\r\n});\r\n\r\n/**\r\n * Defines the shadow generator component responsible to manage any shadow generators\r\n * in a given scene.\r\n */\r\nexport class ShadowGeneratorSceneComponent implements ISceneSerializableComponent {\r\n /**\r\n * The component name helpful to identify the component in the list of scene components.\r\n */\r\n public readonly name = SceneComponentConstants.NAME_SHADOWGENERATOR;\r\n\r\n /**\r\n * The scene the component belongs to.\r\n */\r\n public scene: Scene;\r\n\r\n /**\r\n * Creates a new instance of the component for the given scene\r\n * @param scene Defines the scene to register the component in\r\n */\r\n constructor(scene: Scene) {\r\n this.scene = scene;\r\n }\r\n\r\n /**\r\n * Registers the component in a given scene\r\n */\r\n public register(): void {\r\n this.scene._gatherRenderTargetsStage.registerStep(SceneComponentConstants.STEP_GATHERRENDERTARGETS_SHADOWGENERATOR, this, this._gatherRenderTargets);\r\n }\r\n\r\n /**\r\n * Rebuilds the elements related to this component in case of\r\n * context lost for instance.\r\n */\r\n public rebuild(): void {\r\n // Nothing To Do Here.\r\n }\r\n\r\n /**\r\n * Serializes the component data to the specified json object\r\n * @param serializationObject The object to serialize to\r\n */\r\n public serialize(serializationObject: any): void {\r\n // Shadows\r\n serializationObject.shadowGenerators = [];\r\n const lights = this.scene.lights;\r\n for (const light of lights) {\r\n const shadowGenerators = light.getShadowGenerators();\r\n if (shadowGenerators) {\r\n const iterator = shadowGenerators.values();\r\n for (let key = iterator.next(); key.done !== true; key = iterator.next()) {\r\n const shadowGenerator = key.value;\r\n serializationObject.shadowGenerators.push(shadowGenerator.serialize());\r\n }\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Adds all the elements from the container to the scene\r\n * @param container the container holding the elements\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n public addFromContainer(container: AbstractScene): void {\r\n // Nothing To Do Here. (directly attached to a light)\r\n }\r\n\r\n /**\r\n * Removes all the elements in the container from the scene\r\n * @param container contains the elements to remove\r\n * @param dispose if the removed element should be disposed (default: false)\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n public removeFromContainer(container: AbstractScene, dispose?: boolean): void {\r\n // Nothing To Do Here. (directly attached to a light)\r\n }\r\n\r\n /**\r\n * Rebuilds the elements related to this component in case of\r\n * context lost for instance.\r\n */\r\n public dispose(): void {\r\n // Nothing To Do Here.\r\n }\r\n\r\n private _gatherRenderTargets(renderTargets: SmartArrayNoDuplicate<RenderTargetTexture>): void {\r\n // Shadows\r\n const scene = this.scene;\r\n if (this.scene.shadowsEnabled) {\r\n for (let lightIndex = 0; lightIndex < scene.lights.length; lightIndex++) {\r\n const light = scene.lights[lightIndex];\r\n const shadowGenerators = light.getShadowGenerators();\r\n\r\n if (light.isEnabled() && light.shadowEnabled && shadowGenerators) {\r\n const iterator = shadowGenerators.values();\r\n for (let key = iterator.next(); key.done !== true; key = iterator.next()) {\r\n const shadowGenerator = key.value;\r\n const shadowMap = <RenderTargetTexture>shadowGenerator.getShadowMap();\r\n if (scene.textures.indexOf(shadowMap) !== -1) {\r\n renderTargets.push(shadowMap);\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n}\r\n\r\nShadowGenerator._SceneComponentInitialization = (scene: Scene) => {\r\n let component = scene._getComponent(SceneComponentConstants.NAME_SHADOWGENERATOR);\r\n if (!component) {\r\n component = new ShadowGeneratorSceneComponent(scene);\r\n scene._addComponent(component);\r\n }\r\n};\r\n"]}
@@ -13,7 +13,6 @@ import { AnimationGroup } from "../../Animations/animationGroup.js";
13
13
  import { Light } from "../../Lights/light.js";
14
14
  import { SceneComponentConstants } from "../../sceneComponent.js";
15
15
  import { SceneLoader } from "../../Loading/sceneLoader.js";
16
- import { AbstractScene } from "../../abstractScene.js";
17
16
  import { AssetContainer } from "../../assetContainer.js";
18
17
  import { ActionManager } from "../../Actions/actionManager.js";
19
18
  import { Skeleton } from "../../Bones/skeleton.js";
@@ -26,6 +25,7 @@ import { GetClass } from "../../Misc/typeStore.js";
26
25
  import { Tools } from "../../Misc/tools.js";
27
26
  import { PostProcess } from "../../PostProcesses/postProcess.js";
28
27
  import { SpriteManager } from "../../Sprites/spriteManager.js";
28
+ import { GetIndividualParser, Parse } from "./babylonFileParser.function.js";
29
29
  /** @internal */
30
30
  // eslint-disable-next-line @typescript-eslint/naming-convention, no-var
31
31
  export var _BabylonLoaderRegistered = true;
@@ -486,7 +486,7 @@ const loadAssetContainer = (scene, data, rootUrl, onError, addToScene = false) =
486
486
  scene.geometries.forEach((g) => {
487
487
  g._loadedUniqueId = "";
488
488
  });
489
- AbstractScene.Parse(parsedData, scene, container, rootUrl);
489
+ Parse(parsedData, scene, container, rootUrl);
490
490
  // Actions (scene) Done last as it can access other objects.
491
491
  for (index = 0, cache = scene.meshes.length; index < cache; index++) {
492
492
  const mesh = scene.meshes[index];
@@ -784,7 +784,7 @@ SceneLoader.RegisterPlugin({
784
784
  }
785
785
  // Particles
786
786
  if (parsedData.particleSystems !== undefined && parsedData.particleSystems !== null) {
787
- const parser = AbstractScene.GetIndividualParser(SceneComponentConstants.NAME_PARTICLESYSTEM);
787
+ const parser = GetIndividualParser(SceneComponentConstants.NAME_PARTICLESYSTEM);
788
788
  if (parser) {
789
789
  for (let index = 0, cache = parsedData.particleSystems.length; index < cache; index++) {
790
790
  const parsedParticleSystem = parsedData.particleSystems[index];