@babylonjs/core 6.29.2 → 6.31.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (91) hide show
  1. package/Cameras/camera.js +1 -1
  2. package/Cameras/camera.js.map +1 -1
  3. package/Culling/ray.js +24 -24
  4. package/Culling/ray.js.map +1 -1
  5. package/Debug/skeletonViewer.js +2 -2
  6. package/Debug/skeletonViewer.js.map +1 -1
  7. package/Engines/Extensions/engine.views.d.ts +8 -5
  8. package/Engines/Extensions/engine.views.js +14 -8
  9. package/Engines/Extensions/engine.views.js.map +1 -1
  10. package/Engines/WebGPU/Extensions/engine.multiRender.js +6 -3
  11. package/Engines/WebGPU/Extensions/engine.multiRender.js.map +1 -1
  12. package/Engines/engine.d.ts +16 -1
  13. package/Engines/engine.js +1 -1
  14. package/Engines/engine.js.map +1 -1
  15. package/Engines/thinEngine.js +2 -2
  16. package/Engines/thinEngine.js.map +1 -1
  17. package/Gizmos/axisDragGizmo.d.ts +4 -2
  18. package/Gizmos/axisDragGizmo.js +18 -6
  19. package/Gizmos/axisDragGizmo.js.map +1 -1
  20. package/Gizmos/axisScaleGizmo.d.ts +2 -2
  21. package/Gizmos/axisScaleGizmo.js +1 -1
  22. package/Gizmos/axisScaleGizmo.js.map +1 -1
  23. package/Gizmos/planeDragGizmo.d.ts +4 -4
  24. package/Gizmos/planeDragGizmo.js +1 -1
  25. package/Gizmos/planeDragGizmo.js.map +1 -1
  26. package/Gizmos/planeRotationGizmo.d.ts +13 -7
  27. package/Gizmos/planeRotationGizmo.js +26 -10
  28. package/Gizmos/planeRotationGizmo.js.map +1 -1
  29. package/Materials/Node/Blocks/Teleport/teleportInBlock.d.ts +6 -0
  30. package/Materials/Node/Blocks/Teleport/teleportInBlock.js +22 -0
  31. package/Materials/Node/Blocks/Teleport/teleportInBlock.js.map +1 -1
  32. package/Materials/Textures/Procedurals/proceduralTexture.d.ts +1 -1
  33. package/Materials/Textures/Procedurals/proceduralTexture.js +1 -1
  34. package/Materials/Textures/Procedurals/proceduralTexture.js.map +1 -1
  35. package/Materials/Textures/multiRenderTarget.d.ts +14 -10
  36. package/Materials/Textures/multiRenderTarget.js +7 -5
  37. package/Materials/Textures/multiRenderTarget.js.map +1 -1
  38. package/Materials/imageProcessingConfiguration.d.ts +2 -2
  39. package/Materials/imageProcessingConfiguration.js +2 -2
  40. package/Materials/imageProcessingConfiguration.js.map +1 -1
  41. package/Maths/math.vector.d.ts +5 -5
  42. package/Maths/math.vector.js +5 -4
  43. package/Maths/math.vector.js.map +1 -1
  44. package/Meshes/Builders/linesBuilder.js +4 -2
  45. package/Meshes/Builders/linesBuilder.js.map +1 -1
  46. package/Meshes/GreasedLine/greasedLineBaseMesh.d.ts +1 -1
  47. package/Meshes/GreasedLine/greasedLineBaseMesh.js +1 -1
  48. package/Meshes/GreasedLine/greasedLineBaseMesh.js.map +1 -1
  49. package/Meshes/Node/nodeGeometry.js +3 -1
  50. package/Meshes/Node/nodeGeometry.js.map +1 -1
  51. package/Meshes/groundMesh.js +1 -1
  52. package/Meshes/groundMesh.js.map +1 -1
  53. package/Physics/physicsHelper.d.ts +1 -1
  54. package/Physics/physicsHelper.js +1 -1
  55. package/Physics/physicsHelper.js.map +1 -1
  56. package/PostProcesses/RenderPipeline/Pipelines/ssrRenderingPipeline.d.ts +1 -1
  57. package/PostProcesses/RenderPipeline/Pipelines/ssrRenderingPipeline.js +1 -1
  58. package/PostProcesses/RenderPipeline/Pipelines/ssrRenderingPipeline.js.map +1 -1
  59. package/PostProcesses/bloomEffect.d.ts +1 -1
  60. package/PostProcesses/bloomEffect.js +1 -1
  61. package/PostProcesses/bloomEffect.js.map +1 -1
  62. package/PostProcesses/postProcess.d.ts +1 -1
  63. package/PostProcesses/postProcess.js +1 -1
  64. package/PostProcesses/postProcess.js.map +1 -1
  65. package/Rendering/depthPeelingRenderer.d.ts +5 -0
  66. package/Rendering/depthPeelingRenderer.js +33 -9
  67. package/Rendering/depthPeelingRenderer.js.map +1 -1
  68. package/Rendering/depthRenderer.js +9 -0
  69. package/Rendering/depthRenderer.js.map +1 -1
  70. package/Shaders/depth.vertex.d.ts +2 -0
  71. package/Shaders/depth.vertex.js +4 -0
  72. package/Shaders/depth.vertex.js.map +1 -1
  73. package/XR/features/WebXRAbstractFeature.d.ts +10 -1
  74. package/XR/features/WebXRAbstractFeature.js +13 -0
  75. package/XR/features/WebXRAbstractFeature.js.map +1 -1
  76. package/XR/features/WebXRLightEstimation.d.ts +5 -0
  77. package/XR/features/WebXRLightEstimation.js +14 -2
  78. package/XR/features/WebXRLightEstimation.js.map +1 -1
  79. package/XR/features/WebXRRawCameraAccess.d.ts +81 -0
  80. package/XR/features/WebXRRawCameraAccess.js +169 -0
  81. package/XR/features/WebXRRawCameraAccess.js.map +1 -0
  82. package/XR/features/index.d.ts +1 -0
  83. package/XR/features/index.js +1 -0
  84. package/XR/features/index.js.map +1 -1
  85. package/XR/webXRFeaturesManager.d.ts +13 -0
  86. package/XR/webXRFeaturesManager.js +4 -0
  87. package/XR/webXRFeaturesManager.js.map +1 -1
  88. package/package.json +1 -1
  89. package/scene.d.ts +1 -1
  90. package/scene.js +11 -6
  91. package/scene.js.map +1 -1
@@ -11,6 +11,7 @@ import { DirectionalLight } from "../../Lights/directionalLight.js";
11
11
  import { BaseTexture } from "../../Materials/Textures/baseTexture.js";
12
12
  import { SphericalHarmonics, SphericalPolynomial } from "../../Maths/sphericalPolynomial.js";
13
13
  import { LightConstants } from "../../Lights/lightConstants.js";
