@babylonjs/core 8.21.0 → 8.21.1
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/Engines/abstractEngine.js +2 -2
- package/Engines/abstractEngine.js.map +1 -1
- package/Materials/material.js +3 -0
- package/Materials/material.js.map +1 -1
- package/Misc/decorators.serialization.js +6 -1
- package/Misc/decorators.serialization.js.map +1 -1
- package/Misc/dumpTools.d.ts +2 -13
- package/Misc/dumpTools.js.map +1 -1
- package/Misc/textureTools.d.ts +6 -6
- package/Misc/textureTools.js +81 -19
- package/Misc/textureTools.js.map +1 -1
- package/Particles/flowMap.js +3 -24
- package/Particles/flowMap.js.map +1 -1
- package/XR/features/WebXRHandTracking.d.ts +7 -1
- package/XR/features/WebXRHandTracking.js +17 -3
- package/XR/features/WebXRHandTracking.js.map +1 -1
- package/XR/webXRCamera.d.ts +0 -1
- package/XR/webXRCamera.js +1 -8
- package/XR/webXRCamera.js.map +1 -1
- package/package.json +1 -1
package/XR/webXRCamera.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webXRCamera.js","sourceRoot":"","sources":["../../../../dev/core/src/XR/webXRCamera.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAE/E,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAEvD,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAClD,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAGhD;;;GAGG;AACH,MAAM,OAAO,WAAY,SAAQ,UAAU;IA4CvC;;;;;OAKG;IACH,YACI,IAAY,EACZ,KAAY,EACJ,iBAAsC;QAE9C,KA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EAAE,IAAI,CAAC,oBAAoB,CAAC,CAAC;gBAC9B,CAAC,EAAE,IAAI,CAAC,oBAAoB,CAAC,CAAC;gBAC9B,CAAC,EAAE,IAAI,CAAC,oBAAoB,CAAC,CAAC;aACjC,CACJ,CAAC;YACF,IAAI,CAAC,iBAAiB,CAAC,cAAc,GAAG,IAAI,CAAC,iBAAiB,CAAC,cAAc,CAAC,uBAAuB,CAAC,SAAS,CAAC,CAAC;QACrH,CAAC;IACL,CAAC;;AAzYc,0BAAc,GAAG,OAAO,CAAC,GAAG,EAAE,AAAhB,CAAiB","sourcesContent":["import { Vector3, Matrix, Quaternion, TmpVectors } from \"../Maths/math.vector\";\r\nimport type { Scene } from \"../scene\";\r\nimport { Camera } from \"../Cameras/camera\";\r\nimport { FreeCamera } from \"../Cameras/freeCamera\";\r\nimport { TargetCamera } from \"../Cameras/targetCamera\";\r\nimport type { WebXRSessionManager } from \"./webXRSessionManager\";\r\nimport { Viewport } from \"../Maths/math.viewport\";\r\nimport { Observable } from \"../Misc/observable\";\r\nimport { WebXRTrackingState } from \"./webXRTypes\";\r\n\r\n/**\r\n * WebXR Camera which holds the views for the xrSession\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/webXR/webXRCamera\r\n */\r\nexport class WebXRCamera extends FreeCamera {\r\n private static _ScaleReadOnly = Vector3.One();\r\n\r\n private _firstFrame = false;\r\n private _referenceQuaternion: Quaternion = Quaternion.Identity();\r\n private _referencedPosition: Vector3 = new Vector3();\r\n private _trackingState: WebXRTrackingState = WebXRTrackingState.NOT_TRACKING;\r\n\r\n /**\r\n * This will be triggered after the first XR Frame initialized the camera,\r\n * including the right number of views and their rendering parameters\r\n */\r\n public onXRCameraInitializedObservable = new Observable<WebXRCamera>();\r\n\r\n /**\r\n * Observable raised before camera teleportation\r\n * @deprecated use onBeforeCameraTeleport of the teleportation feature instead\r\n */\r\n public onBeforeCameraTeleport = new Observable<Vector3>();\r\n\r\n /**\r\n * Observable raised after camera teleportation\r\n * @deprecated use onAfterCameraTeleport of the teleportation feature instead\r\n */\r\n public onAfterCameraTeleport = new Observable<Vector3>();\r\n\r\n /**\r\n * Notifies when the camera's tracking state has changed.\r\n * Notice - will also be triggered when tracking has started (at the beginning of the session)\r\n */\r\n public onTrackingStateChanged = new Observable<WebXRTrackingState>();\r\n\r\n /**\r\n * Should position compensation execute on first frame.\r\n * This is used when copying the position from a native (non XR) camera\r\n */\r\n public compensateOnFirstFrame: boolean = true;\r\n\r\n /**\r\n * The last XRViewerPose from the current XRFrame\r\n * @internal\r\n */\r\n public _lastXRViewerPose?: XRViewerPose;\r\n\r\n /**\r\n * Creates a new webXRCamera, this should only be set at the camera after it has been updated by the xrSessionManager\r\n * @param name the name of the camera\r\n * @param scene the scene to add the camera to\r\n * @param _xrSessionManager a constructed xr session manager\r\n */\r\n constructor(\r\n name: string,\r\n scene: Scene,\r\n private _xrSessionManager: WebXRSessionManager\r\n ) {\r\n super(name, Vector3.Zero(), scene);\r\n\r\n // Initial camera configuration\r\n this.minZ = 0.1;\r\n this.rotationQuaternion = new Quaternion();\r\n this.cameraRigMode = Camera.RIG_MODE_CUSTOM;\r\n this.updateUpVectorFromRotation = true;\r\n this._updateNumberOfRigCameras(1);\r\n // freeze projection matrix, which will be copied later\r\n this.freezeProjectionMatrix();\r\n this._deferOnly = true;\r\n\r\n this._xrSessionManager.onXRSessionInit.add(() => {\r\n this._referencedPosition.copyFromFloats(0, 0, 0);\r\n this._referenceQuaternion.copyFromFloats(0, 0, 0, 1);\r\n // first frame - camera's y position should be 0 for the correct offset\r\n this._firstFrame = this.compensateOnFirstFrame;\r\n this._xrSessionManager.onWorldScaleFactorChangedObservable.add(() => {\r\n // only run if in session\r\n if (!this._xrSessionManager.currentFrame) {\r\n return;\r\n }\r\n this._updateDepthNearFar();\r\n });\r\n });\r\n\r\n // Check transformation changes on each frame. Callback is added to be first so that the transformation will be\r\n // applied to the rest of the elements using the referenceSpace object\r\n this._xrSessionManager.onXRFrameObservable.add(\r\n () => {\r\n if (this._firstFrame) {\r\n this._updateFromXRSession();\r\n }\r\n if (this.onXRCameraInitializedObservable.hasObservers()) {\r\n this.onXRCameraInitializedObservable.notifyObservers(this);\r\n this.onXRCameraInitializedObservable.clear();\r\n }\r\n\r\n if (this._deferredUpdated) {\r\n this.position.copyFrom(this._deferredPositionUpdate);\r\n this.rotationQuaternion.copyFrom(this._deferredRotationQuaternionUpdate);\r\n }\r\n\r\n this._updateReferenceSpace();\r\n this._updateFromXRSession();\r\n },\r\n undefined,\r\n true\r\n );\r\n }\r\n\r\n /**\r\n * Get the current XR tracking state of the camera\r\n */\r\n public get trackingState(): WebXRTrackingState {\r\n return this._trackingState;\r\n }\r\n\r\n private _setTrackingState(newState: WebXRTrackingState) {\r\n if (this._trackingState !== newState) {\r\n this._trackingState = newState;\r\n this.onTrackingStateChanged.notifyObservers(newState);\r\n }\r\n }\r\n\r\n /**\r\n * Return the user's height, unrelated to the current ground.\r\n * This will be the y position of this camera, when ground level is 0.\r\n *\r\n * Note - this value is multiplied by the worldScalingFactor (if set), so it will be in the same units as the scene.\r\n */\r\n public get realWorldHeight(): number {\r\n const basePose = this._xrSessionManager.currentFrame && this._xrSessionManager.currentFrame.getViewerPose(this._xrSessionManager.baseReferenceSpace);\r\n if (basePose && basePose.transform) {\r\n return basePose.transform.position.y * this._xrSessionManager.worldScalingFactor;\r\n } else {\r\n return 0;\r\n }\r\n }\r\n\r\n /** @internal */\r\n public _updateForDualEyeDebugging(/*pupilDistance = 0.01*/) {\r\n // Create initial camera rigs\r\n this._updateNumberOfRigCameras(2);\r\n this.rigCameras[0].viewport = new Viewport(0, 0, 0.5, 1.0);\r\n // this.rigCameras[0].position.x = -pupilDistance / 2;\r\n this.rigCameras[0].outputRenderTarget = null;\r\n this.rigCameras[1].viewport = new Viewport(0.5, 0, 0.5, 1.0);\r\n // this.rigCameras[1].position.x = pupilDistance / 2;\r\n this.rigCameras[1].outputRenderTarget = null;\r\n }\r\n\r\n /**\r\n * Sets this camera's transformation based on a non-vr camera\r\n * @param otherCamera the non-vr camera to copy the transformation from\r\n * @param resetToBaseReferenceSpace should XR reset to the base reference space\r\n */\r\n public setTransformationFromNonVRCamera(otherCamera: Camera = this.getScene().activeCamera!, resetToBaseReferenceSpace: boolean = true) {\r\n if (!otherCamera || otherCamera === this) {\r\n return;\r\n }\r\n const mat = otherCamera.computeWorldMatrix();\r\n mat.decompose(undefined, this.rotationQuaternion, this.position);\r\n // set the ground level\r\n this.position.y = 0;\r\n Quaternion.FromEulerAnglesToRef(0, this.rotationQuaternion.toEulerAngles().y, 0, this.rotationQuaternion);\r\n this._firstFrame = true;\r\n if (resetToBaseReferenceSpace) {\r\n this._xrSessionManager.resetReferenceSpace();\r\n }\r\n }\r\n\r\n /**\r\n * Gets the current instance class name (\"WebXRCamera\").\r\n * @returns the class name\r\n */\r\n public override getClassName(): string {\r\n return \"WebXRCamera\";\r\n }\r\n\r\n /**\r\n * Set the target for the camera to look at.\r\n * Note that this only rotates around the Y axis, as opposed to the default behavior of other cameras\r\n * @param target the target to set the camera to look at\r\n */\r\n public override setTarget(target: Vector3): void {\r\n // only rotate around the y axis!\r\n const tmpVector = TmpVectors.Vector3[1];\r\n target.subtractToRef(this.position, tmpVector);\r\n tmpVector.y = 0;\r\n tmpVector.normalize();\r\n const yRotation = Math.atan2(tmpVector.x, tmpVector.z);\r\n this.rotationQuaternion.toEulerAnglesToRef(tmpVector);\r\n Quaternion.FromEulerAnglesToRef(tmpVector.x, yRotation, tmpVector.z, this.rotationQuaternion);\r\n }\r\n\r\n public override dispose() {\r\n super.dispose();\r\n this._lastXRViewerPose = undefined;\r\n this.onTrackingStateChanged.clear();\r\n }\r\n\r\n private _updateDepthNearFar() {\r\n const far = (this.maxZ || 10000) * this._xrSessionManager.worldScalingFactor;\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: far,\r\n depthNear: this.minZ,\r\n };\r\n\r\n this._xrSessionManager.updateRenderState(xrRenderState);\r\n this._cache.minZ = this.minZ;\r\n this._cache.maxZ = far;\r\n }\r\n\r\n private _rotate180 = new Quaternion(0, 1, 0, 0);\r\n\r\n private _updateFromXRSession() {\r\n const pose = this._xrSessionManager.currentFrame && this._xrSessionManager.currentFrame.getViewerPose(this._xrSessionManager.referenceSpace);\r\n this._lastXRViewerPose = pose || undefined;\r\n if (!pose) {\r\n this._setTrackingState(WebXRTrackingState.NOT_TRACKING);\r\n return;\r\n }\r\n\r\n // Set the tracking state. if it didn't change it is a no-op\r\n const trackingState = pose.emulatedPosition ? WebXRTrackingState.TRACKING_LOST : WebXRTrackingState.TRACKING;\r\n this._setTrackingState(trackingState);\r\n\r\n // check min/max Z and update if not the same as in cache\r\n if (this.minZ !== this._cache.minZ || this.maxZ !== this._cache.maxZ) {\r\n this._updateDepthNearFar();\r\n }\r\n\r\n if (pose.transform) {\r\n const orientation = pose.transform.orientation;\r\n if (pose.transform.orientation.x === undefined) {\r\n // Babylon native polyfill can return an undefined orientation value\r\n // When not initialized\r\n return;\r\n }\r\n const pos = pose.transform.position;\r\n this._referencedPosition.set(pos.x, pos.y, pos.z).scaleInPlace(this._xrSessionManager.worldScalingFactor);\r\n\r\n this._referenceQuaternion.set(orientation.x, orientation.y, orientation.z, orientation.w);\r\n if (!this._scene.useRightHandedSystem) {\r\n this._referencedPosition.z *= -1;\r\n this._referenceQuaternion.z *= -1;\r\n this._referenceQuaternion.w *= -1;\r\n } else {\r\n this._referenceQuaternion.multiplyInPlace(this._rotate180);\r\n }\r\n\r\n if (this._firstFrame) {\r\n this._firstFrame = false;\r\n // we have the XR reference, now use this to find the offset to get the camera to be\r\n // in the right position\r\n\r\n // set the height to correlate to the current height\r\n this.position.y += this._referencedPosition.y;\r\n // avoid using the head rotation on the first frame.\r\n this._referenceQuaternion.copyFromFloats(0, 0, 0, 1);\r\n } else {\r\n // update position and rotation as reference\r\n this.rotationQuaternion.copyFrom(this._referenceQuaternion);\r\n this.position.copyFrom(this._referencedPosition);\r\n }\r\n }\r\n\r\n // Update camera rigs\r\n if (this.rigCameras.length !== pose.views.length) {\r\n this._updateNumberOfRigCameras(pose.views.length);\r\n }\r\n\r\n for (let i = 0; i < pose.views.length; i++) {\r\n const view = pose.views[i];\r\n const currentRig = <TargetCamera>this.rigCameras[i];\r\n // update right and left, where applicable\r\n if (!currentRig.isLeftCamera && !currentRig.isRightCamera) {\r\n if (view.eye === \"right\") {\r\n currentRig._isRightCamera = true;\r\n } else if (view.eye === \"left\") {\r\n currentRig._isLeftCamera = true;\r\n }\r\n }\r\n // add any custom render targets to this camera, if available in the scene\r\n const customRenderTargets = this.getScene().customRenderTargets;\r\n // use a for loop\r\n for (let i = 0; i < customRenderTargets.length; i++) {\r\n const rt = customRenderTargets[i];\r\n // make sure we don't add the same render target twice\r\n if (currentRig.customRenderTargets.indexOf(rt) === -1) {\r\n currentRig.customRenderTargets.push(rt);\r\n }\r\n }\r\n // Update view/projection matrix\r\n const pos = view.transform.position;\r\n const orientation = view.transform.orientation;\r\n\r\n currentRig.parent = this.parent;\r\n\r\n currentRig.position.set(pos.x, pos.y, pos.z).scaleInPlace(this._xrSessionManager.worldScalingFactor);\r\n currentRig.rotationQuaternion.set(orientation.x, orientation.y, orientation.z, orientation.w);\r\n if (!this._scene.useRightHandedSystem) {\r\n currentRig.position.z *= -1;\r\n currentRig.rotationQuaternion.z *= -1;\r\n currentRig.rotationQuaternion.w *= -1;\r\n } else {\r\n currentRig.rotationQuaternion.multiplyInPlace(this._rotate180);\r\n }\r\n Matrix.FromFloat32ArrayToRefScaled(view.projectionMatrix, 0, 1, currentRig._projectionMatrix);\r\n\r\n if (!this._scene.useRightHandedSystem) {\r\n currentRig._projectionMatrix.toggleProjectionMatrixHandInPlace();\r\n }\r\n\r\n // fov\r\n const fov = Math.atan2(1, view.projectionMatrix[5]) * 2;\r\n currentRig.fov = fov;\r\n // first camera?\r\n if (i === 0) {\r\n this.fov = fov;\r\n this._projectionMatrix.copyFrom(currentRig._projectionMatrix);\r\n }\r\n\r\n const renderTargetTexture = this._xrSessionManager.getRenderTargetTextureForView(view);\r\n this._renderingMultiview = renderTargetTexture?._texture?.isMultiview || false;\r\n if (this._renderingMultiview) {\r\n // For multiview, the render target texture is the same per-view (just the slice index is different),\r\n // so we only need to set the output render target once for the rig parent.\r\n if (i == 0) {\r\n this._xrSessionManager.trySetViewportForView(this.viewport, view);\r\n this.outputRenderTarget = renderTargetTexture;\r\n }\r\n } else {\r\n // Update viewport\r\n this._xrSessionManager.trySetViewportForView(currentRig.viewport, view);\r\n\r\n // Set cameras to render to the session's render target\r\n currentRig.outputRenderTarget = renderTargetTexture || this._xrSessionManager.getRenderTargetTextureForView(view);\r\n }\r\n\r\n // Replicate parent rig camera behavior\r\n currentRig.layerMask = this.layerMask;\r\n }\r\n }\r\n\r\n private _updateNumberOfRigCameras(viewCount = 1) {\r\n while (this.rigCameras.length < viewCount) {\r\n const newCamera = new TargetCamera(\"XR-RigCamera: \" + this.rigCameras.length, Vector3.Zero(), this.getScene());\r\n newCamera.minZ = 0.1;\r\n newCamera.rotationQuaternion = new Quaternion();\r\n newCamera.updateUpVectorFromRotation = true;\r\n newCamera.isRigCamera = true;\r\n newCamera.rigParent = this;\r\n // do not compute projection matrix, provided by XR\r\n newCamera.freezeProjectionMatrix();\r\n this.rigCameras.push(newCamera);\r\n }\r\n while (this.rigCameras.length > viewCount) {\r\n const removedCamera = this.rigCameras.pop();\r\n if (removedCamera) {\r\n removedCamera.dispose();\r\n }\r\n }\r\n }\r\n\r\n private _updateReferenceSpace() {\r\n // were position & rotation updated OUTSIDE of the xr update loop\r\n if (!this.position.equals(this._referencedPosition) || !this.rotationQuaternion.equals(this._referenceQuaternion)) {\r\n const referencedMat = TmpVectors.Matrix[0];\r\n const poseMat = TmpVectors.Matrix[1];\r\n const transformMat = TmpVectors.Matrix[2];\r\n\r\n Matrix.ComposeToRef(WebXRCamera._ScaleReadOnly, this._referenceQuaternion, this._referencedPosition, referencedMat);\r\n Matrix.ComposeToRef(WebXRCamera._ScaleReadOnly, this.rotationQuaternion, this.position, poseMat);\r\n referencedMat.invert().multiplyToRef(poseMat, transformMat);\r\n transformMat.invert();\r\n\r\n if (!this._scene.useRightHandedSystem) {\r\n transformMat.toggleModelMatrixHandInPlace();\r\n }\r\n\r\n transformMat.decompose(undefined, this._referenceQuaternion, this._referencedPosition);\r\n const transform = new XRRigidTransform(\r\n {\r\n x: this._referencedPosition.x / this._xrSessionManager.worldScalingFactor,\r\n y: this._referencedPosition.y / this._xrSessionManager.worldScalingFactor,\r\n z: this._referencedPosition.z / this._xrSessionManager.worldScalingFactor,\r\n },\r\n {\r\n x: this._referenceQuaternion.x,\r\n y: this._referenceQuaternion.y,\r\n z: this._referenceQuaternion.z,\r\n w: this._referenceQuaternion.w,\r\n }\r\n );\r\n this._xrSessionManager.referenceSpace = this._xrSessionManager.referenceSpace.getOffsetReferenceSpace(transform);\r\n }\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"webXRCamera.js","sourceRoot":"","sources":["../../../../dev/core/src/XR/webXRCamera.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAE/E,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAEvD,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAClD,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAGhD;;;GAGG;AACH,MAAM,OAAO,WAAY,SAAQ,UAAU;IA4CvC;;;;;OAKG;IACH,YACI,IAAY,EACZ,KAAY,EACJ,iBAAsC;QAE9C,KAAK,CAAC,IAAI,EAAE,OAAO,CAAC,IAAI,EAAE,EAAE,KAAK,CA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BAAuB,CAAC,SAAS,CAAC,CAAC;QACrH,CAAC;IACL,CAAC;;AAnYc,0BAAc,GAAG,OAAO,CAAC,GAAG,EAAE,AAAhB,CAAiB","sourcesContent":["import { Vector3, Matrix, Quaternion, TmpVectors } from \"../Maths/math.vector\";\r\nimport type { Scene } from \"../scene\";\r\nimport { Camera } from \"../Cameras/camera\";\r\nimport { FreeCamera } from \"../Cameras/freeCamera\";\r\nimport { TargetCamera } from \"../Cameras/targetCamera\";\r\nimport type { WebXRSessionManager } from \"./webXRSessionManager\";\r\nimport { Viewport } from \"../Maths/math.viewport\";\r\nimport { Observable } from \"../Misc/observable\";\r\nimport { WebXRTrackingState } from \"./webXRTypes\";\r\n\r\n/**\r\n * WebXR Camera which holds the views for the xrSession\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/webXR/webXRCamera\r\n */\r\nexport class WebXRCamera extends FreeCamera {\r\n private static _ScaleReadOnly = Vector3.One();\r\n\r\n private _firstFrame = false;\r\n private _referenceQuaternion: Quaternion = Quaternion.Identity();\r\n private _referencedPosition: Vector3 = new Vector3();\r\n private _trackingState: WebXRTrackingState = WebXRTrackingState.NOT_TRACKING;\r\n\r\n /**\r\n * This will be triggered after the first XR Frame initialized the camera,\r\n * including the right number of views and their rendering parameters\r\n */\r\n public onXRCameraInitializedObservable = new Observable<WebXRCamera>();\r\n\r\n /**\r\n * Observable raised before camera teleportation\r\n * @deprecated use onBeforeCameraTeleport of the teleportation feature instead\r\n */\r\n public onBeforeCameraTeleport = new Observable<Vector3>();\r\n\r\n /**\r\n * Observable raised after camera teleportation\r\n * @deprecated use onAfterCameraTeleport of the teleportation feature instead\r\n */\r\n public onAfterCameraTeleport = new Observable<Vector3>();\r\n\r\n /**\r\n * Notifies when the camera's tracking state has changed.\r\n * Notice - will also be triggered when tracking has started (at the beginning of the session)\r\n */\r\n public onTrackingStateChanged = new Observable<WebXRTrackingState>();\r\n\r\n /**\r\n * Should position compensation execute on first frame.\r\n * This is used when copying the position from a native (non XR) camera\r\n */\r\n public compensateOnFirstFrame: boolean = true;\r\n\r\n /**\r\n * The last XRViewerPose from the current XRFrame\r\n * @internal\r\n */\r\n public _lastXRViewerPose?: XRViewerPose;\r\n\r\n /**\r\n * Creates a new webXRCamera, this should only be set at the camera after it has been updated by the xrSessionManager\r\n * @param name the name of the camera\r\n * @param scene the scene to add the camera to\r\n * @param _xrSessionManager a constructed xr session manager\r\n */\r\n constructor(\r\n name: string,\r\n scene: Scene,\r\n private _xrSessionManager: WebXRSessionManager\r\n ) {\r\n super(name, Vector3.Zero(), scene);\r\n\r\n // Initial camera configuration\r\n this.minZ = 0.1;\r\n this.rotationQuaternion = new Quaternion();\r\n this.cameraRigMode = Camera.RIG_MODE_CUSTOM;\r\n this.updateUpVectorFromRotation = true;\r\n this._updateNumberOfRigCameras(1);\r\n // freeze projection matrix, which will be copied later\r\n this.freezeProjectionMatrix();\r\n this._deferOnly = true;\r\n\r\n this._xrSessionManager.onXRSessionInit.add(() => {\r\n this._referencedPosition.copyFromFloats(0, 0, 0);\r\n this._referenceQuaternion.copyFromFloats(0, 0, 0, 1);\r\n // first frame - camera's y position should be 0 for the correct offset\r\n this._firstFrame = this.compensateOnFirstFrame;\r\n this._xrSessionManager.onWorldScaleFactorChangedObservable.add(() => {\r\n // only run if in session\r\n if (!this._xrSessionManager.currentFrame) {\r\n return;\r\n }\r\n this._updateDepthNearFar();\r\n });\r\n });\r\n\r\n // Check transformation changes on each frame. Callback is added to be first so that the transformation will be\r\n // applied to the rest of the elements using the referenceSpace object\r\n this._xrSessionManager.onXRFrameObservable.add(\r\n () => {\r\n if (this._firstFrame) {\r\n this._updateFromXRSession();\r\n }\r\n if (this.onXRCameraInitializedObservable.hasObservers()) {\r\n this.onXRCameraInitializedObservable.notifyObservers(this);\r\n this.onXRCameraInitializedObservable.clear();\r\n }\r\n\r\n if (this._deferredUpdated) {\r\n this.position.copyFrom(this._deferredPositionUpdate);\r\n this.rotationQuaternion.copyFrom(this._deferredRotationQuaternionUpdate);\r\n }\r\n\r\n this._updateReferenceSpace();\r\n this._updateFromXRSession();\r\n },\r\n undefined,\r\n true\r\n );\r\n }\r\n\r\n /**\r\n * Get the current XR tracking state of the camera\r\n */\r\n public get trackingState(): WebXRTrackingState {\r\n return this._trackingState;\r\n }\r\n\r\n private _setTrackingState(newState: WebXRTrackingState) {\r\n if (this._trackingState !== newState) {\r\n this._trackingState = newState;\r\n this.onTrackingStateChanged.notifyObservers(newState);\r\n }\r\n }\r\n\r\n /**\r\n * Return the user's height, unrelated to the current ground.\r\n * This will be the y position of this camera, when ground level is 0.\r\n *\r\n * Note - this value is multiplied by the worldScalingFactor (if set), so it will be in the same units as the scene.\r\n */\r\n public get realWorldHeight(): number {\r\n const basePose = this._xrSessionManager.currentFrame && this._xrSessionManager.currentFrame.getViewerPose(this._xrSessionManager.baseReferenceSpace);\r\n if (basePose && basePose.transform) {\r\n return basePose.transform.position.y * this._xrSessionManager.worldScalingFactor;\r\n } else {\r\n return 0;\r\n }\r\n }\r\n\r\n /** @internal */\r\n public _updateForDualEyeDebugging(/*pupilDistance = 0.01*/) {\r\n // Create initial camera rigs\r\n this._updateNumberOfRigCameras(2);\r\n this.rigCameras[0].viewport = new Viewport(0, 0, 0.5, 1.0);\r\n // this.rigCameras[0].position.x = -pupilDistance / 2;\r\n this.rigCameras[0].outputRenderTarget = null;\r\n this.rigCameras[1].viewport = new Viewport(0.5, 0, 0.5, 1.0);\r\n // this.rigCameras[1].position.x = pupilDistance / 2;\r\n this.rigCameras[1].outputRenderTarget = null;\r\n }\r\n\r\n /**\r\n * Sets this camera's transformation based on a non-vr camera\r\n * @param otherCamera the non-vr camera to copy the transformation from\r\n * @param resetToBaseReferenceSpace should XR reset to the base reference space\r\n */\r\n public setTransformationFromNonVRCamera(otherCamera: Camera = this.getScene().activeCamera!, resetToBaseReferenceSpace: boolean = true) {\r\n if (!otherCamera || otherCamera === this) {\r\n return;\r\n }\r\n const mat = otherCamera.computeWorldMatrix();\r\n mat.decompose(undefined, this.rotationQuaternion, this.position);\r\n // set the ground level\r\n this.position.y = 0;\r\n Quaternion.FromEulerAnglesToRef(0, this.rotationQuaternion.toEulerAngles().y, 0, this.rotationQuaternion);\r\n this._firstFrame = true;\r\n if (resetToBaseReferenceSpace) {\r\n this._xrSessionManager.resetReferenceSpace();\r\n }\r\n }\r\n\r\n /**\r\n * Gets the current instance class name (\"WebXRCamera\").\r\n * @returns the class name\r\n */\r\n public override getClassName(): string {\r\n return \"WebXRCamera\";\r\n }\r\n\r\n /**\r\n * Set the target for the camera to look at.\r\n * Note that this only rotates around the Y axis, as opposed to the default behavior of other cameras\r\n * @param target the target to set the camera to look at\r\n */\r\n public override setTarget(target: Vector3): void {\r\n // only rotate around the y axis!\r\n const tmpVector = TmpVectors.Vector3[1];\r\n target.subtractToRef(this.position, tmpVector);\r\n tmpVector.y = 0;\r\n tmpVector.normalize();\r\n const yRotation = Math.atan2(tmpVector.x, tmpVector.z) + (this._scene.useRightHandedSystem ? Math.PI : 0);\r\n this.rotationQuaternion.toEulerAnglesToRef(tmpVector);\r\n Quaternion.FromEulerAnglesToRef(tmpVector.x, yRotation, tmpVector.z, this.rotationQuaternion);\r\n }\r\n\r\n public override dispose() {\r\n super.dispose();\r\n this._lastXRViewerPose = undefined;\r\n this.onTrackingStateChanged.clear();\r\n }\r\n\r\n private _updateDepthNearFar() {\r\n const far = (this.maxZ || 10000) * this._xrSessionManager.worldScalingFactor;\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: far,\r\n depthNear: this.minZ,\r\n };\r\n\r\n this._xrSessionManager.updateRenderState(xrRenderState);\r\n this._cache.minZ = this.minZ;\r\n this._cache.maxZ = far;\r\n }\r\n\r\n private _updateFromXRSession() {\r\n const pose = this._xrSessionManager.currentFrame && this._xrSessionManager.currentFrame.getViewerPose(this._xrSessionManager.referenceSpace);\r\n this._lastXRViewerPose = pose || undefined;\r\n if (!pose) {\r\n this._setTrackingState(WebXRTrackingState.NOT_TRACKING);\r\n return;\r\n }\r\n\r\n // Set the tracking state. if it didn't change it is a no-op\r\n const trackingState = pose.emulatedPosition ? WebXRTrackingState.TRACKING_LOST : WebXRTrackingState.TRACKING;\r\n this._setTrackingState(trackingState);\r\n\r\n // check min/max Z and update if not the same as in cache\r\n if (this.minZ !== this._cache.minZ || this.maxZ !== this._cache.maxZ) {\r\n this._updateDepthNearFar();\r\n }\r\n\r\n if (pose.transform) {\r\n const orientation = pose.transform.orientation;\r\n if (pose.transform.orientation.x === undefined) {\r\n // Babylon native polyfill can return an undefined orientation value\r\n // When not initialized\r\n return;\r\n }\r\n const pos = pose.transform.position;\r\n this._referencedPosition.set(pos.x, pos.y, pos.z).scaleInPlace(this._xrSessionManager.worldScalingFactor);\r\n\r\n this._referenceQuaternion.set(orientation.x, orientation.y, orientation.z, orientation.w);\r\n if (!this._scene.useRightHandedSystem) {\r\n this._referencedPosition.z *= -1;\r\n this._referenceQuaternion.z *= -1;\r\n this._referenceQuaternion.w *= -1;\r\n }\r\n\r\n if (this._firstFrame) {\r\n this._firstFrame = false;\r\n // we have the XR reference, now use this to find the offset to get the camera to be\r\n // in the right position\r\n\r\n // set the height to correlate to the current height\r\n this.position.y += this._referencedPosition.y;\r\n // avoid using the head rotation on the first frame.\r\n this._referenceQuaternion.copyFromFloats(0, 0, 0, 1);\r\n } else {\r\n // update position and rotation as reference\r\n this.rotationQuaternion.copyFrom(this._referenceQuaternion);\r\n this.position.copyFrom(this._referencedPosition);\r\n }\r\n }\r\n\r\n // Update camera rigs\r\n if (this.rigCameras.length !== pose.views.length) {\r\n this._updateNumberOfRigCameras(pose.views.length);\r\n }\r\n\r\n for (let i = 0; i < pose.views.length; i++) {\r\n const view = pose.views[i];\r\n const currentRig = <TargetCamera>this.rigCameras[i];\r\n // update right and left, where applicable\r\n if (!currentRig.isLeftCamera && !currentRig.isRightCamera) {\r\n if (view.eye === \"right\") {\r\n currentRig._isRightCamera = true;\r\n } else if (view.eye === \"left\") {\r\n currentRig._isLeftCamera = true;\r\n }\r\n }\r\n // add any custom render targets to this camera, if available in the scene\r\n const customRenderTargets = this.getScene().customRenderTargets;\r\n // use a for loop\r\n for (let i = 0; i < customRenderTargets.length; i++) {\r\n const rt = customRenderTargets[i];\r\n // make sure we don't add the same render target twice\r\n if (currentRig.customRenderTargets.indexOf(rt) === -1) {\r\n currentRig.customRenderTargets.push(rt);\r\n }\r\n }\r\n // Update view/projection matrix\r\n const pos = view.transform.position;\r\n const orientation = view.transform.orientation;\r\n\r\n currentRig.parent = this.parent;\r\n\r\n currentRig.position.set(pos.x, pos.y, pos.z).scaleInPlace(this._xrSessionManager.worldScalingFactor);\r\n currentRig.rotationQuaternion.set(orientation.x, orientation.y, orientation.z, orientation.w);\r\n if (!this._scene.useRightHandedSystem) {\r\n currentRig.position.z *= -1;\r\n currentRig.rotationQuaternion.z *= -1;\r\n currentRig.rotationQuaternion.w *= -1;\r\n }\r\n Matrix.FromFloat32ArrayToRefScaled(view.projectionMatrix, 0, 1, currentRig._projectionMatrix);\r\n\r\n if (!this._scene.useRightHandedSystem) {\r\n currentRig._projectionMatrix.toggleProjectionMatrixHandInPlace();\r\n }\r\n\r\n // fov\r\n const fov = Math.atan2(1, view.projectionMatrix[5]) * 2;\r\n currentRig.fov = fov;\r\n // first camera?\r\n if (i === 0) {\r\n this.fov = fov;\r\n this._projectionMatrix.copyFrom(currentRig._projectionMatrix);\r\n }\r\n\r\n const renderTargetTexture = this._xrSessionManager.getRenderTargetTextureForView(view);\r\n this._renderingMultiview = renderTargetTexture?._texture?.isMultiview || false;\r\n if (this._renderingMultiview) {\r\n // For multiview, the render target texture is the same per-view (just the slice index is different),\r\n // so we only need to set the output render target once for the rig parent.\r\n if (i == 0) {\r\n this._xrSessionManager.trySetViewportForView(this.viewport, view);\r\n this.outputRenderTarget = renderTargetTexture;\r\n }\r\n } else {\r\n // Update viewport\r\n this._xrSessionManager.trySetViewportForView(currentRig.viewport, view);\r\n\r\n // Set cameras to render to the session's render target\r\n currentRig.outputRenderTarget = renderTargetTexture || this._xrSessionManager.getRenderTargetTextureForView(view);\r\n }\r\n\r\n // Replicate parent rig camera behavior\r\n currentRig.layerMask = this.layerMask;\r\n }\r\n }\r\n\r\n private _updateNumberOfRigCameras(viewCount = 1) {\r\n while (this.rigCameras.length < viewCount) {\r\n const newCamera = new TargetCamera(\"XR-RigCamera: \" + this.rigCameras.length, Vector3.Zero(), this.getScene());\r\n newCamera.minZ = 0.1;\r\n newCamera.rotationQuaternion = new Quaternion();\r\n newCamera.updateUpVectorFromRotation = true;\r\n newCamera.isRigCamera = true;\r\n newCamera.rigParent = this;\r\n // do not compute projection matrix, provided by XR\r\n newCamera.freezeProjectionMatrix();\r\n this.rigCameras.push(newCamera);\r\n }\r\n while (this.rigCameras.length > viewCount) {\r\n const removedCamera = this.rigCameras.pop();\r\n if (removedCamera) {\r\n removedCamera.dispose();\r\n }\r\n }\r\n }\r\n\r\n private _updateReferenceSpace() {\r\n // were position & rotation updated OUTSIDE of the xr update loop\r\n if (!this.position.equals(this._referencedPosition) || !this.rotationQuaternion.equals(this._referenceQuaternion)) {\r\n const referencedMat = TmpVectors.Matrix[0];\r\n const poseMat = TmpVectors.Matrix[1];\r\n const transformMat = TmpVectors.Matrix[2];\r\n\r\n Matrix.ComposeToRef(WebXRCamera._ScaleReadOnly, this._referenceQuaternion, this._referencedPosition, referencedMat);\r\n Matrix.ComposeToRef(WebXRCamera._ScaleReadOnly, this.rotationQuaternion, this.position, poseMat);\r\n referencedMat.invert().multiplyToRef(poseMat, transformMat);\r\n transformMat.invert();\r\n\r\n if (!this._scene.useRightHandedSystem) {\r\n transformMat.toggleModelMatrixHandInPlace();\r\n }\r\n\r\n transformMat.decompose(undefined, this._referenceQuaternion, this._referencedPosition);\r\n const transform = new XRRigidTransform(\r\n {\r\n x: this._referencedPosition.x / this._xrSessionManager.worldScalingFactor,\r\n y: this._referencedPosition.y / this._xrSessionManager.worldScalingFactor,\r\n z: this._referencedPosition.z / this._xrSessionManager.worldScalingFactor,\r\n },\r\n {\r\n x: this._referenceQuaternion.x,\r\n y: this._referenceQuaternion.y,\r\n z: this._referenceQuaternion.z,\r\n w: this._referenceQuaternion.w,\r\n }\r\n );\r\n this._xrSessionManager.referenceSpace = this._xrSessionManager.referenceSpace.getOffsetReferenceSpace(transform);\r\n }\r\n }\r\n}\r\n"]}
|