Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
afterUpdate() {
// Disable pointer events on the onscreen canvas when in an immersive XR session
this._togglePointerListeners(!this._isImmersive())
super.afterUpdate()
const {xrSession, _threeRenderer:renderer} = this
const prevXrSession = _xrSessions.get(this)
if (xrSession !== prevXrSession) {
_xrSessions.set(this, xrSession)
this.renderingScheduler = xrSession || window
setAnimationScheduler(xrSession || window)
if (xrSession) {
let baseLayer = xrSession.renderState.baseLayer
const gl = renderer.getContext()
// If the session has an existing valid XRWebGLLayer, just grab its framebuffer.
// Otherwise, create a new XRWebGLLayer
if (baseLayer && baseLayer._glContext === gl) {
renderer.setFramebuffer(baseLayer.framebuffer)
} else {
const promise = gl.makeXRCompatible ? gl.makeXRCompatible() : Promise.resolve() //not always implemented?
promise.then(() => {
if (this.xrSession === xrSession) {
baseLayer = new XRWebGLLayer(xrSession, gl, {
antialias: !!renderer.getContextAttributes().antialias
})
baseLayer._glContext = gl
afterUpdate() {
// Disable pointer events on the onscreen canvas when in VR
const vrDisplay = this._isInVR() ? this.vrDisplay : null
this._togglePointerListeners(!vrDisplay)
// Update the animation scheduler
if (vrDisplay !== this._lastVrDisplay) {
this._lastVrDisplay = vrDisplay
this.renderingScheduler = vrDisplay || window
setAnimationScheduler(vrDisplay || window)
}
super.afterUpdate()
}