@onerjs/core 8.36.1 → 8.36.2

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 (81) hide show
  1. package/Engines/constants.d.ts +1 -1
  2. package/Engines/constants.js +1 -1
  3. package/Engines/constants.js.map +1 -1
  4. package/Lights/areaLight.d.ts +1 -1
  5. package/Lights/areaLight.js +1 -1
  6. package/Lights/areaLight.js.map +1 -1
  7. package/Lights/rectAreaLight.d.ts +20 -0
  8. package/Lights/rectAreaLight.js +45 -0
  9. package/Lights/rectAreaLight.js.map +1 -1
  10. package/Materials/Node/Blocks/Dual/lightBlock.js +1 -1
  11. package/Materials/Node/Blocks/Dual/lightBlock.js.map +1 -1
  12. package/Materials/Node/Blocks/PBR/pbrMetallicRoughnessBlock.js +1 -1
  13. package/Materials/Node/Blocks/PBR/pbrMetallicRoughnessBlock.js.map +1 -1
  14. package/Materials/material.d.ts +1 -1
  15. package/Materials/material.js +1 -1
  16. package/Materials/material.js.map +1 -1
  17. package/Materials/materialHelper.functions.d.ts +2 -1
  18. package/Materials/materialHelper.functions.js +6 -2
  19. package/Materials/materialHelper.functions.js.map +1 -1
  20. package/Materials/materialPluginManager.js +2 -2
  21. package/Materials/materialPluginManager.js.map +1 -1
  22. package/Meshes/Builders/greasedLineBuilder.d.ts +4 -0
  23. package/Meshes/Builders/greasedLineBuilder.js +37 -23
  24. package/Meshes/Builders/greasedLineBuilder.js.map +1 -1
  25. package/Misc/HighDynamicRange/cubemapToSphericalPolynomial.js +1 -5
  26. package/Misc/HighDynamicRange/cubemapToSphericalPolynomial.js.map +1 -1
  27. package/Misc/areaLightsTextureTools.d.ts +52 -0
  28. package/Misc/areaLightsTextureTools.js +227 -0
  29. package/Misc/areaLightsTextureTools.js.map +1 -0
  30. package/Misc/decorators.serialization.js +6 -1
  31. package/Misc/decorators.serialization.js.map +1 -1
  32. package/Misc/index.d.ts +3 -0
  33. package/Misc/index.js +4 -0
  34. package/Misc/index.js.map +1 -1
  35. package/Particles/Node/nodeParticleSystemSet.d.ts +2 -0
  36. package/Particles/Node/nodeParticleSystemSet.js.map +1 -1
  37. package/Physics/v2/IPhysicsEnginePlugin.d.ts +1 -0
  38. package/Physics/v2/IPhysicsEnginePlugin.js.map +1 -1
  39. package/Physics/v2/Plugins/havokPlugin.d.ts +10 -0
  40. package/Physics/v2/Plugins/havokPlugin.js +13 -0
  41. package/Physics/v2/Plugins/havokPlugin.js.map +1 -1
  42. package/Physics/v2/physicsBody.d.ts +10 -0
  43. package/Physics/v2/physicsBody.js +12 -0
  44. package/Physics/v2/physicsBody.js.map +1 -1
  45. package/Physics/v2/physicsEngineComponent.d.ts +5 -0
  46. package/Physics/v2/physicsEngineComponent.js +13 -0
  47. package/Physics/v2/physicsEngineComponent.js.map +1 -1
  48. package/Rendering/utilityLayerRenderer.d.ts +6 -0
  49. package/Rendering/utilityLayerRenderer.js +14 -5
  50. package/Rendering/utilityLayerRenderer.js.map +1 -1
  51. package/Shaders/ShadersInclude/lightFragment.js +13 -0
  52. package/Shaders/ShadersInclude/lightFragment.js.map +1 -1
  53. package/Shaders/ShadersInclude/lightFragmentDeclaration.js +3 -0
  54. package/Shaders/ShadersInclude/lightFragmentDeclaration.js.map +1 -1
  55. package/Shaders/ShadersInclude/lightUboDeclaration.js +3 -0
  56. package/Shaders/ShadersInclude/lightUboDeclaration.js.map +1 -1
  57. package/Shaders/ShadersInclude/lightsFragmentFunctions.js +6 -0
  58. package/Shaders/ShadersInclude/lightsFragmentFunctions.js.map +1 -1
  59. package/Shaders/ShadersInclude/ltcHelperFunctions.js +17 -1
  60. package/Shaders/ShadersInclude/ltcHelperFunctions.js.map +1 -1
  61. package/Shaders/ShadersInclude/pbrDirectLightingSetupFunctions.js +6 -0
  62. package/Shaders/ShadersInclude/pbrDirectLightingSetupFunctions.js.map +1 -1
  63. package/Shaders/areaLightTextureProcessing.fragment.d.ts +5 -0
  64. package/Shaders/areaLightTextureProcessing.fragment.js +13 -0
  65. package/Shaders/areaLightTextureProcessing.fragment.js.map +1 -0
  66. package/ShadersWGSL/ShadersInclude/lightFragment.js +14 -0
  67. package/ShadersWGSL/ShadersInclude/lightFragment.js.map +1 -1
  68. package/ShadersWGSL/ShadersInclude/lightUboDeclaration.js +3 -0
  69. package/ShadersWGSL/ShadersInclude/lightUboDeclaration.js.map +1 -1
  70. package/ShadersWGSL/ShadersInclude/lightsFragmentFunctions.js +6 -0
  71. package/ShadersWGSL/ShadersInclude/lightsFragmentFunctions.js.map +1 -1
  72. package/ShadersWGSL/ShadersInclude/ltcHelperFunctions.js +19 -1
  73. package/ShadersWGSL/ShadersInclude/ltcHelperFunctions.js.map +1 -1
  74. package/ShadersWGSL/ShadersInclude/pbrDirectLightingSetupFunctions.js +5 -0
  75. package/ShadersWGSL/ShadersInclude/pbrDirectLightingSetupFunctions.js.map +1 -1
  76. package/ShadersWGSL/areaLightTextureProcessing.fragment.d.ts +5 -0
  77. package/ShadersWGSL/areaLightTextureProcessing.fragment.js +12 -0
  78. package/ShadersWGSL/areaLightTextureProcessing.fragment.js.map +1 -0
  79. package/States/alphaCullingState.js +0 -1
  80. package/States/alphaCullingState.js.map +1 -1
  81. package/package.json +1 -1
