草案
此页面不完整。
安全上下文
此特征只可用于
安全上下文
(HTTPS),在某些或所有
支持浏览器
.
updateRenderState()
方法在
XRSession
interface of
WebXR API
schedules changes to be applied to the active render state prior to rendering of the next frame.
xrSession.updateRenderState(newState)
newState
XRRenderStateInit
dictionary specifying the properties of the session's
renderState
to update before rendering the next frame.
The specified object may have any combination of the following fields.
baseLayer
可选
XRWebGLLayer
object from which the WebXR compositor will obtain imagery. This is
null
在默认情况下。
depthFar
可选
depthNear
and
depthFar
. This is 1000 meters (1 kilometer) by default.
depthNear
可选
inlineVerticalFieldOfView
可选
inline
XRSession
. The projection matrix calculation also takes into account the output canvas's aspect ratio. This property
不必
be specified for immersive sessions, so the value is
null
by default for immersive sessions. The default value is otherwise π * 0.5 (half of the value of pi).
None.
This method may throw any of the following exceptions. These are true exceptions, since this method does not return a promise.
InvalidStateError
This may occur for one of the following reasons:
XRSession
has already ended, so you cannot change its render state.
baseLayer
specified in
newState
was created by an
XRSession
other than the one on which
updateRenderState()
被调用。
inlineVerticalFieldOfView
property was set, but the session is immersive and therefore does not allow this property to be used.
This example creates a WebGL context that is compatible with an immersive XR device and then uses it to create an
XRWebGLLayer
.
updateRenderState()
is then called to associate the new
XRWebGLLayer
.
function onXRSessionStarted(xrSession) {
let glCanvas = document.createElement("canvas");
let gl = glCanvas.getContext("webgl", { xrCompatible: true });
loadWebGLResources();
xrSession.updateRenderState({ baseLayer: new XRWebGLLayer(xrSession, gl) });
}
| 规范 | 状态 | 注释 |
|---|---|---|
|
WebXR 设备 API
The definition of 'XRSession.updateRenderState()' in that specification. |
工作草案 | 初始定义。 |
| 桌面 | 移动 | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
updateRenderState()
|
Chrome 79 | Edge 79 | Firefox 不支持 No | IE 不支持 No | Opera 不支持 No | Safari 不支持 No | WebView Android 不支持 No | Chrome Android 79 | Firefox Android 不支持 No | Opera Android 不支持 No | Safari iOS 不支持 No | Samsung Internet Android 11.2 |
完整支持
不支持
XRSession
cancelAnimationFrame()
end()
requestAnimationFrame()
requestReferenceSpace()
updateRenderState()
Navigator.xr
WebGLRenderingContext.makeXRCompatible()
XR
XRBoundedReferenceSpace
XRFrame
XRInputSource
XRInputSourceArray
XRInputSourceEvent
XRInputSourcesChangeEvent
XRPose
XRReferenceSpace
XRReferenceSpaceEvent
XRRenderState
XRRigidTransform
XRSessionEvent
XRSpace
XRView
XRViewerPose
XRViewport
XRWebGLLayer