Releases: pmndrs/xr
v4.1.2
What's Changed
- fix: unbundle for webpack tree-shaking, publish sourcemaps by @CodyJasonBennett in #170
Full Changelog: v4.1.1...v4.1.2
v4.1.1
What's Changed
- fix: disable JSX transform by @CodyJasonBennett in #169
Full Changelog: v4.1.0...v4.1.1
v4.1.0
What's Changed
- feat: de-duplicate intersections for select/squeeze event handlers, add
intersection
field by @saitonakamura in #165 - feat: add
onMove
event to Interactive and useInteraction by @saitonakamura in #166
Full Changelog: v4.0.1...v4.1.0
v4.0.1
What's Changed
- fix: wrap portals in fragment by @CodyJasonBennett in #162
Full Changelog: v4.0.0...v4.0.1
v4.0.0
What's Changed
- feat!: react 18 support by @saitonakamura in #131
- feat!: use ambient WebXR types from @types/three by @CodyJasonBennett in #140
- feat!: merge contexts into Zustand store, upstream src/webxr by @CodyJasonBennett in #143
- feat!: add option to hide rays on blur (show by default) by @CodyJasonBennett in #148
- feat!: make XREvent and XREventHandler generic by @CodyJasonBennett in #146
- feat: create AR/VR buttons in react, bypass context for session init by @CodyJasonBennett, @bbohlender in #142
- feat: add onSelectMissed and onSqueezeMissed interactions by @CodyJasonBennett in #150
- refactor: break up DefaultXRControllers, manage DefaultXRControllers and Hands in R3F by @CodyJasonBennett in #147
- refactor(useHitTest): subscribe to session, cleanup source init by @CodyJasonBennett in #149
- refactor: declaratively create controller models by @CodyJasonBennett in #153
- fix: rollup => vite, cleanup peer deps and use cjs target by @CodyJasonBennett in #134
- fix: downlevel transpile, use correct node exts by @CodyJasonBennett in #138
- fix(HandModel): fix circular reference on dispose by @CodyJasonBennett in #139
- fix(InteractionManager): don't pass stale state on filter by @CodyJasonBennett in #144
- fix: don't create matrices on useframe, re-use hitmatrix by @CodyJasonBennett in #145
- chore: fix markdown demo links for github by @rvdende in #137
Changes
This release adds support for React 18, R3F v8, and three r141.
useXRFrame => useFrame
useXRFrame
is removed in favor of R3F's useFrame
.
-useXRFrame((time: DOMHighResTimeStamp, frame: XRFrame) => ...)
+useFrame((state: RootState, delta: number, frame?: XRFrame) => ...)
R3F will pass an XRFrame
as the third argument while in a WebXR session (see R3F migration guide).
onSelectMissed and onSelectSqueezed interaction types
onSelectMissed
and onSqueezeMissed
are now supported in useInteraction
, and <Interactive />
components (see interactions).
This mirror's R3F's onPointerMissed
et al handlers.
Improved Ray visibility
DefaultXRControllers
rays are now shown by default and can be hidden on blur with the hideRaysOnBlur
prop. For <Rays />
, this would be hideOnBlur
.
This is more inline with menu ray representations and examples like https://threejs.org/examples/#webxr_vr_dragging.
Streamlined event types
XREvent
is now generic, and can wrap an XRControllerEvent
, XRManagerEvent
, or XRSessionEvent
. XREventHandler
would represent an event listener.
useXREvent('select', (event: XREvent<XRControllerEvent>) => ...)
XRButton and XRCanvas
The internal XRButton
and XRCanvas
are now exported with expanded configuration options for session init and XRManager settings (see Custom XRButton and XRCanvas).
Expanded XRCanvas
XRCanvas
is now exported for custom canvases. It's also expanded with session configuration options and listeners.
<XRCanvas
/**
* Enables foveated rendering. Default is `0`
* 0 = no foveation, full resolution
* 1 = maximum foveation, the edges render at lower resolution
*/
foveation={0}
/** Type of WebXR reference space to use. Default is `local-space` */
referenceSpace="local-space"
/** Called as an XRSession is requested */
onSessionStart={(event: XREvent<XRManagerEvent>) => ...}
/** Called after an XRSession is terminated */
onSessionEnd={(event: XREvent<XRManagerEvent>) => ...}
/** Called when an XRSession is hidden or unfocused. */
onVisibilityChange={(event: XREvent<XRSessionEvent>) => ...}
/** Called when available inputsources change */
onInputSourcesChange={(event: XREvent<XRSessionEvent>) => ...}
>
{/* All your regular react-three-fiber elements go here */}
</XRCanvas>
Customizeable XRButton
Internal XRButton
and XRCanvas
were refactored to exist in React and init session state outside of XR context, so buttons can exist outside of the canvas. This is fully backward compatible with previous versions that utilize three's VRButton
& ARButton
.
<XRButton
/* The type of `XRSession` to create */
mode={'AR' | 'VR' | 'inline'}
/**
* `XRSession` configuration options
* @see https://immersive-web.github.io/webxr/#feature-dependencies
*/
sessionInit={{ optionalFeatures: ['local-floor', 'bounded-floor', 'hand-tracking', 'layers'] }}
/** Whether this button should only enter an `XRSession`. Default is `false` */
enterOnly={false}
/** Whether this button should only exit an `XRSession`. Default is `false` */
exitOnly={false}
>
{/* Can accept regular DOM children and has an optional callback with the XR button status (unsupported, exited, entered) */}
{(status) => `WebXR ${status}`}
</XRButton>
Furthermore, XRButton
can be composed with XRCanvas
to smoothly integrate with your UI. For example, this would be equivalent to VRCanvas:
<XRButton mode="VR" sessionInit={{ optionalFeatures: ['local-floor', 'bounded-floor', 'hand-tracking', 'layers'] }} />
<XRCanvas>
// ...
</XRCanvas>
Full Changelog: v3.6.0...v4.0.0
v3.6.0
What's Changed
- feat: create AR/VR buttons in react, bypass context for session init by @CodyJasonBennett, @bbohlender in #142
- fix: rollup => vite, cleanup peer deps and use cjs target by @CodyJasonBennett in #134
- fix: downlevel transpile, use correct node exts by @CodyJasonBennett in #138
- fix(HandModel): fix circular reference on dispose by @CodyJasonBennett in #139
- chore: fix markdown demo links for github by @rvdende in #137
- fix(InteractionManager): don't pass stale state on filter by @CodyJasonBennett in #144
- fix: don't create matrices on useframe, re-use hitmatrix by @CodyJasonBennett in #145
Changes
We'll be releasing v4 shortly with react 18/R3F v8 support. Due to breaking changes in @types/three
, r141 support will also follow in v4.
This release backports some important fixes and features for stability and performance.
XRButton and XRCanvas
The internal XRButton
and XRCanvas
are now exported with expanded configuration options for session init and XRManager settings (see Custom XRButton and XRCanvas).
Expanded XRCanvas
XRCanvas
is now exported for custom canvases. It's also expanded with session configuration options and listeners.
<XRCanvas
/**
* Enables foveated rendering. Default is `0`
* 0 = no foveation, full resolution
* 1 = maximum foveation, the edges render at lower resolution
*/
foveation={0}
/** Type of WebXR reference space to use. Default is `local-space` */
referenceSpace="local-space"
/** Called as an XRSession is requested */
onSessionStart={(event: XREvent<XRManagerEvent>) => ...}
/** Called after an XRSession is terminated */
onSessionEnd={(event: XREvent<XRManagerEvent>) => ...}
/** Called when an XRSession is hidden or unfocused. */
onVisibilityChange={(event: XREvent<XRSessionEvent>) => ...}
/** Called when available inputsources change */
onInputSourcesChange={(event: XREvent<XRSessionEvent>) => ...}
>
{/* All your regular react-three-fiber elements go here */}
</XRCanvas>
Customizeable XRButton
Internal XRButton
and XRCanvas
were refactored to exist in React and init session state outside of XR context, so buttons can exist outside of the canvas. This is fully backward compatible with previous versions that utilize three's VRButton
& ARButton
.
<XRButton
/* The type of `XRSession` to create */
mode={'AR' | 'VR' | 'inline'}
/**
* `XRSession` configuration options
* @see https://immersive-web.github.io/webxr/#feature-dependencies
*/
sessionInit={{ optionalFeatures: ['local-floor', 'bounded-floor', 'hand-tracking', 'layers'] }}
/** Whether this button should only enter an `XRSession`. Default is `false` */
enterOnly={false}
/** Whether this button should only exit an `XRSession`. Default is `false` */
exitOnly={false}
>
{/* Can accept regular DOM children and has an optional callback with the XR button status (unsupported, exited, entered) */}
{(status) => `WebXR ${status}`}
</XRButton>
Furthermore, XRButton
can be composed with XRCanvas
to smoothly integrate with your UI. For example, this would be equivalent to VRCanvas:
<XRButton mode="VR" sessionInit={{ optionalFeatures: ['local-floor', 'bounded-floor', 'hand-tracking', 'layers'] }} />
<XRCanvas>
// ...
</XRCanvas>
New Contributors
- @bbohlender made their first contribution in #76
- @rvdende made their first contribution in #137
Full Changelog: v3.5.0...v3.6.0
v3.5.0
What's Changed
- fix(webxr): import three-stdlib from flatbundle for cjs targets by @CodyJasonBennett in #119
- fix(AR/VRCanvas): cleanup button on unmount by @CodyJasonBennett in #127
Full Changelog: v3.4.0...v3.5.0
v3.4.0
What's Changed
- fix(#93) entering vr will not overwrite the xr session feature list anymore by @Kalkut in #94
- Fix prepare and pack scripts by @saitonakamura in #92
- Used 'supports webxr' for babel preset env by @saitonakamura in #95
- Import GLTFLoader from three-stdlib by @marlon360 in #102
- Added console warning when XR context isn't initialized by @saitonakamura in #82
- Added intersection field to handlers other than hover/blue by @saitonakamura in #84
- chore(examples): CRA => Vite, update deps by @CodyJasonBennett in #107
- fix(XRControllerModelFactory): vendor motion controller dep by @CodyJasonBennett in #111
- feat(XRIntersectionEvent): filter event candidates via state.raycaster or stop on first hit by @CodyJasonBennett in #113
- fix(useXRFrame): correctly react to session state changes by @CodyJasonBennett in #114
- chore(useXRFrame): add deprecation notice for v8 by @CodyJasonBennett in #115
- fix(webxr): add dispose methods, cleanup hands on src change by @CodyJasonBennett in #116
- chore: setup GitHub Actions CI by @CodyJasonBennett in #117
New Contributors
- @Kalkut made their first contribution in #94
- @saitonakamura made their first contribution in #92
- @marlon360 made their first contribution in #102
Full Changelog: v3.2.0...v3.4.0
v3.3.0
What's Changed
- fix(#93) entering vr will not overwrite the xr session feature list anymore by @Kalkut in #94
- Fix prepare and pack scripts by @saitonakamura in #92
- Used 'supports webxr' for babel preset env by @saitonakamura in #95
- Import GLTFLoader from three-stdlib by @marlon360 in #102
- Added console warning when XR context isn't initialized by @saitonakamura in #82
- Added intersection field to handlers other than hover/blue by @saitonakamura in #84
- chore(examples): CRA => Vite, update deps by @CodyJasonBennett in #107
New Contributors
- @Kalkut made their first contribution in #94
- @saitonakamura made their first contribution in #92
- @marlon360 made their first contribution in #102
Full Changelog: v3.2.0...v3.3.0