@margoengine/voxel 0.0.0-stage → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +201 -0
- package/NOTICE +4 -0
- package/README.md +1670 -2
- package/dist/bevel.d.ts +79 -0
- package/dist/bevel.js +453 -0
- package/dist/blocks-BabtpQT-.js +179 -0
- package/dist/blocks.d.ts +220 -0
- package/dist/border.d.ts +9 -0
- package/dist/chunk-BCoaKSn4.js +158 -0
- package/dist/chunk.d.ts +112 -0
- package/dist/codec-BmXhcsFt.js +412 -0
- package/dist/codec.d.ts +125 -0
- package/dist/codec.js +1 -0
- package/dist/debris.d.ts +114 -0
- package/dist/debris.js +387 -0
- package/dist/faces-DUR7LhrN.js +146 -0
- package/dist/faces.d.ts +7 -0
- package/dist/fluids.d.ts +74 -0
- package/dist/fluids.js +226 -0
- package/dist/generate.d.ts +78 -0
- package/dist/generate.js +99 -0
- package/dist/gi.d.ts +76 -0
- package/dist/gi.js +264 -0
- package/dist/gpu-mesher.d.ts +77 -0
- package/dist/gpu-mesher.js +461 -0
- package/dist/granular-mpm.d.ts +40 -0
- package/dist/granular-mpm.js +46 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +4 -0
- package/dist/light-rgb.d.ts +71 -0
- package/dist/light-rgb.js +287 -0
- package/dist/light-worker.d.ts +84 -0
- package/dist/light-worker.js +110 -0
- package/dist/light.d.ts +108 -0
- package/dist/light.js +332 -0
- package/dist/light.worker.d.ts +1 -0
- package/dist/lightmap.d.ts +50 -0
- package/dist/lightmap.js +68 -0
- package/dist/lod.d.ts +87 -0
- package/dist/lod.js +182 -0
- package/dist/mesher.d.ts +214 -0
- package/dist/mesher.js +539 -0
- package/dist/mesher.worker.d.ts +1 -0
- package/dist/model-data-D_rIKJCQ.js +41 -0
- package/dist/model-data.d.ts +21 -0
- package/dist/model-mesh-C4Gi6bMM.js +122 -0
- package/dist/model-mesh.d.ts +21 -0
- package/dist/model-surface.d.ts +5 -0
- package/dist/models.d.ts +74 -0
- package/dist/models.js +308 -0
- package/dist/objects.d.ts +73 -0
- package/dist/objects.js +152 -0
- package/dist/octants-C_Ic7gdn.js +10 -0
- package/dist/octants.d.ts +16 -0
- package/dist/origin-DsMelUxs.js +23 -0
- package/dist/origin.d.ts +7 -0
- package/dist/physics.d.ts +147 -0
- package/dist/physics.js +486 -0
- package/dist/query.d.ts +166 -0
- package/dist/query.js +305 -0
- package/dist/render-post.d.ts +6 -0
- package/dist/render.d.ts +296 -0
- package/dist/render.js +1616 -0
- package/dist/shared/borrowed.d.ts +44 -0
- package/dist/smooth-CEwHkXli.js +968 -0
- package/dist/smooth-clip.d.ts +24 -0
- package/dist/smooth-lod.d.ts +118 -0
- package/dist/smooth-lod.js +244 -0
- package/dist/smooth.d.ts +171 -0
- package/dist/smooth.js +1 -0
- package/dist/stream.d.ts +201 -0
- package/dist/stream.js +402 -0
- package/dist/terrain.worker.d.ts +1 -0
- package/dist/textures.d.ts +86 -0
- package/dist/ticks.d.ts +126 -0
- package/dist/ticks.js +239 -0
- package/dist/unit-light-Ch7roJgB.js +7 -0
- package/dist/vox.d.ts +237 -0
- package/dist/vox.js +780 -0
- package/dist/wind-data.d.ts +13 -0
- package/dist/wind.d.ts +68 -0
- package/dist/wind.js +170 -0
- package/dist/worker-DlGRxlc4.js +44 -0
- package/dist/worker-pool-sPyC6jCE.js +93 -0
- package/dist/workers/light.js +1 -0
- package/dist/workers/mesher.js +1 -0
- package/dist/workers/terrain.js +1 -0
- package/dist/world-CelTlft2.js +153 -0
- package/dist/world.d.ts +117 -0
- package/package.json +173 -4
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/** A caller's GPU object, or a function that makes one for a device. */
|
|
2
|
+
export type Borrowable<T> = T | ((device: GPUDevice) => T);
|
|
3
|
+
|
|
4
|
+
/** State kept for one borrowed option; owners do not read its fields. */
|
|
5
|
+
export interface BorrowSlot<T, V = Borrowable<T>> {
|
|
6
|
+
value: V | null | undefined;
|
|
7
|
+
device: GPUDevice | null | undefined;
|
|
8
|
+
made: T | undefined;
|
|
9
|
+
told: boolean;
|
|
10
|
+
readonly name: string;
|
|
11
|
+
readonly setter: string;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/** Puts `value` in `slot`; a plain object belongs to `device` (undefined: the device of its first `lend`). */
|
|
15
|
+
export function relend<T, V = Borrowable<T>>(
|
|
16
|
+
slot: BorrowSlot<T, V>,
|
|
17
|
+
value: V | null | undefined,
|
|
18
|
+
device?: GPUDevice | null,
|
|
19
|
+
): BorrowSlot<T, V>;
|
|
20
|
+
|
|
21
|
+
/** Fixes the device a plain object given before attach belongs to; owners call it from `setup`. */
|
|
22
|
+
export function fix<T, V>(slot: BorrowSlot<T, V>, device: GPUDevice | null): void;
|
|
23
|
+
|
|
24
|
+
/** A slot for an option that takes a caller's GPU object or `(device) => object`, named for its one report. */
|
|
25
|
+
export function borrow<T, V = Borrowable<T>>(
|
|
26
|
+
value: V | null | undefined,
|
|
27
|
+
name: string,
|
|
28
|
+
setter: string,
|
|
29
|
+
device?: GPUDevice | null,
|
|
30
|
+
): BorrowSlot<T, V>;
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* What to bind on `device`: the function's result (made once per device), the plain object while its device is the
|
|
34
|
+
* one in use, else undefined, reported once through `engine.onError` as a `'state'` MargoError linking to
|
|
35
|
+
* margoengine.com/errors#borrowed-lost.
|
|
36
|
+
*/
|
|
37
|
+
export function lend<T, V>(
|
|
38
|
+
slot: BorrowSlot<T, V>,
|
|
39
|
+
device: GPUDevice,
|
|
40
|
+
engine?: { onError(error: unknown): void },
|
|
41
|
+
): T | undefined;
|
|
42
|
+
|
|
43
|
+
/** True for an option object the caller wrote (a plain object), false for a GPU object or any class instance. */
|
|
44
|
+
export function isOptionObject(value: unknown): value is Record<string, unknown>;
|