14
+ import { HDRFiltering } from "../../Materials/Textures/Filtering/hdrFiltering.js";
14
15
  /**
15
16
  * Light Estimation Feature
16
17
  *
@@ -95,8 +96,18 @@ export class WebXRLightEstimation extends WebXRAbstractFeature {
95
96
  this._reflectionCubeMap._texture.getEngine().resetTextureCache();
96
97
  }
97
98
  this._reflectionCubeMap._texture.isReady = true;
98
- this._xrSessionManager.scene.markAllMaterialsAsDirty(1);
99
- this.onReflectionCubeMapUpdatedObservable.notifyObservers(this._reflectionCubeMap);
99
+ if (!this.options.disablePreFiltering) {
100
+ this._xrLightProbe.removeEventListener("reflectionchange", this._updateReflectionCubeMap);
101
+ this._hdrFilter.prefilter(this._reflectionCubeMap).then(() => {
102
+ this._xrSessionManager.scene.markAllMaterialsAsDirty(1);
103
+ this.onReflectionCubeMapUpdatedObservable.notifyObservers(this._reflectionCubeMap);
104
+ this._xrLightProbe.addEventListener("reflectionchange", this._updateReflectionCubeMap);
105
+ });
106
+ }
107
+ else {
108
+ this._xrSessionManager.scene.markAllMaterialsAsDirty(1);
109
+ this.onReflectionCubeMapUpdatedObservable.notifyObservers(this._reflectionCubeMap);
110
+ }
100
111
  }
101
112
  };
102
113
  this.xrNativeFeatureName = "light-estimation";
@@ -107,6 +118,7 @@ export class WebXRLightEstimation extends WebXRAbstractFeature {
107
118
  this.directionalLight.intensity = 0;
108
119
  this.directionalLight.falloffType = LightConstants.FALLOFF_GLTF;
109
120
  }
121
+ this._hdrFilter = new HDRFiltering(this._xrSessionManager.scene.getEngine());
110
122
  // https://immersive-web.github.io/lighting-estimation/
111
123
  Tools.Warn("light-estimation is an experimental and unstable feature.");
112
124
  }
@@ -1 +1 @@
1
- {"version":3,"file":"WebXRLightEstimation.js","sourceRoot":"","sources":["../../../../../dev/core/src/XR/features/WebXRLightEstimation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,0CAA0C,CAAC;AAChF,OAAO,EAAE,eAAe,EAAE,qBAAqB,EAAE,MAAM,0CAA0C,CAAC;AAClG,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAEzC,OAAO,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAEjF,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACpD,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from \"../../Materials/Textures/internalTexture\";\r\nimport { Observable } from \"../../Misc/observable\";\r\nimport { Tools } from \"../../Misc/tools\";\r\nimport type { Nullable } from \"../../types\";\r\nimport { WebXRFeatureName, WebXRFeaturesManager } from \"../webXRFeaturesManager\";\r\nimport type { WebXRSessionManager } from \"../webXRSessionManager\";\r\nimport { WebXRAbstractFeature } from \"./WebXRAbstractFeature\";\r\nimport { Constants } from \"../../Engines/constants\";\r\nimport { Color3 } from \"../../Maths/math.color\";\r\nimport { Vector3 } from \"../../Maths/math.vector\";\r\nimport { DirectionalLight } from \"../../Lights/directionalLight\";\r\nimport { BaseTexture } from \"../../Materials/Textures/baseTexture\";\r\nimport { SphericalHarmonics, SphericalPolynomial } from \"../../Maths/sphericalPolynomial\";\r\nimport { LightConstants } from \"../../Lights/lightConstants\";\r\n\r\n/**\r\n * Options for Light Estimation feature\r\n */\r\nexport interface IWebXRLightEstimationOptions {\r\n /**\r\n * Disable the cube map reflection feature. In this case only light direction and color will be updated\r\n */\r\n disableCubeMapReflection?: boolean;\r\n /**\r\n * Should the scene's env texture be set to the cube map reflection texture\r\n * Note that this doesn't work is disableCubeMapReflection if set to false\r\n */\r\n setSceneEnvironmentTexture?: boolean;\r\n /**\r\n * How often should the cubemap update in ms.\r\n * If not set the cubemap will be updated every time the underlying system updates the environment texture.\r\n */\r\n cubeMapPollInterval?: number;\r\n /**\r\n * How often should the light estimation properties update in ms.\r\n * If not set the light estimation properties will be updated on every frame (depending on the underlying system)\r\n */\r\n lightEstimationPollInterval?: number;\r\n /**\r\n * Should a directional light source be created.\r\n * If created, this light source will be updated whenever the light estimation values change\r\n */\r\n createDirectionalLightSource?: boolean;\r\n /**\r\n * Define the format to be used for the light estimation texture.\r\n */\r\n reflectionFormat?: XRReflectionFormat;\r\n /**\r\n * Should the light estimation's needed vectors be constructed on each frame.\r\n * Use this when you use those vectors and don't want their values to change outside of the light estimation feature\r\n */\r\n disableVectorReuse?: boolean;\r\n\r\n /**\r\n * disable applying the spherical polynomial to the cube map texture\r\n */\r\n disableSphericalPolynomial?: boolean;\r\n}\r\n\r\n/**\r\n * An interface describing the result of a light estimation\r\n */\r\nexport interface IWebXRLightEstimation {\r\n /**\r\n * The intensity of the light source\r\n */\r\n lightIntensity: number;\r\n /**\r\n * Color of light source\r\n */\r\n lightColor: Color3;\r\n /**\r\n * The direction from the light source\r\n */\r\n lightDirection: Vector3;\r\n /**\r\n * Spherical harmonics coefficients of the light source\r\n */\r\n sphericalHarmonics: SphericalHarmonics;\r\n}\r\n\r\n/**\r\n * Light Estimation Feature\r\n *\r\n * @since 5.0.0\r\n */\r\nexport class WebXRLightEstimation extends WebXRAbstractFeature {\r\n private _canvasContext: Nullable<WebGLRenderingContext | WebGL2RenderingContext> = null;\r\n private _reflectionCubeMap: Nullable<BaseTexture> = null;\r\n private _xrLightEstimate: Nullable<XRLightEstimate> = null;\r\n private _xrLightProbe: Nullable<XRLightProbe> = null;\r\n private _xrWebGLBinding: Nullable<XRWebGLBinding> = null;\r\n private _lightDirection: Vector3 = Vector3.Up().negateInPlace();\r\n private _lightColor: Color3 = Color3.White();\r\n private _intensity: number = 1;\r\n private _sphericalHarmonics: SphericalHarmonics = new SphericalHarmonics();\r\n private _cubeMapPollTime = Date.now();\r\n private _lightEstimationPollTime = Date.now();\r\n\r\n /**\r\n * The module's name\r\n */\r\n public static readonly Name = WebXRFeatureName.LIGHT_ESTIMATION;\r\n /**\r\n * The (Babylon) version of this module.\r\n * This is an integer representing the implementation version.\r\n * This number does not correspond to the WebXR specs version\r\n */\r\n public static readonly Version = 1;\r\n\r\n /**\r\n * ARCore's reflection cube map size is 16x16.\r\n * Once other systems support this feature we will need to change this to be dynamic.\r\n * see https://github.com/immersive-web/lighting-estimation/blob/main/lighting-estimation-explainer.md#cube-map-open-questions\r\n */\r\n private _reflectionCubeMapTextureSize: number = 16;\r\n\r\n /**\r\n * If createDirectionalLightSource is set to true this light source will be created automatically.\r\n * Otherwise this can be set with an external directional light source.\r\n * This light will be updated whenever the light estimation values change.\r\n */\r\n public directionalLight: Nullable<DirectionalLight> = null;\r\n\r\n /**\r\n * This observable will notify when the reflection cube map is updated.\r\n */\r\n public onReflectionCubeMapUpdatedObservable: Observable<BaseTexture> = new Observable();\r\n\r\n /**\r\n * Creates a new instance of the light estimation feature\r\n * @param _xrSessionManager an instance of WebXRSessionManager\r\n * @param options options to use when constructing this feature\r\n */\r\n constructor(\r\n _xrSessionManager: WebXRSessionManager,\r\n /**\r\n * options to use when constructing this feature\r\n */\r\n public readonly options: IWebXRLightEstimationOptions\r\n ) {\r\n super(_xrSessionManager);\r\n this.xrNativeFeatureName = \"light-estimation\";\r\n\r\n if (this.options.createDirectionalLightSource) {\r\n this.directionalLight = new DirectionalLight(\"light estimation directional\", this._lightDirection, this._xrSessionManager.scene);\r\n this.directionalLight.position = new Vector3(0, 8, 0);\r\n // intensity will be set later\r\n this.directionalLight.intensity = 0;\r\n this.directionalLight.falloffType = LightConstants.FALLOFF_GLTF;\r\n }\r\n\r\n // https://immersive-web.github.io/lighting-estimation/\r\n Tools.Warn(\"light-estimation is an experimental and unstable feature.\");\r\n }\r\n\r\n /**\r\n * While the estimated cube map is expected to update over time to better reflect the user's environment as they move around those changes are unlikely to happen with every XRFrame.\r\n * Since creating and processing the cube map is potentially expensive, especially if mip maps are needed, you can listen to the onReflectionCubeMapUpdatedObservable to determine\r\n * when it has been updated.\r\n */\r\n public get reflectionCubeMapTexture(): Nullable<BaseTexture> {\r\n return this._reflectionCubeMap;\r\n }\r\n\r\n /**\r\n * The most recent light estimate. Available starting on the first frame where the device provides a light probe.\r\n */\r\n public get xrLightingEstimate(): Nullable<IWebXRLightEstimation> {\r\n if (this._xrLightEstimate) {\r\n return {\r\n lightColor: this._lightColor,\r\n lightDirection: this._lightDirection,\r\n lightIntensity: this._intensity,\r\n sphericalHarmonics: this._sphericalHarmonics,\r\n };\r\n }\r\n return this._xrLightEstimate;\r\n }\r\n\r\n private _getCanvasContext(): WebGLRenderingContext | WebGL2RenderingContext {\r\n if (this._canvasContext === null) {\r\n this._canvasContext = this._xrSessionManager.scene.getEngine()._gl;\r\n }\r\n return this._canvasContext;\r\n }\r\n\r\n private _getXRGLBinding(): XRWebGLBinding {\r\n if (this._xrWebGLBinding === null) {\r\n const context = this._getCanvasContext();\r\n this._xrWebGLBinding = new XRWebGLBinding(this._xrSessionManager.session, context);\r\n }\r\n return this._xrWebGLBinding;\r\n }\r\n\r\n /**\r\n * Event Listener for \"reflectionchange\" events.\r\n */\r\n private _updateReflectionCubeMap = (): void => {\r\n if (!this._xrLightProbe) {\r\n return;\r\n }\r\n // check poll time, do not update if it has not been long enough\r\n if (this.options.cubeMapPollInterval) {\r\n const now = Date.now();\r\n if (now - this._cubeMapPollTime < this.options.cubeMapPollInterval) {\r\n return;\r\n }\r\n this._cubeMapPollTime = now;\r\n }\r\n const lp = this._getXRGLBinding().getReflectionCubeMap(this._xrLightProbe);\r\n if (lp && this._reflectionCubeMap) {\r\n if (!this._reflectionCubeMap._texture) {\r\n const internalTexture = new InternalTexture(this._xrSessionManager.scene.getEngine(), InternalTextureSource.Unknown);\r\n internalTexture.isCube = true;\r\n internalTexture.invertY = false;\r\n internalTexture._useSRGBBuffer = this.options.reflectionFormat === \"srgba8\";\r\n internalTexture.format = Constants.TEXTUREFORMAT_RGBA;\r\n internalTexture.generateMipMaps = true;\r\n internalTexture.type = this.options.reflectionFormat !== \"srgba8\" ? Constants.TEXTURETYPE_HALF_FLOAT : Constants.TEXTURETYPE_UNSIGNED_BYTE;\r\n internalTexture.samplingMode = Constants.TEXTURE_LINEAR_LINEAR_MIPLINEAR;\r\n internalTexture.width = this._reflectionCubeMapTextureSize;\r\n internalTexture.height = this._reflectionCubeMapTextureSize;\r\n internalTexture._cachedWrapU = Constants.TEXTURE_WRAP_ADDRESSMODE;\r\n internalTexture._cachedWrapV = Constants.TEXTURE_WRAP_ADDRESSMODE;\r\n internalTexture._hardwareTexture = new WebGLHardwareTexture(lp, this._getCanvasContext() as WebGLRenderingContext);\r\n this._reflectionCubeMap._texture = internalTexture;\r\n } else {\r\n this._reflectionCubeMap._texture._hardwareTexture?.set(lp);\r\n this._reflectionCubeMap._texture.getEngine().resetTextureCache();\r\n }\r\n this._reflectionCubeMap._texture.isReady = true;\r\n this._xrSessionManager.scene.markAllMaterialsAsDirty(Constants.MATERIAL_TextureDirtyFlag);\r\n\r\n this.onReflectionCubeMapUpdatedObservable.notifyObservers(this._reflectionCubeMap);\r\n }\r\n };\r\n\r\n /**\r\n * attach this feature\r\n * Will usually be called by the features manager\r\n *\r\n * @returns true if successful.\r\n */\r\n public attach(): boolean {\r\n if (!super.attach()) {\r\n return false;\r\n }\r\n\r\n const reflectionFormat = this.options.reflectionFormat ?? (this._xrSessionManager.session.preferredReflectionFormat || \"srgba8\");\r\n this.options.reflectionFormat = reflectionFormat;\r\n this._xrSessionManager.session\r\n .requestLightProbe({\r\n reflectionFormat,\r\n })\r\n .then((xrLightProbe: XRLightProbe) => {\r\n this._xrLightProbe = xrLightProbe;\r\n if (!this.options.disableCubeMapReflection) {\r\n if (!this._reflectionCubeMap) {\r\n this._reflectionCubeMap = new BaseTexture(this._xrSessionManager.scene);\r\n this._reflectionCubeMap._isCube = true;\r\n this._reflectionCubeMap.coordinatesMode = Constants.TEXTURE_CUBIC_MODE;\r\n if (this.options.setSceneEnvironmentTexture) {\r\n this._xrSessionManager.scene.environmentTexture = this._reflectionCubeMap;\r\n }\r\n }\r\n this._xrLightProbe.addEventListener(\"reflectionchange\", this._updateReflectionCubeMap);\r\n }\r\n });\r\n\r\n return true;\r\n }\r\n\r\n /**\r\n * detach this feature.\r\n * Will usually be called by the features manager\r\n *\r\n * @returns true if successful.\r\n */\r\n public detach(): boolean {\r\n const detached = super.detach();\r\n\r\n if (this._xrLightProbe !== null && !this.options.disableCubeMapReflection) {\r\n this._xrLightProbe.removeEventListener(\"reflectionchange\", this._updateReflectionCubeMap);\r\n this._xrLightProbe = null;\r\n }\r\n\r\n this._canvasContext = null;\r\n this._xrLightEstimate = null;\r\n // When the session ends (on detach) we must clear our XRWebGLBinging instance, which references the ended session.\r\n this._xrWebGLBinding = null;\r\n\r\n return detached;\r\n }\r\n\r\n /**\r\n * Dispose this feature and all of the resources attached\r\n */\r\n public dispose(): void {\r\n super.dispose();\r\n\r\n this.onReflectionCubeMapUpdatedObservable.clear();\r\n\r\n if (this.directionalLight) {\r\n this.directionalLight.dispose();\r\n this.directionalLight = null;\r\n }\r\n\r\n if (this._reflectionCubeMap !== null) {\r\n if (this._reflectionCubeMap._texture) {\r\n this._reflectionCubeMap._texture.dispose();\r\n }\r\n this._reflectionCubeMap.dispose();\r\n this._reflectionCubeMap = null;\r\n }\r\n }\r\n\r\n protected _onXRFrame(_xrFrame: XRFrame): void {\r\n if (this._xrLightProbe !== null) {\r\n if (this.options.lightEstimationPollInterval) {\r\n const now = Date.now();\r\n if (now - this._lightEstimationPollTime < this.options.lightEstimationPollInterval) {\r\n return;\r\n }\r\n this._lightEstimationPollTime = now;\r\n }\r\n this._xrLightEstimate = _xrFrame.getLightEstimate(this._xrLightProbe);\r\n if (this._xrLightEstimate) {\r\n this._intensity = Math.max(\r\n 1.0,\r\n this._xrLightEstimate.primaryLightIntensity.x,\r\n this._xrLightEstimate.primaryLightIntensity.y,\r\n this._xrLightEstimate.primaryLightIntensity.z\r\n );\r\n\r\n const rhsFactor = this._xrSessionManager.scene.useRightHandedSystem ? 1.0 : -1.0;\r\n\r\n // recreate the vector caches, so that the last one provided to the user will persist\r\n if (this.options.disableVectorReuse) {\r\n this._lightDirection = new Vector3();\r\n this._lightColor = new Color3();\r\n if (this.directionalLight) {\r\n this.directionalLight.direction = this._lightDirection;\r\n this.directionalLight.diffuse = this._lightColor;\r\n }\r\n }\r\n\r\n this._lightDirection.copyFromFloats(\r\n this._xrLightEstimate.primaryLightDirection.x,\r\n this._xrLightEstimate.primaryLightDirection.y,\r\n this._xrLightEstimate.primaryLightDirection.z * rhsFactor\r\n );\r\n this._lightColor.copyFromFloats(\r\n this._xrLightEstimate.primaryLightIntensity.x / this._intensity,\r\n this._xrLightEstimate.primaryLightIntensity.y / this._intensity,\r\n this._xrLightEstimate.primaryLightIntensity.z / this._intensity\r\n );\r\n this._sphericalHarmonics.updateFromFloatsArray(this._xrLightEstimate.sphericalHarmonicsCoefficients);\r\n if (this._reflectionCubeMap && !this.options.disableSphericalPolynomial) {\r\n this._reflectionCubeMap.sphericalPolynomial = this._reflectionCubeMap.sphericalPolynomial || new SphericalPolynomial();\r\n this._reflectionCubeMap.sphericalPolynomial?.updateFromHarmonics(this._sphericalHarmonics);\r\n }\r\n\r\n // direction from instead of direction to\r\n this._lightDirection.negateInPlace();\r\n // set the values after calculating them\r\n if (this.directionalLight) {\r\n this.directionalLight.direction.copyFrom(this._lightDirection);\r\n this.directionalLight.intensity = Math.min(this._intensity, 1.0);\r\n this.directionalLight.diffuse.copyFrom(this._lightColor);\r\n }\r\n }\r\n }\r\n }\r\n}\r\n\r\n// register the plugin\r\nWebXRFeaturesManager.AddWebXRFeature(\r\n WebXRLightEstimation.Name,\r\n (xrSessionManager, options) => {\r\n return () => new WebXRLightEstimation(xrSessionManager, options);\r\n },\r\n WebXRLightEstimation.Version,\r\n false\r\n);\r\n"]}
1
+ {"version":3,"file":"WebXRLightEstimation.js","sourceRoot":"","sources":["../../../../../dev/core/src/XR/features/WebXRLightEstimation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,0CAA0C,CAAC;AAChF,OAAO,EAAE,eAAe,EAAE,qBAAqB,EAAE,MAAM,0CAA0C,CAAC;AAClG,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAEzC,OAAO,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAEjF,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EAAE,SAAS,EAAE,MA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AC,IAAI,CAAC,eAAe,CAAC,CAAC;oBAC/D,IAAI,CAAC,gBAAgB,CAAC,SAAS,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,UAAU,EAAE,GAAG,CAAC,CAAC;oBACjE,IAAI,CAAC,gBAAgB,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;iBAC5D;aACJ;SACJ;IACL,CAAC;;AA/RD;;GAEG;AACoB,yBAAI,GAAG,gBAAgB,CAAC,gBAAgB,AAApC,CAAqC;AAChE;;;;GAIG;AACoB,4BAAO,GAAG,CAAC,AAAJ,CAAK;AAyRvC,sBAAsB;AACtB,oBAAoB,CAAC,eAAe,CAChC,oBAAoB,CAAC,IAAI,EACzB,CAAC,gBAAgB,EAAE,OAAO,EAAE,EAAE;IAC1B,OAAO,GAAG,EAAE,CAAC,IAAI,oBAAoB,CAAC,gBAAgB,EAAE,OAAO,CAAC,CAAC;AACrE,CAAC,EACD,oBAAoB,CAAC,OAAO,EAC5B,KAAK,CACR,CAAC","sourcesContent":["import { WebGLHardwareTexture } from \"../../Engines/WebGL/webGLHardwareTexture\";\r\nimport { InternalTexture, InternalTextureSource } from \"../../Materials/Textures/internalTexture\";\r\nimport { Observable } from \"../../Misc/observable\";\r\nimport { Tools } from \"../../Misc/tools\";\r\nimport type { Nullable } from \"../../types\";\r\nimport { WebXRFeatureName, WebXRFeaturesManager } from \"../webXRFeaturesManager\";\r\nimport type { WebXRSessionManager } from \"../webXRSessionManager\";\r\nimport { WebXRAbstractFeature } from \"./WebXRAbstractFeature\";\r\nimport { Constants } from \"../../Engines/constants\";\r\nimport { Color3 } from \"../../Maths/math.color\";\r\nimport { Vector3 } from \"../../Maths/math.vector\";\r\nimport { DirectionalLight } from \"../../Lights/directionalLight\";\r\nimport { BaseTexture } from \"../../Materials/Textures/baseTexture\";\r\nimport { SphericalHarmonics, SphericalPolynomial } from \"../../Maths/sphericalPolynomial\";\r\nimport { LightConstants } from \"../../Lights/lightConstants\";\r\nimport { HDRFiltering } from \"core/Materials/Textures/Filtering/hdrFiltering\";\r\n\r\n/**\r\n * Options for Light Estimation feature\r\n */\r\nexport interface IWebXRLightEstimationOptions {\r\n /**\r\n * Disable the cube map reflection feature. In this case only light direction and color will be updated\r\n */\r\n disableCubeMapReflection?: boolean;\r\n /**\r\n * Should the scene's env texture be set to the cube map reflection texture\r\n * Note that this doesn't work is disableCubeMapReflection if set to false\r\n */\r\n setSceneEnvironmentTexture?: boolean;\r\n /**\r\n * How often should the cubemap update in ms.\r\n * If not set the cubemap will be updated every time the underlying system updates the environment texture.\r\n */\r\n cubeMapPollInterval?: number;\r\n /**\r\n * How often should the light estimation properties update in ms.\r\n * If not set the light estimation properties will be updated on every frame (depending on the underlying system)\r\n */\r\n lightEstimationPollInterval?: number;\r\n /**\r\n * Should a directional light source be created.\r\n * If created, this light source will be updated whenever the light estimation values change\r\n */\r\n createDirectionalLightSource?: boolean;\r\n /**\r\n * Define the format to be used for the light estimation texture.\r\n */\r\n reflectionFormat?: XRReflectionFormat;\r\n /**\r\n * Should the light estimation's needed vectors be constructed on each frame.\r\n * Use this when you use those vectors and don't want their values to change outside of the light estimation feature\r\n */\r\n disableVectorReuse?: boolean;\r\n\r\n /**\r\n * disable applying the spherical polynomial to the cube map texture\r\n */\r\n disableSphericalPolynomial?: boolean;\r\n\r\n /**\r\n * disable prefiltering the cube map texture\r\n */\r\n disablePreFiltering?: boolean;\r\n}\r\n\r\n/**\r\n * An interface describing the result of a light estimation\r\n */\r\nexport interface IWebXRLightEstimation {\r\n /**\r\n * The intensity of the light source\r\n */\r\n lightIntensity: number;\r\n /**\r\n * Color of light source\r\n */\r\n lightColor: Color3;\r\n /**\r\n * The direction from the light source\r\n */\r\n lightDirection: Vector3;\r\n /**\r\n * Spherical harmonics coefficients of the light source\r\n */\r\n sphericalHarmonics: SphericalHarmonics;\r\n}\r\n\r\n/**\r\n * Light Estimation Feature\r\n *\r\n * @since 5.0.0\r\n */\r\nexport class WebXRLightEstimation extends WebXRAbstractFeature {\r\n private _canvasContext: Nullable<WebGLRenderingContext | WebGL2RenderingContext> = null;\r\n private _reflectionCubeMap: Nullable<BaseTexture> = null;\r\n private _xrLightEstimate: Nullable<XRLightEstimate> = null;\r\n private _xrLightProbe: Nullable<XRLightProbe> = null;\r\n private _xrWebGLBinding: Nullable<XRWebGLBinding> = null;\r\n private _lightDirection: Vector3 = Vector3.Up().negateInPlace();\r\n private _lightColor: Color3 = Color3.White();\r\n private _intensity: number = 1;\r\n private _sphericalHarmonics: SphericalHarmonics = new SphericalHarmonics();\r\n private _cubeMapPollTime = Date.now();\r\n private _lightEstimationPollTime = Date.now();\r\n\r\n /**\r\n * The module's name\r\n */\r\n public static readonly Name = WebXRFeatureName.LIGHT_ESTIMATION;\r\n /**\r\n * The (Babylon) version of this module.\r\n * This is an integer representing the implementation version.\r\n * This number does not correspond to the WebXR specs version\r\n */\r\n public static readonly Version = 1;\r\n\r\n /**\r\n * ARCore's reflection cube map size is 16x16.\r\n * Once other systems support this feature we will need to change this to be dynamic.\r\n * see https://github.com/immersive-web/lighting-estimation/blob/main/lighting-estimation-explainer.md#cube-map-open-questions\r\n */\r\n private _reflectionCubeMapTextureSize: number = 16;\r\n\r\n private _hdrFilter: HDRFiltering;\r\n\r\n /**\r\n * If createDirectionalLightSource is set to true this light source will be created automatically.\r\n * Otherwise this can be set with an external directional light source.\r\n * This light will be updated whenever the light estimation values change.\r\n */\r\n public directionalLight: Nullable<DirectionalLight> = null;\r\n\r\n /**\r\n * This observable will notify when the reflection cube map is updated.\r\n */\r\n public onReflectionCubeMapUpdatedObservable: Observable<BaseTexture> = new Observable();\r\n\r\n /**\r\n * Creates a new instance of the light estimation feature\r\n * @param _xrSessionManager an instance of WebXRSessionManager\r\n * @param options options to use when constructing this feature\r\n */\r\n constructor(\r\n _xrSessionManager: WebXRSessionManager,\r\n /**\r\n * options to use when constructing this feature\r\n */\r\n public readonly options: IWebXRLightEstimationOptions\r\n ) {\r\n super(_xrSessionManager);\r\n this.xrNativeFeatureName = \"light-estimation\";\r\n\r\n if (this.options.createDirectionalLightSource) {\r\n this.directionalLight = new DirectionalLight(\"light estimation directional\", this._lightDirection, this._xrSessionManager.scene);\r\n this.directionalLight.position = new Vector3(0, 8, 0);\r\n // intensity will be set later\r\n this.directionalLight.intensity = 0;\r\n this.directionalLight.falloffType = LightConstants.FALLOFF_GLTF;\r\n }\r\n\r\n this._hdrFilter = new HDRFiltering(this._xrSessionManager.scene.getEngine());\r\n\r\n // https://immersive-web.github.io/lighting-estimation/\r\n Tools.Warn(\"light-estimation is an experimental and unstable feature.\");\r\n }\r\n\r\n /**\r\n * While the estimated cube map is expected to update over time to better reflect the user's environment as they move around those changes are unlikely to happen with every XRFrame.\r\n * Since creating and processing the cube map is potentially expensive, especially if mip maps are needed, you can listen to the onReflectionCubeMapUpdatedObservable to determine\r\n * when it has been updated.\r\n */\r\n public get reflectionCubeMapTexture(): Nullable<BaseTexture> {\r\n return this._reflectionCubeMap;\r\n }\r\n\r\n /**\r\n * The most recent light estimate. Available starting on the first frame where the device provides a light probe.\r\n */\r\n public get xrLightingEstimate(): Nullable<IWebXRLightEstimation> {\r\n if (this._xrLightEstimate) {\r\n return {\r\n lightColor: this._lightColor,\r\n lightDirection: this._lightDirection,\r\n lightIntensity: this._intensity,\r\n sphericalHarmonics: this._sphericalHarmonics,\r\n };\r\n }\r\n return this._xrLightEstimate;\r\n }\r\n\r\n private _getCanvasContext(): WebGLRenderingContext | WebGL2RenderingContext {\r\n if (this._canvasContext === null) {\r\n this._canvasContext = this._xrSessionManager.scene.getEngine()._gl;\r\n }\r\n return this._canvasContext;\r\n }\r\n\r\n private _getXRGLBinding(): XRWebGLBinding {\r\n if (this._xrWebGLBinding === null) {\r\n const context = this._getCanvasContext();\r\n this._xrWebGLBinding = new XRWebGLBinding(this._xrSessionManager.session, context);\r\n }\r\n return this._xrWebGLBinding;\r\n }\r\n\r\n /**\r\n * Event Listener for \"reflectionchange\" events.\r\n */\r\n private _updateReflectionCubeMap = (): void => {\r\n if (!this._xrLightProbe) {\r\n return;\r\n }\r\n // check poll time, do not update if it has not been long enough\r\n if (this.options.cubeMapPollInterval) {\r\n const now = Date.now();\r\n if (now - this._cubeMapPollTime < this.options.cubeMapPollInterval) {\r\n return;\r\n }\r\n this._cubeMapPollTime = now;\r\n }\r\n const lp = this._getXRGLBinding().getReflectionCubeMap(this._xrLightProbe);\r\n if (lp && this._reflectionCubeMap) {\r\n if (!this._reflectionCubeMap._texture) {\r\n const internalTexture = new InternalTexture(this._xrSessionManager.scene.getEngine(), InternalTextureSource.Unknown);\r\n internalTexture.isCube = true;\r\n internalTexture.invertY = false;\r\n internalTexture._useSRGBBuffer = this.options.reflectionFormat === \"srgba8\";\r\n internalTexture.format = Constants.TEXTUREFORMAT_RGBA;\r\n internalTexture.generateMipMaps = true;\r\n internalTexture.type = this.options.reflectionFormat !== \"srgba8\" ? Constants.TEXTURETYPE_HALF_FLOAT : Constants.TEXTURETYPE_UNSIGNED_BYTE;\r\n internalTexture.samplingMode = Constants.TEXTURE_LINEAR_LINEAR_MIPLINEAR;\r\n internalTexture.width = this._reflectionCubeMapTextureSize;\r\n internalTexture.height = this._reflectionCubeMapTextureSize;\r\n internalTexture._cachedWrapU = Constants.TEXTURE_WRAP_ADDRESSMODE;\r\n internalTexture._cachedWrapV = Constants.TEXTURE_WRAP_ADDRESSMODE;\r\n internalTexture._hardwareTexture = new WebGLHardwareTexture(lp, this._getCanvasContext() as WebGLRenderingContext);\r\n this._reflectionCubeMap._texture = internalTexture;\r\n } else {\r\n this._reflectionCubeMap._texture._hardwareTexture?.set(lp);\r\n this._reflectionCubeMap._texture.getEngine().resetTextureCache();\r\n }\r\n this._reflectionCubeMap._texture.isReady = true;\r\n if (!this.options.disablePreFiltering) {\r\n this._xrLightProbe!.removeEventListener(\"reflectionchange\", this._updateReflectionCubeMap);\r\n this._hdrFilter.prefilter(this._reflectionCubeMap).then(() => {\r\n this._xrSessionManager.scene.markAllMaterialsAsDirty(Constants.MATERIAL_TextureDirtyFlag);\r\n this.onReflectionCubeMapUpdatedObservable.notifyObservers(this._reflectionCubeMap!);\r\n this._xrLightProbe!.addEventListener(\"reflectionchange\", this._updateReflectionCubeMap);\r\n });\r\n } else {\r\n this._xrSessionManager.scene.markAllMaterialsAsDirty(Constants.MATERIAL_TextureDirtyFlag);\r\n\r\n this.onReflectionCubeMapUpdatedObservable.notifyObservers(this._reflectionCubeMap);\r\n }\r\n }\r\n };\r\n\r\n /**\r\n * attach this feature\r\n * Will usually be called by the features manager\r\n *\r\n * @returns true if successful.\r\n */\r\n public attach(): boolean {\r\n if (!super.attach()) {\r\n return false;\r\n }\r\n\r\n const reflectionFormat = this.options.reflectionFormat ?? (this._xrSessionManager.session.preferredReflectionFormat || \"srgba8\");\r\n this.options.reflectionFormat = reflectionFormat;\r\n this._xrSessionManager.session\r\n .requestLightProbe({\r\n reflectionFormat,\r\n })\r\n .then((xrLightProbe: XRLightProbe) => {\r\n this._xrLightProbe = xrLightProbe;\r\n if (!this.options.disableCubeMapReflection) {\r\n if (!this._reflectionCubeMap) {\r\n this._reflectionCubeMap = new BaseTexture(this._xrSessionManager.scene);\r\n this._reflectionCubeMap._isCube = true;\r\n this._reflectionCubeMap.coordinatesMode = Constants.TEXTURE_CUBIC_MODE;\r\n if (this.options.setSceneEnvironmentTexture) {\r\n this._xrSessionManager.scene.environmentTexture = this._reflectionCubeMap;\r\n }\r\n }\r\n this._xrLightProbe.addEventListener(\"reflectionchange\", this._updateReflectionCubeMap);\r\n }\r\n });\r\n\r\n return true;\r\n }\r\n\r\n /**\r\n * detach this feature.\r\n * Will usually be called by the features manager\r\n *\r\n * @returns true if successful.\r\n */\r\n public detach(): boolean {\r\n const detached = super.detach();\r\n\r\n if (this._xrLightProbe !== null && !this.options.disableCubeMapReflection) {\r\n this._xrLightProbe.removeEventListener(\"reflectionchange\", this._updateReflectionCubeMap);\r\n this._xrLightProbe = null;\r\n }\r\n\r\n this._canvasContext = null;\r\n this._xrLightEstimate = null;\r\n // When the session ends (on detach) we must clear our XRWebGLBinging instance, which references the ended session.\r\n this._xrWebGLBinding = null;\r\n\r\n return detached;\r\n }\r\n\r\n /**\r\n * Dispose this feature and all of the resources attached\r\n */\r\n public dispose(): void {\r\n super.dispose();\r\n\r\n this.onReflectionCubeMapUpdatedObservable.clear();\r\n\r\n if (this.directionalLight) {\r\n this.directionalLight.dispose();\r\n this.directionalLight = null;\r\n }\r\n\r\n if (this._reflectionCubeMap !== null) {\r\n if (this._reflectionCubeMap._texture) {\r\n this._reflectionCubeMap._texture.dispose();\r\n }\r\n this._reflectionCubeMap.dispose();\r\n this._reflectionCubeMap = null;\r\n }\r\n }\r\n\r\n protected _onXRFrame(_xrFrame: XRFrame): void {\r\n if (this._xrLightProbe !== null) {\r\n if (this.options.lightEstimationPollInterval) {\r\n const now = Date.now();\r\n if (now - this._lightEstimationPollTime < this.options.lightEstimationPollInterval) {\r\n return;\r\n }\r\n this._lightEstimationPollTime = now;\r\n }\r\n this._xrLightEstimate = _xrFrame.getLightEstimate(this._xrLightProbe);\r\n if (this._xrLightEstimate) {\r\n this._intensity = Math.max(\r\n 1.0,\r\n this._xrLightEstimate.primaryLightIntensity.x,\r\n this._xrLightEstimate.primaryLightIntensity.y,\r\n this._xrLightEstimate.primaryLightIntensity.z\r\n );\r\n\r\n const rhsFactor = this._xrSessionManager.scene.useRightHandedSystem ? 1.0 : -1.0;\r\n\r\n // recreate the vector caches, so that the last one provided to the user will persist\r\n if (this.options.disableVectorReuse) {\r\n this._lightDirection = new Vector3();\r\n this._lightColor = new Color3();\r\n if (this.directionalLight) {\r\n this.directionalLight.direction = this._lightDirection;\r\n this.directionalLight.diffuse = this._lightColor;\r\n }\r\n }\r\n\r\n this._lightDirection.copyFromFloats(\r\n this._xrLightEstimate.primaryLightDirection.x,\r\n this._xrLightEstimate.primaryLightDirection.y,\r\n this._xrLightEstimate.primaryLightDirection.z * rhsFactor\r\n );\r\n this._lightColor.copyFromFloats(\r\n this._xrLightEstimate.primaryLightIntensity.x / this._intensity,\r\n this._xrLightEstimate.primaryLightIntensity.y / this._intensity,\r\n this._xrLightEstimate.primaryLightIntensity.z / this._intensity\r\n );\r\n this._sphericalHarmonics.updateFromFloatsArray(this._xrLightEstimate.sphericalHarmonicsCoefficients);\r\n if (this._reflectionCubeMap && !this.options.disableSphericalPolynomial) {\r\n this._reflectionCubeMap.sphericalPolynomial = this._reflectionCubeMap.sphericalPolynomial || new SphericalPolynomial();\r\n this._reflectionCubeMap.sphericalPolynomial?.updateFromHarmonics(this._sphericalHarmonics);\r\n }\r\n\r\n // direction from instead of direction to\r\n this._lightDirection.negateInPlace();\r\n // set the values after calculating them\r\n if (this.directionalLight) {\r\n this.directionalLight.direction.copyFrom(this._lightDirection);\r\n this.directionalLight.intensity = Math.min(this._intensity, 1.0);\r\n this.directionalLight.diffuse.copyFrom(this._lightColor);\r\n }\r\n }\r\n }\r\n }\r\n}\r\n\r\n// register the plugin\r\nWebXRFeaturesManager.AddWebXRFeature(\r\n WebXRLightEstimation.Name,\r\n (xrSessionManager, options) => {\r\n return () => new WebXRLightEstimation(xrSessionManager, options);\r\n },\r\n WebXRLightEstimation.Version,\r\n false\r\n);\r\n"]}
@@ -0,0 +1,81 @@
1
+ import type { WebXRSessionManager } from "../webXRSessionManager";
2
+ import { WebXRAbstractFeature } from "./WebXRAbstractFeature";
3
+ import { Observable } from "../../Misc/observable";
4
+ import { BaseTexture } from "../../Materials/Textures/baseTexture.js";
5
+ /**
6
+ * Options for raw camera access
7
+ */
8
+ export interface IWebXRRawCameraAccessOptions {
9
+ /**
10
+ * Keep the created textures and metadata when detaching the feature.
11
+ */
12
+ doNotDisposeOnDetach?: boolean;
13
+ }
14
+ /**
15
+ * WebXR Feature for WebXR raw camera access
16
+ * @since 6.31.0
17
+ * @see https://immersive-web.github.io/raw-camera-access/
18
+ */
19
+ export declare class WebXRRawCameraAccess extends WebXRAbstractFeature {
20
+ readonly options: IWebXRRawCameraAccessOptions;
21
+ private _cachedInternalTextures;
22
+ /**
23
+ * This is an array of camera views
24
+ * Note that mostly the array will contain a single view
25
+ * If you want to know the order of the views, use the `viewIndex` array
26
+ */
27
+ texturesData: BaseTexture[];
28
+ /**
29
+ * If needed, this array will contain the eye definition of each texture in `texturesArray`
30
+ */
31
+ viewIndex: string[];
32
+ /**
33
+ * If needed, this array will contain the camera's intrinsics
34
+ * You can use this data to convert from camera space to screen space and vice versa
35
+ */
36
+ cameraIntrinsics: {
37
+ u0: number;
38
+ v0: number;
39
+ ax: number;
40
+ ay: number;
41
+ gamma: number;
42
+ width: number;
43
+ height: number;
44
+ viewportX: number;
45
+ viewportY: number;
46
+ }[];
47
+ /**
48
+ * An observable that will notify when the camera's textures are updated
49
+ */
50
+ onTexturesUpdatedObservable: Observable<BaseTexture[]>;
51
+ private _glBinding?;
52
+ private _glContext;
53
+ /**
54
+ * The module's name
55
+ */
56
+ static readonly Name = "xr-raw-camera-access";
57
+ /**
58
+ * The (Babylon) version of this module.
59
+ * This is an integer representing the implementation version.
60
+ * This number does not correspond to the WebXR specs version
61
+ */
62
+ static readonly Version = 1;
63
+ /**
64
+ * Creates a new instance of the feature
65
+ * @param _xrSessionManager the WebXRSessionManager
66
+ * @param options options for the Feature
67
+ */
68
+ constructor(_xrSessionManager: WebXRSessionManager, options?: IWebXRRawCameraAccessOptions);
69
+ attach(force?: boolean | undefined): boolean;
70
+ detach(): boolean;
71
+ /**
72
+ * Dispose this feature and all of the resources attached
73
+ */
74
+ dispose(): void;
75
+ /**
76
+ * @see https://github.com/immersive-web/raw-camera-access/blob/main/explainer.md
77
+ */
78
+ private _updateCameraIntrinsics;
79
+ private _updateInternalTextures;
80
+ protected _onXRFrame(_xrFrame: XRFrame): void;
81
+ }
@@ -0,0 +1,169 @@
1
+ import { WebXRFeatureName, WebXRFeaturesManager } from "../webXRFeaturesManager.js";
2
+ import { WebXRAbstractFeature } from "./WebXRAbstractFeature.js";
3
+ import { Observable } from "../../Misc/observable.js";
4
+
5
+ import { WebGLHardwareTexture } from "../../Engines/WebGL/webGLHardwareTexture.js";
6
+ import { InternalTexture, InternalTextureSource } from "../../Materials/Textures/internalTexture.js";
7
+ import { BaseTexture } from "../../Materials/Textures/baseTexture.js";
8
+ /**
9
+ * WebXR Feature for WebXR raw camera access
10
+ * @since 6.31.0
11
+ * @see https://immersive-web.github.io/raw-camera-access/
12
+ */
13
+ export class WebXRRawCameraAccess extends WebXRAbstractFeature {
14
+ /**
15
+ * Creates a new instance of the feature
16
+ * @param _xrSessionManager the WebXRSessionManager
17
+ * @param options options for the Feature
18
+ */
19
+ constructor(_xrSessionManager, options = {}) {
20
+ super(_xrSessionManager);
21
+ this.options = options;
22
+ this._cachedInternalTextures = [];
23
+ /**
24
+ * This is an array of camera views
25
+ * Note that mostly the array will contain a single view
26
+ * If you want to know the order of the views, use the `viewIndex` array
27
+ */
28
+ this.texturesData = [];
29
+ /**
30
+ * If needed, this array will contain the eye definition of each texture in `texturesArray`
31
+ */
32
+ this.viewIndex = [];
33
+ /**
34
+ * If needed, this array will contain the camera's intrinsics
35
+ * You can use this data to convert from camera space to screen space and vice versa
36
+ */
37
+ this.cameraIntrinsics = [];
38
+ /**
39
+ * An observable that will notify when the camera's textures are updated
40
+ */
41
+ this.onTexturesUpdatedObservable = new Observable();
42
+ this.xrNativeFeatureName = "camera-access";
43
+ }
44
+ attach(force) {
45
+ if (!super.attach(force)) {
46
+ return false;
47
+ }
48
+ this._glContext = this._xrSessionManager.scene.getEngine()._gl;
49
+ this._glBinding = new XRWebGLBinding(this._xrSessionManager.session, this._glContext);
50
+ return true;
51
+ }
52
+ detach() {
53
+ if (!super.detach()) {
54
+ return false;
55
+ }
56
+ this._glBinding = undefined;
57
+ if (!this.options.doNotDisposeOnDetach) {
58
+ this._cachedInternalTextures.forEach((t) => t.dispose());
59
+ this.texturesData.forEach((t) => t.dispose());
60
+ this._cachedInternalTextures.length = 0;
61
+ this.texturesData.length = 0;
62
+ this.cameraIntrinsics.length = 0;
63
+ }
64
+ return true;
65
+ }
66
+ /**
67
+ * Dispose this feature and all of the resources attached
68
+ */
69
+ dispose() {
70
+ super.dispose();
71
+ this.onTexturesUpdatedObservable.clear();
72
+ }
73
+ /**
74
+ * @see https://github.com/immersive-web/raw-camera-access/blob/main/explainer.md
75
+ */
76
+ _updateCameraIntrinsics(view, index) {
77
+ const cameraViewport = {
78
+ width: view.camera.width,
79
+ height: view.camera.height,
80
+ x: 0,
81
+ y: 0,
82
+ };
83
+ const p = view.projectionMatrix;
84
+ // Principal point in pixels (typically at or near the center of the viewport)
85
+ const u0 = ((1 - p[8]) * cameraViewport.width) / 2 + cameraViewport.x;
86
+ const v0 = ((1 - p[9]) * cameraViewport.height) / 2 + cameraViewport.y;
87
+ // Focal lengths in pixels (these are equal for square pixels)
88
+ const ax = (cameraViewport.width / 2) * p[0];
89
+ const ay = (cameraViewport.height / 2) * p[5];
90
+ // Skew factor in pixels (nonzero for rhomboid pixels)
91
+ const gamma = (cameraViewport.width / 2) * p[4];
92
+ this.cameraIntrinsics[index] = {
93
+ u0,
94
+ v0,
95
+ ax,
96
+ ay,
97
+ gamma,
98
+ width: cameraViewport.width,
99
+ height: cameraViewport.height,
100
+ viewportX: cameraViewport.x,
101
+ viewportY: cameraViewport.y,
102
+ };
103
+ }
104
+ _updateInternalTextures(view, index = 0) {
105
+ var _a, _b;
106
+ if (!view.camera) {
107
+ return false;
108
+ }
109
+ this.viewIndex[index] = view.eye;
110
+ const lp = (_a = this._glBinding) === null || _a === void 0 ? void 0 : _a.getCameraImage(view.camera);
111
+ if (!this._cachedInternalTextures[index]) {
112
+ const internalTexture = new InternalTexture(this._xrSessionManager.scene.getEngine(), InternalTextureSource.Unknown, true);
113
+ internalTexture.isCube = true;
114
+ internalTexture.invertY = false;
115
+ // internalTexture._useSRGBBuffer = this.options.reflectionFormat === "srgba8";
116
+ internalTexture.format = 5;
117
+ internalTexture.generateMipMaps = true;
118
+ internalTexture.type = 1;
119
+ internalTexture.samplingMode = 3;
120
+ internalTexture.width = view.camera.width;
121
+ internalTexture.height = view.camera.height;
122
+ internalTexture._cachedWrapU = 1;
123
+ internalTexture._cachedWrapV = 1;
124
+ internalTexture._hardwareTexture = new WebGLHardwareTexture(lp, this._glContext);
125
+ this._cachedInternalTextures[index] = internalTexture;
126
+ // create the base texture
127
+ const texture = new BaseTexture(this._xrSessionManager.scene);
128
+ texture.name = `WebXR Raw Camera Access (${index})`;
129
+ texture._texture = this._cachedInternalTextures[index];
130
+ this.texturesData[index] = texture;
131
+ // get the camera intrinsics
132
+ this._updateCameraIntrinsics(view, index);
133
+ }
134
+ else {
135
+ // make sure the webgl texture is updated. Should happen automatically
136
+ (_b = this._cachedInternalTextures[index]._hardwareTexture) === null || _b === void 0 ? void 0 : _b.set(lp);
137
+ }
138
+ this._cachedInternalTextures[index].isReady = true;
139
+ return true;
140
+ }
141
+ _onXRFrame(_xrFrame) {
142
+ const referenceSPace = this._xrSessionManager.referenceSpace;
143
+ const pose = _xrFrame.getViewerPose(referenceSPace);
144
+ if (!pose || !pose.views) {
145
+ return;
146
+ }
147
+ let updated = true;
148
+ pose.views.forEach((view, index) => {
149
+ updated = updated && this._updateInternalTextures(view, index);
150
+ });
151
+ if (updated) {
152
+ this.onTexturesUpdatedObservable.notifyObservers(this.texturesData);
153
+ }
154
+ }
155
+ }
156
+ /**
157
+ * The module's name
158
+ */
159
+ WebXRRawCameraAccess.Name = WebXRFeatureName.RAW_CAMERA_ACCESS;
160
+ /**
161
+ * The (Babylon) version of this module.
162
+ * This is an integer representing the implementation version.
163
+ * This number does not correspond to the WebXR specs version
164
+ */
165
+ WebXRRawCameraAccess.Version = 1;
166
+ WebXRFeaturesManager.AddWebXRFeature(WebXRRawCameraAccess.Name, (xrSessionManager, options) => {
167
+ return () => new WebXRRawCameraAccess(xrSessionManager, options);
168
+ }, WebXRRawCameraAccess.Version, false);
169
+ //# sourceMappingURL=WebXRRawCameraAccess.js.map
@@ -0,0 +1 @@
1
+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AAC,KAAK,CAAC,CAAC,gBAAgB,0CAAE,GAAG,CAAC,EAAE,CAAC,CAAC;SACjE;QACD,IAAI,CAAC,uBAAuB,CAAC,KAAK,CAAC,CAAC,OAAO,GAAG,IAAI,CAAC;QACnD,OAAO,IAAI,CAAC;IAChB,CAAC;IAES,UAAU,CAAC,QAAiB;QAClC,MAAM,cAAc,GAAG,IAAI,CAAC,iBAAiB,CAAC,cAAc,CAAC;QAE7D,MAAM,IAAI,GAAG,QAAQ,CAAC,aAAa,CAAC,cAAc,CAAC,CAAC;QACpD,IAAI,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE;YACtB,OAAO;SACV;QACD,IAAI,OAAO,GAAG,IAAI,CAAC;QACnB,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE;YAC/B,OAAO,GAAG,OAAO,IAAI,IAAI,CAAC,uBAAuB,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;QACnE,CAAC,CAAC,CAAC;QACH,IAAI,OAAO,EAAE;YACT,IAAI,CAAC,2BAA2B,CAAC,eAAe,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;SACvE;IACL,CAAC;;AAjJD;;GAEG;AACoB,yBAAI,GAAG,gBAAgB,CAAC,iBAAiB,AAArC,CAAsC;AAEjE;;;;GAIG;AACoB,4BAAO,GAAG,CAAC,AAAJ,CAAK;AA0IvC,oBAAoB,CAAC,eAAe,CAChC,oBAAoB,CAAC,IAAI,EACzB,CAAC,gBAAgB,EAAE,OAAO,EAAE,EAAE;IAC1B,OAAO,GAAG,EAAE,CAAC,IAAI,oBAAoB,CAAC,gBAAgB,EAAE,OAAO,CAAC,CAAC;AACrE,CAAC,EACD,oBAAoB,CAAC,OAAO,EAC5B,KAAK,CACR,CAAC","sourcesContent":["import { WebXRFeatureName, WebXRFeaturesManager } from \"../webXRFeaturesManager\";\nimport type { WebXRSessionManager } from \"../webXRSessionManager\";\nimport { WebXRAbstractFeature } from \"./WebXRAbstractFeature\";\nimport { Observable } from \"../../Misc/observable\";\nimport { Constants } from \"../../Engines/constants\";\nimport { WebGLHardwareTexture } from \"../../Engines/WebGL/webGLHardwareTexture\";\nimport { InternalTexture, InternalTextureSource } from \"../../Materials/Textures/internalTexture\";\nimport { BaseTexture } from \"core/Materials/Textures/baseTexture\";\n\n/**\n * Options for raw camera access\n */\nexport interface IWebXRRawCameraAccessOptions {\n /**\n * Keep the created textures and metadata when detaching the feature.\n */\n doNotDisposeOnDetach?: boolean;\n}\n\n/**\n * WebXR Feature for WebXR raw camera access\n * @since 6.31.0\n * @see https://immersive-web.github.io/raw-camera-access/\n */\nexport class WebXRRawCameraAccess extends WebXRAbstractFeature {\n private _cachedInternalTextures: InternalTexture[] = [];\n /**\n * This is an array of camera views\n * Note that mostly the array will contain a single view\n * If you want to know the order of the views, use the `viewIndex` array\n */\n public texturesData: BaseTexture[] = [];\n /**\n * If needed, this array will contain the eye definition of each texture in `texturesArray`\n */\n public viewIndex: string[] = [];\n\n /**\n * If needed, this array will contain the camera's intrinsics\n * You can use this data to convert from camera space to screen space and vice versa\n */\n public cameraIntrinsics: {\n u0: number;\n v0: number;\n ax: number;\n ay: number;\n gamma: number;\n width: number;\n height: number;\n viewportX: number;\n viewportY: number;\n }[] = [];\n\n /**\n * An observable that will notify when the camera's textures are updated\n */\n public onTexturesUpdatedObservable: Observable<BaseTexture[]> = new Observable();\n\n private _glBinding?: XRWebGLBinding;\n private _glContext: WebGLRenderingContext;\n\n /**\n * The module's name\n */\n public static readonly Name = WebXRFeatureName.RAW_CAMERA_ACCESS;\n\n /**\n * The (Babylon) version of this module.\n * This is an integer representing the implementation version.\n * This number does not correspond to the WebXR specs version\n */\n public static readonly Version = 1;\n\n /**\n * Creates a new instance of the feature\n * @param _xrSessionManager the WebXRSessionManager\n * @param options options for the Feature\n */\n constructor(\n _xrSessionManager: WebXRSessionManager,\n public readonly options: IWebXRRawCameraAccessOptions = {}\n ) {\n super(_xrSessionManager);\n this.xrNativeFeatureName = \"camera-access\";\n }\n\n public attach(force?: boolean | undefined): boolean {\n if (!super.attach(force)) {\n return false;\n }\n\n this._glContext = this._xrSessionManager.scene.getEngine()._gl;\n this._glBinding = new XRWebGLBinding(this._xrSessionManager.session, this._glContext);\n\n return true;\n }\n\n public detach(): boolean {\n if (!super.detach()) {\n return false;\n }\n this._glBinding = undefined;\n if (!this.options.doNotDisposeOnDetach) {\n this._cachedInternalTextures.forEach((t) => t.dispose());\n this.texturesData.forEach((t) => t.dispose());\n this._cachedInternalTextures.length = 0;\n this.texturesData.length = 0;\n this.cameraIntrinsics.length = 0;\n }\n return true;\n }\n\n /**\n * Dispose this feature and all of the resources attached\n */\n public dispose(): void {\n super.dispose();\n this.onTexturesUpdatedObservable.clear();\n }\n\n /**\n * @see https://github.com/immersive-web/raw-camera-access/blob/main/explainer.md\n */\n private _updateCameraIntrinsics(view: XRView, index: number): void {\n const cameraViewport = {\n width: view.camera!.width,\n height: view.camera!.height,\n x: 0,\n y: 0,\n };\n const p = view.projectionMatrix;\n\n // Principal point in pixels (typically at or near the center of the viewport)\n const u0 = ((1 - p[8]) * cameraViewport.width) / 2 + cameraViewport.x;\n const v0 = ((1 - p[9]) * cameraViewport.height) / 2 + cameraViewport.y;\n\n // Focal lengths in pixels (these are equal for square pixels)\n const ax = (cameraViewport.width / 2) * p[0];\n const ay = (cameraViewport.height / 2) * p[5];\n\n // Skew factor in pixels (nonzero for rhomboid pixels)\n const gamma = (cameraViewport.width / 2) * p[4];\n this.cameraIntrinsics[index] = {\n u0,\n v0,\n ax,\n ay,\n gamma,\n width: cameraViewport.width,\n height: cameraViewport.height,\n viewportX: cameraViewport.x,\n viewportY: cameraViewport.y,\n };\n }\n\n private _updateInternalTextures(view: XRView, index = 0): boolean {\n if (!view.camera) {\n return false;\n }\n this.viewIndex[index] = view.eye;\n const lp = this._glBinding?.getCameraImage(view.camera);\n\n if (!this._cachedInternalTextures[index]) {\n const internalTexture = new InternalTexture(this._xrSessionManager.scene.getEngine(), InternalTextureSource.Unknown, true);\n internalTexture.isCube = true;\n internalTexture.invertY = false;\n // internalTexture._useSRGBBuffer = this.options.reflectionFormat === \"srgba8\";\n internalTexture.format = Constants.TEXTUREFORMAT_RGBA;\n internalTexture.generateMipMaps = true;\n internalTexture.type = Constants.TEXTURETYPE_FLOAT;\n internalTexture.samplingMode = Constants.TEXTURE_LINEAR_LINEAR_MIPLINEAR;\n internalTexture.width = view.camera.width;\n internalTexture.height = view.camera.height;\n internalTexture._cachedWrapU = Constants.TEXTURE_WRAP_ADDRESSMODE;\n internalTexture._cachedWrapV = Constants.TEXTURE_WRAP_ADDRESSMODE;\n internalTexture._hardwareTexture = new WebGLHardwareTexture(lp, this._glContext);\n this._cachedInternalTextures[index] = internalTexture;\n // create the base texture\n const texture = new BaseTexture(this._xrSessionManager.scene);\n texture.name = `WebXR Raw Camera Access (${index})`;\n texture._texture = this._cachedInternalTextures[index];\n this.texturesData[index] = texture;\n // get the camera intrinsics\n this._updateCameraIntrinsics(view, index);\n } else {\n // make sure the webgl texture is updated. Should happen automatically\n this._cachedInternalTextures[index]._hardwareTexture?.set(lp);\n }\n this._cachedInternalTextures[index].isReady = true;\n return true;\n }\n\n protected _onXRFrame(_xrFrame: XRFrame): void {\n const referenceSPace = this._xrSessionManager.referenceSpace;\n\n const pose = _xrFrame.getViewerPose(referenceSPace);\n if (!pose || !pose.views) {\n return;\n }\n let updated = true;\n pose.views.forEach((view, index) => {\n updated = updated && this._updateInternalTextures(view, index);\n });\n if (updated) {\n this.onTexturesUpdatedObservable.notifyObservers(this.texturesData);\n }\n }\n}\n\nWebXRFeaturesManager.AddWebXRFeature(\n WebXRRawCameraAccess.Name,\n (xrSessionManager, options) => {\n return () => new WebXRRawCameraAccess(xrSessionManager, options);\n },\n WebXRRawCameraAccess.Version,\n false\n);\n"]}
@@ -20,3 +20,4 @@ export * from "./WebXRWalkingLocomotion";
20
20
  export * from "./WebXRLayers";
