minecraft-renderer 0.1.39 → 0.1.41
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/dist/mesher.js +8 -8
- package/dist/mesher.js.map +4 -4
- package/dist/mesherWasm.js +94 -94
- package/dist/minecraft-renderer.js +57 -57
- package/dist/minecraft-renderer.js.meta.json +1 -1
- package/dist/threeWorker.js +66 -66
- package/package.json +3 -4
- package/src/bundler/bundlePrepare.ts +56 -0
- package/src/graphicsBackend/appViewer.ts +10 -0
- package/src/graphicsBackend/config.ts +5 -1
- package/src/graphicsBackend/preloadWorkers.ts +187 -0
- package/src/lib/worldrendererCommon.ts +26 -2
- package/src/{mesher → mesher-legacy}/mesher.ts +14 -4
- package/src/{mesher → mesher-legacy}/test/mesherTester.ts +2 -2
- package/src/{mesher → mesher-legacy}/test/run/test-js.ts +1 -1
- package/src/{mesher → mesher-legacy}/test/test-perf.ts +1 -1
- package/src/{mesher → mesher-legacy}/test/tests.test.ts +1 -1
- package/src/{mesher → mesher-shared}/shared.ts +2 -0
- package/src/playground/allEntitiesDebug.ts +1 -1
- package/src/three/chunkMeshManager.ts +1 -1
- package/src/three/entities.ts +19 -6
- package/src/three/entity/EntityMesh.ts +123 -140
- package/src/three/graphicsBackendBase.ts +13 -0
- package/src/three/holdingBlock.ts +1 -1
- package/src/three/holdingBlockLegacy.ts +1 -1
- package/src/three/modules/sciFiWorldReveal.ts +1 -1
- package/src/three/worldRendererThree.ts +2 -2
- package/src/wasm-mesher/README.md +90 -0
- package/src/{wasm-lib → wasm-mesher/bridge}/convertChunk.ts +2 -2
- package/src/{wasm-lib → wasm-mesher/bridge}/render-from-wasm.ts +4 -4
- package/src/wasm-mesher/runtime-build/wasm_mesher.d.ts +210 -0
- package/src/wasm-mesher/runtime-build/wasm_mesher.js +881 -0
- package/src/wasm-mesher/runtime-build/wasm_mesher_bg.wasm +0 -0
- package/src/wasm-mesher/runtime-build/wasm_mesher_bg.wasm.d.ts +24 -0
- package/src/{mesher/test → wasm-mesher/tests}/heightmapParity.test.ts +4 -4
- package/src/{mesher/test → wasm-mesher/tests}/mesherWasmConversionCache.test.ts +2 -2
- package/src/{mesher/test → wasm-mesher/tests}/splitColumnWasmOutput.test.ts +1 -1
- package/src/wasm-mesher/worker/mesherWasm.ts +1247 -0
- package/src/{mesher → wasm-mesher/worker}/mesherWasmConversionCache.ts +1 -1
- package/src/worldView/types.ts +90 -0
- package/src/mesher/mesherWasm.ts +0 -696
- package/wasm/wasm_mesher.d.ts +0 -46
- package/wasm/wasm_mesher.js +0 -443
- package/wasm/wasm_mesher_bg.wasm +0 -0
- package/wasm/wasm_mesher_bg.wasm.d.ts +0 -9
- /package/src/{mesher → mesher-legacy}/test/a.ts +0 -0
- /package/src/{mesher → mesher-legacy}/test/playground.ts +0 -0
- /package/src/{mesher → mesher-legacy}/test/run/chunk.ts +0 -0
- /package/src/{mesher → mesher-legacy}/test/snapshotUtils.ts +0 -0
- /package/src/{mesher → mesher-shared}/blockEntityMetadata.ts +0 -0
- /package/src/{mesher → mesher-shared}/computeHeightmap.ts +0 -0
- /package/src/{mesher → mesher-shared}/models.ts +0 -0
- /package/src/{mesher → mesher-shared}/modelsGeometryCommon.ts +0 -0
- /package/src/{mesher → mesher-shared}/standaloneRenderer.ts +0 -0
- /package/src/{mesher → mesher-shared}/world.ts +0 -0
- /package/src/{mesher → mesher-shared}/worldConstants.ts +0 -0
- /package/src/{mesher → wasm-mesher/worker}/mesherWasmRequestTracker.ts +0 -0
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
// but changes content. The `blockUpdate` handler explicitly invalidates
|
|
22
22
|
// the affected `(chunkX, chunkZ)` to handle this.
|
|
23
23
|
|
|
24
|
-
import type { ChunkConversionResult } from '../
|
|
24
|
+
import type { ChunkConversionResult } from '../bridge/convertChunk'
|
|
25
25
|
|
|
26
26
|
// Hard cap on entries. A 12x12 visible area ≈ 144 columns; 64 keeps the hot
|
|
27
27
|
// ~8x8 window resident. Tunable.
|
package/src/worldView/types.ts
CHANGED
|
@@ -39,11 +39,101 @@ export interface UnloadChunkData {
|
|
|
39
39
|
z: number
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
+
/**
|
|
43
|
+
* Raw `map_chunk` packet payload forwarded to the WASM mesher worker.
|
|
44
|
+
* Stage 3 of issue-15-wasm — lets the worker call `parseMapChunkV18Plus`
|
|
45
|
+
* directly on the bytes mineflayer received, bypassing the JS hot loop
|
|
46
|
+
* `convertChunkToWasm` for protocol >= 757 (1.18+).
|
|
47
|
+
*/
|
|
48
|
+
export interface RawMapChunkData {
|
|
49
|
+
x: number
|
|
50
|
+
z: number
|
|
51
|
+
rawPacket: Uint8Array
|
|
52
|
+
protocol: number
|
|
53
|
+
numSections: number
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Pre-parsed `map_chunk` payload for protocol 756 (1.17/1.17.1).
|
|
58
|
+
* The 1.17 wire format is split across two packets (`map_chunk` for
|
|
59
|
+
* blocks/biomes/heightmaps and `update_light` for lighting), so we feed the
|
|
60
|
+
* WASM parser only the section bytes plus the bit-mask. Mineflayer already
|
|
61
|
+
* does the cheap top-level parsing for us; we just hand the
|
|
62
|
+
* already-extracted `chunkData` and `bitMap` to the worker.
|
|
63
|
+
*/
|
|
64
|
+
export interface ParsedMapChunkV17Data {
|
|
65
|
+
x: number
|
|
66
|
+
z: number
|
|
67
|
+
protocol: number
|
|
68
|
+
numSections: number
|
|
69
|
+
maxBitsPerBlock: number
|
|
70
|
+
chunkData: Uint8Array
|
|
71
|
+
/** Section bit mask flattened as [lo0, hi0, lo1, hi1, ...] u32 pairs. */
|
|
72
|
+
bitMapLoHi: Uint32Array
|
|
73
|
+
/** Optional flat biomes (1024 entries, 4×4×4 cells per column). */
|
|
74
|
+
biomes?: Int32Array
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Raw `update_light` payload for protocol 755/756 (1.17/1.17.1). The
|
|
79
|
+
* worker decodes (chunkX, chunkZ) out of the varints in `rawPacket` via
|
|
80
|
+
* `parseUpdateLightV17` — JS doesn't peek at coords, so the packet bytes
|
|
81
|
+
* are forwarded verbatim (with the leading packet-id varint included).
|
|
82
|
+
*/
|
|
83
|
+
export interface UpdateLightV17Data {
|
|
84
|
+
protocol: number
|
|
85
|
+
numSections: number
|
|
86
|
+
rawPacket: Uint8Array
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Pre-parsed `map_chunk` payload for the 1.16.x family (protocols
|
|
91
|
+
* 735, 736, 751, 753, 754). Wire format for chunk sections is identical
|
|
92
|
+
* to 1.17, so the worker reuses `parseChunkSectionsV16V17`. The bit mask
|
|
93
|
+
* is a single varint in 1.16 (only 16 sections), forwarded as a plain
|
|
94
|
+
* number; the worker widens it to a [lo,hi] u32 pair.
|
|
95
|
+
*/
|
|
96
|
+
export interface ParsedMapChunkV16Data {
|
|
97
|
+
x: number
|
|
98
|
+
z: number
|
|
99
|
+
protocol: number
|
|
100
|
+
chunkData: Uint8Array
|
|
101
|
+
bitMap: number
|
|
102
|
+
/** Flat 1024-entry biome cells (4×4×4 per column). */
|
|
103
|
+
biomes: Int32Array
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* Raw `update_light` payload for the 1.16.x family. Same wire format as
|
|
108
|
+
* 1.17, so the worker calls `parseUpdateLightV17` on the bytes; the
|
|
109
|
+
* result lands in a separate v16 light cache to keep the two protocol
|
|
110
|
+
* families isolated.
|
|
111
|
+
*/
|
|
112
|
+
export interface UpdateLightV16Data {
|
|
113
|
+
x: number
|
|
114
|
+
z: number
|
|
115
|
+
protocol: number
|
|
116
|
+
rawPacket: Uint8Array
|
|
117
|
+
}
|
|
118
|
+
|
|
42
119
|
/** Biome update event data */
|
|
43
120
|
export interface BiomeUpdateData {
|
|
44
121
|
biome: any
|
|
45
122
|
}
|
|
46
123
|
|
|
124
|
+
/**
|
|
125
|
+
* Discriminated union forwarded to the WASM mesher workers via the
|
|
126
|
+
* `feedChunkPacket` backend method. `kind` matches the worker message
|
|
127
|
+
* `type` so the backend method can forward the payload verbatim to
|
|
128
|
+
* `worker.postMessage`.
|
|
129
|
+
*/
|
|
130
|
+
export type FeedChunkPacketPayload =
|
|
131
|
+
| ({ kind: 'setRawMapChunk' } & RawMapChunkData)
|
|
132
|
+
| ({ kind: 'setParsedMapChunkV17' } & ParsedMapChunkV17Data)
|
|
133
|
+
| ({ kind: 'setUpdateLightV17' } & UpdateLightV17Data)
|
|
134
|
+
| ({ kind: 'setParsedMapChunkV16' } & ParsedMapChunkV16Data)
|
|
135
|
+
| ({ kind: 'setUpdateLightV16' } & UpdateLightV16Data)
|
|
136
|
+
|
|
47
137
|
/**
|
|
48
138
|
* WorldView events emitted to the renderer.
|
|
49
139
|
*/
|