Skip to content

Commit 84f88dd

Browse files
Mugen87RuthySheffi
authored andcommitted
XRManager: Improve docs. (mrdoob#31101)
1 parent fca1f1d commit 84f88dd

File tree

1 file changed

+39
-2
lines changed

1 file changed

+39
-2
lines changed

src/renderers/common/XRManager.js

Lines changed: 39 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -596,7 +596,22 @@ class XRManager extends EventDispatcher {
596596

597597
}
598598

599-
createQuadLayer( width, height, translation, quaternion, pixelwidth, pixelheight, rendercall, attributes = [] ) {
599+
/**
600+
* This method can be used in XR applications to create a quadratic layer that presents a separate
601+
* rendered scene.
602+
*
603+
* @param {number} width - The width of the layer plane in world units.
604+
* @param {number} height - The height of the layer plane in world units.
605+
* @param {Vector3} translation - The position/translation of the layer plane in world units.
606+
* @param {Quaternion} quaternion - The orientation of the layer plane expressed as a quaternion.
607+
* @param {number} pixelwidth - The width of the layer's render target in pixels.
608+
* @param {number} pixelheight - The height of the layer's render target in pixels.
609+
* @param {Function} rendercall - A callback function that renders the layer. Similar to code in
610+
* the default animation loop, this method can be used to update/transform 3D object in the layer's scene.
611+
* @param {Object} [attributes={}] - Allows to configure the layer's render target.
612+
* @return {Mesh} A mesh representing the quadratic XR layer. This mesh should be added to the XR scene.
613+
*/
614+
createQuadLayer( width, height, translation, quaternion, pixelwidth, pixelheight, rendercall, attributes = {} ) {
600615

601616
const geometry = new PlaneGeometry( width, height );
602617
const renderTarget = new XRRenderTarget(
@@ -669,7 +684,23 @@ class XRManager extends EventDispatcher {
669684

670685
}
671686

672-
createCylinderLayer( radius, centralAngle, aspectratio, translation, quaternion, pixelwidth, pixelheight, rendercall, attributes = [] ) {
687+
/**
688+
* This method can be used in XR applications to create a cylindrical layer that presents a separate
689+
* rendered scene.
690+
*
691+
* @param {number} radius - The radius of the cylinder in world units.
692+
* @param {number} centralAngle - The central angle of the cylinder in radians.
693+
* @param {number} aspectratio - The aspect ratio.
694+
* @param {Vector3} translation - The position/translation of the layer plane in world units.
695+
* @param {Quaternion} quaternion - The orientation of the layer plane expressed as a quaternion.
696+
* @param {number} pixelwidth - The width of the layer's render target in pixels.
697+
* @param {number} pixelheight - The height of the layer's render target in pixels.
698+
* @param {Function} rendercall - A callback function that renders the layer. Similar to code in
699+
* the default animation loop, this method can be used to update/transform 3D object in the layer's scene.
700+
* @param {Object} [attributes={}] - Allows to configure the layer's render target.
701+
* @return {Mesh} A mesh representing the cylindrical XR layer. This mesh should be added to the XR scene.
702+
*/
703+
createCylinderLayer( radius, centralAngle, aspectratio, translation, quaternion, pixelwidth, pixelheight, rendercall, attributes = {} ) {
673704

674705
const geometry = new CylinderGeometry( radius, radius, radius * centralAngle / aspectratio, 64, 64, true, Math.PI - centralAngle / 2, centralAngle );
675706
const renderTarget = new XRRenderTarget(
@@ -743,6 +774,12 @@ class XRManager extends EventDispatcher {
743774

744775
}
745776

777+
/**
778+
* Renders the XR layers that have been previously added to the scene.
779+
*
780+
* This method is usually called in your animation loop before rendering
781+
* the actual scene via `renderer.render( scene, camera );`.
782+
*/
746783
renderLayers( ) {
747784

748785
const translationObject = new Vector3();

0 commit comments

Comments
 (0)