21
21
  export * from "./WebXRDepthSensing";
22
22
  export * from "./WebXRSpaceWarp";
23
+ export * from "./WebXRRawCameraAccess";
@@ -20,4 +20,5 @@ export * from "./WebXRWalkingLocomotion.js";
20
20
  export * from "./WebXRLayers.js";
21
21
  export * from "./WebXRDepthSensing.js";
22
22
  export * from "./WebXRSpaceWarp.js";
23
+ export * from "./WebXRRawCameraAccess.js";
23
24
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../dev/core/src/XR/features/index.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAC;AACvC,cAAc,sBAAsB,CAAC;AACrC,cAAc,qBAAqB,CAAC;AACpC,cAAc,sBAAsB,CAAC;AACrC,cAAc,0BAA0B,CAAC;AACzC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,mCAAmC,CAAC;AAClD,cAAc,0BAA0B,CAAC;AACzC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,2BAA2B,CAAC;AAC1C,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,sBAAsB,CAAC;AACrC,cAAc,wBAAwB,CAAC;AACvC,cAAc,mBAAmB,CAAC;AAClC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,wBAAwB,CAAC;AACvC,cAAc,oBAAoB,CAAC;AACnC,cAAc,0BAA0B,CAAC;AACzC,cAAc,eAAe,CAAC;AAC9B,cAAc,qBAAqB,CAAC;AACpC,cAAc,kBAAkB,CAAC","sourcesContent":["export * from \"./WebXRAbstractFeature\";\r\nexport * from \"./WebXRHitTestLegacy\";\r\nexport * from \"./WebXRAnchorSystem\";\r\nexport * from \"./WebXRPlaneDetector\";\r\nexport * from \"./WebXRBackgroundRemover\";\r\nexport * from \"./WebXRControllerTeleportation\";\r\nexport * from \"./WebXRControllerPointerSelection\";\r\nexport * from \"./WebXRControllerPhysics\";\r\nexport * from \"./WebXRHitTest\";\r\nexport * from \"./WebXRFeaturePointSystem\";\r\nexport * from \"./WebXRHandTracking\";\r\nexport * from \"./WebXRMeshDetector\";\r\nexport * from \"./WebXRImageTracking\";\r\nexport * from \"./WebXRNearInteraction\";\r\nexport * from \"./WebXRDOMOverlay\";\r\nexport * from \"./WebXRControllerMovement\";\r\nexport * from \"./WebXRLightEstimation\";\r\nexport * from \"./WebXREyeTracking\";\r\nexport * from \"./WebXRWalkingLocomotion\";\r\nexport * from \"./WebXRLayers\";\r\nexport * from \"./WebXRDepthSensing\";\r\nexport * from \"./WebXRSpaceWarp\";\r\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../dev/core/src/XR/features/index.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAC;AACvC,cAAc,sBAAsB,CAAC;AACrC,cAAc,qBAAqB,CAAC;AACpC,cAAc,sBAAsB,CAAC;AACrC,cAAc,0BAA0B,CAAC;AACzC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,mCAAmC,CAAC;AAClD,cAAc,0BAA0B,CAAC;AACzC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,2BAA2B,CAAC;AAC1C,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,sBAAsB,CAAC;AACrC,cAAc,wBAAwB,CAAC;AACvC,cAAc,mBAAmB,CAAC;AAClC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,wBAAwB,CAAC;AACvC,cAAc,oBAAoB,CAAC;AACnC,cAAc,0BAA0B,CAAC;AACzC,cAAc,eAAe,CAAC;AAC9B,cAAc,qBAAqB,CAAC;AACpC,cAAc,kBAAkB,CAAC;AACjC,cAAc,wBAAwB,CAAC","sourcesContent":["export * from \"./WebXRAbstractFeature\";\r\nexport * from \"./WebXRHitTestLegacy\";\r\nexport * from \"./WebXRAnchorSystem\";\r\nexport * from \"./WebXRPlaneDetector\";\r\nexport * from \"./WebXRBackgroundRemover\";\r\nexport * from \"./WebXRControllerTeleportation\";\r\nexport * from \"./WebXRControllerPointerSelection\";\r\nexport * from \"./WebXRControllerPhysics\";\r\nexport * from \"./WebXRHitTest\";\r\nexport * from \"./WebXRFeaturePointSystem\";\r\nexport * from \"./WebXRHandTracking\";\r\nexport * from \"./WebXRMeshDetector\";\r\nexport * from \"./WebXRImageTracking\";\r\nexport * from \"./WebXRNearInteraction\";\r\nexport * from \"./WebXRDOMOverlay\";\r\nexport * from \"./WebXRControllerMovement\";\r\nexport * from \"./WebXRLightEstimation\";\r\nexport * from \"./WebXREyeTracking\";\r\nexport * from \"./WebXRWalkingLocomotion\";\r\nexport * from \"./WebXRLayers\";\r\nexport * from \"./WebXRDepthSensing\";\r\nexport * from \"./WebXRSpaceWarp\";\r\nexport * from \"./WebXRRawCameraAccess\";\r\n"]}
@@ -1,5 +1,6 @@
1
1
  import type { WebXRSessionManager } from "./webXRSessionManager";
