@margoengine/voxel 0.0.0-stage → 0.1.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.
Files changed (90) hide show
  1. package/LICENSE +201 -0
  2. package/NOTICE +4 -0
  3. package/README.md +1671 -3
  4. package/dist/bevel.d.ts +79 -0
  5. package/dist/bevel.js +453 -0
  6. package/dist/blocks-BabtpQT-.js +179 -0
  7. package/dist/blocks.d.ts +220 -0
  8. package/dist/border.d.ts +9 -0
  9. package/dist/chunk-BCoaKSn4.js +158 -0
  10. package/dist/chunk.d.ts +112 -0
  11. package/dist/codec-ZZFj1xvt.js +410 -0
  12. package/dist/codec.d.ts +125 -0
  13. package/dist/codec.js +1 -0
  14. package/dist/debris.d.ts +114 -0
  15. package/dist/debris.js +387 -0
  16. package/dist/faces-DUR7LhrN.js +146 -0
  17. package/dist/faces.d.ts +7 -0
  18. package/dist/fluids.d.ts +74 -0
  19. package/dist/fluids.js +226 -0
  20. package/dist/generate.d.ts +78 -0
  21. package/dist/generate.js +99 -0
  22. package/dist/gi.d.ts +76 -0
  23. package/dist/gi.js +264 -0
  24. package/dist/gpu-mesher.d.ts +77 -0
  25. package/dist/gpu-mesher.js +461 -0
  26. package/dist/granular-mpm.d.ts +32 -0
  27. package/dist/granular-mpm.js +46 -0
  28. package/dist/index.d.ts +6 -0
  29. package/dist/index.js +4 -0
  30. package/dist/light-rgb.d.ts +71 -0
  31. package/dist/light-rgb.js +287 -0
  32. package/dist/light-worker.d.ts +84 -0
  33. package/dist/light-worker.js +110 -0
  34. package/dist/light.d.ts +108 -0
  35. package/dist/light.js +332 -0
  36. package/dist/light.worker.d.ts +1 -0
  37. package/dist/lightmap.d.ts +50 -0
  38. package/dist/lightmap.js +68 -0
  39. package/dist/lod.d.ts +87 -0
  40. package/dist/lod.js +182 -0
  41. package/dist/mesher.d.ts +214 -0
  42. package/dist/mesher.js +539 -0
  43. package/dist/mesher.worker.d.ts +1 -0
  44. package/dist/model-data-D_rIKJCQ.js +41 -0
  45. package/dist/model-data.d.ts +21 -0
  46. package/dist/model-mesh-C4Gi6bMM.js +122 -0
  47. package/dist/model-mesh.d.ts +21 -0
  48. package/dist/model-surface.d.ts +5 -0
  49. package/dist/models.d.ts +74 -0
  50. package/dist/models.js +308 -0
  51. package/dist/objects.d.ts +73 -0
  52. package/dist/objects.js +152 -0
  53. package/dist/octants-C_Ic7gdn.js +10 -0
  54. package/dist/octants.d.ts +16 -0
  55. package/dist/origin-DsMelUxs.js +23 -0
  56. package/dist/origin.d.ts +7 -0
  57. package/dist/physics.d.ts +147 -0
  58. package/dist/physics.js +486 -0
  59. package/dist/query.d.ts +166 -0
  60. package/dist/query.js +305 -0
  61. package/dist/render-post.d.ts +6 -0
  62. package/dist/render.d.ts +296 -0
  63. package/dist/render.js +1613 -0
  64. package/dist/shared/borrowed.d.ts +44 -0
  65. package/dist/smooth-CEwHkXli.js +968 -0
  66. package/dist/smooth-clip.d.ts +24 -0
  67. package/dist/smooth-lod.d.ts +118 -0
  68. package/dist/smooth-lod.js +244 -0
  69. package/dist/smooth.d.ts +171 -0
  70. package/dist/smooth.js +1 -0
  71. package/dist/stream.d.ts +201 -0
  72. package/dist/stream.js +402 -0
  73. package/dist/terrain.worker.d.ts +1 -0
  74. package/dist/textures.d.ts +86 -0
  75. package/dist/ticks.d.ts +126 -0
  76. package/dist/ticks.js +239 -0
  77. package/dist/unit-light-Ch7roJgB.js +7 -0
  78. package/dist/vox.d.ts +237 -0
  79. package/dist/vox.js +780 -0
  80. package/dist/wind-data.d.ts +13 -0
  81. package/dist/wind.d.ts +68 -0
  82. package/dist/wind.js +170 -0
  83. package/dist/worker-DlGRxlc4.js +44 -0
  84. package/dist/worker-pool-sPyC6jCE.js +93 -0
  85. package/dist/workers/light.js +1 -0
  86. package/dist/workers/mesher.js +1 -0
  87. package/dist/workers/terrain.js +1 -0
  88. package/dist/world-CelTlft2.js +153 -0
  89. package/dist/world.d.ts +117 -0
  90. package/package.json +175 -6
