Whether there is a step to redo, as of the latest result.
Whether there is a step to undo, as of the latest result.
The threads the engine computes with: more than 1 when the threaded engine runs (see WorkerSceneOptions.threads), 1 when single-threaded. As of the current Worker's start (1 until it is ready).
Adds a signed distance field; see Scene.addDistanceField.
Adds a mesh from world positions and returns its handle at once. The
origin defaults to the bounding-box centre, computed here. The mesh has
no slots until the Worker has added it; a failed add shows as an error
on status("mesh:<id>"), and later calls on it fail with UNKNOWN_MESH.
A mesh of WorkerSceneOptions.backgroundAddTriangles triangles or
more (65,536 by default) is added in the background: requests sent after
it that do not need it run meanwhile, so a reply to one of them can
arrive before the mesh. Until it lands, status("mesh:<id>") reads
"computing" and its views are empty; its buffers arrive with that
status turning "ready".
Adds a plane section; its results arrive with the next results.
A report of the mesh's defects; see Scene.analyze.
Optionaloptions: AnalyzeOptionsThe surface point nearest to a world point, or null; see Scene.closestPoint.
The rule the mirrored colours and values are made by (a frozen copy of
the one given to setColoring, the same object until another rule is
applied), or null without colouring. It follows the
results: a new rule shows with the batch that applies it, a rejected one
never, and a removed field's colouring goes when the removal is applied.
Call once per animation frame. Sends this frame's requests to the Worker as one batch, then delivers to every listener, and returns, the change records of the results received since the last call (already applied to the mirrors) plus the drags' pose changes made here. Every listener runs even if one throws; the first error is rethrown afterwards.
Starts an optimistic drag. move shows the pose here at once and sends
at most one move per batch; end and cancel are synchronous here.
cancel puts the start pose back and records nothing.
Edits a mesh's geometry (one undo step); resolves with the ids added.
The field's nearest-target indices as of its last update (the index in
its to, 0xffffffff for none); see Scene.fieldNearest. A target
removed since shifts the later indices down.
A copy of the field's values as of its last update, one per vertex slot.
Whether the field is current, and what its sign data found out about the
targets together; see Scene.fieldStatus.
What the sign data found out about each of the field's targets; see Scene.fieldTargetStatus.
Every mesh pair (or every pair of pairs) within margin; see Scene.findContacts.
The client id behind a handle, as used in status keys.
Whether two meshes intersect or touch as placed.
Joins source into target; see Scene.join. The source stays usable
until the join lands: only a successful result removes it (a failed join
changes nothing, engine-side or here).
The column-major world matrix of the mesh's local render coordinates, as mirrored.
Scalar measurements of a mesh; see Scene.measure.
The distance between two meshes' surfaces, or null; see Scene.meshDistance.
Optionaloptions: { maxDistance?: number }Registers a listener for WorkerScene.commitFrame; returns the function that removes it.
Registers a listener called (on a microtask) when any status or the undo/redo state changes; returns the function that removes it.
The mesh's placement as mirrored, scale always present (a drag's pose while it is held).
The nearest hit of a world ray over every mesh, or null; see Scene.raycast.
Optionaloptions: RaycastOptionsRedoes the latest undone step; an active drag is ended first.
Rigidly aligns moving to fixed by ICP from their placements as the
Worker has them when the request runs; see Scene.register. An applied
result reaches placement() with its batch, like a setPlacement.
Not replayed by a restart: an unanswered one rejects with
INSTANCE_POISONED, like an edit.
Removes a mesh, ending an active drag of it first. Later calls on it give
UNKNOWN_MESH; its mirrors stay readable until the removal is delivered
by commitFrame().
Removes a section. Its handle then gives UNKNOWN_SECTION.
Runs one repair operation, a list as one transaction, or the auto pipeline; see Scene.repair.
Runs one repair operation, a list as one transaction, or the auto pipeline; see Scene.repair.
Runs one repair operation, a list as one transaction, or the auto pipeline; see Scene.repair.
Stops the Worker, starts a new one and replays the scene into it; this
is how a scene recovers after INSTANCE_POISONED. Resolves once the
replay's results are applied (reported by the next commitFrame()).
The replay is built here, from what the main thread has:
setPlacement or drag not acknowledged yet);History is cleared (canUndo/canRedo are false). The replay is sent
at once, not with the next frame. Every replayed key is "computing"
until the replay's results arrive, and so is the key of every pending
declarative request (placement, drag, colouring, field, section), also
one that failed after a poisoning (its call was rejected then): it
settles with the replay ("ready", or "error" when the replay failed
for it), which applies the newest value; after a poisoning, placements
replay the engine's pose. A colouring whose field cannot be replayed
(its mesh was lost) is dropped, with UNKNOWN_FIELD on its display key.
Removals count as done: field and section removal keys read "idle"
at once (their state is forgotten), mesh removal keys after the next
commitFrame() delivers the removal. When the replay fails as a whole
(no Worker, it could not be posted, a trap), the scene is poisoned and
the next restart() replays the same intent and settles those keys.
What cannot be replayed surfaces as errors (INSTANCE_POISONED): edits,
repairs, compaction, undo/redo and queries sent and not answered, or not
sent yet (their promises reject), and meshes whose add was sent but
never acknowledged (their buffers went to the old Worker: they stay
failed, and calls on them give UNKNOWN_MESH). An active drag ends.
Mirrors, section results included, stay readable throughout. Calling it
again before it settles returns the same promise. When no Worker can be
created, the promise rejects and the scene stays poisoned (a later
restart() tries again).
The section's latest result for a mesh as mirrored (empty and "stale"
until the first arrives). Do not modify it.
The closest pair between two meshes' contours in a section; see Scene.sectionGap.
The section's plane as last set here, the normal normalised.
Colours a mesh from one of its fields, or turns colouring off with
null. Last wins: of several calls for a mesh in one frame, only the
last is sent. Tracked by status("display:<id>").
Sets a mesh's placement (one undo step), scale included ([1, 1, 1]
when omitted); placement() follows when the result arrives.
Turns a section's fill on or off. Last wins per frame.
Changes the meshes a section cuts. Last wins per frame.
Moves a section's plane; sectionPlane() returns it at once. Last wins per frame.
The state of a request key: mesh:<id>, placement:<id>, edit:<id>,
display:<id>, field:<id>, section:<id> (add and remove),
section:<id>:plane / :meshes / :fill, history. A result sets
"ready" or "error" only when no newer request for the key is pending.
A status covers only requests made under its key: a drag or edit does
not mark the display: or section: keys of the colours and sections
that catch up after it. Returns a copy.
Stops the Worker. Pending promises reject with INVALID_ARGUMENT; later
calls throw it. Calling it again does nothing.
Undoes the latest step; an active drag is ended first.
The mirrors of the mesh's render buffers, at full slot length. Each getter returns the current mirror; a mirror is replaced when the slot count changes or a buffer turns on or off, so get views right before use.
A scene whose engine runs in a Worker, from createWorkerScene. It mirrors
Scene(always"eager") with these differences:voidand are tracked by key through WorkerScene.status; calls that return data return promises.commitFrame()too, or are sent on their own after 100 ms when no frame comes; before the firstcommitFrame()(no frame loop) they are sent on the next microtask.views,placement,matrix4,sectionandsectionPlaneread main-thread mirrors, updated as results arrive and reported by the nextcommitFrame(). Views follow the same fresh-view rule asScene: get them right before use. A mesh has 0 slots until its add is processed.moveshows the pose at once,endandcancelare synchronous here, and the pose is held until the Worker has the drag.INSTANCE_POISONED); handles keep working. Unlike other promise calls, its replay is sent at once, not with the nextcommitFrame().