Remarks
Creates aWebGPURenderer (WebGL2 fallback) on a canvas added to the
container, a Scene and a default PerspectiveCamera. It renders once per
tick, after the ECS systems, and never on its own: a paused game keeps its
last image. The canvas follows every viewport change like graphics-2d’s
stage: the design resolution is the camera’s full frame, letterboxed or
cropped according to the viewport’s fit. Client-only — __init throws if
InitContext.container is missing.
Extends
Library
Implements
Constructors
Constructor
new Graphics3DLibrary(Defined in: modules/graphics-3d/src/graphics-3d.library.ts:75_options?):Graphics3DLibrary
Parameters
_options?
Graphics3DOptions = {}
Returns
Graphics3DLibrary
Overrides
Library.constructor
Properties
key
Defined in: modules/graphics-3d/src/graphics-3d.library.ts:57 This library’s identity: its slot onreadonlykey:"graphics"
Context, its registry key, and
the identifier used to reference it in ordering relationships.
Overrides
Library.key
Accessors
backend
Get Signature
get backend(): Graphics3DBackend
Defined in: modules/graphics-3d/src/graphics-3d.library.ts:217
Returns
Graphics3DBackend
camera
Get Signature
get camera(): Camera
Defined in: modules/graphics-3d/src/graphics-3d.library.ts:197
Returns
Camera
Set Signature
set camera(Defined in: modules/graphics-3d/src/graphics-3d.library.ts:202camera):void
Parameters
camera
Camera
Returns
void
relationships
Get Signature
get relationships(): LibraryRelationships
Defined in: packages/common/dist/index.d.ts:512
Internal
Returns
LibraryRelationships
Inherited from
Library.relationships
render
Get Signature
get render(): () => void
Defined in: modules/graphics-3d/src/graphics-3d.library.ts:209
The render step in use now, so a custom render can wrap it without calling itself.
Returns
() =>void
Set Signature
set render(Defined in: modules/graphics-3d/src/graphics-3d.library.ts:213render):void
Parameters
render
(() =>void) | undefined
Returns
void
renderer
Get Signature
get renderer(): WebGPURenderer
Defined in: modules/graphics-3d/src/graphics-3d.library.ts:187
Returns
WebGPURenderer
scene
Get Signature
get scene(): Scene
Defined in: modules/graphics-3d/src/graphics-3d.library.ts:192
Returns
Scene
Methods
__clear()
__clear():Defined in: modules/graphics-3d/src/graphics-3d.library.ts:170 Called once after the tick loop stops.Promise<void>
Returns
Promise<void>
Overrides
Library.__clear
__editorInit()
__editorInit(Defined in: modules/graphics-3d/src/graphics-3d.library.ts:122 Listens to the editor’sctx):Promise<void>
graphics-capture command and keeps the editor for graphics-camera.
Parameters
ctx
EditorInitContext
Returns
Promise<void>
Implementation of
EditorAwareLibrary.__editorInit
__events()
__events(Defined in: modules/graphics-3d/src/graphics-3d.library.ts:135 Emits_ctx):Promise<void>
graphics-camera while the editor asks for it, paused ticks included.
Parameters
_ctx
Context
Returns
Promise<void>
Overrides
Library.__events
__init()
__init(Defined in: modules/graphics-3d/src/graphics-3d.library.ts:79 Called once, in dependency order, before the tick loop starts.ctx):Promise<void>
Parameters
ctx
InitContext
Returns
Promise<void>
Overrides
Library.__init
__run()
__run(Defined in: modules/graphics-3d/src/graphics-3d.library.ts:158 Called every tick, in run order, while the tick loop is active and not paused._ctx):Promise<void>
Parameters
_ctx
Context
Returns
Promise<void>
Overrides
Library.__run
expose()
expose(): Graphics3DContextApi
Defined in: modules/graphics-3d/src/graphics-3d.library.ts:246
Returns this library’s public contribution to Context[this.key].
Returns
Graphics3DContextApi
Remarks
Return a plain object exposing only what game code should be able to reach — neverthis — so internal state and lifecycle hooks never leak
onto Context. Libraries with nothing to expose (headless libraries)
can leave this unimplemented; they simply won’t appear on Context.
Overrides
Library.expose
raycast()
raycast(Defined in: modules/graphics-3d/src/graphics-3d.library.ts:223clientX,clientY,objects?):Intersection<Object3D<Object3DEventMap>>[]
Parameters
clientX
number
clientY
number
objects?
Object3D<Object3DEventMap>[] = ...
Returns
Intersection<Object3D<Object3DEventMap>>[]
throwNotInitializedError()
Defined in: packages/common/dist/index.d.ts:536protectedthrowNotInitializedError():never
Returns
never
Inherited from
Library.throwNotInitializedError
worldToScreen()
worldToScreen(Defined in: modules/graphics-3d/src/graphics-3d.library.ts:237point):ScreenPoint
Parameters
point
Vector3
Returns
ScreenPoint