@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.
- package/Animations/animation.js +1 -1
- package/Animations/animation.js.map +1 -1
- package/BakedVertexAnimation/bakedVertexAnimationManager.js +2 -1
- package/BakedVertexAnimation/bakedVertexAnimationManager.js.map +1 -1
- package/Bones/skeleton.js +2 -2
- package/Bones/skeleton.js.map +1 -1
- package/Cameras/camera.d.ts +3 -3
- package/Cameras/camera.js +2 -1
- package/Cameras/camera.js.map +1 -1
- package/Cameras/cameraInputsManager.js +1 -1
- package/Cameras/cameraInputsManager.js.map +1 -1
- package/Cameras/targetCamera.js +4 -0
- package/Cameras/targetCamera.js.map +1 -1
- package/Compute/computeShader.d.ts +4 -2
- package/Compute/computeShader.js +7 -3
- package/Compute/computeShader.js.map +1 -1
- package/Debug/directionalLightFrustumViewer.js +6 -6
- package/Debug/directionalLightFrustumViewer.js.map +1 -1
- package/Engines/Extensions/engine.computeShader.d.ts +2 -1
- package/Engines/Extensions/engine.computeShader.js +1 -0
- package/Engines/Extensions/engine.computeShader.js.map +1 -1
- package/Engines/Extensions/engine.rawTexture.js +3 -3
- package/Engines/Extensions/engine.rawTexture.js.map +1 -1
- package/Engines/Native/nativePipelineContext.js +1 -1
- package/Engines/Native/nativePipelineContext.js.map +1 -1
- package/Engines/WebGL/webGLPipelineContext.js +1 -1
- package/Engines/WebGL/webGLPipelineContext.js.map +1 -1
- package/Engines/WebGPU/webgpuComputeContext.js +7 -3
- package/Engines/WebGPU/webgpuComputeContext.js.map +1 -1
- package/Engines/engine.d.ts +1 -1
- package/Engines/thinEngine.js +2 -2
- package/Engines/thinEngine.js.map +1 -1
- package/Engines/webgpuEngine.js +2 -15
- package/Engines/webgpuEngine.js.map +1 -1
- package/Layers/glowLayer.js +2 -1
- package/Layers/glowLayer.js.map +1 -1
- package/Layers/highlightLayer.js +2 -1
- package/Layers/highlightLayer.js.map +1 -1
- package/Lights/light.js +2 -1
- package/Lights/light.js.map +1 -1
- package/Loading/Plugins/babylonFileLoader.js +9 -0
- package/Loading/Plugins/babylonFileLoader.js.map +1 -1
- package/Loading/sceneLoader.d.ts +6 -1
- package/Loading/sceneLoader.js +6 -5
- package/Loading/sceneLoader.js.map +1 -1
- package/Materials/Background/backgroundMaterial.js +2 -1
- package/Materials/Background/backgroundMaterial.js.map +1 -1
- package/Materials/GaussianSplatting/gaussianSplattingMaterial.js +1 -1
- package/Materials/GaussianSplatting/gaussianSplattingMaterial.js.map +1 -1
- package/Materials/Node/nodeMaterial.d.ts +2 -1
- package/Materials/Node/nodeMaterial.js +5 -1
- package/Materials/Node/nodeMaterial.js.map +1 -1
- package/Materials/PBR/pbrBaseMaterial.d.ts +1 -1
- package/Materials/PBR/pbrBaseMaterial.js.map +1 -1
- package/Materials/PBR/pbrMaterial.js +2 -1
- package/Materials/PBR/pbrMaterial.js.map +1 -1
- package/Materials/PBR/pbrMetallicRoughnessMaterial.js +2 -1
- package/Materials/PBR/pbrMetallicRoughnessMaterial.js.map +1 -1
- package/Materials/PBR/pbrSpecularGlossinessMaterial.js +2 -1
- package/Materials/PBR/pbrSpecularGlossinessMaterial.js.map +1 -1
- package/Materials/Textures/baseTexture.js +2 -1
- package/Materials/Textures/baseTexture.js.map +1 -1
- package/Materials/Textures/cubeTexture.js +2 -1
- package/Materials/Textures/cubeTexture.js.map +1 -1
- package/Materials/Textures/rawCubeTexture.js +1 -1
- package/Materials/Textures/rawCubeTexture.js.map +1 -1
- package/Materials/Textures/texture.js +2 -1
- package/Materials/Textures/texture.js.map +1 -1
- package/Materials/colorCurves.d.ts +1 -1
- package/Materials/colorCurves.functions.d.ts +5 -0
- package/Materials/colorCurves.functions.js +8 -0
- package/Materials/colorCurves.functions.js.map +1 -0
- package/Materials/colorCurves.js +8 -8
- package/Materials/colorCurves.js.map +1 -1
- package/Materials/fresnelParameters.js +1 -1
- package/Materials/fresnelParameters.js.map +1 -1
- package/Materials/imageProcessingConfiguration.d.ts +3 -48
- package/Materials/imageProcessingConfiguration.defines.d.ts +46 -0
- package/Materials/imageProcessingConfiguration.defines.js +27 -0
- package/Materials/imageProcessingConfiguration.defines.js.map +1 -0
- package/Materials/imageProcessingConfiguration.functions.d.ts +13 -0
- package/Materials/imageProcessingConfiguration.functions.js +41 -0
- package/Materials/imageProcessingConfiguration.functions.js.map +1 -0
- package/Materials/imageProcessingConfiguration.js +18 -69
- package/Materials/imageProcessingConfiguration.js.map +1 -1
- package/Materials/material.js +2 -1
- package/Materials/material.js.map +1 -1
- package/Materials/materialHelper.d.ts +33 -33
- package/Materials/materialHelper.js +244 -286
- package/Materials/materialHelper.js.map +1 -1
- package/Materials/materialPluginBase.js +2 -1
- package/Materials/materialPluginBase.js.map +1 -1
- package/Materials/materialStencilState.js +2 -1
- package/Materials/materialStencilState.js.map +1 -1
- package/Materials/shaderMaterial.js +1 -1
- package/Materials/shaderMaterial.js.map +1 -1
- package/Materials/standardMaterial.d.ts +1 -1
- package/Materials/standardMaterial.js +2 -1
- package/Materials/standardMaterial.js.map +1 -1
- package/Materials/uniformBuffer.js +2 -2
- package/Materials/uniformBuffer.js.map +1 -1
- package/Maths/math.color.d.ts +392 -66
- package/Maths/math.color.js +541 -65
- package/Maths/math.color.js.map +1 -1
- package/Maths/math.like.d.ts +17 -28
- package/Maths/math.like.js.map +1 -1
- package/Maths/math.plane.d.ts +2 -1
- package/Maths/math.plane.js.map +1 -1
- package/Maths/math.polar.d.ts +1 -1
- package/Maths/math.polar.js.map +1 -1
- package/Maths/math.scalar.d.ts +6 -6
- package/Maths/math.scalar.functions.d.ts +51 -0
- package/Maths/math.scalar.functions.js +80 -0
- package/Maths/math.scalar.functions.js.map +1 -0
- package/Maths/math.scalar.js +48 -73
- package/Maths/math.scalar.js.map +1 -1
- package/Maths/math.vector.d.ts +571 -72
- package/Maths/math.vector.js +917 -119
- package/Maths/math.vector.js.map +1 -1
- package/Maths/math.viewport.d.ts +2 -1
- package/Maths/math.viewport.js.map +1 -1
- package/Maths/tensor.d.ts +411 -0
- package/Maths/tensor.js +3 -0
- package/Maths/tensor.js.map +1 -0
- package/Meshes/Node/Blocks/Set/setColorsBlock.js +20 -4
- package/Meshes/Node/Blocks/Set/setColorsBlock.js.map +1 -1
- package/Meshes/Node/nodeGeometry.js +2 -1
- package/Meshes/Node/nodeGeometry.js.map +1 -1
- package/Meshes/mesh.js +2 -2
- package/Meshes/mesh.js.map +1 -1
- package/Meshes/mesh.vertexData.d.ts +4 -0
- package/Meshes/mesh.vertexData.js +10 -0
- package/Meshes/mesh.vertexData.js.map +1 -1
- package/Meshes/transformNode.js +2 -1
- package/Meshes/transformNode.js.map +1 -1
- package/Misc/arrayTools.d.ts +2 -19
- package/Misc/arrayTools.js.map +1 -1
- package/Misc/decorators.d.ts +0 -80
- package/Misc/decorators.functions.d.ts +7 -0
- package/Misc/decorators.functions.js +52 -0
- package/Misc/decorators.functions.js.map +1 -0
- package/Misc/decorators.js +2 -318
- package/Misc/decorators.js.map +1 -1
- package/Misc/decorators.serialization.d.ts +81 -0
- package/Misc/decorators.serialization.js +269 -0
- package/Misc/decorators.serialization.js.map +1 -0
- package/Misc/index.d.ts +1 -0
- package/Misc/index.js +1 -0
- package/Misc/index.js.map +1 -1
- package/Misc/sceneRecorder.js +1 -1
- package/Misc/sceneRecorder.js.map +1 -1
- package/Misc/sceneSerializer.js +8 -1
- package/Misc/sceneSerializer.js.map +1 -1
- package/Misc/tools.functions.d.ts +14 -0
- package/Misc/tools.functions.js +23 -0
- package/Misc/tools.functions.js.map +1 -0
- package/Misc/tools.js +5 -6
- package/Misc/tools.js.map +1 -1
- package/Morph/morphTarget.js +2 -1
- package/Morph/morphTarget.js.map +1 -1
- package/Particles/EmitterTypes/boxParticleEmitter.js +8 -8
- package/Particles/EmitterTypes/boxParticleEmitter.js.map +1 -1
- package/Particles/baseParticleSystem.d.ts +8 -11
- package/Particles/baseParticleSystem.js +9 -40
- package/Particles/baseParticleSystem.js.map +1 -1
- package/Particles/gpuParticleSystem.d.ts +71 -1
- package/Particles/gpuParticleSystem.js +102 -1
- package/Particles/gpuParticleSystem.js.map +1 -1
- package/Particles/particle.d.ts +3 -3
- package/Particles/particle.js +3 -3
- package/Particles/particle.js.map +1 -1
- package/Particles/particleSystem.d.ts +81 -455
- package/Particles/particleSystem.functions.d.ts +61 -0
- package/Particles/particleSystem.functions.js +79 -0
- package/Particles/particleSystem.functions.js.map +1 -0
- package/Particles/particleSystem.js +390 -1984
- package/Particles/particleSystem.js.map +1 -1
- package/Particles/thinParticleSystem.d.ts +485 -0
- package/Particles/thinParticleSystem.js +1768 -0
- package/Particles/thinParticleSystem.js.map +1 -0
- package/PostProcesses/RenderPipeline/Pipelines/defaultRenderingPipeline.js +2 -1
- package/PostProcesses/RenderPipeline/Pipelines/defaultRenderingPipeline.js.map +1 -1
- package/PostProcesses/RenderPipeline/Pipelines/ssao2RenderingPipeline.js +2 -1
- package/PostProcesses/RenderPipeline/Pipelines/ssao2RenderingPipeline.js.map +1 -1
- package/PostProcesses/RenderPipeline/Pipelines/ssrRenderingPipeline.js +2 -1
- package/PostProcesses/RenderPipeline/Pipelines/ssrRenderingPipeline.js.map +1 -1
- package/PostProcesses/RenderPipeline/Pipelines/standardRenderingPipeline.js +2 -1
- package/PostProcesses/RenderPipeline/Pipelines/standardRenderingPipeline.js.map +1 -1
- package/PostProcesses/RenderPipeline/Pipelines/taaRenderingPipeline.js +2 -1
- package/PostProcesses/RenderPipeline/Pipelines/taaRenderingPipeline.js.map +1 -1
- package/PostProcesses/blackAndWhitePostProcess.js +2 -1
- package/PostProcesses/blackAndWhitePostProcess.js.map +1 -1
- package/PostProcesses/blurPostProcess.js +2 -1
- package/PostProcesses/blurPostProcess.js.map +1 -1
- package/PostProcesses/chromaticAberrationPostProcess.js +2 -1
- package/PostProcesses/chromaticAberrationPostProcess.js.map +1 -1
- package/PostProcesses/colorCorrectionPostProcess.js +2 -1
- package/PostProcesses/colorCorrectionPostProcess.js.map +1 -1
- package/PostProcesses/convolutionPostProcess.js +2 -1
- package/PostProcesses/convolutionPostProcess.js.map +1 -1
- package/PostProcesses/displayPassPostProcess.js +1 -1
- package/PostProcesses/displayPassPostProcess.js.map +1 -1
- package/PostProcesses/filterPostProcess.js +2 -1
- package/PostProcesses/filterPostProcess.js.map +1 -1
- package/PostProcesses/fxaaPostProcess.js +1 -1
- package/PostProcesses/fxaaPostProcess.js.map +1 -1
- package/PostProcesses/grainPostProcess.js +2 -1
- package/PostProcesses/grainPostProcess.js.map +1 -1
- package/PostProcesses/imageProcessingPostProcess.js.map +1 -1
- package/PostProcesses/motionBlurPostProcess.js +2 -1
- package/PostProcesses/motionBlurPostProcess.js.map +1 -1
- package/PostProcesses/passPostProcess.js +1 -1
- package/PostProcesses/passPostProcess.js.map +1 -1
- package/PostProcesses/postProcess.js +2 -1
- package/PostProcesses/postProcess.js.map +1 -1
- package/PostProcesses/refractionPostProcess.js +2 -1
- package/PostProcesses/refractionPostProcess.js.map +1 -1
- package/PostProcesses/screenSpaceCurvaturePostProcess.js +2 -1
- package/PostProcesses/screenSpaceCurvaturePostProcess.js.map +1 -1
- package/PostProcesses/screenSpaceReflectionPostProcess.js +2 -1
- package/PostProcesses/screenSpaceReflectionPostProcess.js.map +1 -1
- package/PostProcesses/sharpenPostProcess.js +2 -1
- package/PostProcesses/sharpenPostProcess.js.map +1 -1
- package/Probes/reflectionProbe.js +2 -1
- package/Probes/reflectionProbe.js.map +1 -1
- package/Sprites/spriteManager.d.ts +4 -0
- package/Sprites/spriteManager.js.map +1 -1
- package/XR/features/WebXRControllerTeleportation.d.ts +9 -0
- package/XR/features/WebXRControllerTeleportation.js +75 -31
- package/XR/features/WebXRControllerTeleportation.js.map +1 -1
- package/node.js +2 -1
- package/node.js.map +1 -1
- package/package.json +1 -1
- package/types.d.ts +105 -0
- package/types.js.map +1 -1
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import type { FresnelParameters } from "../Materials/fresnelParameters";
|
|
2
|
+
import type { ImageProcessingConfiguration } from "../Materials/imageProcessingConfiguration";
|
|
3
|
+
import type { ColorCurves } from "../Materials/colorCurves";
|
|
4
|
+
import type { Scene } from "../scene";
|
|
5
|
+
import type { Nullable } from "../types";
|
|
6
|
+
import type { BaseTexture } from "../Materials/Textures/baseTexture";
|
|
7
|
+
import type { IAnimatable } from "../Animations/animatable.interface";
|
|
8
|
+
/** @internal */
|
|
9
|
+
export interface CopySourceOptions {
|
|
10
|
+
cloneTexturesOnlyOnce?: boolean;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Class used to help serialization objects
|
|
14
|
+
*/
|
|
15
|
+
export declare class SerializationHelper {
|
|
16
|
+
/**
|
|
17
|
+
* Gets or sets a boolean to indicate if the UniqueId property should be serialized
|
|
18
|
+
*/
|
|
19
|
+
static AllowLoadingUniqueId: boolean;
|
|
20
|
+
/**
|
|
21
|
+
* @internal
|
|
22
|
+
*/
|
|
23
|
+
static _ImageProcessingConfigurationParser: (sourceProperty: any) => ImageProcessingConfiguration;
|
|
24
|
+
/**
|
|
25
|
+
* @internal
|
|
26
|
+
*/
|
|
27
|
+
static _FresnelParametersParser: (sourceProperty: any) => FresnelParameters;
|
|
28
|
+
/**
|
|
29
|
+
* @internal
|
|
30
|
+
*/
|
|
31
|
+
static _ColorCurvesParser: (sourceProperty: any) => ColorCurves;
|
|
32
|
+
/**
|
|
33
|
+
* @internal
|
|
34
|
+
*/
|
|
35
|
+
static _TextureParser: (sourceProperty: any, scene: Scene, rootUrl: string) => Nullable<BaseTexture>;
|
|
36
|
+
/**
|
|
37
|
+
* Appends the serialized animations from the source animations
|
|
38
|
+
* @param source Source containing the animations
|
|
39
|
+
* @param destination Target to store the animations
|
|
40
|
+
*/
|
|
41
|
+
static AppendSerializedAnimations(source: IAnimatable, destination: any): void;
|
|
42
|
+
/**
|
|
43
|
+
* Static function used to serialized a specific entity
|
|
44
|
+
* @param entity defines the entity to serialize
|
|
45
|
+
* @param serializationObject defines the optional target object where serialization data will be stored
|
|
46
|
+
* @returns a JSON compatible object representing the serialization of the entity
|
|
47
|
+
*/
|
|
48
|
+
static Serialize<T>(entity: T, serializationObject?: any): any;
|
|
49
|
+
/**
|
|
50
|
+
* 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
|
|
51
|
+
* @param source the source json data
|
|
52
|
+
* @param destination the destination object
|
|
53
|
+
* @param scene the scene where the object is
|
|
54
|
+
* @param rootUrl root url to use to load assets
|
|
55
|
+
*/
|
|
56
|
+
static ParseProperties(source: any, destination: any, scene: Nullable<Scene>, rootUrl: Nullable<string>): void;
|
|
57
|
+
/**
|
|
58
|
+
* Creates a new entity from a serialization data object
|
|
59
|
+
* @param creationFunction defines a function used to instanciated the new entity
|
|
60
|
+
* @param source defines the source serialization data
|
|
61
|
+
* @param scene defines the hosting scene
|
|
62
|
+
* @param rootUrl defines the root url for resources
|
|
63
|
+
* @returns a new entity
|
|
64
|
+
*/
|
|
65
|
+
static Parse<T>(creationFunction: () => T, source: any, scene: Nullable<Scene>, rootUrl?: Nullable<string>): T;
|
|
66
|
+
/**
|
|
67
|
+
* Clones an object
|
|
68
|
+
* @param creationFunction defines the function used to instanciate the new object
|
|
69
|
+
* @param source defines the source object
|
|
70
|
+
* @param options defines the options to use
|
|
71
|
+
* @returns the cloned object
|
|
72
|
+
*/
|
|
73
|
+
static Clone<T>(creationFunction: () => T, source: T, options?: CopySourceOptions): T;
|
|
74
|
+
/**
|
|
75
|
+
* Instanciates a new object based on a source one (some data will be shared between both object)
|
|
76
|
+
* @param creationFunction defines the function used to instanciate the new object
|
|
77
|
+
* @param source defines the source object
|
|
78
|
+
* @returns the new object
|
|
79
|
+
*/
|
|
80
|
+
static Instanciate<T>(creationFunction: () => T, source: T): T;
|
|
81
|
+
}
|
|
@@ -0,0 +1,269 @@
|
|
|
1
|
+
import { _WarnImport } from "./devTools.js";
|
|
2
|
+
import { Tags } from "./tags.js";
|
|
3
|
+
import { Color3, Color4 } from "../Maths/math.color.js";
|
|
4
|
+
import { Matrix, Quaternion, Vector2, Vector3 } from "../Maths/math.vector.js";
|
|
5
|
+
import { GetMergedStore } from "./decorators.functions.js";
|
|
6
|
+
const _copySource = function (creationFunction, source, instanciate, options = {}) {
|
|
7
|
+
const destination = creationFunction();
|
|
8
|
+
// Tags
|
|
9
|
+
if (Tags && Tags.HasTags(source)) {
|
|
10
|
+
Tags.AddTagsTo(destination, Tags.GetTags(source, true));
|
|
11
|
+
}
|
|
12
|
+
const classStore = GetMergedStore(destination);
|
|
13
|
+
// Map from source texture uniqueId to destination texture
|
|
14
|
+
const textureMap = {};
|
|
15
|
+
// Properties
|
|
16
|
+
for (const property in classStore) {
|
|
17
|
+
const propertyDescriptor = classStore[property];
|
|
18
|
+
const sourceProperty = source[property];
|
|
19
|
+
const propertyType = propertyDescriptor.type;
|
|
20
|
+
if (sourceProperty !== undefined && sourceProperty !== null && (property !== "uniqueId" || SerializationHelper.AllowLoadingUniqueId)) {
|
|
21
|
+
switch (propertyType) {
|
|
22
|
+
case 0: // Value
|
|
23
|
+
case 6: // Mesh reference
|
|
24
|
+
case 11: // Camera reference
|
|
25
|
+
destination[property] = sourceProperty;
|
|
26
|
+
break;
|
|
27
|
+
case 1: // Texture
|
|
28
|
+
if (options.cloneTexturesOnlyOnce && textureMap[sourceProperty.uniqueId]) {
|
|
29
|
+
destination[property] = textureMap[sourceProperty.uniqueId];
|
|
30
|
+
}
|
|
31
|
+
else {
|
|
32
|
+
destination[property] = instanciate || sourceProperty.isRenderTarget ? sourceProperty : sourceProperty.clone();
|
|
33
|
+
textureMap[sourceProperty.uniqueId] = destination[property];
|
|
34
|
+
}
|
|
35
|
+
break;
|
|
36
|
+
case 2: // Color3
|
|
37
|
+
case 3: // FresnelParameters
|
|
38
|
+
case 4: // Vector2
|
|
39
|
+
case 5: // Vector3
|
|
40
|
+
case 7: // Color Curves
|
|
41
|
+
case 10: // Quaternion
|
|
42
|
+
case 12: // Matrix
|
|
43
|
+
destination[property] = instanciate ? sourceProperty : sourceProperty.clone();
|
|
44
|
+
break;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
return destination;
|
|
49
|
+
};
|
|
50
|
+
/**
|
|
51
|
+
* Class used to help serialization objects
|
|
52
|
+
*/
|
|
53
|
+
export class SerializationHelper {
|
|
54
|
+
/**
|
|
55
|
+
* Appends the serialized animations from the source animations
|
|
56
|
+
* @param source Source containing the animations
|
|
57
|
+
* @param destination Target to store the animations
|
|
58
|
+
*/
|
|
59
|
+
static AppendSerializedAnimations(source, destination) {
|
|
60
|
+
if (source.animations) {
|
|
61
|
+
destination.animations = [];
|
|
62
|
+
for (let animationIndex = 0; animationIndex < source.animations.length; animationIndex++) {
|
|
63
|
+
const animation = source.animations[animationIndex];
|
|
64
|
+
destination.animations.push(animation.serialize());
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Static function used to serialized a specific entity
|
|
70
|
+
* @param entity defines the entity to serialize
|
|
71
|
+
* @param serializationObject defines the optional target object where serialization data will be stored
|
|
72
|
+
* @returns a JSON compatible object representing the serialization of the entity
|
|
73
|
+
*/
|
|
74
|
+
static Serialize(entity, serializationObject) {
|
|
75
|
+
if (!serializationObject) {
|
|
76
|
+
serializationObject = {};
|
|
77
|
+
}
|
|
78
|
+
// Tags
|
|
79
|
+
if (Tags) {
|
|
80
|
+
serializationObject.tags = Tags.GetTags(entity);
|
|
81
|
+
}
|
|
82
|
+
const serializedProperties = GetMergedStore(entity);
|
|
83
|
+
// Properties
|
|
84
|
+
for (const property in serializedProperties) {
|
|
85
|
+
const propertyDescriptor = serializedProperties[property];
|
|
86
|
+
const targetPropertyName = propertyDescriptor.sourceName || property;
|
|
87
|
+
const propertyType = propertyDescriptor.type;
|
|
88
|
+
const sourceProperty = entity[property];
|
|
89
|
+
if (sourceProperty !== undefined && sourceProperty !== null && (property !== "uniqueId" || SerializationHelper.AllowLoadingUniqueId)) {
|
|
90
|
+
switch (propertyType) {
|
|
91
|
+
case 0: // Value
|
|
92
|
+
serializationObject[targetPropertyName] = sourceProperty;
|
|
93
|
+
break;
|
|
94
|
+
case 1: // Texture
|
|
95
|
+
serializationObject[targetPropertyName] = sourceProperty.serialize();
|
|
96
|
+
break;
|
|
97
|
+
case 2: // Color3
|
|
98
|
+
serializationObject[targetPropertyName] = sourceProperty.asArray();
|
|
99
|
+
break;
|
|
100
|
+
case 3: // FresnelParameters
|
|
101
|
+
serializationObject[targetPropertyName] = sourceProperty.serialize();
|
|
102
|
+
break;
|
|
103
|
+
case 4: // Vector2
|
|
104
|
+
serializationObject[targetPropertyName] = sourceProperty.asArray();
|
|
105
|
+
break;
|
|
106
|
+
case 5: // Vector3
|
|
107
|
+
serializationObject[targetPropertyName] = sourceProperty.asArray();
|
|
108
|
+
break;
|
|
109
|
+
case 6: // Mesh reference
|
|
110
|
+
serializationObject[targetPropertyName] = sourceProperty.id;
|
|
111
|
+
break;
|
|
112
|
+
case 7: // Color Curves
|
|
113
|
+
serializationObject[targetPropertyName] = sourceProperty.serialize();
|
|
114
|
+
break;
|
|
115
|
+
case 8: // Color 4
|
|
116
|
+
serializationObject[targetPropertyName] = sourceProperty.asArray();
|
|
117
|
+
break;
|
|
118
|
+
case 9: // Image Processing
|
|
119
|
+
serializationObject[targetPropertyName] = sourceProperty.serialize();
|
|
120
|
+
break;
|
|
121
|
+
case 10: // Quaternion
|
|
122
|
+
serializationObject[targetPropertyName] = sourceProperty.asArray();
|
|
123
|
+
break;
|
|
124
|
+
case 11: // Camera reference
|
|
125
|
+
serializationObject[targetPropertyName] = sourceProperty.id;
|
|
126
|
+
break;
|
|
127
|
+
case 12: // Matrix
|
|
128
|
+
serializationObject[targetPropertyName] = sourceProperty.asArray();
|
|
129
|
+
break;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
return serializationObject;
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* 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
|
|
137
|
+
* @param source the source json data
|
|
138
|
+
* @param destination the destination object
|
|
139
|
+
* @param scene the scene where the object is
|
|
140
|
+
* @param rootUrl root url to use to load assets
|
|
141
|
+
*/
|
|
142
|
+
static ParseProperties(source, destination, scene, rootUrl) {
|
|
143
|
+
if (!rootUrl) {
|
|
144
|
+
rootUrl = "";
|
|
145
|
+
}
|
|
146
|
+
const classStore = GetMergedStore(destination);
|
|
147
|
+
// Properties
|
|
148
|
+
for (const property in classStore) {
|
|
149
|
+
const propertyDescriptor = classStore[property];
|
|
150
|
+
const sourceProperty = source[propertyDescriptor.sourceName || property];
|
|
151
|
+
const propertyType = propertyDescriptor.type;
|
|
152
|
+
if (sourceProperty !== undefined && sourceProperty !== null && (property !== "uniqueId" || SerializationHelper.AllowLoadingUniqueId)) {
|
|
153
|
+
const dest = destination;
|
|
154
|
+
switch (propertyType) {
|
|
155
|
+
case 0: // Value
|
|
156
|
+
dest[property] = sourceProperty;
|
|
157
|
+
break;
|
|
158
|
+
case 1: // Texture
|
|
159
|
+
if (scene) {
|
|
160
|
+
dest[property] = SerializationHelper._TextureParser(sourceProperty, scene, rootUrl);
|
|
161
|
+
}
|
|
162
|
+
break;
|
|
163
|
+
case 2: // Color3
|
|
164
|
+
dest[property] = Color3.FromArray(sourceProperty);
|
|
165
|
+
break;
|
|
166
|
+
case 3: // FresnelParameters
|
|
167
|
+
dest[property] = SerializationHelper._FresnelParametersParser(sourceProperty);
|
|
168
|
+
break;
|
|
169
|
+
case 4: // Vector2
|
|
170
|
+
dest[property] = Vector2.FromArray(sourceProperty);
|
|
171
|
+
break;
|
|
172
|
+
case 5: // Vector3
|
|
173
|
+
dest[property] = Vector3.FromArray(sourceProperty);
|
|
174
|
+
break;
|
|
175
|
+
case 6: // Mesh reference
|
|
176
|
+
if (scene) {
|
|
177
|
+
dest[property] = scene.getLastMeshById(sourceProperty);
|
|
178
|
+
}
|
|
179
|
+
break;
|
|
180
|
+
case 7: // Color Curves
|
|
181
|
+
dest[property] = SerializationHelper._ColorCurvesParser(sourceProperty);
|
|
182
|
+
break;
|
|
183
|
+
case 8: // Color 4
|
|
184
|
+
dest[property] = Color4.FromArray(sourceProperty);
|
|
185
|
+
break;
|
|
186
|
+
case 9: // Image Processing
|
|
187
|
+
dest[property] = SerializationHelper._ImageProcessingConfigurationParser(sourceProperty);
|
|
188
|
+
break;
|
|
189
|
+
case 10: // Quaternion
|
|
190
|
+
dest[property] = Quaternion.FromArray(sourceProperty);
|
|
191
|
+
break;
|
|
192
|
+
case 11: // Camera reference
|
|
193
|
+
if (scene) {
|
|
194
|
+
dest[property] = scene.getCameraById(sourceProperty);
|
|
195
|
+
}
|
|
196
|
+
break;
|
|
197
|
+
case 12: // Matrix
|
|
198
|
+
dest[property] = Matrix.FromArray(sourceProperty);
|
|
199
|
+
break;
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
/**
|
|
205
|
+
* Creates a new entity from a serialization data object
|
|
206
|
+
* @param creationFunction defines a function used to instanciated the new entity
|
|
207
|
+
* @param source defines the source serialization data
|
|
208
|
+
* @param scene defines the hosting scene
|
|
209
|
+
* @param rootUrl defines the root url for resources
|
|
210
|
+
* @returns a new entity
|
|
211
|
+
*/
|
|
212
|
+
static Parse(creationFunction, source, scene, rootUrl = null) {
|
|
213
|
+
const destination = creationFunction();
|
|
214
|
+
// Tags
|
|
215
|
+
if (Tags) {
|
|
216
|
+
Tags.AddTagsTo(destination, source.tags);
|
|
217
|
+
}
|
|
218
|
+
SerializationHelper.ParseProperties(source, destination, scene, rootUrl);
|
|
219
|
+
return destination;
|
|
220
|
+
}
|
|
221
|
+
/**
|
|
222
|
+
* Clones an object
|
|
223
|
+
* @param creationFunction defines the function used to instanciate the new object
|
|
224
|
+
* @param source defines the source object
|
|
225
|
+
* @param options defines the options to use
|
|
226
|
+
* @returns the cloned object
|
|
227
|
+
*/
|
|
228
|
+
static Clone(creationFunction, source, options = {}) {
|
|
229
|
+
return _copySource(creationFunction, source, false, options);
|
|
230
|
+
}
|
|
231
|
+
/**
|
|
232
|
+
* Instanciates a new object based on a source one (some data will be shared between both object)
|
|
233
|
+
* @param creationFunction defines the function used to instanciate the new object
|
|
234
|
+
* @param source defines the source object
|
|
235
|
+
* @returns the new object
|
|
236
|
+
*/
|
|
237
|
+
static Instanciate(creationFunction, source) {
|
|
238
|
+
return _copySource(creationFunction, source, true);
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
/**
|
|
242
|
+
* Gets or sets a boolean to indicate if the UniqueId property should be serialized
|
|
243
|
+
*/
|
|
244
|
+
SerializationHelper.AllowLoadingUniqueId = false;
|
|
245
|
+
/**
|
|
246
|
+
* @internal
|
|
247
|
+
*/
|
|
248
|
+
SerializationHelper._ImageProcessingConfigurationParser = (sourceProperty) => {
|
|
249
|
+
throw _WarnImport("ImageProcessingConfiguration");
|
|
250
|
+
};
|
|
251
|
+
/**
|
|
252
|
+
* @internal
|
|
253
|
+
*/
|
|
254
|
+
SerializationHelper._FresnelParametersParser = (sourceProperty) => {
|
|
255
|
+
throw _WarnImport("FresnelParameters");
|
|
256
|
+
};
|
|
257
|
+
/**
|
|
258
|
+
* @internal
|
|
259
|
+
*/
|
|
260
|
+
SerializationHelper._ColorCurvesParser = (sourceProperty) => {
|
|
261
|
+
throw _WarnImport("ColorCurves");
|
|
262
|
+
};
|
|
263
|
+
/**
|
|
264
|
+
* @internal
|
|
265
|
+
*/
|
|
266
|
+
SerializationHelper._TextureParser = (sourceProperty, scene, rootUrl) => {
|
|
267
|
+
throw _WarnImport("Texture");
|
|
268
|
+
};
|
|
269
|
+
//# sourceMappingURL=decorators.serialization.js.map
|
|
@@ -0,0 +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,CA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AM,WAAW,GAAG,gBAAgB,EAAE,CAAC;QAEvC,OAAO;QACP,IAAI,IAAI,EAAE;YACN,IAAI,CAAC,SAAS,CAAC,WAAW,EAAE,MAAM,CAAC,IAAI,CAAC,CAAC;SAC5C;QAED,mBAAmB,CAAC,eAAe,CAAC,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,UAA6B,EAAE;QACxF,OAAO,WAAW,CAAC,gBAAgB,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;IACjE,CAAC;IAED;;;;;OAKG;IACI,MAAM,CAAC,WAAW,CAAI,gBAAyB,EAAE,MAAS;QAC7D,OAAO,WAAW,CAAC,gBAAgB,EAAE,MAAM,EAAE,IAAI,CAAC,CAAC;IACvD,CAAC;;AA3OD;;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 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\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"]}
|
package/Misc/index.d.ts
CHANGED
package/Misc/index.js
CHANGED
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,+CAA+C;AAC/C,cAAc,qBAAqB,CAAC;AACpC,cAAc,iBAAiB,CAAC;AAChC,cAAc,SAAS,CAAC;AACxB,cAAc,OAAO,CAAC;AACtB,cAAc,cAAc,CAAC;AAC7B,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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,yCAAyC;AACzC,cAAc,uBAAuB,CAAC;AACtC,cAAc,wBAAwB,CAAC;AACvC,cAAc,aAAa,CAAC;AAC5B,cAAc,oBAAoB,CAAC;AACnC,cAAc,0BAA0B,CAAC","sourcesContent":["/* eslint-disable import/no-internal-modules */\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\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 \"./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\n// eslint-disable-next-line import/export\r\nexport * from \"./observableCoroutine\";\r\nexport * from \"./copyTextureToTexture\";\r\nexport * from \"./dumpTools\";\r\nexport * from \"./greasedLineTools\";\r\nexport * from \"./equirectangularCapture\";\r\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../dev/core/src/Misc/index.ts"],"names":[],"mappings":"AAAA,+CAA+C;AAC/C,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,oBAA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AoB,CAAC;AACnC,cAAc,0BAA0B,CAAC;AACzC,cAAc,4BAA4B,CAAC","sourcesContent":["/* eslint-disable import/no-internal-modules */\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\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 \"./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\n// eslint-disable-next-line import/export\r\nexport * from \"./observableCoroutine\";\r\nexport * from \"./copyTextureToTexture\";\r\nexport * from \"./dumpTools\";\r\nexport * from \"./greasedLineTools\";\r\nexport * from \"./equirectangularCapture\";\r\nexport * from \"./decorators.serialization\";\r\n"]}
|
package/Misc/sceneRecorder.js
CHANGED
|
@@ -11,7 +11,7 @@ import { MorphTargetManager } from "../Morph/morphTargetManager.js";
|
|
|
11
11
|
import { ShadowGenerator } from "../Lights/Shadows/shadowGenerator.js";
|
|
12
12
|
import { PostProcess } from "../PostProcesses/postProcess.js";
|
|
13
13
|
import { Texture } from "../Materials/Textures/texture.js";
|
|
14
|
-
import { SerializationHelper } from "./decorators.js";
|
|
14
|
+
import { SerializationHelper } from "./decorators.serialization.js";
|
|
15
15
|
/**
|
|
16
16
|
* Class used to record delta files between 2 scene states
|
|
17
17
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sceneRecorder.js","sourceRoot":"","sources":["../../../../dev/core/src/Misc/sceneRecorder.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AACtC,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AACxC,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC3C,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACjD,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B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AAE,YAAY,CAAC,CAAC;oBACpD,sDAAsD;oBACtD,mBAAmB,CAAC,eAAe,CAAC,MAAM,EAAE,YAAY,EAAE,KAAK,EAAE,IAAI,CAAC,CAAC;iBAC1E;aACJ;iBAAM,IAAI,MAAM,CAAC,OAAO,IAAI,MAAM,CAAC,OAAO,CAAC,QAAQ,KAAK,SAAS,EAAE;gBAChE,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;gBAC/C,MAAM,EAAE,OAAO,EAAE,CAAC;aACrB;iBAAM;gBACH,MAAM;gBACN,MAAM,CAAC,MAAM,CAAC,CAAC;aAClB;SACJ;IACL,CAAC;CACJ","sourcesContent":["/* eslint-disable @typescript-eslint/naming-convention */\r\nimport type { Scene } from \"../scene\";\r\nimport type { Nullable } from \"../types\";\r\nimport { SceneSerializer } from \"./sceneSerializer\";\r\nimport { Mesh } from \"../Meshes/mesh\";\r\nimport { Light } from \"../Lights/light\";\r\nimport { Camera } from \"../Cameras/camera\";\r\nimport { Skeleton } from \"../Bones/skeleton\";\r\nimport { Material } from \"../Materials/material\";\r\nimport { MultiMaterial } from \"../Materials/multiMaterial\";\r\nimport { TransformNode } from \"../Meshes/transformNode\";\r\nimport { ParticleSystem } from \"../Particles/particleSystem\";\r\nimport { MorphTargetManager } from \"../Morph/morphTargetManager\";\r\nimport { ShadowGenerator } from \"../Lights/Shadows/shadowGenerator\";\r\nimport { PostProcess } from \"../PostProcesses/postProcess\";\r\nimport { Texture } from \"../Materials/Textures/texture\";\r\nimport { SerializationHelper } from \"./decorators\";\r\n\r\n/**\r\n * Class used to record delta files between 2 scene states\r\n */\r\nexport class SceneRecorder {\r\n private _trackedScene: Nullable<Scene> = null;\r\n private _savedJSON: any;\r\n\r\n /**\r\n * Track a given scene. This means the current scene state will be considered the original state\r\n * @param scene defines the scene to track\r\n */\r\n public track(scene: Scene) {\r\n this._trackedScene = scene;\r\n\r\n SerializationHelper.AllowLoadingUniqueId = true;\r\n this._savedJSON = SceneSerializer.Serialize(scene);\r\n SerializationHelper.AllowLoadingUniqueId = false;\r\n }\r\n\r\n /**\r\n * Get the delta between current state and original state\r\n * @returns a any containing the delta\r\n */\r\n public getDelta(): any {\r\n if (!this._trackedScene) {\r\n return null;\r\n }\r\n\r\n const currentForceSerializeBuffers = Texture.ForceSerializeBuffers;\r\n Texture.ForceSerializeBuffers = false;\r\n\r\n SerializationHelper.AllowLoadingUniqueId = true;\r\n const newJSON = SceneSerializer.Serialize(this._trackedScene);\r\n SerializationHelper.AllowLoadingUniqueId = false;\r\n const deltaJSON: any = {};\r\n\r\n for (const node in newJSON) {\r\n this._compareCollections(node, this._savedJSON[node], newJSON[node], deltaJSON);\r\n }\r\n\r\n Texture.ForceSerializeBuffers = currentForceSerializeBuffers;\r\n\r\n return deltaJSON;\r\n }\r\n\r\n private _compareArray(key: string, original: any[], current: any[], deltaJSON: any) {\r\n if (original.length === 0 && current.length === 0) {\r\n return true;\r\n }\r\n\r\n // Numbers?\r\n if ((original.length && !isNaN(original[0])) || (current.length && !isNaN(current[0]))) {\r\n if (original.length !== current.length) {\r\n return false;\r\n }\r\n\r\n if (original.length === 0) {\r\n return true;\r\n }\r\n for (let index = 0; index < original.length; index++) {\r\n if (original[index] !== current[index]) {\r\n deltaJSON[key] = current;\r\n return false;\r\n }\r\n }\r\n return true;\r\n }\r\n\r\n // let's use uniqueId to find similar objects\r\n const originalUniqueIds: number[] = [];\r\n for (let index = 0; index < original.length; index++) {\r\n const originalObject = original[index];\r\n const originalUniqueId = originalObject.uniqueId;\r\n\r\n originalUniqueIds.push(originalUniqueId);\r\n // Look for that object in current state\r\n const currentObjects = current.filter((c) => c.uniqueId === originalUniqueId);\r\n if (currentObjects.length) {\r\n // We have a candidate\r\n const currentObject = currentObjects[0];\r\n\r\n const newObject: any = {};\r\n if (!this._compareObjects(originalObject, currentObject, newObject)) {\r\n if (!deltaJSON[key]) {\r\n deltaJSON[key] = [];\r\n }\r\n newObject.__state = {\r\n id: currentObject.id || currentObject.name,\r\n };\r\n deltaJSON[key].push(newObject);\r\n }\r\n } else {\r\n // We need to delete\r\n const newObject: any = {\r\n __state: {\r\n deleteId: originalObject.id || originalObject.name,\r\n },\r\n };\r\n if (!deltaJSON[key]) {\r\n deltaJSON[key] = [];\r\n }\r\n deltaJSON[key].push(newObject);\r\n }\r\n }\r\n\r\n // Checking for new objects\r\n for (let index = 0; index < current.length; index++) {\r\n const currentObject = current[index];\r\n const currentUniqueId = currentObject.uniqueId;\r\n\r\n // Object was added\r\n if (originalUniqueIds.indexOf(currentUniqueId) === -1) {\r\n if (!deltaJSON[key]) {\r\n deltaJSON[key] = [];\r\n }\r\n\r\n deltaJSON[key].push(currentObject);\r\n }\r\n }\r\n\r\n return true;\r\n }\r\n\r\n private _compareObjects(originalObjet: any, currentObject: any, deltaJSON: any) {\r\n let aDifferenceWasFound = false;\r\n\r\n for (const prop in originalObjet) {\r\n if (!Object.prototype.hasOwnProperty.call(originalObjet, prop)) {\r\n continue;\r\n }\r\n const originalValue = originalObjet[prop];\r\n const currentValue = currentObject[prop];\r\n let diffFound = false;\r\n\r\n if (Array.isArray(originalValue)) {\r\n diffFound = JSON.stringify(originalValue) !== JSON.stringify(currentValue);\r\n } else if (!isNaN(originalValue) || Object.prototype.toString.call(originalValue) == \"[object String]\") {\r\n diffFound = originalValue !== currentValue;\r\n } else if (typeof originalValue === \"object\" && typeof currentValue === \"object\") {\r\n const newObject = {};\r\n if (!this._compareObjects(originalValue, currentValue, newObject)) {\r\n deltaJSON[prop] = newObject;\r\n aDifferenceWasFound = true;\r\n }\r\n }\r\n\r\n if (diffFound) {\r\n aDifferenceWasFound = true;\r\n deltaJSON[prop] = currentValue;\r\n }\r\n }\r\n\r\n return !aDifferenceWasFound;\r\n }\r\n\r\n private _compareCollections(key: string, original: any[], current: any[], deltaJSON: any) {\r\n // Same ?\r\n if (original === current) {\r\n return;\r\n }\r\n\r\n if (original && current) {\r\n // Array?\r\n if (Array.isArray(original) && Array.isArray(current)) {\r\n if (this._compareArray(key, original, current, deltaJSON)) {\r\n return;\r\n }\r\n } else if (typeof original === \"object\" && typeof current === \"object\") {\r\n // Object\r\n const newObject = {};\r\n if (!this._compareObjects(original, current, newObject)) {\r\n deltaJSON[key] = newObject;\r\n }\r\n return;\r\n }\r\n }\r\n }\r\n\r\n private static GetShadowGeneratorById(scene: Scene, id: string) {\r\n const allGenerators = scene.lights.map((l) => l.getShadowGenerators());\r\n\r\n for (const generators of allGenerators) {\r\n if (generators) {\r\n const iterator = generators.values();\r\n for (let key = iterator.next(); key.done !== true; key = iterator.next()) {\r\n const generator = key.value;\r\n if (generator && generator.id === id) {\r\n return generator;\r\n }\r\n }\r\n }\r\n }\r\n\r\n return null;\r\n }\r\n\r\n /**\r\n * Apply a given delta to a given scene\r\n * @param deltaJSON defines the JSON containing the delta\r\n * @param scene defines the scene to apply the delta to\r\n */\r\n public static ApplyDelta(deltaJSON: any | string, scene: Scene) {\r\n if (typeof deltaJSON === \"string\") {\r\n deltaJSON = JSON.parse(deltaJSON);\r\n }\r\n\r\n // Scene\r\n const anyScene = scene as any;\r\n for (const prop in deltaJSON) {\r\n const source = deltaJSON[prop];\r\n const property = anyScene[prop];\r\n\r\n if (Array.isArray(property) || prop === \"shadowGenerators\") {\r\n // Restore array\r\n switch (prop) {\r\n case \"cameras\":\r\n this._ApplyDeltaForEntity(source, scene, scene.getCameraById.bind(scene), (data) => Camera.Parse(data, scene));\r\n break;\r\n case \"lights\":\r\n this._ApplyDeltaForEntity(source, scene, scene.getLightById.bind(scene), (data) => Light.Parse(data, scene));\r\n break;\r\n case \"shadowGenerators\":\r\n this._ApplyDeltaForEntity(\r\n source,\r\n scene,\r\n (id) => this.GetShadowGeneratorById(scene, id),\r\n (data) => ShadowGenerator.Parse(data, scene)\r\n );\r\n break;\r\n case \"meshes\":\r\n this._ApplyDeltaForEntity(source, scene, scene.getMeshById.bind(scene), (data) => Mesh.Parse(data, scene, \"\"));\r\n break;\r\n case \"skeletons\":\r\n this._ApplyDeltaForEntity(source, scene, scene.getSkeletonById.bind(scene), (data) => Skeleton.Parse(data, scene));\r\n break;\r\n case \"materials\":\r\n this._ApplyDeltaForEntity(source, scene, scene.getMaterialById.bind(scene), (data) => Material.Parse(data, scene, \"\"));\r\n break;\r\n case \"multiMaterials\":\r\n this._ApplyDeltaForEntity(source, scene, scene.getMaterialById.bind(scene), (data) => MultiMaterial.Parse(data, scene, \"\"));\r\n break;\r\n case \"transformNodes\":\r\n this._ApplyDeltaForEntity(source, scene, scene.getTransformNodeById.bind(scene), (data) => TransformNode.Parse(data, scene, \"\"));\r\n break;\r\n case \"particleSystems\":\r\n this._ApplyDeltaForEntity(source, scene, scene.getParticleSystemById.bind(scene), (data) => ParticleSystem.Parse(data, scene, \"\"));\r\n break;\r\n case \"morphTargetManagers\":\r\n this._ApplyDeltaForEntity(source, scene, scene.getMorphTargetById.bind(scene), (data) => MorphTargetManager.Parse(data, scene));\r\n break;\r\n case \"postProcesses\":\r\n this._ApplyDeltaForEntity(source, scene, scene.getPostProcessByName.bind(scene), (data) => PostProcess.Parse(data, scene, \"\"));\r\n break;\r\n }\r\n } else if (!isNaN(property)) {\r\n anyScene[prop] = source;\r\n } else if (property.fromArray) {\r\n property.fromArray(source);\r\n }\r\n }\r\n }\r\n\r\n private static _ApplyPropertiesToEntity(deltaJSON: any, entity: any) {\r\n for (const prop in deltaJSON) {\r\n const source = deltaJSON[prop];\r\n const property = entity[prop];\r\n\r\n if (property === undefined) {\r\n continue;\r\n }\r\n\r\n if (!isNaN(property) || Array.isArray(property)) {\r\n entity[prop] = source;\r\n } else if (property.fromArray) {\r\n property.fromArray(source);\r\n } else if (typeof property === \"object\" && property !== null) {\r\n this._ApplyPropertiesToEntity(source, property);\r\n }\r\n }\r\n }\r\n\r\n private static _ApplyDeltaForEntity(sources: any[], scene: Scene, finder: (id: string) => any, addNew: (data: any) => void) {\r\n for (const source of sources) {\r\n // Update\r\n if (source.__state && source.__state.id !== undefined) {\r\n const targetEntity = finder(source.__state.id);\r\n\r\n if (targetEntity) {\r\n // This first pass applies properties that aren't on the serialization list\r\n this._ApplyPropertiesToEntity(source, targetEntity);\r\n // The second pass applies the serializable properties\r\n SerializationHelper.ParseProperties(source, targetEntity, scene, null);\r\n }\r\n } else if (source.__state && source.__state.deleteId !== undefined) {\r\n const target = finder(source.__state.deleteId);\r\n target?.dispose();\r\n } else {\r\n // New\r\n addNew(source);\r\n }\r\n }\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"sceneRecorder.js","sourceRoot":"","sources":["../../../../dev/core/src/Misc/sceneRecorder.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AACtC,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AACxC,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC3C,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACjD,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAC7D,OAAO,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AACjE,OAAO,EAAE,eAAe,EAAE,MAAM,mCAAmC,CAAC;AACpE,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAC3D,OAAO,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AACxD,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AAEjE;;GAEG;AACH,MAAM,OAAO,aAAa;IAA1B;QACY,kBAAa,GAAoB,IAAI,CAAC;IA0SlD,CAAC;IAvSG;;;OA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-convention */\r\nimport type { Scene } from \"../scene\";\r\nimport type { Nullable } from \"../types\";\r\nimport { SceneSerializer } from \"./sceneSerializer\";\r\nimport { Mesh } from \"../Meshes/mesh\";\r\nimport { Light } from \"../Lights/light\";\r\nimport { Camera } from \"../Cameras/camera\";\r\nimport { Skeleton } from \"../Bones/skeleton\";\r\nimport { Material } from \"../Materials/material\";\r\nimport { MultiMaterial } from \"../Materials/multiMaterial\";\r\nimport { TransformNode } from \"../Meshes/transformNode\";\r\nimport { ParticleSystem } from \"../Particles/particleSystem\";\r\nimport { MorphTargetManager } from \"../Morph/morphTargetManager\";\r\nimport { ShadowGenerator } from \"../Lights/Shadows/shadowGenerator\";\r\nimport { PostProcess } from \"../PostProcesses/postProcess\";\r\nimport { Texture } from \"../Materials/Textures/texture\";\r\nimport { SerializationHelper } from \"./decorators.serialization\";\r\n\r\n/**\r\n * Class used to record delta files between 2 scene states\r\n */\r\nexport class SceneRecorder {\r\n private _trackedScene: Nullable<Scene> = null;\r\n private _savedJSON: any;\r\n\r\n /**\r\n * Track a given scene. This means the current scene state will be considered the original state\r\n * @param scene defines the scene to track\r\n */\r\n public track(scene: Scene) {\r\n this._trackedScene = scene;\r\n\r\n SerializationHelper.AllowLoadingUniqueId = true;\r\n this._savedJSON = SceneSerializer.Serialize(scene);\r\n SerializationHelper.AllowLoadingUniqueId = false;\r\n }\r\n\r\n /**\r\n * Get the delta between current state and original state\r\n * @returns a any containing the delta\r\n */\r\n public getDelta(): any {\r\n if (!this._trackedScene) {\r\n return null;\r\n }\r\n\r\n const currentForceSerializeBuffers = Texture.ForceSerializeBuffers;\r\n Texture.ForceSerializeBuffers = false;\r\n\r\n SerializationHelper.AllowLoadingUniqueId = true;\r\n const newJSON = SceneSerializer.Serialize(this._trackedScene);\r\n SerializationHelper.AllowLoadingUniqueId = false;\r\n const deltaJSON: any = {};\r\n\r\n for (const node in newJSON) {\r\n this._compareCollections(node, this._savedJSON[node], newJSON[node], deltaJSON);\r\n }\r\n\r\n Texture.ForceSerializeBuffers = currentForceSerializeBuffers;\r\n\r\n return deltaJSON;\r\n }\r\n\r\n private _compareArray(key: string, original: any[], current: any[], deltaJSON: any) {\r\n if (original.length === 0 && current.length === 0) {\r\n return true;\r\n }\r\n\r\n // Numbers?\r\n if ((original.length && !isNaN(original[0])) || (current.length && !isNaN(current[0]))) {\r\n if (original.length !== current.length) {\r\n return false;\r\n }\r\n\r\n if (original.length === 0) {\r\n return true;\r\n }\r\n for (let index = 0; index < original.length; index++) {\r\n if (original[index] !== current[index]) {\r\n deltaJSON[key] = current;\r\n return false;\r\n }\r\n }\r\n return true;\r\n }\r\n\r\n // let's use uniqueId to find similar objects\r\n const originalUniqueIds: number[] = [];\r\n for (let index = 0; index < original.length; index++) {\r\n const originalObject = original[index];\r\n const originalUniqueId = originalObject.uniqueId;\r\n\r\n originalUniqueIds.push(originalUniqueId);\r\n // Look for that object in current state\r\n const currentObjects = current.filter((c) => c.uniqueId === originalUniqueId);\r\n if (currentObjects.length) {\r\n // We have a candidate\r\n const currentObject = currentObjects[0];\r\n\r\n const newObject: any = {};\r\n if (!this._compareObjects(originalObject, currentObject, newObject)) {\r\n if (!deltaJSON[key]) {\r\n deltaJSON[key] = [];\r\n }\r\n newObject.__state = {\r\n id: currentObject.id || currentObject.name,\r\n };\r\n deltaJSON[key].push(newObject);\r\n }\r\n } else {\r\n // We need to delete\r\n const newObject: any = {\r\n __state: {\r\n deleteId: originalObject.id || originalObject.name,\r\n },\r\n };\r\n if (!deltaJSON[key]) {\r\n deltaJSON[key] = [];\r\n }\r\n deltaJSON[key].push(newObject);\r\n }\r\n }\r\n\r\n // Checking for new objects\r\n for (let index = 0; index < current.length; index++) {\r\n const currentObject = current[index];\r\n const currentUniqueId = currentObject.uniqueId;\r\n\r\n // Object was added\r\n if (originalUniqueIds.indexOf(currentUniqueId) === -1) {\r\n if (!deltaJSON[key]) {\r\n deltaJSON[key] = [];\r\n }\r\n\r\n deltaJSON[key].push(currentObject);\r\n }\r\n }\r\n\r\n return true;\r\n }\r\n\r\n private _compareObjects(originalObjet: any, currentObject: any, deltaJSON: any) {\r\n let aDifferenceWasFound = false;\r\n\r\n for (const prop in originalObjet) {\r\n if (!Object.prototype.hasOwnProperty.call(originalObjet, prop)) {\r\n continue;\r\n }\r\n const originalValue = originalObjet[prop];\r\n const currentValue = currentObject[prop];\r\n let diffFound = false;\r\n\r\n if (Array.isArray(originalValue)) {\r\n diffFound = JSON.stringify(originalValue) !== JSON.stringify(currentValue);\r\n } else if (!isNaN(originalValue) || Object.prototype.toString.call(originalValue) == \"[object String]\") {\r\n diffFound = originalValue !== currentValue;\r\n } else if (typeof originalValue === \"object\" && typeof currentValue === \"object\") {\r\n const newObject = {};\r\n if (!this._compareObjects(originalValue, currentValue, newObject)) {\r\n deltaJSON[prop] = newObject;\r\n aDifferenceWasFound = true;\r\n }\r\n }\r\n\r\n if (diffFound) {\r\n aDifferenceWasFound = true;\r\n deltaJSON[prop] = currentValue;\r\n }\r\n }\r\n\r\n return !aDifferenceWasFound;\r\n }\r\n\r\n private _compareCollections(key: string, original: any[], current: any[], deltaJSON: any) {\r\n // Same ?\r\n if (original === current) {\r\n return;\r\n }\r\n\r\n if (original && current) {\r\n // Array?\r\n if (Array.isArray(original) && Array.isArray(current)) {\r\n if (this._compareArray(key, original, current, deltaJSON)) {\r\n return;\r\n }\r\n } else if (typeof original === \"object\" && typeof current === \"object\") {\r\n // Object\r\n const newObject = {};\r\n if (!this._compareObjects(original, current, newObject)) {\r\n deltaJSON[key] = newObject;\r\n }\r\n return;\r\n }\r\n }\r\n }\r\n\r\n private static GetShadowGeneratorById(scene: Scene, id: string) {\r\n const allGenerators = scene.lights.map((l) => l.getShadowGenerators());\r\n\r\n for (const generators of allGenerators) {\r\n if (generators) {\r\n const iterator = generators.values();\r\n for (let key = iterator.next(); key.done !== true; key = iterator.next()) {\r\n const generator = key.value;\r\n if (generator && generator.id === id) {\r\n return generator;\r\n }\r\n }\r\n }\r\n }\r\n\r\n return null;\r\n }\r\n\r\n /**\r\n * Apply a given delta to a given scene\r\n * @param deltaJSON defines the JSON containing the delta\r\n * @param scene defines the scene to apply the delta to\r\n */\r\n public static ApplyDelta(deltaJSON: any | string, scene: Scene) {\r\n if (typeof deltaJSON === \"string\") {\r\n deltaJSON = JSON.parse(deltaJSON);\r\n }\r\n\r\n // Scene\r\n const anyScene = scene as any;\r\n for (const prop in deltaJSON) {\r\n const source = deltaJSON[prop];\r\n const property = anyScene[prop];\r\n\r\n if (Array.isArray(property) || prop === \"shadowGenerators\") {\r\n // Restore array\r\n switch (prop) {\r\n case \"cameras\":\r\n this._ApplyDeltaForEntity(source, scene, scene.getCameraById.bind(scene), (data) => Camera.Parse(data, scene));\r\n break;\r\n case \"lights\":\r\n this._ApplyDeltaForEntity(source, scene, scene.getLightById.bind(scene), (data) => Light.Parse(data, scene));\r\n break;\r\n case \"shadowGenerators\":\r\n this._ApplyDeltaForEntity(\r\n source,\r\n scene,\r\n (id) => this.GetShadowGeneratorById(scene, id),\r\n (data) => ShadowGenerator.Parse(data, scene)\r\n );\r\n break;\r\n case \"meshes\":\r\n this._ApplyDeltaForEntity(source, scene, scene.getMeshById.bind(scene), (data) => Mesh.Parse(data, scene, \"\"));\r\n break;\r\n case \"skeletons\":\r\n this._ApplyDeltaForEntity(source, scene, scene.getSkeletonById.bind(scene), (data) => Skeleton.Parse(data, scene));\r\n break;\r\n case \"materials\":\r\n this._ApplyDeltaForEntity(source, scene, scene.getMaterialById.bind(scene), (data) => Material.Parse(data, scene, \"\"));\r\n break;\r\n case \"multiMaterials\":\r\n this._ApplyDeltaForEntity(source, scene, scene.getMaterialById.bind(scene), (data) => MultiMaterial.Parse(data, scene, \"\"));\r\n break;\r\n case \"transformNodes\":\r\n this._ApplyDeltaForEntity(source, scene, scene.getTransformNodeById.bind(scene), (data) => TransformNode.Parse(data, scene, \"\"));\r\n break;\r\n case \"particleSystems\":\r\n this._ApplyDeltaForEntity(source, scene, scene.getParticleSystemById.bind(scene), (data) => ParticleSystem.Parse(data, scene, \"\"));\r\n break;\r\n case \"morphTargetManagers\":\r\n this._ApplyDeltaForEntity(source, scene, scene.getMorphTargetById.bind(scene), (data) => MorphTargetManager.Parse(data, scene));\r\n break;\r\n case \"postProcesses\":\r\n this._ApplyDeltaForEntity(source, scene, scene.getPostProcessByName.bind(scene), (data) => PostProcess.Parse(data, scene, \"\"));\r\n break;\r\n }\r\n } else if (!isNaN(property)) {\r\n anyScene[prop] = source;\r\n } else if (property.fromArray) {\r\n property.fromArray(source);\r\n }\r\n }\r\n }\r\n\r\n private static _ApplyPropertiesToEntity(deltaJSON: any, entity: any) {\r\n for (const prop in deltaJSON) {\r\n const source = deltaJSON[prop];\r\n const property = entity[prop];\r\n\r\n if (property === undefined) {\r\n continue;\r\n }\r\n\r\n if (!isNaN(property) || Array.isArray(property)) {\r\n entity[prop] = source;\r\n } else if (property.fromArray) {\r\n property.fromArray(source);\r\n } else if (typeof property === \"object\" && property !== null) {\r\n this._ApplyPropertiesToEntity(source, property);\r\n }\r\n }\r\n }\r\n\r\n private static _ApplyDeltaForEntity(sources: any[], scene: Scene, finder: (id: string) => any, addNew: (data: any) => void) {\r\n for (const source of sources) {\r\n // Update\r\n if (source.__state && source.__state.id !== undefined) {\r\n const targetEntity = finder(source.__state.id);\r\n\r\n if (targetEntity) {\r\n // This first pass applies properties that aren't on the serialization list\r\n this._ApplyPropertiesToEntity(source, targetEntity);\r\n // The second pass applies the serializable properties\r\n SerializationHelper.ParseProperties(source, targetEntity, scene, null);\r\n }\r\n } else if (source.__state && source.__state.deleteId !== undefined) {\r\n const target = finder(source.__state.deleteId);\r\n target?.dispose();\r\n } else {\r\n // New\r\n addNew(source);\r\n }\r\n }\r\n }\r\n}\r\n"]}
|
package/Misc/sceneSerializer.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Mesh } from "../Meshes/mesh.js";
|
|
2
2
|
|
|
3
3
|
import { MultiMaterial } from "../Materials/multiMaterial.js";
|
|
4
|
-
import { SerializationHelper } from "./decorators.js";
|
|
4
|
+
import { SerializationHelper } from "./decorators.serialization.js";
|
|
5
5
|
import { Texture } from "../Materials/Textures/texture.js";
|
|
6
6
|
import { Logger } from "./logger.js";
|
|
7
7
|
let serializedGeometries = [];
|
|
@@ -292,6 +292,13 @@ export class SceneSerializer {
|
|
|
292
292
|
for (const component of scene._serializableComponents) {
|
|
293
293
|
component.serialize(serializationObject);
|
|
294
294
|
}
|
|
295
|
+
// Sprites
|
|
296
|
+
if (scene.spriteManagers) {
|
|
297
|
+
serializationObject.spriteManagers = [];
|
|
298
|
+
for (index = 0; index < scene.spriteManagers.length; index++) {
|
|
299
|
+
serializationObject.spriteManagers.push(scene.spriteManagers[index].serialize(true));
|
|
300
|
+
}
|
|
301
|
+
}
|
|
295
302
|
return serializationObject;
|
|
296
303
|
}
|
|
297
304
|
/**
|