Capítulo 818 de 859
The minimal setup for a WebXR VR app in three.js: add VRButton, enable XR on the renderer, and drive the render loop with renderer.setAnimationLoop instead of requestAnimationFrame.
VRButton.createButton(): from the examples/addons, adds a button that both signals VR support and starts a VR session when clicked.renderer.xr.enabled = true: turns on XR rendering on a WebGLRenderer.renderer.setAnimationLoop(): replaces a manual window.requestAnimationFrame loop, since an active XR session drives its own frame timing.renderer.setAnimationLoop(function () {
renderer.render(scene, camera);
});
setAnimationLoop instead of requestAnimationFrame.VRButton.createButton() handles both the VR entry-point UI and starting the session in one call.renderer.xr.enabled = true before rendering VR content.renderer.setAnimationLoop() for their render loop, not a manual requestAnimationFrame call..xr namespace and setAnimationLoop.