SceneRequest
A message to a scene worker. Everything but chunk, lookup, cancel and close applies in the order sent.
type SceneRequest =
| {
kind: "model";
model: PlacementModel;
}
| {
key: number;
kind: "drop";
}
| {
cache?: boolean;
id: number;
input: PlacementInput;
kind: "bake";
}
| {
bricks: Uint8Array;
id: number;
keys: Uint32Array;
kind: "chunk";
}
| {
cacheKey?: string;
hashKey?: boolean;
id: number;
keep?: boolean;
kind: "encode";
model: EncodeSource;
}
| {
cacheKey: string;
id: number;
joints?: ModelSource["joints"];
keep?: boolean;
kind: "lookup";
partBoxes?: Int32Array;
}
| {
kind: "close";
}
| {
id: number;
keys: PlacementKeys | PlacementKeys[];
kind: "keys";
}
| {
id: number;
kind: "cancel";
};Defined in: engine/src/worker/scene.ts:61
Union Members
Type Literal
{
kind: "model";
model: PlacementModel;
}Register a model for placement (Renderer.placementModel) under its key.
Type Literal
{
key: number;
kind: "drop";
}Forget a model key, after its model was removed.
Type Literal
{
cache?: boolean;
id: number;
input: PlacementInput;
kind: "bake";
}Bake a static set (Renderer.placementInput); answered by baked or error with this id,
after progress messages while it runs.
Type Literal
{
bricks: Uint8Array;
id: number;
keys: Uint32Array;
kind: "chunk";
}Some of the bricks of sparse model id (encoded by the encode that follows): keys[i] is
the brick key of bytes [i * 512, i * 512 + 512) of bricks.
Type Literal
{
cacheKey?: string;
hashKey?: boolean;
id: number;
keep?: boolean;
kind: "encode";
model: EncodeSource;
}Encode a model (encodeModel); answered by encoded or error with this id, after
progress messages while it runs. With keep, the worker keeps the encoding's placement
data until a keys (register it) or a cancel (forget it) for this id.
cacheKey?
optional cacheKey?: string;The source's identity for the worker's cache: its encoding is stored under it (with the part boxes and joints).
hashKey?
optional hashKey?: boolean;No identity given: with a cache, the worker hashes the source's bytes to look it up.
id
id: number;keep?
optional keep?: boolean;kind
kind: "encode";model
model: EncodeSource;Type Literal
{
cacheKey: string;
id: number;
joints?: ModelSource["joints"];
keep?: boolean;
kind: "lookup";
partBoxes?: Int32Array;
}Look up encode id in the worker's cache by the source's identity, before sending its bytes:
answered by encoded (with cached) or miss. After a miss the host sends the source as
usual (chunks and an encode with the same id and cacheKey). With keep, a hit is kept
for placement as an encode's would be.
Type Literal
{
kind: "close";
}Finish the cache writes in progress, answer closed, and expect to be terminated.
Type Literal
{
id: number;
keys: PlacementKeys | PlacementKeys[];
kind: "keys";
}Register the kept encoding id for placement under the keys the renderer gave it: a list
when one encoding was added at several scales (one renderer model, and key, per scale).
Type Literal
{
id: number;
kind: "cancel";
}Skip job id (a bake or an encode) if it has not started, and forget encoding id if it
is kept. A running job cannot be stopped.