@@ -0,0 +1,153 @@
1
+ import { t as e } from "./blocks-BabtpQT-.js";
2
+ import { a as t, n, o as r, s as i } from "./chunk-BCoaKSn4.js";
3
+ import { MargoError as a } from "@margoengine/math/errors";
4
+ //#region src/world.ts
5
+ var o = (e, t, n) => `${e},${t},${n}`, s = (e, t, n) => [
6
+ e,
7
+ t,
8
+ n
9
+ ].every((e) => typeof e == "number") ? /* @__PURE__ */ RangeError(`Cell (${e}, ${t}, ${n}) is not three 32-bit integers; floor positions to cells first`) : /* @__PURE__ */ TypeError("Cell coordinates must be numbers"), c = (e, t, n) => [
10
+ e,
11
+ t,
12
+ n
13
+ ].every((e) => typeof e == "number") ? /* @__PURE__ */ RangeError(`Chunk (${e}, ${t}, ${n}) is not three integers in -2^26..2^26-1; pass cell >> 5`) : /* @__PURE__ */ TypeError("Chunk coordinates must be numbers"), l = (e) => e << 5 >> 5 === e, u, d, f = Array.from({ length: 27 }, (e, t) => {
14
+ let n = (e) => e === 1 ? [-1, 0] : e === 2 ? [0, 1] : [0], r = 0;
15
+ for (let e of n(t / 9 | 0)) for (let i of n((t / 3 | 0) % 3)) for (let a of n(t % 3)) r |= 1 << (e + 1) * 9 + (i + 1) * 3 + a + 1;
16
+ return r;
17
+ }), p = (e) => e === 0 ? 1 : e === 31 ? 2 : 0, m = class {
18
+ static {
19
+ d = (e, t) => {
20
+ for (let [n, r, i, a] of t) if (e.getBlock(n, r, i) !== a) return !1;
21
+ for (let [n, r, i] of t) e.write(n, r, i, 0, !1);
22
+ for (let [n, r, i, a] of t) for (let t of e.listeners) t(n, r, i, 0, a);
23
+ return !0;
24
+ }, u = (e, n, i, a, s, c, l, u, d) => {
25
+ let m = o(n, i, a), h = e.chunks.get(m) ?? e.addChunk(n, i, a), g = /* @__PURE__ */ new Uint8Array(256), _ = /* @__PURE__ */ new Uint32Array(256), v = n * 32, y = i * 32, b = a * 32, x = 0;
26
+ for (let e = u; e < d; e++) g[c[e]] || (g[c[e]] = 1, _[x++] = l[c[e]]);
27
+ t(h, _, x);
28
+ let S = 0, C = 0;
29
+ for (let t = u; t < d; t++) {
30
+ let n = s[t], r = l[c[t]], i = h.set(n & 31, n >> 10, n >> 5 & 31, r);
31
+ if (i !== r) {
32
+ S++ || e.dirty.add(m), C |= 1 << p(n & 31) * 9 + p(n >> 10) * 3 + p(n >> 5 & 31);
33
+ for (let t of e.listeners) t(v + (n & 31), y + (n >> 10), b + (n >> 5 & 31), r, i);
34
+ }
35
+ }
36
+ if (r(h), !S) return 0;
37
+ e.dirty.add(m);
38
+ let w = 0;
39
+ for (let e = 0; e < 27; e++) C & 1 << e && (w |= f[e]);
40
+ for (let t = 0; t < 27; t++) {
41
+ if (t === 13 || !(w & 1 << t)) continue;
42
+ let r = o(n + (t / 9 | 0) - 1, i + (t / 3 | 0) % 3 - 1, a + t % 3 - 1);
43
+ e.chunks.has(r) && e.dirty.add(r);
44
+ }
45
+ return S;
46
+ };
47
+ }
48
+ constructor(t) {
49
+ if (this.dirty = /* @__PURE__ */ new Set(), this.chunks = /* @__PURE__ */ new Map(), this.columns = /* @__PURE__ */ new Map(), this.listeners = /* @__PURE__ */ new Set(), this.chunkListeners = /* @__PURE__ */ new Set(), this.cx = NaN, this.cy = 0, this.cz = 0, this.key = "", !(t?.blocks instanceof e)) throw TypeError("VoxelWorld needs {blocks}: pass {blocks: new BlockTypes()}");
50
+ let { minY: n = -32768, maxY: r = 32767 } = t;
51
+ if (typeof n != "number" || typeof r != "number") throw TypeError("VoxelWorld minY and maxY must be numbers");
52
+ if (!Number.isInteger(n) || !Number.isInteger(r) || n < -32768 || r > 32767 || n > r) throw RangeError(`VoxelWorld y range ${n}..${r} is invalid; use integers in -32768..32767, minY <= maxY`);
53
+ this.blocks = t.blocks, this.minY = n, this.maxY = r;
54
+ }
55
+ getBlock(e, t, n) {
56
+ if ((e | 0) !== e || (t | 0) !== t || (n | 0) !== n) throw s(e, t, n);
57
+ if (t < this.minY || t > this.maxY) return 0;
58
+ let r = this.at(e >> 5, t >> 5, n >> 5);
59
+ return r ? r.get(e & 31, t & 31, n & 31) : 0;
60
+ }
61
+ setBlock(e, t, n, r) {
62
+ return this.check(e, t, n, r), this.write(e, t, n, r);
63
+ }
64
+ setBlocks(e) {
65
+ if (!e || typeof e != "object" || !Number.isInteger(e.length) || e.length % 4) throw TypeError("setBlocks expects a flat [x, y, z, state, ...] array of quadruples");
66
+ let t = e.length, n = (t) => (e[t] | 0) === e[t] ? e[t] >>> 0 : e[t];
67
+ for (let r = 0; r < t; r += 4) this.check(e[r], e[r + 1], e[r + 2], n(r + 3));
68
+ let r = 0;
69
+ for (let i = 0; i < t; i += 4) {
70
+ let t = n(i + 3);
71
+ this.write(e[i], e[i + 1], e[i + 2], t) !== t && r++;
72
+ }
73
+ return r;
74
+ }
75
+ getChunk(e, t, n) {
76
+ if (!l(e) || !l(t) || !l(n)) throw c(e, t, n);
77
+ return this.chunks.get(o(e, t, n));
78
+ }
79
+ addChunk(e, t, r, i = new n()) {
80
+ if (!l(e) || !l(t) || !l(r)) throw c(e, t, r);
81
+ if (!(i instanceof n)) throw TypeError("addChunk expects a VoxelChunk; create one with new VoxelChunk() or VoxelChunk.unpack()");
82
+ if (t * 32 > this.maxY || t * 32 + 31 < this.minY) throw RangeError(`Chunk y ${t} is outside this world's cells ${this.minY}..${this.maxY}; widen minY/maxY`);
83
+ let s = o(e, t, r);
84
+ if (this.chunks.has(s)) throw new a("state", `Chunk ${s} is already loaded; removeChunk(${s}) before adding another`);
85
+ this.chunks.set(s, i), this.cx = NaN;
86
+ let u = this.columns.get(`${e},${r}`);
87
+ u ? u.chunks++ : this.columns.set(`${e},${r}`, {
88
+ heights: (/* @__PURE__ */ new Int16Array(1024)).fill(-32768),
89
+ chunks: 1
90
+ }), this.dirty.add(s), this.touch(e, t, r, -1, 1, -1, 1, -1, 1);
91
+ for (let n of this.chunkListeners) n(e, t, r, i);
92
+ return i;
93
+ }
94
+ removeChunk(e, t, n) {
95
+ if (!l(e) || !l(t) || !l(n)) throw c(e, t, n);
96
+ let r = o(e, t, n), i = this.chunks.get(r);
97
+ if (!i) return;
98
+ this.chunks.delete(r), this.cx = NaN;
99
+ let a = this.columns.get(`${e},${n}`);
100
+ a && !--a.chunks && this.columns.delete(`${e},${n}`), this.dirty.add(r), this.touch(e, t, n, -1, 1, -1, 1, -1, 1);
101
+ for (let r of this.chunkListeners) r(e, t, n, void 0);
102
+ return i;
103
+ }
104
+ onChunk(e) {
105
+ if (typeof e != "function") throw TypeError("onChunk expects a function (cx, cy, cz, chunk)");
106
+ for (let [t, n] of this.chunks) {
107
+ let [r, i, a] = t.split(",").map(Number);
108
+ e(r, i, a, n);
109
+ }
110
+ return this.chunkListeners.add(e), () => {
111
+ this.chunkListeners.delete(e);
112
+ };
113
+ }
114
+ heightmap(e, t) {
115
+ if (!l(e) || !l(t)) throw c(e, 0, t);
116
+ return this.columns.get(`${e},${t}`)?.heights;
117
+ }
118
+ onChange(e) {
119
+ if (typeof e != "function") throw TypeError("onChange expects a function (x, y, z, state, previous)");
120
+ return this.listeners.add(e), () => {
121
+ this.listeners.delete(e);
122
+ };
123
+ }
124
+ at(e, t, n) {
125
+ return (e !== this.cx || t !== this.cy || n !== this.cz) && (this.cx = e, this.cy = t, this.cz = n, this.key = o(e, t, n), this.chunk = this.chunks.get(this.key)), this.chunk;
126
+ }
127
+ check(e, t, n, r) {
128
+ if ((e | 0) !== e || (t | 0) !== t || (n | 0) !== n) throw s(e, t, n);
129
+ if (t < this.minY || t > this.maxY) throw RangeError(`Cell y ${t} is outside this world's ${this.minY}..${this.maxY}; widen minY/maxY`);
130
+ if (r >>> 0 !== r) throw i(r);
131
+ if ((r & 65535) >= this.blocks.table.length) throw RangeError(`Block id ${r & 65535} is not defined; define it with blocks.define() first`);
132
+ }
133
+ write(e, t, n, r, i = !0) {
134
+ let a = e >> 5, o = t >> 5, s = n >> 5, c = e & 31, l = t & 31, u = n & 31, d = this.at(a, o, s);
135
+ if (!d) {
136
+ if (!r) return 0;
137
+ d = this.addChunk(a, o, s), this.at(a, o, s);
138
+ }
139
+ let f = d.set(c, l, u, r);
140
+ if (f === r) return f;
141
+ if (this.dirty.add(this.key), this.touch(a, o, s, c ? 0 : -1, +(c === 31), l ? 0 : -1, +(l === 31), u ? 0 : -1, +(u === 31)), i) for (let i of this.listeners) i(e, t, n, r, f);
142
+ return f;
143
+ }
144
+ touch(e, t, n, r, i, a, s, c, l) {
145
+ for (let u = r; u <= i; u++) for (let r = a; r <= s; r++) for (let i = c; i <= l; i++) {
146
+ if (!(u | r | i)) continue;
147
+ let a = o(e + u, t + r, n + i);
148
+ this.chunks.has(a) && this.dirty.add(a);
149
+ }
150
+ }
151
+ };
152
+ //#endregion
153
+ export { u as i, o as n, d as r, m as t };
@@ -0,0 +1,117 @@
1
+ import { BlockTypes } from './blocks.js';
2
+ import { VoxelChunk } from './chunk.js';
3
+ /** Key of chunk (cx, cy, cz) in {@link VoxelWorld.dirty}: `'cx,cy,cz'`. Chunk coordinates are cell >> 5. */
4
+ export declare const chunkKey: (cx: number, cy: number, cz: number) => string;
5
+ /** Options of {@link VoxelWorld}. */
6
+ export interface VoxelWorldOptions {
7
+ /** The block types states refer to: setBlock rejects ids it does not define. */
8
+ blocks: BlockTypes;
9
+ /** Lowest cell y, inclusive. Default -32768 (heightmaps are 16-bit). */
10
+ minY?: number;
11
+ /** Highest cell y, inclusive. Default 32767. */
12
+ maxY?: number;
13
+ }
14
+ /**
15
+ * Package-internal (the package entry does not export it): writes `table[colors[i]]` into local cell `cells[i]`
16
+ * (`x | z << 5 | y << 10`) of chunk (cx, cy, cz) for i in from..to - 1, in that order, as one setBlock each would: the
17
+ * chunk is added (air) first when it is not loaded, onChange runs after each changed cell, and the dirty keys are the
18
+ * same (neighbours are marked once the chunk is written). Returns how many writes changed a cell. Nothing is checked:
19
+ * every `table` entry used must be a defined, non-air block state and the chunk inside minY..maxY.
20
+ */
21
+ export declare let writeChunkCells: (world: VoxelWorld, cx: number, cy: number, cz: number, cells: Uint16Array, colors: Uint8Array, table: Uint32Array, from: number, to: number) => number;
22
+ /** Package-internal removal of captured, non-air states, with all edits visible before change listeners run. */
23
+ export declare let takeMatchingCells: (world: VoxelWorld, cells: readonly (readonly [x: number, y: number, z: number, state: number])[]) => boolean;
24
+ /**
25
+ * A chunked voxel world: {@link VoxelChunk}s keyed by chunk coordinates, cells addressed by 32-bit integer
26
+ * coordinates (an unloaded cell reads as air, 0). Edits through {@link VoxelWorld.setBlock} and
27
+ * {@link VoxelWorld.setBlocks} mark the edited chunk dirty, and also each loaded neighbour whose one-cell border shell
28
+ * holds the cell (up to 7 for a corner), then call the {@link VoxelWorld.onChange} listeners.
29
+ */
30
+ export declare class VoxelWorld {
31
+ /** The block types this world's states refer to. */
32
+ readonly blocks: BlockTypes;
33
+ /** Lowest cell y, inclusive. */
34
+ readonly minY: number;
35
+ /** Highest cell y, inclusive. */
36
+ readonly maxY: number;
37
+ /**
38
+ * Keys ({@link chunkKey}) of chunks to remesh: their cells or their neighbours' border cells changed, or they were
39
+ * added; a key with no chunk was removed (drop its mesh). The consumer deletes the keys it handled.
40
+ */
41
+ readonly dirty: Set<string>;
42
+ private readonly chunks;
43
+ private readonly columns;
44
+ private readonly listeners;
45
+ private readonly chunkListeners;
46
+ private cx;
47
+ private cy;
48
+ private cz;
49
+ private key;
50
+ private chunk;
51
+ /**
52
+ * @throws TypeError when `options.blocks` is not a {@link BlockTypes} or minY/maxY is not a number.
53
+ * @throws RangeError unless minY and maxY are integers with -32768 <= minY <= maxY <= 32767.
54
+ */
55
+ constructor(options: VoxelWorldOptions);
56
+ /**
57
+ * Block state of cell (x, y, z); 0 (air) in an unloaded chunk or outside minY..maxY.
58
+ * @throws RangeError (TypeError for non-numbers) when a coordinate is not a 32-bit integer.
59
+ */
60
+ getBlock(x: number, y: number, z: number): number;
61
+ /**
62
+ * Sets cell (x, y, z) to `state` (a block id, or {@link blockState}) and returns its previous state. A non-air
63
+ * state in an unloaded chunk adds an air chunk there first.
64
+ * @throws RangeError (TypeError for non-numbers) for a coordinate that is not a 32-bit integer, y outside
65
+ * minY..maxY, a state that is not a u32, or a block id that `blocks` does not define.
66
+ */
67
+ setBlock(x: number, y: number, z: number, state: number): number;
68
+ /**
69
+ * Applies `edits`, a flat `[x, y, z, state, ...]` list (an Int32Array works: negative states are read as their
70
+ * u32 bit pattern), and returns how many cells changed. Every edit is checked before any is applied.
71
+ * @throws TypeError when `edits` is not an array-like of quadruples; otherwise as {@link VoxelWorld.setBlock}.
72
+ */
73
+ setBlocks(edits: ArrayLike<number>): number;
74
+ /**
75
+ * The chunk at chunk coordinates (cx, cy, cz), or undefined when it is not loaded.
76
+ * @throws RangeError (TypeError for non-numbers) for coordinates that are not chunk coordinates (cell >> 5).
77
+ */
78
+ getChunk(cx: number, cy: number, cz: number): VoxelChunk | undefined;
79
+ /**
80
+ * Adds `chunk` (default: a new air chunk) at chunk coordinates (cx, cy, cz) and returns it. Marks it and its 26
81
+ * loaded neighbours dirty and creates the column's heightmap if this is its first chunk. Fires no change events.
82
+ * @throws TypeError when `chunk` is not a VoxelChunk.
83
+ * @throws RangeError for invalid chunk coordinates or a chunk entirely outside minY..maxY.
84
+ * @throws MargoError `'state'` when a chunk is already loaded there.
85
+ */
86
+ addChunk(cx: number, cy: number, cz: number, chunk?: VoxelChunk): VoxelChunk;
87
+ /**
88
+ * Removes and returns the chunk at (cx, cy, cz), or undefined when none is loaded. Its key stays dirty (so its mesh
89
+ * is dropped) with its 26 loaded neighbours; the column's heightmap goes with its last chunk. Fires no change events.
90
+ * @throws RangeError (TypeError for non-numbers) for invalid chunk coordinates.
91
+ */
92
+ removeChunk(cx: number, cy: number, cz: number): VoxelChunk | undefined;
93
+ /**
94
+ * Calls `listener(cx, cy, cz, chunk)` at once for every loaded chunk and then after each addChunk (including the
95
+ * air chunk a setBlock adds, before that edit's onChange), and `listener(cx, cy, cz, undefined)` after each
96
+ * removeChunk. Returns an unsubscribe function.
97
+ * @throws TypeError when `listener` is not a function.
98
+ */
99
+ onChunk(listener: (cx: number, cy: number, cz: number, chunk: VoxelChunk | undefined) => void): () => void;
100
+ /**
101
+ * The heightmap of chunk column (cx, cz) while any of its chunks is loaded: 32 x 32 int16 heights, index
102
+ * `x | z << 5` (local x, z), each the y of the column's highest light-blocking cell or -32768 for none. Starts at
103
+ * -32768; `@margoengine/voxel/light` fills it to seed sky light.
104
+ * @throws RangeError (TypeError for non-numbers) for invalid chunk coordinates.
105
+ */
106
+ heightmap(cx: number, cz: number): Int16Array | undefined;
107
+ /**
108
+ * Calls `listener(x, y, z, state, previous)` after each cell that setBlock or setBlocks changes (once per cell,
109
+ * in edit order). Returns an unsubscribe function.
110
+ * @throws TypeError when `listener` is not a function.
111
+ */
112
+ onChange(listener: (x: number, y: number, z: number, state: number, previous: number) => void): () => void;
113
+ private at;
114
+ private check;
115
+ private write;
116
+ private touch;
117
+ }
package/package.json CHANGED
@@ -1,6 +1,175 @@
1
- {
2
- "name": "@margoengine/voxel",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
1
+ {
2
+ "name": "@margoengine/voxel",
3
+ "version": "0.1.0",
4
+ "description": "Voxel worlds: a block-type registry, 32-cubed palette chunks with light bytes, and a chunked world with dirty tracking and change events.",
5
+ "keywords": [
6
+ "margoengine",
7
+ "webgpu",
8
+ "3d",
9
+ "voxel"
10
+ ],
11
+ "homepage": "https://margoengine.com",
12
+ "bugs": {
13
+ "url": "https://github.com/scottcampbelldata/margoengine/issues"
14
+ },
15
+ "repository": {
16
+ "type": "git",
17
+ "url": "git+https://github.com/scottcampbelldata/margoengine.git",
18
+ "directory": "packages/voxel"
19
+ },
20
+ "license": "Apache-2.0",
21
+ "author": "Scott Campbell",
22
+ "type": "module",
23
+ "sideEffects": false,
24
+ "exports": {
25
+ ".": {
26
+ "types": "./dist/index.d.ts",
27
+ "import": "./dist/index.js"
28
+ },
29
+ "./query": {
30
+ "types": "./dist/query.d.ts",
31
+ "import": "./dist/query.js"
32
+ },
33
+ "./codec": {
34
+ "types": "./dist/codec.d.ts",
35
+ "import": "./dist/codec.js"
36
+ },
37
+ "./stream": {
38
+ "types": "./dist/stream.d.ts",
39
+ "import": "./dist/stream.js"
40
+ },
41
+ "./generate": {
42
+ "types": "./dist/generate.d.ts",
43
+ "import": "./dist/generate.js"
44
+ },
45
+ "./bevel": {
46
+ "types": "./dist/bevel.d.ts",
47
+ "import": "./dist/bevel.js"
48
+ },
49
+ "./mesher": {
50
+ "types": "./dist/mesher.d.ts",
51
+ "import": "./dist/mesher.js"
52
+ },
53
+ "./light": {
54
+ "types": "./dist/light.d.ts",
55
+ "import": "./dist/light.js"
56
+ },
57
+ "./vox": {
58
+ "types": "./dist/vox.d.ts",
59
+ "import": "./dist/vox.js"
60
+ },
61
+ "./physics": {
62
+ "types": "./dist/physics.d.ts",
63
+ "import": "./dist/physics.js"
64
+ },
65
+ "./granular-mpm": {
66
+ "types": "./dist/granular-mpm.d.ts",
67
+ "import": "./dist/granular-mpm.js"
68
+ },
69
+ "./render": {
70
+ "types": "./dist/render.d.ts",
71
+ "import": "./dist/render.js"
72
+ },
73
+ "./lightmap": {
74
+ "types": "./dist/lightmap.d.ts",
75
+ "import": "./dist/lightmap.js"
76
+ },
77
+ "./lod": {
78
+ "types": "./dist/lod.d.ts",
79
+ "import": "./dist/lod.js"
80
+ },
81
+ "./light-worker": {
82
+ "types": "./dist/light-worker.d.ts",
83
+ "import": "./dist/light-worker.js"
84
+ },
85
+ "./light-rgb": {
86
+ "types": "./dist/light-rgb.d.ts",
87
+ "import": "./dist/light-rgb.js"
88
+ },
89
+ "./fluids": {
90
+ "types": "./dist/fluids.d.ts",
91
+ "import": "./dist/fluids.js"
92
+ },
93
+ "./ticks": {
94
+ "types": "./dist/ticks.d.ts",
95
+ "import": "./dist/ticks.js"
96
+ },
97
+ "./gpu-mesher": {
98
+ "types": "./dist/gpu-mesher.d.ts",
99
+ "import": "./dist/gpu-mesher.js"
100
+ },
101
+ "./smooth": {
102
+ "types": "./dist/smooth.d.ts",
103
+ "import": "./dist/smooth.js"
104
+ },
105
+ "./smooth-lod": {
106
+ "types": "./dist/smooth-lod.d.ts",
107
+ "import": "./dist/smooth-lod.js"
108
+ },
109
+ "./gi": {
110
+ "types": "./dist/gi.d.ts",
111
+ "import": "./dist/gi.js"
112
+ },
113
+ "./debris": {
114
+ "types": "./dist/debris.d.ts",
115
+ "import": "./dist/debris.js"
116
+ },
117
+ "./models": {
118
+ "types": "./dist/models.d.ts",
119
+ "import": "./dist/models.js"
120
+ },
121
+ "./objects": {
122
+ "types": "./dist/objects.d.ts",
123
+ "import": "./dist/objects.js"
124
+ },
125
+ "./wind": {
126
+ "types": "./dist/wind.d.ts",
127
+ "import": "./dist/wind.js"
128
+ }
129
+ },
130
+ "files": [
131
+ "dist",
132
+ "LICENSE",
133
+ "NOTICE"
134
+ ],
135
+ "publishConfig": {
136
+ "access": "public"
137
+ },
138
+ "peerDependencies": {
139
+ "@margoengine/core": "^0.1.0",
140
+ "@margoengine/physics": "^0.1.0",
141
+ "@margoengine/materials": "^0.1.0"
142
+ },
143
+ "peerDependenciesMeta": {
144
+ "@margoengine/physics": {
145
+ "optional": true
146
+ },
147
+ "@margoengine/materials": {
148
+ "optional": true
149
+ }
150
+ },
151
+ "dependencies": {
152
+ "@margoengine/math": "^0.1.0",
153
+ "@margoengine/procedural": "^0.1.0"
154
+ },
155
+ "scripts": {
156
+ "build": "node ../../scripts/build-optional.js voxel",
157
+ "test": "npm run build && node --test tests/*.test.js",
158
+ "prepack": "npm run build",
159
+ "test:gpu": "cd ../.. && node packages/voxel/tests/render-browser-check.mjs && node packages/voxel/tests/bevel-browser-check.mjs && node packages/voxel/tests/render-lighting-browser-check.mjs && node packages/voxel/tests/lod-browser-check.mjs && node packages/voxel/tests/light-rgb-browser-check.mjs && node packages/voxel/tests/gpu-mesher-browser-check.mjs && node packages/voxel/tests/smooth-browser-check.mjs && node packages/voxel/tests/smooth-lod-browser-check.mjs && node packages/voxel/tests/gi-browser-check.mjs && node packages/voxel/tests/restore-browser-check.mjs && node packages/voxel/tests/lightmap-restore-browser-check.mjs && node packages/voxel/tests/debris-browser-check.mjs && node packages/voxel/tests/models-browser-check.mjs && node packages/voxel/tests/objects-browser-check.mjs && node packages/voxel/tests/wind-browser-check.mjs",
160
+ "test:gpu:slow-compile": "cd ../.. && node packages/voxel/tests/bevel-browser-check.mjs --pipeline-delay=500",
161
+ "test:gpu:slow-mesh": "cd ../.. && node packages/voxel/tests/bevel-browser-check.mjs --worker-delay=150"
162
+ },
163
+ "margo": {
164
+ "gpuTestSteps": {
165
+ "test:gpu:slow-compile": [
166
+ "--samples=4",
167
+ "--samples=1"
168
+ ],
169
+ "test:gpu:slow-mesh": [
170
+ "--samples=4",
171
+ "--samples=1"
172
+ ]
173
+ }
174
+ }
175
+ }