2
2
  import type { IDisposable } from "../scene";
3
+ import type { Observable } from "../Misc/observable.js";
3
4
  /**
4
5
  * Defining the interface required for a (webxr) feature
5
6
  */
@@ -50,6 +51,14 @@ export interface IWebXRFeature extends IDisposable {
50
51
  * If this feature requires to extend the XRSessionInit object, this function will return the partial XR session init object
51
52
  */
52
53
  getXRSessionInitExtension?: () => Promise<Partial<XRSessionInit>>;
54
+ /**
55
+ * Triggered when the feature is attached
56
+ */
57
+ onFeatureAttachObservable: Observable<IWebXRFeature>;
58
+ /**
59
+ * Triggered when the feature is detached
60
+ */
61
+ onFeatureDetachObservable: Observable<IWebXRFeature>;
53
62
  }
54
63
  /**
55
64
  * A list of the currently available features without referencing them
@@ -135,6 +144,10 @@ export declare class WebXRFeatureName {
135
144
  * The name of the WebXR Space Warp feature
136
145
  */
137
146
  static readonly SPACE_WARP = "xr-space-warp";
147
+ /**
148
+ * The name of the WebXR Raw Camera Access feature
149
+ */
150
+ static readonly RAW_CAMERA_ACCESS = "xr-raw-camera-access";
138
151
  }
139
152
  /**
140
153
  * Defining the constructor of a feature. Used to register the modules.
@@ -84,6 +84,10 @@ WebXRFeatureName.DEPTH_SENSING = "xr-depth-sensing";
84
84
  * The name of the WebXR Space Warp feature
85
85
  */
86
86
  WebXRFeatureName.SPACE_WARP = "xr-space-warp";
87
+ /**
88
+ * The name of the WebXR Raw Camera Access feature
89
+ */
90
+ WebXRFeatureName.RAW_CAMERA_ACCESS = "xr-raw-camera-access";
87
91
  /**
88
92
  * The WebXR features manager is responsible of enabling or disabling features required for the current XR session.
89
93
  * It is mainly used in AR sessions.