@babylonjs/core 8.3.0 → 8.4.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.d.ts +4 -0
- package/Animations/animation.js +22 -13
- package/Animations/animation.js.map +1 -1
- package/Animations/animation.optimizations.d.ts +31 -0
- package/Animations/animation.optimizations.js +41 -0
- package/Animations/animation.optimizations.js.map +1 -0
- package/Animations/index.d.ts +1 -0
- package/Animations/index.js +1 -0
- package/Animations/index.js.map +1 -1
- package/Animations/pathCursor.js +3 -1
- package/Animations/pathCursor.js.map +1 -1
- package/Animations/runtimeAnimation.d.ts +3 -1
- package/Animations/runtimeAnimation.js +127 -116
- package/Animations/runtimeAnimation.js.map +1 -1
- package/Audio/audioSceneComponent.js +4 -4
- package/Audio/audioSceneComponent.js.map +1 -1
- package/Behaviors/Meshes/attachToBoxBehavior.js +6 -6
- package/Behaviors/Meshes/attachToBoxBehavior.js.map +1 -1
- package/Behaviors/Meshes/fadeInOutBehavior.js +3 -2
- package/Behaviors/Meshes/fadeInOutBehavior.js.map +1 -1
- package/Behaviors/Meshes/multiPointerScaleBehavior.js +6 -4
- package/Behaviors/Meshes/multiPointerScaleBehavior.js.map +1 -1
- package/Behaviors/Meshes/sixDofDragBehavior.js +3 -2
- package/Behaviors/Meshes/sixDofDragBehavior.js.map +1 -1
- package/Bones/skeleton.js +6 -6
- package/Bones/skeleton.js.map +1 -1
- package/Cameras/Inputs/followCameraKeyboardMoveInput.js +2 -2
- package/Cameras/Inputs/followCameraKeyboardMoveInput.js.map +1 -1
- package/Cameras/VR/vrExperienceHelper.js +2 -2
- package/Cameras/VR/vrExperienceHelper.js.map +1 -1
- package/Cameras/arcRotateCamera.js +6 -2
- package/Cameras/arcRotateCamera.js.map +1 -1
- package/Cameras/camera.js +2 -2
- package/Cameras/camera.js.map +1 -1
- package/Cameras/deviceOrientationCamera.js +3 -2
- package/Cameras/deviceOrientationCamera.js.map +1 -1
- package/Collisions/gpuPicker.d.ts +1 -0
- package/Collisions/gpuPicker.js +9 -0
- package/Collisions/gpuPicker.js.map +1 -1
- package/Debug/axesViewer.js +3 -2
- package/Debug/axesViewer.js.map +1 -1
- package/Debug/directionalLightFrustumViewer.js +4 -4
- package/Debug/directionalLightFrustumViewer.js.map +1 -1
- package/Debug/physicsViewer.js +7 -6
- package/Debug/physicsViewer.js.map +1 -1
- package/Debug/skeletonViewer.js +4 -4
- package/Debug/skeletonViewer.js.map +1 -1
- package/Engines/Native/nativeInterfaces.d.ts +6 -7
- package/Engines/Native/nativeInterfaces.js.map +1 -1
- package/Engines/Processors/shaderCodeNode.js +2 -2
- package/Engines/Processors/shaderCodeNode.js.map +1 -1
- package/Engines/abstractEngine.d.ts +1 -0
- package/Engines/abstractEngine.js +14 -8
- package/Engines/abstractEngine.js.map +1 -1
- package/Engines/constants.d.ts +27 -5
- package/Engines/constants.js +27 -5
- package/Engines/constants.js.map +1 -1
- package/Engines/engine.js +8 -8
- package/Engines/engine.js.map +1 -1
- package/Engines/nativeEngine.js +13 -27
- package/Engines/nativeEngine.js.map +1 -1
- package/Engines/webgpuEngine.js +6 -2
- package/Engines/webgpuEngine.js.map +1 -1
- package/FlowGraph/Blocks/Data/Transformers/flowGraphJsonPointerParserBlock.js +2 -2
- package/FlowGraph/Blocks/Data/Transformers/flowGraphJsonPointerParserBlock.js.map +1 -1
- package/FlowGraph/Blocks/Data/flowGraphDataSwitchBlock.js +3 -2
- package/FlowGraph/Blocks/Data/flowGraphDataSwitchBlock.js.map +1 -1
- package/FlowGraph/Blocks/Event/flowGraphReceiveCustomEventBlock.js +3 -2
- package/FlowGraph/Blocks/Event/flowGraphReceiveCustomEventBlock.js.map +1 -1
- package/FlowGraph/Blocks/Event/flowGraphSendCustomEventBlock.js +2 -2
- package/FlowGraph/Blocks/Event/flowGraphSendCustomEventBlock.js.map +1 -1
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphSwitchBlock.js +3 -2
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphSwitchBlock.js.map +1 -1
- package/FlowGraph/flowGraphAsyncExecutionBlock.js +5 -3
- package/FlowGraph/flowGraphAsyncExecutionBlock.js.map +1 -1
- package/FlowGraph/flowGraphBlock.js +3 -2
- package/FlowGraph/flowGraphBlock.js.map +1 -1
- package/FlowGraph/flowGraphCoordinator.js +10 -6
- package/FlowGraph/flowGraphCoordinator.js.map +1 -1
- package/FrameGraph/Node/Blocks/Rendering/baseObjectRendererBlock.js +2 -2
- package/FrameGraph/Node/Blocks/Rendering/baseObjectRendererBlock.js.map +1 -1
- package/FrameGraph/Node/nodeRenderGraphBlock.js +5 -4
- package/FrameGraph/Node/nodeRenderGraphBlock.js.map +1 -1
- package/FrameGraph/Tasks/PostProcesses/depthOfFieldMergeTask.js +4 -3
- package/FrameGraph/Tasks/PostProcesses/depthOfFieldMergeTask.js.map +1 -1
- package/Gamepads/gamepadManager.js +2 -2
- package/Gamepads/gamepadManager.js.map +1 -1
- package/Gizmos/axisDragGizmo.js +3 -2
- package/Gizmos/axisDragGizmo.js.map +1 -1
- package/Gizmos/axisScaleGizmo.js +6 -4
- package/Gizmos/axisScaleGizmo.js.map +1 -1
- package/Gizmos/boundingBoxGizmo.js +28 -26
- package/Gizmos/boundingBoxGizmo.js.map +1 -1
- package/Gizmos/cameraGizmo.js +6 -3
- package/Gizmos/cameraGizmo.js.map +1 -1
- package/Gizmos/gizmo.js +11 -10
- package/Gizmos/gizmo.js.map +1 -1
- package/Gizmos/gizmoManager.js +16 -12
- package/Gizmos/gizmoManager.js.map +1 -1
- package/Gizmos/lightGizmo.js +3 -2
- package/Gizmos/lightGizmo.js.map +1 -1
- package/Gizmos/planeDragGizmo.js +3 -2
- package/Gizmos/planeDragGizmo.js.map +1 -1
- package/Gizmos/planeRotationGizmo.js +3 -2
- package/Gizmos/planeRotationGizmo.js.map +1 -1
- package/Gizmos/positionGizmo.js +41 -28
- package/Gizmos/positionGizmo.js.map +1 -1
- package/Gizmos/rotationGizmo.js +26 -18
- package/Gizmos/rotationGizmo.js.map +1 -1
- package/Gizmos/scaleGizmo.js +47 -32
- package/Gizmos/scaleGizmo.js.map +1 -1
- package/Layers/effectLayerSceneComponent.js +4 -4
- package/Layers/effectLayerSceneComponent.js.map +1 -1
- package/Layers/layerSceneComponent.js +4 -4
- package/Layers/layerSceneComponent.js.map +1 -1
- package/LensFlares/lensFlareSystemSceneComponent.js +4 -4
- package/LensFlares/lensFlareSystemSceneComponent.js.map +1 -1
- package/Lights/Shadows/shadowGenerator.js +3 -3
- package/Lights/Shadows/shadowGenerator.js.map +1 -1
- package/Lights/light.js +4 -4
- package/Lights/light.js.map +1 -1
- package/Loading/Plugins/babylonFileLoader.js +54 -46
- package/Loading/Plugins/babylonFileLoader.js.map +1 -1
- package/Loading/loadingScreen.js +4 -3
- package/Loading/loadingScreen.js.map +1 -1
- package/Loading/sceneLoader.js +15 -12
- package/Loading/sceneLoader.js.map +1 -1
- package/Materials/Node/Blocks/Dual/currentScreenBlock.js +9 -3
- package/Materials/Node/Blocks/Dual/currentScreenBlock.js.map +1 -1
- package/Materials/Node/Blocks/Fragment/fragmentOutputBlock.js +11 -0
- package/Materials/Node/Blocks/Fragment/fragmentOutputBlock.js.map +1 -1
- package/Materials/Node/Blocks/Input/inputBlock.js +18 -31
- package/Materials/Node/Blocks/Input/inputBlock.js.map +1 -1
- package/Materials/Node/Blocks/baseMathBlock.js +3 -1
- package/Materials/Node/Blocks/baseMathBlock.js.map +1 -1
- package/Materials/Node/Blocks/customBlock.js +53 -43
- package/Materials/Node/Blocks/customBlock.js.map +1 -1
- package/Materials/Node/Enums/nodeMaterialModes.d.ts +3 -1
- package/Materials/Node/Enums/nodeMaterialModes.js +2 -0
- package/Materials/Node/Enums/nodeMaterialModes.js.map +1 -1
- package/Materials/Node/nodeMaterial.d.ts +5 -0
- package/Materials/Node/nodeMaterial.js +33 -20
- package/Materials/Node/nodeMaterial.js.map +1 -1
- package/Materials/Node/nodeMaterialBlock.js +7 -4
- package/Materials/Node/nodeMaterialBlock.js.map +1 -1
- package/Materials/Node/nodeMaterialBuildState.d.ts +13 -2
- package/Materials/Node/nodeMaterialBuildState.js +72 -7
- package/Materials/Node/nodeMaterialBuildState.js.map +1 -1
- package/Materials/Node/nodeMaterialDefault.d.ts +5 -0
- package/Materials/Node/nodeMaterialDefault.js +28 -0
- package/Materials/Node/nodeMaterialDefault.js.map +1 -1
- package/Materials/Textures/cubeTexture.js +3 -1
- package/Materials/Textures/cubeTexture.js.map +1 -1
- package/Materials/Textures/videoTexture.js +5 -4
- package/Materials/Textures/videoTexture.js.map +1 -1
- package/Materials/materialDefines.js +3 -1
- package/Materials/materialDefines.js.map +1 -1
- package/Materials/multiMaterial.js +3 -1
- package/Materials/multiMaterial.js.map +1 -1
- package/Materials/shaderMaterial.js +3 -2
- package/Materials/shaderMaterial.js.map +1 -1
- package/Meshes/Compression/dracoEncoder.js +2 -2
- package/Meshes/Compression/dracoEncoder.js.map +1 -1
- package/Meshes/GaussianSplatting/gaussianSplattingMesh.js +8 -8
- package/Meshes/GaussianSplatting/gaussianSplattingMesh.js.map +1 -1
- package/Meshes/GreasedLine/greasedLineMesh.js +6 -6
- package/Meshes/GreasedLine/greasedLineMesh.js.map +1 -1
- package/Meshes/GreasedLine/greasedLineRibbonMesh.js +4 -3
- package/Meshes/GreasedLine/greasedLineRibbonMesh.js.map +1 -1
- package/Meshes/Node/Blocks/mathBlock.js +3 -1
- package/Meshes/Node/Blocks/mathBlock.js.map +1 -1
- package/Meshes/Node/nodeGeometryBlock.js +8 -5
- package/Meshes/Node/nodeGeometryBlock.js.map +1 -1
- package/Meshes/abstractMesh.js +2 -2
- package/Meshes/abstractMesh.js.map +1 -1
- package/Meshes/geodesicMesh.js +2 -2
- package/Meshes/geodesicMesh.js.map +1 -1
- package/Meshes/mesh.js +6 -6
- package/Meshes/mesh.js.map +1 -1
- package/Meshes/mesh.vertexData.functions.js +11 -10
- package/Meshes/mesh.vertexData.functions.js.map +1 -1
- package/Meshes/mesh.vertexData.subdivide.js +10 -10
- package/Meshes/mesh.vertexData.subdivide.js.map +1 -1
- package/Meshes/meshSimplification.js +10 -10
- package/Meshes/meshSimplification.js.map +1 -1
- package/Meshes/meshUtils.js +6 -3
- package/Meshes/meshUtils.js.map +1 -1
- package/Meshes/polygonMesh.js +10 -10
- package/Meshes/polygonMesh.js.map +1 -1
- package/Misc/PerformanceViewer/performanceViewerCollector.js +4 -4
- package/Misc/PerformanceViewer/performanceViewerCollector.js.map +1 -1
- package/Misc/arrayTools.js +2 -2
- package/Misc/arrayTools.js.map +1 -1
- package/Misc/asyncLock.js +9 -9
- package/Misc/asyncLock.js.map +1 -1
- package/Misc/basis.js +4 -2
- package/Misc/basis.js.map +1 -1
- package/Misc/deepCopier.js +3 -2
- package/Misc/deepCopier.js.map +1 -1
- package/Misc/deepMerger.js +3 -2
- package/Misc/deepMerger.js.map +1 -1
- package/Misc/fileTools.js +4 -4
- package/Misc/fileTools.js.map +1 -1
- package/Misc/greasedLineTools.js +14 -13
- package/Misc/greasedLineTools.js.map +1 -1
- package/Misc/logger.js +3 -2
- package/Misc/logger.js.map +1 -1
- package/Misc/observable.extensions.js +4 -4
- package/Misc/observable.extensions.js.map +1 -1
- package/Misc/sceneSerializer.js +5 -4
- package/Misc/sceneSerializer.js.map +1 -1
- package/Misc/snapshotRenderingHelper.js +3 -1
- package/Misc/snapshotRenderingHelper.js.map +1 -1
- package/Misc/tags.js +2 -2
- package/Misc/tags.js.map +1 -1
- package/Misc/trajectoryClassifier.js +8 -8
- package/Misc/trajectoryClassifier.js.map +1 -1
- package/Particles/IParticleSystem.d.ts +1 -1
- package/Particles/IParticleSystem.js.map +1 -1
- package/Particles/baseParticleSystem.d.ts +11 -3
- package/Particles/baseParticleSystem.js +37 -3
- package/Particles/baseParticleSystem.js.map +1 -1
- package/Particles/gpuParticleSystem.js +1 -14
- package/Particles/gpuParticleSystem.js.map +1 -1
- package/Particles/particle.js +2 -2
- package/Particles/particle.js.map +1 -1
- package/Particles/particleSystem.js +15 -13
- package/Particles/particleSystem.js.map +1 -1
- package/Particles/thinParticleSystem.js +3 -16
- package/Particles/thinParticleSystem.js.map +1 -1
- package/Physics/physicsHelper.js +18 -14
- package/Physics/physicsHelper.js.map +1 -1
- package/Physics/v1/Plugins/ammoJSPlugin.js +10 -8
- package/Physics/v1/Plugins/ammoJSPlugin.js.map +1 -1
- package/Physics/v1/Plugins/cannonJSPlugin.js +13 -8
- package/Physics/v1/Plugins/cannonJSPlugin.js.map +1 -1
- package/Physics/v1/Plugins/oimoJSPlugin.js +9 -8
- package/Physics/v1/Plugins/oimoJSPlugin.js.map +1 -1
- package/Physics/v1/physicsEngine.js +4 -4
- package/Physics/v1/physicsEngine.js.map +1 -1
- package/Physics/v1/physicsImpostor.js +10 -21
- package/Physics/v1/physicsImpostor.js.map +1 -1
- package/Physics/v2/Plugins/havokPlugin.js +12 -10
- package/Physics/v2/Plugins/havokPlugin.js.map +1 -1
- package/Physics/v2/ragdoll.js +4 -4
- package/Physics/v2/ragdoll.js.map +1 -1
- package/PostProcesses/RenderPipeline/Pipelines/standardRenderingPipeline.js +3 -2
- package/PostProcesses/RenderPipeline/Pipelines/standardRenderingPipeline.js.map +1 -1
- package/PostProcesses/RenderPipeline/postProcessRenderEffect.js +8 -6
- package/PostProcesses/RenderPipeline/postProcessRenderEffect.js.map +1 -1
- package/PostProcesses/depthOfFieldMergePostProcess.js +4 -3
- package/PostProcesses/depthOfFieldMergePostProcess.js.map +1 -1
- package/Rendering/GlobalIllumination/giRSMManager.js +6 -6
- package/Rendering/GlobalIllumination/giRSMManager.js.map +1 -1
- package/Rendering/IBLShadows/iblShadowsRenderPipeline.js +14 -14
- package/Rendering/IBLShadows/iblShadowsRenderPipeline.js.map +1 -1
- package/Rendering/IBLShadows/iblShadowsVoxelRenderer.js +14 -12
- package/Rendering/IBLShadows/iblShadowsVoxelRenderer.js.map +1 -1
- package/Rendering/iblCdfGenerator.js +4 -4
- package/Rendering/iblCdfGenerator.js.map +1 -1
- package/Rendering/objectRenderer.js +2 -2
- package/Rendering/objectRenderer.js.map +1 -1
- package/Rendering/reflectiveShadowMap.js +7 -5
- package/Rendering/reflectiveShadowMap.js.map +1 -1
- package/Sprites/spriteMap.js +2 -2
- package/Sprites/spriteMap.js.map +1 -1
- package/XR/features/WebXRAbstractFeature.js +2 -2
- package/XR/features/WebXRAbstractFeature.js.map +1 -1
- package/XR/features/WebXRAnchorSystem.js +4 -4
- package/XR/features/WebXRAnchorSystem.js.map +1 -1
- package/XR/features/WebXRBackgroundRemover.js +3 -1
- package/XR/features/WebXRBackgroundRemover.js.map +1 -1
- package/XR/features/WebXRControllerMovement.js +6 -3
- package/XR/features/WebXRControllerMovement.js.map +1 -1
- package/XR/features/WebXRControllerPhysics.js +12 -7
- package/XR/features/WebXRControllerPhysics.js.map +1 -1
- package/XR/features/WebXRControllerPointerSelection.js +12 -7
- package/XR/features/WebXRControllerPointerSelection.js.map +1 -1
- package/XR/features/WebXRControllerTeleportation.js +11 -7
- package/XR/features/WebXRControllerTeleportation.js.map +1 -1
- package/XR/features/WebXRDepthSensing.js +6 -6
- package/XR/features/WebXRDepthSensing.js.map +1 -1
- package/XR/features/WebXRHandTracking.js +60 -24
- package/XR/features/WebXRHandTracking.js.map +1 -1
- package/XR/features/WebXRHitTest.js +4 -4
- package/XR/features/WebXRHitTest.js.map +1 -1
- package/XR/features/WebXRImageTracking.js +2 -2
- package/XR/features/WebXRImageTracking.js.map +1 -1
- package/XR/features/WebXRLayers.js +2 -2
- package/XR/features/WebXRLayers.js.map +1 -1
- package/XR/features/WebXRNearInteraction.js +12 -7
- package/XR/features/WebXRNearInteraction.js.map +1 -1
- package/XR/features/WebXRRawCameraAccess.js +9 -4
- package/XR/features/WebXRRawCameraAccess.js.map +1 -1
- package/XR/features/WebXRSpaceWarp.js +2 -2
- package/XR/features/WebXRSpaceWarp.js.map +1 -1
- package/XR/motionController/webXRAbstractMotionController.js +19 -8
- package/XR/motionController/webXRAbstractMotionController.js.map +1 -1
- package/XR/motionController/webXRGenericMotionController.js +2 -2
- package/XR/motionController/webXRGenericMotionController.js.map +1 -1
- package/XR/motionController/webXRHTCViveMotionController.js +5 -4
- package/XR/motionController/webXRHTCViveMotionController.js.map +1 -1
- package/XR/motionController/webXRMicrosoftMixedRealityController.js +9 -6
- package/XR/motionController/webXRMicrosoftMixedRealityController.js.map +1 -1
- package/XR/motionController/webXRMotionControllerManager.js +4 -4
- package/XR/motionController/webXRMotionControllerManager.js.map +1 -1
- package/XR/motionController/webXROculusTouchMotionController.js +5 -4
- package/XR/motionController/webXROculusTouchMotionController.js.map +1 -1
- package/XR/motionController/webXRProfiledMotionController.js +15 -10
- package/XR/motionController/webXRProfiledMotionController.js.map +1 -1
- package/XR/webXRCamera.js +3 -2
- package/XR/webXRCamera.js.map +1 -1
- package/XR/webXREnterExitUI.js +5 -4
- package/XR/webXREnterExitUI.js.map +1 -1
- package/XR/webXRExperienceHelper.js +2 -2
- package/XR/webXRExperienceHelper.js.map +1 -1
- package/XR/webXRFeaturesManager.js +10 -7
- package/XR/webXRFeaturesManager.js.map +1 -1
- package/XR/webXRInput.js +8 -8
- package/XR/webXRInput.js.map +1 -1
- package/XR/webXRInputSource.js +4 -1
- package/XR/webXRInputSource.js.map +1 -1
- package/XR/webXRRenderTargetTextureProvider.js +3 -1
- package/XR/webXRRenderTargetTextureProvider.js.map +1 -1
- package/assetContainer.js +156 -135
- package/assetContainer.js.map +1 -1
- package/node.js +2 -2
- package/node.js.map +1 -1
- package/package.json +1 -1
- package/scene.js +18 -11
- package/scene.js.map +1 -1
package/assetContainer.js
CHANGED
|
@@ -131,7 +131,9 @@ export class AbstractAssetContainer {
|
|
|
131
131
|
nodes = nodes.concat(this.lights);
|
|
132
132
|
nodes = nodes.concat(this.cameras);
|
|
133
133
|
nodes = nodes.concat(this.transformNodes); // dummies
|
|
134
|
-
|
|
134
|
+
for (const skeleton of this.skeletons) {
|
|
135
|
+
nodes = nodes.concat(skeleton.bones);
|
|
136
|
+
}
|
|
135
137
|
return nodes;
|
|
136
138
|
}
|
|
137
139
|
}
|
|
@@ -162,18 +164,21 @@ export class InstantiatedEntries {
|
|
|
162
164
|
* Disposes the instantiated entries from the scene
|
|
163
165
|
*/
|
|
164
166
|
dispose() {
|
|
165
|
-
this.rootNodes
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
167
|
+
const rootNodes = this.rootNodes;
|
|
168
|
+
for (const rootNode of rootNodes) {
|
|
169
|
+
rootNode.dispose();
|
|
170
|
+
}
|
|
171
|
+
rootNodes.length = 0;
|
|
172
|
+
const skeletons = this.skeletons;
|
|
173
|
+
for (const skeleton of skeletons) {
|
|
174
|
+
skeleton.dispose();
|
|
175
|
+
}
|
|
176
|
+
skeletons.length = 0;
|
|
177
|
+
const animationGroups = this.animationGroups;
|
|
178
|
+
for (const animationGroup of animationGroups) {
|
|
179
|
+
animationGroup.dispose();
|
|
180
|
+
}
|
|
181
|
+
animationGroups.length = 0;
|
|
177
182
|
}
|
|
178
183
|
}
|
|
179
184
|
/**
|
|
@@ -290,7 +295,9 @@ export class AssetContainer extends AbstractAssetContainer {
|
|
|
290
295
|
}
|
|
291
296
|
if (nodesUidMap.size > 0) {
|
|
292
297
|
Logger.Error("SceneSerializer._topologicalSort: There were unvisited nodes:");
|
|
293
|
-
nodesUidMap.forEach((node) =>
|
|
298
|
+
nodesUidMap.forEach((node) => {
|
|
299
|
+
Logger.Error(node.name);
|
|
300
|
+
});
|
|
294
301
|
}
|
|
295
302
|
return sortedNodes;
|
|
296
303
|
}
|
|
@@ -483,7 +490,7 @@ export class AssetContainer extends AbstractAssetContainer {
|
|
|
483
490
|
result.rootNodes.push(clone);
|
|
484
491
|
}
|
|
485
492
|
};
|
|
486
|
-
|
|
493
|
+
for (const node of sortedNodes) {
|
|
487
494
|
if (node.getClassName() === "InstancedMesh") {
|
|
488
495
|
const instancedNode = node;
|
|
489
496
|
const sourceMesh = instancedNode.sourceMesh;
|
|
@@ -517,10 +524,10 @@ export class AssetContainer extends AbstractAssetContainer {
|
|
|
517
524
|
}
|
|
518
525
|
onNewCreated(node, replicatedNode);
|
|
519
526
|
}
|
|
520
|
-
}
|
|
521
|
-
this.skeletons
|
|
527
|
+
}
|
|
528
|
+
for (const s of this.skeletons) {
|
|
522
529
|
if (localOptions.predicate && !localOptions.predicate(s)) {
|
|
523
|
-
|
|
530
|
+
continue;
|
|
524
531
|
}
|
|
525
532
|
const clone = s.clone(nameFunction ? nameFunction(s.name) : "Clone of " + s.name);
|
|
526
533
|
for (const m of this.meshes) {
|
|
@@ -543,17 +550,17 @@ export class AssetContainer extends AbstractAssetContainer {
|
|
|
543
550
|
}
|
|
544
551
|
}
|
|
545
552
|
result.skeletons.push(clone);
|
|
546
|
-
}
|
|
547
|
-
this.animationGroups
|
|
553
|
+
}
|
|
554
|
+
for (const o of this.animationGroups) {
|
|
548
555
|
if (localOptions.predicate && !localOptions.predicate(o)) {
|
|
549
|
-
|
|
556
|
+
continue;
|
|
550
557
|
}
|
|
551
558
|
const clone = o.clone(nameFunction ? nameFunction(o.name) : "Clone of " + o.name, (oldTarget) => {
|
|
552
559
|
const newTarget = storeMap[conversionMap[oldTarget.uniqueId]];
|
|
553
560
|
return newTarget || oldTarget;
|
|
554
561
|
});
|
|
555
562
|
result.animationGroups.push(clone);
|
|
556
|
-
}
|
|
563
|
+
}
|
|
557
564
|
return result;
|
|
558
565
|
}
|
|
559
566
|
/**
|
|
@@ -583,94 +590,94 @@ export class AssetContainer extends AbstractAssetContainer {
|
|
|
583
590
|
*/
|
|
584
591
|
addToScene(predicate = null) {
|
|
585
592
|
const addedNodes = [];
|
|
586
|
-
this.cameras
|
|
593
|
+
for (const o of this.cameras) {
|
|
587
594
|
if (predicate && !predicate(o)) {
|
|
588
595
|
return;
|
|
589
596
|
}
|
|
590
597
|
this.scene.addCamera(o);
|
|
591
598
|
addedNodes.push(o);
|
|
592
|
-
}
|
|
593
|
-
this.lights
|
|
599
|
+
}
|
|
600
|
+
for (const o of this.lights) {
|
|
594
601
|
if (predicate && !predicate(o)) {
|
|
595
602
|
return;
|
|
596
603
|
}
|
|
597
604
|
this.scene.addLight(o);
|
|
598
605
|
addedNodes.push(o);
|
|
599
|
-
}
|
|
600
|
-
this.meshes
|
|
606
|
+
}
|
|
607
|
+
for (const o of this.meshes) {
|
|
601
608
|
if (predicate && !predicate(o)) {
|
|
602
609
|
return;
|
|
603
610
|
}
|
|
604
611
|
this.scene.addMesh(o);
|
|
605
612
|
addedNodes.push(o);
|
|
606
|
-
}
|
|
607
|
-
this.skeletons
|
|
613
|
+
}
|
|
614
|
+
for (const o of this.skeletons) {
|
|
608
615
|
if (predicate && !predicate(o)) {
|
|
609
616
|
return;
|
|
610
617
|
}
|
|
611
618
|
this.scene.addSkeleton(o);
|
|
612
|
-
}
|
|
613
|
-
this.animations
|
|
619
|
+
}
|
|
620
|
+
for (const o of this.animations) {
|
|
614
621
|
if (predicate && !predicate(o)) {
|
|
615
622
|
return;
|
|
616
623
|
}
|
|
617
624
|
this.scene.addAnimation(o);
|
|
618
|
-
}
|
|
619
|
-
this.animationGroups
|
|
625
|
+
}
|
|
626
|
+
for (const o of this.animationGroups) {
|
|
620
627
|
if (predicate && !predicate(o)) {
|
|
621
628
|
return;
|
|
622
629
|
}
|
|
623
630
|
this.scene.addAnimationGroup(o);
|
|
624
|
-
}
|
|
625
|
-
this.multiMaterials
|
|
631
|
+
}
|
|
632
|
+
for (const o of this.multiMaterials) {
|
|
626
633
|
if (predicate && !predicate(o)) {
|
|
627
634
|
return;
|
|
628
635
|
}
|
|
629
636
|
this.scene.addMultiMaterial(o);
|
|
630
|
-
}
|
|
631
|
-
this.materials
|
|
637
|
+
}
|
|
638
|
+
for (const o of this.materials) {
|
|
632
639
|
if (predicate && !predicate(o)) {
|
|
633
640
|
return;
|
|
634
641
|
}
|
|
635
642
|
this.scene.addMaterial(o);
|
|
636
|
-
}
|
|
637
|
-
this.morphTargetManagers
|
|
643
|
+
}
|
|
644
|
+
for (const o of this.morphTargetManagers) {
|
|
638
645
|
if (predicate && !predicate(o)) {
|
|
639
646
|
return;
|
|
640
647
|
}
|
|
641
648
|
this.scene.addMorphTargetManager(o);
|
|
642
|
-
}
|
|
643
|
-
this.geometries
|
|
649
|
+
}
|
|
650
|
+
for (const o of this.geometries) {
|
|
644
651
|
if (predicate && !predicate(o)) {
|
|
645
652
|
return;
|
|
646
653
|
}
|
|
647
654
|
this.scene.addGeometry(o);
|
|
648
|
-
}
|
|
649
|
-
this.transformNodes
|
|
655
|
+
}
|
|
656
|
+
for (const o of this.transformNodes) {
|
|
650
657
|
if (predicate && !predicate(o)) {
|
|
651
658
|
return;
|
|
652
659
|
}
|
|
653
660
|
this.scene.addTransformNode(o);
|
|
654
661
|
addedNodes.push(o);
|
|
655
|
-
}
|
|
656
|
-
this.actionManagers
|
|
662
|
+
}
|
|
663
|
+
for (const o of this.actionManagers) {
|
|
657
664
|
if (predicate && !predicate(o)) {
|
|
658
665
|
return;
|
|
659
666
|
}
|
|
660
667
|
this.scene.addActionManager(o);
|
|
661
|
-
}
|
|
662
|
-
this.textures
|
|
668
|
+
}
|
|
669
|
+
for (const o of this.textures) {
|
|
663
670
|
if (predicate && !predicate(o)) {
|
|
664
671
|
return;
|
|
665
672
|
}
|
|
666
673
|
this.scene.addTexture(o);
|
|
667
|
-
}
|
|
668
|
-
this.reflectionProbes
|
|
674
|
+
}
|
|
675
|
+
for (const o of this.reflectionProbes) {
|
|
669
676
|
if (predicate && !predicate(o)) {
|
|
670
677
|
return;
|
|
671
678
|
}
|
|
672
679
|
this.scene.addReflectionProbe(o);
|
|
673
|
-
}
|
|
680
|
+
}
|
|
674
681
|
for (const addedNode of addedNodes) {
|
|
675
682
|
// If node was added to the scene, but parent is not in the scene, break the relationship
|
|
676
683
|
if (addedNode.parent && this.scene.getNodes().indexOf(addedNode.parent) === -1) {
|
|
@@ -705,146 +712,159 @@ export class AssetContainer extends AbstractAssetContainer {
|
|
|
705
712
|
* @param predicate defines a predicate used to select which entity will be added (can be null)
|
|
706
713
|
*/
|
|
707
714
|
removeFromScene(predicate = null) {
|
|
708
|
-
this.cameras
|
|
715
|
+
for (const o of this.cameras) {
|
|
709
716
|
if (predicate && !predicate(o)) {
|
|
710
717
|
return;
|
|
711
718
|
}
|
|
712
719
|
this.scene.removeCamera(o);
|
|
713
|
-
}
|
|
714
|
-
this.lights
|
|
720
|
+
}
|
|
721
|
+
for (const o of this.lights) {
|
|
715
722
|
if (predicate && !predicate(o)) {
|
|
716
723
|
return;
|
|
717
724
|
}
|
|
718
725
|
this.scene.removeLight(o);
|
|
719
|
-
}
|
|
720
|
-
this.meshes
|
|
726
|
+
}
|
|
727
|
+
for (const o of this.meshes) {
|
|
721
728
|
if (predicate && !predicate(o)) {
|
|
722
729
|
return;
|
|
723
730
|
}
|
|
724
731
|
this.scene.removeMesh(o, true);
|
|
725
|
-
}
|
|
726
|
-
this.skeletons
|
|
732
|
+
}
|
|
733
|
+
for (const o of this.skeletons) {
|
|
727
734
|
if (predicate && !predicate(o)) {
|
|
728
735
|
return;
|
|
729
736
|
}
|
|
730
737
|
this.scene.removeSkeleton(o);
|
|
731
|
-
}
|
|
732
|
-
this.animations
|
|
738
|
+
}
|
|
739
|
+
for (const o of this.animations) {
|
|
733
740
|
if (predicate && !predicate(o)) {
|
|
734
741
|
return;
|
|
735
742
|
}
|
|
736
743
|
this.scene.removeAnimation(o);
|
|
737
|
-
}
|
|
738
|
-
this.animationGroups
|
|
744
|
+
}
|
|
745
|
+
for (const o of this.animationGroups) {
|
|
739
746
|
if (predicate && !predicate(o)) {
|
|
740
747
|
return;
|
|
741
748
|
}
|
|
742
749
|
this.scene.removeAnimationGroup(o);
|
|
743
|
-
}
|
|
744
|
-
this.multiMaterials
|
|
750
|
+
}
|
|
751
|
+
for (const o of this.multiMaterials) {
|
|
745
752
|
if (predicate && !predicate(o)) {
|
|
746
753
|
return;
|
|
747
754
|
}
|
|
748
755
|
this.scene.removeMultiMaterial(o);
|
|
749
|
-
}
|
|
750
|
-
this.materials
|
|
756
|
+
}
|
|
757
|
+
for (const o of this.materials) {
|
|
751
758
|
if (predicate && !predicate(o)) {
|
|
752
759
|
return;
|
|
753
760
|
}
|
|
754
761
|
this.scene.removeMaterial(o);
|
|
755
|
-
}
|
|
756
|
-
this.morphTargetManagers
|
|
762
|
+
}
|
|
763
|
+
for (const o of this.morphTargetManagers) {
|
|
757
764
|
if (predicate && !predicate(o)) {
|
|
758
765
|
return;
|
|
759
766
|
}
|
|
760
767
|
this.scene.removeMorphTargetManager(o);
|
|
761
|
-
}
|
|
762
|
-
this.geometries
|
|
768
|
+
}
|
|
769
|
+
for (const o of this.geometries) {
|
|
763
770
|
if (predicate && !predicate(o)) {
|
|
764
771
|
return;
|
|
765
772
|
}
|
|
766
773
|
this.scene.removeGeometry(o);
|
|
767
|
-
}
|
|
768
|
-
this.transformNodes
|
|
774
|
+
}
|
|
775
|
+
for (const o of this.transformNodes) {
|
|
769
776
|
if (predicate && !predicate(o)) {
|
|
770
777
|
return;
|
|
771
778
|
}
|
|
772
779
|
this.scene.removeTransformNode(o);
|
|
773
|
-
}
|
|
774
|
-
this.actionManagers
|
|
780
|
+
}
|
|
781
|
+
for (const o of this.actionManagers) {
|
|
775
782
|
if (predicate && !predicate(o)) {
|
|
776
783
|
return;
|
|
777
784
|
}
|
|
778
785
|
this.scene.removeActionManager(o);
|
|
779
|
-
}
|
|
780
|
-
this.textures
|
|
786
|
+
}
|
|
787
|
+
for (const o of this.textures) {
|
|
781
788
|
if (predicate && !predicate(o)) {
|
|
782
789
|
return;
|
|
783
790
|
}
|
|
784
791
|
this.scene.removeTexture(o);
|
|
785
|
-
}
|
|
786
|
-
this.reflectionProbes
|
|
792
|
+
}
|
|
793
|
+
for (const o of this.reflectionProbes) {
|
|
787
794
|
if (predicate && !predicate(o)) {
|
|
788
795
|
return;
|
|
789
796
|
}
|
|
790
797
|
this.scene.removeReflectionProbe(o);
|
|
791
|
-
}
|
|
798
|
+
}
|
|
792
799
|
}
|
|
793
800
|
/**
|
|
794
801
|
* Disposes all the assets in the container
|
|
795
802
|
*/
|
|
796
803
|
dispose() {
|
|
797
|
-
this.cameras
|
|
798
|
-
|
|
799
|
-
|
|
804
|
+
const cameras = this.cameras;
|
|
805
|
+
for (const camera of cameras) {
|
|
806
|
+
camera.dispose();
|
|
807
|
+
}
|
|
800
808
|
this.cameras.length = 0;
|
|
801
|
-
this.lights
|
|
802
|
-
|
|
803
|
-
|
|
809
|
+
const lights = this.lights;
|
|
810
|
+
for (const light of lights) {
|
|
811
|
+
light.dispose();
|
|
812
|
+
}
|
|
804
813
|
this.lights.length = 0;
|
|
805
|
-
this.meshes
|
|
806
|
-
|
|
807
|
-
|
|
814
|
+
const meshes = this.meshes;
|
|
815
|
+
for (const mesh of meshes) {
|
|
816
|
+
mesh.dispose();
|
|
817
|
+
}
|
|
808
818
|
this.meshes.length = 0;
|
|
809
|
-
this.skeletons
|
|
810
|
-
|
|
811
|
-
|
|
819
|
+
const skeletons = this.skeletons;
|
|
820
|
+
for (const skeleton of skeletons) {
|
|
821
|
+
skeleton.dispose();
|
|
822
|
+
}
|
|
812
823
|
this.skeletons.length = 0;
|
|
813
|
-
this.animationGroups
|
|
814
|
-
|
|
815
|
-
|
|
824
|
+
const animationGroups = this.animationGroups;
|
|
825
|
+
for (const animationGroup of animationGroups) {
|
|
826
|
+
animationGroup.dispose();
|
|
827
|
+
}
|
|
816
828
|
this.animationGroups.length = 0;
|
|
817
|
-
this.multiMaterials
|
|
818
|
-
|
|
819
|
-
|
|
829
|
+
const multiMaterials = this.multiMaterials;
|
|
830
|
+
for (const multiMaterial of multiMaterials) {
|
|
831
|
+
multiMaterial.dispose();
|
|
832
|
+
}
|
|
820
833
|
this.multiMaterials.length = 0;
|
|
821
|
-
this.materials
|
|
822
|
-
|
|
823
|
-
|
|
834
|
+
const materials = this.materials;
|
|
835
|
+
for (const material of materials) {
|
|
836
|
+
material.dispose();
|
|
837
|
+
}
|
|
824
838
|
this.materials.length = 0;
|
|
825
|
-
this.geometries
|
|
826
|
-
|
|
827
|
-
|
|
839
|
+
const geometries = this.geometries;
|
|
840
|
+
for (const geometry of geometries) {
|
|
841
|
+
geometry.dispose();
|
|
842
|
+
}
|
|
828
843
|
this.geometries.length = 0;
|
|
829
|
-
this.transformNodes
|
|
830
|
-
|
|
831
|
-
|
|
844
|
+
const transformNodes = this.transformNodes;
|
|
845
|
+
for (const transformNode of transformNodes) {
|
|
846
|
+
transformNode.dispose();
|
|
847
|
+
}
|
|
832
848
|
this.transformNodes.length = 0;
|
|
833
|
-
this.actionManagers
|
|
834
|
-
|
|
835
|
-
|
|
849
|
+
const actionManagers = this.actionManagers;
|
|
850
|
+
for (const actionManager of actionManagers) {
|
|
851
|
+
actionManager.dispose();
|
|
852
|
+
}
|
|
836
853
|
this.actionManagers.length = 0;
|
|
837
|
-
this.textures
|
|
838
|
-
|
|
839
|
-
|
|
854
|
+
const textures = this.textures;
|
|
855
|
+
for (const texture of textures) {
|
|
856
|
+
texture.dispose();
|
|
857
|
+
}
|
|
840
858
|
this.textures.length = 0;
|
|
841
|
-
this.reflectionProbes
|
|
842
|
-
|
|
843
|
-
|
|
859
|
+
const reflectionProbes = this.reflectionProbes;
|
|
860
|
+
for (const reflectionProbe of reflectionProbes) {
|
|
861
|
+
reflectionProbe.dispose();
|
|
862
|
+
}
|
|
844
863
|
this.reflectionProbes.length = 0;
|
|
845
|
-
this.morphTargetManagers
|
|
846
|
-
|
|
847
|
-
|
|
864
|
+
const morphTargetManagers = this.morphTargetManagers;
|
|
865
|
+
for (const morphTargetManager of morphTargetManagers) {
|
|
866
|
+
morphTargetManager.dispose();
|
|
867
|
+
}
|
|
848
868
|
this.morphTargetManagers.length = 0;
|
|
849
869
|
if (this.environmentTexture) {
|
|
850
870
|
this.environmentTexture.dispose();
|
|
@@ -902,11 +922,11 @@ export class AssetContainer extends AbstractAssetContainer {
|
|
|
902
922
|
*/
|
|
903
923
|
createRootMesh() {
|
|
904
924
|
const rootMesh = new Mesh("assetContainerRootMesh", this.scene);
|
|
905
|
-
this.meshes
|
|
925
|
+
for (const m of this.meshes) {
|
|
906
926
|
if (!m.parent) {
|
|
907
927
|
rootMesh.addChild(m);
|
|
908
928
|
}
|
|
909
|
-
}
|
|
929
|
+
}
|
|
910
930
|
this.meshes.unshift(rootMesh);
|
|
911
931
|
return rootMesh;
|
|
912
932
|
}
|
|
@@ -951,7 +971,7 @@ export class AssetContainer extends AbstractAssetContainer {
|
|
|
951
971
|
};
|
|
952
972
|
// Copy new node animations
|
|
953
973
|
const nodesInAC = this.getNodes();
|
|
954
|
-
|
|
974
|
+
for (const nodeInAC of nodesInAC) {
|
|
955
975
|
const nodeInScene = _targetConverter(nodeInAC);
|
|
956
976
|
if (nodeInScene !== null) {
|
|
957
977
|
// Remove old animations with same target property as a new one
|
|
@@ -970,19 +990,20 @@ export class AssetContainer extends AbstractAssetContainer {
|
|
|
970
990
|
// Append new animations
|
|
971
991
|
nodeInScene.animations = nodeInScene.animations.concat(nodeInAC.animations);
|
|
972
992
|
}
|
|
973
|
-
}
|
|
993
|
+
}
|
|
974
994
|
const newAnimationGroups = [];
|
|
975
995
|
// Copy new animation groups
|
|
976
|
-
this.animationGroups.slice()
|
|
996
|
+
const animationGroups = this.animationGroups.slice();
|
|
997
|
+
for (const animationGroupInAC of animationGroups) {
|
|
977
998
|
// Clone the animation group and all its animatables
|
|
978
999
|
newAnimationGroups.push(animationGroupInAC.clone(animationGroupInAC.name, _targetConverter));
|
|
979
1000
|
// Remove animatables related to the asset container
|
|
980
|
-
animationGroupInAC.animatables
|
|
1001
|
+
for (const animatable of animationGroupInAC.animatables) {
|
|
981
1002
|
animatable.stop();
|
|
982
|
-
}
|
|
983
|
-
}
|
|
1003
|
+
}
|
|
1004
|
+
}
|
|
984
1005
|
// Retarget animatables
|
|
985
|
-
|
|
1006
|
+
for (const animatable of animatables) {
|
|
986
1007
|
const target = _targetConverter(animatable.target);
|
|
987
1008
|
if (target) {
|
|
988
1009
|
// Clone the animatable and retarget it
|
|
@@ -990,7 +1011,7 @@ export class AssetContainer extends AbstractAssetContainer {
|
|
|
990
1011
|
// Stop animation for the target in the asset container
|
|
991
1012
|
scene.stopAnimation(animatable.target);
|
|
992
1013
|
}
|
|
993
|
-
}
|
|
1014
|
+
}
|
|
994
1015
|
return newAnimationGroups;
|
|
995
1016
|
}
|
|
996
1017
|
/**
|
|
@@ -1001,26 +1022,26 @@ export class AssetContainer extends AbstractAssetContainer {
|
|
|
1001
1022
|
*/
|
|
1002
1023
|
populateRootNodes() {
|
|
1003
1024
|
this.rootNodes.length = 0;
|
|
1004
|
-
this.meshes
|
|
1025
|
+
for (const m of this.meshes) {
|
|
1005
1026
|
if (!m.parent && this.rootNodes.indexOf(m) === -1) {
|
|
1006
1027
|
this.rootNodes.push(m);
|
|
1007
1028
|
}
|
|
1008
|
-
}
|
|
1009
|
-
this.transformNodes
|
|
1029
|
+
}
|
|
1030
|
+
for (const t of this.transformNodes) {
|
|
1010
1031
|
if (!t.parent && this.rootNodes.indexOf(t) === -1) {
|
|
1011
1032
|
this.rootNodes.push(t);
|
|
1012
1033
|
}
|
|
1013
|
-
}
|
|
1014
|
-
this.lights
|
|
1034
|
+
}
|
|
1035
|
+
for (const l of this.lights) {
|
|
1015
1036
|
if (!l.parent && this.rootNodes.indexOf(l) === -1) {
|
|
1016
1037
|
this.rootNodes.push(l);
|
|
1017
1038
|
}
|
|
1018
|
-
}
|
|
1019
|
-
this.cameras
|
|
1039
|
+
}
|
|
1040
|
+
for (const c of this.cameras) {
|
|
1020
1041
|
if (!c.parent && this.rootNodes.indexOf(c) === -1) {
|
|
1021
1042
|
this.rootNodes.push(c);
|
|
1022
1043
|
}
|
|
1023
|
-
}
|
|
1044
|
+
}
|
|
1024
1045
|
}
|
|
1025
1046
|
/**
|
|
1026
1047
|
* @since 6.26.0
|