Просмотр исходного кода

Docs: Update WebXRManager methods (#31657)

* Docs: missing WebXRManager methods -> old docs

* Docs: WebXRManager JSDoc fixes/clarifications

* Update docs/api/en/renderers/webxr/WebXRManager.html

Co-authored-by: Vincent Fretin <vincent.fretin@gmail.com>

* Update docs/api/en/renderers/webxr/WebXRManager.html

Co-authored-by: Vincent Fretin <vincent.fretin@gmail.com>

---------

Co-authored-by: Vincent Fretin <vincent.fretin@gmail.com>
harryhjsh 5 месяцев назад
Родитель
Сommit
deb748d091
2 измененных файлов с 61 добавлено и 1 удалено
  1. 53 0
      docs/api/en/renderers/webxr/WebXRManager.html
  2. 8 1
      src/renderers/webxr/WebXRManager.js

+ 53 - 0
docs/api/en/renderers/webxr/WebXRManager.html

@@ -37,6 +37,24 @@
 		</p>
 
 		<h2>Methods</h2>
+		
+		<h3>[method:XRWebGLLayer getBaseLayer]()</h3>
+		<p>
+			Returns the current base layer. This is an 
+			[link:https://developer.mozilla.org/en-US/docs/Web/API/XRProjectionLayer XRProjectionLayer]
+			when the targeted XR device supports the
+			[link:https://www.w3.org/TR/webxrlayers-1/ WebXR Layers API], or an
+			[link:https://developer.mozilla.org/en-US/docs/Web/API/XRWebGLLayer XRWebGLLayer]
+			if it doesn't.
+		</p>
+
+		<h3>[method:XRWebGLBinding getBinding]()</h3>
+		<p>
+			Returns the current 
+			[link:https://developer.mozilla.org/en-US/docs/Web/API/XRWebGLBinding XRWebGLBinding].<br /><br />
+			
+			This method will create a new `XRWebGLBinding` if the browser is able to and one hasn't been created yet.
+		</p>
 
 		<h3>[method:ArrayCamera getCamera]()</h3>
 		<p>
@@ -50,6 +68,18 @@
 			manually from the XR camera's projection matrices.
 		</p>
 
+		<h3>[method:Texture getCameraTexture]( [param:XRCamera xrCamera] )</h3>
+		<p>
+			[page:XRCamera xrCamera] — The 
+			[link:https://immersive-web.github.io/raw-camera-access/#xr-camera-section XRCamera]
+			to query.<br /><br />
+
+			Returns an opaque texture from the queried `XRCamera`. 
+			Only available during the current animation loop.<br /><br />
+
+			See the [example:webxr_ar_camera_access webxr / ar / camera_access] example.
+		</p>
+
 		<h3>[method:Group getController]( [param:Integer index] )</h3>
 		<p>
 			[page:Integer index] — The index of the controller. <br /><br />
@@ -76,6 +106,18 @@
 			different groups in two different coordinate spaces for the same WebXR
 			controller.
 		</p>
+		
+		<h3>[method:Mesh getDepthSensingMesh]()</h3>
+		<p>
+			Returns a plane mesh that visualizes the depth sensing texture
+			if one is available, and `null` otherwise.
+		</p>
+
+		<h3>[method:ExternalTexture getDepthTexture]()</h3>
+		<p>
+			Returns a texture representing the computed depth of the
+			user's environment if available, and `null` otherwise.
+		</p>
 
 		<h3>[method:Float getFoveation]()</h3>
 		<p>
@@ -83,6 +125,12 @@
 			projection layer.
 		</p>
 
+		<h3>[method:XRFrame getFrame]()</h3>
+		<p>
+			Returns the current [link:https://developer.mozilla.org/en-US/docs/Web/API/XRFrame XRFrame].
+			Will return `null` if used without an ongoing XR session.
+		</p>
+
 		<h3>[method:Group getHand]( [param:Integer index] )</h3>
 		<p>
 			[page:Integer index] — The index of the controller. <br /><br />
@@ -101,6 +149,11 @@
 			of active WebXR sessions on application level.
 		</p>
 
+		<h3>[method:Boolean hasDepthSensing]()</h3>
+		<p>
+			Returns `true` if depth sensing data has been provided by the XR device.
+		</p>
+
 		<h3>[method:undefined setFoveation]( [param:Float foveation] )</h3>
 		<p>
 			[page:Float foveation] — The foveation to set.<br /><br />

+ 8 - 1
src/renderers/webxr/WebXRManager.js

@@ -331,6 +331,9 @@ class WebXRManager extends EventDispatcher {
 		/**
 		 * Returns the current base layer.
 		 *
+		 * This is an `XRProjectionLayer` when the targeted XR device supports the
+		 * WebXR Layers API, or an `XRWebGLLayer` otherwise.
+		 *
 		 * @return {?(XRWebGLLayer|XRProjectionLayer)} The XR base layer.
 		 */
 		this.getBaseLayer = function () {
@@ -533,6 +536,8 @@ class WebXRManager extends EventDispatcher {
 		/**
 		 * Returns the current depth texture computed via depth sensing.
 		 *
+		 * See {@link WebXRDepthSensing#getDepthTexture}.
+		 *
 		 * @return {?Texture} The depth texture.
 		 */
 		this.getDepthTexture = function () {
@@ -703,7 +708,7 @@ class WebXRManager extends EventDispatcher {
 
 		/**
 		 * Updates the state of the XR camera. Use this method on app level if you
-		 * set cameraAutoUpdate` to `false`. The method requires the non-XR
+		 * set `cameraAutoUpdate` to `false`. The method requires the non-XR
 		 * camera of the scene as a parameter. The passed in camera's transformation
 		 * is automatically adjusted to the position of the XR camera when calling
 		 * this method.
@@ -880,6 +885,8 @@ class WebXRManager extends EventDispatcher {
 		/**
 		 * Returns the depth sensing mesh.
 		 *
+		 * See {@link WebXRDepthSensing#getMesh}.
+		 *
 		 * @return {Mesh} The depth sensing mesh.
 		 */
 		this.getDepthSensingMesh = function () {

粤ICP备19079148号