Class: Scene3D
Experimental
The live scene (see the module comment). Get it with acquireScene.
Constructors
Constructor
new Scene3D(
id,
viewport,
layout,
full
): Scene3D;Experimental
Parameters
| Parameter | Type |
|---|---|
id | string |
viewport | Viewport |
layout | SceneLayout |
full | Record<string, unknown> |
Returns
Scene3D
Properties
| Property | Modifier | Type | Default value | Description |
|---|---|---|---|---|
camera | public | SceneCamera | undefined | Experimental The camera in use (scene units); the controls move it, the layout's camera resets it. |
id | readonly | string | undefined | Experimental |
initial | readonly | object | undefined | Experimental The camera and aspect ratio of the first drawn view (double-click, "reset to last save"). |
initial.aspect | public | Vec3 | undefined | - |
initial.aspectmode | public | unknown | undefined | - |
initial.camera | public | SceneCamera | undefined | - |
layout | public | SceneLayout | undefined | Experimental The scene as laid out by the latest pass that laid it out. |
lighting | readonly | SceneLighting | undefined | Experimental The scene's lights (layout.sceneN.lighting, E8.7; see scene-lighting.ts). |
orthoZoom | public | number | 1 | Experimental Orthographic zoom not committed yet: Plotly zooms orthographic scenes by scaling their aspectratio, which the controls commit when the gesture ends; until then the view zooms. |
projection | public | SceneProjection | 'perspective' | Experimental camera.projection.type in use. |
viewport | readonly | Viewport | undefined | Experimental |
Accessors
transform
Get Signature
get transform(): Required<DataTransform>;Experimental
Linear coordinates → scene units (all three axes; see SceneLayout.transform).
Returns
Required<DataTransform>
Methods
apply()
apply(fullLayout, layout): void;Experimental
Take a pass's layout: a camera the layout changed replaces the live one (an app's relayout, a reset, or the controls' own commit, which then changes nothing).
Parameters
| Parameter | Type |
|---|---|
fullLayout | FullLayout |
layout | SceneLayout | undefined |
Returns
void
cameraPayload()
cameraPayload(commit?): Record<string, unknown>;Experimental
The scene.camera of a relayout for the live camera. With commit, the layout camera it becomes will not replace the live one (see apply).
Parameters
| Parameter | Type | Default value |
|---|---|---|
commit | boolean | false |
Returns
Record<string, unknown>
commitZoom()
commitZoom(): Record<string, unknown>;Experimental
Commit an orthographic zoom as an aspect ratio (see orthoZoom).
Returns
Record<string, unknown>
onCameraChange()
onCameraChange(listener): () => void;Experimental
Called with this scene whenever the camera moved (the axes redraw, views may re-sort).
Parameters
| Parameter | Type |
|---|---|
listener | (scene) => void |
Returns
() => void
project()
project(
x,
y,
z,
out?
): ScreenPoint;Experimental
Scene units → screen: container px (top-left origin) and NDC depth. Uses the camera as of the last sync.
Parameters
| Parameter | Type |
|---|---|
x | number |
y | number |
z | number |
out | ScreenPoint |
Returns
setCamera()
setCamera(camera): void;Experimental
Move the camera (controls, animations): the view follows on the next frame.
Parameters
| Parameter | Type |
|---|---|
camera | SceneCamera |
Returns
void
sync()
sync(): void;Experimental
Push the camera to the viewport's three.js camera and tell the listeners.
Returns
void
toWorld()
toWorld(
x,
y,
z,
out?
): Vec3;Experimental
Linear coordinates → scene units.
Parameters
| Parameter | Type |
|---|---|
x | number |
y | number |
z | number |
out | Vec3 |
Returns
useLightRig()
useLightRig(mesh): () => void;Experimental
Light a mesh primitive with the scene's lights (scene.lighting, E8.7): now and whenever they change. Returns the function that stops it (call it when the mesh is disposed).
Parameters
| Parameter | Type |
|---|---|
mesh | LightRigUser |
Returns
() => void