@babylonjs/core 6.45.0 → 6.46.0

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 (235) hide show
  1. package/Animations/animation.js +1 -1
  2. package/Animations/animation.js.map +1 -1
  3. package/BakedVertexAnimation/bakedVertexAnimationManager.js +2 -1
  4. package/BakedVertexAnimation/bakedVertexAnimationManager.js.map +1 -1
  5. package/Bones/skeleton.js +2 -2
  6. package/Bones/skeleton.js.map +1 -1
  7. package/Cameras/camera.d.ts +3 -3
  8. package/Cameras/camera.js +2 -1
  9. package/Cameras/camera.js.map +1 -1
  10. package/Cameras/cameraInputsManager.js +1 -1
  11. package/Cameras/cameraInputsManager.js.map +1 -1
  12. package/Cameras/targetCamera.js +4 -0
  13. package/Cameras/targetCamera.js.map +1 -1
  14. package/Compute/computeShader.d.ts +4 -2
  15. package/Compute/computeShader.js +7 -3
  16. package/Compute/computeShader.js.map +1 -1
  17. package/Debug/directionalLightFrustumViewer.js +6 -6
  18. package/Debug/directionalLightFrustumViewer.js.map +1 -1
  19. package/Engines/Extensions/engine.computeShader.d.ts +2 -1
  20. package/Engines/Extensions/engine.computeShader.js +1 -0
  21. package/Engines/Extensions/engine.computeShader.js.map +1 -1
  22. package/Engines/Extensions/engine.rawTexture.js +3 -3
  23. package/Engines/Extensions/engine.rawTexture.js.map +1 -1
  24. package/Engines/Native/nativePipelineContext.js +1 -1
  25. package/Engines/Native/nativePipelineContext.js.map +1 -1
  26. package/Engines/WebGL/webGLPipelineContext.js +1 -1
  27. package/Engines/WebGL/webGLPipelineContext.js.map +1 -1
  28. package/Engines/WebGPU/webgpuComputeContext.js +7 -3
  29. package/Engines/WebGPU/webgpuComputeContext.js.map +1 -1
  30. package/Engines/engine.d.ts +1 -1
  31. package/Engines/thinEngine.js +2 -2
  32. package/Engines/thinEngine.js.map +1 -1
  33. package/Engines/webgpuEngine.js +2 -15
  34. package/Engines/webgpuEngine.js.map +1 -1
  35. package/Layers/glowLayer.js +2 -1
  36. package/Layers/glowLayer.js.map +1 -1
  37. package/Layers/highlightLayer.js +2 -1
  38. package/Layers/highlightLayer.js.map +1 -1
  39. package/Lights/light.js +2 -1
  40. package/Lights/light.js.map +1 -1
  41. package/Loading/Plugins/babylonFileLoader.js +9 -0
  42. package/Loading/Plugins/babylonFileLoader.js.map +1 -1
  43. package/Loading/sceneLoader.d.ts +6 -1
  44. package/Loading/sceneLoader.js +6 -5
  45. package/Loading/sceneLoader.js.map +1 -1
  46. package/Materials/Background/backgroundMaterial.js +2 -1
  47. package/Materials/Background/backgroundMaterial.js.map +1 -1
  48. package/Materials/GaussianSplatting/gaussianSplattingMaterial.js +1 -1
  49. package/Materials/GaussianSplatting/gaussianSplattingMaterial.js.map +1 -1
  50. package/Materials/Node/nodeMaterial.d.ts +2 -1
  51. package/Materials/Node/nodeMaterial.js +5 -1
  52. package/Materials/Node/nodeMaterial.js.map +1 -1
  53. package/Materials/PBR/pbrBaseMaterial.d.ts +1 -1
  54. package/Materials/PBR/pbrBaseMaterial.js.map +1 -1
  55. package/Materials/PBR/pbrMaterial.js +2 -1
  56. package/Materials/PBR/pbrMaterial.js.map +1 -1
  57. package/Materials/PBR/pbrMetallicRoughnessMaterial.js +2 -1
  58. package/Materials/PBR/pbrMetallicRoughnessMaterial.js.map +1 -1
  59. package/Materials/PBR/pbrSpecularGlossinessMaterial.js +2 -1
  60. package/Materials/PBR/pbrSpecularGlossinessMaterial.js.map +1 -1
  61. package/Materials/Textures/baseTexture.js +2 -1
  62. package/Materials/Textures/baseTexture.js.map +1 -1
  63. package/Materials/Textures/cubeTexture.js +2 -1
  64. package/Materials/Textures/cubeTexture.js.map +1 -1
  65. package/Materials/Textures/rawCubeTexture.js +1 -1
  66. package/Materials/Textures/rawCubeTexture.js.map +1 -1
  67. package/Materials/Textures/texture.js +2 -1
  68. package/Materials/Textures/texture.js.map +1 -1
  69. package/Materials/colorCurves.d.ts +1 -1
  70. package/Materials/colorCurves.functions.d.ts +5 -0
  71. package/Materials/colorCurves.functions.js +8 -0
  72. package/Materials/colorCurves.functions.js.map +1 -0
  73. package/Materials/colorCurves.js +8 -8
  74. package/Materials/colorCurves.js.map +1 -1
  75. package/Materials/fresnelParameters.js +1 -1
  76. package/Materials/fresnelParameters.js.map +1 -1
  77. package/Materials/imageProcessingConfiguration.d.ts +3 -48
  78. package/Materials/imageProcessingConfiguration.defines.d.ts +46 -0
  79. package/Materials/imageProcessingConfiguration.defines.js +27 -0
  80. package/Materials/imageProcessingConfiguration.defines.js.map +1 -0
  81. package/Materials/imageProcessingConfiguration.functions.d.ts +13 -0
  82. package/Materials/imageProcessingConfiguration.functions.js +41 -0
  83. package/Materials/imageProcessingConfiguration.functions.js.map +1 -0
  84. package/Materials/imageProcessingConfiguration.js +18 -69
  85. package/Materials/imageProcessingConfiguration.js.map +1 -1
  86. package/Materials/material.js +2 -1
  87. package/Materials/material.js.map +1 -1
  88. package/Materials/materialHelper.d.ts +33 -33
  89. package/Materials/materialHelper.js +244 -286
  90. package/Materials/materialHelper.js.map +1 -1
  91. package/Materials/materialPluginBase.js +2 -1
  92. package/Materials/materialPluginBase.js.map +1 -1
  93. package/Materials/materialStencilState.js +2 -1
  94. package/Materials/materialStencilState.js.map +1 -1
  95. package/Materials/shaderMaterial.js +1 -1
  96. package/Materials/shaderMaterial.js.map +1 -1
  97. package/Materials/standardMaterial.d.ts +1 -1
  98. package/Materials/standardMaterial.js +2 -1
  99. package/Materials/standardMaterial.js.map +1 -1
  100. package/Materials/uniformBuffer.js +2 -2
  101. package/Materials/uniformBuffer.js.map +1 -1
  102. package/Maths/math.color.d.ts +392 -66
  103. package/Maths/math.color.js +541 -65
  104. package/Maths/math.color.js.map +1 -1
  105. package/Maths/math.like.d.ts +17 -28
  106. package/Maths/math.like.js.map +1 -1
  107. package/Maths/math.plane.d.ts +2 -1
  108. package/Maths/math.plane.js.map +1 -1
  109. package/Maths/math.polar.d.ts +1 -1
  110. package/Maths/math.polar.js.map +1 -1
  111. package/Maths/math.scalar.d.ts +6 -6
  112. package/Maths/math.scalar.functions.d.ts +51 -0
  113. package/Maths/math.scalar.functions.js +80 -0
  114. package/Maths/math.scalar.functions.js.map +1 -0
  115. package/Maths/math.scalar.js +48 -73
  116. package/Maths/math.scalar.js.map +1 -1
  117. package/Maths/math.vector.d.ts +571 -72
  118. package/Maths/math.vector.js +917 -119
  119. package/Maths/math.vector.js.map +1 -1
  120. package/Maths/math.viewport.d.ts +2 -1
  121. package/Maths/math.viewport.js.map +1 -1
  122. package/Maths/tensor.d.ts +411 -0
  123. package/Maths/tensor.js +3 -0
  124. package/Maths/tensor.js.map +1 -0
  125. package/Meshes/Node/Blocks/Set/setColorsBlock.js +20 -4
  126. package/Meshes/Node/Blocks/Set/setColorsBlock.js.map +1 -1
  127. package/Meshes/Node/nodeGeometry.js +2 -1
  128. package/Meshes/Node/nodeGeometry.js.map +1 -1
  129. package/Meshes/mesh.js +2 -2
  130. package/Meshes/mesh.js.map +1 -1
  131. package/Meshes/mesh.vertexData.d.ts +4 -0
  132. package/Meshes/mesh.vertexData.js +10 -0
  133. package/Meshes/mesh.vertexData.js.map +1 -1
  134. package/Meshes/transformNode.js +2 -1
  135. package/Meshes/transformNode.js.map +1 -1
  136. package/Misc/arrayTools.d.ts +2 -19
  137. package/Misc/arrayTools.js.map +1 -1
  138. package/Misc/decorators.d.ts +0 -80
  139. package/Misc/decorators.functions.d.ts +7 -0
  140. package/Misc/decorators.functions.js +52 -0
  141. package/Misc/decorators.functions.js.map +1 -0
  142. package/Misc/decorators.js +2 -318
  143. package/Misc/decorators.js.map +1 -1
  144. package/Misc/decorators.serialization.d.ts +81 -0
  145. package/Misc/decorators.serialization.js +269 -0
  146. package/Misc/decorators.serialization.js.map +1 -0
  147. package/Misc/index.d.ts +1 -0
  148. package/Misc/index.js +1 -0
  149. package/Misc/index.js.map +1 -1
  150. package/Misc/sceneRecorder.js +1 -1
  151. package/Misc/sceneRecorder.js.map +1 -1
  152. package/Misc/sceneSerializer.js +8 -1
  153. package/Misc/sceneSerializer.js.map +1 -1
  154. package/Misc/tools.functions.d.ts +14 -0
  155. package/Misc/tools.functions.js +23 -0
  156. package/Misc/tools.functions.js.map +1 -0
  157. package/Misc/tools.js +5 -6
  158. package/Misc/tools.js.map +1 -1
  159. package/Morph/morphTarget.js +2 -1
  160. package/Morph/morphTarget.js.map +1 -1
  161. package/Particles/EmitterTypes/boxParticleEmitter.js +8 -8
  162. package/Particles/EmitterTypes/boxParticleEmitter.js.map +1 -1
  163. package/Particles/baseParticleSystem.d.ts +8 -11
  164. package/Particles/baseParticleSystem.js +9 -40
  165. package/Particles/baseParticleSystem.js.map +1 -1
  166. package/Particles/gpuParticleSystem.d.ts +71 -1
  167. package/Particles/gpuParticleSystem.js +102 -1
  168. package/Particles/gpuParticleSystem.js.map +1 -1
  169. package/Particles/particle.d.ts +3 -3
  170. package/Particles/particle.js +3 -3
  171. package/Particles/particle.js.map +1 -1
  172. package/Particles/particleSystem.d.ts +81 -455
  173. package/Particles/particleSystem.functions.d.ts +61 -0
  174. package/Particles/particleSystem.functions.js +79 -0
  175. package/Particles/particleSystem.functions.js.map +1 -0
  176. package/Particles/particleSystem.js +390 -1984
  177. package/Particles/particleSystem.js.map +1 -1
  178. package/Particles/thinParticleSystem.d.ts +485 -0
  179. package/Particles/thinParticleSystem.js +1768 -0
  180. package/Particles/thinParticleSystem.js.map +1 -0
  181. package/PostProcesses/RenderPipeline/Pipelines/defaultRenderingPipeline.js +2 -1
  182. package/PostProcesses/RenderPipeline/Pipelines/defaultRenderingPipeline.js.map +1 -1
  183. package/PostProcesses/RenderPipeline/Pipelines/ssao2RenderingPipeline.js +2 -1
  184. package/PostProcesses/RenderPipeline/Pipelines/ssao2RenderingPipeline.js.map +1 -1
  185. package/PostProcesses/RenderPipeline/Pipelines/ssrRenderingPipeline.js +2 -1
  186. package/PostProcesses/RenderPipeline/Pipelines/ssrRenderingPipeline.js.map +1 -1
  187. package/PostProcesses/RenderPipeline/Pipelines/standardRenderingPipeline.js +2 -1
  188. package/PostProcesses/RenderPipeline/Pipelines/standardRenderingPipeline.js.map +1 -1
  189. package/PostProcesses/RenderPipeline/Pipelines/taaRenderingPipeline.js +2 -1
  190. package/PostProcesses/RenderPipeline/Pipelines/taaRenderingPipeline.js.map +1 -1
  191. package/PostProcesses/blackAndWhitePostProcess.js +2 -1
  192. package/PostProcesses/blackAndWhitePostProcess.js.map +1 -1
  193. package/PostProcesses/blurPostProcess.js +2 -1
  194. package/PostProcesses/blurPostProcess.js.map +1 -1
  195. package/PostProcesses/chromaticAberrationPostProcess.js +2 -1
  196. package/PostProcesses/chromaticAberrationPostProcess.js.map +1 -1
  197. package/PostProcesses/colorCorrectionPostProcess.js +2 -1
  198. package/PostProcesses/colorCorrectionPostProcess.js.map +1 -1
  199. package/PostProcesses/convolutionPostProcess.js +2 -1
  200. package/PostProcesses/convolutionPostProcess.js.map +1 -1
  201. package/PostProcesses/displayPassPostProcess.js +1 -1
  202. package/PostProcesses/displayPassPostProcess.js.map +1 -1
  203. package/PostProcesses/filterPostProcess.js +2 -1
  204. package/PostProcesses/filterPostProcess.js.map +1 -1
  205. package/PostProcesses/fxaaPostProcess.js +1 -1
  206. package/PostProcesses/fxaaPostProcess.js.map +1 -1
  207. package/PostProcesses/grainPostProcess.js +2 -1
  208. package/PostProcesses/grainPostProcess.js.map +1 -1
  209. package/PostProcesses/imageProcessingPostProcess.js.map +1 -1
  210. package/PostProcesses/motionBlurPostProcess.js +2 -1
  211. package/PostProcesses/motionBlurPostProcess.js.map +1 -1
  212. package/PostProcesses/passPostProcess.js +1 -1
  213. package/PostProcesses/passPostProcess.js.map +1 -1
  214. package/PostProcesses/postProcess.js +2 -1
  215. package/PostProcesses/postProcess.js.map +1 -1
  216. package/PostProcesses/refractionPostProcess.js +2 -1
  217. package/PostProcesses/refractionPostProcess.js.map +1 -1
  218. package/PostProcesses/screenSpaceCurvaturePostProcess.js +2 -1
  219. package/PostProcesses/screenSpaceCurvaturePostProcess.js.map +1 -1
  220. package/PostProcesses/screenSpaceReflectionPostProcess.js +2 -1
  221. package/PostProcesses/screenSpaceReflectionPostProcess.js.map +1 -1
  222. package/PostProcesses/sharpenPostProcess.js +2 -1
  223. package/PostProcesses/sharpenPostProcess.js.map +1 -1
  224. package/Probes/reflectionProbe.js +2 -1
  225. package/Probes/reflectionProbe.js.map +1 -1
  226. package/Sprites/spriteManager.d.ts +4 -0
  227. package/Sprites/spriteManager.js.map +1 -1
  228. package/XR/features/WebXRControllerTeleportation.d.ts +9 -0
  229. package/XR/features/WebXRControllerTeleportation.js +75 -31
  230. package/XR/features/WebXRControllerTeleportation.js.map +1 -1
  231. package/node.js +2 -1
  232. package/node.js.map +1 -1
  233. package/package.json +1 -1
  234. package/types.d.ts +105 -0
  235. package/types.js.map +1 -1
