Class XRView
- Namespace
- CSharpToJavaScript.APIs.JS
- Assembly
- CSharpToJavaScript.dll
NOTE
ExperimentalXRView interface describes a single view into the XR scene for a specific frame, providing orientation and position information for the viewpoint. You can think of it as a description of a specific eye or camera and how it views the world. A 3D frame will involve two views, one for each eye, separated by an appropriate distance which approximates the distance between the viewer's eyes. This allows the two views, when projected in isolation into the appropriate eyes, to simulate a 3D world.
[Value("XRView")]
public class XRView
- Inheritance
-
XRView
- Inherited Members
Remarks
Constructors
XRView()
public XRView()
Properties
Camera
[Value("camera")]
public XRCamera? Camera { get; }
Property Value
Eye
NOTE
Experimentaleyeproperty is a string indicating which eye's viewpoint the
XRView represents: left orright. For views which represent neither eye, such as monoscopic views,this property's value is
none.
[Value("eye")]
public XREye Eye { get; }
Property Value
- XREye
A string that can be one of the following values:
Remarks
IsFirstPersonObserver
NOTE
ExperimentalisFirstPersonObserver property is a boolean indicating if the XRView is a first-person observer view.
[Value("isFirstPersonObserver")]
public bool IsFirstPersonObserver { get; }
Property Value
Remarks
To create video recordings of AR device cameras, you can't simply use one of the rendered eyes, as there often will be a physical offset. Some devices expose a secondary view, the first-person observer view, which has an eye of none.
To receive a first-person observer view, you need to enable the "secondary-views" feature descriptor explicitly (typically as an optional feature). See RequestSession(XRSessionMode, XRSessionInit) for details.
The isFirstPersonObserver property then allows you to check which secondary view is a first-person observer view.
ProjectionMatrix
NOTE
ExperimentalprojectionMatrix property specifies the projection matrixto apply to the underlying view. This should be used to integrate perspective to
everything in the scene, in order to ensure the result is consistent with what the eye
expects to see.
[Value("projectionMatrix")]
public Float32Array ProjectionMatrix { get; }
Property Value
- Float32Array
A Float32Array object representing the projection matrix for the view.
The projection matrix for each eye's view is used to ensure that the correct area of the
scene is presented to each eye in order to create a believable 3D scene without
introducing discomfort for the user.
Remarks
NOTE
Failure to apply proper perspective, or inconsistencies
in perspective, may result in possibly serious user discomfort or distress.
RecommendedViewportScale
NOTE
ExperimentalrecommendedViewportScale property of the XRView interface is the recommended viewport scale value that you can use for RequestViewportScale(Number?) if the user agent has such a recommendation; null otherwise.
[Value("recommendedViewportScale")]
public Number? RecommendedViewportScale { get; }
Property Value
- Number
A number greater than 0.0 and less than or equal to 1.0; or
nullif the user agent does not provide a recommended scale.
Remarks
Transform
NOTE
Experimentaltransform property of theXRView interface is an XRRigidTransform object which
provides the position and orientation of the viewpoint relative to the
XRReferenceSpace specified when the
GetViewerPose(XRReferenceSpace) method was called to obtain the view object.
[Value("transform")]
public XRRigidTransform Transform { get; }
Property Value
- XRRigidTransform
A XRRigidTransform object specifying the position and orientation of the
viewpoint represented by theXRView.
Remarks
With the transform, you can then position the view as a camera within the
3D scene. If you instead need the more traditional view matrix, you can get usingview.transform.inverse.matrix; this gets the underlying
Matrix of the transform's
Inverse.
Methods
RequestViewportScale(Number?)
NOTE
ExperimentalrequestViewportScale() method of the XRView interface requests that the user agent sets the requested viewport scale for this viewport to the given value. This is used for dynamic viewport scaling which allows rendering to a subset of the WebXR viewport using a scale factor that can be changed every animation frame.
[Value("requestViewportScale")]
public GlobalObject.Undefined RequestViewportScale(Number? scale)
Parameters
scaleNumber