@babylonjs/core 5.17.1 → 5.20.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/Debug/debugLayer.d.ts +36 -0
- package/Debug/debugLayer.js.map +1 -1
- package/DeviceInput/InputDevices/deviceSource.d.ts +1 -1
- package/DeviceInput/InputDevices/deviceSource.js.map +1 -1
- package/DeviceInput/InputDevices/deviceSourceManager.d.ts +1 -1
- package/DeviceInput/InputDevices/deviceSourceManager.js +1 -1
- package/DeviceInput/InputDevices/deviceSourceManager.js.map +1 -1
- package/DeviceInput/{Helpers/eventFactory.d.ts → eventFactory.d.ts} +4 -4
- package/DeviceInput/{Helpers/eventFactory.js → eventFactory.js} +2 -2
- package/DeviceInput/eventFactory.js.map +1 -0
- package/DeviceInput/{InputDevices/inputInterfaces.d.ts → inputInterfaces.d.ts} +2 -2
- package/DeviceInput/{InputDevices/inputInterfaces.js → inputInterfaces.js} +0 -0
- package/DeviceInput/inputInterfaces.js.map +1 -0
- package/DeviceInput/{InputDevices/internalDeviceSourceManager.d.ts → internalDeviceSourceManager.d.ts} +7 -7
- package/DeviceInput/{InputDevices/internalDeviceSourceManager.js → internalDeviceSourceManager.js} +2 -2
- package/DeviceInput/internalDeviceSourceManager.js.map +1 -0
- package/DeviceInput/{InputDevices/nativeDeviceInputSystem.d.ts → nativeDeviceInputSystem.d.ts} +2 -2
- package/DeviceInput/{InputDevices/nativeDeviceInputSystem.js → nativeDeviceInputSystem.js} +2 -2
- package/DeviceInput/nativeDeviceInputSystem.js.map +1 -0
- package/DeviceInput/{InputDevices/webDeviceInputSystem.d.ts → webDeviceInputSystem.d.ts} +3 -3
- package/DeviceInput/{InputDevices/webDeviceInputSystem.js → webDeviceInputSystem.js} +4 -4
- package/DeviceInput/webDeviceInputSystem.js.map +1 -0
- package/Engines/Extensions/engine.query.js +5 -1
- package/Engines/Extensions/engine.query.js.map +1 -1
- package/Engines/Extensions/engine.transformFeedback.js +5 -1
- package/Engines/Extensions/engine.transformFeedback.js.map +1 -1
- package/Engines/Extensions/engine.views.d.ts +13 -0
- package/Engines/Extensions/engine.views.js +16 -1
- package/Engines/Extensions/engine.views.js.map +1 -1
- package/Engines/Native/nativeInterfaces.d.ts +1 -1
- package/Engines/Native/nativeInterfaces.js.map +1 -1
- package/Engines/engine.d.ts +15 -240
- package/Engines/engineFeatures.d.ts +2 -0
- package/Engines/engineFeatures.js.map +1 -1
- package/Engines/nativeEngine.js +1 -0
- package/Engines/nativeEngine.js.map +1 -1
- package/Engines/nullEngine.js +1 -0
- package/Engines/nullEngine.js.map +1 -1
- package/Engines/thinEngine.d.ts +1 -1
- package/Engines/thinEngine.js +14 -4
- package/Engines/thinEngine.js.map +1 -1
- package/Engines/webgpuEngine.js +1 -0
- package/Engines/webgpuEngine.js.map +1 -1
- package/Gizmos/axisDragGizmo.d.ts +31 -9
- package/Gizmos/axisDragGizmo.js.map +1 -1
- package/Gizmos/axisScaleGizmo.d.ts +46 -14
- package/Gizmos/axisScaleGizmo.js.map +1 -1
- package/Gizmos/boundingBoxGizmo.d.ts +94 -19
- package/Gizmos/boundingBoxGizmo.js.map +1 -1
- package/Gizmos/cameraGizmo.d.ts +23 -6
- package/Gizmos/cameraGizmo.js.map +1 -1
- package/Gizmos/gizmo.d.ts +48 -6
- package/Gizmos/gizmo.js.map +1 -1
- package/Gizmos/gizmoManager.d.ts +25 -17
- package/Gizmos/gizmoManager.js.map +1 -1
- package/Gizmos/lightGizmo.d.ts +25 -8
- package/Gizmos/lightGizmo.js.map +1 -1
- package/Gizmos/planeDragGizmo.d.ts +30 -9
- package/Gizmos/planeDragGizmo.js.map +1 -1
- package/Gizmos/planeRotationGizmo.d.ts +45 -15
- package/Gizmos/planeRotationGizmo.js.map +1 -1
- package/Gizmos/positionGizmo.d.ts +53 -17
- package/Gizmos/positionGizmo.js +1 -1
- package/Gizmos/positionGizmo.js.map +1 -1
- package/Gizmos/rotationGizmo.d.ts +35 -10
- package/Gizmos/rotationGizmo.js.map +1 -1
- package/Gizmos/scaleGizmo.d.ts +49 -18
- package/Gizmos/scaleGizmo.js.map +1 -1
- package/Loading/Plugins/babylonFileLoader.js +16 -4
- package/Loading/Plugins/babylonFileLoader.js.map +1 -1
- package/Materials/Node/Blocks/Fragment/heightToNormalBlock.d.ts +39 -0
- package/Materials/Node/Blocks/Fragment/heightToNormalBlock.js +97 -0
- package/Materials/Node/Blocks/Fragment/heightToNormalBlock.js.map +1 -0
- package/Materials/Node/Blocks/Fragment/index.d.ts +1 -0
- package/Materials/Node/Blocks/Fragment/index.js +1 -0
- package/Materials/Node/Blocks/Fragment/index.js.map +1 -1
- package/Materials/Node/Blocks/Vertex/lightInformationBlock.d.ts +18 -0
- package/Materials/Node/Blocks/Vertex/lightInformationBlock.js +85 -1
- package/Materials/Node/Blocks/Vertex/lightInformationBlock.js.map +1 -1
- package/Materials/Node/nodeMaterial.d.ts +6 -0
- package/Materials/Node/nodeMaterial.js +11 -0
- package/Materials/Node/nodeMaterial.js.map +1 -1
- package/Materials/Textures/Procedurals/proceduralTexture.js +5 -1
- package/Materials/Textures/Procedurals/proceduralTexture.js.map +1 -1
- package/Materials/Textures/renderTargetTexture.js +3 -0
- package/Materials/Textures/renderTargetTexture.js.map +1 -1
- package/Materials/Textures/texture.js +9 -5
- package/Materials/Textures/texture.js.map +1 -1
- package/Materials/index.d.ts +1 -0
- package/Materials/index.js +1 -0
- package/Materials/index.js.map +1 -1
- package/Maths/math.vector.d.ts +134 -8
- package/Maths/math.vector.js +168 -36
- package/Maths/math.vector.js.map +1 -1
- package/Meshes/Compression/dracoCompression.js +1 -1
- package/Meshes/Compression/dracoCompression.js.map +1 -1
- package/Meshes/groundMesh.js +1 -1
- package/Meshes/groundMesh.js.map +1 -1
- package/Meshes/mesh.js +1 -0
- package/Meshes/mesh.js.map +1 -1
- package/Meshes/transformNode.js +1 -0
- package/Meshes/transformNode.js.map +1 -1
- package/Misc/assetsManager.d.ts +9 -0
- package/Misc/assetsManager.js +3 -1
- package/Misc/assetsManager.js.map +1 -1
- package/Misc/basis.js +10 -4
- package/Misc/basis.js.map +1 -1
- package/Misc/computePressure.d.ts +9 -3
- package/Misc/computePressure.js +13 -5
- package/Misc/computePressure.js.map +1 -1
- package/Misc/fileTools.js +2 -2
- package/Misc/fileTools.js.map +1 -1
- package/Misc/iInspectable.d.ts +12 -2
- package/Misc/iInspectable.js +4 -0
- package/Misc/iInspectable.js.map +1 -1
- package/Misc/khronosTextureContainer2.js +1 -1
- package/Misc/khronosTextureContainer2.js.map +1 -1
- package/Misc/sceneSerializer.js +1 -1
- package/Misc/sceneSerializer.js.map +1 -1
- package/Misc/tools.d.ts +2 -2
- package/Misc/tools.js +4 -1
- package/Misc/tools.js.map +1 -1
- package/Offline/database.js +6 -8
- package/Offline/database.js.map +1 -1
- package/Particles/solidParticleSystem.d.ts +1 -0
- package/Particles/solidParticleSystem.js +4 -1
- package/Particles/solidParticleSystem.js.map +1 -1
- package/Physics/Plugins/ammoJSPlugin.d.ts +2 -2
- package/Physics/Plugins/ammoJSPlugin.js +29 -29
- package/Physics/Plugins/ammoJSPlugin.js.map +1 -1
- package/Physics/Plugins/cannonJSPlugin.d.ts +2 -2
- package/Physics/Plugins/cannonJSPlugin.js +26 -26
- package/Physics/Plugins/cannonJSPlugin.js.map +1 -1
- package/Physics/Plugins/oimoJSPlugin.js +9 -11
- package/Physics/Plugins/oimoJSPlugin.js.map +1 -1
- package/Physics/physicsImpostor.d.ts +6 -6
- package/Physics/physicsImpostor.js +15 -8
- package/Physics/physicsImpostor.js.map +1 -1
- package/Shaders/sprites.fragment.js +1 -1
- package/Shaders/sprites.fragment.js.map +1 -1
- package/Sprites/spriteRenderer.js +1 -1
- package/Sprites/spriteRenderer.js.map +1 -1
- package/XR/webXRDefaultExperience.d.ts +10 -0
- package/XR/webXRDefaultExperience.js +2 -12
- package/XR/webXRDefaultExperience.js.map +1 -1
- package/XR/webXRExperienceHelper.js +12 -12
- package/XR/webXRExperienceHelper.js.map +1 -1
- package/node.d.ts +2 -0
- package/node.js +2 -0
- package/node.js.map +1 -1
- package/package.json +1 -1
- package/scene.d.ts +1 -1
- package/scene.js +5 -3
- package/scene.js.map +1 -1
- package/DeviceInput/Helpers/eventFactory.js.map +0 -1
- package/DeviceInput/InputDevices/inputInterfaces.js.map +0 -1
- package/DeviceInput/InputDevices/internalDeviceSourceManager.js.map +0 -1
- package/DeviceInput/InputDevices/nativeDeviceInputSystem.js.map +0 -1
- package/DeviceInput/InputDevices/webDeviceInputSystem.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webXRDefaultExperience.js","sourceRoot":"","sources":["../../../../../lts/core/generated/XR/webXRDefaultExperience.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAGhE,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C,OAAO,EAAE,+BAA+B,EAAE,MAAM,4CAA4C,CAAC;AAE7F,OAAO,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AAGvE,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAItD,OAAO,EAAE,kCAAkC,EAAE,MAAM,yCAAyC,CAAC;AAC7F,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAExC;;GAEG;AACH;IAAA;IA4DA,CAAC;IAAD,oCAAC;AAAD,CAAC,AA5DD,IA4DC;;AAED;;GAEG;AACH;IA+BI;IAAuB,CAAC;IAExB;;;;;OAKG;IACW,kCAAW,GAAzB,UAA0B,KAAY,EAAE,OAA2C;QAA3C,wBAAA,EAAA,YAA2C;QAC/E,IAAM,MAAM,GAAG,IAAI,sBAAsB,EAAE,CAAC;QAC5C,KAAK,CAAC,mBAAmB,CAAC,OAAO,CAAC;YAC9B,MAAM,CAAC,OAAO,EAAE,CAAC;QACrB,CAAC,CAAC,CAAC;QACH,uCAAuC;QACvC,IAAI,CAAC,OAAO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;YAE7G,IAAI,CAAC,OAAO,CAAC,gBAAgB,EAAE;gBAC3B,oCAAoC;gBACpC,OAAO,MAAM,CAAC,WAAW,CAAC,cAAc,CAAC,MAAM,CAAC,cAAc,EAAE,MAAM,CAAC,YAAY,CAAC,CAAC;aACxF;iBAAM;gBACH,OAAO;aACV;QACL,CAAC,CAAC;aACD,IAAI,CAAC;YACF,OAAO,MAAM,CAAC;QAClB,CAAC,CAAC;aACD,KAAK,CAAC,UAAC,KAAK;YACT,MAAM,CAAC,KAAK,CAAC,uBAAuB,CAAC,CAAC;YACtC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;YACpB,OAAO,MAAM,CAAC;QAClB,CAAC,CAAC,CAAC;IACX,CAAC;IAED;;OAEG;IACI,wCAAO,GAAd;QACI,IAAI,IAAI,CAAC,cAAc,EAAE;YACrB,IAAI,CAAC,cAAc,CAAC,OAAO,EAAE,CAAC;SACjC;QACD,IAAI,IAAI,CAAC,KAAK,EAAE;YACZ,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC;SACxB;QACD,IAAI,IAAI,CAAC,WAAW,EAAE;YAClB,IAAI,CAAC,WAAW,CAAC,OAAO,EAAE,CAAC;SAC9B;QACD,IAAI,IAAI,CAAC,YAAY,EAAE;YACnB,IAAI,CAAC,YAAY,CAAC,OAAO,EAAE,CAAC;SAC/B;IACL,CAAC;IACL,6BAAC;AAAD,CAAC,AAhKD,IAgKC","sourcesContent":["import { WebXRExperienceHelper } from \"./webXRExperienceHelper\";\r\nimport type { Scene } from \"../scene\";\r\nimport type { IWebXRInputOptions } from \"./webXRInput\";\r\nimport { WebXRInput } from \"./webXRInput\";\r\nimport type { IWebXRControllerPointerSelectionOptions } from \"./features/WebXRControllerPointerSelection\";\r\nimport { WebXRControllerPointerSelection } from \"./features/WebXRControllerPointerSelection\";\r\nimport type { IWebXRNearInteractionOptions } from \"./features/WebXRNearInteraction\";\r\nimport { WebXRNearInteraction } from \"./features/WebXRNearInteraction\";\r\nimport type { WebXRRenderTarget } from \"./webXRTypes\";\r\nimport type { WebXREnterExitUIOptions } from \"./webXREnterExitUI\";\r\nimport { WebXREnterExitUI } from \"./webXREnterExitUI\";\r\nimport type { AbstractMesh } from \"../Meshes/abstractMesh\";\r\nimport type { WebXRManagedOutputCanvasOptions } from \"./webXRManagedOutputCanvas\";\r\nimport type { IWebXRTeleportationOptions } from \"./features/WebXRControllerTeleportation\";\r\nimport { WebXRMotionControllerTeleportation } from \"./features/WebXRControllerTeleportation\";\r\nimport { Logger } from \"../Misc/logger\";\r\n\r\n/**\r\n * Options for the default xr helper\r\n */\r\nexport class WebXRDefaultExperienceOptions {\r\n /**\r\n * Enable or disable default UI to enter XR\r\n */\r\n public disableDefaultUI?: boolean;\r\n /**\r\n * Should pointer selection not initialize.\r\n * Note that disabling pointer selection also disables teleportation.\r\n * Defaults to false.\r\n */\r\n public disablePointerSelection?: boolean;\r\n /**\r\n * Should teleportation not initialize. Defaults to false.\r\n */\r\n public disableTeleportation?: boolean;\r\n /**\r\n * Should nearInteraction not initialize. Defaults to false.\r\n */\r\n public disableNearInteraction?: boolean;\r\n /**\r\n * Floor meshes that will be used for teleport\r\n */\r\n public floorMeshes?: Array<AbstractMesh>;\r\n /**\r\n * If set to true, the first frame will not be used to reset position\r\n * The first frame is mainly used when copying transformation from the old camera\r\n * Mainly used in AR\r\n */\r\n public ignoreNativeCameraTransformation?: boolean;\r\n /**\r\n * Disable the controller mesh-loading. Can be used if you want to load your own meshes\r\n */\r\n public inputOptions?: IWebXRInputOptions;\r\n /**\r\n * optional configuration for pointer selection\r\n */\r\n public pointerSelectionOptions?: IWebXRControllerPointerSelectionOptions;\r\n /**\r\n * optional configuration for the output canvas\r\n */\r\n public outputCanvasOptions?: WebXRManagedOutputCanvasOptions;\r\n /**\r\n * optional UI options. This can be used among other to change session mode and reference space type\r\n */\r\n public uiOptions?: WebXREnterExitUIOptions;\r\n /**\r\n * When loading teleportation and pointer select, use stable versions instead of latest.\r\n */\r\n public useStablePlugins?: boolean;\r\n\r\n /**\r\n * An optional rendering group id that will be set globally for teleportation, pointer selection and default controller meshes\r\n */\r\n public renderingGroupId?: number;\r\n\r\n /**\r\n * A list of optional features to init the session with\r\n * If set to true, all features we support will be added\r\n */\r\n optionalFeatures?: boolean | string[];\r\n}\r\n\r\n/**\r\n * Default experience which provides a similar setup to the previous webVRExperience\r\n */\r\nexport class WebXRDefaultExperience {\r\n /**\r\n * Base experience\r\n */\r\n public baseExperience: WebXRExperienceHelper;\r\n /**\r\n * Enables ui for entering/exiting xr\r\n */\r\n public enterExitUI: WebXREnterExitUI;\r\n /**\r\n * Input experience extension\r\n */\r\n public input: WebXRInput;\r\n /**\r\n * Enables laser pointer and selection\r\n */\r\n public pointerSelection: WebXRControllerPointerSelection;\r\n /**\r\n * Default target xr should render to\r\n */\r\n public renderTarget: WebXRRenderTarget;\r\n /**\r\n * Enables teleportation\r\n */\r\n public teleportation: WebXRMotionControllerTeleportation;\r\n\r\n /**\r\n * Enables near interaction for hands/controllers\r\n */\r\n public nearInteraction: WebXRNearInteraction;\r\n\r\n private constructor() {}\r\n\r\n /**\r\n * Creates the default xr experience\r\n * @param scene scene\r\n * @param options options for basic configuration\r\n * @returns resulting WebXRDefaultExperience\r\n */\r\n public static CreateAsync(scene: Scene, options: WebXRDefaultExperienceOptions = {}) {\r\n const result = new WebXRDefaultExperience();\r\n scene.onDisposeObservable.addOnce(() => {\r\n result.dispose();\r\n });\r\n // init the UI right after construction\r\n if (!options.disableDefaultUI) {\r\n const uiOptions: WebXREnterExitUIOptions = {\r\n renderTarget: result.renderTarget,\r\n ...(options.uiOptions || {}),\r\n };\r\n if (options.optionalFeatures) {\r\n if (typeof options.optionalFeatures === \"boolean\") {\r\n uiOptions.optionalFeatures = [\"hit-test\", \"anchors\", \"plane-detection\", \"hand-tracking\"];\r\n } else {\r\n uiOptions.optionalFeatures = options.optionalFeatures;\r\n }\r\n }\r\n result.enterExitUI = new WebXREnterExitUI(scene, uiOptions);\r\n }\r\n\r\n // Create base experience\r\n return WebXRExperienceHelper.CreateAsync(scene)\r\n .then((xrHelper) => {\r\n result.baseExperience = xrHelper;\r\n\r\n if (options.ignoreNativeCameraTransformation) {\r\n result.baseExperience.camera.compensateOnFirstFrame = false;\r\n }\r\n\r\n // Add controller support\r\n result.input = new WebXRInput(xrHelper.sessionManager, xrHelper.camera, {\r\n controllerOptions: {\r\n renderingGroupId: options.renderingGroupId,\r\n },\r\n ...(options.inputOptions || {}),\r\n });\r\n\r\n if (!options.disablePointerSelection) {\r\n // Add default pointer selection\r\n const pointerSelectionOptions = {\r\n ...options.pointerSelectionOptions,\r\n xrInput: result.input,\r\n renderingGroupId: options.renderingGroupId,\r\n };\r\n\r\n result.pointerSelection = <WebXRControllerPointerSelection>(\r\n result.baseExperience.featuresManager.enableFeature(\r\n WebXRControllerPointerSelection.Name,\r\n options.useStablePlugins ? \"stable\" : \"latest\",\r\n <IWebXRControllerPointerSelectionOptions>pointerSelectionOptions\r\n )\r\n );\r\n\r\n if (!options.disableTeleportation) {\r\n // Add default teleportation, including rotation\r\n result.teleportation = <WebXRMotionControllerTeleportation>result.baseExperience.featuresManager.enableFeature(\r\n WebXRMotionControllerTeleportation.Name,\r\n options.useStablePlugins ? \"stable\" : \"latest\",\r\n <IWebXRTeleportationOptions>{\r\n floorMeshes: options.floorMeshes,\r\n xrInput: result.input,\r\n renderingGroupId: options.renderingGroupId,\r\n }\r\n );\r\n result.teleportation.setSelectionFeature(result.pointerSelection);\r\n }\r\n }\r\n\r\n if (!options.disableNearInteraction) {\r\n // Add default pointer selection\r\n result.nearInteraction = <WebXRNearInteraction>result.baseExperience.featuresManager.enableFeature(\r\n WebXRNearInteraction.Name,\r\n options.useStablePlugins ? \"stable\" : \"latest\",\r\n <IWebXRNearInteractionOptions>{\r\n xrInput: result.input,\r\n farInteractionFeature: result.pointerSelection,\r\n renderingGroupId: options.renderingGroupId,\r\n useUtilityLayer: true,\r\n enableNearInteractionOnAllControllers: true,\r\n }\r\n );\r\n }\r\n\r\n // Create the WebXR output target\r\n result.renderTarget = result.baseExperience.sessionManager.getWebXRRenderTarget(options.outputCanvasOptions);\r\n\r\n if (!options.disableDefaultUI) {\r\n // Create ui for entering/exiting xr\r\n return result.enterExitUI.setHelperAsync(result.baseExperience, result.renderTarget);\r\n } else {\r\n return;\r\n }\r\n })\r\n .then(() => {\r\n return result;\r\n })\r\n .catch((error) => {\r\n Logger.Error(\"Error initializing XR\");\r\n Logger.Error(error);\r\n return result;\r\n });\r\n }\r\n\r\n /**\r\n * Disposes of the experience helper\r\n */\r\n public dispose() {\r\n if (this.baseExperience) {\r\n this.baseExperience.dispose();\r\n }\r\n if (this.input) {\r\n this.input.dispose();\r\n }\r\n if (this.enterExitUI) {\r\n this.enterExitUI.dispose();\r\n }\r\n if (this.renderTarget) {\r\n this.renderTarget.dispose();\r\n }\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"webXRDefaultExperience.js","sourceRoot":"","sources":["../../../../../lts/core/generated/XR/webXRDefaultExperience.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAGhE,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C,OAAO,EAAE,+BAA+B,EAAE,MAAM,4CAA4C,CAAC;AAE7F,OAAO,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AAGvE,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAItD,OAAO,EAAE,kCAAkC,EAAE,MAAM,yCAAyC,CAAC;AAC7F,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAExC;;GAEG;AACH;IAAA;IAoEA,CAAC;IAAD,oCAAC;AAAD,CAAC,AApED,IAoEC;;AAED;;GAEG;AACH;IA+BI;IAAuB,CAAC;IAExB;;;;;OAKG;IACW,kCAAW,GAAzB,UAA0B,KAAY,EAAE,OAA2C;QAA3C,wBAAA,EAAA,Y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AC,gBAAgB,EAC1C,eAAe,EAAE,IAAI,EACrB,qCAAqC,EAAE,IAAI,IACxC,OAAO,CAAC,sBAAsB,CACpC,CACJ,CAAC;aACL;YAED,iCAAiC;YACjC,MAAM,CAAC,YAAY,GAAG,MAAM,CAAC,cAAc,CAAC,cAAc,CAAC,oBAAoB,CAAC,OAAO,CAAC,mBAAmB,CAAC,CAAC;YAE7G,IAAI,CAAC,OAAO,CAAC,gBAAgB,EAAE;gBAC3B,oCAAoC;gBACpC,OAAO,MAAM,CAAC,WAAW,CAAC,cAAc,CAAC,MAAM,CAAC,cAAc,EAAE,MAAM,CAAC,YAAY,CAAC,CAAC;aACxF;iBAAM;gBACH,OAAO;aACV;QACL,CAAC,CAAC;aACD,IAAI,CAAC;YACF,OAAO,MAAM,CAAC;QAClB,CAAC,CAAC;aACD,KAAK,CAAC,UAAC,KAAK;YACT,MAAM,CAAC,KAAK,CAAC,uBAAuB,CAAC,CAAC;YACtC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;YACpB,OAAO,MAAM,CAAC;QAClB,CAAC,CAAC,CAAC;IACX,CAAC;IAED;;OAEG;IACI,wCAAO,GAAd;QACI,IAAI,IAAI,CAAC,cAAc,EAAE;YACrB,IAAI,CAAC,cAAc,CAAC,OAAO,EAAE,CAAC;SACjC;QACD,IAAI,IAAI,CAAC,KAAK,EAAE;YACZ,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC;SACxB;QACD,IAAI,IAAI,CAAC,WAAW,EAAE;YAClB,IAAI,CAAC,WAAW,CAAC,OAAO,EAAE,CAAC;SAC9B;QACD,IAAI,IAAI,CAAC,YAAY,EAAE;YACnB,IAAI,CAAC,YAAY,CAAC,OAAO,EAAE,CAAC;SAC/B;IACL,CAAC;IACL,6BAAC;AAAD,CAAC,AAlKD,IAkKC","sourcesContent":["import { WebXRExperienceHelper } from \"./webXRExperienceHelper\";\r\nimport type { Scene } from \"../scene\";\r\nimport type { IWebXRInputOptions } from \"./webXRInput\";\r\nimport { WebXRInput } from \"./webXRInput\";\r\nimport type { IWebXRControllerPointerSelectionOptions } from \"./features/WebXRControllerPointerSelection\";\r\nimport { WebXRControllerPointerSelection } from \"./features/WebXRControllerPointerSelection\";\r\nimport type { IWebXRNearInteractionOptions } from \"./features/WebXRNearInteraction\";\r\nimport { WebXRNearInteraction } from \"./features/WebXRNearInteraction\";\r\nimport type { WebXRRenderTarget } from \"./webXRTypes\";\r\nimport type { WebXREnterExitUIOptions } from \"./webXREnterExitUI\";\r\nimport { WebXREnterExitUI } from \"./webXREnterExitUI\";\r\nimport type { AbstractMesh } from \"../Meshes/abstractMesh\";\r\nimport type { WebXRManagedOutputCanvasOptions } from \"./webXRManagedOutputCanvas\";\r\nimport type { IWebXRTeleportationOptions } from \"./features/WebXRControllerTeleportation\";\r\nimport { WebXRMotionControllerTeleportation } from \"./features/WebXRControllerTeleportation\";\r\nimport { Logger } from \"../Misc/logger\";\r\n\r\n/**\r\n * Options for the default xr helper\r\n */\r\nexport class WebXRDefaultExperienceOptions {\r\n /**\r\n * Enable or disable default UI to enter XR\r\n */\r\n public disableDefaultUI?: boolean;\r\n /**\r\n * Should pointer selection not initialize.\r\n * Note that disabling pointer selection also disables teleportation.\r\n * Defaults to false.\r\n */\r\n public disablePointerSelection?: boolean;\r\n /**\r\n * Should teleportation not initialize. Defaults to false.\r\n */\r\n public disableTeleportation?: boolean;\r\n /**\r\n * Should nearInteraction not initialize. Defaults to false.\r\n */\r\n public disableNearInteraction?: boolean;\r\n /**\r\n * Floor meshes that will be used for teleport\r\n */\r\n public floorMeshes?: Array<AbstractMesh>;\r\n /**\r\n * If set to true, the first frame will not be used to reset position\r\n * The first frame is mainly used when copying transformation from the old camera\r\n * Mainly used in AR\r\n */\r\n public ignoreNativeCameraTransformation?: boolean;\r\n /**\r\n * Disable the controller mesh-loading. Can be used if you want to load your own meshes\r\n */\r\n public inputOptions?: IWebXRInputOptions;\r\n /**\r\n * optional configuration for pointer selection\r\n */\r\n public pointerSelectionOptions?: IWebXRControllerPointerSelectionOptions;\r\n /**\r\n * optional configuration for near interaction\r\n */\r\n public nearInteractionOptions?: IWebXRNearInteractionOptions;\r\n /**\r\n * optional configuration for teleportation\r\n */\r\n public teleportationOptions?: IWebXRTeleportationOptions;\r\n /**\r\n * optional configuration for the output canvas\r\n */\r\n public outputCanvasOptions?: WebXRManagedOutputCanvasOptions;\r\n /**\r\n * optional UI options. This can be used among other to change session mode and reference space type\r\n */\r\n public uiOptions?: WebXREnterExitUIOptions;\r\n /**\r\n * When loading teleportation and pointer select, use stable versions instead of latest.\r\n */\r\n public useStablePlugins?: boolean;\r\n\r\n /**\r\n * An optional rendering group id that will be set globally for teleportation, pointer selection and default controller meshes\r\n */\r\n public renderingGroupId?: number;\r\n\r\n /**\r\n * A list of optional features to init the session with\r\n * If set to true, all features we support will be added\r\n */\r\n optionalFeatures?: boolean | string[];\r\n}\r\n\r\n/**\r\n * Default experience which provides a similar setup to the previous webVRExperience\r\n */\r\nexport class WebXRDefaultExperience {\r\n /**\r\n * Base experience\r\n */\r\n public baseExperience: WebXRExperienceHelper;\r\n /**\r\n * Enables ui for entering/exiting xr\r\n */\r\n public enterExitUI: WebXREnterExitUI;\r\n /**\r\n * Input experience extension\r\n */\r\n public input: WebXRInput;\r\n /**\r\n * Enables laser pointer and selection\r\n */\r\n public pointerSelection: WebXRControllerPointerSelection;\r\n /**\r\n * Default target xr should render to\r\n */\r\n public renderTarget: WebXRRenderTarget;\r\n /**\r\n * Enables teleportation\r\n */\r\n public teleportation: WebXRMotionControllerTeleportation;\r\n\r\n /**\r\n * Enables near interaction for hands/controllers\r\n */\r\n public nearInteraction: WebXRNearInteraction;\r\n\r\n private constructor() {}\r\n\r\n /**\r\n * Creates the default xr experience\r\n * @param scene scene\r\n * @param options options for basic configuration\r\n * @returns resulting WebXRDefaultExperience\r\n */\r\n public static CreateAsync(scene: Scene, options: WebXRDefaultExperienceOptions = {}) {\r\n const result = new WebXRDefaultExperience();\r\n scene.onDisposeObservable.addOnce(() => {\r\n result.dispose();\r\n });\r\n // init the UI right after construction\r\n if (!options.disableDefaultUI) {\r\n const uiOptions: WebXREnterExitUIOptions = {\r\n renderTarget: result.renderTarget,\r\n ...(options.uiOptions || {}),\r\n };\r\n if (options.optionalFeatures) {\r\n if (typeof options.optionalFeatures === \"boolean\") {\r\n uiOptions.optionalFeatures = [\"hit-test\", \"anchors\", \"plane-detection\", \"hand-tracking\"];\r\n } else {\r\n uiOptions.optionalFeatures = options.optionalFeatures;\r\n }\r\n }\r\n result.enterExitUI = new WebXREnterExitUI(scene, uiOptions);\r\n }\r\n\r\n // Create base experience\r\n return WebXRExperienceHelper.CreateAsync(scene)\r\n .then((xrHelper) => {\r\n result.baseExperience = xrHelper;\r\n\r\n if (options.ignoreNativeCameraTransformation) {\r\n result.baseExperience.camera.compensateOnFirstFrame = false;\r\n }\r\n\r\n // Add controller support\r\n result.input = new WebXRInput(xrHelper.sessionManager, xrHelper.camera, {\r\n controllerOptions: {\r\n renderingGroupId: options.renderingGroupId,\r\n },\r\n ...(options.inputOptions || {}),\r\n });\r\n\r\n if (!options.disablePointerSelection) {\r\n // Add default pointer selection\r\n const pointerSelectionOptions = {\r\n ...options.pointerSelectionOptions,\r\n xrInput: result.input,\r\n renderingGroupId: options.renderingGroupId,\r\n };\r\n\r\n result.pointerSelection = <WebXRControllerPointerSelection>(\r\n result.baseExperience.featuresManager.enableFeature(\r\n WebXRControllerPointerSelection.Name,\r\n options.useStablePlugins ? \"stable\" : \"latest\",\r\n <IWebXRControllerPointerSelectionOptions>pointerSelectionOptions\r\n )\r\n );\r\n\r\n if (!options.disableTeleportation) {\r\n // Add default teleportation, including rotation\r\n result.teleportation = <WebXRMotionControllerTeleportation>result.baseExperience.featuresManager.enableFeature(\r\n WebXRMotionControllerTeleportation.Name,\r\n options.useStablePlugins ? \"stable\" : \"latest\",\r\n <IWebXRTeleportationOptions>{\r\n floorMeshes: options.floorMeshes,\r\n xrInput: result.input,\r\n renderingGroupId: options.renderingGroupId,\r\n ...options.teleportationOptions,\r\n }\r\n );\r\n result.teleportation.setSelectionFeature(result.pointerSelection);\r\n }\r\n }\r\n\r\n if (!options.disableNearInteraction) {\r\n // Add default pointer selection\r\n result.nearInteraction = <WebXRNearInteraction>result.baseExperience.featuresManager.enableFeature(\r\n WebXRNearInteraction.Name,\r\n options.useStablePlugins ? \"stable\" : \"latest\",\r\n <IWebXRNearInteractionOptions>{\r\n xrInput: result.input,\r\n farInteractionFeature: result.pointerSelection,\r\n renderingGroupId: options.renderingGroupId,\r\n useUtilityLayer: true,\r\n enableNearInteractionOnAllControllers: true,\r\n ...options.nearInteractionOptions,\r\n }\r\n );\r\n }\r\n\r\n // Create the WebXR output target\r\n result.renderTarget = result.baseExperience.sessionManager.getWebXRRenderTarget(options.outputCanvasOptions);\r\n\r\n if (!options.disableDefaultUI) {\r\n // Create ui for entering/exiting xr\r\n return result.enterExitUI.setHelperAsync(result.baseExperience, result.renderTarget);\r\n } else {\r\n return;\r\n }\r\n })\r\n .then(() => {\r\n return result;\r\n })\r\n .catch((error) => {\r\n Logger.Error(\"Error initializing XR\");\r\n Logger.Error(error);\r\n return result;\r\n });\r\n }\r\n\r\n /**\r\n * Disposes of the experience helper\r\n */\r\n public dispose() {\r\n if (this.baseExperience) {\r\n this.baseExperience.dispose();\r\n }\r\n if (this.input) {\r\n this.input.dispose();\r\n }\r\n if (this.enterExitUI) {\r\n this.enterExitUI.dispose();\r\n }\r\n if (this.renderTarget) {\r\n this.renderTarget.dispose();\r\n }\r\n }\r\n}\r\n"]}
|
|
@@ -91,14 +91,14 @@ var WebXRExperienceHelper = /** @class */ (function () {
|
|
|
91
91
|
* @returns promise that resolves after xr mode has entered
|
|
92
92
|
*/
|
|
93
93
|
WebXRExperienceHelper.prototype.enterXRAsync = function (sessionMode, referenceSpaceType, renderTarget, sessionCreationOptions) {
|
|
94
|
-
var _a, _b;
|
|
94
|
+
var _a, _b, _c;
|
|
95
95
|
if (renderTarget === void 0) { renderTarget = this.sessionManager.getWebXRRenderTarget(); }
|
|
96
96
|
if (sessionCreationOptions === void 0) { sessionCreationOptions = {}; }
|
|
97
97
|
return __awaiter(this, void 0, void 0, function () {
|
|
98
98
|
var baseLayer, xrRenderState, e_1;
|
|
99
99
|
var _this = this;
|
|
100
|
-
return __generator(this, function (
|
|
101
|
-
switch (
|
|
100
|
+
return __generator(this, function (_d) {
|
|
101
|
+
switch (_d.label) {
|
|
102
102
|
case 0:
|
|
103
103
|
if (!this._supported) {
|
|
104
104
|
throw "WebXR not supported in this browser or environment";
|
|
@@ -110,23 +110,23 @@ var WebXRExperienceHelper = /** @class */ (function () {
|
|
|
110
110
|
}
|
|
111
111
|
return [4 /*yield*/, this.featuresManager._extendXRSessionInitObject(sessionCreationOptions)];
|
|
112
112
|
case 1:
|
|
113
|
-
sessionCreationOptions =
|
|
113
|
+
sessionCreationOptions = _d.sent();
|
|
114
114
|
// we currently recommend "unbounded" space in AR (#7959)
|
|
115
115
|
if (sessionMode === "immersive-ar" && referenceSpaceType !== "unbounded") {
|
|
116
116
|
Logger.Warn("We recommend using 'unbounded' reference space type when using 'immersive-ar' session mode");
|
|
117
117
|
}
|
|
118
|
-
|
|
118
|
+
_d.label = 2;
|
|
119
119
|
case 2:
|
|
120
|
-
|
|
120
|
+
_d.trys.push([2, 6, , 7]);
|
|
121
121
|
return [4 /*yield*/, this.sessionManager.initializeSessionAsync(sessionMode, sessionCreationOptions)];
|
|
122
122
|
case 3:
|
|
123
|
-
|
|
123
|
+
_d.sent();
|
|
124
124
|
return [4 /*yield*/, this.sessionManager.setReferenceSpaceTypeAsync(referenceSpaceType)];
|
|
125
125
|
case 4:
|
|
126
|
-
|
|
126
|
+
_d.sent();
|
|
127
127
|
return [4 /*yield*/, renderTarget.initializeXRLayerAsync(this.sessionManager.session)];
|
|
128
128
|
case 5:
|
|
129
|
-
baseLayer =
|
|
129
|
+
baseLayer = _d.sent();
|
|
130
130
|
xrRenderState = {
|
|
131
131
|
// if maxZ is 0 it should be "Infinity", but it doesn't work with the WebXR API. Setting to a large number.
|
|
132
132
|
depthFar: this.camera.maxZ || 10000,
|
|
@@ -142,8 +142,8 @@ var WebXRExperienceHelper = /** @class */ (function () {
|
|
|
142
142
|
// Cache pre xr scene settings
|
|
143
143
|
this._originalSceneAutoClear = this._scene.autoClear;
|
|
144
144
|
this._nonVRCamera = this._scene.activeCamera;
|
|
145
|
-
this._attachedToElement = !!((_a = this._nonVRCamera) === null || _a === void 0 ? void 0 : _a.inputs.attachedToElement);
|
|
146
|
-
(
|
|
145
|
+
this._attachedToElement = !!((_b = (_a = this._nonVRCamera) === null || _a === void 0 ? void 0 : _a.inputs) === null || _b === void 0 ? void 0 : _b.attachedToElement);
|
|
146
|
+
(_c = this._nonVRCamera) === null || _c === void 0 ? void 0 : _c.detachControl();
|
|
147
147
|
this._scene.activeCamera = this.camera;
|
|
148
148
|
// do not compensate when AR session is used
|
|
149
149
|
if (sessionMode !== "immersive-ar") {
|
|
@@ -188,7 +188,7 @@ var WebXRExperienceHelper = /** @class */ (function () {
|
|
|
188
188
|
});
|
|
189
189
|
return [2 /*return*/, this.sessionManager];
|
|
190
190
|
case 6:
|
|
191
|
-
e_1 =
|
|
191
|
+
e_1 = _d.sent();
|
|
192
192
|
console.log(e_1);
|
|
193
193
|
console.log(e_1.message);
|
|
194
194
|
this._setState(WebXRState.NOT_IN_XR);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webXRExperienceHelper.js","sourceRoot":"","sources":["../../../../../lts/core/generated/XR/webXRExperienceHelper.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAGhD,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAE5C,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,gBAAgB,EAAE,oBAAo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U,CAAC,UAAU,EAAE;oBAC7C,KAAI,CAAC,cAAc,CAAC,mBAAmB,CAAC,cAAc,CAAC,uBAAqB,CAAC,CAAC;oBAC9E,KAAI,CAAC,MAAM,CAAC,aAAa,GAAG,IAAI,CAAC;iBACpC;YACL,CAAC,CAAC;YACF,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC;YAC3B,IAAI,CAAC,wBAAwB,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;YAClD,cAAc,EAAE,CAAC;SACpB;IACL,CAAC;IAEO,gDAAgB,GAAxB;QACI,IAAI,CAAC,MAAM,CAAC,gCAAgC,CAAC,IAAI,CAAC,YAAa,CAAC,CAAC;QACjE,IAAI,CAAC,4BAA4B,CAAC,eAAe,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IACnE,CAAC;IAEO,yCAAS,GAAjB,UAAkB,GAAe;QAC7B,IAAI,IAAI,CAAC,KAAK,KAAK,GAAG,EAAE;YACpB,OAAO;SACV;QACD,IAAI,CAAC,KAAK,GAAG,GAAG,CAAC;QACjB,IAAI,CAAC,wBAAwB,CAAC,eAAe,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAC9D,CAAC;IACL,4BAAC;AAAD,CAAC,AA3PD,IA2PC","sourcesContent":["import type { Nullable } from \"../types\";\r\nimport { Observable } from \"../Misc/observable\";\r\nimport type { IDisposable, Scene } from \"../scene\";\r\nimport type { Camera } from \"../Cameras/camera\";\r\nimport { WebXRSessionManager } from \"./webXRSessionManager\";\r\nimport { WebXRCamera } from \"./webXRCamera\";\r\nimport type { WebXRRenderTarget } from \"./webXRTypes\";\r\nimport { WebXRState } from \"./webXRTypes\";\r\nimport { WebXRFeatureName, WebXRFeaturesManager } from \"./webXRFeaturesManager\";\r\nimport { Logger } from \"../Misc/logger\";\r\nimport { UniversalCamera } from \"../Cameras/universalCamera\";\r\nimport { Quaternion, Vector3 } from \"../Maths/math.vector\";\r\n\r\n/**\r\n * Base set of functionality needed to create an XR experience (WebXRSessionManager, Camera, StateManagement, etc.)\r\n * @see https://doc.babylonjs.com/how_to/webxr_experience_helpers\r\n */\r\nexport class WebXRExperienceHelper implements IDisposable {\r\n private _nonVRCamera: Nullable<Camera> = null;\r\n private _attachedToElement: boolean = false;\r\n private _spectatorCamera: Nullable<UniversalCamera> = null;\r\n private _originalSceneAutoClear = true;\r\n private _supported = false;\r\n private _spectatorMode = false;\r\n\r\n /**\r\n * Camera used to render xr content\r\n */\r\n public camera: WebXRCamera;\r\n /** A features manager for this xr session */\r\n public featuresManager: WebXRFeaturesManager;\r\n /**\r\n * Observers registered here will be triggered after the camera's initial transformation is set\r\n * This can be used to set a different ground level or an extra rotation.\r\n *\r\n * Note that ground level is considered to be at 0. The height defined by the XR camera will be added\r\n * to the position set after this observable is done executing.\r\n */\r\n public onInitialXRPoseSetObservable = new Observable<WebXRCamera>();\r\n /**\r\n * Fires when the state of the experience helper has changed\r\n */\r\n public onStateChangedObservable = new Observable<WebXRState>();\r\n /** Session manager used to keep track of xr session */\r\n public sessionManager: WebXRSessionManager;\r\n /**\r\n * The current state of the XR experience (eg. transitioning, in XR or not in XR)\r\n */\r\n public state: WebXRState = WebXRState.NOT_IN_XR;\r\n\r\n /**\r\n * Creates a WebXRExperienceHelper\r\n * @param _scene The scene the helper should be created in\r\n */\r\n private constructor(private _scene: Scene) {\r\n this.sessionManager = new WebXRSessionManager(_scene);\r\n this.camera = new WebXRCamera(\"webxr\", _scene, this.sessionManager);\r\n this.featuresManager = new WebXRFeaturesManager(this.sessionManager);\r\n\r\n _scene.onDisposeObservable.addOnce(() => {\r\n this.dispose();\r\n });\r\n }\r\n\r\n /**\r\n * Creates the experience helper\r\n * @param scene the scene to attach the experience helper to\r\n * @returns a promise for the experience helper\r\n */\r\n public static CreateAsync(scene: Scene): Promise<WebXRExperienceHelper> {\r\n const helper = new WebXRExperienceHelper(scene);\r\n return helper.sessionManager\r\n .initializeAsync()\r\n .then(() => {\r\n helper._supported = true;\r\n return helper;\r\n })\r\n .catch((e) => {\r\n helper._setState(WebXRState.NOT_IN_XR);\r\n helper.dispose();\r\n throw e;\r\n });\r\n }\r\n\r\n /**\r\n * Disposes of the experience helper\r\n */\r\n public dispose() {\r\n this.exitXRAsync();\r\n this.camera.dispose();\r\n this.onStateChangedObservable.clear();\r\n this.onInitialXRPoseSetObservable.clear();\r\n this.sessionManager.dispose();\r\n this._spectatorCamera?.dispose();\r\n if (this._nonVRCamera) {\r\n this._scene.activeCamera = this._nonVRCamera;\r\n }\r\n }\r\n\r\n /**\r\n * Enters XR mode (This must be done within a user interaction in most browsers eg. button click)\r\n * @param sessionMode options for the XR session\r\n * @param referenceSpaceType frame of reference of the XR session\r\n * @param renderTarget the output canvas that will be used to enter XR mode\r\n * @param sessionCreationOptions optional XRSessionInit object to init the session with\r\n * @returns promise that resolves after xr mode has entered\r\n */\r\n public async enterXRAsync(\r\n sessionMode: XRSessionMode,\r\n referenceSpaceType: XRReferenceSpaceType,\r\n renderTarget: WebXRRenderTarget = this.sessionManager.getWebXRRenderTarget(),\r\n sessionCreationOptions: XRSessionInit = {}\r\n ): Promise<WebXRSessionManager> {\r\n if (!this._supported) {\r\n throw \"WebXR not supported in this browser or environment\";\r\n }\r\n this._setState(WebXRState.ENTERING_XR);\r\n if (referenceSpaceType !== \"viewer\" && referenceSpaceType !== \"local\") {\r\n sessionCreationOptions.optionalFeatures = sessionCreationOptions.optionalFeatures || [];\r\n sessionCreationOptions.optionalFeatures.push(referenceSpaceType);\r\n }\r\n sessionCreationOptions = await this.featuresManager._extendXRSessionInitObject(sessionCreationOptions);\r\n // we currently recommend \"unbounded\" space in AR (#7959)\r\n if (sessionMode === \"immersive-ar\" && referenceSpaceType !== \"unbounded\") {\r\n Logger.Warn(\"We recommend using 'unbounded' reference space type when using 'immersive-ar' session mode\");\r\n }\r\n // make sure that the session mode is supported\r\n try {\r\n await this.sessionManager.initializeSessionAsync(sessionMode, sessionCreationOptions);\r\n await this.sessionManager.setReferenceSpaceTypeAsync(referenceSpaceType);\r\n const baseLayer = await renderTarget.initializeXRLayerAsync(this.sessionManager.session);\r\n\r\n const xrRenderState: XRRenderStateInit = {\r\n // if maxZ is 0 it should be \"Infinity\", but it doesn't work with the WebXR API. Setting to a large number.\r\n depthFar: this.camera.maxZ || 10000,\r\n depthNear: this.camera.minZ,\r\n };\r\n\r\n // The layers feature will have already initialized the xr session's layers on session init.\r\n if (!this.featuresManager.getEnabledFeature(WebXRFeatureName.LAYERS)) {\r\n xrRenderState.baseLayer = baseLayer;\r\n }\r\n\r\n this.sessionManager.updateRenderState(xrRenderState);\r\n // run the render loop\r\n this.sessionManager.runXRRenderLoop();\r\n // Cache pre xr scene settings\r\n this._originalSceneAutoClear = this._scene.autoClear;\r\n this._nonVRCamera = this._scene.activeCamera;\r\n this._attachedToElement = !!this._nonVRCamera?.inputs.attachedToElement;\r\n this._nonVRCamera?.detachControl();\r\n\r\n this._scene.activeCamera = this.camera;\r\n // do not compensate when AR session is used\r\n if (sessionMode !== \"immersive-ar\") {\r\n this._nonXRToXRCamera();\r\n } else {\r\n // Kept here, TODO - check if needed\r\n this._scene.autoClear = false;\r\n this.camera.compensateOnFirstFrame = false;\r\n // reset the camera's position to the origin\r\n this.camera.position.set(0, 0, 0);\r\n this.camera.rotationQuaternion.set(0, 0, 0, 1);\r\n }\r\n\r\n this.sessionManager.onXRSessionEnded.addOnce(() => {\r\n // when using the back button and not the exit button (default on mobile), the session is ending but the EXITING state was not set\r\n if (this.state !== WebXRState.EXITING_XR) {\r\n this._setState(WebXRState.EXITING_XR);\r\n }\r\n // Reset camera rigs output render target to ensure sessions render target is not drawn after it ends\r\n this.camera.rigCameras.forEach((c) => {\r\n c.outputRenderTarget = null;\r\n });\r\n\r\n // Restore scene settings\r\n this._scene.autoClear = this._originalSceneAutoClear;\r\n this._scene.activeCamera = this._nonVRCamera;\r\n if (this._attachedToElement && this._nonVRCamera) {\r\n this._nonVRCamera.attachControl(!!this._nonVRCamera.inputs.noPreventDefault);\r\n }\r\n if (sessionMode !== \"immersive-ar\" && this.camera.compensateOnFirstFrame) {\r\n if ((<any>this._nonVRCamera).setPosition) {\r\n (<any>this._nonVRCamera).setPosition(this.camera.position);\r\n } else {\r\n this._nonVRCamera!.position.copyFrom(this.camera.position);\r\n }\r\n }\r\n\r\n this._setState(WebXRState.NOT_IN_XR);\r\n });\r\n\r\n // Wait until the first frame arrives before setting state to in xr\r\n this.sessionManager.onXRFrameObservable.addOnce(() => {\r\n this._setState(WebXRState.IN_XR);\r\n });\r\n return this.sessionManager;\r\n } catch (e) {\r\n console.log(e);\r\n console.log(e.message);\r\n this._setState(WebXRState.NOT_IN_XR);\r\n throw e;\r\n }\r\n }\r\n\r\n /**\r\n * Exits XR mode and returns the scene to its original state\r\n * @returns promise that resolves after xr mode has exited\r\n */\r\n public exitXRAsync() {\r\n // only exit if state is IN_XR\r\n if (this.state !== WebXRState.IN_XR) {\r\n return Promise.resolve();\r\n }\r\n this._setState(WebXRState.EXITING_XR);\r\n return this.sessionManager.exitXRAsync();\r\n }\r\n\r\n /**\r\n * Enable spectator mode for desktop VR experiences.\r\n * When spectator mode is enabled a camera will be attached to the desktop canvas and will\r\n * display the first rig camera's view on the desktop canvas.\r\n * Please note that this will degrade performance, as it requires another camera render.\r\n * It is also not recommended to enable this in devices like the quest, as it brings no benefit there.\r\n */\r\n public enableSpectatorMode(): void {\r\n if (!this._spectatorMode) {\r\n const updateSpectatorCamera = () => {\r\n if (this._spectatorCamera) {\r\n this._spectatorCamera.position.copyFrom(this.camera.rigCameras[0].globalPosition);\r\n this._spectatorCamera.rotationQuaternion.copyFrom(this.camera.rigCameras[0].absoluteRotation);\r\n }\r\n };\r\n const onStateChanged = () => {\r\n if (this.state === WebXRState.IN_XR) {\r\n this._spectatorCamera = new UniversalCamera(\"webxr-spectator\", Vector3.Zero(), this._scene);\r\n this._spectatorCamera.rotationQuaternion = new Quaternion();\r\n this._scene.activeCameras = [this.camera, this._spectatorCamera];\r\n this.sessionManager.onXRFrameObservable.add(updateSpectatorCamera);\r\n this._scene.onAfterRenderCameraObservable.add((camera) => {\r\n if (camera === this.camera) {\r\n // reset the dimensions object for correct resizing\r\n this._scene.getEngine().framebufferDimensionsObject = null;\r\n }\r\n });\r\n } else if (this.state === WebXRState.EXITING_XR) {\r\n this.sessionManager.onXRFrameObservable.removeCallback(updateSpectatorCamera);\r\n this._scene.activeCameras = null;\r\n }\r\n };\r\n this._spectatorMode = true;\r\n this.onStateChangedObservable.add(onStateChanged);\r\n onStateChanged();\r\n }\r\n }\r\n\r\n private _nonXRToXRCamera() {\r\n this.camera.setTransformationFromNonVRCamera(this._nonVRCamera!);\r\n this.onInitialXRPoseSetObservable.notifyObservers(this.camera);\r\n }\r\n\r\n private _setState(val: WebXRState) {\r\n if (this.state === val) {\r\n return;\r\n }\r\n this.state = val;\r\n this.onStateChangedObservable.notifyObservers(this.state);\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"webXRExperienceHelper.js","sourceRoot":"","sources":["../../../../../lts/core/generated/XR/webXRExperienceHelper.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAGhD,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAE5C,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAChF,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AACxC,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAC7D,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAE3D;;;GAGG;AACH;IAiCI;;;OAGG;IACH,+BAA4B,MAAa;QAAzC,iBAQC;QAR2B,WAAM,GAAN,MAAM,CAAO;QApCjC,iBAAY,GAAqB,IAAI,CAAC;Q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AC;IAEO,gDAAgB,GAAxB;QACI,IAAI,CAAC,MAAM,CAAC,gCAAgC,CAAC,IAAI,CAAC,YAAa,CAAC,CAAC;QACjE,IAAI,CAAC,4BAA4B,CAAC,eAAe,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IACnE,CAAC;IAEO,yCAAS,GAAjB,UAAkB,GAAe;QAC7B,IAAI,IAAI,CAAC,KAAK,KAAK,GAAG,EAAE;YACpB,OAAO;SACV;QACD,IAAI,CAAC,KAAK,GAAG,GAAG,CAAC;QACjB,IAAI,CAAC,wBAAwB,CAAC,eAAe,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAC9D,CAAC;IACL,4BAAC;AAAD,CAAC,AA3PD,IA2PC","sourcesContent":["import type { Nullable } from \"../types\";\r\nimport { Observable } from \"../Misc/observable\";\r\nimport type { IDisposable, Scene } from \"../scene\";\r\nimport type { Camera } from \"../Cameras/camera\";\r\nimport { WebXRSessionManager } from \"./webXRSessionManager\";\r\nimport { WebXRCamera } from \"./webXRCamera\";\r\nimport type { WebXRRenderTarget } from \"./webXRTypes\";\r\nimport { WebXRState } from \"./webXRTypes\";\r\nimport { WebXRFeatureName, WebXRFeaturesManager } from \"./webXRFeaturesManager\";\r\nimport { Logger } from \"../Misc/logger\";\r\nimport { UniversalCamera } from \"../Cameras/universalCamera\";\r\nimport { Quaternion, Vector3 } from \"../Maths/math.vector\";\r\n\r\n/**\r\n * Base set of functionality needed to create an XR experience (WebXRSessionManager, Camera, StateManagement, etc.)\r\n * @see https://doc.babylonjs.com/how_to/webxr_experience_helpers\r\n */\r\nexport class WebXRExperienceHelper implements IDisposable {\r\n private _nonVRCamera: Nullable<Camera> = null;\r\n private _attachedToElement: boolean = false;\r\n private _spectatorCamera: Nullable<UniversalCamera> = null;\r\n private _originalSceneAutoClear = true;\r\n private _supported = false;\r\n private _spectatorMode = false;\r\n\r\n /**\r\n * Camera used to render xr content\r\n */\r\n public camera: WebXRCamera;\r\n /** A features manager for this xr session */\r\n public featuresManager: WebXRFeaturesManager;\r\n /**\r\n * Observers registered here will be triggered after the camera's initial transformation is set\r\n * This can be used to set a different ground level or an extra rotation.\r\n *\r\n * Note that ground level is considered to be at 0. The height defined by the XR camera will be added\r\n * to the position set after this observable is done executing.\r\n */\r\n public onInitialXRPoseSetObservable = new Observable<WebXRCamera>();\r\n /**\r\n * Fires when the state of the experience helper has changed\r\n */\r\n public onStateChangedObservable = new Observable<WebXRState>();\r\n /** Session manager used to keep track of xr session */\r\n public sessionManager: WebXRSessionManager;\r\n /**\r\n * The current state of the XR experience (eg. transitioning, in XR or not in XR)\r\n */\r\n public state: WebXRState = WebXRState.NOT_IN_XR;\r\n\r\n /**\r\n * Creates a WebXRExperienceHelper\r\n * @param _scene The scene the helper should be created in\r\n */\r\n private constructor(private _scene: Scene) {\r\n this.sessionManager = new WebXRSessionManager(_scene);\r\n this.camera = new WebXRCamera(\"webxr\", _scene, this.sessionManager);\r\n this.featuresManager = new WebXRFeaturesManager(this.sessionManager);\r\n\r\n _scene.onDisposeObservable.addOnce(() => {\r\n this.dispose();\r\n });\r\n }\r\n\r\n /**\r\n * Creates the experience helper\r\n * @param scene the scene to attach the experience helper to\r\n * @returns a promise for the experience helper\r\n */\r\n public static CreateAsync(scene: Scene): Promise<WebXRExperienceHelper> {\r\n const helper = new WebXRExperienceHelper(scene);\r\n return helper.sessionManager\r\n .initializeAsync()\r\n .then(() => {\r\n helper._supported = true;\r\n return helper;\r\n })\r\n .catch((e) => {\r\n helper._setState(WebXRState.NOT_IN_XR);\r\n helper.dispose();\r\n throw e;\r\n });\r\n }\r\n\r\n /**\r\n * Disposes of the experience helper\r\n */\r\n public dispose() {\r\n this.exitXRAsync();\r\n this.camera.dispose();\r\n this.onStateChangedObservable.clear();\r\n this.onInitialXRPoseSetObservable.clear();\r\n this.sessionManager.dispose();\r\n this._spectatorCamera?.dispose();\r\n if (this._nonVRCamera) {\r\n this._scene.activeCamera = this._nonVRCamera;\r\n }\r\n }\r\n\r\n /**\r\n * Enters XR mode (This must be done within a user interaction in most browsers eg. button click)\r\n * @param sessionMode options for the XR session\r\n * @param referenceSpaceType frame of reference of the XR session\r\n * @param renderTarget the output canvas that will be used to enter XR mode\r\n * @param sessionCreationOptions optional XRSessionInit object to init the session with\r\n * @returns promise that resolves after xr mode has entered\r\n */\r\n public async enterXRAsync(\r\n sessionMode: XRSessionMode,\r\n referenceSpaceType: XRReferenceSpaceType,\r\n renderTarget: WebXRRenderTarget = this.sessionManager.getWebXRRenderTarget(),\r\n sessionCreationOptions: XRSessionInit = {}\r\n ): Promise<WebXRSessionManager> {\r\n if (!this._supported) {\r\n throw \"WebXR not supported in this browser or environment\";\r\n }\r\n this._setState(WebXRState.ENTERING_XR);\r\n if (referenceSpaceType !== \"viewer\" && referenceSpaceType !== \"local\") {\r\n sessionCreationOptions.optionalFeatures = sessionCreationOptions.optionalFeatures || [];\r\n sessionCreationOptions.optionalFeatures.push(referenceSpaceType);\r\n }\r\n sessionCreationOptions = await this.featuresManager._extendXRSessionInitObject(sessionCreationOptions);\r\n // we currently recommend \"unbounded\" space in AR (#7959)\r\n if (sessionMode === \"immersive-ar\" && referenceSpaceType !== \"unbounded\") {\r\n Logger.Warn(\"We recommend using 'unbounded' reference space type when using 'immersive-ar' session mode\");\r\n }\r\n // make sure that the session mode is supported\r\n try {\r\n await this.sessionManager.initializeSessionAsync(sessionMode, sessionCreationOptions);\r\n await this.sessionManager.setReferenceSpaceTypeAsync(referenceSpaceType);\r\n const baseLayer = await renderTarget.initializeXRLayerAsync(this.sessionManager.session);\r\n\r\n const xrRenderState: XRRenderStateInit = {\r\n // if maxZ is 0 it should be \"Infinity\", but it doesn't work with the WebXR API. Setting to a large number.\r\n depthFar: this.camera.maxZ || 10000,\r\n depthNear: this.camera.minZ,\r\n };\r\n\r\n // The layers feature will have already initialized the xr session's layers on session init.\r\n if (!this.featuresManager.getEnabledFeature(WebXRFeatureName.LAYERS)) {\r\n xrRenderState.baseLayer = baseLayer;\r\n }\r\n\r\n this.sessionManager.updateRenderState(xrRenderState);\r\n // run the render loop\r\n this.sessionManager.runXRRenderLoop();\r\n // Cache pre xr scene settings\r\n this._originalSceneAutoClear = this._scene.autoClear;\r\n this._nonVRCamera = this._scene.activeCamera;\r\n this._attachedToElement = !!this._nonVRCamera?.inputs?.attachedToElement;\r\n this._nonVRCamera?.detachControl();\r\n\r\n this._scene.activeCamera = this.camera;\r\n // do not compensate when AR session is used\r\n if (sessionMode !== \"immersive-ar\") {\r\n this._nonXRToXRCamera();\r\n } else {\r\n // Kept here, TODO - check if needed\r\n this._scene.autoClear = false;\r\n this.camera.compensateOnFirstFrame = false;\r\n // reset the camera's position to the origin\r\n this.camera.position.set(0, 0, 0);\r\n this.camera.rotationQuaternion.set(0, 0, 0, 1);\r\n }\r\n\r\n this.sessionManager.onXRSessionEnded.addOnce(() => {\r\n // when using the back button and not the exit button (default on mobile), the session is ending but the EXITING state was not set\r\n if (this.state !== WebXRState.EXITING_XR) {\r\n this._setState(WebXRState.EXITING_XR);\r\n }\r\n // Reset camera rigs output render target to ensure sessions render target is not drawn after it ends\r\n this.camera.rigCameras.forEach((c) => {\r\n c.outputRenderTarget = null;\r\n });\r\n\r\n // Restore scene settings\r\n this._scene.autoClear = this._originalSceneAutoClear;\r\n this._scene.activeCamera = this._nonVRCamera;\r\n if (this._attachedToElement && this._nonVRCamera) {\r\n this._nonVRCamera.attachControl(!!this._nonVRCamera.inputs.noPreventDefault);\r\n }\r\n if (sessionMode !== \"immersive-ar\" && this.camera.compensateOnFirstFrame) {\r\n if ((<any>this._nonVRCamera).setPosition) {\r\n (<any>this._nonVRCamera).setPosition(this.camera.position);\r\n } else {\r\n this._nonVRCamera!.position.copyFrom(this.camera.position);\r\n }\r\n }\r\n\r\n this._setState(WebXRState.NOT_IN_XR);\r\n });\r\n\r\n // Wait until the first frame arrives before setting state to in xr\r\n this.sessionManager.onXRFrameObservable.addOnce(() => {\r\n this._setState(WebXRState.IN_XR);\r\n });\r\n return this.sessionManager;\r\n } catch (e) {\r\n console.log(e);\r\n console.log(e.message);\r\n this._setState(WebXRState.NOT_IN_XR);\r\n throw e;\r\n }\r\n }\r\n\r\n /**\r\n * Exits XR mode and returns the scene to its original state\r\n * @returns promise that resolves after xr mode has exited\r\n */\r\n public exitXRAsync() {\r\n // only exit if state is IN_XR\r\n if (this.state !== WebXRState.IN_XR) {\r\n return Promise.resolve();\r\n }\r\n this._setState(WebXRState.EXITING_XR);\r\n return this.sessionManager.exitXRAsync();\r\n }\r\n\r\n /**\r\n * Enable spectator mode for desktop VR experiences.\r\n * When spectator mode is enabled a camera will be attached to the desktop canvas and will\r\n * display the first rig camera's view on the desktop canvas.\r\n * Please note that this will degrade performance, as it requires another camera render.\r\n * It is also not recommended to enable this in devices like the quest, as it brings no benefit there.\r\n */\r\n public enableSpectatorMode(): void {\r\n if (!this._spectatorMode) {\r\n const updateSpectatorCamera = () => {\r\n if (this._spectatorCamera) {\r\n this._spectatorCamera.position.copyFrom(this.camera.rigCameras[0].globalPosition);\r\n this._spectatorCamera.rotationQuaternion.copyFrom(this.camera.rigCameras[0].absoluteRotation);\r\n }\r\n };\r\n const onStateChanged = () => {\r\n if (this.state === WebXRState.IN_XR) {\r\n this._spectatorCamera = new UniversalCamera(\"webxr-spectator\", Vector3.Zero(), this._scene);\r\n this._spectatorCamera.rotationQuaternion = new Quaternion();\r\n this._scene.activeCameras = [this.camera, this._spectatorCamera];\r\n this.sessionManager.onXRFrameObservable.add(updateSpectatorCamera);\r\n this._scene.onAfterRenderCameraObservable.add((camera) => {\r\n if (camera === this.camera) {\r\n // reset the dimensions object for correct resizing\r\n this._scene.getEngine().framebufferDimensionsObject = null;\r\n }\r\n });\r\n } else if (this.state === WebXRState.EXITING_XR) {\r\n this.sessionManager.onXRFrameObservable.removeCallback(updateSpectatorCamera);\r\n this._scene.activeCameras = null;\r\n }\r\n };\r\n this._spectatorMode = true;\r\n this.onStateChangedObservable.add(onStateChanged);\r\n onStateChanged();\r\n }\r\n }\r\n\r\n private _nonXRToXRCamera() {\r\n this.camera.setTransformationFromNonVRCamera(this._nonVRCamera!);\r\n this.onInitialXRPoseSetObservable.notifyObservers(this.camera);\r\n }\r\n\r\n private _setState(val: WebXRState) {\r\n if (this.state === val) {\r\n return;\r\n }\r\n this.state = val;\r\n this.onStateChangedObservable.notifyObservers(this.state);\r\n }\r\n}\r\n"]}
|
package/node.d.ts
CHANGED
|
@@ -102,6 +102,8 @@ export declare class Node implements IBehaviorAware<Node> {
|
|
|
102
102
|
/** @hidden */
|
|
103
103
|
_waitingParentInstanceIndex: Nullable<string>;
|
|
104
104
|
/** @hidden */
|
|
105
|
+
_waitingParsedUniqueId: Nullable<number>;
|
|
106
|
+
/** @hidden */
|
|
105
107
|
_scene: Scene;
|
|
106
108
|
/** @hidden */
|
|
107
109
|
_cache: any;
|
package/node.js
CHANGED
package/node.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"node.js","sourceRoot":"","sources":["../../../../lts/core/generated/node.ts"],"names":[],"mappings":";AAGA,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAGtD,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAE9C,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAgB9C,cAAc;AACd;IAAA;QACW,oBAAe,GAAG,KAAK,CAAC;QACxB,gBAAW,GAAG,KAAK,CAAC;QACpB,yBAAoB,GAAG,CAAC,CAAC,CAAC;QAC1B,eAAU,GAAG,IAAI,CAAC;QAClB,qBAAgB,GAAG,IAAI,CAAC;QACxB,aAAQ,GAAG,IAAI,CAAC;QAChB,qCAAgC,GAAG,IAAI,UAAU,EAAW,CAAC;QAC7D,wBAAmB,GAAG,IAAI,UAAU,EAAQ,CAAC;IACxD,C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,GAAG,iBAAiB,CAAC,WAAW,CAAC;gBAElD,IAAM,MAAM,GAAG,WAAW,CAAC,YAAY,CAAC;gBACxC,IAAM,MAAM,GAAG,WAAW,CAAC,YAAY,CAAC;gBAExC,OAAO,CAAC,YAAY,CAAC,MAAM,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC;gBACvC,OAAO,CAAC,YAAY,CAAC,MAAM,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC;aAC1C;SACJ;QAED,OAAO;YACH,GAAG,EAAE,GAAG;YACR,GAAG,EAAE,GAAG;SACX,CAAC;IACN,CAAC;IA56BD;;;;;OAKG;IACH,6DAA6D;IAC/C,2BAAsB,GAAG,UAAC,IAAY,EAAE,IAAY,EAAE,EAAU;QAC1E,MAAM,WAAW,CAAC,gBAAgB,CAAC,CAAC;IACxC,CAAC,CAAC;IAEa,sBAAiB,GAA2B,EAAE,CAAC;IAmC9D;QADC,SAAS,EAAE;sCACQ;IAMpB;QADC,SAAS,EAAE;oCACM;IAMlB;QADC,SAAS,EAAE;0CACY;IAMxB;QADC,SAAS,EAAE;uCACM;IAMlB;QADC,SAAS,EAAE;0CACgB;IAu2BhC,WAAC;CAAA,AAh7BD,IAg7BC;SAh7BY,IAAI","sourcesContent":["/* eslint-disable @typescript-eslint/no-unused-vars */\r\nimport type { Scene } from \"./scene\";\r\nimport type { Nullable } from \"./types\";\r\nimport { Matrix, Vector3 } from \"./Maths/math.vector\";\r\nimport type { Engine } from \"./Engines/engine\";\r\nimport type { IBehaviorAware, Behavior } from \"./Behaviors/behavior\";\r\nimport { serialize } from \"./Misc/decorators\";\r\nimport type { Observer } from \"./Misc/observable\";\r\nimport { Observable } from \"./Misc/observable\";\r\nimport { EngineStore } from \"./Engines/engineStore\";\r\nimport { _WarnImport } from \"./Misc/devTools\";\r\nimport type { AbstractActionManager } from \"./Actions/abstractActionManager\";\r\nimport type { IInspectable } from \"./Misc/iInspectable\";\r\nimport type { AbstractScene } from \"./abstractScene\";\r\n\r\ndeclare type Animatable = import(\"./Animations/animatable\").Animatable;\r\ndeclare type AnimationPropertiesOverride = import(\"./Animations/animationPropertiesOverride\").AnimationPropertiesOverride;\r\ndeclare type Animation = import(\"./Animations/animation\").Animation;\r\ndeclare type AnimationRange = import(\"./Animations/animationRange\").AnimationRange;\r\ndeclare type AbstractMesh = import(\"./Meshes/abstractMesh\").AbstractMesh;\r\n\r\n/**\r\n * Defines how a node can be built from a string name.\r\n */\r\nexport type NodeConstructor = (name: string, scene: Scene, options?: any) => () => Node;\r\n\r\n/** @hidden */\r\nclass _InternalNodeDataInfo {\r\n public _doNotSerialize = false;\r\n public _isDisposed = false;\r\n public _sceneRootNodesIndex = -1;\r\n public _isEnabled = true;\r\n public _isParentEnabled = true;\r\n public _isReady = true;\r\n public _onEnabledStateChangedObservable = new Observable<boolean>();\r\n public _onClonedObservable = new Observable<Node>();\r\n}\r\n\r\n/**\r\n * Node is the basic class for all scene objects (Mesh, Light, Camera.)\r\n */\r\nexport class Node implements IBehaviorAware<Node> {\r\n protected _isDirty = false;\r\n\r\n /**\r\n * @param name\r\n * @param from\r\n * @param to\r\n * @hidden\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n public static _AnimationRangeFactory = (name: string, from: number, to: number): AnimationRange => {\r\n throw _WarnImport(\"AnimationRange\");\r\n };\r\n\r\n private static _NodeConstructors: { [key: string]: any } = {};\r\n\r\n /**\r\n * Add a new node constructor\r\n * @param type defines the type name of the node to construct\r\n * @param constructorFunc defines the constructor function\r\n */\r\n public static AddNodeConstructor(type: string, constructorFunc: NodeConstructor) {\r\n this._NodeConstructors[type] = constructorFunc;\r\n }\r\n\r\n /**\r\n * Returns a node constructor based on type name\r\n * @param type defines the type name\r\n * @param name defines the new node name\r\n * @param scene defines the hosting scene\r\n * @param options defines optional options to transmit to constructors\r\n * @returns the new constructor or null\r\n */\r\n public static Construct(type: string, name: string, scene: Scene, options?: any): Nullable<() => Node> {\r\n const constructorFunc = this._NodeConstructors[type];\r\n\r\n if (!constructorFunc) {\r\n return null;\r\n }\r\n\r\n return constructorFunc(name, scene, options);\r\n }\r\n\r\n private _nodeDataStorage = new _InternalNodeDataInfo();\r\n\r\n /**\r\n * Gets or sets the name of the node\r\n */\r\n @serialize()\r\n public name: string;\r\n\r\n /**\r\n * Gets or sets the id of the node\r\n */\r\n @serialize()\r\n public id: string;\r\n\r\n /**\r\n * Gets or sets the unique id of the node\r\n */\r\n @serialize()\r\n public uniqueId: number;\r\n\r\n /**\r\n * Gets or sets a string used to store user defined state for the node\r\n */\r\n @serialize()\r\n public state = \"\";\r\n\r\n /**\r\n * Gets or sets an object used to store user defined information for the node\r\n */\r\n @serialize()\r\n public metadata: any = null;\r\n\r\n /**\r\n * For internal use only. Please do not use.\r\n */\r\n public reservedDataStore: any = null;\r\n\r\n /**\r\n * List of inspectable custom properties (used by the Inspector)\r\n * @see https://doc.babylonjs.com/how_to/debug_layer#extensibility\r\n */\r\n public inspectableCustomProperties: IInspectable[];\r\n\r\n /**\r\n * Gets or sets a boolean used to define if the node must be serialized\r\n */\r\n public get doNotSerialize() {\r\n if (this._nodeDataStorage._doNotSerialize) {\r\n return true;\r\n }\r\n\r\n if (this._parentNode) {\r\n return this._parentNode.doNotSerialize;\r\n }\r\n\r\n return false;\r\n }\r\n\r\n public set doNotSerialize(value: boolean) {\r\n this._nodeDataStorage._doNotSerialize = value;\r\n }\r\n\r\n /** @hidden */\r\n public _parentContainer: Nullable<AbstractScene> = null;\r\n\r\n /**\r\n * Gets a list of Animations associated with the node\r\n */\r\n public animations = new Array<Animation>();\r\n protected _ranges: { [name: string]: Nullable<AnimationRange> } = {};\r\n\r\n /**\r\n * Callback raised when the node is ready to be used\r\n */\r\n public onReady: Nullable<(node: Node) => void> = null;\r\n\r\n /** @hidden */\r\n public _currentRenderId = -1;\r\n private _parentUpdateId = -1;\r\n /** @hidden */\r\n public _childUpdateId = -1;\r\n\r\n /** @hidden */\r\n public _waitingParentId: Nullable<string> = null;\r\n /** @hidden */\r\n public _waitingParentInstanceIndex: Nullable<string> = null;\r\n /** @hidden */\r\n public _scene: Scene;\r\n /** @hidden */\r\n public _cache: any = {};\r\n\r\n protected _parentNode: Nullable<Node> = null;\r\n\r\n /** @hidden */\r\n protected _children: Nullable<Node[]> = null;\r\n\r\n /** @hidden */\r\n public _worldMatrix = Matrix.Identity();\r\n /** @hidden */\r\n public _worldMatrixDeterminant = 0;\r\n /** @hidden */\r\n public _worldMatrixDeterminantIsDirty = true;\r\n\r\n /**\r\n * Gets a boolean indicating if the node has been disposed\r\n * @returns true if the node was disposed\r\n */\r\n public isDisposed(): boolean {\r\n return this._nodeDataStorage._isDisposed;\r\n }\r\n\r\n /**\r\n * Gets or sets the parent of the node (without keeping the current position in the scene)\r\n * @see https://doc.babylonjs.com/how_to/parenting\r\n */\r\n public set parent(parent: Nullable<Node>) {\r\n if (this._parentNode === parent) {\r\n return;\r\n }\r\n\r\n const previousParentNode = this._parentNode;\r\n\r\n // Remove self from list of children of parent\r\n if (this._parentNode && this._parentNode._children !== undefined && this._parentNode._children !== null) {\r\n const index = this._parentNode._children.indexOf(this);\r\n if (index !== -1) {\r\n this._parentNode._children.splice(index, 1);\r\n }\r\n\r\n if (!parent && !this._nodeDataStorage._isDisposed) {\r\n this._addToSceneRootNodes();\r\n }\r\n }\r\n\r\n // Store new parent\r\n this._parentNode = parent;\r\n\r\n // Add as child to new parent\r\n if (this._parentNode) {\r\n if (this._parentNode._children === undefined || this._parentNode._children === null) {\r\n this._parentNode._children = new Array<Node>();\r\n }\r\n this._parentNode._children.push(this);\r\n\r\n if (!previousParentNode) {\r\n this._removeFromSceneRootNodes();\r\n }\r\n }\r\n\r\n // Enabled state\r\n this._syncParentEnabledState();\r\n }\r\n\r\n public get parent(): Nullable<Node> {\r\n return this._parentNode;\r\n }\r\n\r\n /**\r\n * @param serializationObject\r\n * @hidden\r\n */\r\n public _serializeAsParent(serializationObject: any): void {\r\n serializationObject.parentId = this.uniqueId;\r\n }\r\n\r\n /** @hidden */\r\n public _addToSceneRootNodes() {\r\n if (this._nodeDataStorage._sceneRootNodesIndex === -1) {\r\n this._nodeDataStorage._sceneRootNodesIndex = this._scene.rootNodes.length;\r\n this._scene.rootNodes.push(this);\r\n }\r\n }\r\n\r\n /** @hidden */\r\n public _removeFromSceneRootNodes() {\r\n if (this._nodeDataStorage._sceneRootNodesIndex !== -1) {\r\n const rootNodes = this._scene.rootNodes;\r\n const lastIdx = rootNodes.length - 1;\r\n rootNodes[this._nodeDataStorage._sceneRootNodesIndex] = rootNodes[lastIdx];\r\n rootNodes[this._nodeDataStorage._sceneRootNodesIndex]._nodeDataStorage._sceneRootNodesIndex = this._nodeDataStorage._sceneRootNodesIndex;\r\n this._scene.rootNodes.pop();\r\n this._nodeDataStorage._sceneRootNodesIndex = -1;\r\n }\r\n }\r\n\r\n private _animationPropertiesOverride: Nullable<AnimationPropertiesOverride> = null;\r\n\r\n /**\r\n * Gets or sets the animation properties override\r\n */\r\n public get animationPropertiesOverride(): Nullable<AnimationPropertiesOverride> {\r\n if (!this._animationPropertiesOverride) {\r\n return this._scene.animationPropertiesOverride;\r\n }\r\n return this._animationPropertiesOverride;\r\n }\r\n\r\n public set animationPropertiesOverride(value: Nullable<AnimationPropertiesOverride>) {\r\n this._animationPropertiesOverride = value;\r\n }\r\n\r\n /**\r\n * Gets a string identifying the name of the class\r\n * @returns \"Node\" string\r\n */\r\n public getClassName(): string {\r\n return \"Node\";\r\n }\r\n\r\n /** @hidden */\r\n public readonly _isNode = true;\r\n\r\n /**\r\n * An event triggered when the mesh is disposed\r\n */\r\n public onDisposeObservable = new Observable<Node>();\r\n\r\n private _onDisposeObserver: Nullable<Observer<Node>> = null;\r\n /**\r\n * Sets a callback that will be raised when the node will be disposed\r\n */\r\n public set onDispose(callback: () => void) {\r\n if (this._onDisposeObserver) {\r\n this.onDisposeObservable.remove(this._onDisposeObserver);\r\n }\r\n this._onDisposeObserver = this.onDisposeObservable.add(callback);\r\n }\r\n\r\n /**\r\n * An event triggered when the enabled state of the node changes\r\n */\r\n public get onEnabledStateChangedObservable(): Observable<boolean> {\r\n return this._nodeDataStorage._onEnabledStateChangedObservable;\r\n }\r\n\r\n /**\r\n * An event triggered when the node is cloned\r\n */\r\n public get onClonedObservable(): Observable<Node> {\r\n return this._nodeDataStorage._onClonedObservable;\r\n }\r\n\r\n /**\r\n * Creates a new Node\r\n * @param name the name and id to be given to this node\r\n * @param scene the scene this node will be added to\r\n */\r\n constructor(name: string, scene: Nullable<Scene> = null) {\r\n this.name = name;\r\n this.id = name;\r\n this._scene = <Scene>(scene || EngineStore.LastCreatedScene);\r\n this.uniqueId = this._scene.getUniqueId();\r\n this._initCache();\r\n }\r\n\r\n /**\r\n * Gets the scene of the node\r\n * @returns a scene\r\n */\r\n public getScene(): Scene {\r\n return this._scene;\r\n }\r\n\r\n /**\r\n * Gets the engine of the node\r\n * @returns a Engine\r\n */\r\n public getEngine(): Engine {\r\n return this._scene.getEngine();\r\n }\r\n\r\n // Behaviors\r\n private _behaviors = new Array<Behavior<Node>>();\r\n\r\n /**\r\n * Attach a behavior to the node\r\n * @see https://doc.babylonjs.com/features/behaviour\r\n * @param behavior defines the behavior to attach\r\n * @param attachImmediately defines that the behavior must be attached even if the scene is still loading\r\n * @returns the current Node\r\n */\r\n public addBehavior(behavior: Behavior<Node>, attachImmediately = false): Node {\r\n const index = this._behaviors.indexOf(behavior);\r\n\r\n if (index !== -1) {\r\n return this;\r\n }\r\n\r\n behavior.init();\r\n if (this._scene.isLoading && !attachImmediately) {\r\n // We defer the attach when the scene will be loaded\r\n this._scene.onDataLoadedObservable.addOnce(() => {\r\n behavior.attach(this);\r\n });\r\n } else {\r\n behavior.attach(this);\r\n }\r\n this._behaviors.push(behavior);\r\n\r\n return this;\r\n }\r\n\r\n /**\r\n * Remove an attached behavior\r\n * @see https://doc.babylonjs.com/features/behaviour\r\n * @param behavior defines the behavior to attach\r\n * @returns the current Node\r\n */\r\n public removeBehavior(behavior: Behavior<Node>): Node {\r\n const index = this._behaviors.indexOf(behavior);\r\n\r\n if (index === -1) {\r\n return this;\r\n }\r\n\r\n this._behaviors[index].detach();\r\n this._behaviors.splice(index, 1);\r\n\r\n return this;\r\n }\r\n\r\n /**\r\n * Gets the list of attached behaviors\r\n * @see https://doc.babylonjs.com/features/behaviour\r\n */\r\n public get behaviors(): Behavior<Node>[] {\r\n return this._behaviors;\r\n }\r\n\r\n /**\r\n * Gets an attached behavior by name\r\n * @param name defines the name of the behavior to look for\r\n * @see https://doc.babylonjs.com/features/behaviour\r\n * @returns null if behavior was not found else the requested behavior\r\n */\r\n public getBehaviorByName(name: string): Nullable<Behavior<Node>> {\r\n for (const behavior of this._behaviors) {\r\n if (behavior.name === name) {\r\n return behavior;\r\n }\r\n }\r\n\r\n return null;\r\n }\r\n\r\n /**\r\n * Returns the latest update of the World matrix\r\n * @returns a Matrix\r\n */\r\n public getWorldMatrix(): Matrix {\r\n if (this._currentRenderId !== this._scene.getRenderId()) {\r\n this.computeWorldMatrix();\r\n }\r\n return this._worldMatrix;\r\n }\r\n\r\n /** @hidden */\r\n public _getWorldMatrixDeterminant(): number {\r\n if (this._worldMatrixDeterminantIsDirty) {\r\n this._worldMatrixDeterminantIsDirty = false;\r\n this._worldMatrixDeterminant = this._worldMatrix.determinant();\r\n }\r\n return this._worldMatrixDeterminant;\r\n }\r\n\r\n /**\r\n * Returns directly the latest state of the mesh World matrix.\r\n * A Matrix is returned.\r\n */\r\n public get worldMatrixFromCache(): Matrix {\r\n return this._worldMatrix;\r\n }\r\n\r\n // override it in derived class if you add new variables to the cache\r\n // and call the parent class method\r\n /** @hidden */\r\n public _initCache() {\r\n this._cache = {};\r\n this._cache.parent = undefined;\r\n }\r\n\r\n /**\r\n * @param force\r\n * @hidden\r\n */\r\n public updateCache(force?: boolean): void {\r\n if (!force && this.isSynchronized()) {\r\n return;\r\n }\r\n\r\n this._cache.parent = this.parent;\r\n\r\n this._updateCache();\r\n }\r\n\r\n /**\r\n * @param trigger\r\n * @param initialCall\r\n * @hidden\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n public _getActionManagerForTrigger(trigger?: number, initialCall = true): Nullable<AbstractActionManager> {\r\n if (!this.parent) {\r\n return null;\r\n }\r\n\r\n return this.parent._getActionManagerForTrigger(trigger, false);\r\n }\r\n\r\n // override it in derived class if you add new variables to the cache\r\n // and call the parent class method if !ignoreParentClass\r\n /**\r\n * @param ignoreParentClass\r\n * @hidden\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n public _updateCache(ignoreParentClass?: boolean): void {}\r\n\r\n // override it in derived class if you add new variables to the cache\r\n /** @hidden */\r\n public _isSynchronized(): boolean {\r\n return true;\r\n }\r\n\r\n /** @hidden */\r\n public _markSyncedWithParent() {\r\n if (this._parentNode) {\r\n this._parentUpdateId = this._parentNode._childUpdateId;\r\n }\r\n }\r\n\r\n /** @hidden */\r\n public isSynchronizedWithParent(): boolean {\r\n if (!this._parentNode) {\r\n return true;\r\n }\r\n\r\n if (this._parentNode._isDirty || this._parentUpdateId !== this._parentNode._childUpdateId) {\r\n return false;\r\n }\r\n\r\n return this._parentNode.isSynchronized();\r\n }\r\n\r\n /** @hidden */\r\n public isSynchronized(): boolean {\r\n if (this._cache.parent !== this._parentNode) {\r\n this._cache.parent = this._parentNode;\r\n return false;\r\n }\r\n\r\n if (this._parentNode && !this.isSynchronizedWithParent()) {\r\n return false;\r\n }\r\n\r\n return this._isSynchronized();\r\n }\r\n\r\n /**\r\n * Is this node ready to be used/rendered\r\n * @param completeCheck defines if a complete check (including materials and lights) has to be done (false by default)\r\n * @return true if the node is ready\r\n */\r\n public isReady(completeCheck = false): boolean {\r\n return this._nodeDataStorage._isReady;\r\n }\r\n\r\n /**\r\n * Flag the node as dirty (Forcing it to update everything)\r\n * @param property helps children apply precise \"dirtyfication\"\r\n * @returns this node\r\n */\r\n public markAsDirty(property?: string): Node {\r\n this._currentRenderId = Number.MAX_VALUE;\r\n this._isDirty = true;\r\n return this;\r\n }\r\n\r\n /**\r\n * Is this node enabled?\r\n * If the node has a parent, all ancestors will be checked and false will be returned if any are false (not enabled), otherwise will return true\r\n * @param checkAncestors indicates if this method should check the ancestors. The default is to check the ancestors. If set to false, the method will return the value of this node without checking ancestors\r\n * @return whether this node (and its parent) is enabled\r\n */\r\n public isEnabled(checkAncestors: boolean = true): boolean {\r\n if (checkAncestors === false) {\r\n return this._nodeDataStorage._isEnabled;\r\n }\r\n\r\n if (!this._nodeDataStorage._isEnabled) {\r\n return false;\r\n }\r\n\r\n return this._nodeDataStorage._isParentEnabled;\r\n }\r\n\r\n /** @hidden */\r\n protected _syncParentEnabledState() {\r\n this._nodeDataStorage._isParentEnabled = this._parentNode ? this._parentNode.isEnabled() : true;\r\n\r\n if (this._children) {\r\n this._children.forEach((c) => {\r\n c._syncParentEnabledState(); // Force children to update accordingly\r\n });\r\n }\r\n }\r\n\r\n /**\r\n * Set the enabled state of this node\r\n * @param value defines the new enabled state\r\n */\r\n public setEnabled(value: boolean): void {\r\n if (this._nodeDataStorage._isEnabled === value) {\r\n return;\r\n }\r\n this._nodeDataStorage._isEnabled = value;\r\n\r\n this._nodeDataStorage._onEnabledStateChangedObservable.notifyObservers(value);\r\n\r\n this._syncParentEnabledState();\r\n }\r\n\r\n /**\r\n * Is this node a descendant of the given node?\r\n * The function will iterate up the hierarchy until the ancestor was found or no more parents defined\r\n * @param ancestor defines the parent node to inspect\r\n * @returns a boolean indicating if this node is a descendant of the given node\r\n */\r\n public isDescendantOf(ancestor: Node): boolean {\r\n if (this.parent) {\r\n if (this.parent === ancestor) {\r\n return true;\r\n }\r\n\r\n return this.parent.isDescendantOf(ancestor);\r\n }\r\n return false;\r\n }\r\n\r\n /**\r\n * @param results\r\n * @param directDescendantsOnly\r\n * @param predicate\r\n * @hidden\r\n */\r\n public _getDescendants(results: Node[], directDescendantsOnly: boolean = false, predicate?: (node: Node) => boolean): void {\r\n if (!this._children) {\r\n return;\r\n }\r\n\r\n for (let index = 0; index < this._children.length; index++) {\r\n const item = this._children[index];\r\n\r\n if (!predicate || predicate(item)) {\r\n results.push(item);\r\n }\r\n\r\n if (!directDescendantsOnly) {\r\n item._getDescendants(results, false, predicate);\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Will return all nodes that have this node as ascendant\r\n * @param directDescendantsOnly defines if true only direct descendants of 'this' will be considered, if false direct and also indirect (children of children, an so on in a recursive manner) descendants of 'this' will be considered\r\n * @param predicate defines an optional predicate that will be called on every evaluated child, the predicate must return true for a given child to be part of the result, otherwise it will be ignored\r\n * @return all children nodes of all types\r\n */\r\n public getDescendants<T extends Node>(directDescendantsOnly?: boolean, predicate?: (node: Node) => node is T): T[];\r\n\r\n /**\r\n * Will return all nodes that have this node as ascendant\r\n * @param directDescendantsOnly defines if true only direct descendants of 'this' will be considered, if false direct and also indirect (children of children, an so on in a recursive manner) descendants of 'this' will be considered\r\n * @param predicate defines an optional predicate that will be called on every evaluated child, the predicate must return true for a given child to be part of the result, otherwise it will be ignored\r\n * @return all children nodes of all types\r\n */\r\n public getDescendants(directDescendantsOnly?: boolean, predicate?: (node: Node) => boolean): Node[];\r\n\r\n /**\r\n * Will return all nodes that have this node as ascendant\r\n * @param directDescendantsOnly defines if true only direct descendants of 'this' will be considered, if false direct and also indirect (children of children, an so on in a recursive manner) descendants of 'this' will be considered\r\n * @param predicate defines an optional predicate that will be called on every evaluated child, the predicate must return true for a given child to be part of the result, otherwise it will be ignored\r\n * @return all children nodes of all types\r\n */\r\n public getDescendants(directDescendantsOnly?: boolean, predicate?: (node: Node) => boolean): Node[] {\r\n const results = new Array<Node>();\r\n\r\n this._getDescendants(results, directDescendantsOnly, predicate);\r\n\r\n return results;\r\n }\r\n\r\n /**\r\n * Get all child-meshes of this node\r\n * @param directDescendantsOnly defines if true only direct descendants of 'this' will be considered, if false direct and also indirect (children of children, an so on in a recursive manner) descendants of 'this' will be considered (Default: false)\r\n * @param predicate defines an optional predicate that will be called on every evaluated child, the predicate must return true for a given child to be part of the result, otherwise it will be ignored\r\n * @returns an array of AbstractMesh\r\n */\r\n public getChildMeshes<T extends AbstractMesh>(directDescendantsOnly?: boolean, predicate?: (node: Node) => node is T): T[];\r\n\r\n /**\r\n * Get all child-meshes of this node\r\n * @param directDescendantsOnly defines if true only direct descendants of 'this' will be considered, if false direct and also indirect (children of children, an so on in a recursive manner) descendants of 'this' will be considered (Default: false)\r\n * @param predicate defines an optional predicate that will be called on every evaluated child, the predicate must return true for a given child to be part of the result, otherwise it will be ignored\r\n * @returns an array of AbstractMesh\r\n */\r\n public getChildMeshes(directDescendantsOnly?: boolean, predicate?: (node: Node) => boolean): AbstractMesh[];\r\n\r\n /**\r\n * Get all child-meshes of this node\r\n * @param directDescendantsOnly defines if true only direct descendants of 'this' will be considered, if false direct and also indirect (children of children, an so on in a recursive manner) descendants of 'this' will be considered (Default: false)\r\n * @param predicate defines an optional predicate that will be called on every evaluated child, the predicate must return true for a given child to be part of the result, otherwise it will be ignored\r\n * @returns an array of AbstractMesh\r\n */\r\n public getChildMeshes(directDescendantsOnly?: boolean, predicate?: (node: Node) => boolean): AbstractMesh[] {\r\n const results: Array<AbstractMesh> = [];\r\n this._getDescendants(results, directDescendantsOnly, (node: Node) => {\r\n return (!predicate || predicate(node)) && (<AbstractMesh>node).cullingStrategy !== undefined;\r\n });\r\n return results;\r\n }\r\n\r\n /**\r\n * Get all direct children of this node\r\n * @param predicate defines an optional predicate that will be called on every evaluated child, the predicate must return true for a given child to be part of the result, otherwise it will be ignored\r\n * @param directDescendantsOnly defines if true only direct descendants of 'this' will be considered, if false direct and also indirect (children of children, an so on in a recursive manner) descendants of 'this' will be considered (Default: true)\r\n * @returns an array of Node\r\n */\r\n public getChildren<T extends Node>(predicate?: (node: Node) => node is T, directDescendantsOnly?: boolean): T[];\r\n\r\n /**\r\n * Get all direct children of this node\r\n * @param predicate defines an optional predicate that will be called on every evaluated child, the predicate must return true for a given child to be part of the result, otherwise it will be ignored\r\n * @param directDescendantsOnly defines if true only direct descendants of 'this' will be considered, if false direct and also indirect (children of children, an so on in a recursive manner) descendants of 'this' will be considered (Default: true)\r\n * @returns an array of Node\r\n */\r\n public getChildren(predicate?: (node: Node) => boolean, directDescendantsOnly?: boolean): Node[];\r\n\r\n /**\r\n * Get all direct children of this node\r\n * @param predicate defines an optional predicate that will be called on every evaluated child, the predicate must return true for a given child to be part of the result, otherwise it will be ignored\r\n * @param directDescendantsOnly defines if true only direct descendants of 'this' will be considered, if false direct and also indirect (children of children, an so on in a recursive manner) descendants of 'this' will be considered (Default: true)\r\n * @returns an array of Node\r\n */\r\n public getChildren(predicate?: (node: Node) => boolean, directDescendantsOnly = true): Node[] {\r\n return this.getDescendants(directDescendantsOnly, predicate);\r\n }\r\n\r\n /**\r\n * @param state\r\n * @hidden\r\n */\r\n public _setReady(state: boolean): void {\r\n if (state === this._nodeDataStorage._isReady) {\r\n return;\r\n }\r\n\r\n if (!state) {\r\n this._nodeDataStorage._isReady = false;\r\n return;\r\n }\r\n\r\n if (this.onReady) {\r\n this.onReady(this);\r\n }\r\n this._nodeDataStorage._isReady = true;\r\n }\r\n\r\n /**\r\n * Get an animation by name\r\n * @param name defines the name of the animation to look for\r\n * @returns null if not found else the requested animation\r\n */\r\n public getAnimationByName(name: string): Nullable<Animation> {\r\n for (let i = 0; i < this.animations.length; i++) {\r\n const animation = this.animations[i];\r\n\r\n if (animation.name === name) {\r\n return animation;\r\n }\r\n }\r\n\r\n return null;\r\n }\r\n\r\n /**\r\n * Creates an animation range for this node\r\n * @param name defines the name of the range\r\n * @param from defines the starting key\r\n * @param to defines the end key\r\n */\r\n public createAnimationRange(name: string, from: number, to: number): void {\r\n // check name not already in use\r\n if (!this._ranges[name]) {\r\n this._ranges[name] = Node._AnimationRangeFactory(name, from, to);\r\n for (let i = 0, nAnimations = this.animations.length; i < nAnimations; i++) {\r\n if (this.animations[i]) {\r\n this.animations[i].createRange(name, from, to);\r\n }\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Delete a specific animation range\r\n * @param name defines the name of the range to delete\r\n * @param deleteFrames defines if animation frames from the range must be deleted as well\r\n */\r\n public deleteAnimationRange(name: string, deleteFrames = true): void {\r\n for (let i = 0, nAnimations = this.animations.length; i < nAnimations; i++) {\r\n if (this.animations[i]) {\r\n this.animations[i].deleteRange(name, deleteFrames);\r\n }\r\n }\r\n this._ranges[name] = null; // said much faster than 'delete this._range[name]'\r\n }\r\n\r\n /**\r\n * Get an animation range by name\r\n * @param name defines the name of the animation range to look for\r\n * @returns null if not found else the requested animation range\r\n */\r\n public getAnimationRange(name: string): Nullable<AnimationRange> {\r\n return this._ranges[name] || null;\r\n }\r\n\r\n /**\r\n * Gets the list of all animation ranges defined on this node\r\n * @returns an array\r\n */\r\n public getAnimationRanges(): Nullable<AnimationRange>[] {\r\n const animationRanges: Nullable<AnimationRange>[] = [];\r\n let name: string;\r\n for (name in this._ranges) {\r\n animationRanges.push(this._ranges[name]);\r\n }\r\n return animationRanges;\r\n }\r\n\r\n /**\r\n * Will start the animation sequence\r\n * @param name defines the range frames for animation sequence\r\n * @param loop defines if the animation should loop (false by default)\r\n * @param speedRatio defines the speed factor in which to run the animation (1 by default)\r\n * @param onAnimationEnd defines a function to be executed when the animation ended (undefined by default)\r\n * @returns the object created for this animation. If range does not exist, it will return null\r\n */\r\n public beginAnimation(name: string, loop?: boolean, speedRatio?: number, onAnimationEnd?: () => void): Nullable<Animatable> {\r\n const range = this.getAnimationRange(name);\r\n\r\n if (!range) {\r\n return null;\r\n }\r\n\r\n return this._scene.beginAnimation(this, range.from, range.to, loop, speedRatio, onAnimationEnd);\r\n }\r\n\r\n /**\r\n * Serialize animation ranges into a JSON compatible object\r\n * @returns serialization object\r\n */\r\n public serializeAnimationRanges(): any {\r\n const serializationRanges = [];\r\n for (const name in this._ranges) {\r\n const localRange = this._ranges[name];\r\n if (!localRange) {\r\n continue;\r\n }\r\n const range: any = {};\r\n range.name = name;\r\n range.from = localRange.from;\r\n range.to = localRange.to;\r\n serializationRanges.push(range);\r\n }\r\n return serializationRanges;\r\n }\r\n\r\n /**\r\n * Computes the world matrix of the node\r\n * @param force defines if the cache version should be invalidated forcing the world matrix to be created from scratch\r\n * @returns the world matrix\r\n */\r\n public computeWorldMatrix(force?: boolean): Matrix {\r\n if (!this._worldMatrix) {\r\n this._worldMatrix = Matrix.Identity();\r\n }\r\n return this._worldMatrix;\r\n }\r\n\r\n /**\r\n * Releases resources associated with this node.\r\n * @param doNotRecurse Set to true to not recurse into each children (recurse into each children by default)\r\n * @param disposeMaterialAndTextures Set to true to also dispose referenced materials and textures (false by default)\r\n */\r\n public dispose(doNotRecurse?: boolean, disposeMaterialAndTextures = false): void {\r\n this._nodeDataStorage._isDisposed = true;\r\n\r\n if (!doNotRecurse) {\r\n const nodes = this.getDescendants(true);\r\n for (const node of nodes) {\r\n node.dispose(doNotRecurse, disposeMaterialAndTextures);\r\n }\r\n }\r\n\r\n if (!this.parent) {\r\n this._removeFromSceneRootNodes();\r\n } else {\r\n this.parent = null;\r\n }\r\n\r\n // Callback\r\n this.onDisposeObservable.notifyObservers(this);\r\n this.onDisposeObservable.clear();\r\n\r\n this.onEnabledStateChangedObservable.clear();\r\n this.onClonedObservable.clear();\r\n\r\n // Behaviors\r\n for (const behavior of this._behaviors) {\r\n behavior.detach();\r\n }\r\n\r\n this._behaviors.length = 0;\r\n\r\n this.metadata = null;\r\n }\r\n\r\n /**\r\n * Parse animation range data from a serialization object and store them into a given node\r\n * @param node defines where to store the animation ranges\r\n * @param parsedNode defines the serialization object to read data from\r\n * @param scene defines the hosting scene\r\n */\r\n public static ParseAnimationRanges(node: Node, parsedNode: any, scene: Scene): void {\r\n if (parsedNode.ranges) {\r\n for (let index = 0; index < parsedNode.ranges.length; index++) {\r\n const data = parsedNode.ranges[index];\r\n node.createAnimationRange(data.name, data.from, data.to);\r\n }\r\n }\r\n }\r\n /**\r\n * Return the minimum and maximum world vectors of the entire hierarchy under current node\r\n * @param includeDescendants Include bounding info from descendants as well (true by default)\r\n * @param predicate defines a callback function that can be customize to filter what meshes should be included in the list used to compute the bounding vectors\r\n * @returns the new bounding vectors\r\n */\r\n public getHierarchyBoundingVectors(includeDescendants = true, predicate: Nullable<(abstractMesh: AbstractMesh) => boolean> = null): { min: Vector3; max: Vector3 } {\r\n // Ensures that all world matrix will be recomputed.\r\n this.getScene().incrementRenderId();\r\n\r\n this.computeWorldMatrix(true);\r\n\r\n let min: Vector3;\r\n let max: Vector3;\r\n\r\n const thisAbstractMesh = this as Node as AbstractMesh;\r\n if (thisAbstractMesh.getBoundingInfo && thisAbstractMesh.subMeshes) {\r\n // If this is an abstract mesh get its bounding info\r\n const boundingInfo = thisAbstractMesh.getBoundingInfo();\r\n min = boundingInfo.boundingBox.minimumWorld.clone();\r\n max = boundingInfo.boundingBox.maximumWorld.clone();\r\n } else {\r\n min = new Vector3(Number.MAX_VALUE, Number.MAX_VALUE, Number.MAX_VALUE);\r\n max = new Vector3(-Number.MAX_VALUE, -Number.MAX_VALUE, -Number.MAX_VALUE);\r\n }\r\n\r\n if (includeDescendants) {\r\n const descendants = this.getDescendants(false);\r\n\r\n for (const descendant of descendants) {\r\n const childMesh = <AbstractMesh>descendant;\r\n childMesh.computeWorldMatrix(true);\r\n\r\n // Filters meshes based on custom predicate function.\r\n if (predicate && !predicate(childMesh)) {\r\n continue;\r\n }\r\n\r\n //make sure we have the needed params to get mix and max\r\n if (!childMesh.getBoundingInfo || childMesh.getTotalVertices() === 0) {\r\n continue;\r\n }\r\n\r\n const childBoundingInfo = childMesh.getBoundingInfo();\r\n const boundingBox = childBoundingInfo.boundingBox;\r\n\r\n const minBox = boundingBox.minimumWorld;\r\n const maxBox = boundingBox.maximumWorld;\r\n\r\n Vector3.CheckExtends(minBox, min, max);\r\n Vector3.CheckExtends(maxBox, min, max);\r\n }\r\n }\r\n\r\n return {\r\n min: min,\r\n max: max,\r\n };\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"node.js","sourceRoot":"","sources":["../../../../lts/core/generated/node.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sCACQ;IAMpB;QADC,SAAS,EAAE;oCACM;IAMlB;QADC,SAAS,EAAE;0CACY;IAMxB;QADC,SAAS,EAAE;uCACM;IAMlB;QADC,SAAS,EAAE;0CACgB;IAy2BhC,WAAC;CAAA,AAl7BD,IAk7BC;SAl7BY,IAAI","sourcesContent":["/* eslint-disable @typescript-eslint/no-unused-vars */\r\nimport type { Scene } from \"./scene\";\r\nimport type { Nullable } from \"./types\";\r\nimport { Matrix, Vector3 } from \"./Maths/math.vector\";\r\nimport type { Engine } from \"./Engines/engine\";\r\nimport type { IBehaviorAware, Behavior } from \"./Behaviors/behavior\";\r\nimport { serialize } from \"./Misc/decorators\";\r\nimport type { Observer } from \"./Misc/observable\";\r\nimport { Observable } from \"./Misc/observable\";\r\nimport { EngineStore } from \"./Engines/engineStore\";\r\nimport { _WarnImport } from \"./Misc/devTools\";\r\nimport type { AbstractActionManager } from \"./Actions/abstractActionManager\";\r\nimport type { IInspectable } from \"./Misc/iInspectable\";\r\nimport type { AbstractScene } from \"./abstractScene\";\r\n\r\ndeclare type Animatable = import(\"./Animations/animatable\").Animatable;\r\ndeclare type AnimationPropertiesOverride = import(\"./Animations/animationPropertiesOverride\").AnimationPropertiesOverride;\r\ndeclare type Animation = import(\"./Animations/animation\").Animation;\r\ndeclare type AnimationRange = import(\"./Animations/animationRange\").AnimationRange;\r\ndeclare type AbstractMesh = import(\"./Meshes/abstractMesh\").AbstractMesh;\r\n\r\n/**\r\n * Defines how a node can be built from a string name.\r\n */\r\nexport type NodeConstructor = (name: string, scene: Scene, options?: any) => () => Node;\r\n\r\n/** @hidden */\r\nclass _InternalNodeDataInfo {\r\n public _doNotSerialize = false;\r\n public _isDisposed = false;\r\n public _sceneRootNodesIndex = -1;\r\n public _isEnabled = true;\r\n public _isParentEnabled = true;\r\n public _isReady = true;\r\n public _onEnabledStateChangedObservable = new Observable<boolean>();\r\n public _onClonedObservable = new Observable<Node>();\r\n}\r\n\r\n/**\r\n * Node is the basic class for all scene objects (Mesh, Light, Camera.)\r\n */\r\nexport class Node implements IBehaviorAware<Node> {\r\n protected _isDirty = false;\r\n\r\n /**\r\n * @param name\r\n * @param from\r\n * @param to\r\n * @hidden\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n public static _AnimationRangeFactory = (name: string, from: number, to: number): AnimationRange => {\r\n throw _WarnImport(\"AnimationRange\");\r\n };\r\n\r\n private static _NodeConstructors: { [key: string]: any } = {};\r\n\r\n /**\r\n * Add a new node constructor\r\n * @param type defines the type name of the node to construct\r\n * @param constructorFunc defines the constructor function\r\n */\r\n public static AddNodeConstructor(type: string, constructorFunc: NodeConstructor) {\r\n this._NodeConstructors[type] = constructorFunc;\r\n }\r\n\r\n /**\r\n * Returns a node constructor based on type name\r\n * @param type defines the type name\r\n * @param name defines the new node name\r\n * @param scene defines the hosting scene\r\n * @param options defines optional options to transmit to constructors\r\n * @returns the new constructor or null\r\n */\r\n public static Construct(type: string, name: string, scene: Scene, options?: any): Nullable<() => Node> {\r\n const constructorFunc = this._NodeConstructors[type];\r\n\r\n if (!constructorFunc) {\r\n return null;\r\n }\r\n\r\n return constructorFunc(name, scene, options);\r\n }\r\n\r\n private _nodeDataStorage = new _InternalNodeDataInfo();\r\n\r\n /**\r\n * Gets or sets the name of the node\r\n */\r\n @serialize()\r\n public name: string;\r\n\r\n /**\r\n * Gets or sets the id of the node\r\n */\r\n @serialize()\r\n public id: string;\r\n\r\n /**\r\n * Gets or sets the unique id of the node\r\n */\r\n @serialize()\r\n public uniqueId: number;\r\n\r\n /**\r\n * Gets or sets a string used to store user defined state for the node\r\n */\r\n @serialize()\r\n public state = \"\";\r\n\r\n /**\r\n * Gets or sets an object used to store user defined information for the node\r\n */\r\n @serialize()\r\n public metadata: any = null;\r\n\r\n /**\r\n * For internal use only. Please do not use.\r\n */\r\n public reservedDataStore: any = null;\r\n\r\n /**\r\n * List of inspectable custom properties (used by the Inspector)\r\n * @see https://doc.babylonjs.com/how_to/debug_layer#extensibility\r\n */\r\n public inspectableCustomProperties: IInspectable[];\r\n\r\n /**\r\n * Gets or sets a boolean used to define if the node must be serialized\r\n */\r\n public get doNotSerialize() {\r\n if (this._nodeDataStorage._doNotSerialize) {\r\n return true;\r\n }\r\n\r\n if (this._parentNode) {\r\n return this._parentNode.doNotSerialize;\r\n }\r\n\r\n return false;\r\n }\r\n\r\n public set doNotSerialize(value: boolean) {\r\n this._nodeDataStorage._doNotSerialize = value;\r\n }\r\n\r\n /** @hidden */\r\n public _parentContainer: Nullable<AbstractScene> = null;\r\n\r\n /**\r\n * Gets a list of Animations associated with the node\r\n */\r\n public animations = new Array<Animation>();\r\n protected _ranges: { [name: string]: Nullable<AnimationRange> } = {};\r\n\r\n /**\r\n * Callback raised when the node is ready to be used\r\n */\r\n public onReady: Nullable<(node: Node) => void> = null;\r\n\r\n /** @hidden */\r\n public _currentRenderId = -1;\r\n private _parentUpdateId = -1;\r\n /** @hidden */\r\n public _childUpdateId = -1;\r\n\r\n /** @hidden */\r\n public _waitingParentId: Nullable<string> = null;\r\n /** @hidden */\r\n public _waitingParentInstanceIndex: Nullable<string> = null;\r\n /** @hidden */\r\n public _waitingParsedUniqueId: Nullable<number> = null;\r\n /** @hidden */\r\n public _scene: Scene;\r\n /** @hidden */\r\n public _cache: any = {};\r\n\r\n protected _parentNode: Nullable<Node> = null;\r\n\r\n /** @hidden */\r\n protected _children: Nullable<Node[]> = null;\r\n\r\n /** @hidden */\r\n public _worldMatrix = Matrix.Identity();\r\n /** @hidden */\r\n public _worldMatrixDeterminant = 0;\r\n /** @hidden */\r\n public _worldMatrixDeterminantIsDirty = true;\r\n\r\n /**\r\n * Gets a boolean indicating if the node has been disposed\r\n * @returns true if the node was disposed\r\n */\r\n public isDisposed(): boolean {\r\n return this._nodeDataStorage._isDisposed;\r\n }\r\n\r\n /**\r\n * Gets or sets the parent of the node (without keeping the current position in the scene)\r\n * @see https://doc.babylonjs.com/how_to/parenting\r\n */\r\n public set parent(parent: Nullable<Node>) {\r\n if (this._parentNode === parent) {\r\n return;\r\n }\r\n\r\n const previousParentNode = this._parentNode;\r\n\r\n // Remove self from list of children of parent\r\n if (this._parentNode && this._parentNode._children !== undefined && this._parentNode._children !== null) {\r\n const index = this._parentNode._children.indexOf(this);\r\n if (index !== -1) {\r\n this._parentNode._children.splice(index, 1);\r\n }\r\n\r\n if (!parent && !this._nodeDataStorage._isDisposed) {\r\n this._addToSceneRootNodes();\r\n }\r\n }\r\n\r\n // Store new parent\r\n this._parentNode = parent;\r\n\r\n // Add as child to new parent\r\n if (this._parentNode) {\r\n if (this._parentNode._children === undefined || this._parentNode._children === null) {\r\n this._parentNode._children = new Array<Node>();\r\n }\r\n this._parentNode._children.push(this);\r\n\r\n if (!previousParentNode) {\r\n this._removeFromSceneRootNodes();\r\n }\r\n }\r\n\r\n // Enabled state\r\n this._syncParentEnabledState();\r\n }\r\n\r\n public get parent(): Nullable<Node> {\r\n return this._parentNode;\r\n }\r\n\r\n /**\r\n * @param serializationObject\r\n * @hidden\r\n */\r\n public _serializeAsParent(serializationObject: any): void {\r\n serializationObject.parentId = this.uniqueId;\r\n }\r\n\r\n /** @hidden */\r\n public _addToSceneRootNodes() {\r\n if (this._nodeDataStorage._sceneRootNodesIndex === -1) {\r\n this._nodeDataStorage._sceneRootNodesIndex = this._scene.rootNodes.length;\r\n this._scene.rootNodes.push(this);\r\n }\r\n }\r\n\r\n /** @hidden */\r\n public _removeFromSceneRootNodes() {\r\n if (this._nodeDataStorage._sceneRootNodesIndex !== -1) {\r\n const rootNodes = this._scene.rootNodes;\r\n const lastIdx = rootNodes.length - 1;\r\n rootNodes[this._nodeDataStorage._sceneRootNodesIndex] = rootNodes[lastIdx];\r\n rootNodes[this._nodeDataStorage._sceneRootNodesIndex]._nodeDataStorage._sceneRootNodesIndex = this._nodeDataStorage._sceneRootNodesIndex;\r\n this._scene.rootNodes.pop();\r\n this._nodeDataStorage._sceneRootNodesIndex = -1;\r\n }\r\n }\r\n\r\n private _animationPropertiesOverride: Nullable<AnimationPropertiesOverride> = null;\r\n\r\n /**\r\n * Gets or sets the animation properties override\r\n */\r\n public get animationPropertiesOverride(): Nullable<AnimationPropertiesOverride> {\r\n if (!this._animationPropertiesOverride) {\r\n return this._scene.animationPropertiesOverride;\r\n }\r\n return this._animationPropertiesOverride;\r\n }\r\n\r\n public set animationPropertiesOverride(value: Nullable<AnimationPropertiesOverride>) {\r\n this._animationPropertiesOverride = value;\r\n }\r\n\r\n /**\r\n * Gets a string identifying the name of the class\r\n * @returns \"Node\" string\r\n */\r\n public getClassName(): string {\r\n return \"Node\";\r\n }\r\n\r\n /** @hidden */\r\n public readonly _isNode = true;\r\n\r\n /**\r\n * An event triggered when the mesh is disposed\r\n */\r\n public onDisposeObservable = new Observable<Node>();\r\n\r\n private _onDisposeObserver: Nullable<Observer<Node>> = null;\r\n /**\r\n * Sets a callback that will be raised when the node will be disposed\r\n */\r\n public set onDispose(callback: () => void) {\r\n if (this._onDisposeObserver) {\r\n this.onDisposeObservable.remove(this._onDisposeObserver);\r\n }\r\n this._onDisposeObserver = this.onDisposeObservable.add(callback);\r\n }\r\n\r\n /**\r\n * An event triggered when the enabled state of the node changes\r\n */\r\n public get onEnabledStateChangedObservable(): Observable<boolean> {\r\n return this._nodeDataStorage._onEnabledStateChangedObservable;\r\n }\r\n\r\n /**\r\n * An event triggered when the node is cloned\r\n */\r\n public get onClonedObservable(): Observable<Node> {\r\n return this._nodeDataStorage._onClonedObservable;\r\n }\r\n\r\n /**\r\n * Creates a new Node\r\n * @param name the name and id to be given to this node\r\n * @param scene the scene this node will be added to\r\n */\r\n constructor(name: string, scene: Nullable<Scene> = null) {\r\n this.name = name;\r\n this.id = name;\r\n this._scene = <Scene>(scene || EngineStore.LastCreatedScene);\r\n this.uniqueId = this._scene.getUniqueId();\r\n this._initCache();\r\n }\r\n\r\n /**\r\n * Gets the scene of the node\r\n * @returns a scene\r\n */\r\n public getScene(): Scene {\r\n return this._scene;\r\n }\r\n\r\n /**\r\n * Gets the engine of the node\r\n * @returns a Engine\r\n */\r\n public getEngine(): Engine {\r\n return this._scene.getEngine();\r\n }\r\n\r\n // Behaviors\r\n private _behaviors = new Array<Behavior<Node>>();\r\n\r\n /**\r\n * Attach a behavior to the node\r\n * @see https://doc.babylonjs.com/features/behaviour\r\n * @param behavior defines the behavior to attach\r\n * @param attachImmediately defines that the behavior must be attached even if the scene is still loading\r\n * @returns the current Node\r\n */\r\n public addBehavior(behavior: Behavior<Node>, attachImmediately = false): Node {\r\n const index = this._behaviors.indexOf(behavior);\r\n\r\n if (index !== -1) {\r\n return this;\r\n }\r\n\r\n behavior.init();\r\n if (this._scene.isLoading && !attachImmediately) {\r\n // We defer the attach when the scene will be loaded\r\n this._scene.onDataLoadedObservable.addOnce(() => {\r\n behavior.attach(this);\r\n });\r\n } else {\r\n behavior.attach(this);\r\n }\r\n this._behaviors.push(behavior);\r\n\r\n return this;\r\n }\r\n\r\n /**\r\n * Remove an attached behavior\r\n * @see https://doc.babylonjs.com/features/behaviour\r\n * @param behavior defines the behavior to attach\r\n * @returns the current Node\r\n */\r\n public removeBehavior(behavior: Behavior<Node>): Node {\r\n const index = this._behaviors.indexOf(behavior);\r\n\r\n if (index === -1) {\r\n return this;\r\n }\r\n\r\n this._behaviors[index].detach();\r\n this._behaviors.splice(index, 1);\r\n\r\n return this;\r\n }\r\n\r\n /**\r\n * Gets the list of attached behaviors\r\n * @see https://doc.babylonjs.com/features/behaviour\r\n */\r\n public get behaviors(): Behavior<Node>[] {\r\n return this._behaviors;\r\n }\r\n\r\n /**\r\n * Gets an attached behavior by name\r\n * @param name defines the name of the behavior to look for\r\n * @see https://doc.babylonjs.com/features/behaviour\r\n * @returns null if behavior was not found else the requested behavior\r\n */\r\n public getBehaviorByName(name: string): Nullable<Behavior<Node>> {\r\n for (const behavior of this._behaviors) {\r\n if (behavior.name === name) {\r\n return behavior;\r\n }\r\n }\r\n\r\n return null;\r\n }\r\n\r\n /**\r\n * Returns the latest update of the World matrix\r\n * @returns a Matrix\r\n */\r\n public getWorldMatrix(): Matrix {\r\n if (this._currentRenderId !== this._scene.getRenderId()) {\r\n this.computeWorldMatrix();\r\n }\r\n return this._worldMatrix;\r\n }\r\n\r\n /** @hidden */\r\n public _getWorldMatrixDeterminant(): number {\r\n if (this._worldMatrixDeterminantIsDirty) {\r\n this._worldMatrixDeterminantIsDirty = false;\r\n this._worldMatrixDeterminant = this._worldMatrix.determinant();\r\n }\r\n return this._worldMatrixDeterminant;\r\n }\r\n\r\n /**\r\n * Returns directly the latest state of the mesh World matrix.\r\n * A Matrix is returned.\r\n */\r\n public get worldMatrixFromCache(): Matrix {\r\n return this._worldMatrix;\r\n }\r\n\r\n // override it in derived class if you add new variables to the cache\r\n // and call the parent class method\r\n /** @hidden */\r\n public _initCache() {\r\n this._cache = {};\r\n this._cache.parent = undefined;\r\n }\r\n\r\n /**\r\n * @param force\r\n * @hidden\r\n */\r\n public updateCache(force?: boolean): void {\r\n if (!force && this.isSynchronized()) {\r\n return;\r\n }\r\n\r\n this._cache.parent = this.parent;\r\n\r\n this._updateCache();\r\n }\r\n\r\n /**\r\n * @param trigger\r\n * @param initialCall\r\n * @hidden\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n public _getActionManagerForTrigger(trigger?: number, initialCall = true): Nullable<AbstractActionManager> {\r\n if (!this.parent) {\r\n return null;\r\n }\r\n\r\n return this.parent._getActionManagerForTrigger(trigger, false);\r\n }\r\n\r\n // override it in derived class if you add new variables to the cache\r\n // and call the parent class method if !ignoreParentClass\r\n /**\r\n * @param ignoreParentClass\r\n * @hidden\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n public _updateCache(ignoreParentClass?: boolean): void {}\r\n\r\n // override it in derived class if you add new variables to the cache\r\n /** @hidden */\r\n public _isSynchronized(): boolean {\r\n return true;\r\n }\r\n\r\n /** @hidden */\r\n public _markSyncedWithParent() {\r\n if (this._parentNode) {\r\n this._parentUpdateId = this._parentNode._childUpdateId;\r\n }\r\n }\r\n\r\n /** @hidden */\r\n public isSynchronizedWithParent(): boolean {\r\n if (!this._parentNode) {\r\n return true;\r\n }\r\n\r\n if (this._parentNode._isDirty || this._parentUpdateId !== this._parentNode._childUpdateId) {\r\n return false;\r\n }\r\n\r\n return this._parentNode.isSynchronized();\r\n }\r\n\r\n /** @hidden */\r\n public isSynchronized(): boolean {\r\n if (this._cache.parent !== this._parentNode) {\r\n this._cache.parent = this._parentNode;\r\n return false;\r\n }\r\n\r\n if (this._parentNode && !this.isSynchronizedWithParent()) {\r\n return false;\r\n }\r\n\r\n return this._isSynchronized();\r\n }\r\n\r\n /**\r\n * Is this node ready to be used/rendered\r\n * @param completeCheck defines if a complete check (including materials and lights) has to be done (false by default)\r\n * @return true if the node is ready\r\n */\r\n public isReady(completeCheck = false): boolean {\r\n return this._nodeDataStorage._isReady;\r\n }\r\n\r\n /**\r\n * Flag the node as dirty (Forcing it to update everything)\r\n * @param property helps children apply precise \"dirtyfication\"\r\n * @returns this node\r\n */\r\n public markAsDirty(property?: string): Node {\r\n this._currentRenderId = Number.MAX_VALUE;\r\n this._isDirty = true;\r\n return this;\r\n }\r\n\r\n /**\r\n * Is this node enabled?\r\n * If the node has a parent, all ancestors will be checked and false will be returned if any are false (not enabled), otherwise will return true\r\n * @param checkAncestors indicates if this method should check the ancestors. The default is to check the ancestors. If set to false, the method will return the value of this node without checking ancestors\r\n * @return whether this node (and its parent) is enabled\r\n */\r\n public isEnabled(checkAncestors: boolean = true): boolean {\r\n if (checkAncestors === false) {\r\n return this._nodeDataStorage._isEnabled;\r\n }\r\n\r\n if (!this._nodeDataStorage._isEnabled) {\r\n return false;\r\n }\r\n\r\n return this._nodeDataStorage._isParentEnabled;\r\n }\r\n\r\n /** @hidden */\r\n protected _syncParentEnabledState() {\r\n this._nodeDataStorage._isParentEnabled = this._parentNode ? this._parentNode.isEnabled() : true;\r\n\r\n if (this._children) {\r\n this._children.forEach((c) => {\r\n c._syncParentEnabledState(); // Force children to update accordingly\r\n });\r\n }\r\n }\r\n\r\n /**\r\n * Set the enabled state of this node\r\n * @param value defines the new enabled state\r\n */\r\n public setEnabled(value: boolean): void {\r\n if (this._nodeDataStorage._isEnabled === value) {\r\n return;\r\n }\r\n this._nodeDataStorage._isEnabled = value;\r\n\r\n this._nodeDataStorage._onEnabledStateChangedObservable.notifyObservers(value);\r\n\r\n this._syncParentEnabledState();\r\n }\r\n\r\n /**\r\n * Is this node a descendant of the given node?\r\n * The function will iterate up the hierarchy until the ancestor was found or no more parents defined\r\n * @param ancestor defines the parent node to inspect\r\n * @returns a boolean indicating if this node is a descendant of the given node\r\n */\r\n public isDescendantOf(ancestor: Node): boolean {\r\n if (this.parent) {\r\n if (this.parent === ancestor) {\r\n return true;\r\n }\r\n\r\n return this.parent.isDescendantOf(ancestor);\r\n }\r\n return false;\r\n }\r\n\r\n /**\r\n * @param results\r\n * @param directDescendantsOnly\r\n * @param predicate\r\n * @hidden\r\n */\r\n public _getDescendants(results: Node[], directDescendantsOnly: boolean = false, predicate?: (node: Node) => boolean): void {\r\n if (!this._children) {\r\n return;\r\n }\r\n\r\n for (let index = 0; index < this._children.length; index++) {\r\n const item = this._children[index];\r\n\r\n if (!predicate || predicate(item)) {\r\n results.push(item);\r\n }\r\n\r\n if (!directDescendantsOnly) {\r\n item._getDescendants(results, false, predicate);\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Will return all nodes that have this node as ascendant\r\n * @param directDescendantsOnly defines if true only direct descendants of 'this' will be considered, if false direct and also indirect (children of children, an so on in a recursive manner) descendants of 'this' will be considered\r\n * @param predicate defines an optional predicate that will be called on every evaluated child, the predicate must return true for a given child to be part of the result, otherwise it will be ignored\r\n * @return all children nodes of all types\r\n */\r\n public getDescendants<T extends Node>(directDescendantsOnly?: boolean, predicate?: (node: Node) => node is T): T[];\r\n\r\n /**\r\n * Will return all nodes that have this node as ascendant\r\n * @param directDescendantsOnly defines if true only direct descendants of 'this' will be considered, if false direct and also indirect (children of children, an so on in a recursive manner) descendants of 'this' will be considered\r\n * @param predicate defines an optional predicate that will be called on every evaluated child, the predicate must return true for a given child to be part of the result, otherwise it will be ignored\r\n * @return all children nodes of all types\r\n */\r\n public getDescendants(directDescendantsOnly?: boolean, predicate?: (node: Node) => boolean): Node[];\r\n\r\n /**\r\n * Will return all nodes that have this node as ascendant\r\n * @param directDescendantsOnly defines if true only direct descendants of 'this' will be considered, if false direct and also indirect (children of children, an so on in a recursive manner) descendants of 'this' will be considered\r\n * @param predicate defines an optional predicate that will be called on every evaluated child, the predicate must return true for a given child to be part of the result, otherwise it will be ignored\r\n * @return all children nodes of all types\r\n */\r\n public getDescendants(directDescendantsOnly?: boolean, predicate?: (node: Node) => boolean): Node[] {\r\n const results = new Array<Node>();\r\n\r\n this._getDescendants(results, directDescendantsOnly, predicate);\r\n\r\n return results;\r\n }\r\n\r\n /**\r\n * Get all child-meshes of this node\r\n * @param directDescendantsOnly defines if true only direct descendants of 'this' will be considered, if false direct and also indirect (children of children, an so on in a recursive manner) descendants of 'this' will be considered (Default: false)\r\n * @param predicate defines an optional predicate that will be called on every evaluated child, the predicate must return true for a given child to be part of the result, otherwise it will be ignored\r\n * @returns an array of AbstractMesh\r\n */\r\n public getChildMeshes<T extends AbstractMesh>(directDescendantsOnly?: boolean, predicate?: (node: Node) => node is T): T[];\r\n\r\n /**\r\n * Get all child-meshes of this node\r\n * @param directDescendantsOnly defines if true only direct descendants of 'this' will be considered, if false direct and also indirect (children of children, an so on in a recursive manner) descendants of 'this' will be considered (Default: false)\r\n * @param predicate defines an optional predicate that will be called on every evaluated child, the predicate must return true for a given child to be part of the result, otherwise it will be ignored\r\n * @returns an array of AbstractMesh\r\n */\r\n public getChildMeshes(directDescendantsOnly?: boolean, predicate?: (node: Node) => boolean): AbstractMesh[];\r\n\r\n /**\r\n * Get all child-meshes of this node\r\n * @param directDescendantsOnly defines if true only direct descendants of 'this' will be considered, if false direct and also indirect (children of children, an so on in a recursive manner) descendants of 'this' will be considered (Default: false)\r\n * @param predicate defines an optional predicate that will be called on every evaluated child, the predicate must return true for a given child to be part of the result, otherwise it will be ignored\r\n * @returns an array of AbstractMesh\r\n */\r\n public getChildMeshes(directDescendantsOnly?: boolean, predicate?: (node: Node) => boolean): AbstractMesh[] {\r\n const results: Array<AbstractMesh> = [];\r\n this._getDescendants(results, directDescendantsOnly, (node: Node) => {\r\n return (!predicate || predicate(node)) && (<AbstractMesh>node).cullingStrategy !== undefined;\r\n });\r\n return results;\r\n }\r\n\r\n /**\r\n * Get all direct children of this node\r\n * @param predicate defines an optional predicate that will be called on every evaluated child, the predicate must return true for a given child to be part of the result, otherwise it will be ignored\r\n * @param directDescendantsOnly defines if true only direct descendants of 'this' will be considered, if false direct and also indirect (children of children, an so on in a recursive manner) descendants of 'this' will be considered (Default: true)\r\n * @returns an array of Node\r\n */\r\n public getChildren<T extends Node>(predicate?: (node: Node) => node is T, directDescendantsOnly?: boolean): T[];\r\n\r\n /**\r\n * Get all direct children of this node\r\n * @param predicate defines an optional predicate that will be called on every evaluated child, the predicate must return true for a given child to be part of the result, otherwise it will be ignored\r\n * @param directDescendantsOnly defines if true only direct descendants of 'this' will be considered, if false direct and also indirect (children of children, an so on in a recursive manner) descendants of 'this' will be considered (Default: true)\r\n * @returns an array of Node\r\n */\r\n public getChildren(predicate?: (node: Node) => boolean, directDescendantsOnly?: boolean): Node[];\r\n\r\n /**\r\n * Get all direct children of this node\r\n * @param predicate defines an optional predicate that will be called on every evaluated child, the predicate must return true for a given child to be part of the result, otherwise it will be ignored\r\n * @param directDescendantsOnly defines if true only direct descendants of 'this' will be considered, if false direct and also indirect (children of children, an so on in a recursive manner) descendants of 'this' will be considered (Default: true)\r\n * @returns an array of Node\r\n */\r\n public getChildren(predicate?: (node: Node) => boolean, directDescendantsOnly = true): Node[] {\r\n return this.getDescendants(directDescendantsOnly, predicate);\r\n }\r\n\r\n /**\r\n * @param state\r\n * @hidden\r\n */\r\n public _setReady(state: boolean): void {\r\n if (state === this._nodeDataStorage._isReady) {\r\n return;\r\n }\r\n\r\n if (!state) {\r\n this._nodeDataStorage._isReady = false;\r\n return;\r\n }\r\n\r\n if (this.onReady) {\r\n this.onReady(this);\r\n }\r\n this._nodeDataStorage._isReady = true;\r\n }\r\n\r\n /**\r\n * Get an animation by name\r\n * @param name defines the name of the animation to look for\r\n * @returns null if not found else the requested animation\r\n */\r\n public getAnimationByName(name: string): Nullable<Animation> {\r\n for (let i = 0; i < this.animations.length; i++) {\r\n const animation = this.animations[i];\r\n\r\n if (animation.name === name) {\r\n return animation;\r\n }\r\n }\r\n\r\n return null;\r\n }\r\n\r\n /**\r\n * Creates an animation range for this node\r\n * @param name defines the name of the range\r\n * @param from defines the starting key\r\n * @param to defines the end key\r\n */\r\n public createAnimationRange(name: string, from: number, to: number): void {\r\n // check name not already in use\r\n if (!this._ranges[name]) {\r\n this._ranges[name] = Node._AnimationRangeFactory(name, from, to);\r\n for (let i = 0, nAnimations = this.animations.length; i < nAnimations; i++) {\r\n if (this.animations[i]) {\r\n this.animations[i].createRange(name, from, to);\r\n }\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Delete a specific animation range\r\n * @param name defines the name of the range to delete\r\n * @param deleteFrames defines if animation frames from the range must be deleted as well\r\n */\r\n public deleteAnimationRange(name: string, deleteFrames = true): void {\r\n for (let i = 0, nAnimations = this.animations.length; i < nAnimations; i++) {\r\n if (this.animations[i]) {\r\n this.animations[i].deleteRange(name, deleteFrames);\r\n }\r\n }\r\n this._ranges[name] = null; // said much faster than 'delete this._range[name]'\r\n }\r\n\r\n /**\r\n * Get an animation range by name\r\n * @param name defines the name of the animation range to look for\r\n * @returns null if not found else the requested animation range\r\n */\r\n public getAnimationRange(name: string): Nullable<AnimationRange> {\r\n return this._ranges[name] || null;\r\n }\r\n\r\n /**\r\n * Gets the list of all animation ranges defined on this node\r\n * @returns an array\r\n */\r\n public getAnimationRanges(): Nullable<AnimationRange>[] {\r\n const animationRanges: Nullable<AnimationRange>[] = [];\r\n let name: string;\r\n for (name in this._ranges) {\r\n animationRanges.push(this._ranges[name]);\r\n }\r\n return animationRanges;\r\n }\r\n\r\n /**\r\n * Will start the animation sequence\r\n * @param name defines the range frames for animation sequence\r\n * @param loop defines if the animation should loop (false by default)\r\n * @param speedRatio defines the speed factor in which to run the animation (1 by default)\r\n * @param onAnimationEnd defines a function to be executed when the animation ended (undefined by default)\r\n * @returns the object created for this animation. If range does not exist, it will return null\r\n */\r\n public beginAnimation(name: string, loop?: boolean, speedRatio?: number, onAnimationEnd?: () => void): Nullable<Animatable> {\r\n const range = this.getAnimationRange(name);\r\n\r\n if (!range) {\r\n return null;\r\n }\r\n\r\n return this._scene.beginAnimation(this, range.from, range.to, loop, speedRatio, onAnimationEnd);\r\n }\r\n\r\n /**\r\n * Serialize animation ranges into a JSON compatible object\r\n * @returns serialization object\r\n */\r\n public serializeAnimationRanges(): any {\r\n const serializationRanges = [];\r\n for (const name in this._ranges) {\r\n const localRange = this._ranges[name];\r\n if (!localRange) {\r\n continue;\r\n }\r\n const range: any = {};\r\n range.name = name;\r\n range.from = localRange.from;\r\n range.to = localRange.to;\r\n serializationRanges.push(range);\r\n }\r\n return serializationRanges;\r\n }\r\n\r\n /**\r\n * Computes the world matrix of the node\r\n * @param force defines if the cache version should be invalidated forcing the world matrix to be created from scratch\r\n * @returns the world matrix\r\n */\r\n public computeWorldMatrix(force?: boolean): Matrix {\r\n if (!this._worldMatrix) {\r\n this._worldMatrix = Matrix.Identity();\r\n }\r\n return this._worldMatrix;\r\n }\r\n\r\n /**\r\n * Releases resources associated with this node.\r\n * @param doNotRecurse Set to true to not recurse into each children (recurse into each children by default)\r\n * @param disposeMaterialAndTextures Set to true to also dispose referenced materials and textures (false by default)\r\n */\r\n public dispose(doNotRecurse?: boolean, disposeMaterialAndTextures = false): void {\r\n this._nodeDataStorage._isDisposed = true;\r\n\r\n if (!doNotRecurse) {\r\n const nodes = this.getDescendants(true);\r\n for (const node of nodes) {\r\n node.dispose(doNotRecurse, disposeMaterialAndTextures);\r\n }\r\n }\r\n\r\n if (!this.parent) {\r\n this._removeFromSceneRootNodes();\r\n } else {\r\n this.parent = null;\r\n }\r\n\r\n // Callback\r\n this.onDisposeObservable.notifyObservers(this);\r\n this.onDisposeObservable.clear();\r\n\r\n this.onEnabledStateChangedObservable.clear();\r\n this.onClonedObservable.clear();\r\n\r\n // Behaviors\r\n for (const behavior of this._behaviors) {\r\n behavior.detach();\r\n }\r\n\r\n this._behaviors.length = 0;\r\n\r\n this.metadata = null;\r\n }\r\n\r\n /**\r\n * Parse animation range data from a serialization object and store them into a given node\r\n * @param node defines where to store the animation ranges\r\n * @param parsedNode defines the serialization object to read data from\r\n * @param scene defines the hosting scene\r\n */\r\n public static ParseAnimationRanges(node: Node, parsedNode: any, scene: Scene): void {\r\n if (parsedNode.ranges) {\r\n for (let index = 0; index < parsedNode.ranges.length; index++) {\r\n const data = parsedNode.ranges[index];\r\n node.createAnimationRange(data.name, data.from, data.to);\r\n }\r\n }\r\n }\r\n /**\r\n * Return the minimum and maximum world vectors of the entire hierarchy under current node\r\n * @param includeDescendants Include bounding info from descendants as well (true by default)\r\n * @param predicate defines a callback function that can be customize to filter what meshes should be included in the list used to compute the bounding vectors\r\n * @returns the new bounding vectors\r\n */\r\n public getHierarchyBoundingVectors(includeDescendants = true, predicate: Nullable<(abstractMesh: AbstractMesh) => boolean> = null): { min: Vector3; max: Vector3 } {\r\n // Ensures that all world matrix will be recomputed.\r\n this.getScene().incrementRenderId();\r\n\r\n this.computeWorldMatrix(true);\r\n\r\n let min: Vector3;\r\n let max: Vector3;\r\n\r\n const thisAbstractMesh = this as Node as AbstractMesh;\r\n if (thisAbstractMesh.getBoundingInfo && thisAbstractMesh.subMeshes) {\r\n // If this is an abstract mesh get its bounding info\r\n const boundingInfo = thisAbstractMesh.getBoundingInfo();\r\n min = boundingInfo.boundingBox.minimumWorld.clone();\r\n max = boundingInfo.boundingBox.maximumWorld.clone();\r\n } else {\r\n min = new Vector3(Number.MAX_VALUE, Number.MAX_VALUE, Number.MAX_VALUE);\r\n max = new Vector3(-Number.MAX_VALUE, -Number.MAX_VALUE, -Number.MAX_VALUE);\r\n }\r\n\r\n if (includeDescendants) {\r\n const descendants = this.getDescendants(false);\r\n\r\n for (const descendant of descendants) {\r\n const childMesh = <AbstractMesh>descendant;\r\n childMesh.computeWorldMatrix(true);\r\n\r\n // Filters meshes based on custom predicate function.\r\n if (predicate && !predicate(childMesh)) {\r\n continue;\r\n }\r\n\r\n //make sure we have the needed params to get mix and max\r\n if (!childMesh.getBoundingInfo || childMesh.getTotalVertices() === 0) {\r\n continue;\r\n }\r\n\r\n const childBoundingInfo = childMesh.getBoundingInfo();\r\n const boundingBox = childBoundingInfo.boundingBox;\r\n\r\n const minBox = boundingBox.minimumWorld;\r\n const maxBox = boundingBox.maximumWorld;\r\n\r\n Vector3.CheckExtends(minBox, min, max);\r\n Vector3.CheckExtends(maxBox, min, max);\r\n }\r\n }\r\n\r\n return {\r\n min: min,\r\n max: max,\r\n };\r\n }\r\n}\r\n"]}
|
package/package.json
CHANGED
package/scene.d.ts
CHANGED
|
@@ -1983,7 +1983,7 @@ export declare class Scene extends AbstractScene implements IAnimatable, IClipPl
|
|
|
1983
1983
|
* @param trianglePredicate defines an optional predicate used to select faces when a mesh intersection is detected
|
|
1984
1984
|
* @returns an array of PickingInfo
|
|
1985
1985
|
*/
|
|
1986
|
-
multiPickWithRay(ray: Ray, predicate
|
|
1986
|
+
multiPickWithRay(ray: Ray, predicate?: (mesh: AbstractMesh) => boolean, trianglePredicate?: TrianglePickingPredicate): Nullable<PickingInfo[]>;
|
|
1987
1987
|
/**
|
|
1988
1988
|
* Force the value of meshUnderPointer
|
|
1989
1989
|
* @param mesh defines the mesh to use
|
package/scene.js
CHANGED
|
@@ -705,7 +705,7 @@ var Scene = /** @class */ (function (_super) {
|
|
|
705
705
|
cpuUtilizationThresholds: [0.25, 0.5, 0.75, 0.9],
|
|
706
706
|
cpuSpeedThresholds: [0.5]
|
|
707
707
|
});
|
|
708
|
-
_this._computePressureObserver.observe();
|
|
708
|
+
_this._computePressureObserver.observe("cpu");
|
|
709
709
|
}
|
|
710
710
|
return _this;
|
|
711
711
|
}
|
|
@@ -2670,10 +2670,12 @@ var Scene = /** @class */ (function (_super) {
|
|
|
2670
2670
|
this.geometries[index] = lastGeometry;
|
|
2671
2671
|
if (this._geometriesByUniqueId) {
|
|
2672
2672
|
this._geometriesByUniqueId[lastGeometry.uniqueId] = index;
|
|
2673
|
-
this._geometriesByUniqueId[geometry.uniqueId] = undefined;
|
|
2674
2673
|
}
|
|
2675
2674
|
}
|
|
2676
2675
|
}
|
|
2676
|
+
if (this._geometriesByUniqueId) {
|
|
2677
|
+
this._geometriesByUniqueId[geometry.uniqueId] = undefined;
|
|
2678
|
+
}
|
|
2677
2679
|
this.geometries.pop();
|
|
2678
2680
|
this.onGeometryRemovedObservable.notifyObservers(geometry);
|
|
2679
2681
|
return true;
|
|
@@ -3981,7 +3983,7 @@ var Scene = /** @class */ (function (_super) {
|
|
|
3981
3983
|
this.onKeyboardObservable.clear();
|
|
3982
3984
|
this.onActiveCameraChanged.clear();
|
|
3983
3985
|
this.onComputePressureChanged.clear();
|
|
3984
|
-
(_a = this._computePressureObserver) === null || _a === void 0 ? void 0 : _a.unobserve();
|
|
3986
|
+
(_a = this._computePressureObserver) === null || _a === void 0 ? void 0 : _a.unobserve("cpu");
|
|
3985
3987
|
this._computePressureObserver = undefined;
|
|
3986
3988
|
this.detachControl();
|
|
3987
3989
|
// Detach cameras
|