@@ -1,14 +1,4 @@
1
1
  import type { Nullable } from "../types";
2
- import type { IAnimatable } from "../Animations/animatable.interface";
3
- import type { Scene } from "../scene";
4
- import type { ImageProcessingConfiguration } from "../Materials/imageProcessingConfiguration";
5
- import type { FresnelParameters } from "../Materials/fresnelParameters";
6
- import type { ColorCurves } from "../Materials/colorCurves";
7
- import type { BaseTexture } from "../Materials/Textures/baseTexture";
8
- /** @internal */
9
- export interface CopySourceOptions {
10
- cloneTexturesOnlyOnce?: boolean;
11
- }
12
2
  export declare function expandToProperty(callback: string, targetKey?: Nullable<string>): (target: any, propertyKey: string) => void;
13
3
  export declare function serialize(sourceName?: string): (target: any, propertyKey: string | symbol) => void;
14
4
  export declare function serializeAsTexture(sourceName?: string): (target: any, propertyKey: string | symbol) => void;
@@ -28,76 +18,6 @@ export declare function serializeAsMatrix(sourceName?: string): (target: any, pr
28
18
  * @returns Property Decorator
29
19
  */
30
20
  export declare function serializeAsCameraReference(sourceName?: string): (target: any, propertyKey: string | symbol) => void;
31
- /**
32
- * Class used to help serialization objects
33
- */
34
- export declare class SerializationHelper {
35
- /**
36
- * Gets or sets a boolean to indicate if the UniqueId property should be serialized
37
- */
38
- static AllowLoadingUniqueId: boolean;
39
- /**
40
- * @internal
41
- */
42
- static _ImageProcessingConfigurationParser: (sourceProperty: any) => ImageProcessingConfiguration;
43
- /**
44
- * @internal
45
- */
46
- static _FresnelParametersParser: (sourceProperty: any) => FresnelParameters;
47
- /**
48
- * @internal
49
- */
50
- static _ColorCurvesParser: (sourceProperty: any) => ColorCurves;
51
- /**
52
- * @internal
53
- */
54
- static _TextureParser: (sourceProperty: any, scene: Scene, rootUrl: string) => Nullable<BaseTexture>;
55
- /**
56
- * Appends the serialized animations from the source animations
57
- * @param source Source containing the animations
58
- * @param destination Target to store the animations
59
- */
60
- static AppendSerializedAnimations(source: IAnimatable, destination: any): void;
61
- /**
62
- * Static function used to serialized a specific entity
63
- * @param entity defines the entity to serialize
64
- * @param serializationObject defines the optional target object where serialization data will be stored
65
- * @returns a JSON compatible object representing the serialization of the entity
66
- */
67
- static Serialize<T>(entity: T, serializationObject?: any): any;
68
- /**
69
- * 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
70
- * @param source the source json data
71
- * @param destination the destination object
72
- * @param scene the scene where the object is
73
- * @param rootUrl root url to use to load assets
74
- */
75
- static ParseProperties(source: any, destination: any, scene: Nullable<Scene>, rootUrl: Nullable<string>): void;
76
- /**
77
- * Creates a new entity from a serialization data object
78
- * @param creationFunction defines a function used to instanciated the new entity
79
- * @param source defines the source serialization data
80
- * @param scene defines the hosting scene
81
- * @param rootUrl defines the root url for resources
82
- * @returns a new entity
83
- */
84
- static Parse<T>(creationFunction: () => T, source: any, scene: Nullable<Scene>, rootUrl?: Nullable<string>): T;
85
- /**
86
- * Clones an object
87
- * @param creationFunction defines the function used to instanciate the new object
88
- * @param source defines the source object
89
- * @param options defines the options to use
90
- * @returns the cloned object
91
- */
92
- static Clone<T>(creationFunction: () => T, source: T, options?: CopySourceOptions): T;
93
- /**
94
- * Instanciates a new object based on a source one (some data will be shared between both object)
95
- * @param creationFunction defines the function used to instanciate the new object
96
- * @param source defines the source object
97
- * @returns the new object
98
- */
99
- static Instanciate<T>(creationFunction: () => T, source: T): T;
100
- }
101
21
  /**
102
22
  * Decorator used to redirect a function to a native implementation if available.
103
23
  * @internal
@@ -0,0 +1,7 @@
1
+ /** @internal */
2
+ export declare function GetDirectStore(target: any): any;
3
+ /**
4
+ * @returns the list of properties flagged as serializable
5
+ * @param target host object
6
+ */
7
+ export declare function GetMergedStore(target: any): any;
@@ -0,0 +1,52 @@
1
+ // eslint-disable-next-line @typescript-eslint/naming-convention
2
+ const __mergedStore = {};
3
+ // eslint-disable-next-line @typescript-eslint/naming-convention
4
+ const __decoratorInitialStore = {};
5
+ /** @internal */
6
+ export function GetDirectStore(target) {
7
+ const classKey = target.getClassName();
8
+ if (!__decoratorInitialStore[classKey]) {
9
+ __decoratorInitialStore[classKey] = {};
10
+ }
11
+ return __decoratorInitialStore[classKey];
12
+ }
13
+ /**
14
+ * @returns the list of properties flagged as serializable
15
+ * @param target host object
16
+ */
17
+ export function GetMergedStore(target) {
18
+ const classKey = target.getClassName();
19
+ if (__mergedStore[classKey]) {
20
+ return __mergedStore[classKey];
21
+ }
22
+ __mergedStore[classKey] = {};
23
+ const store = __mergedStore[classKey];
24
+ let currentTarget = target;
25
+ let currentKey = classKey;
26
+ while (currentKey) {
27
+ const initialStore = __decoratorInitialStore[currentKey];
28
+ for (const property in initialStore) {
29
+ store[property] = initialStore[property];
30
+ }
31
+ let parent;
32
+ let done = false;
33
+ do {
34
+ parent = Object.getPrototypeOf(currentTarget);
35
+ if (!parent.getClassName) {
36
+ done = true;
37
+ break;
38
+ }
39
+ if (parent.getClassName() !== currentKey) {
40
+ break;
41
+ }
42
+ currentTarget = parent;
43
+ } while (parent);
44
+ if (done) {
45
+ break;
46
+ }
47
+ currentKey = parent.getClassName();
48
+ currentTarget = parent;
49
+ }
50
+ return store;
51
+ }
52
+ //# sourceMappingURL=decorators.functions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"decorators.functions.js","sourceRoot":"","sources":["../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AI,MAAM,CAAC,YAAY,EAAE,KAAK,UAAU,EAAE;gBACtC,MAAM;aACT;YAED,aAAa,GAAG,MAAM,CAAC;SAC1B,QAAQ,MAAM,EAAE;QAEjB,IAAI,IAAI,EAAE;YACN,MAAM;SACT;QAED,UAAU,GAAG,MAAM,CAAC,YAAY,EAAE,CAAC;QACnC,aAAa,GAAG,MAAM,CAAC;KAC1B;IAED,OAAO,KAAK,CAAC;AACjB,CAAC","sourcesContent":["// eslint-disable-next-line @typescript-eslint/naming-convention\r\nconst __mergedStore = {};\r\n\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nconst __decoratorInitialStore = {};\r\n\r\n/** @internal */\r\nexport function GetDirectStore(target: any): any {\r\n const classKey = target.getClassName();\r\n\r\n if (!(<any>__decoratorInitialStore)[classKey]) {\r\n (<any>__decoratorInitialStore)[classKey] = {};\r\n }\r\n\r\n return (<any>__decoratorInitialStore)[classKey];\r\n}\r\n\r\n/**\r\n * @returns the list of properties flagged as serializable\r\n * @param target host object\r\n */\r\nexport function GetMergedStore(target: any): any {\r\n const classKey = target.getClassName();\r\n\r\n if ((<any>__mergedStore)[classKey]) {\r\n return (<any>__mergedStore)[classKey];\r\n }\r\n\r\n (<any>__mergedStore)[classKey] = {};\r\n\r\n const store = (<any>__mergedStore)[classKey];\r\n let currentTarget = target;\r\n let currentKey = classKey;\r\n while (currentKey) {\r\n const initialStore = (<any>__decoratorInitialStore)[currentKey];\r\n for (const property in initialStore) {\r\n store[property] = initialStore[property];\r\n }\r\n\r\n let parent: any;\r\n let done = false;\r\n\r\n do {\r\n parent = Object.getPrototypeOf(currentTarget);\r\n if (!parent.getClassName) {\r\n done = true;\r\n break;\r\n }\r\n\r\n if (parent.getClassName() !== currentKey) {\r\n break;\r\n }\r\n\r\n currentTarget = parent;\r\n } while (parent);\r\n\r\n if (done) {\r\n break;\r\n }\r\n\r\n currentKey = parent.getClassName();\r\n currentTarget = parent;\r\n }\r\n\r\n return store;\r\n}\r\n"]}
@@ -1,104 +1,7 @@
1
- /* eslint-disable @typescript-eslint/no-unused-vars */
2
- /* eslint-disable @typescript-eslint/naming-convention */
3
- import { Tags } from "../Misc/tags.js";
4
- import { Quaternion, Vector2, Vector3, Matrix } from "../Maths/math.vector.js";
5
- import { _WarnImport } from "./devTools.js";
6
- import { Color4, Color3 } from "../Maths/math.color.js";
7
- const __decoratorInitialStore = {};
8
- const __mergedStore = {};
9
- const _copySource = function (creationFunction, source, instanciate, options = {}) {
10
- const destination = creationFunction();
11
- // Tags
12
- if (Tags && Tags.HasTags(source)) {
13
- Tags.AddTagsTo(destination, Tags.GetTags(source, true));
14
- }
15
- const classStore = getMergedStore(destination);
16
- // Map from source texture uniqueId to destination texture
17
- const textureMap = {};
18
- // Properties
19
- for (const property in classStore) {
20
- const propertyDescriptor = classStore[property];
21
- const sourceProperty = source[property];
22
- const propertyType = propertyDescriptor.type;
23
- if (sourceProperty !== undefined && sourceProperty !== null && (property !== "uniqueId" || SerializationHelper.AllowLoadingUniqueId)) {
24
- switch (propertyType) {
25
- case 0: // Value
26
- case 6: // Mesh reference
27
- case 11: // Camera reference
28
- destination[property] = sourceProperty;
29
- break;
30
- case 1: // Texture
31
- if (options.cloneTexturesOnlyOnce && textureMap[sourceProperty.uniqueId]) {
32
- destination[property] = textureMap[sourceProperty.uniqueId];
33
- }
34
- else {
35
- destination[property] = instanciate || sourceProperty.isRenderTarget ? sourceProperty : sourceProperty.clone();
36
- textureMap[sourceProperty.uniqueId] = destination[property];
37
- }
38
- break;
39
- case 2: // Color3
40
- case 3: // FresnelParameters
41
- case 4: // Vector2
42
- case 5: // Vector3
43
- case 7: // Color Curves
44
- case 10: // Quaternion
45
- case 12: // Matrix
46
- destination[property] = instanciate ? sourceProperty : sourceProperty.clone();
47
- break;
48
- }
49
- }
50
- }
51
- return destination;
52
- };
53
- function getDirectStore(target) {
54
- const classKey = target.getClassName();
55
- if (!__decoratorInitialStore[classKey]) {
56
- __decoratorInitialStore[classKey] = {};
57
- }
58
- return __decoratorInitialStore[classKey];
59
- }
60
- /**
61
- * @returns the list of properties flagged as serializable
62
- * @param target host object
63
- */
64
- function getMergedStore(target) {
65
- const classKey = target.getClassName();
66
- if (__mergedStore[classKey]) {
67
- return __mergedStore[classKey];
68
- }
69
- __mergedStore[classKey] = {};
70
- const store = __mergedStore[classKey];
71
- let currentTarget = target;
72
- let currentKey = classKey;
73
- while (currentKey) {
74
- const initialStore = __decoratorInitialStore[currentKey];
75
- for (const property in initialStore) {
76
- store[property] = initialStore[property];
77
- }
78
- let parent;
79
- let done = false;
80
- do {
81
- parent = Object.getPrototypeOf(currentTarget);
82
- if (!parent.getClassName) {
83
- done = true;
84
- break;
85
- }
86
- if (parent.getClassName() !== currentKey) {
87
- break;
88
- }
89
- currentTarget = parent;
90
- } while (parent);
91
- if (done) {
92
- break;
93
- }
94
- currentKey = parent.getClassName();
95
- currentTarget = parent;
96
- }
97
- return store;
98
- }
1
+ import { GetDirectStore } from "./decorators.functions.js";
99
2
  function generateSerializableMember(type, sourceName) {
100
3
  return (target, propertyKey) => {
101
- const classStore = getDirectStore(target);
4
+ const classStore = GetDirectStore(target);
102
5
  if (!classStore[propertyKey]) {
103
6
  classStore[propertyKey] = { type: type, sourceName: sourceName };
104
7
  }
@@ -177,225 +80,6 @@ export function serializeAsMatrix(sourceName) {
177
80
  export function serializeAsCameraReference(sourceName) {
178
81
  return generateSerializableMember(11, sourceName); // camera reference member
179
82
  }
180
- /**
181
- * Class used to help serialization objects
182
- */
183
- export class SerializationHelper {
184
- /**
185
- * Appends the serialized animations from the source animations
186
- * @param source Source containing the animations
187
- * @param destination Target to store the animations
188
- */
189
- static AppendSerializedAnimations(source, destination) {
190
- if (source.animations) {
191
- destination.animations = [];
192
- for (let animationIndex = 0; animationIndex < source.animations.length; animationIndex++) {
193
- const animation = source.animations[animationIndex];
194
- destination.animations.push(animation.serialize());
195
- }
196
- }
197
- }
198
- /**
199
- * Static function used to serialized a specific entity
200
- * @param entity defines the entity to serialize
201
- * @param serializationObject defines the optional target object where serialization data will be stored
202
- * @returns a JSON compatible object representing the serialization of the entity
203
- */
204
- static Serialize(entity, serializationObject) {
205
- if (!serializationObject) {
206
- serializationObject = {};
207
- }
208
- // Tags
209
- if (Tags) {
210
- serializationObject.tags = Tags.GetTags(entity);
211
- }
212
- const serializedProperties = getMergedStore(entity);
213
- // Properties
214
- for (const property in serializedProperties) {
215
- const propertyDescriptor = serializedProperties[property];
216
- const targetPropertyName = propertyDescriptor.sourceName || property;
217
- const propertyType = propertyDescriptor.type;
218
- const sourceProperty = entity[property];
219
- if (sourceProperty !== undefined && sourceProperty !== null && (property !== "uniqueId" || SerializationHelper.AllowLoadingUniqueId)) {
220
- switch (propertyType) {
221
- case 0: // Value
222
- serializationObject[targetPropertyName] = sourceProperty;
223
- break;
224
- case 1: // Texture
225
- serializationObject[targetPropertyName] = sourceProperty.serialize();
226
- break;
227
- case 2: // Color3
228
- serializationObject[targetPropertyName] = sourceProperty.asArray();
229
- break;
230
- case 3: // FresnelParameters
231
- serializationObject[targetPropertyName] = sourceProperty.serialize();
232
- break;
233
- case 4: // Vector2
234
- serializationObject[targetPropertyName] = sourceProperty.asArray();
235
- break;
236
- case 5: // Vector3
237
- serializationObject[targetPropertyName] = sourceProperty.asArray();
238
- break;
239
- case 6: // Mesh reference
240
- serializationObject[targetPropertyName] = sourceProperty.id;
241
- break;
242
- case 7: // Color Curves
243
- serializationObject[targetPropertyName] = sourceProperty.serialize();
244
- break;
245
- case 8: // Color 4
246
- serializationObject[targetPropertyName] = sourceProperty.asArray();
247
- break;
248
- case 9: // Image Processing
249
- serializationObject[targetPropertyName] = sourceProperty.serialize();
250
- break;
251
- case 10: // Quaternion
252
- serializationObject[targetPropertyName] = sourceProperty.asArray();
253
- break;
254
- case 11: // Camera reference
255
- serializationObject[targetPropertyName] = sourceProperty.id;
256
- break;
257
- case 12: // Matrix
258
- serializationObject[targetPropertyName] = sourceProperty.asArray();
259
- break;
260
- }
261
- }
262
- }
263
- return serializationObject;
264
- }
265
- /**
266
- * 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
267
- * @param source the source json data
268
- * @param destination the destination object
269
- * @param scene the scene where the object is
270
- * @param rootUrl root url to use to load assets
271
- */
272
- static ParseProperties(source, destination, scene, rootUrl) {
273
- if (!rootUrl) {
274
- rootUrl = "";
275
- }
276
- const classStore = getMergedStore(destination);
277
- // Properties
278
- for (const property in classStore) {
279
- const propertyDescriptor = classStore[property];
280
- const sourceProperty = source[propertyDescriptor.sourceName || property];
281
- const propertyType = propertyDescriptor.type;
282
- if (sourceProperty !== undefined && sourceProperty !== null && (property !== "uniqueId" || SerializationHelper.AllowLoadingUniqueId)) {
283
- const dest = destination;
284
- switch (propertyType) {
285
- case 0: // Value
286
- dest[property] = sourceProperty;
287
- break;
288
- case 1: // Texture
289
- if (scene) {
290
- dest[property] = SerializationHelper._TextureParser(sourceProperty, scene, rootUrl);
291
- }
292
- break;
293
- case 2: // Color3
294
- dest[property] = Color3.FromArray(sourceProperty);
295
- break;
296
- case 3: // FresnelParameters
297
- dest[property] = SerializationHelper._FresnelParametersParser(sourceProperty);
298
- break;
299
- case 4: // Vector2
300
- dest[property] = Vector2.FromArray(sourceProperty);
301
- break;
302
- case 5: // Vector3
303
- dest[property] = Vector3.FromArray(sourceProperty);
304
- break;
305
- case 6: // Mesh reference
306
- if (scene) {
307
- dest[property] = scene.getLastMeshById(sourceProperty);
308
- }
309
- break;
310
- case 7: // Color Curves
311
- dest[property] = SerializationHelper._ColorCurvesParser(sourceProperty);
312
- break;
313
- case 8: // Color 4
314
- dest[property] = Color4.FromArray(sourceProperty);
315
- break;
316
- case 9: // Image Processing
317
- dest[property] = SerializationHelper._ImageProcessingConfigurationParser(sourceProperty);
318
- break;
319
- case 10: // Quaternion
320
- dest[property] = Quaternion.FromArray(sourceProperty);
321
- break;
322
- case 11: // Camera reference
323
- if (scene) {
324
- dest[property] = scene.getCameraById(sourceProperty);
325
- }
326
- break;
327
- case 12: // Matrix
328
- dest[property] = Matrix.FromArray(sourceProperty);
329
- break;
330
- }
331
- }
332
- }
333
- }
334
- /**
335
- * Creates a new entity from a serialization data object
336
- * @param creationFunction defines a function used to instanciated the new entity
337
- * @param source defines the source serialization data
338
- * @param scene defines the hosting scene
339
- * @param rootUrl defines the root url for resources
340
- * @returns a new entity
341
- */
342
- static Parse(creationFunction, source, scene, rootUrl = null) {
343
- const destination = creationFunction();
344
- // Tags
345
- if (Tags) {
346
- Tags.AddTagsTo(destination, source.tags);
347
- }
348
- SerializationHelper.ParseProperties(source, destination, scene, rootUrl);
349
- return destination;
350
- }
351
- /**
352
- * Clones an object
353
- * @param creationFunction defines the function used to instanciate the new object
354
- * @param source defines the source object
355
- * @param options defines the options to use
356
- * @returns the cloned object
357
- */
358
- static Clone(creationFunction, source, options = {}) {
359
- return _copySource(creationFunction, source, false, options);
360
- }
361
- /**
362
- * Instanciates a new object based on a source one (some data will be shared between both object)
363
- * @param creationFunction defines the function used to instanciate the new object
364
- * @param source defines the source object
365
- * @returns the new object
366
- */
367
- static Instanciate(creationFunction, source) {
368
- return _copySource(creationFunction, source, true);
369
- }
370
- }
371
- /**
372
- * Gets or sets a boolean to indicate if the UniqueId property should be serialized
373
- */
374
- SerializationHelper.AllowLoadingUniqueId = false;
375
- /**
376
- * @internal
377
- */
378
- SerializationHelper._ImageProcessingConfigurationParser = (sourceProperty) => {
379
- throw _WarnImport("ImageProcessingConfiguration");
380
- };
381
- /**
382
- * @internal
383
- */
384
- SerializationHelper._FresnelParametersParser = (sourceProperty) => {
385
- throw _WarnImport("FresnelParameters");
386
- };
387
- /**
388
- * @internal
389
- */
390
- SerializationHelper._ColorCurvesParser = (sourceProperty) => {
391
- throw _WarnImport("ColorCurves");
392
- };
393
- /**
394
- * @internal
395
- */
396
- SerializationHelper._TextureParser = (sourceProperty, scene, rootUrl) => {
397
- throw _WarnImport("Texture");
398
- };
399
83
  /**
400
84
  * Decorator used to redirect a function to a native implementation if available.
401
85
  * @internal
@@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AAM,CAAC,CAAC,CAAC;aAC3G;iBAAM;gBACH,mEAAmE;gBACnE,IAAI,GAAG,UAAU,CAAC;aACrB;SACJ;QAED,0EAA0E;QAC1E,MAAM,CAAC,WAAW,CAAC,GAAG,IAAI,CAAC;QAE3B,wJAAwJ;QACxJ,0IAA0I;QAC1I,OAAO,IAAI,CAAC,GAAG,MAAM,CAAC,CAAC;IAC3B,CAAC,CAAC;AACN,CAAC;AAED;;;;;;GAMG;AACH,cAAc,CAAC,MAAM,GAAG,UAAiD,SAAY;IACjF,OAAO,CAAC,MAAW,EAAE,WAAmB,EAAE,UAA0E,EAAE,EAAE,CACpH,cAAc,CAAC,MAAM,EAAE,WAAW,EAAE,UAAU,EAAE,SAAS,CAAC,CAAC;AACnE,CAAC,CAAC","sourcesContent":["/* eslint-disable @typescript-eslint/no-unused-vars */\r\n/* eslint-disable @typescript-eslint/naming-convention */\r\nimport { Tags } from \"../Misc/tags\";\r\nimport type { Nullable } from \"../types\";\r\nimport { Quaternion, Vector2, Vector3, Matrix } from \"../Maths/math.vector\";\r\nimport { _WarnImport } from \"./devTools\";\r\nimport type { IAnimatable } from \"../Animations/animatable.interface\";\r\nimport { Color4, Color3 } from \"../Maths/math.color\";\r\n\r\nimport type { Scene } from \"../scene\";\r\nimport type { Camera } from \"../Cameras/camera\";\r\n\r\nimport type { ImageProcessingConfiguration } from \"../Materials/imageProcessingConfiguration\";\r\nimport type { FresnelParameters } from \"../Materials/fresnelParameters\";\r\nimport type { ColorCurves } from \"../Materials/colorCurves\";\r\nimport type { BaseTexture } from \"../Materials/Textures/baseTexture\";\r\n\r\nconst __decoratorInitialStore = {};\r\nconst __mergedStore = {};\r\n\r\n/** @internal */\r\nexport interface CopySourceOptions {\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: CopySourceOptions = {}): 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 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 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\nfunction getDirectStore(target: any): any {\r\n const classKey = target.getClassName();\r\n\r\n if (!(<any>__decoratorInitialStore)[classKey]) {\r\n (<any>__decoratorInitialStore)[classKey] = {};\r\n }\r\n\r\n return (<any>__decoratorInitialStore)[classKey];\r\n}\r\n\r\n/**\r\n * @returns the list of properties flagged as serializable\r\n * @param target host object\r\n */\r\nfunction getMergedStore(target: any): any {\r\n const classKey = target.getClassName();\r\n\r\n if ((<any>__mergedStore)[classKey]) {\r\n return (<any>__mergedStore)[classKey];\r\n }\r\n\r\n (<any>__mergedStore)[classKey] = {};\r\n\r\n const store = (<any>__mergedStore)[classKey];\r\n let currentTarget = target;\r\n let currentKey = classKey;\r\n while (currentKey) {\r\n const initialStore = (<any>__decoratorInitialStore)[currentKey];\r\n for (const property in initialStore) {\r\n store[property] = initialStore[property];\r\n }\r\n\r\n let parent: any;\r\n let done = false;\r\n\r\n do {\r\n parent = Object.getPrototypeOf(currentTarget);\r\n if (!parent.getClassName) {\r\n done = true;\r\n break;\r\n }\r\n\r\n if (parent.getClassName() !== currentKey) {\r\n break;\r\n }\r\n\r\n currentTarget = parent;\r\n } while (parent);\r\n\r\n if (done) {\r\n break;\r\n }\r\n\r\n currentKey = parent.getClassName();\r\n currentTarget = parent;\r\n }\r\n\r\n return store;\r\n}\r\n\r\nfunction generateSerializableMember(type: number, sourceName?: string) {\r\n return (target: any, propertyKey: string | symbol) => {\r\n const classStore = getDirectStore(target);\r\n\r\n if (!classStore[propertyKey]) {\r\n classStore[propertyKey] = { type: type, sourceName: sourceName };\r\n }\r\n };\r\n}\r\n\r\nfunction generateExpandMember(setCallback: string, targetKey: Nullable<string> = null) {\r\n return (target: any, propertyKey: string) => {\r\n const key = targetKey || \"_\" + propertyKey;\r\n Object.defineProperty(target, propertyKey, {\r\n get: function (this: any) {\r\n return this[key];\r\n },\r\n set: function (this: any, value) {\r\n // does this object (i.e. vector3) has an equals function? use it!\r\n // Note - not using \"with epsilon\" here, it is expected te behave like the internal cache does.\r\n if (typeof this.equals === \"function\") {\r\n if (this.equals(value)) {\r\n return;\r\n }\r\n }\r\n if (this[key] === value) {\r\n return;\r\n }\r\n this[key] = value;\r\n\r\n target[setCallback].apply(this);\r\n },\r\n enumerable: true,\r\n configurable: true,\r\n });\r\n };\r\n}\r\n\r\nexport function expandToProperty(callback: string, targetKey: Nullable<string> = null) {\r\n return generateExpandMember(callback, targetKey);\r\n}\r\n\r\nexport function serialize(sourceName?: string) {\r\n return generateSerializableMember(0, sourceName); // value member\r\n}\r\n\r\nexport function serializeAsTexture(sourceName?: string) {\r\n return generateSerializableMember(1, sourceName); // texture member\r\n}\r\n\r\nexport function serializeAsColor3(sourceName?: string) {\r\n return generateSerializableMember(2, sourceName); // color3 member\r\n}\r\n\r\nexport function serializeAsFresnelParameters(sourceName?: string) {\r\n return generateSerializableMember(3, sourceName); // fresnel parameters member\r\n}\r\n\r\nexport function serializeAsVector2(sourceName?: string) {\r\n return generateSerializableMember(4, sourceName); // vector2 member\r\n}\r\n\r\nexport function serializeAsVector3(sourceName?: string) {\r\n return generateSerializableMember(5, sourceName); // vector3 member\r\n}\r\n\r\nexport function serializeAsMeshReference(sourceName?: string) {\r\n return generateSerializableMember(6, sourceName); // mesh reference member\r\n}\r\n\r\nexport function serializeAsColorCurves(sourceName?: string) {\r\n return generateSerializableMember(7, sourceName); // color curves\r\n}\r\n\r\nexport function serializeAsColor4(sourceName?: string) {\r\n return generateSerializableMember(8, sourceName); // color 4\r\n}\r\n\r\nexport function serializeAsImageProcessingConfiguration(sourceName?: string) {\r\n return generateSerializableMember(9, sourceName); // image processing\r\n}\r\n\r\nexport function serializeAsQuaternion(sourceName?: string) {\r\n return generateSerializableMember(10, sourceName); // quaternion member\r\n}\r\n\r\nexport function serializeAsMatrix(sourceName?: string) {\r\n return generateSerializableMember(12, sourceName); // matrix member\r\n}\r\n\r\n/**\r\n * Decorator used to define property that can be serialized as reference to a camera\r\n * @param sourceName defines the name of the property to decorate\r\n * @returns Property Decorator\r\n */\r\nexport function serializeAsCameraReference(sourceName?: string) {\r\n return generateSerializableMember(11, sourceName); // camera reference member\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\r\n destination.animations.push(animation.serialize());\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 serializationObject[targetPropertyName] = sourceProperty;\r\n break;\r\n case 1: // Texture\r\n serializationObject[targetPropertyName] = 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 = <any>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: CopySourceOptions = {}): 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\r\n/** @internal */\r\ndeclare const _native: any;\r\n\r\n/**\r\n * Decorator used to redirect a function to a native implementation if available.\r\n * @internal\r\n */\r\nexport function nativeOverride<T extends (...params: any[]) => boolean>(\r\n target: any,\r\n propertyKey: string,\r\n descriptor: TypedPropertyDescriptor<(...params: Parameters<T>) => unknown>,\r\n predicate?: T\r\n) {\r\n // Cache the original JS function for later.\r\n const jsFunc = descriptor.value!;\r\n\r\n // Override the JS function to check for a native override on first invocation. Setting descriptor.value overrides the function at the early stage of code being loaded/imported.\r\n descriptor.value = (...params: Parameters<T>): unknown => {\r\n // Assume the resolved function will be the original JS function, then we will check for the Babylon Native context.\r\n let func = jsFunc;\r\n\r\n // Check if we are executing in a Babylon Native context (e.g. check the presence of the _native global property) and if so also check if a function override is available.\r\n if (typeof _native !== \"undefined\" && _native[propertyKey]) {\r\n const nativeFunc = _native[propertyKey] as (...params: Parameters<T>) => unknown;\r\n // If a predicate was provided, then we'll need to invoke the predicate on each invocation of the underlying function to determine whether to call the native function or the JS function.\r\n if (predicate) {\r\n // The resolved function will execute the predicate and then either execute the native function or the JS function.\r\n func = (...params: Parameters<T>) => (predicate(...params) ? nativeFunc(...params) : jsFunc(...params));\r\n } else {\r\n // The resolved function will directly execute the native function.\r\n func = nativeFunc;\r\n }\r\n }\r\n\r\n // Override the JS function again with the final resolved target function.\r\n target[propertyKey] = func;\r\n\r\n // The JS function has now been overridden based on whether we're executing in the context of Babylon Native, but we still need to invoke that function.\r\n // Future invocations of the function will just directly invoke the final overridden function, not any of the decorator setup logic above.\r\n return func(...params);\r\n };\r\n}\r\n\r\n/**\r\n * Decorator factory that applies the nativeOverride decorator, but determines whether to redirect to the native implementation based on a filter function that evaluates the function arguments.\r\n * @param predicate\r\n * @example @nativeOverride.filter((...[arg1]: Parameters<typeof someClass.someMethod>) => arg1.length > 20)\r\n * public someMethod(arg1: string, arg2: number): string {\r\n * @internal\r\n */\r\nnativeOverride.filter = function <T extends (...params: any) => boolean>(predicate: T) {\r\n return (target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<(...params: Parameters<T>) => unknown>) =>\r\n nativeOverride(target, propertyKey, descriptor, predicate);\r\n};\r\n"]}
1
+ {"version":3,"file":"decorators.js","sourceRoot":"","sources":["../../../../dev/core/src/Misc/decorators.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAGxD,SAAS,0BAA0B,CAAC,IAAY,EAAE,UAAmB;IACjE,OAAO,CAAC,MAAW,EAAE,WAA4B,EAAE,EAAE;QACjD,MAAM,UAAU,GAAG,cAAc,CAAC,MAAM,CAAC,CAAC;QAE1C,IAAI,CAAC,UAAU,CAAC,WAAW,CAAC,EAAE;YAC1B,UAAU,CAAC,WAAW,CAAC,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,UAAU,EAAE,UAAU,EAAE,CAAC;SACpE;IACL,CAAC,CAAC;AACN,CAAC;AAED,SAAS,oBAAoB,CAAC,WAAmB,EAAE,YAA8B,IAAI;IACjF,OAAO,CAAC,MAAW,EAAE,WAAmB,EAAE,EAAE;QACxC,MAAM,GAAG,GAAG,SAAS,IAAI,GAAG,GAAG,WAAW,CAAC;QAC3C,MAAM,CAAC,cAAc,CAAC,MAAM,EAAE,WAAW,EAAE;YACvC,GAAG,EAAE;gBACD,OAAO,IAA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qB,EAAW,EAAE;QACrD,oHAAoH;QACpH,IAAI,IAAI,GAAG,MAAM,CAAC;QAElB,2KAA2K;QAC3K,IAAI,OAAO,OAAO,KAAK,WAAW,IAAI,OAAO,CAAC,WAAW,CAAC,EAAE;YACxD,MAAM,UAAU,GAAG,OAAO,CAAC,WAAW,CAA0C,CAAC;YACjF,0LAA0L;YAC1L,IAAI,SAAS,EAAE;gBACX,mHAAmH;gBACnH,IAAI,GAAG,CAAC,GAAG,MAAqB,EAAE,EAAE,CAAC,CAAC,SAAS,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC;aAC3G;iBAAM;gBACH,mEAAmE;gBACnE,IAAI,GAAG,UAAU,CAAC;aACrB;SACJ;QAED,0EAA0E;QAC1E,MAAM,CAAC,WAAW,CAAC,GAAG,IAAI,CAAC;QAE3B,wJAAwJ;QACxJ,0IAA0I;QAC1I,OAAO,IAAI,CAAC,GAAG,MAAM,CAAC,CAAC;IAC3B,CAAC,CAAC;AACN,CAAC;AAED;;;;;;GAMG;AACH,cAAc,CAAC,MAAM,GAAG,UAAiD,SAAY;IACjF,OAAO,CAAC,MAAW,EAAE,WAAmB,EAAE,UAA0E,EAAE,EAAE,CACpH,cAAc,CAAC,MAAM,EAAE,WAAW,EAAE,UAAU,EAAE,SAAS,CAAC,CAAC;AACnE,CAAC,CAAC","sourcesContent":["/* eslint-disable @typescript-eslint/no-unused-vars */\r\n/* eslint-disable @typescript-eslint/naming-convention */\r\nimport type { Nullable } from \"../types\";\r\nimport { GetDirectStore } from \"./decorators.functions\";\r\nimport { _WarnImport } from \"./devTools\";\r\n\r\nfunction generateSerializableMember(type: number, sourceName?: string) {\r\n return (target: any, propertyKey: string | symbol) => {\r\n const classStore = GetDirectStore(target);\r\n\r\n if (!classStore[propertyKey]) {\r\n classStore[propertyKey] = { type: type, sourceName: sourceName };\r\n }\r\n };\r\n}\r\n\r\nfunction generateExpandMember(setCallback: string, targetKey: Nullable<string> = null) {\r\n return (target: any, propertyKey: string) => {\r\n const key = targetKey || \"_\" + propertyKey;\r\n Object.defineProperty(target, propertyKey, {\r\n get: function (this: any) {\r\n return this[key];\r\n },\r\n set: function (this: any, value) {\r\n // does this object (i.e. vector3) has an equals function? use it!\r\n // Note - not using \"with epsilon\" here, it is expected te behave like the internal cache does.\r\n if (typeof this.equals === \"function\") {\r\n if (this.equals(value)) {\r\n return;\r\n }\r\n }\r\n if (this[key] === value) {\r\n return;\r\n }\r\n this[key] = value;\r\n\r\n target[setCallback].apply(this);\r\n },\r\n enumerable: true,\r\n configurable: true,\r\n });\r\n };\r\n}\r\n\r\nexport function expandToProperty(callback: string, targetKey: Nullable<string> = null) {\r\n return generateExpandMember(callback, targetKey);\r\n}\r\n\r\nexport function serialize(sourceName?: string) {\r\n return generateSerializableMember(0, sourceName); // value member\r\n}\r\n\r\nexport function serializeAsTexture(sourceName?: string) {\r\n return generateSerializableMember(1, sourceName); // texture member\r\n}\r\n\r\nexport function serializeAsColor3(sourceName?: string) {\r\n return generateSerializableMember(2, sourceName); // color3 member\r\n}\r\n\r\nexport function serializeAsFresnelParameters(sourceName?: string) {\r\n return generateSerializableMember(3, sourceName); // fresnel parameters member\r\n}\r\n\r\nexport function serializeAsVector2(sourceName?: string) {\r\n return generateSerializableMember(4, sourceName); // vector2 member\r\n}\r\n\r\nexport function serializeAsVector3(sourceName?: string) {\r\n return generateSerializableMember(5, sourceName); // vector3 member\r\n}\r\n\r\nexport function serializeAsMeshReference(sourceName?: string) {\r\n return generateSerializableMember(6, sourceName); // mesh reference member\r\n}\r\n\r\nexport function serializeAsColorCurves(sourceName?: string) {\r\n return generateSerializableMember(7, sourceName); // color curves\r\n}\r\n\r\nexport function serializeAsColor4(sourceName?: string) {\r\n return generateSerializableMember(8, sourceName); // color 4\r\n}\r\n\r\nexport function serializeAsImageProcessingConfiguration(sourceName?: string) {\r\n return generateSerializableMember(9, sourceName); // image processing\r\n}\r\n\r\nexport function serializeAsQuaternion(sourceName?: string) {\r\n return generateSerializableMember(10, sourceName); // quaternion member\r\n}\r\n\r\nexport function serializeAsMatrix(sourceName?: string) {\r\n return generateSerializableMember(12, sourceName); // matrix member\r\n}\r\n\r\n/**\r\n * Decorator used to define property that can be serialized as reference to a camera\r\n * @param sourceName defines the name of the property to decorate\r\n * @returns Property Decorator\r\n */\r\nexport function serializeAsCameraReference(sourceName?: string) {\r\n return generateSerializableMember(11, sourceName); // camera reference member\r\n}\r\n\r\n/** @internal */\r\ndeclare const _native: any;\r\n\r\n/**\r\n * Decorator used to redirect a function to a native implementation if available.\r\n * @internal\r\n */\r\nexport function nativeOverride<T extends (...params: any[]) => boolean>(\r\n target: any,\r\n propertyKey: string,\r\n descriptor: TypedPropertyDescriptor<(...params: Parameters<T>) => unknown>,\r\n predicate?: T\r\n) {\r\n // Cache the original JS function for later.\r\n const jsFunc = descriptor.value!;\r\n\r\n // Override the JS function to check for a native override on first invocation. Setting descriptor.value overrides the function at the early stage of code being loaded/imported.\r\n descriptor.value = (...params: Parameters<T>): unknown => {\r\n // Assume the resolved function will be the original JS function, then we will check for the Babylon Native context.\r\n let func = jsFunc;\r\n\r\n // Check if we are executing in a Babylon Native context (e.g. check the presence of the _native global property) and if so also check if a function override is available.\r\n if (typeof _native !== \"undefined\" && _native[propertyKey]) {\r\n const nativeFunc = _native[propertyKey] as (...params: Parameters<T>) => unknown;\r\n // If a predicate was provided, then we'll need to invoke the predicate on each invocation of the underlying function to determine whether to call the native function or the JS function.\r\n if (predicate) {\r\n // The resolved function will execute the predicate and then either execute the native function or the JS function.\r\n func = (...params: Parameters<T>) => (predicate(...params) ? nativeFunc(...params) : jsFunc(...params));\r\n } else {\r\n // The resolved function will directly execute the native function.\r\n func = nativeFunc;\r\n }\r\n }\r\n\r\n // Override the JS function again with the final resolved target function.\r\n target[propertyKey] = func;\r\n\r\n // The JS function has now been overridden based on whether we're executing in the context of Babylon Native, but we still need to invoke that function.\r\n // Future invocations of the function will just directly invoke the final overridden function, not any of the decorator setup logic above.\r\n return func(...params);\r\n };\r\n}\r\n\r\n/**\r\n * Decorator factory that applies the nativeOverride decorator, but determines whether to redirect to the native implementation based on a filter function that evaluates the function arguments.\r\n * @param predicate\r\n * @example @nativeOverride.filter((...[arg1]: Parameters<typeof someClass.someMethod>) => arg1.length > 20)\r\n * public someMethod(arg1: string, arg2: number): string {\r\n * @internal\r\n */\r\nnativeOverride.filter = function <T extends (...params: any) => boolean>(predicate: T) {\r\n return (target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<(...params: Parameters<T>) => unknown>) =>\r\n nativeOverride(target, propertyKey, descriptor, predicate);\r\n};\r\n"]}