Skip to main content
Defined in: modules/graphics-3d/src/graphics-context.type.ts:13 Public surface of Graphics3DLibrary, exposed on Context.graphics.

Properties

backend

readonly backend: Graphics3DBackend
Defined in: modules/graphics-3d/src/graphics-context.type.ts:32 Which backend runs.

camera

camera: Camera
Defined in: modules/graphics-3d/src/graphics-context.type.ts:22 The camera the scene is rendered with. A default PerspectiveCamera at (0, 0, 5) looking at the origin; assign another camera to switch.

renderer

readonly renderer: WebGPURenderer
Defined in: modules/graphics-3d/src/graphics-context.type.ts:15 The Three.js renderer. Rendered by the library every tick; never call setAnimationLoop.

scene

readonly scene: Scene
Defined in: modules/graphics-3d/src/graphics-context.type.ts:17 The scene rendered every tick — add objects here to show them.

Accessors

render

Get Signature

get render(): () => void
Defined in: modules/graphics-3d/src/graphics-context.type.ts:29 Draws one frame. The library calls it once per tick, after the systems, and for editor screenshots. By default it renders scene through camera. Assign your own function to render a post-processing pipeline instead. Assign undefined to go back to the default. Reset on restart.
Returns
() => void

Set Signature

set render(render): void
Defined in: modules/graphics-3d/src/graphics-context.type.ts:30
Parameters
render
(() => void) | undefined
Returns
void

Methods

raycast()

raycast(clientX, clientY, objects?): Intersection<Object3D<Object3DEventMap>>[]
Defined in: modules/graphics-3d/src/graphics-context.type.ts:40 Objects under a point of the page, nearest first.

Parameters

clientX
number Page x, in CSS px (PointerEvent.clientX).
clientY
number Page y, in CSS px (PointerEvent.clientY).
objects?
Object3D<Object3DEventMap>[] Objects to test, with their children. Defaults to the whole scene.

Returns

Intersection<Object3D<Object3DEventMap>>[]

worldToScreen()

worldToScreen(point): ScreenPoint
Defined in: modules/graphics-3d/src/graphics-context.type.ts:42 Where a world point is drawn in the page, in CSS px.

Parameters

point
Vector3

Returns

ScreenPoint