@@ -0,0 +1,52 @@
1
+ import type { AbstractEngine } from "../Engines/abstractEngine.js";
2
+ import type { Nullable } from "../types.js";
3
+ import { ShaderLanguage } from "../Materials/shaderLanguage.js";
4
+ import { BaseTexture } from "../Materials/Textures/baseTexture.js";
5
+ /**
6
+ * Class used for fast copy from one texture to another
7
+ */
8
+ export declare class AreaLightTextureTools {
9
+ private _engine;
10
+ private _renderer;
11
+ private _effectWrapper;
12
+ private _source;
13
+ private _scalingRange;
14
+ private _kernelLibrary;
15
+ private readonly _blurSize;
16
+ private readonly _alphaFactor;
17
+ /** Shader language used */
18
+ protected _shaderLanguage: ShaderLanguage;
19
+ /**
20
+ * Gets the shader language
21
+ */
22
+ get shaderLanguage(): ShaderLanguage;
23
+ private _textureIsInternal;
24
+ /**
25
+ * Constructs a new instance of the class
26
+ * @param engine The engine to use for the copy
27
+ */
28
+ constructor(engine: AbstractEngine);
29
+ private _shadersLoaded;
30
+ private _createEffect;
31
+ /**
32
+ * Indicates if the effect is ready to be used for the copy
33
+ * @returns true if "copy" can be called without delay, else false
34
+ */
35
+ isReady(): boolean;
36
+ /**
37
+ * Pre-processes the texture to be used with RectAreaLight emissionTexture.
38
+ * @param source The texture to pre-process
39
+ * @returns A promise that resolves with the pre-processed texture
40
+ */
41
+ processAsync(source: BaseTexture): Promise<Nullable<BaseTexture>>;
42
+ private _scaleImageDownAsync;
43
+ private _generateGaussianKernel;
44
+ private _mirrorIndex;
45
+ private _applyGaussianBlurRange;
46
+ private _transposeImage;
47
+ private _applyProgressiveBlurAsync;
48
+ /**
49
+ * Releases all the resources used by the class
50
+ */
51
+ dispose(): void;
52
+ }
@@ -0,0 +1,227 @@
1
+ import { EffectRenderer, EffectWrapper } from "../Materials/effectRenderer.js";
2
+ import { Vector2 } from "../Maths/math.vector.js";
3
+ import { WhenTextureReadyAsync } from "./textureTools.js";
4
+ import { BaseTexture } from "../Materials/Textures/baseTexture.js";
5
+
6
+ /**
7
+ * Class used for fast copy from one texture to another
8
+ */
9
+ export class AreaLightTextureTools {
10
+ /**
11
+ * Gets the shader language
12
+ */
13
+ get shaderLanguage() {
14
+ return this._shaderLanguage;
15
+ }
16
+ _textureIsInternal(texture) {
17
+ return texture?.getInternalTexture === undefined;
18
+ }
19
+ /**
20
+ * Constructs a new instance of the class
21
+ * @param engine The engine to use for the copy
22
+ */
23
+ constructor(engine) {
24
+ this._kernelLibrary = [];
25
+ this._blurSize = 5;
26
+ this._alphaFactor = 0.5;
27
+ /** Shader language used */
28
+ this._shaderLanguage = 0 /* ShaderLanguage.GLSL */;
29
+ this._shadersLoaded = false;
30
+ this._engine = engine;
31
+ this._renderer = new EffectRenderer(this._engine);
32
+ this._scalingRange = new Vector2();
33
+ for (let i = 0; i < 512; i++) {
34
+ const kernelSize = this._blurSize + (i + 1) * 2;
35
+ const alpha = (kernelSize / 2.0) * this._alphaFactor;
36
+ this._kernelLibrary.push(this._generateGaussianKernel(kernelSize, alpha));
37
+ }
38
+ }
39
+ _createEffect() {
40
+ const engine = this._engine;
41
+ let isWebGPU = false;
42
+ if (engine?.isWebGPU) {
43
+ this._shaderLanguage = 1 /* ShaderLanguage.WGSL */;
44
+ isWebGPU = true;
45
+ }
46
+ const effectWrapper = new EffectWrapper({
47
+ engine: engine,
48
+ name: "AreaLightTextureProcessing",
49
+ fragmentShader: "areaLightTextureProcessing",
50
+ useShaderStore: true,
51
+ uniformNames: ["scalingRange"],
52
+ samplerNames: ["textureSampler"],
53
+ defines: [],
54
+ shaderLanguage: this._shaderLanguage,
55
+ extraInitializationsAsync: async () => {
56
+ if (isWebGPU) {
57
+ await import("../ShadersWGSL/areaLightTextureProcessing.fragment.js");
58
+ }
59
+ else {
60
+ await import("../Shaders/areaLightTextureProcessing.fragment.js");
61
+ }
62
+ },
63
+ });
64
+ effectWrapper.onApplyObservable.add(() => {
65
+ engine.depthCullingState.depthMask = false;
66
+ if (this._textureIsInternal(this._source)) {
67
+ effectWrapper.effect._bindTexture("textureSampler", this._source);
68
+ }
69
+ else {
70
+ effectWrapper.effect.setTexture("textureSampler", this._source);
71
+ }
72
+ effectWrapper.effect.setVector2("scalingRange", this._scalingRange);
73
+ });
74
+ return effectWrapper;
75
+ }
76
+ /**
77
+ * Indicates if the effect is ready to be used for the copy
78
+ * @returns true if "copy" can be called without delay, else false
79
+ */
80
+ isReady() {
81
+ return this._shadersLoaded && !!this._effectWrapper?.effect?.isReady();
82
+ }
83
+ /**
84
+ * Pre-processes the texture to be used with RectAreaLight emissionTexture.
85
+ * @param source The texture to pre-process
86
+ * @returns A promise that resolves with the pre-processed texture
87
+ */
88
+ async processAsync(source) {
89
+ if (!this._shadersLoaded) {
90
+ this._effectWrapper = this._createEffect();
91
+ await this._effectWrapper.effect.whenCompiledAsync();
92
+ this._shadersLoaded = true;
93
+ }
94
+ if (!source.isReady()) {
95
+ await WhenTextureReadyAsync(source);
96
+ }
97
+ this._scalingRange.x = 0.125;
98
+ this._scalingRange.y = 0.875;
99
+ this._source = source;
100
+ const oldWrapU = this._source.wrapU;
101
+ const oldWrapV = this._source.wrapV;
102
+ this._source.wrapU = 2;
103
+ this._source.wrapV = 2;
104
+ const result = await this._scaleImageDownAsync(source);
105
+ await this._applyProgressiveBlurAsync(result);
106
+ result.wrapU = 0;
107
+ result.wrapV = 0;
108
+ this._source.wrapU = oldWrapU;
109
+ this._source.wrapV = oldWrapV;
110
+ return result;
111
+ }
112
+ async _scaleImageDownAsync(source) {
113
+ const renderTarget = this._engine.createRenderTargetTexture({ width: 1024, height: 1024 }, {
114
+ generateDepthBuffer: false,
115
+ generateMipMaps: true,
116
+ generateStencilBuffer: false,
117
+ samplingMode: 3,
118
+ type: 3553,
119
+ format: 5,
120
+ });
121
+ this._source = source;
122
+ const engineDepthMask = this._engine.getDepthWrite(); // for some reasons, depthWrite is not restored by EffectRenderer.restoreStates
123
+ this._renderer.render(this._effectWrapper, renderTarget);
124
+ this._engine.setDepthWrite(engineDepthMask);
125
+ return new BaseTexture(this._engine, renderTarget.texture);
126
+ }
127
+ _generateGaussianKernel(size, sigma) {
128
+ if (size % 2 === 0) {
129
+ throw new Error("Kernel size must be odd.");
130
+ }
131
+ const kernel = new Float32Array(size);
132
+ let sum = 0.0;
133
+ const halfSize = Math.floor(size / 2);
134
+ for (let i = -halfSize; i <= halfSize; ++i) {
135
+ const value = Math.exp(-(i * i) / (2.0 * sigma * sigma));
136
+ const index = i + halfSize;
137
+ kernel[index] = value;
138
+ sum += value;
139
+ }
140
+ for (let i = 0; i < kernel.length; i++) {
141
+ kernel[i] /= sum;
142
+ }
143
+ return { kernel, kernelSize: size, kernelHalfSize: halfSize };
144
+ }
145
+ _mirrorIndex(x, width) {
146
+ if (x < 0) {
147
+ x = -x;
148
+ }
149
+ if (x >= width) {
150
+ x = 2 * width - 2 - x;
151
+ }
152
+ return x;
153
+ }
154
+ _applyGaussianBlurRange(input, output, width, height, channels, kernelLibrary) {
155
+ const marginStart = Math.floor(width * 0.125);
156
+ const marginEnd = Math.floor(width * 0.875);
157
+ for (let y = 0; y < height; y++) {
158
+ for (let x = 0; x < width; x++) {
159
+ let targetKernel = 0;
160
+ if (x <= marginStart) {
161
+ targetKernel = Math.max(targetKernel, Math.abs(x - marginStart));
162
+ }
163
+ if (y <= marginStart) {
164
+ targetKernel = Math.max(targetKernel, Math.abs(y - marginStart));
165
+ }
166
+ if (x >= marginEnd) {
167
+ targetKernel = Math.max(targetKernel, Math.abs(x - marginEnd));
168
+ }
169
+ if (y >= marginEnd) {
170
+ targetKernel = Math.max(targetKernel, Math.abs(y - marginEnd));
171
+ }
172
+ const kernelData = kernelLibrary[targetKernel];
173
+ const { kernel, kernelHalfSize } = kernelData;
174
+ for (let c = 0; c < channels - 1; c++) {
175
+ let sum = 0.0;
176
+ for (let kx = -kernelHalfSize; kx <= kernelHalfSize; kx++) {
177
+ const px = this._mirrorIndex(x + kx, width);
178
+ const weight = kernel[kx + kernelHalfSize];
179
+ const pixelData = input[(y * width + px) * channels + c];
180
+ sum += pixelData * weight;
181
+ }
182
+ output[(y * width + x) * channels + c] = Math.max(0, Math.min(255, Math.round(sum)));
183
+ }
184
+ // copy alpha if present
185
+ if (channels > 3) {
186
+ output[(y * width + x) * channels + (channels - 1)] = input[(y * width + x) * channels + (channels - 1)];
187
+ }
188
+ }
189
+ }
190
+ }
191
+ _transposeImage(input, width, height, channels, output) {
192
+ for (let y = 0; y < height; y++) {
193
+ for (let x = 0; x < width; x++) {
194
+ const srcBase = (y * width + x) * channels;
195
+ const dstBase = (x * height + y) * channels;
196
+ for (let c = 0; c < channels; c++) {
197
+ output[dstBase + c] = input[srcBase + c];
198
+ }
199
+ }
200
+ }
201
+ }
202
+ async _applyProgressiveBlurAsync(source) {
203
+ const pixelData = await source.readPixels();
204
+ if (!pixelData) {
205
+ return;
206
+ }
207
+ const internalTexture = source.getInternalTexture();
208
+ if (!internalTexture) {
209
+ return;
210
+ }
211
+ const rourcePixel = new Uint8Array(pixelData.buffer);
212
+ const result = new Uint8Array(rourcePixel.length);
213
+ this._applyGaussianBlurRange(rourcePixel, result, internalTexture.width, internalTexture.height, 4, this._kernelLibrary);
214
+ this._transposeImage(result, internalTexture.width, internalTexture.height, 4, rourcePixel);
215
+ this._applyGaussianBlurRange(rourcePixel, result, internalTexture.width, internalTexture.height, 4, this._kernelLibrary);
216
+ this._transposeImage(result, internalTexture.width, internalTexture.height, 4, rourcePixel);
217
+ this._engine.updateRawTexture(internalTexture, rourcePixel, internalTexture.format, false);
218
+ }
219
+ /**
220
+ * Releases all the resources used by the class
221
+ */
222
+ dispose() {
223
+ this._effectWrapper?.dispose();
224
+ this._renderer.dispose();
225
+ }
226
+ }
227
+ //# sourceMappingURL=areaLightsTextureTools.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"areaLightsTextureTools.js","sourceRoot":"","sources":["../../../../dev/core/src/Misc/areaLightsTextureTools.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,uCAAsC;AAI9E,OAAO,EAAE,OAAO,EAAE,gCAA+B;AACjD,OAAO,EAAE,qBAAqB,EAAE,0BAA+B;AAC/D,OAAO,EAAE,WAAW,EAAE,6CAA4C;AAClE,OAAO,EAAE,SAAS,EAAE,gCAA+B;AAQnD;;GAEG;AACH,MAAM,OAAO,qBAAqB;IAa9B;;OAEG;IACH,IAAW,cAAc;QACrB,OAAO,IAAI,CAAC,eAAe,CAAC;IAChC,CAAC;IAEO,kBAAkB,CAAC,OAAsC;QAC7D,OAAQ,OAAuB,EAAE,kBAAkB,KAAK,SAAS,CAAC;IACtE,CAAC;IAED;;;OAGG;IACH,YAAY,MAAsB;QAtB1B,mBAAc,GAAiB,EAAE,CAAC;QACzB,cAAS,GAAG,CAAC,CAAC;QACd,iBAAY,GAAG,GAAG,CAAC;QAEpC,2BAA2B;QACjB,oB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,IAAI,UAAU,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;QACrD,MAAM,MAAM,GAAG,IAAI,UAAU,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;QAElD,IAAI,CAAC,uBAAuB,CAAC,WAAW,EAAE,MAAM,EAAE,eAAe,CAAC,KAAK,EAAE,eAAe,CAAC,MAAM,EAAE,CAAC,EAAE,IAAI,CAAC,cAAc,CAAC,CAAC;QACzH,IAAI,CAAC,eAAe,CAAC,MAAM,EAAE,eAAe,CAAC,KAAK,EAAE,eAAe,CAAC,MAAM,EAAE,CAAC,EAAE,WAAW,CAAC,CAAC;QAC5F,IAAI,CAAC,uBAAuB,CAAC,WAAW,EAAE,MAAM,EAAE,eAAe,CAAC,KAAK,EAAE,eAAe,CAAC,MAAM,EAAE,CAAC,EAAE,IAAI,CAAC,cAAc,CAAC,CAAC;QACzH,IAAI,CAAC,eAAe,CAAC,MAAM,EAAE,eAAe,CAAC,KAAK,EAAE,eAAe,CAAC,MAAM,EAAE,CAAC,EAAE,WAAW,CAAC,CAAC;QAC5F,IAAI,CAAC,OAAO,CAAC,gBAAgB,CAAC,eAAe,EAAE,WAAW,EAAE,eAAe,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;IAC/F,CAAC;IAED;;OAEG;IACI,OAAO;QACV,IAAI,CAAC,cAAc,EAAE,OAAO,EAAE,CAAC;QAC/B,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,CAAC;IAC7B,CAAC;CACJ","sourcesContent":["import type { AbstractEngine } from \"core/Engines/abstractEngine\";\r\nimport type { InternalTexture } from \"core/Materials/Textures/internalTexture\";\r\nimport { EffectRenderer, EffectWrapper } from \"core/Materials/effectRenderer\";\r\nimport type { ThinTexture } from \"core/Materials/Textures/thinTexture\";\r\nimport type { Nullable } from \"core/types\";\r\nimport { ShaderLanguage } from \"core/Materials/shaderLanguage\";\r\nimport { Vector2 } from \"core/Maths/math.vector\";\r\nimport { WhenTextureReadyAsync } from \"core/Misc/textureTools\";\r\nimport { BaseTexture } from \"core/Materials/Textures/baseTexture\";\r\nimport { Constants } from \"core/Engines/constants\";\r\n\r\ntype KernelData = {\r\n kernel: Float32Array;\r\n kernelSize: number;\r\n kernelHalfSize: number;\r\n};\r\n\r\n/**\r\n * Class used for fast copy from one texture to another\r\n */\r\nexport class AreaLightTextureTools {\r\n private _engine: AbstractEngine;\r\n private _renderer: EffectRenderer;\r\n private _effectWrapper: EffectWrapper;\r\n private _source: BaseTexture;\r\n private _scalingRange: Vector2;\r\n private _kernelLibrary: KernelData[] = [];\r\n private readonly _blurSize = 5;\r\n private readonly _alphaFactor = 0.5;\r\n\r\n /** Shader language used */\r\n protected _shaderLanguage = ShaderLanguage.GLSL;\r\n\r\n /**\r\n * Gets the shader language\r\n */\r\n public get shaderLanguage(): ShaderLanguage {\r\n return this._shaderLanguage;\r\n }\r\n\r\n private _textureIsInternal(texture: InternalTexture | ThinTexture): texture is InternalTexture {\r\n return (texture as ThinTexture)?.getInternalTexture === undefined;\r\n }\r\n\r\n /**\r\n * Constructs a new instance of the class\r\n * @param engine The engine to use for the copy\r\n */\r\n constructor(engine: AbstractEngine) {\r\n this._engine = engine;\r\n this._renderer = new EffectRenderer(this._engine);\r\n this._scalingRange = new Vector2();\r\n\r\n for (let i = 0; i < 512; i++) {\r\n const kernelSize = this._blurSize + (i + 1) * 2;\r\n const alpha = (kernelSize / 2.0) * this._alphaFactor;\r\n this._kernelLibrary.push(this._generateGaussianKernel(kernelSize, alpha));\r\n }\r\n }\r\n\r\n private _shadersLoaded = false;\r\n private _createEffect(): EffectWrapper {\r\n const engine = this._engine;\r\n let isWebGPU = false;\r\n\r\n if (engine?.isWebGPU) {\r\n this._shaderLanguage = ShaderLanguage.WGSL;\r\n isWebGPU = true;\r\n }\r\n\r\n const effectWrapper = new EffectWrapper({\r\n engine: engine,\r\n name: \"AreaLightTextureProcessing\",\r\n fragmentShader: \"areaLightTextureProcessing\",\r\n useShaderStore: true,\r\n uniformNames: [\"scalingRange\"],\r\n samplerNames: [\"textureSampler\"],\r\n defines: [],\r\n shaderLanguage: this._shaderLanguage,\r\n extraInitializationsAsync: async () => {\r\n if (isWebGPU) {\r\n await import(\"../ShadersWGSL/areaLightTextureProcessing.fragment\");\r\n } else {\r\n await import(\"../Shaders/areaLightTextureProcessing.fragment\");\r\n }\r\n },\r\n });\r\n\r\n effectWrapper.onApplyObservable.add(() => {\r\n engine.depthCullingState.depthMask = false;\r\n if (this._textureIsInternal(this._source)) {\r\n effectWrapper.effect._bindTexture(\"textureSampler\", this._source);\r\n } else {\r\n effectWrapper.effect.setTexture(\"textureSampler\", this._source);\r\n }\r\n effectWrapper.effect.setVector2(\"scalingRange\", this._scalingRange);\r\n });\r\n\r\n return effectWrapper;\r\n }\r\n\r\n /**\r\n * Indicates if the effect is ready to be used for the copy\r\n * @returns true if \"copy\" can be called without delay, else false\r\n */\r\n public isReady(): boolean {\r\n return this._shadersLoaded && !!this._effectWrapper?.effect?.isReady();\r\n }\r\n\r\n /**\r\n * Pre-processes the texture to be used with RectAreaLight emissionTexture.\r\n * @param source The texture to pre-process\r\n * @returns A promise that resolves with the pre-processed texture\r\n */\r\n public async processAsync(source: BaseTexture): Promise<Nullable<BaseTexture>> {\r\n if (!this._shadersLoaded) {\r\n this._effectWrapper = this._createEffect();\r\n await this._effectWrapper.effect.whenCompiledAsync();\r\n this._shadersLoaded = true;\r\n }\r\n\r\n if (!source.isReady()) {\r\n await WhenTextureReadyAsync(source);\r\n }\r\n\r\n this._scalingRange.x = 0.125;\r\n this._scalingRange.y = 0.875;\r\n\r\n this._source = source;\r\n const oldWrapU = this._source.wrapU;\r\n const oldWrapV = this._source.wrapV;\r\n\r\n this._source.wrapU = Constants.TEXTURE_MIRROR_ADDRESSMODE;\r\n this._source.wrapV = Constants.TEXTURE_MIRROR_ADDRESSMODE;\r\n\r\n const result = await this._scaleImageDownAsync(source);\r\n await this._applyProgressiveBlurAsync(result);\r\n\r\n result.wrapU = Constants.TEXTURE_CLAMP_ADDRESSMODE;\r\n result.wrapV = Constants.TEXTURE_CLAMP_ADDRESSMODE;\r\n\r\n this._source.wrapU = oldWrapU;\r\n this._source.wrapV = oldWrapV;\r\n\r\n return result;\r\n }\r\n\r\n private async _scaleImageDownAsync(source: BaseTexture): Promise<BaseTexture> {\r\n const renderTarget = this._engine.createRenderTargetTexture(\r\n { width: 1024, height: 1024 },\r\n {\r\n generateDepthBuffer: false,\r\n generateMipMaps: true,\r\n generateStencilBuffer: false,\r\n samplingMode: Constants.TEXTURE_TRILINEAR_SAMPLINGMODE,\r\n type: Constants.TEXTURE_2D,\r\n format: Constants.TEXTUREFORMAT_RGBA,\r\n }\r\n );\r\n\r\n this._source = source;\r\n const engineDepthMask = this._engine.getDepthWrite(); // for some reasons, depthWrite is not restored by EffectRenderer.restoreStates\r\n this._renderer.render(this._effectWrapper, renderTarget);\r\n this._engine.setDepthWrite(engineDepthMask);\r\n return new BaseTexture(this._engine, renderTarget.texture);\r\n }\r\n\r\n private _generateGaussianKernel(size: number, sigma: number): KernelData {\r\n if (size % 2 === 0) {\r\n throw new Error(\"Kernel size must be odd.\");\r\n }\r\n\r\n const kernel = new Float32Array(size);\r\n let sum = 0.0;\r\n const halfSize = Math.floor(size / 2);\r\n\r\n for (let i = -halfSize; i <= halfSize; ++i) {\r\n const value = Math.exp(-(i * i) / (2.0 * sigma * sigma));\r\n const index = i + halfSize;\r\n kernel[index] = value;\r\n sum += value;\r\n }\r\n\r\n for (let i = 0; i < kernel.length; i++) {\r\n kernel[i] /= sum;\r\n }\r\n\r\n return { kernel, kernelSize: size, kernelHalfSize: halfSize };\r\n }\r\n\r\n private _mirrorIndex(x: number, width: number): number {\r\n if (x < 0) {\r\n x = -x;\r\n }\r\n if (x >= width) {\r\n x = 2 * width - 2 - x;\r\n }\r\n return x;\r\n }\r\n\r\n private _applyGaussianBlurRange(input: Uint8Array, output: Uint8Array, width: number, height: number, channels: number, kernelLibrary: KernelData[]) {\r\n const marginStart = Math.floor(width * 0.125);\r\n const marginEnd = Math.floor(width * 0.875);\r\n\r\n for (let y = 0; y < height; y++) {\r\n for (let x = 0; x < width; x++) {\r\n let targetKernel = 0;\r\n\r\n if (x <= marginStart) {\r\n targetKernel = Math.max(targetKernel, Math.abs(x - marginStart));\r\n }\r\n if (y <= marginStart) {\r\n targetKernel = Math.max(targetKernel, Math.abs(y - marginStart));\r\n }\r\n if (x >= marginEnd) {\r\n targetKernel = Math.max(targetKernel, Math.abs(x - marginEnd));\r\n }\r\n if (y >= marginEnd) {\r\n targetKernel = Math.max(targetKernel, Math.abs(y - marginEnd));\r\n }\r\n\r\n const kernelData = kernelLibrary[targetKernel];\r\n const { kernel, kernelHalfSize } = kernelData;\r\n\r\n for (let c = 0; c < channels - 1; c++) {\r\n let sum = 0.0;\r\n for (let kx = -kernelHalfSize; kx <= kernelHalfSize; kx++) {\r\n const px = this._mirrorIndex(x + kx, width);\r\n const weight = kernel[kx + kernelHalfSize];\r\n const pixelData = input[(y * width + px) * channels + c];\r\n sum += pixelData * weight;\r\n }\r\n output[(y * width + x) * channels + c] = Math.max(0, Math.min(255, Math.round(sum)));\r\n }\r\n // copy alpha if present\r\n if (channels > 3) {\r\n output[(y * width + x) * channels + (channels - 1)] = input[(y * width + x) * channels + (channels - 1)];\r\n }\r\n }\r\n }\r\n }\r\n\r\n private _transposeImage(input: Uint8Array, width: number, height: number, channels: number, output: Uint8Array): void {\r\n for (let y = 0; y < height; y++) {\r\n for (let x = 0; x < width; x++) {\r\n const srcBase = (y * width + x) * channels;\r\n const dstBase = (x * height + y) * channels;\r\n for (let c = 0; c < channels; c++) {\r\n output[dstBase + c] = input[srcBase + c];\r\n }\r\n }\r\n }\r\n }\r\n\r\n private async _applyProgressiveBlurAsync(source: BaseTexture): Promise<void> {\r\n const pixelData = await source.readPixels();\r\n\r\n if (!pixelData) {\r\n return;\r\n }\r\n\r\n const internalTexture = source.getInternalTexture();\r\n\r\n if (!internalTexture) {\r\n return;\r\n }\r\n\r\n const rourcePixel = new Uint8Array(pixelData.buffer);\r\n const result = new Uint8Array(rourcePixel.length);\r\n\r\n this._applyGaussianBlurRange(rourcePixel, result, internalTexture.width, internalTexture.height, 4, this._kernelLibrary);\r\n this._transposeImage(result, internalTexture.width, internalTexture.height, 4, rourcePixel);\r\n this._applyGaussianBlurRange(rourcePixel, result, internalTexture.width, internalTexture.height, 4, this._kernelLibrary);\r\n this._transposeImage(result, internalTexture.width, internalTexture.height, 4, rourcePixel);\r\n this._engine.updateRawTexture(internalTexture, rourcePixel, internalTexture.format, false);\r\n }\r\n\r\n /**\r\n * Releases all the resources used by the class\r\n */\r\n public dispose(): void {\r\n this._effectWrapper?.dispose();\r\n this._renderer.dispose();\r\n }\r\n}\r\n"]}
@@ -23,7 +23,12 @@ const CopySource = function (creationFunction, source, instanciate, options = {}
23
23
  case 6: // Mesh reference
24
24
  case 9: // Image processing configuration reference
25
25
  case 11: // Camera reference
26
- destination[property] = sourceProperty;
26
+ if (typeof sourceProperty.slice === "function") {
27
+ destination[property] = sourceProperty.slice();
28
+ }
29
+ else {
30
+ destination[property] = sourceProperty;
31
+ }
27
32
  break;
28
33
  case 1: // Texture
29
34
  if (options.cloneTexturesOnlyOnce && textureMap[sourceProperty.uniqueId]) {
@@ -1 +1 @@
1
- {"version":3,"file":"decorators.serialization.js","sourceRoot":"","sources":["../../../../dev/core/src/Misc/decorators.serialization.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAMzC,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAE5E,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAWxD,MAAM,UAAU,GAAG,UAAa,gBAAyB,EAAE,MAAS,EAAE,WAA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EAAe,EAAE;IACpE,MAAM,WAAW,CAAC,aAAa,CAAC,CAAC;AACrC,CAAC,CAAC;AAEF;;GAEG;AACW,kCAAc,GAAG,CAAC,cAAmB,EAAE,KAAY,EAAE,OAAe,EAAyB,EAAE;IACzG,MAAM,WAAW,CAAC,SAAS,CAAC,CAAC;AACjC,CAAC,CAAC","sourcesContent":["import type { FresnelParameters } from \"../Materials/fresnelParameters\";\r\nimport type { ImageProcessingConfiguration } from \"../Materials/imageProcessingConfiguration\";\r\nimport { _WarnImport } from \"./devTools\";\r\nimport type { ColorCurves } from \"../Materials/colorCurves\";\r\nimport type { Scene } from \"../scene\";\r\nimport type { Nullable } from \"../types\";\r\nimport type { BaseTexture } from \"../Materials/Textures/baseTexture\";\r\nimport type { IAnimatable } from \"../Animations/animatable.interface\";\r\nimport { Tags } from \"./tags\";\r\nimport { Color3, Color4 } from \"../Maths/math.color\";\r\nimport { Matrix, Quaternion, Vector2, Vector3 } from \"../Maths/math.vector\";\r\nimport type { Camera } from \"../Cameras/camera\";\r\nimport { GetMergedStore } from \"./decorators.functions\";\r\n\r\n/** @internal */\r\nexport interface ICopySourceOptions {\r\n /*\r\n * if a texture is used in more than one channel (e.g diffuse and opacity),\r\n * only clone it once and reuse it on the other channels. Default false\r\n */\r\n cloneTexturesOnlyOnce?: boolean;\r\n}\r\n\r\nconst CopySource = function <T>(creationFunction: () => T, source: T, instanciate: boolean, options: ICopySourceOptions = {}): T {\r\n const destination = creationFunction();\r\n\r\n // Tags\r\n if (Tags && Tags.HasTags(source)) {\r\n Tags.AddTagsTo(destination, Tags.GetTags(source, true));\r\n }\r\n\r\n const classStore = GetMergedStore(destination);\r\n\r\n // Map from source texture uniqueId to destination texture\r\n const textureMap: Record<number, any> = {};\r\n\r\n // Properties\r\n for (const property in classStore) {\r\n const propertyDescriptor = classStore[property];\r\n const sourceProperty = (<any>source)[property];\r\n const propertyType = propertyDescriptor.type;\r\n\r\n if (sourceProperty !== undefined && sourceProperty !== null && (property !== \"uniqueId\" || SerializationHelper.AllowLoadingUniqueId)) {\r\n switch (propertyType) {\r\n case 0: // Value\r\n case 6: // Mesh reference\r\n case 9: // Image processing configuration reference\r\n case 11: // Camera reference\r\n (<any>destination)[property] = sourceProperty;\r\n break;\r\n case 1: // Texture\r\n if (options.cloneTexturesOnlyOnce && textureMap[sourceProperty.uniqueId]) {\r\n (<any>destination)[property] = textureMap[sourceProperty.uniqueId];\r\n } else {\r\n (<any>destination)[property] = instanciate || sourceProperty.isRenderTarget ? sourceProperty : sourceProperty.clone();\r\n textureMap[sourceProperty.uniqueId] = (<any>destination)[property];\r\n }\r\n break;\r\n case 2: // Color3\r\n case 3: // FresnelParameters\r\n case 4: // Vector2\r\n case 5: // Vector3\r\n case 7: // Color Curves\r\n case 8: // Color 4\r\n case 10: // Quaternion\r\n case 12: // Matrix\r\n (<any>destination)[property] = instanciate ? sourceProperty : sourceProperty.clone();\r\n break;\r\n }\r\n }\r\n }\r\n\r\n return destination;\r\n};\r\n\r\n/**\r\n * Class used to help serialization objects\r\n */\r\nexport class SerializationHelper {\r\n /**\r\n * Gets or sets a boolean to indicate if the UniqueId property should be serialized\r\n */\r\n public static AllowLoadingUniqueId = false;\r\n\r\n /**\r\n * @internal\r\n */\r\n public static _ImageProcessingConfigurationParser = (sourceProperty: any): ImageProcessingConfiguration => {\r\n throw _WarnImport(\"ImageProcessingConfiguration\");\r\n };\r\n\r\n /**\r\n * @internal\r\n */\r\n public static _FresnelParametersParser = (sourceProperty: any): FresnelParameters => {\r\n throw _WarnImport(\"FresnelParameters\");\r\n };\r\n\r\n /**\r\n * @internal\r\n */\r\n public static _ColorCurvesParser = (sourceProperty: any): ColorCurves => {\r\n throw _WarnImport(\"ColorCurves\");\r\n };\r\n\r\n /**\r\n * @internal\r\n */\r\n public static _TextureParser = (sourceProperty: any, scene: Scene, rootUrl: string): Nullable<BaseTexture> => {\r\n throw _WarnImport(\"Texture\");\r\n };\r\n\r\n /**\r\n * Appends the serialized animations from the source animations\r\n * @param source Source containing the animations\r\n * @param destination Target to store the animations\r\n */\r\n public static AppendSerializedAnimations(source: IAnimatable, destination: any): void {\r\n if (source.animations) {\r\n destination.animations = [];\r\n for (let animationIndex = 0; animationIndex < source.animations.length; animationIndex++) {\r\n const animation = source.animations[animationIndex];\r\n if (!animation.doNotSerialize) {\r\n destination.animations.push(animation.serialize());\r\n }\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Static function used to serialized a specific entity\r\n * @param entity defines the entity to serialize\r\n * @param serializationObject defines the optional target object where serialization data will be stored\r\n * @returns a JSON compatible object representing the serialization of the entity\r\n */\r\n public static Serialize<T>(entity: T, serializationObject?: any): any {\r\n if (!serializationObject) {\r\n serializationObject = {};\r\n }\r\n\r\n // Tags\r\n if (Tags) {\r\n serializationObject.tags = Tags.GetTags(entity);\r\n }\r\n\r\n const serializedProperties = GetMergedStore(entity);\r\n\r\n // Properties\r\n for (const property in serializedProperties) {\r\n const propertyDescriptor = serializedProperties[property];\r\n const targetPropertyName = propertyDescriptor.sourceName || property;\r\n const propertyType = propertyDescriptor.type;\r\n const sourceProperty = (<any>entity)[property];\r\n\r\n if (sourceProperty !== undefined && sourceProperty !== null && (property !== \"uniqueId\" || SerializationHelper.AllowLoadingUniqueId)) {\r\n switch (propertyType) {\r\n case 0: // Value\r\n if (Array.isArray(sourceProperty)) {\r\n serializationObject[targetPropertyName] = sourceProperty.slice();\r\n } else {\r\n serializationObject[targetPropertyName] = sourceProperty;\r\n }\r\n break;\r\n case 1: // Texture\r\n serializationObject[targetPropertyName] = sourceProperty.doNotSerialize ? null : sourceProperty.serialize();\r\n break;\r\n case 2: // Color3\r\n serializationObject[targetPropertyName] = sourceProperty.asArray();\r\n break;\r\n case 3: // FresnelParameters\r\n serializationObject[targetPropertyName] = sourceProperty.serialize();\r\n break;\r\n case 4: // Vector2\r\n serializationObject[targetPropertyName] = sourceProperty.asArray();\r\n break;\r\n case 5: // Vector3\r\n serializationObject[targetPropertyName] = sourceProperty.asArray();\r\n break;\r\n case 6: // Mesh reference\r\n serializationObject[targetPropertyName] = sourceProperty.id;\r\n break;\r\n case 7: // Color Curves\r\n serializationObject[targetPropertyName] = sourceProperty.serialize();\r\n break;\r\n case 8: // Color 4\r\n serializationObject[targetPropertyName] = (<Color4>sourceProperty).asArray();\r\n break;\r\n case 9: // Image Processing\r\n serializationObject[targetPropertyName] = (<ImageProcessingConfiguration>sourceProperty).serialize();\r\n break;\r\n case 10: // Quaternion\r\n serializationObject[targetPropertyName] = (<Quaternion>sourceProperty).asArray();\r\n break;\r\n case 11: // Camera reference\r\n serializationObject[targetPropertyName] = (<Camera>sourceProperty).id;\r\n break;\r\n case 12: // Matrix\r\n serializationObject[targetPropertyName] = (<Matrix>sourceProperty).asArray();\r\n break;\r\n }\r\n }\r\n }\r\n\r\n return serializationObject;\r\n }\r\n\r\n /**\r\n * Given a source json and a destination object in a scene, this function will parse the source and will try to apply its content to the destination object\r\n * @param source the source json data\r\n * @param destination the destination object\r\n * @param scene the scene where the object is\r\n * @param rootUrl root url to use to load assets\r\n */\r\n public static ParseProperties(source: any, destination: any, scene: Nullable<Scene>, rootUrl: Nullable<string>) {\r\n if (!rootUrl) {\r\n rootUrl = \"\";\r\n }\r\n\r\n const classStore = GetMergedStore(destination);\r\n\r\n // Properties\r\n for (const property in classStore) {\r\n const propertyDescriptor = classStore[property];\r\n const sourceProperty = source[propertyDescriptor.sourceName || property];\r\n const propertyType = propertyDescriptor.type;\r\n\r\n if (sourceProperty !== undefined && sourceProperty !== null && (property !== \"uniqueId\" || SerializationHelper.AllowLoadingUniqueId)) {\r\n const dest = destination;\r\n switch (propertyType) {\r\n case 0: // Value\r\n dest[property] = sourceProperty;\r\n break;\r\n case 1: // Texture\r\n if (scene) {\r\n dest[property] = SerializationHelper._TextureParser(sourceProperty, scene, rootUrl);\r\n }\r\n break;\r\n case 2: // Color3\r\n dest[property] = Color3.FromArray(sourceProperty);\r\n break;\r\n case 3: // FresnelParameters\r\n dest[property] = SerializationHelper._FresnelParametersParser(sourceProperty);\r\n break;\r\n case 4: // Vector2\r\n dest[property] = Vector2.FromArray(sourceProperty);\r\n break;\r\n case 5: // Vector3\r\n dest[property] = Vector3.FromArray(sourceProperty);\r\n break;\r\n case 6: // Mesh reference\r\n if (scene) {\r\n dest[property] = scene.getLastMeshById(sourceProperty);\r\n }\r\n break;\r\n case 7: // Color Curves\r\n dest[property] = SerializationHelper._ColorCurvesParser(sourceProperty);\r\n break;\r\n case 8: // Color 4\r\n dest[property] = Color4.FromArray(sourceProperty);\r\n break;\r\n case 9: // Image Processing\r\n dest[property] = SerializationHelper._ImageProcessingConfigurationParser(sourceProperty);\r\n break;\r\n case 10: // Quaternion\r\n dest[property] = Quaternion.FromArray(sourceProperty);\r\n break;\r\n case 11: // Camera reference\r\n if (scene) {\r\n dest[property] = scene.getCameraById(sourceProperty);\r\n }\r\n break;\r\n case 12: // Matrix\r\n dest[property] = Matrix.FromArray(sourceProperty);\r\n break;\r\n }\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Creates a new entity from a serialization data object\r\n * @param creationFunction defines a function used to instanciated the new entity\r\n * @param source defines the source serialization data\r\n * @param scene defines the hosting scene\r\n * @param rootUrl defines the root url for resources\r\n * @returns a new entity\r\n */\r\n public static Parse<T>(creationFunction: () => T, source: any, scene: Nullable<Scene>, rootUrl: Nullable<string> = null): T {\r\n const destination = creationFunction();\r\n\r\n // Tags\r\n if (Tags) {\r\n Tags.AddTagsTo(destination, source.tags);\r\n }\r\n\r\n SerializationHelper.ParseProperties(source, destination, scene, rootUrl);\r\n\r\n return destination;\r\n }\r\n\r\n /**\r\n * Clones an object\r\n * @param creationFunction defines the function used to instanciate the new object\r\n * @param source defines the source object\r\n * @param options defines the options to use\r\n * @returns the cloned object\r\n */\r\n public static Clone<T>(creationFunction: () => T, source: T, options: ICopySourceOptions = {}): T {\r\n return CopySource(creationFunction, source, false, options);\r\n }\r\n\r\n /**\r\n * Instanciates a new object based on a source one (some data will be shared between both object)\r\n * @param creationFunction defines the function used to instanciate the new object\r\n * @param source defines the source object\r\n * @returns the new object\r\n */\r\n public static Instanciate<T>(creationFunction: () => T, source: T): T {\r\n return CopySource(creationFunction, source, true);\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"decorators.serialization.js","sourceRoot":"","sources":["../../../../dev/core/src/Misc/decorators.serialization.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAMzC,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAE5E,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAWxD,MAAM,UAAU,GAAG,UAAa,gBAAyB,EAAE,MAAS,EAAE,WAAoB,EAAE,UAA8B,EAAE;IACxH,MAAM,WAAW,GAAG,gBAAgB,EAAE,CAAC;IAEvC,OAAO;IACP,IAAI,IAAI,IAAI,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;QAC/B,IAAI,CAAC,SAAS,CAAC,WAAW,EAAE,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC,CAAC;IAC5D,CAAC;IAED,MAAM,UAAU,GAAG,cAAc,CAAC,WAAW,CAAC,CAAC;IAE/C,0DAA0D;IAC1D,MAAM,UAAU,GAAwB,EAAE,CAAC;IAE3C,aAAa;IACb,KAAK,MAAM,QAAQ,IAAI,UAAU,EAAE,CAAC;QAChC,MAAM,kBAAkB,GAAG,UAAU,CAAC,QAAQ,CAAC,CAAC;QAChD,MAAM,cAAc,GAAS,MAAO,CAAC,QAAQ,CAAC,CAAC;QAC/C,MAAM,YAAY,GAAG,kBAAkB,CAAC,IAAI,CAAC;QAE7C,IAAI,cAAc,KAAK,SAAS,IAAI,cA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AC,MAAM,EAAE,WAAW,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;QAEzE,OAAO,WAAW,CAAC;IACvB,CAAC;IAED;;;;;;OAMG;IACI,MAAM,CAAC,KAAK,CAAI,gBAAyB,EAAE,MAAS,EAAE,UAA8B,EAAE;QACzF,OAAO,UAAU,CAAC,gBAAgB,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;IAChE,CAAC;IAED;;;;;OAKG;IACI,MAAM,CAAC,WAAW,CAAI,gBAAyB,EAAE,MAAS;QAC7D,OAAO,UAAU,CAAC,gBAAgB,EAAE,MAAM,EAAE,IAAI,CAAC,CAAC;IACtD,CAAC;;AAhPD;;GAEG;AACW,wCAAoB,GAAG,KAAK,CAAC;AAE3C;;GAEG;AACW,uDAAmC,GAAG,CAAC,cAAmB,EAAgC,EAAE;IACtG,MAAM,WAAW,CAAC,8BAA8B,CAAC,CAAC;AACtD,CAAC,CAAC;AAEF;;GAEG;AACW,4CAAwB,GAAG,CAAC,cAAmB,EAAqB,EAAE;IAChF,MAAM,WAAW,CAAC,mBAAmB,CAAC,CAAC;AAC3C,CAAC,CAAC;AAEF;;GAEG;AACW,sCAAkB,GAAG,CAAC,cAAmB,EAAe,EAAE;IACpE,MAAM,WAAW,CAAC,aAAa,CAAC,CAAC;AACrC,CAAC,CAAC;AAEF;;GAEG;AACW,kCAAc,GAAG,CAAC,cAAmB,EAAE,KAAY,EAAE,OAAe,EAAyB,EAAE;IACzG,MAAM,WAAW,CAAC,SAAS,CAAC,CAAC;AACjC,CAAC,CAAC","sourcesContent":["import type { FresnelParameters } from \"../Materials/fresnelParameters\";\r\nimport type { ImageProcessingConfiguration } from \"../Materials/imageProcessingConfiguration\";\r\nimport { _WarnImport } from \"./devTools\";\r\nimport type { ColorCurves } from \"../Materials/colorCurves\";\r\nimport type { Scene } from \"../scene\";\r\nimport type { Nullable } from \"../types\";\r\nimport type { BaseTexture } from \"../Materials/Textures/baseTexture\";\r\nimport type { IAnimatable } from \"../Animations/animatable.interface\";\r\nimport { Tags } from \"./tags\";\r\nimport { Color3, Color4 } from \"../Maths/math.color\";\r\nimport { Matrix, Quaternion, Vector2, Vector3 } from \"../Maths/math.vector\";\r\nimport type { Camera } from \"../Cameras/camera\";\r\nimport { GetMergedStore } from \"./decorators.functions\";\r\n\r\n/** @internal */\r\nexport interface ICopySourceOptions {\r\n /*\r\n * if a texture is used in more than one channel (e.g diffuse and opacity),\r\n * only clone it once and reuse it on the other channels. Default false\r\n */\r\n cloneTexturesOnlyOnce?: boolean;\r\n}\r\n\r\nconst CopySource = function <T>(creationFunction: () => T, source: T, instanciate: boolean, options: ICopySourceOptions = {}): T {\r\n const destination = creationFunction();\r\n\r\n // Tags\r\n if (Tags && Tags.HasTags(source)) {\r\n Tags.AddTagsTo(destination, Tags.GetTags(source, true));\r\n }\r\n\r\n const classStore = GetMergedStore(destination);\r\n\r\n // Map from source texture uniqueId to destination texture\r\n const textureMap: Record<number, any> = {};\r\n\r\n // Properties\r\n for (const property in classStore) {\r\n const propertyDescriptor = classStore[property];\r\n const sourceProperty = (<any>source)[property];\r\n const propertyType = propertyDescriptor.type;\r\n\r\n if (sourceProperty !== undefined && sourceProperty !== null && (property !== \"uniqueId\" || SerializationHelper.AllowLoadingUniqueId)) {\r\n switch (propertyType) {\r\n case 0: // Value\r\n case 6: // Mesh reference\r\n case 9: // Image processing configuration reference\r\n case 11: // Camera reference\r\n if (typeof sourceProperty.slice === \"function\") {\r\n (<any>destination)[property] = sourceProperty.slice();\r\n } else {\r\n (<any>destination)[property] = sourceProperty;\r\n }\r\n break;\r\n case 1: // Texture\r\n if (options.cloneTexturesOnlyOnce && textureMap[sourceProperty.uniqueId]) {\r\n (<any>destination)[property] = textureMap[sourceProperty.uniqueId];\r\n } else {\r\n (<any>destination)[property] = instanciate || sourceProperty.isRenderTarget ? sourceProperty : sourceProperty.clone();\r\n textureMap[sourceProperty.uniqueId] = (<any>destination)[property];\r\n }\r\n break;\r\n case 2: // Color3\r\n case 3: // FresnelParameters\r\n case 4: // Vector2\r\n case 5: // Vector3\r\n case 7: // Color Curves\r\n case 8: // Color 4\r\n case 10: // Quaternion\r\n case 12: // Matrix\r\n (<any>destination)[property] = instanciate ? sourceProperty : sourceProperty.clone();\r\n break;\r\n }\r\n }\r\n }\r\n\r\n return destination;\r\n};\r\n\r\n/**\r\n * Class used to help serialization objects\r\n */\r\nexport class SerializationHelper {\r\n /**\r\n * Gets or sets a boolean to indicate if the UniqueId property should be serialized\r\n */\r\n public static AllowLoadingUniqueId = false;\r\n\r\n /**\r\n * @internal\r\n */\r\n public static _ImageProcessingConfigurationParser = (sourceProperty: any): ImageProcessingConfiguration => {\r\n throw _WarnImport(\"ImageProcessingConfiguration\");\r\n };\r\n\r\n /**\r\n * @internal\r\n */\r\n public static _FresnelParametersParser = (sourceProperty: any): FresnelParameters => {\r\n throw _WarnImport(\"FresnelParameters\");\r\n };\r\n\r\n /**\r\n * @internal\r\n */\r\n public static _ColorCurvesParser = (sourceProperty: any): ColorCurves => {\r\n throw _WarnImport(\"ColorCurves\");\r\n };\r\n\r\n /**\r\n * @internal\r\n */\r\n public static _TextureParser = (sourceProperty: any, scene: Scene, rootUrl: string): Nullable<BaseTexture> => {\r\n throw _WarnImport(\"Texture\");\r\n };\r\n\r\n /**\r\n * Appends the serialized animations from the source animations\r\n * @param source Source containing the animations\r\n * @param destination Target to store the animations\r\n */\r\n public static AppendSerializedAnimations(source: IAnimatable, destination: any): void {\r\n if (source.animations) {\r\n destination.animations = [];\r\n for (let animationIndex = 0; animationIndex < source.animations.length; animationIndex++) {\r\n const animation = source.animations[animationIndex];\r\n if (!animation.doNotSerialize) {\r\n destination.animations.push(animation.serialize());\r\n }\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Static function used to serialized a specific entity\r\n * @param entity defines the entity to serialize\r\n * @param serializationObject defines the optional target object where serialization data will be stored\r\n * @returns a JSON compatible object representing the serialization of the entity\r\n */\r\n public static Serialize<T>(entity: T, serializationObject?: any): any {\r\n if (!serializationObject) {\r\n serializationObject = {};\r\n }\r\n\r\n // Tags\r\n if (Tags) {\r\n serializationObject.tags = Tags.GetTags(entity);\r\n }\r\n\r\n const serializedProperties = GetMergedStore(entity);\r\n\r\n // Properties\r\n for (const property in serializedProperties) {\r\n const propertyDescriptor = serializedProperties[property];\r\n const targetPropertyName = propertyDescriptor.sourceName || property;\r\n const propertyType = propertyDescriptor.type;\r\n const sourceProperty = (<any>entity)[property];\r\n\r\n if (sourceProperty !== undefined && sourceProperty !== null && (property !== \"uniqueId\" || SerializationHelper.AllowLoadingUniqueId)) {\r\n switch (propertyType) {\r\n case 0: // Value\r\n if (Array.isArray(sourceProperty)) {\r\n serializationObject[targetPropertyName] = sourceProperty.slice();\r\n } else {\r\n serializationObject[targetPropertyName] = sourceProperty;\r\n }\r\n break;\r\n case 1: // Texture\r\n serializationObject[targetPropertyName] = sourceProperty.doNotSerialize ? null : sourceProperty.serialize();\r\n break;\r\n case 2: // Color3\r\n serializationObject[targetPropertyName] = sourceProperty.asArray();\r\n break;\r\n case 3: // FresnelParameters\r\n serializationObject[targetPropertyName] = sourceProperty.serialize();\r\n break;\r\n case 4: // Vector2\r\n serializationObject[targetPropertyName] = sourceProperty.asArray();\r\n break;\r\n case 5: // Vector3\r\n serializationObject[targetPropertyName] = sourceProperty.asArray();\r\n break;\r\n case 6: // Mesh reference\r\n serializationObject[targetPropertyName] = sourceProperty.id;\r\n break;\r\n case 7: // Color Curves\r\n serializationObject[targetPropertyName] = sourceProperty.serialize();\r\n break;\r\n case 8: // Color 4\r\n serializationObject[targetPropertyName] = (<Color4>sourceProperty).asArray();\r\n break;\r\n case 9: // Image Processing\r\n serializationObject[targetPropertyName] = (<ImageProcessingConfiguration>sourceProperty).serialize();\r\n break;\r\n case 10: // Quaternion\r\n serializationObject[targetPropertyName] = (<Quaternion>sourceProperty).asArray();\r\n break;\r\n case 11: // Camera reference\r\n serializationObject[targetPropertyName] = (<Camera>sourceProperty).id;\r\n break;\r\n case 12: // Matrix\r\n serializationObject[targetPropertyName] = (<Matrix>sourceProperty).asArray();\r\n break;\r\n }\r\n }\r\n }\r\n\r\n return serializationObject;\r\n }\r\n\r\n /**\r\n * Given a source json and a destination object in a scene, this function will parse the source and will try to apply its content to the destination object\r\n * @param source the source json data\r\n * @param destination the destination object\r\n * @param scene the scene where the object is\r\n * @param rootUrl root url to use to load assets\r\n */\r\n public static ParseProperties(source: any, destination: any, scene: Nullable<Scene>, rootUrl: Nullable<string>) {\r\n if (!rootUrl) {\r\n rootUrl = \"\";\r\n }\r\n\r\n const classStore = GetMergedStore(destination);\r\n\r\n // Properties\r\n for (const property in classStore) {\r\n const propertyDescriptor = classStore[property];\r\n const sourceProperty = source[propertyDescriptor.sourceName || property];\r\n const propertyType = propertyDescriptor.type;\r\n\r\n if (sourceProperty !== undefined && sourceProperty !== null && (property !== \"uniqueId\" || SerializationHelper.AllowLoadingUniqueId)) {\r\n const dest = destination;\r\n switch (propertyType) {\r\n case 0: // Value\r\n dest[property] = sourceProperty;\r\n break;\r\n case 1: // Texture\r\n if (scene) {\r\n dest[property] = SerializationHelper._TextureParser(sourceProperty, scene, rootUrl);\r\n }\r\n break;\r\n case 2: // Color3\r\n dest[property] = Color3.FromArray(sourceProperty);\r\n break;\r\n case 3: // FresnelParameters\r\n dest[property] = SerializationHelper._FresnelParametersParser(sourceProperty);\r\n break;\r\n case 4: // Vector2\r\n dest[property] = Vector2.FromArray(sourceProperty);\r\n break;\r\n case 5: // Vector3\r\n dest[property] = Vector3.FromArray(sourceProperty);\r\n break;\r\n case 6: // Mesh reference\r\n if (scene) {\r\n dest[property] = scene.getLastMeshById(sourceProperty);\r\n }\r\n break;\r\n case 7: // Color Curves\r\n dest[property] = SerializationHelper._ColorCurvesParser(sourceProperty);\r\n break;\r\n case 8: // Color 4\r\n dest[property] = Color4.FromArray(sourceProperty);\r\n break;\r\n case 9: // Image Processing\r\n dest[property] = SerializationHelper._ImageProcessingConfigurationParser(sourceProperty);\r\n break;\r\n case 10: // Quaternion\r\n dest[property] = Quaternion.FromArray(sourceProperty);\r\n break;\r\n case 11: // Camera reference\r\n if (scene) {\r\n dest[property] = scene.getCameraById(sourceProperty);\r\n }\r\n break;\r\n case 12: // Matrix\r\n dest[property] = Matrix.FromArray(sourceProperty);\r\n break;\r\n }\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Creates a new entity from a serialization data object\r\n * @param creationFunction defines a function used to instanciated the new entity\r\n * @param source defines the source serialization data\r\n * @param scene defines the hosting scene\r\n * @param rootUrl defines the root url for resources\r\n * @returns a new entity\r\n */\r\n public static Parse<T>(creationFunction: () => T, source: any, scene: Nullable<Scene>, rootUrl: Nullable<string> = null): T {\r\n const destination = creationFunction();\r\n\r\n // Tags\r\n if (Tags) {\r\n Tags.AddTagsTo(destination, source.tags);\r\n }\r\n\r\n SerializationHelper.ParseProperties(source, destination, scene, rootUrl);\r\n\r\n return destination;\r\n }\r\n\r\n /**\r\n * Clones an object\r\n * @param creationFunction defines the function used to instanciate the new object\r\n * @param source defines the source object\r\n * @param options defines the options to use\r\n * @returns the cloned object\r\n */\r\n public static Clone<T>(creationFunction: () => T, source: T, options: ICopySourceOptions = {}): T {\r\n return CopySource(creationFunction, source, false, options);\r\n }\r\n\r\n /**\r\n * Instanciates a new object based on a source one (some data will be shared between both object)\r\n * @param creationFunction defines the function used to instanciate the new object\r\n * @param source defines the source object\r\n * @returns the new object\r\n */\r\n public static Instanciate<T>(creationFunction: () => T, source: T): T {\r\n return CopySource(creationFunction, source, true);\r\n }\r\n}\r\n"]}
package/Misc/index.d.ts CHANGED
@@ -67,6 +67,7 @@ export * from "./error.js";
67
67
  export * from "./snapshotRenderingHelper.js";
68
68
  export * from "./observableCoroutine.js";
69
69
  export * from "./copyTextureToTexture.js";
70
+ export * from "./areaLightsTextureTools.js";
70
71
  export { DumpTools, EncodeImageAsync } from "./dumpTools.js";
71
72
  export * from "./greasedLineTools.js";
72
73
  export * from "./equirectangularCapture.js";
@@ -81,4 +82,6 @@ export * from "../ShadersWGSL/rgbdDecode.fragment.js";
81
82
  export * from "../ShadersWGSL/rgbdEncode.fragment.js";
82
83
  export * from "../Shaders/copyTextureToTexture.fragment.js";
83
84
  export * from "../ShadersWGSL/copyTextureToTexture.fragment.js";
85
+ export * from "../Shaders/areaLightTextureProcessing.fragment.js";
86
+ export * from "../ShadersWGSL/areaLightTextureProcessing.fragment.js";
84
87
  export * from "./tools.internals.js";
package/Misc/index.js CHANGED
@@ -70,6 +70,7 @@ export * from "./snapshotRenderingHelper.js";
70
70
  // eslint-disable-next-line import/export
71
71
  export * from "./observableCoroutine.js";
72
72
  export * from "./copyTextureToTexture.js";
73
+ export * from "./areaLightsTextureTools.js";
73
74
  export { DumpTools, EncodeImageAsync } from "./dumpTools.js";
74
75
  export * from "./greasedLineTools.js";
75
76
  export * from "./equirectangularCapture.js";
@@ -86,5 +87,8 @@ export * from "../ShadersWGSL/rgbdEncode.fragment.js";
86
87
  // CopyTextureToTexture
87
88
  export * from "../Shaders/copyTextureToTexture.fragment.js";
88
89
  export * from "../ShadersWGSL/copyTextureToTexture.fragment.js";
90
+ // Area Light Texture
91
+ export * from "../Shaders/areaLightTextureProcessing.fragment.js";
92
+ export * from "../ShadersWGSL/areaLightTextureProcessing.fragment.js";
89
93
  export * from "./tools.internals.js";
90
94
  //# sourceMappingURL=index.js.map
package/Misc/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../dev/core/src/Misc/index.ts"],"names":[],"mappings":"AAAA,6DAA6D;AAC7D,cAAc,qBAAqB,CAAC;AACpC,cAAc,iBAAiB,CAAC;AAChC,cAAc,SAAS,CAAC;AACxB,cAAc,OAAO,CAAC;AACtB,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAC3B,cAAc,2BAA2B,CAAC;AAC1C,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC;AAC7B,cAAc,0BAA0B,CAAC;AAC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B,CAAC;AACvC,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,iBAAiB,CAAC;AAChC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,aAAa,CAAC;AAC5B,cAAc,QAAQ,CAAC;AACvB,cAAc,SAAS,CAAC;AACxB,cAAc,2BAA2B,CAAC;AAC1C,yCAAyC;AACzC,cAAc,uBAAuB,CAAC;AACtC,cAAc,wBAAwB,CAAC;AACvC,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC1D,cAAc,oBAAoB,CAAC;AACnC,cAAc,0BAA0B,CAAC;AACzC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,QAAQ,CAAC;AAEvB,mBAAmB;AACnB,cAAc,gCAAgC,CAAC;AAC/C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,oCAAoC,CAAC;AACnD,cAAc,oCAAoC,CAAC;AAEnD,uBAAuB;AACvB,cAAc,0CAA0C,CAAC;AACzD,cAAc,8CAA8C,CAAC;AAE7D,cAAc,mBAAmB,CAAC","sourcesContent":["/* eslint-disable @typescript-eslint/no-restricted-imports */\r\nexport * from \"./andOrNotEvaluator\";\r\nexport * from \"./assetsManager\";\r\nexport * from \"./basis\";\r\nexport * from \"./dds\";\r\nexport * from \"./decorators\";\r\nexport * from \"./deferred\";\r\nexport * from \"./environmentTextureTools\";\r\nexport * from \"./meshExploder\";\r\nexport * from \"./filesInput\";\r\nexport * from \"./HighDynamicRange/index\";\r\nexport * from \"./khronosTextureContainer\";\r\nexport * from \"./observable\";\r\nexport * from \"./observable.extensions\";\r\nexport * from \"./performanceMonitor\";\r\nexport * from \"./sceneOptimizer\";\r\nexport * from \"./sceneSerializer\";\r\nexport * from \"./smartArray\";\r\nexport * from \"./stringDictionary\";\r\nexport * from \"./tags\";\r\nexport * from \"./textureTools\";\r\n// loaded from texture tools\r\nexport * from \"../Shaders/lodCube.fragment\";\r\nexport * from \"../Shaders/lod.fragment\";\r\nexport * from \"../ShadersWGSL/lodCube.fragment\";\r\nexport * from \"../ShadersWGSL/lod.fragment\";\r\nexport * from \"./tga\";\r\nexport * from \"./tools\";\r\nexport * from \"./videoRecorder\";\r\nexport * from \"./virtualJoystick\";\r\nexport * from \"./workerPool\";\r\nexport * from \"./logger\";\r\nexport * from \"./typeStore\";\r\nexport * from \"./filesInputStore\";\r\nexport * from \"./deepCopier\";\r\nexport * from \"./deepMerger\";\r\nexport * from \"./pivotTools\";\r\nexport * from \"./precisionDate\";\r\nexport * from \"./screenshotTools\";\r\nexport * from \"./webRequest\";\r\nexport * from \"./iInspectable\";\r\nexport * from \"./brdfTextureTools\";\r\nexport * from \"./rgbdTextureTools\";\r\nexport * from \"./gradients\";\r\nexport * from \"./perfCounter\";\r\nexport * from \"./fileRequest\";\r\nexport * from \"./customAnimationFrameRequester\";\r\nexport * from \"./retryStrategy\";\r\nexport * from \"./interfaces/screenshotSize\";\r\nexport * from \"./interfaces/iPerfViewer\";\r\nexport * from \"./fileTools\";\r\nexport * from \"./stringTools\";\r\nexport * from \"./dataReader\";\r\nexport * from \"./minMaxReducer\";\r\nexport * from \"./depthReducer\";\r\nexport * from \"./dataStorage\";\r\nexport * from \"./sceneRecorder\";\r\nexport * from \"./khronosTextureContainer2\";\r\nexport * from \"./trajectoryClassifier\";\r\nexport * from \"./timer\";\r\nexport * from \"./copyTools\";\r\nexport * from \"./reflector\";\r\nexport * from \"./domManagement\";\r\nexport * from \"./pressureObserverWrapper\";\r\nexport * from \"./PerformanceViewer/index\";\r\nexport * from \"./coroutine\";\r\nexport * from \"./guid\";\r\nexport * from \"./error\";\r\nexport * from \"./snapshotRenderingHelper\";\r\n// eslint-disable-next-line import/export\r\nexport * from \"./observableCoroutine\";\r\nexport * from \"./copyTextureToTexture\";\r\nexport { DumpTools, EncodeImageAsync } from \"./dumpTools\";\r\nexport * from \"./greasedLineTools\";\r\nexport * from \"./equirectangularCapture\";\r\nexport * from \"./decorators.serialization\";\r\nexport * from \"./asyncLock\";\r\nexport * from \"./bitArray\";\r\nexport * from \"./urlTools\";\r\nexport * from \"./lazy\";\r\n\r\n// RGBDTextureTools\r\nexport * from \"../Shaders/rgbdDecode.fragment\";\r\nexport * from \"../Shaders/rgbdEncode.fragment\";\r\nexport * from \"../ShadersWGSL/rgbdDecode.fragment\";\r\nexport * from \"../ShadersWGSL/rgbdEncode.fragment\";\r\n\r\n// CopyTextureToTexture\r\nexport * from \"../Shaders/copyTextureToTexture.fragment\";\r\nexport * from \"../ShadersWGSL/copyTextureToTexture.fragment\";\r\n\r\nexport * from \"./tools.internals\";\r\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../dev/core/src/Misc/index.ts"],"names":[],"mappings":"AAAA,6DAA6D;AAC7D,cAAc,qBAAqB,CAAC;AACpC,cAAc,iBAAiB,CAAC;AAChC,cAAc,SAAS,CAAC;AACxB,cAAc,OAAO,CAAC;AACtB,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAC3B,cAAc,2BAA2B,CAAC;AAC1C,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC;AAC7B,cAAc,0BAA0B,CAAC;AACzC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,cAAc,CAAC;AAC7B,cAAc,yBAAyB,CAAC;AACxC,cAAc,sBAAsB,CAAC;AACrC,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC;AAClC,cAAc,cAAc,CAAC;AAC7B,cAAc,oBAAoB,CAAC;AACnC,cAAc,QAAQ,CAAC;AACvB,cAAc,gBAAgB,CAAC;AAC/B,4BAA4B;AAC5B,cAAc,6BAA6B,CAAC;AAC5C,cAAc,yBAAyB,CAAC;AACxC,cAAc,iCAAiC,CAAC;AAChD,cAAc,6B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,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC1D,cAAc,oBAAoB,CAAC;AACnC,cAAc,0BAA0B,CAAC;AACzC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,QAAQ,CAAC;AAEvB,mBAAmB;AACnB,cAAc,gCAAgC,CAAC;AAC/C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,oCAAoC,CAAC;AACnD,cAAc,oCAAoC,CAAC;AAEnD,uBAAuB;AACvB,cAAc,0CAA0C,CAAC;AACzD,cAAc,8CAA8C,CAAC;AAE7D,qBAAqB;AACrB,cAAc,gDAAgD,CAAC;AAC/D,cAAc,oDAAoD,CAAC;AACnE,cAAc,mBAAmB,CAAC","sourcesContent":["/* eslint-disable @typescript-eslint/no-restricted-imports */\r\nexport * from \"./andOrNotEvaluator\";\r\nexport * from \"./assetsManager\";\r\nexport * from \"./basis\";\r\nexport * from \"./dds\";\r\nexport * from \"./decorators\";\r\nexport * from \"./deferred\";\r\nexport * from \"./environmentTextureTools\";\r\nexport * from \"./meshExploder\";\r\nexport * from \"./filesInput\";\r\nexport * from \"./HighDynamicRange/index\";\r\nexport * from \"./khronosTextureContainer\";\r\nexport * from \"./observable\";\r\nexport * from \"./observable.extensions\";\r\nexport * from \"./performanceMonitor\";\r\nexport * from \"./sceneOptimizer\";\r\nexport * from \"./sceneSerializer\";\r\nexport * from \"./smartArray\";\r\nexport * from \"./stringDictionary\";\r\nexport * from \"./tags\";\r\nexport * from \"./textureTools\";\r\n// loaded from texture tools\r\nexport * from \"../Shaders/lodCube.fragment\";\r\nexport * from \"../Shaders/lod.fragment\";\r\nexport * from \"../ShadersWGSL/lodCube.fragment\";\r\nexport * from \"../ShadersWGSL/lod.fragment\";\r\nexport * from \"./tga\";\r\nexport * from \"./tools\";\r\nexport * from \"./videoRecorder\";\r\nexport * from \"./virtualJoystick\";\r\nexport * from \"./workerPool\";\r\nexport * from \"./logger\";\r\nexport * from \"./typeStore\";\r\nexport * from \"./filesInputStore\";\r\nexport * from \"./deepCopier\";\r\nexport * from \"./deepMerger\";\r\nexport * from \"./pivotTools\";\r\nexport * from \"./precisionDate\";\r\nexport * from \"./screenshotTools\";\r\nexport * from \"./webRequest\";\r\nexport * from \"./iInspectable\";\r\nexport * from \"./brdfTextureTools\";\r\nexport * from \"./rgbdTextureTools\";\r\nexport * from \"./gradients\";\r\nexport * from \"./perfCounter\";\r\nexport * from \"./fileRequest\";\r\nexport * from \"./customAnimationFrameRequester\";\r\nexport * from \"./retryStrategy\";\r\nexport * from \"./interfaces/screenshotSize\";\r\nexport * from \"./interfaces/iPerfViewer\";\r\nexport * from \"./fileTools\";\r\nexport * from \"./stringTools\";\r\nexport * from \"./dataReader\";\r\nexport * from \"./minMaxReducer\";\r\nexport * from \"./depthReducer\";\r\nexport * from \"./dataStorage\";\r\nexport * from \"./sceneRecorder\";\r\nexport * from \"./khronosTextureContainer2\";\r\nexport * from \"./trajectoryClassifier\";\r\nexport * from \"./timer\";\r\nexport * from \"./copyTools\";\r\nexport * from \"./reflector\";\r\nexport * from \"./domManagement\";\r\nexport * from \"./pressureObserverWrapper\";\r\nexport * from \"./PerformanceViewer/index\";\r\nexport * from \"./coroutine\";\r\nexport * from \"./guid\";\r\nexport * from \"./error\";\r\nexport * from \"./snapshotRenderingHelper\";\r\n// eslint-disable-next-line import/export\r\nexport * from \"./observableCoroutine\";\r\nexport * from \"./copyTextureToTexture\";\r\nexport * from \"./areaLightsTextureTools\";\r\nexport { DumpTools, EncodeImageAsync } from \"./dumpTools\";\r\nexport * from \"./greasedLineTools\";\r\nexport * from \"./equirectangularCapture\";\r\nexport * from \"./decorators.serialization\";\r\nexport * from \"./asyncLock\";\r\nexport * from \"./bitArray\";\r\nexport * from \"./urlTools\";\r\nexport * from \"./lazy\";\r\n\r\n// RGBDTextureTools\r\nexport * from \"../Shaders/rgbdDecode.fragment\";\r\nexport * from \"../Shaders/rgbdEncode.fragment\";\r\nexport * from \"../ShadersWGSL/rgbdDecode.fragment\";\r\nexport * from \"../ShadersWGSL/rgbdEncode.fragment\";\r\n\r\n// CopyTextureToTexture\r\nexport * from \"../Shaders/copyTextureToTexture.fragment\";\r\nexport * from \"../ShadersWGSL/copyTextureToTexture.fragment\";\r\n\r\n// Area Light Texture\r\nexport * from \"../Shaders/areaLightTextureProcessing.fragment\";\r\nexport * from \"../ShadersWGSL/areaLightTextureProcessing.fragment\";\r\nexport * from \"./tools.internals\";\r\n"]}
@@ -15,6 +15,8 @@ export interface INodeParticleEditorOptions {
15
15
  /** Additional configuration for the NPE */
16
16
  nodeEditorConfig?: {
17
17
  backgroundColor?: Color4;
18
+ /** If true, the node particle system set will be disposed when the editor is closed (default: true) */
19
+ disposeOnClose?: boolean;
18
20
  };
19
21
  }
20
22
  /**