Skip to content

Commit

Permalink
docs: root state controls
Browse files Browse the repository at this point in the history
  • Loading branch information
abernier authored Nov 26, 2024
1 parent dcd6d0e commit e408d4e
Showing 1 changed file with 28 additions and 27 deletions.
55 changes: 28 additions & 27 deletions docs/API/hooks.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -50,33 +50,34 @@ The hook is reactive, if you resize the browser for instance, you get fresh meas
### `state` properties
| Prop | Description | Type |
| ----------------- | ----------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `gl` | Renderer | `THREE.WebGLRenderer` |
| `scene` | Scene | `THREE.Scene` |
| `camera` | Camera | `THREE.PerspectiveCamera` |
| `raycaster` | Default raycaster | `THREE.Raycaster` |
| `pointer` | Contains updated, normalized, centric pointer coordinates | `THREE.Vector2` |
| `mouse` | Note: this is deprecated, use `pointer` instead! Normalized event coordinates | `THREE.Vector2` |
| `clock` | Running system clock | `THREE.Clock` |
| `linear` | True when the colorspace is linear | `boolean` |
| `flat` | True when no tonemapping is used | `boolean` |
| `legacy` | Disables global color management via `THREE.ColorManagement` | `boolean` |
| `frameloop` | Render mode: always, demand, never | `always`, `demand`, `never` |
| `performance` | System regression | `{ current: number, min: number, max: number, debounce: number, regress: () => void }` |
| `size` | Canvas size in pixels | `{ width: number, height: number, top: number, left: number, updateStyle?: boolean }` |
| `viewport` | Viewport size in three.js units | `{ width: number, height: number, initialDpr: number, dpr: number, factor: number, distance: number, aspect: number, getCurrentViewport: (camera?: Camera, target?: THREE.Vector3, size?: Size) => Viewport }` |
| `xr` | XR interface, manages WebXR rendering | `{ connect: () => void, disconnect: () => void }` |
| `set` | Allows you to set any state property | `(state: SetState<RootState>) => void` |
| `get` | Allows you to retrieve any state property non-reactively | `() => GetState<RootState>` |
| `invalidate` | Request a new render, given that `frameloop === 'demand'` | `() => void` |
| `advance` | Advance one tick, given that `frameloop === 'never'` | `(timestamp: number, runGlobalEffects?: boolean) => void` |
| `setSize` | Resize the canvas | `(width: number, height: number, updateStyle?: boolean, top?: number, left?: number) => void` |
| `setDpr` | Set the pixel-ratio | `(dpr: number) => void` |
| `setFrameloop` | Shortcut to set the current render mode | `(frameloop?: 'always', 'demand', 'never') => void` |
| `setEvents` | Shortcut to setting the event layer | `(events: Partial<EventManager<any>>) => void` |
| `onPointerMissed` | Response for pointer clicks that have missed a target | `() => void` |
| `events` | Pointer-event handling | `{ connected: TargetNode, handlers: Events, connect: (target: TargetNode) => void, disconnect: () => void }` |
| Prop | Description | Type |
| ----------------- | -------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `gl` | Renderer | `THREE.WebGLRenderer` |
| `scene` | Scene | `THREE.Scene` |
| `camera` | Camera | `THREE.PerspectiveCamera` |
| `controls` | A `[makeDefault]` [`*Controls`](https://drei.docs.pmnd.rs/controls/introduction) | `THREE.EventDispatcher` or `null` |
| `raycaster` | Default raycaster | `THREE.Raycaster` |
| `pointer` | Contains updated, normalized, centric pointer coordinates | `THREE.Vector2` |
| `mouse` | Note: this is deprecated, use `pointer` instead! Normalized event coordinates | `THREE.Vector2` |
| `clock` | Running system clock | `THREE.Clock` |
| `linear` | True when the colorspace is linear | `boolean` |
| `flat` | True when no tonemapping is used | `boolean` |
| `legacy` | Disables global color management via `THREE.ColorManagement` | `boolean` |
| `frameloop` | Render mode: always, demand, never | `always`, `demand`, `never` |
| `performance` | System regression | `{ current: number, min: number, max: number, debounce: number, regress: () => void }` |
| `size` | Canvas size in pixels | `{ width: number, height: number, top: number, left: number, updateStyle?: boolean }` |
| `viewport` | Viewport size in three.js units | `{ width: number, height: number, initialDpr: number, dpr: number, factor: number, distance: number, aspect: number, getCurrentViewport: (camera?: Camera, target?: THREE.Vector3, size?: Size) => Viewport }` |
| `xr` | XR interface, manages WebXR rendering | `{ connect: () => void, disconnect: () => void }` |
| `set` | Allows you to set any state property | `(state: SetState<RootState>) => void` |
| `get` | Allows you to retrieve any state property non-reactively | `() => GetState<RootState>` |
| `invalidate` | Request a new render, given that `frameloop === 'demand'` | `() => void` |
| `advance` | Advance one tick, given that `frameloop === 'never'` | `(timestamp: number, runGlobalEffects?: boolean) => void` |
| `setSize` | Resize the canvas | `(width: number, height: number, updateStyle?: boolean, top?: number, left?: number) => void` |
| `setDpr` | Set the pixel-ratio | `(dpr: number) => void` |
| `setFrameloop` | Shortcut to set the current render mode | `(frameloop?: 'always', 'demand', 'never') => void` |
| `setEvents` | Shortcut to setting the event layer | `(events: Partial<EventManager<any>>) => void` |
| `onPointerMissed` | Response for pointer clicks that have missed a target | `() => void` |
| `events` | Pointer-event handling | `{ connected: TargetNode, handlers: Events, connect: (target: TargetNode) => void, disconnect: () => void }` |
### Selector
Expand Down

0 comments on commit e408d4e

Please sign in to comment.