nucleation 0.1.156 → 0.1.166
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/nucleation-original.js +1340 -85
- package/nucleation.d.ts +605 -13
- package/nucleation_bg.wasm +0 -0
- package/package.json +1 -1
package/nucleation-original.js
CHANGED
|
@@ -81,6 +81,11 @@ function debugString(val) {
|
|
|
81
81
|
return className;
|
|
82
82
|
}
|
|
83
83
|
|
|
84
|
+
function getArrayF32FromWasm0(ptr, len) {
|
|
85
|
+
ptr = ptr >>> 0;
|
|
86
|
+
return getFloat32ArrayMemory0().subarray(ptr / 4, ptr / 4 + len);
|
|
87
|
+
}
|
|
88
|
+
|
|
84
89
|
function getArrayI32FromWasm0(ptr, len) {
|
|
85
90
|
ptr = ptr >>> 0;
|
|
86
91
|
return getInt32ArrayMemory0().subarray(ptr / 4, ptr / 4 + len);
|
|
@@ -97,6 +102,11 @@ function getArrayJsValueFromWasm0(ptr, len) {
|
|
|
97
102
|
return result;
|
|
98
103
|
}
|
|
99
104
|
|
|
105
|
+
function getArrayU32FromWasm0(ptr, len) {
|
|
106
|
+
ptr = ptr >>> 0;
|
|
107
|
+
return getUint32ArrayMemory0().subarray(ptr / 4, ptr / 4 + len);
|
|
108
|
+
}
|
|
109
|
+
|
|
100
110
|
function getArrayU8FromWasm0(ptr, len) {
|
|
101
111
|
ptr = ptr >>> 0;
|
|
102
112
|
return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
|
|
@@ -110,6 +120,14 @@ function getDataViewMemory0() {
|
|
|
110
120
|
return cachedDataViewMemory0;
|
|
111
121
|
}
|
|
112
122
|
|
|
123
|
+
let cachedFloat32ArrayMemory0 = null;
|
|
124
|
+
function getFloat32ArrayMemory0() {
|
|
125
|
+
if (cachedFloat32ArrayMemory0 === null || cachedFloat32ArrayMemory0.byteLength === 0) {
|
|
126
|
+
cachedFloat32ArrayMemory0 = new Float32Array(wasm.memory.buffer);
|
|
127
|
+
}
|
|
128
|
+
return cachedFloat32ArrayMemory0;
|
|
129
|
+
}
|
|
130
|
+
|
|
113
131
|
let cachedInt32ArrayMemory0 = null;
|
|
114
132
|
function getInt32ArrayMemory0() {
|
|
115
133
|
if (cachedInt32ArrayMemory0 === null || cachedInt32ArrayMemory0.byteLength === 0) {
|
|
@@ -260,6 +278,14 @@ const BrushWrapperFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
|
260
278
|
? { register: () => {}, unregister: () => {} }
|
|
261
279
|
: new FinalizationRegistry(ptr => wasm.__wbg_brushwrapper_free(ptr >>> 0, 1));
|
|
262
280
|
|
|
281
|
+
const ChunkMeshIteratorWrapperFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
282
|
+
? { register: () => {}, unregister: () => {} }
|
|
283
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_chunkmeshiteratorwrapper_free(ptr >>> 0, 1));
|
|
284
|
+
|
|
285
|
+
const ChunkMeshResultWrapperFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
286
|
+
? { register: () => {}, unregister: () => {} }
|
|
287
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_chunkmeshresultwrapper_free(ptr >>> 0, 1));
|
|
288
|
+
|
|
263
289
|
const CircuitBuilderWrapperFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
264
290
|
? { register: () => {}, unregister: () => {} }
|
|
265
291
|
: new FinalizationRegistry(ptr => wasm.__wbg_circuitbuilderwrapper_free(ptr >>> 0, 1));
|
|
@@ -296,6 +322,18 @@ const MchprsWorldWrapperFinalization = (typeof FinalizationRegistry === 'undefin
|
|
|
296
322
|
? { register: () => {}, unregister: () => {} }
|
|
297
323
|
: new FinalizationRegistry(ptr => wasm.__wbg_mchprsworldwrapper_free(ptr >>> 0, 1));
|
|
298
324
|
|
|
325
|
+
const MeshConfigWrapperFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
326
|
+
? { register: () => {}, unregister: () => {} }
|
|
327
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_meshconfigwrapper_free(ptr >>> 0, 1));
|
|
328
|
+
|
|
329
|
+
const MeshOutputWrapperFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
330
|
+
? { register: () => {}, unregister: () => {} }
|
|
331
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_meshoutputwrapper_free(ptr >>> 0, 1));
|
|
332
|
+
|
|
333
|
+
const MultiMeshResultWrapperFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
334
|
+
? { register: () => {}, unregister: () => {} }
|
|
335
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_multimeshresultwrapper_free(ptr >>> 0, 1));
|
|
336
|
+
|
|
299
337
|
const OutputConditionWrapperFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
300
338
|
? { register: () => {}, unregister: () => {} }
|
|
301
339
|
: new FinalizationRegistry(ptr => wasm.__wbg_outputconditionwrapper_free(ptr >>> 0, 1));
|
|
@@ -304,6 +342,14 @@ const PaletteManagerFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
|
304
342
|
? { register: () => {}, unregister: () => {} }
|
|
305
343
|
: new FinalizationRegistry(ptr => wasm.__wbg_palettemanager_free(ptr >>> 0, 1));
|
|
306
344
|
|
|
345
|
+
const RawMeshExportWrapperFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
346
|
+
? { register: () => {}, unregister: () => {} }
|
|
347
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_rawmeshexportwrapper_free(ptr >>> 0, 1));
|
|
348
|
+
|
|
349
|
+
const ResourcePackWrapperFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
350
|
+
? { register: () => {}, unregister: () => {} }
|
|
351
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_resourcepackwrapper_free(ptr >>> 0, 1));
|
|
352
|
+
|
|
307
353
|
const SchematicBuilderWrapperFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
308
354
|
? { register: () => {}, unregister: () => {} }
|
|
309
355
|
: new FinalizationRegistry(ptr => wasm.__wbg_schematicbuilderwrapper_free(ptr >>> 0, 1));
|
|
@@ -328,6 +374,10 @@ const StateModeConstantsFinalization = (typeof FinalizationRegistry === 'undefin
|
|
|
328
374
|
? { register: () => {}, unregister: () => {} }
|
|
329
375
|
: new FinalizationRegistry(ptr => wasm.__wbg_statemodeconstants_free(ptr >>> 0, 1));
|
|
330
376
|
|
|
377
|
+
const TextureAtlasWrapperFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
378
|
+
? { register: () => {}, unregister: () => {} }
|
|
379
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_textureatlaswrapper_free(ptr >>> 0, 1));
|
|
380
|
+
|
|
331
381
|
const TypedCircuitExecutorWrapperFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
332
382
|
? { register: () => {}, unregister: () => {} }
|
|
333
383
|
: new FinalizationRegistry(ptr => wasm.__wbg_typedcircuitexecutorwrapper_free(ptr >>> 0, 1));
|
|
@@ -623,6 +673,170 @@ export class BrushWrapper {
|
|
|
623
673
|
}
|
|
624
674
|
if (Symbol.dispose) BrushWrapper.prototype[Symbol.dispose] = BrushWrapper.prototype.free;
|
|
625
675
|
|
|
676
|
+
/**
|
|
677
|
+
* Lazy chunk mesh iterator for WASM.
|
|
678
|
+
*
|
|
679
|
+
* Pull-based: call `advance()` to step to the next chunk, then
|
|
680
|
+
* `current()` to get the [`MeshOutputWrapper`].
|
|
681
|
+
*/
|
|
682
|
+
export class ChunkMeshIteratorWrapper {
|
|
683
|
+
static __wrap(ptr) {
|
|
684
|
+
ptr = ptr >>> 0;
|
|
685
|
+
const obj = Object.create(ChunkMeshIteratorWrapper.prototype);
|
|
686
|
+
obj.__wbg_ptr = ptr;
|
|
687
|
+
ChunkMeshIteratorWrapperFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
688
|
+
return obj;
|
|
689
|
+
}
|
|
690
|
+
__destroy_into_raw() {
|
|
691
|
+
const ptr = this.__wbg_ptr;
|
|
692
|
+
this.__wbg_ptr = 0;
|
|
693
|
+
ChunkMeshIteratorWrapperFinalization.unregister(this);
|
|
694
|
+
return ptr;
|
|
695
|
+
}
|
|
696
|
+
free() {
|
|
697
|
+
const ptr = this.__destroy_into_raw();
|
|
698
|
+
wasm.__wbg_chunkmeshiteratorwrapper_free(ptr, 0);
|
|
699
|
+
}
|
|
700
|
+
/**
|
|
701
|
+
* Total number of chunks in the iterator.
|
|
702
|
+
* @returns {number}
|
|
703
|
+
*/
|
|
704
|
+
chunkCount() {
|
|
705
|
+
const ret = wasm.chunkmeshiteratorwrapper_chunkCount(this.__wbg_ptr);
|
|
706
|
+
return ret >>> 0;
|
|
707
|
+
}
|
|
708
|
+
/**
|
|
709
|
+
* Get the shared atlas (if any). Returns null if no shared atlas was set.
|
|
710
|
+
* @returns {TextureAtlasWrapper | undefined}
|
|
711
|
+
*/
|
|
712
|
+
sharedAtlas() {
|
|
713
|
+
const ret = wasm.chunkmeshiteratorwrapper_sharedAtlas(this.__wbg_ptr);
|
|
714
|
+
return ret === 0 ? undefined : TextureAtlasWrapper.__wrap(ret);
|
|
715
|
+
}
|
|
716
|
+
/**
|
|
717
|
+
* Get the chunk coordinate of the current mesh as [cx, cy, cz].
|
|
718
|
+
* @returns {any}
|
|
719
|
+
*/
|
|
720
|
+
currentCoord() {
|
|
721
|
+
const ret = wasm.chunkmeshiteratorwrapper_currentCoord(this.__wbg_ptr);
|
|
722
|
+
return ret;
|
|
723
|
+
}
|
|
724
|
+
/**
|
|
725
|
+
* Whether this iterator uses a shared global atlas.
|
|
726
|
+
* @returns {boolean}
|
|
727
|
+
*/
|
|
728
|
+
get hasSharedAtlas() {
|
|
729
|
+
const ret = wasm.chunkmeshiteratorwrapper_hasSharedAtlas(this.__wbg_ptr);
|
|
730
|
+
return ret !== 0;
|
|
731
|
+
}
|
|
732
|
+
/**
|
|
733
|
+
* Set a progress callback invoked after each chunk is meshed.
|
|
734
|
+
*
|
|
735
|
+
* The callback receives a JS object with fields:
|
|
736
|
+
* `{ phase: string, chunksDone: number, chunksTotal: number, verticesSoFar: number, trianglesSoFar: number }`
|
|
737
|
+
* @param {Function} callback
|
|
738
|
+
*/
|
|
739
|
+
setProgressCallback(callback) {
|
|
740
|
+
wasm.chunkmeshiteratorwrapper_setProgressCallback(this.__wbg_ptr, callback);
|
|
741
|
+
}
|
|
742
|
+
/**
|
|
743
|
+
* Advance to the next chunk. Returns `true` if a chunk is available.
|
|
744
|
+
* @returns {boolean}
|
|
745
|
+
*/
|
|
746
|
+
advance() {
|
|
747
|
+
const ret = wasm.chunkmeshiteratorwrapper_advance(this.__wbg_ptr);
|
|
748
|
+
if (ret[2]) {
|
|
749
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
750
|
+
}
|
|
751
|
+
return ret[0] !== 0;
|
|
752
|
+
}
|
|
753
|
+
/**
|
|
754
|
+
* Get the current chunk mesh (after a successful `advance()`).
|
|
755
|
+
* Returns null if no current mesh.
|
|
756
|
+
* @returns {MeshOutputWrapper | undefined}
|
|
757
|
+
*/
|
|
758
|
+
current() {
|
|
759
|
+
const ret = wasm.chunkmeshiteratorwrapper_current(this.__wbg_ptr);
|
|
760
|
+
return ret === 0 ? undefined : MeshOutputWrapper.__wrap(ret);
|
|
761
|
+
}
|
|
762
|
+
}
|
|
763
|
+
if (Symbol.dispose) ChunkMeshIteratorWrapper.prototype[Symbol.dispose] = ChunkMeshIteratorWrapper.prototype.free;
|
|
764
|
+
|
|
765
|
+
/**
|
|
766
|
+
* Result of chunk-based mesh generation (eager, all at once).
|
|
767
|
+
*/
|
|
768
|
+
export class ChunkMeshResultWrapper {
|
|
769
|
+
static __wrap(ptr) {
|
|
770
|
+
ptr = ptr >>> 0;
|
|
771
|
+
const obj = Object.create(ChunkMeshResultWrapper.prototype);
|
|
772
|
+
obj.__wbg_ptr = ptr;
|
|
773
|
+
ChunkMeshResultWrapperFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
774
|
+
return obj;
|
|
775
|
+
}
|
|
776
|
+
__destroy_into_raw() {
|
|
777
|
+
const ptr = this.__wbg_ptr;
|
|
778
|
+
this.__wbg_ptr = 0;
|
|
779
|
+
ChunkMeshResultWrapperFinalization.unregister(this);
|
|
780
|
+
return ptr;
|
|
781
|
+
}
|
|
782
|
+
free() {
|
|
783
|
+
const ptr = this.__destroy_into_raw();
|
|
784
|
+
wasm.__wbg_chunkmeshresultwrapper_free(ptr, 0);
|
|
785
|
+
}
|
|
786
|
+
/**
|
|
787
|
+
* Get the number of chunks.
|
|
788
|
+
* @returns {number}
|
|
789
|
+
*/
|
|
790
|
+
get chunkCount() {
|
|
791
|
+
const ret = wasm.chunkmeshresultwrapper_chunkCount(this.__wbg_ptr);
|
|
792
|
+
return ret >>> 0;
|
|
793
|
+
}
|
|
794
|
+
/**
|
|
795
|
+
* Get the total vertex count.
|
|
796
|
+
* @returns {number}
|
|
797
|
+
*/
|
|
798
|
+
get totalVertexCount() {
|
|
799
|
+
const ret = wasm.chunkmeshresultwrapper_totalVertexCount(this.__wbg_ptr);
|
|
800
|
+
return ret >>> 0;
|
|
801
|
+
}
|
|
802
|
+
/**
|
|
803
|
+
* Get the total triangle count.
|
|
804
|
+
* @returns {number}
|
|
805
|
+
*/
|
|
806
|
+
get totalTriangleCount() {
|
|
807
|
+
const ret = wasm.chunkmeshresultwrapper_totalTriangleCount(this.__wbg_ptr);
|
|
808
|
+
return ret >>> 0;
|
|
809
|
+
}
|
|
810
|
+
/**
|
|
811
|
+
* Get the chunk coordinates as an array of [x, y, z] arrays.
|
|
812
|
+
* @returns {Array<any>}
|
|
813
|
+
*/
|
|
814
|
+
getChunkCoordinates() {
|
|
815
|
+
const ret = wasm.chunkmeshresultwrapper_getChunkCoordinates(this.__wbg_ptr);
|
|
816
|
+
return ret;
|
|
817
|
+
}
|
|
818
|
+
/**
|
|
819
|
+
* Serialize all chunks to NUCM binary cache format as Uint8Array.
|
|
820
|
+
* @returns {Uint8Array}
|
|
821
|
+
*/
|
|
822
|
+
toNucm() {
|
|
823
|
+
const ret = wasm.chunkmeshresultwrapper_toNucm(this.__wbg_ptr);
|
|
824
|
+
return ret;
|
|
825
|
+
}
|
|
826
|
+
/**
|
|
827
|
+
* Get the mesh for a specific chunk.
|
|
828
|
+
* @param {number} cx
|
|
829
|
+
* @param {number} cy
|
|
830
|
+
* @param {number} cz
|
|
831
|
+
* @returns {MeshOutputWrapper | undefined}
|
|
832
|
+
*/
|
|
833
|
+
getMesh(cx, cy, cz) {
|
|
834
|
+
const ret = wasm.chunkmeshresultwrapper_getMesh(this.__wbg_ptr, cx, cy, cz);
|
|
835
|
+
return ret === 0 ? undefined : MeshOutputWrapper.__wrap(ret);
|
|
836
|
+
}
|
|
837
|
+
}
|
|
838
|
+
if (Symbol.dispose) ChunkMeshResultWrapper.prototype[Symbol.dispose] = ChunkMeshResultWrapper.prototype.free;
|
|
839
|
+
|
|
626
840
|
/**
|
|
627
841
|
* CircuitBuilder wrapper for JavaScript
|
|
628
842
|
* Provides a fluent API for creating TypedCircuitExecutor instances
|
|
@@ -2288,135 +2502,956 @@ export class MchprsWorldWrapper {
|
|
|
2288
2502
|
if (Symbol.dispose) MchprsWorldWrapper.prototype[Symbol.dispose] = MchprsWorldWrapper.prototype.free;
|
|
2289
2503
|
|
|
2290
2504
|
/**
|
|
2291
|
-
*
|
|
2505
|
+
* Configuration for mesh generation.
|
|
2292
2506
|
*/
|
|
2293
|
-
export class
|
|
2507
|
+
export class MeshConfigWrapper {
|
|
2508
|
+
__destroy_into_raw() {
|
|
2509
|
+
const ptr = this.__wbg_ptr;
|
|
2510
|
+
this.__wbg_ptr = 0;
|
|
2511
|
+
MeshConfigWrapperFinalization.unregister(this);
|
|
2512
|
+
return ptr;
|
|
2513
|
+
}
|
|
2514
|
+
free() {
|
|
2515
|
+
const ptr = this.__destroy_into_raw();
|
|
2516
|
+
wasm.__wbg_meshconfigwrapper_free(ptr, 0);
|
|
2517
|
+
}
|
|
2518
|
+
/**
|
|
2519
|
+
* Get the AO intensity.
|
|
2520
|
+
* @returns {number}
|
|
2521
|
+
*/
|
|
2522
|
+
get aoIntensity() {
|
|
2523
|
+
const ret = wasm.meshconfigwrapper_aoIntensity(this.__wbg_ptr);
|
|
2524
|
+
return ret;
|
|
2525
|
+
}
|
|
2526
|
+
/**
|
|
2527
|
+
* Get the maximum atlas size.
|
|
2528
|
+
* @returns {number}
|
|
2529
|
+
*/
|
|
2530
|
+
get atlasMaxSize() {
|
|
2531
|
+
const ret = wasm.chunkmeshresultwrapper_chunkCount(this.__wbg_ptr);
|
|
2532
|
+
return ret >>> 0;
|
|
2533
|
+
}
|
|
2534
|
+
/**
|
|
2535
|
+
* Get whether greedy meshing is enabled.
|
|
2536
|
+
* @returns {boolean}
|
|
2537
|
+
*/
|
|
2538
|
+
get greedyMeshing() {
|
|
2539
|
+
const ret = wasm.meshconfigwrapper_greedyMeshing(this.__wbg_ptr);
|
|
2540
|
+
return ret !== 0;
|
|
2541
|
+
}
|
|
2542
|
+
/**
|
|
2543
|
+
* Set the AO intensity (0.0 = no darkening, 1.0 = full darkening).
|
|
2544
|
+
* @param {number} intensity
|
|
2545
|
+
*/
|
|
2546
|
+
setAoIntensity(intensity) {
|
|
2547
|
+
wasm.meshconfigwrapper_setAoIntensity(this.__wbg_ptr, intensity);
|
|
2548
|
+
}
|
|
2549
|
+
/**
|
|
2550
|
+
* Get whether ambient occlusion is enabled.
|
|
2551
|
+
* @returns {boolean}
|
|
2552
|
+
*/
|
|
2553
|
+
get ambientOcclusion() {
|
|
2554
|
+
const ret = wasm.meshconfigwrapper_ambientOcclusion(this.__wbg_ptr);
|
|
2555
|
+
return ret !== 0;
|
|
2556
|
+
}
|
|
2557
|
+
/**
|
|
2558
|
+
* Get whether face culling is enabled.
|
|
2559
|
+
* @returns {boolean}
|
|
2560
|
+
*/
|
|
2561
|
+
get cullHiddenFaces() {
|
|
2562
|
+
const ret = wasm.meshconfigwrapper_cullHiddenFaces(this.__wbg_ptr);
|
|
2563
|
+
return ret !== 0;
|
|
2564
|
+
}
|
|
2565
|
+
/**
|
|
2566
|
+
* Set the maximum atlas texture size.
|
|
2567
|
+
* @param {number} size
|
|
2568
|
+
*/
|
|
2569
|
+
setAtlasMaxSize(size) {
|
|
2570
|
+
wasm.meshconfigwrapper_setAtlasMaxSize(this.__wbg_ptr, size);
|
|
2571
|
+
}
|
|
2572
|
+
/**
|
|
2573
|
+
* Enable or disable greedy meshing.
|
|
2574
|
+
* @param {boolean} enabled
|
|
2575
|
+
*/
|
|
2576
|
+
setGreedyMeshing(enabled) {
|
|
2577
|
+
wasm.meshconfigwrapper_setGreedyMeshing(this.__wbg_ptr, enabled);
|
|
2578
|
+
}
|
|
2579
|
+
/**
|
|
2580
|
+
* Get whether occluded block culling is enabled.
|
|
2581
|
+
* @returns {boolean}
|
|
2582
|
+
*/
|
|
2583
|
+
get cullOccludedBlocks() {
|
|
2584
|
+
const ret = wasm.meshconfigwrapper_cullOccludedBlocks(this.__wbg_ptr);
|
|
2585
|
+
return ret !== 0;
|
|
2586
|
+
}
|
|
2587
|
+
/**
|
|
2588
|
+
* Enable or disable ambient occlusion.
|
|
2589
|
+
* @param {boolean} enabled
|
|
2590
|
+
*/
|
|
2591
|
+
setAmbientOcclusion(enabled) {
|
|
2592
|
+
wasm.meshconfigwrapper_setAmbientOcclusion(this.__wbg_ptr, enabled);
|
|
2593
|
+
}
|
|
2594
|
+
/**
|
|
2595
|
+
* Enable or disable face culling between adjacent blocks.
|
|
2596
|
+
* @param {boolean} enabled
|
|
2597
|
+
*/
|
|
2598
|
+
setCullHiddenFaces(enabled) {
|
|
2599
|
+
wasm.meshconfigwrapper_setCullHiddenFaces(this.__wbg_ptr, enabled);
|
|
2600
|
+
}
|
|
2601
|
+
/**
|
|
2602
|
+
* Enable or disable occluded block culling.
|
|
2603
|
+
* @param {boolean} enabled
|
|
2604
|
+
*/
|
|
2605
|
+
setCullOccludedBlocks(enabled) {
|
|
2606
|
+
wasm.meshconfigwrapper_setCullOccludedBlocks(this.__wbg_ptr, enabled);
|
|
2607
|
+
}
|
|
2608
|
+
/**
|
|
2609
|
+
* Create a new MeshConfig with default settings.
|
|
2610
|
+
*/
|
|
2611
|
+
constructor() {
|
|
2612
|
+
const ret = wasm.meshconfigwrapper_new();
|
|
2613
|
+
this.__wbg_ptr = ret >>> 0;
|
|
2614
|
+
MeshConfigWrapperFinalization.register(this, this.__wbg_ptr, this);
|
|
2615
|
+
return this;
|
|
2616
|
+
}
|
|
2617
|
+
/**
|
|
2618
|
+
* Get the biome name.
|
|
2619
|
+
* @returns {string | undefined}
|
|
2620
|
+
*/
|
|
2621
|
+
get biome() {
|
|
2622
|
+
const ret = wasm.meshconfigwrapper_biome(this.__wbg_ptr);
|
|
2623
|
+
let v1;
|
|
2624
|
+
if (ret[0] !== 0) {
|
|
2625
|
+
v1 = getStringFromWasm0(ret[0], ret[1]).slice();
|
|
2626
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
2627
|
+
}
|
|
2628
|
+
return v1;
|
|
2629
|
+
}
|
|
2630
|
+
/**
|
|
2631
|
+
* Set the biome for tinting (e.g., "plains", "swamp").
|
|
2632
|
+
* @param {string} biome
|
|
2633
|
+
*/
|
|
2634
|
+
setBiome(biome) {
|
|
2635
|
+
const ptr0 = passStringToWasm0(biome, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
2636
|
+
const len0 = WASM_VECTOR_LEN;
|
|
2637
|
+
wasm.meshconfigwrapper_setBiome(this.__wbg_ptr, ptr0, len0);
|
|
2638
|
+
}
|
|
2639
|
+
}
|
|
2640
|
+
if (Symbol.dispose) MeshConfigWrapper.prototype[Symbol.dispose] = MeshConfigWrapper.prototype.free;
|
|
2641
|
+
|
|
2642
|
+
/**
|
|
2643
|
+
* WASM wrapper for [`MeshOutput`].
|
|
2644
|
+
*
|
|
2645
|
+
* Exposes per-layer typed arrays (opaque, cutout, transparent), shared atlas,
|
|
2646
|
+
* export helpers, and metadata. This is the primary return type for all
|
|
2647
|
+
* meshing methods.
|
|
2648
|
+
*/
|
|
2649
|
+
export class MeshOutputWrapper {
|
|
2294
2650
|
static __wrap(ptr) {
|
|
2295
2651
|
ptr = ptr >>> 0;
|
|
2296
|
-
const obj = Object.create(
|
|
2652
|
+
const obj = Object.create(MeshOutputWrapper.prototype);
|
|
2297
2653
|
obj.__wbg_ptr = ptr;
|
|
2298
|
-
|
|
2654
|
+
MeshOutputWrapperFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
2299
2655
|
return obj;
|
|
2300
2656
|
}
|
|
2301
2657
|
__destroy_into_raw() {
|
|
2302
2658
|
const ptr = this.__wbg_ptr;
|
|
2303
2659
|
this.__wbg_ptr = 0;
|
|
2304
|
-
|
|
2660
|
+
MeshOutputWrapperFinalization.unregister(this);
|
|
2305
2661
|
return ptr;
|
|
2306
2662
|
}
|
|
2307
|
-
free() {
|
|
2308
|
-
const ptr = this.__destroy_into_raw();
|
|
2309
|
-
wasm.
|
|
2663
|
+
free() {
|
|
2664
|
+
const ptr = this.__destroy_into_raw();
|
|
2665
|
+
wasm.__wbg_meshoutputwrapper_free(ptr, 0);
|
|
2666
|
+
}
|
|
2667
|
+
/**
|
|
2668
|
+
* Shared texture atlas RGBA pixel data as Uint8Array.
|
|
2669
|
+
* @returns {Uint8Array}
|
|
2670
|
+
*/
|
|
2671
|
+
atlasRgba() {
|
|
2672
|
+
const ret = wasm.meshoutputwrapper_atlasRgba(this.__wbg_ptr);
|
|
2673
|
+
return ret;
|
|
2674
|
+
}
|
|
2675
|
+
/**
|
|
2676
|
+
* Cutout layer texture coordinates as Float32Array.
|
|
2677
|
+
* @returns {Float32Array}
|
|
2678
|
+
*/
|
|
2679
|
+
cutoutUvs() {
|
|
2680
|
+
const ret = wasm.meshoutputwrapper_cutoutUvs(this.__wbg_ptr);
|
|
2681
|
+
return ret;
|
|
2682
|
+
}
|
|
2683
|
+
/**
|
|
2684
|
+
* Opaque layer texture coordinates as Float32Array (u,v per vertex).
|
|
2685
|
+
* @returns {Float32Array}
|
|
2686
|
+
*/
|
|
2687
|
+
opaqueUvs() {
|
|
2688
|
+
const ret = wasm.meshoutputwrapper_opaqueUvs(this.__wbg_ptr);
|
|
2689
|
+
return ret;
|
|
2690
|
+
}
|
|
2691
|
+
/**
|
|
2692
|
+
* Atlas width in pixels.
|
|
2693
|
+
* @returns {number}
|
|
2694
|
+
*/
|
|
2695
|
+
get atlasWidth() {
|
|
2696
|
+
const ret = wasm.meshoutputwrapper_atlasWidth(this.__wbg_ptr);
|
|
2697
|
+
return ret >>> 0;
|
|
2698
|
+
}
|
|
2699
|
+
/**
|
|
2700
|
+
* Chunk coordinate as [cx, cy, cz] or null if not a chunk mesh.
|
|
2701
|
+
* @returns {any}
|
|
2702
|
+
*/
|
|
2703
|
+
chunkCoord() {
|
|
2704
|
+
const ret = wasm.meshoutputwrapper_chunkCoord(this.__wbg_ptr);
|
|
2705
|
+
return ret;
|
|
2706
|
+
}
|
|
2707
|
+
/**
|
|
2708
|
+
* Atlas height in pixels.
|
|
2709
|
+
* @returns {number}
|
|
2710
|
+
*/
|
|
2711
|
+
get atlasHeight() {
|
|
2712
|
+
const ret = wasm.meshoutputwrapper_atlasHeight(this.__wbg_ptr);
|
|
2713
|
+
return ret >>> 0;
|
|
2714
|
+
}
|
|
2715
|
+
/**
|
|
2716
|
+
* Get the vertex count (backward-compat).
|
|
2717
|
+
* @returns {number}
|
|
2718
|
+
*/
|
|
2719
|
+
get vertexCount() {
|
|
2720
|
+
const ret = wasm.meshoutputwrapper_totalVertices(this.__wbg_ptr);
|
|
2721
|
+
return ret >>> 0;
|
|
2722
|
+
}
|
|
2723
|
+
/**
|
|
2724
|
+
* Cutout layer vertex colors as Float32Array.
|
|
2725
|
+
* @returns {Float32Array}
|
|
2726
|
+
*/
|
|
2727
|
+
cutoutColors() {
|
|
2728
|
+
const ret = wasm.meshoutputwrapper_cutoutColors(this.__wbg_ptr);
|
|
2729
|
+
return ret;
|
|
2730
|
+
}
|
|
2731
|
+
/**
|
|
2732
|
+
* Opaque layer vertex colors as Float32Array (r,g,b,a per vertex).
|
|
2733
|
+
* @returns {Float32Array}
|
|
2734
|
+
*/
|
|
2735
|
+
opaqueColors() {
|
|
2736
|
+
const ret = wasm.meshoutputwrapper_opaqueColors(this.__wbg_ptr);
|
|
2737
|
+
return ret;
|
|
2738
|
+
}
|
|
2739
|
+
/**
|
|
2740
|
+
* Cutout layer triangle indices as Uint32Array.
|
|
2741
|
+
* @returns {Uint32Array}
|
|
2742
|
+
*/
|
|
2743
|
+
cutoutIndices() {
|
|
2744
|
+
const ret = wasm.meshoutputwrapper_cutoutIndices(this.__wbg_ptr);
|
|
2745
|
+
return ret;
|
|
2746
|
+
}
|
|
2747
|
+
/**
|
|
2748
|
+
* Cutout layer vertex normals as Float32Array.
|
|
2749
|
+
* @returns {Float32Array}
|
|
2750
|
+
*/
|
|
2751
|
+
cutoutNormals() {
|
|
2752
|
+
const ret = wasm.meshoutputwrapper_cutoutNormals(this.__wbg_ptr);
|
|
2753
|
+
return ret;
|
|
2754
|
+
}
|
|
2755
|
+
/**
|
|
2756
|
+
* Opaque layer triangle indices as Uint32Array.
|
|
2757
|
+
* @returns {Uint32Array}
|
|
2758
|
+
*/
|
|
2759
|
+
opaqueIndices() {
|
|
2760
|
+
const ret = wasm.meshoutputwrapper_opaqueIndices(this.__wbg_ptr);
|
|
2761
|
+
return ret;
|
|
2762
|
+
}
|
|
2763
|
+
/**
|
|
2764
|
+
* Opaque layer vertex normals as Float32Array.
|
|
2765
|
+
* @returns {Float32Array}
|
|
2766
|
+
*/
|
|
2767
|
+
opaqueNormals() {
|
|
2768
|
+
const ret = wasm.meshoutputwrapper_opaqueNormals(this.__wbg_ptr);
|
|
2769
|
+
return ret;
|
|
2770
|
+
}
|
|
2771
|
+
/**
|
|
2772
|
+
* Total vertex count across all layers.
|
|
2773
|
+
* @returns {number}
|
|
2774
|
+
*/
|
|
2775
|
+
get totalVertices() {
|
|
2776
|
+
const ret = wasm.meshoutputwrapper_totalVertices(this.__wbg_ptr);
|
|
2777
|
+
return ret >>> 0;
|
|
2778
|
+
}
|
|
2779
|
+
/**
|
|
2780
|
+
* Get the triangle count (backward-compat).
|
|
2781
|
+
* @returns {number}
|
|
2782
|
+
*/
|
|
2783
|
+
get triangleCount() {
|
|
2784
|
+
const ret = wasm.meshoutputwrapper_totalTriangles(this.__wbg_ptr);
|
|
2785
|
+
return ret >>> 0;
|
|
2786
|
+
}
|
|
2787
|
+
/**
|
|
2788
|
+
* Total triangle count across all layers.
|
|
2789
|
+
* @returns {number}
|
|
2790
|
+
*/
|
|
2791
|
+
get totalTriangles() {
|
|
2792
|
+
const ret = wasm.meshoutputwrapper_totalTriangles(this.__wbg_ptr);
|
|
2793
|
+
return ret >>> 0;
|
|
2794
|
+
}
|
|
2795
|
+
/**
|
|
2796
|
+
* Transparent layer texture coordinates as Float32Array.
|
|
2797
|
+
* @returns {Float32Array}
|
|
2798
|
+
*/
|
|
2799
|
+
transparentUvs() {
|
|
2800
|
+
const ret = wasm.meshoutputwrapper_transparentUvs(this.__wbg_ptr);
|
|
2801
|
+
return ret;
|
|
2802
|
+
}
|
|
2803
|
+
/**
|
|
2804
|
+
* Cutout layer vertex positions as Float32Array.
|
|
2805
|
+
* @returns {Float32Array}
|
|
2806
|
+
*/
|
|
2807
|
+
cutoutPositions() {
|
|
2808
|
+
const ret = wasm.meshoutputwrapper_cutoutPositions(this.__wbg_ptr);
|
|
2809
|
+
return ret;
|
|
2810
|
+
}
|
|
2811
|
+
/**
|
|
2812
|
+
* Whether the mesh has transparent geometry.
|
|
2813
|
+
* @returns {boolean}
|
|
2814
|
+
*/
|
|
2815
|
+
get hasTransparency() {
|
|
2816
|
+
const ret = wasm.meshoutputwrapper_hasTransparency(this.__wbg_ptr);
|
|
2817
|
+
return ret !== 0;
|
|
2818
|
+
}
|
|
2819
|
+
/**
|
|
2820
|
+
* Opaque layer vertex positions as Float32Array (x,y,z per vertex).
|
|
2821
|
+
* @returns {Float32Array}
|
|
2822
|
+
*/
|
|
2823
|
+
opaquePositions() {
|
|
2824
|
+
const ret = wasm.meshoutputwrapper_opaquePositions(this.__wbg_ptr);
|
|
2825
|
+
return ret;
|
|
2826
|
+
}
|
|
2827
|
+
/**
|
|
2828
|
+
* Transparent layer vertex colors as Float32Array.
|
|
2829
|
+
* @returns {Float32Array}
|
|
2830
|
+
*/
|
|
2831
|
+
transparentColors() {
|
|
2832
|
+
const ret = wasm.meshoutputwrapper_transparentColors(this.__wbg_ptr);
|
|
2833
|
+
return ret;
|
|
2834
|
+
}
|
|
2835
|
+
/**
|
|
2836
|
+
* Transparent layer triangle indices as Uint32Array.
|
|
2837
|
+
* @returns {Uint32Array}
|
|
2838
|
+
*/
|
|
2839
|
+
transparentIndices() {
|
|
2840
|
+
const ret = wasm.meshoutputwrapper_transparentIndices(this.__wbg_ptr);
|
|
2841
|
+
return ret;
|
|
2842
|
+
}
|
|
2843
|
+
/**
|
|
2844
|
+
* Transparent layer vertex normals as Float32Array.
|
|
2845
|
+
* @returns {Float32Array}
|
|
2846
|
+
*/
|
|
2847
|
+
transparentNormals() {
|
|
2848
|
+
const ret = wasm.meshoutputwrapper_transparentNormals(this.__wbg_ptr);
|
|
2849
|
+
return ret;
|
|
2850
|
+
}
|
|
2851
|
+
/**
|
|
2852
|
+
* Transparent layer vertex positions as Float32Array.
|
|
2853
|
+
* @returns {Float32Array}
|
|
2854
|
+
*/
|
|
2855
|
+
transparentPositions() {
|
|
2856
|
+
const ret = wasm.meshoutputwrapper_transparentPositions(this.__wbg_ptr);
|
|
2857
|
+
return ret;
|
|
2858
|
+
}
|
|
2859
|
+
/**
|
|
2860
|
+
* Get the bounding box as [minX, minY, minZ, maxX, maxY, maxZ].
|
|
2861
|
+
* @returns {Array<any>}
|
|
2862
|
+
*/
|
|
2863
|
+
get bounds() {
|
|
2864
|
+
const ret = wasm.meshoutputwrapper_bounds(this.__wbg_ptr);
|
|
2865
|
+
return ret;
|
|
2866
|
+
}
|
|
2867
|
+
/**
|
|
2868
|
+
* Get GLB binary data as Uint8Array.
|
|
2869
|
+
* @returns {Uint8Array}
|
|
2870
|
+
*/
|
|
2871
|
+
toGlb() {
|
|
2872
|
+
const ret = wasm.meshoutputwrapper_toGlb(this.__wbg_ptr);
|
|
2873
|
+
if (ret[2]) {
|
|
2874
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
2875
|
+
}
|
|
2876
|
+
return takeFromExternrefTable0(ret[0]);
|
|
2877
|
+
}
|
|
2878
|
+
/**
|
|
2879
|
+
* Get NUCM binary cache data as Uint8Array.
|
|
2880
|
+
*
|
|
2881
|
+
* Serializes this single mesh chunk to the `.nucm` binary format.
|
|
2882
|
+
* @returns {Uint8Array}
|
|
2883
|
+
*/
|
|
2884
|
+
toNucm() {
|
|
2885
|
+
const ret = wasm.meshoutputwrapper_toNucm(this.__wbg_ptr);
|
|
2886
|
+
return ret;
|
|
2887
|
+
}
|
|
2888
|
+
/**
|
|
2889
|
+
* Get USDZ binary data as Uint8Array.
|
|
2890
|
+
* @returns {Uint8Array}
|
|
2891
|
+
*/
|
|
2892
|
+
toUsdz() {
|
|
2893
|
+
const ret = wasm.meshoutputwrapper_toUsdz(this.__wbg_ptr);
|
|
2894
|
+
if (ret[2]) {
|
|
2895
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
2896
|
+
}
|
|
2897
|
+
return takeFromExternrefTable0(ret[0]);
|
|
2898
|
+
}
|
|
2899
|
+
/**
|
|
2900
|
+
* Get the GLB binary data (backward-compat getter).
|
|
2901
|
+
* @returns {Uint8Array}
|
|
2902
|
+
*/
|
|
2903
|
+
get glbData() {
|
|
2904
|
+
const ret = wasm.meshoutputwrapper_glbData(this.__wbg_ptr);
|
|
2905
|
+
if (ret[2]) {
|
|
2906
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
2907
|
+
}
|
|
2908
|
+
return takeFromExternrefTable0(ret[0]);
|
|
2909
|
+
}
|
|
2910
|
+
/**
|
|
2911
|
+
* Whether all layers are empty.
|
|
2912
|
+
* @returns {boolean}
|
|
2913
|
+
*/
|
|
2914
|
+
get isEmpty() {
|
|
2915
|
+
const ret = wasm.meshoutputwrapper_isEmpty(this.__wbg_ptr);
|
|
2916
|
+
return ret !== 0;
|
|
2917
|
+
}
|
|
2918
|
+
/**
|
|
2919
|
+
* Get mesh statistics as a JS object.
|
|
2920
|
+
* @returns {object}
|
|
2921
|
+
*/
|
|
2922
|
+
getStats() {
|
|
2923
|
+
const ret = wasm.meshoutputwrapper_getStats(this.__wbg_ptr);
|
|
2924
|
+
return ret;
|
|
2925
|
+
}
|
|
2926
|
+
/**
|
|
2927
|
+
* LOD level (0 = full detail).
|
|
2928
|
+
* @returns {number}
|
|
2929
|
+
*/
|
|
2930
|
+
get lodLevel() {
|
|
2931
|
+
const ret = wasm.meshoutputwrapper_lodLevel(this.__wbg_ptr);
|
|
2932
|
+
return ret;
|
|
2933
|
+
}
|
|
2934
|
+
}
|
|
2935
|
+
if (Symbol.dispose) MeshOutputWrapper.prototype[Symbol.dispose] = MeshOutputWrapper.prototype.free;
|
|
2936
|
+
|
|
2937
|
+
/**
|
|
2938
|
+
* Result of per-region mesh generation.
|
|
2939
|
+
*
|
|
2940
|
+
* Wraps a `HashMap<String, MeshOutput>` for WASM consumption.
|
|
2941
|
+
*/
|
|
2942
|
+
export class MultiMeshResultWrapper {
|
|
2943
|
+
static __wrap(ptr) {
|
|
2944
|
+
ptr = ptr >>> 0;
|
|
2945
|
+
const obj = Object.create(MultiMeshResultWrapper.prototype);
|
|
2946
|
+
obj.__wbg_ptr = ptr;
|
|
2947
|
+
MultiMeshResultWrapperFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
2948
|
+
return obj;
|
|
2949
|
+
}
|
|
2950
|
+
__destroy_into_raw() {
|
|
2951
|
+
const ptr = this.__wbg_ptr;
|
|
2952
|
+
this.__wbg_ptr = 0;
|
|
2953
|
+
MultiMeshResultWrapperFinalization.unregister(this);
|
|
2954
|
+
return ptr;
|
|
2955
|
+
}
|
|
2956
|
+
free() {
|
|
2957
|
+
const ptr = this.__destroy_into_raw();
|
|
2958
|
+
wasm.__wbg_multimeshresultwrapper_free(ptr, 0);
|
|
2959
|
+
}
|
|
2960
|
+
/**
|
|
2961
|
+
* Get the number of meshes.
|
|
2962
|
+
* @returns {number}
|
|
2963
|
+
*/
|
|
2964
|
+
get meshCount() {
|
|
2965
|
+
const ret = wasm.chunkmeshresultwrapper_chunkCount(this.__wbg_ptr);
|
|
2966
|
+
return ret >>> 0;
|
|
2967
|
+
}
|
|
2968
|
+
/**
|
|
2969
|
+
* Get the region names.
|
|
2970
|
+
* @returns {Array<any>}
|
|
2971
|
+
*/
|
|
2972
|
+
getRegionNames() {
|
|
2973
|
+
const ret = wasm.multimeshresultwrapper_getRegionNames(this.__wbg_ptr);
|
|
2974
|
+
return ret;
|
|
2975
|
+
}
|
|
2976
|
+
/**
|
|
2977
|
+
* Get the total vertex count across all regions.
|
|
2978
|
+
* @returns {number}
|
|
2979
|
+
*/
|
|
2980
|
+
get totalVertexCount() {
|
|
2981
|
+
const ret = wasm.multimeshresultwrapper_totalVertexCount(this.__wbg_ptr);
|
|
2982
|
+
return ret >>> 0;
|
|
2983
|
+
}
|
|
2984
|
+
/**
|
|
2985
|
+
* Get the total triangle count across all regions.
|
|
2986
|
+
* @returns {number}
|
|
2987
|
+
*/
|
|
2988
|
+
get totalTriangleCount() {
|
|
2989
|
+
const ret = wasm.multimeshresultwrapper_totalTriangleCount(this.__wbg_ptr);
|
|
2990
|
+
return ret >>> 0;
|
|
2991
|
+
}
|
|
2992
|
+
/**
|
|
2993
|
+
* Get the mesh for a specific region.
|
|
2994
|
+
* @param {string} region_name
|
|
2995
|
+
* @returns {MeshOutputWrapper | undefined}
|
|
2996
|
+
*/
|
|
2997
|
+
getMesh(region_name) {
|
|
2998
|
+
const ptr0 = passStringToWasm0(region_name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
2999
|
+
const len0 = WASM_VECTOR_LEN;
|
|
3000
|
+
const ret = wasm.multimeshresultwrapper_getMesh(this.__wbg_ptr, ptr0, len0);
|
|
3001
|
+
return ret === 0 ? undefined : MeshOutputWrapper.__wrap(ret);
|
|
3002
|
+
}
|
|
3003
|
+
}
|
|
3004
|
+
if (Symbol.dispose) MultiMeshResultWrapper.prototype[Symbol.dispose] = MultiMeshResultWrapper.prototype.free;
|
|
3005
|
+
|
|
3006
|
+
/**
|
|
3007
|
+
* OutputCondition for conditional execution
|
|
3008
|
+
*/
|
|
3009
|
+
export class OutputConditionWrapper {
|
|
3010
|
+
static __wrap(ptr) {
|
|
3011
|
+
ptr = ptr >>> 0;
|
|
3012
|
+
const obj = Object.create(OutputConditionWrapper.prototype);
|
|
3013
|
+
obj.__wbg_ptr = ptr;
|
|
3014
|
+
OutputConditionWrapperFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
3015
|
+
return obj;
|
|
3016
|
+
}
|
|
3017
|
+
__destroy_into_raw() {
|
|
3018
|
+
const ptr = this.__wbg_ptr;
|
|
3019
|
+
this.__wbg_ptr = 0;
|
|
3020
|
+
OutputConditionWrapperFinalization.unregister(this);
|
|
3021
|
+
return ptr;
|
|
3022
|
+
}
|
|
3023
|
+
free() {
|
|
3024
|
+
const ptr = this.__destroy_into_raw();
|
|
3025
|
+
wasm.__wbg_outputconditionwrapper_free(ptr, 0);
|
|
3026
|
+
}
|
|
3027
|
+
/**
|
|
3028
|
+
* Output not equals a value
|
|
3029
|
+
* @param {ValueWrapper} value
|
|
3030
|
+
* @returns {OutputConditionWrapper}
|
|
3031
|
+
*/
|
|
3032
|
+
static notEquals(value) {
|
|
3033
|
+
_assertClass(value, ValueWrapper);
|
|
3034
|
+
const ret = wasm.outputconditionwrapper_notEquals(value.__wbg_ptr);
|
|
3035
|
+
return OutputConditionWrapper.__wrap(ret);
|
|
3036
|
+
}
|
|
3037
|
+
/**
|
|
3038
|
+
* Bitwise AND with mask
|
|
3039
|
+
* @param {number} mask
|
|
3040
|
+
* @returns {OutputConditionWrapper}
|
|
3041
|
+
*/
|
|
3042
|
+
static bitwiseAnd(mask) {
|
|
3043
|
+
const ret = wasm.outputconditionwrapper_bitwiseAnd(mask);
|
|
3044
|
+
return OutputConditionWrapper.__wrap(ret);
|
|
3045
|
+
}
|
|
3046
|
+
/**
|
|
3047
|
+
* Output greater than a value
|
|
3048
|
+
* @param {ValueWrapper} value
|
|
3049
|
+
* @returns {OutputConditionWrapper}
|
|
3050
|
+
*/
|
|
3051
|
+
static greaterThan(value) {
|
|
3052
|
+
_assertClass(value, ValueWrapper);
|
|
3053
|
+
const ret = wasm.outputconditionwrapper_greaterThan(value.__wbg_ptr);
|
|
3054
|
+
return OutputConditionWrapper.__wrap(ret);
|
|
3055
|
+
}
|
|
3056
|
+
/**
|
|
3057
|
+
* Output equals a value
|
|
3058
|
+
* @param {ValueWrapper} value
|
|
3059
|
+
* @returns {OutputConditionWrapper}
|
|
3060
|
+
*/
|
|
3061
|
+
static equals(value) {
|
|
3062
|
+
_assertClass(value, ValueWrapper);
|
|
3063
|
+
const ret = wasm.outputconditionwrapper_equals(value.__wbg_ptr);
|
|
3064
|
+
return OutputConditionWrapper.__wrap(ret);
|
|
3065
|
+
}
|
|
3066
|
+
/**
|
|
3067
|
+
* Output less than a value
|
|
3068
|
+
* @param {ValueWrapper} value
|
|
3069
|
+
* @returns {OutputConditionWrapper}
|
|
3070
|
+
*/
|
|
3071
|
+
static lessThan(value) {
|
|
3072
|
+
_assertClass(value, ValueWrapper);
|
|
3073
|
+
const ret = wasm.outputconditionwrapper_lessThan(value.__wbg_ptr);
|
|
3074
|
+
return OutputConditionWrapper.__wrap(ret);
|
|
3075
|
+
}
|
|
3076
|
+
}
|
|
3077
|
+
if (Symbol.dispose) OutputConditionWrapper.prototype[Symbol.dispose] = OutputConditionWrapper.prototype.free;
|
|
3078
|
+
|
|
3079
|
+
export class PaletteManager {
|
|
3080
|
+
__destroy_into_raw() {
|
|
3081
|
+
const ptr = this.__wbg_ptr;
|
|
3082
|
+
this.__wbg_ptr = 0;
|
|
3083
|
+
PaletteManagerFinalization.unregister(this);
|
|
3084
|
+
return ptr;
|
|
3085
|
+
}
|
|
3086
|
+
free() {
|
|
3087
|
+
const ptr = this.__destroy_into_raw();
|
|
3088
|
+
wasm.__wbg_palettemanager_free(ptr, 0);
|
|
3089
|
+
}
|
|
3090
|
+
/**
|
|
3091
|
+
* Get all wool blocks
|
|
3092
|
+
* @returns {string[]}
|
|
3093
|
+
*/
|
|
3094
|
+
static getWoolBlocks() {
|
|
3095
|
+
const ret = wasm.palettemanager_getWoolBlocks();
|
|
3096
|
+
var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
|
|
3097
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
|
|
3098
|
+
return v1;
|
|
3099
|
+
}
|
|
3100
|
+
/**
|
|
3101
|
+
* Get all concrete blocks
|
|
3102
|
+
* @returns {string[]}
|
|
3103
|
+
*/
|
|
3104
|
+
static getConcreteBlocks() {
|
|
3105
|
+
const ret = wasm.palettemanager_getConcreteBlocks();
|
|
3106
|
+
var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
|
|
3107
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
|
|
3108
|
+
return v1;
|
|
3109
|
+
}
|
|
3110
|
+
/**
|
|
3111
|
+
* Get all terracotta blocks
|
|
3112
|
+
* @returns {string[]}
|
|
3113
|
+
*/
|
|
3114
|
+
static getTerracottaBlocks() {
|
|
3115
|
+
const ret = wasm.palettemanager_getTerracottaBlocks();
|
|
3116
|
+
var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
|
|
3117
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
|
|
3118
|
+
return v1;
|
|
3119
|
+
}
|
|
3120
|
+
/**
|
|
3121
|
+
* Get a palette containing blocks matching ANY of the provided keywords
|
|
3122
|
+
* Example: `["wool", "obsidian"]` gets all wool blocks AND obsidian
|
|
3123
|
+
* @param {string[]} keywords
|
|
3124
|
+
* @returns {string[]}
|
|
3125
|
+
*/
|
|
3126
|
+
static getPaletteByKeywords(keywords) {
|
|
3127
|
+
const ptr0 = passArrayJsValueToWasm0(keywords, wasm.__wbindgen_malloc);
|
|
3128
|
+
const len0 = WASM_VECTOR_LEN;
|
|
3129
|
+
const ret = wasm.palettemanager_getPaletteByKeywords(ptr0, len0);
|
|
3130
|
+
var v2 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
|
|
3131
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
|
|
3132
|
+
return v2;
|
|
3133
|
+
}
|
|
3134
|
+
}
|
|
3135
|
+
if (Symbol.dispose) PaletteManager.prototype[Symbol.dispose] = PaletteManager.prototype.free;
|
|
3136
|
+
|
|
3137
|
+
/**
|
|
3138
|
+
* Result of raw mesh export for custom rendering.
|
|
3139
|
+
*/
|
|
3140
|
+
export class RawMeshExportWrapper {
|
|
3141
|
+
static __wrap(ptr) {
|
|
3142
|
+
ptr = ptr >>> 0;
|
|
3143
|
+
const obj = Object.create(RawMeshExportWrapper.prototype);
|
|
3144
|
+
obj.__wbg_ptr = ptr;
|
|
3145
|
+
RawMeshExportWrapperFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
3146
|
+
return obj;
|
|
3147
|
+
}
|
|
3148
|
+
__destroy_into_raw() {
|
|
3149
|
+
const ptr = this.__wbg_ptr;
|
|
3150
|
+
this.__wbg_ptr = 0;
|
|
3151
|
+
RawMeshExportWrapperFinalization.unregister(this);
|
|
3152
|
+
return ptr;
|
|
3153
|
+
}
|
|
3154
|
+
free() {
|
|
3155
|
+
const ptr = this.__destroy_into_raw();
|
|
3156
|
+
wasm.__wbg_rawmeshexportwrapper_free(ptr, 0);
|
|
3157
|
+
}
|
|
3158
|
+
/**
|
|
3159
|
+
* Get vertex colors as a flat Float32Array.
|
|
3160
|
+
* @returns {Float32Array}
|
|
3161
|
+
*/
|
|
3162
|
+
colorsFlat() {
|
|
3163
|
+
const ret = wasm.rawmeshexportwrapper_colorsFlat(this.__wbg_ptr);
|
|
3164
|
+
var v1 = getArrayF32FromWasm0(ret[0], ret[1]).slice();
|
|
3165
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
|
|
3166
|
+
return v1;
|
|
3167
|
+
}
|
|
3168
|
+
/**
|
|
3169
|
+
* Get vertex normals as a flat Float32Array.
|
|
3170
|
+
* @returns {Float32Array}
|
|
3171
|
+
*/
|
|
3172
|
+
normalsFlat() {
|
|
3173
|
+
const ret = wasm.rawmeshexportwrapper_normalsFlat(this.__wbg_ptr);
|
|
3174
|
+
var v1 = getArrayF32FromWasm0(ret[0], ret[1]).slice();
|
|
3175
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
|
|
3176
|
+
return v1;
|
|
3177
|
+
}
|
|
3178
|
+
/**
|
|
3179
|
+
* Get texture atlas RGBA pixel data.
|
|
3180
|
+
* @returns {Uint8Array}
|
|
3181
|
+
*/
|
|
3182
|
+
textureRgba() {
|
|
3183
|
+
const ret = wasm.rawmeshexportwrapper_textureRgba(this.__wbg_ptr);
|
|
3184
|
+
var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
3185
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
3186
|
+
return v1;
|
|
3187
|
+
}
|
|
3188
|
+
/**
|
|
3189
|
+
* Get the vertex count.
|
|
3190
|
+
* @returns {number}
|
|
3191
|
+
*/
|
|
3192
|
+
get vertexCount() {
|
|
3193
|
+
const ret = wasm.rawmeshexportwrapper_vertexCount(this.__wbg_ptr);
|
|
3194
|
+
return ret >>> 0;
|
|
3195
|
+
}
|
|
3196
|
+
/**
|
|
3197
|
+
* Get texture atlas width.
|
|
3198
|
+
* @returns {number}
|
|
3199
|
+
*/
|
|
3200
|
+
get textureWidth() {
|
|
3201
|
+
const ret = wasm.rawmeshexportwrapper_textureWidth(this.__wbg_ptr);
|
|
3202
|
+
return ret >>> 0;
|
|
3203
|
+
}
|
|
3204
|
+
/**
|
|
3205
|
+
* Get vertex positions as a flat Float32Array.
|
|
3206
|
+
* @returns {Float32Array}
|
|
3207
|
+
*/
|
|
3208
|
+
positionsFlat() {
|
|
3209
|
+
const ret = wasm.rawmeshexportwrapper_positionsFlat(this.__wbg_ptr);
|
|
3210
|
+
var v1 = getArrayF32FromWasm0(ret[0], ret[1]).slice();
|
|
3211
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
|
|
3212
|
+
return v1;
|
|
3213
|
+
}
|
|
3214
|
+
/**
|
|
3215
|
+
* Get texture atlas height.
|
|
3216
|
+
* @returns {number}
|
|
3217
|
+
*/
|
|
3218
|
+
get textureHeight() {
|
|
3219
|
+
const ret = wasm.rawmeshexportwrapper_textureHeight(this.__wbg_ptr);
|
|
3220
|
+
return ret >>> 0;
|
|
3221
|
+
}
|
|
3222
|
+
/**
|
|
3223
|
+
* Get the triangle count.
|
|
3224
|
+
* @returns {number}
|
|
3225
|
+
*/
|
|
3226
|
+
get triangleCount() {
|
|
3227
|
+
const ret = wasm.rawmeshexportwrapper_triangleCount(this.__wbg_ptr);
|
|
3228
|
+
return ret >>> 0;
|
|
3229
|
+
}
|
|
3230
|
+
/**
|
|
3231
|
+
* Get triangle indices.
|
|
3232
|
+
* @returns {Uint32Array}
|
|
3233
|
+
*/
|
|
3234
|
+
indices() {
|
|
3235
|
+
const ret = wasm.rawmeshexportwrapper_indices(this.__wbg_ptr);
|
|
3236
|
+
var v1 = getArrayU32FromWasm0(ret[0], ret[1]).slice();
|
|
3237
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
|
|
3238
|
+
return v1;
|
|
3239
|
+
}
|
|
3240
|
+
/**
|
|
3241
|
+
* Get texture coordinates as a flat Float32Array.
|
|
3242
|
+
* @returns {Float32Array}
|
|
3243
|
+
*/
|
|
3244
|
+
uvsFlat() {
|
|
3245
|
+
const ret = wasm.rawmeshexportwrapper_uvsFlat(this.__wbg_ptr);
|
|
3246
|
+
var v1 = getArrayF32FromWasm0(ret[0], ret[1]).slice();
|
|
3247
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
|
|
3248
|
+
return v1;
|
|
3249
|
+
}
|
|
3250
|
+
}
|
|
3251
|
+
if (Symbol.dispose) RawMeshExportWrapper.prototype[Symbol.dispose] = RawMeshExportWrapper.prototype.free;
|
|
3252
|
+
|
|
3253
|
+
/**
|
|
3254
|
+
* Wrapper for a Minecraft resource pack.
|
|
3255
|
+
*/
|
|
3256
|
+
export class ResourcePackWrapper {
|
|
3257
|
+
__destroy_into_raw() {
|
|
3258
|
+
const ptr = this.__wbg_ptr;
|
|
3259
|
+
this.__wbg_ptr = 0;
|
|
3260
|
+
ResourcePackWrapperFinalization.unregister(this);
|
|
3261
|
+
return ptr;
|
|
3262
|
+
}
|
|
3263
|
+
free() {
|
|
3264
|
+
const ptr = this.__destroy_into_raw();
|
|
3265
|
+
wasm.__wbg_resourcepackwrapper_free(ptr, 0);
|
|
3266
|
+
}
|
|
3267
|
+
/**
|
|
3268
|
+
* Get the namespaces in the resource pack.
|
|
3269
|
+
* @returns {Array<any>}
|
|
3270
|
+
*/
|
|
3271
|
+
get namespaces() {
|
|
3272
|
+
const ret = wasm.resourcepackwrapper_namespaces(this.__wbg_ptr);
|
|
3273
|
+
return ret;
|
|
3274
|
+
}
|
|
3275
|
+
/**
|
|
3276
|
+
* Add a texture from raw RGBA8 pixel data.
|
|
3277
|
+
* @param {string} name
|
|
3278
|
+
* @param {number} width
|
|
3279
|
+
* @param {number} height
|
|
3280
|
+
* @param {Uint8Array} pixels
|
|
3281
|
+
*/
|
|
3282
|
+
addTexture(name, width, height, pixels) {
|
|
3283
|
+
const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
3284
|
+
const len0 = WASM_VECTOR_LEN;
|
|
3285
|
+
const ptr1 = passArray8ToWasm0(pixels, wasm.__wbindgen_malloc);
|
|
3286
|
+
const len1 = WASM_VECTOR_LEN;
|
|
3287
|
+
const ret = wasm.resourcepackwrapper_addTexture(this.__wbg_ptr, ptr0, len0, width, height, ptr1, len1);
|
|
3288
|
+
if (ret[1]) {
|
|
3289
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
3290
|
+
}
|
|
3291
|
+
}
|
|
3292
|
+
/**
|
|
3293
|
+
* List all model names.
|
|
3294
|
+
* @returns {Array<any>}
|
|
3295
|
+
*/
|
|
3296
|
+
listModels() {
|
|
3297
|
+
const ret = wasm.resourcepackwrapper_listModels(this.__wbg_ptr);
|
|
3298
|
+
return ret;
|
|
2310
3299
|
}
|
|
2311
3300
|
/**
|
|
2312
|
-
*
|
|
2313
|
-
* @
|
|
2314
|
-
* @returns {OutputConditionWrapper}
|
|
3301
|
+
* Get the number of models in the resource pack.
|
|
3302
|
+
* @returns {number}
|
|
2315
3303
|
*/
|
|
2316
|
-
|
|
2317
|
-
|
|
2318
|
-
|
|
2319
|
-
return OutputConditionWrapper.__wrap(ret);
|
|
3304
|
+
get modelCount() {
|
|
3305
|
+
const ret = wasm.resourcepackwrapper_modelCount(this.__wbg_ptr);
|
|
3306
|
+
return ret >>> 0;
|
|
2320
3307
|
}
|
|
2321
3308
|
/**
|
|
2322
|
-
*
|
|
2323
|
-
* @
|
|
2324
|
-
* @returns {OutputConditionWrapper}
|
|
3309
|
+
* List all texture names.
|
|
3310
|
+
* @returns {Array<any>}
|
|
2325
3311
|
*/
|
|
2326
|
-
|
|
2327
|
-
const ret = wasm.
|
|
2328
|
-
return
|
|
3312
|
+
listTextures() {
|
|
3313
|
+
const ret = wasm.resourcepackwrapper_listTextures(this.__wbg_ptr);
|
|
3314
|
+
return ret;
|
|
2329
3315
|
}
|
|
2330
3316
|
/**
|
|
2331
|
-
*
|
|
2332
|
-
* @
|
|
2333
|
-
* @returns {OutputConditionWrapper}
|
|
3317
|
+
* Get the number of textures in the resource pack.
|
|
3318
|
+
* @returns {number}
|
|
2334
3319
|
*/
|
|
2335
|
-
|
|
2336
|
-
|
|
2337
|
-
|
|
2338
|
-
return OutputConditionWrapper.__wrap(ret);
|
|
3320
|
+
get textureCount() {
|
|
3321
|
+
const ret = wasm.resourcepackwrapper_textureCount(this.__wbg_ptr);
|
|
3322
|
+
return ret >>> 0;
|
|
2339
3323
|
}
|
|
2340
3324
|
/**
|
|
2341
|
-
*
|
|
2342
|
-
* @param {
|
|
2343
|
-
* @
|
|
3325
|
+
* Add a block model from a JSON string.
|
|
3326
|
+
* @param {string} name
|
|
3327
|
+
* @param {string} json
|
|
2344
3328
|
*/
|
|
2345
|
-
|
|
2346
|
-
|
|
2347
|
-
const
|
|
2348
|
-
|
|
3329
|
+
addModelJson(name, json) {
|
|
3330
|
+
const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
3331
|
+
const len0 = WASM_VECTOR_LEN;
|
|
3332
|
+
const ptr1 = passStringToWasm0(json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
3333
|
+
const len1 = WASM_VECTOR_LEN;
|
|
3334
|
+
const ret = wasm.resourcepackwrapper_addModelJson(this.__wbg_ptr, ptr0, len0, ptr1, len1);
|
|
3335
|
+
if (ret[1]) {
|
|
3336
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
3337
|
+
}
|
|
2349
3338
|
}
|
|
2350
3339
|
/**
|
|
2351
|
-
*
|
|
2352
|
-
* @param {
|
|
2353
|
-
* @returns {
|
|
3340
|
+
* Get a block model as a JSON string. Returns null if not found.
|
|
3341
|
+
* @param {string} name
|
|
3342
|
+
* @returns {string | undefined}
|
|
2354
3343
|
*/
|
|
2355
|
-
|
|
2356
|
-
|
|
2357
|
-
const
|
|
2358
|
-
|
|
3344
|
+
getModelJson(name) {
|
|
3345
|
+
const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
3346
|
+
const len0 = WASM_VECTOR_LEN;
|
|
3347
|
+
const ret = wasm.resourcepackwrapper_getModelJson(this.__wbg_ptr, ptr0, len0);
|
|
3348
|
+
let v2;
|
|
3349
|
+
if (ret[0] !== 0) {
|
|
3350
|
+
v2 = getStringFromWasm0(ret[0], ret[1]).slice();
|
|
3351
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
3352
|
+
}
|
|
3353
|
+
return v2;
|
|
2359
3354
|
}
|
|
2360
|
-
|
|
2361
|
-
|
|
2362
|
-
|
|
2363
|
-
|
|
2364
|
-
|
|
2365
|
-
const
|
|
2366
|
-
|
|
2367
|
-
PaletteManagerFinalization.unregister(this);
|
|
2368
|
-
return ptr;
|
|
3355
|
+
/**
|
|
3356
|
+
* Get the number of blockstates in the resource pack.
|
|
3357
|
+
* @returns {number}
|
|
3358
|
+
*/
|
|
3359
|
+
get blockstateCount() {
|
|
3360
|
+
const ret = wasm.resourcepackwrapper_blockstateCount(this.__wbg_ptr);
|
|
3361
|
+
return ret >>> 0;
|
|
2369
3362
|
}
|
|
2370
|
-
|
|
2371
|
-
|
|
2372
|
-
|
|
3363
|
+
/**
|
|
3364
|
+
* Get texture info as a JS object with width, height, isAnimated, frameCount.
|
|
3365
|
+
* Returns null if not found.
|
|
3366
|
+
* @param {string} name
|
|
3367
|
+
* @returns {any}
|
|
3368
|
+
*/
|
|
3369
|
+
getTextureInfo(name) {
|
|
3370
|
+
const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
3371
|
+
const len0 = WASM_VECTOR_LEN;
|
|
3372
|
+
const ret = wasm.resourcepackwrapper_getTextureInfo(this.__wbg_ptr, ptr0, len0);
|
|
3373
|
+
return ret;
|
|
2373
3374
|
}
|
|
2374
3375
|
/**
|
|
2375
|
-
*
|
|
2376
|
-
* @returns {
|
|
3376
|
+
* List all blockstate names.
|
|
3377
|
+
* @returns {Array<any>}
|
|
2377
3378
|
*/
|
|
2378
|
-
|
|
2379
|
-
const ret = wasm.
|
|
2380
|
-
|
|
2381
|
-
wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
|
|
2382
|
-
return v1;
|
|
3379
|
+
listBlockstates() {
|
|
3380
|
+
const ret = wasm.resourcepackwrapper_listBlockstates(this.__wbg_ptr);
|
|
3381
|
+
return ret;
|
|
2383
3382
|
}
|
|
2384
3383
|
/**
|
|
2385
|
-
* Get
|
|
2386
|
-
* @
|
|
3384
|
+
* Get raw RGBA8 pixel data for a texture. Returns null if not found.
|
|
3385
|
+
* @param {string} name
|
|
3386
|
+
* @returns {Uint8Array | undefined}
|
|
2387
3387
|
*/
|
|
2388
|
-
|
|
2389
|
-
const
|
|
2390
|
-
|
|
2391
|
-
wasm.
|
|
2392
|
-
|
|
3388
|
+
getTexturePixels(name) {
|
|
3389
|
+
const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
3390
|
+
const len0 = WASM_VECTOR_LEN;
|
|
3391
|
+
const ret = wasm.resourcepackwrapper_getTexturePixels(this.__wbg_ptr, ptr0, len0);
|
|
3392
|
+
let v2;
|
|
3393
|
+
if (ret[0] !== 0) {
|
|
3394
|
+
v2 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
3395
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
3396
|
+
}
|
|
3397
|
+
return v2;
|
|
2393
3398
|
}
|
|
2394
3399
|
/**
|
|
2395
|
-
*
|
|
2396
|
-
* @
|
|
3400
|
+
* Add a blockstate definition from a JSON string.
|
|
3401
|
+
* @param {string} name
|
|
3402
|
+
* @param {string} json
|
|
2397
3403
|
*/
|
|
2398
|
-
|
|
2399
|
-
const
|
|
2400
|
-
|
|
2401
|
-
|
|
2402
|
-
|
|
3404
|
+
addBlockstateJson(name, json) {
|
|
3405
|
+
const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
3406
|
+
const len0 = WASM_VECTOR_LEN;
|
|
3407
|
+
const ptr1 = passStringToWasm0(json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
3408
|
+
const len1 = WASM_VECTOR_LEN;
|
|
3409
|
+
const ret = wasm.resourcepackwrapper_addBlockstateJson(this.__wbg_ptr, ptr0, len0, ptr1, len1);
|
|
3410
|
+
if (ret[1]) {
|
|
3411
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
3412
|
+
}
|
|
2403
3413
|
}
|
|
2404
3414
|
/**
|
|
2405
|
-
* Get a
|
|
2406
|
-
*
|
|
2407
|
-
* @
|
|
2408
|
-
* @returns {string[]}
|
|
3415
|
+
* Get a blockstate definition as a JSON string. Returns null if not found.
|
|
3416
|
+
* @param {string} name
|
|
3417
|
+
* @returns {string | undefined}
|
|
2409
3418
|
*/
|
|
2410
|
-
|
|
2411
|
-
const ptr0 =
|
|
3419
|
+
getBlockstateJson(name) {
|
|
3420
|
+
const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
2412
3421
|
const len0 = WASM_VECTOR_LEN;
|
|
2413
|
-
const ret = wasm.
|
|
2414
|
-
|
|
2415
|
-
|
|
3422
|
+
const ret = wasm.resourcepackwrapper_getBlockstateJson(this.__wbg_ptr, ptr0, len0);
|
|
3423
|
+
let v2;
|
|
3424
|
+
if (ret[0] !== 0) {
|
|
3425
|
+
v2 = getStringFromWasm0(ret[0], ret[1]).slice();
|
|
3426
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
3427
|
+
}
|
|
2416
3428
|
return v2;
|
|
2417
3429
|
}
|
|
3430
|
+
/**
|
|
3431
|
+
* Load a resource pack from bytes (ZIP file contents).
|
|
3432
|
+
* @param {Uint8Array} data
|
|
3433
|
+
*/
|
|
3434
|
+
constructor(data) {
|
|
3435
|
+
const ptr0 = passArray8ToWasm0(data, wasm.__wbindgen_malloc);
|
|
3436
|
+
const len0 = WASM_VECTOR_LEN;
|
|
3437
|
+
const ret = wasm.resourcepackwrapper_new(ptr0, len0);
|
|
3438
|
+
if (ret[2]) {
|
|
3439
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
3440
|
+
}
|
|
3441
|
+
this.__wbg_ptr = ret[0] >>> 0;
|
|
3442
|
+
ResourcePackWrapperFinalization.register(this, this.__wbg_ptr, this);
|
|
3443
|
+
return this;
|
|
3444
|
+
}
|
|
3445
|
+
/**
|
|
3446
|
+
* Get statistics about the resource pack as a JS object.
|
|
3447
|
+
* @returns {object}
|
|
3448
|
+
*/
|
|
3449
|
+
getStats() {
|
|
3450
|
+
const ret = wasm.resourcepackwrapper_getStats(this.__wbg_ptr);
|
|
3451
|
+
return ret;
|
|
3452
|
+
}
|
|
2418
3453
|
}
|
|
2419
|
-
if (Symbol.dispose)
|
|
3454
|
+
if (Symbol.dispose) ResourcePackWrapper.prototype[Symbol.dispose] = ResourcePackWrapper.prototype.free;
|
|
2420
3455
|
|
|
2421
3456
|
/**
|
|
2422
3457
|
* SchematicBuilder for creating schematics from ASCII art
|
|
@@ -2563,6 +3598,162 @@ export class SchematicWrapper {
|
|
|
2563
3598
|
}
|
|
2564
3599
|
return MchprsWorldWrapper.__wrap(ret[0]);
|
|
2565
3600
|
}
|
|
3601
|
+
/**
|
|
3602
|
+
* Generate raw mesh data for custom rendering pipelines.
|
|
3603
|
+
* @param {ResourcePackWrapper} pack
|
|
3604
|
+
* @param {MeshConfigWrapper} config
|
|
3605
|
+
* @returns {RawMeshExportWrapper}
|
|
3606
|
+
*/
|
|
3607
|
+
toRawMesh(pack, config) {
|
|
3608
|
+
_assertClass(pack, ResourcePackWrapper);
|
|
3609
|
+
_assertClass(config, MeshConfigWrapper);
|
|
3610
|
+
const ret = wasm.schematicwrapper_toRawMesh(this.__wbg_ptr, pack.__wbg_ptr, config.__wbg_ptr);
|
|
3611
|
+
if (ret[2]) {
|
|
3612
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
3613
|
+
}
|
|
3614
|
+
return RawMeshExportWrapper.__wrap(ret[0]);
|
|
3615
|
+
}
|
|
3616
|
+
/**
|
|
3617
|
+
* Generate one mesh per 16x16x16 chunk (eager, all at once).
|
|
3618
|
+
* @param {ResourcePackWrapper} pack
|
|
3619
|
+
* @param {MeshConfigWrapper} config
|
|
3620
|
+
* @returns {ChunkMeshResultWrapper}
|
|
3621
|
+
*/
|
|
3622
|
+
meshByChunk(pack, config) {
|
|
3623
|
+
_assertClass(pack, ResourcePackWrapper);
|
|
3624
|
+
_assertClass(config, MeshConfigWrapper);
|
|
3625
|
+
const ret = wasm.schematicwrapper_meshByChunk(this.__wbg_ptr, pack.__wbg_ptr, config.__wbg_ptr);
|
|
3626
|
+
if (ret[2]) {
|
|
3627
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
3628
|
+
}
|
|
3629
|
+
return ChunkMeshResultWrapper.__wrap(ret[0]);
|
|
3630
|
+
}
|
|
3631
|
+
/**
|
|
3632
|
+
* Generate one mesh per region.
|
|
3633
|
+
* @param {ResourcePackWrapper} pack
|
|
3634
|
+
* @param {MeshConfigWrapper} config
|
|
3635
|
+
* @returns {MultiMeshResultWrapper}
|
|
3636
|
+
*/
|
|
3637
|
+
meshByRegion(pack, config) {
|
|
3638
|
+
_assertClass(pack, ResourcePackWrapper);
|
|
3639
|
+
_assertClass(config, MeshConfigWrapper);
|
|
3640
|
+
const ret = wasm.schematicwrapper_meshByRegion(this.__wbg_ptr, pack.__wbg_ptr, config.__wbg_ptr);
|
|
3641
|
+
if (ret[2]) {
|
|
3642
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
3643
|
+
}
|
|
3644
|
+
return MultiMeshResultWrapper.__wrap(ret[0]);
|
|
3645
|
+
}
|
|
3646
|
+
/**
|
|
3647
|
+
* Build a single shared texture atlas from all unique block states.
|
|
3648
|
+
*
|
|
3649
|
+
* The atlas can be reused across all chunks via `chunkMeshIteratorWithAtlas()`,
|
|
3650
|
+
* eliminating per-chunk atlas duplication for massive schematics.
|
|
3651
|
+
* @param {ResourcePackWrapper} pack
|
|
3652
|
+
* @param {MeshConfigWrapper} config
|
|
3653
|
+
* @returns {TextureAtlasWrapper}
|
|
3654
|
+
*/
|
|
3655
|
+
buildGlobalAtlas(pack, config) {
|
|
3656
|
+
_assertClass(pack, ResourcePackWrapper);
|
|
3657
|
+
_assertClass(config, MeshConfigWrapper);
|
|
3658
|
+
const ret = wasm.schematicwrapper_buildGlobalAtlas(this.__wbg_ptr, pack.__wbg_ptr, config.__wbg_ptr);
|
|
3659
|
+
if (ret[2]) {
|
|
3660
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
3661
|
+
}
|
|
3662
|
+
return TextureAtlasWrapper.__wrap(ret[0]);
|
|
3663
|
+
}
|
|
3664
|
+
/**
|
|
3665
|
+
* Generate one mesh per chunk of the specified size (eager).
|
|
3666
|
+
* @param {ResourcePackWrapper} pack
|
|
3667
|
+
* @param {MeshConfigWrapper} config
|
|
3668
|
+
* @param {number} chunk_size
|
|
3669
|
+
* @returns {ChunkMeshResultWrapper}
|
|
3670
|
+
*/
|
|
3671
|
+
meshByChunkSize(pack, config, chunk_size) {
|
|
3672
|
+
_assertClass(pack, ResourcePackWrapper);
|
|
3673
|
+
_assertClass(config, MeshConfigWrapper);
|
|
3674
|
+
const ret = wasm.schematicwrapper_meshByChunkSize(this.__wbg_ptr, pack.__wbg_ptr, config.__wbg_ptr, chunk_size);
|
|
3675
|
+
if (ret[2]) {
|
|
3676
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
3677
|
+
}
|
|
3678
|
+
return ChunkMeshResultWrapper.__wrap(ret[0]);
|
|
3679
|
+
}
|
|
3680
|
+
/**
|
|
3681
|
+
* Create a lazy chunk mesh iterator.
|
|
3682
|
+
*
|
|
3683
|
+
* Call `advance()` to step to the next chunk, then `current()` to get the
|
|
3684
|
+
* mesh. Never loads the full world mesh into memory.
|
|
3685
|
+
* @param {ResourcePackWrapper} pack
|
|
3686
|
+
* @param {MeshConfigWrapper} config
|
|
3687
|
+
* @param {number} chunk_size
|
|
3688
|
+
* @returns {ChunkMeshIteratorWrapper}
|
|
3689
|
+
*/
|
|
3690
|
+
chunkMeshIterator(pack, config, chunk_size) {
|
|
3691
|
+
_assertClass(pack, ResourcePackWrapper);
|
|
3692
|
+
_assertClass(config, MeshConfigWrapper);
|
|
3693
|
+
const ret = wasm.schematicwrapper_chunkMeshIterator(this.__wbg_ptr, pack.__wbg_ptr, config.__wbg_ptr, chunk_size);
|
|
3694
|
+
return ChunkMeshIteratorWrapper.__wrap(ret);
|
|
3695
|
+
}
|
|
3696
|
+
/**
|
|
3697
|
+
* Register a mesh exporter with the FormatManager, enabling save_as("mesh", ...).
|
|
3698
|
+
* @param {ResourcePackWrapper} pack
|
|
3699
|
+
*/
|
|
3700
|
+
registerMeshExporter(pack) {
|
|
3701
|
+
_assertClass(pack, ResourcePackWrapper);
|
|
3702
|
+
const ret = wasm.schematicwrapper_registerMeshExporter(this.__wbg_ptr, pack.__wbg_ptr);
|
|
3703
|
+
if (ret[1]) {
|
|
3704
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
3705
|
+
}
|
|
3706
|
+
}
|
|
3707
|
+
/**
|
|
3708
|
+
* Create a lazy chunk mesh iterator that uses a pre-built global atlas.
|
|
3709
|
+
*
|
|
3710
|
+
* The global atlas is shared across all chunks, eliminating per-chunk atlas
|
|
3711
|
+
* duplication. Build the atlas first with `buildGlobalAtlas()`.
|
|
3712
|
+
* @param {ResourcePackWrapper} pack
|
|
3713
|
+
* @param {MeshConfigWrapper} config
|
|
3714
|
+
* @param {number} chunk_size
|
|
3715
|
+
* @param {TextureAtlasWrapper} atlas
|
|
3716
|
+
* @returns {ChunkMeshIteratorWrapper}
|
|
3717
|
+
*/
|
|
3718
|
+
chunkMeshIteratorWithAtlas(pack, config, chunk_size, atlas) {
|
|
3719
|
+
_assertClass(pack, ResourcePackWrapper);
|
|
3720
|
+
_assertClass(config, MeshConfigWrapper);
|
|
3721
|
+
_assertClass(atlas, TextureAtlasWrapper);
|
|
3722
|
+
const ret = wasm.schematicwrapper_chunkMeshIteratorWithAtlas(this.__wbg_ptr, pack.__wbg_ptr, config.__wbg_ptr, chunk_size, atlas.__wbg_ptr);
|
|
3723
|
+
return ChunkMeshIteratorWrapper.__wrap(ret);
|
|
3724
|
+
}
|
|
3725
|
+
/**
|
|
3726
|
+
* Generate a single mesh for the entire schematic.
|
|
3727
|
+
*
|
|
3728
|
+
* Returns a [`MeshOutputWrapper`] with per-layer typed arrays, atlas, and GLB data.
|
|
3729
|
+
* @param {ResourcePackWrapper} pack
|
|
3730
|
+
* @param {MeshConfigWrapper} config
|
|
3731
|
+
* @returns {MeshOutputWrapper}
|
|
3732
|
+
*/
|
|
3733
|
+
toMesh(pack, config) {
|
|
3734
|
+
_assertClass(pack, ResourcePackWrapper);
|
|
3735
|
+
_assertClass(config, MeshConfigWrapper);
|
|
3736
|
+
const ret = wasm.schematicwrapper_toMesh(this.__wbg_ptr, pack.__wbg_ptr, config.__wbg_ptr);
|
|
3737
|
+
if (ret[2]) {
|
|
3738
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
3739
|
+
}
|
|
3740
|
+
return MeshOutputWrapper.__wrap(ret[0]);
|
|
3741
|
+
}
|
|
3742
|
+
/**
|
|
3743
|
+
* Generate a USDZ mesh for the entire schematic.
|
|
3744
|
+
* @param {ResourcePackWrapper} pack
|
|
3745
|
+
* @param {MeshConfigWrapper} config
|
|
3746
|
+
* @returns {MeshOutputWrapper}
|
|
3747
|
+
*/
|
|
3748
|
+
toUsdz(pack, config) {
|
|
3749
|
+
_assertClass(pack, ResourcePackWrapper);
|
|
3750
|
+
_assertClass(config, MeshConfigWrapper);
|
|
3751
|
+
const ret = wasm.schematicwrapper_toUsdz(this.__wbg_ptr, pack.__wbg_ptr, config.__wbg_ptr);
|
|
3752
|
+
if (ret[2]) {
|
|
3753
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
3754
|
+
}
|
|
3755
|
+
return MeshOutputWrapper.__wrap(ret[0]);
|
|
3756
|
+
}
|
|
2566
3757
|
/**
|
|
2567
3758
|
* Add a mobile entity to the schematic.
|
|
2568
3759
|
* @param {string} id
|
|
@@ -4186,6 +5377,57 @@ export class StateModeConstants {
|
|
|
4186
5377
|
}
|
|
4187
5378
|
if (Symbol.dispose) StateModeConstants.prototype[Symbol.dispose] = StateModeConstants.prototype.free;
|
|
4188
5379
|
|
|
5380
|
+
/**
|
|
5381
|
+
* Wrapper for a pre-built global texture atlas.
|
|
5382
|
+
*
|
|
5383
|
+
* Build one atlas with `buildGlobalAtlas()` and pass it to
|
|
5384
|
+
* `chunkMeshIteratorWithAtlas()` so every chunk shares the same texture sheet.
|
|
5385
|
+
*/
|
|
5386
|
+
export class TextureAtlasWrapper {
|
|
5387
|
+
static __wrap(ptr) {
|
|
5388
|
+
ptr = ptr >>> 0;
|
|
5389
|
+
const obj = Object.create(TextureAtlasWrapper.prototype);
|
|
5390
|
+
obj.__wbg_ptr = ptr;
|
|
5391
|
+
TextureAtlasWrapperFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
5392
|
+
return obj;
|
|
5393
|
+
}
|
|
5394
|
+
__destroy_into_raw() {
|
|
5395
|
+
const ptr = this.__wbg_ptr;
|
|
5396
|
+
this.__wbg_ptr = 0;
|
|
5397
|
+
TextureAtlasWrapperFinalization.unregister(this);
|
|
5398
|
+
return ptr;
|
|
5399
|
+
}
|
|
5400
|
+
free() {
|
|
5401
|
+
const ptr = this.__destroy_into_raw();
|
|
5402
|
+
wasm.__wbg_textureatlaswrapper_free(ptr, 0);
|
|
5403
|
+
}
|
|
5404
|
+
/**
|
|
5405
|
+
* Atlas width in pixels.
|
|
5406
|
+
* @returns {number}
|
|
5407
|
+
*/
|
|
5408
|
+
get width() {
|
|
5409
|
+
const ret = wasm.chunkmeshresultwrapper_totalVertexCount(this.__wbg_ptr);
|
|
5410
|
+
return ret >>> 0;
|
|
5411
|
+
}
|
|
5412
|
+
/**
|
|
5413
|
+
* Atlas height in pixels.
|
|
5414
|
+
* @returns {number}
|
|
5415
|
+
*/
|
|
5416
|
+
get height() {
|
|
5417
|
+
const ret = wasm.chunkmeshresultwrapper_totalTriangleCount(this.__wbg_ptr);
|
|
5418
|
+
return ret >>> 0;
|
|
5419
|
+
}
|
|
5420
|
+
/**
|
|
5421
|
+
* RGBA pixel data as Uint8Array.
|
|
5422
|
+
* @returns {Uint8Array}
|
|
5423
|
+
*/
|
|
5424
|
+
toBytes() {
|
|
5425
|
+
const ret = wasm.textureatlaswrapper_toBytes(this.__wbg_ptr);
|
|
5426
|
+
return ret;
|
|
5427
|
+
}
|
|
5428
|
+
}
|
|
5429
|
+
if (Symbol.dispose) TextureAtlasWrapper.prototype[Symbol.dispose] = TextureAtlasWrapper.prototype.free;
|
|
5430
|
+
|
|
4189
5431
|
/**
|
|
4190
5432
|
* TypedCircuitExecutor wrapper for JavaScript
|
|
4191
5433
|
*/
|
|
@@ -4760,6 +6002,10 @@ function __wbg_get_imports() {
|
|
|
4760
6002
|
imports.wbg.__wbg___wbindgen_throw_dd24417ed36fc46e = function(arg0, arg1) {
|
|
4761
6003
|
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
4762
6004
|
};
|
|
6005
|
+
imports.wbg.__wbg_call_3020136f7a2d6e44 = function() { return handleError(function (arg0, arg1, arg2) {
|
|
6006
|
+
const ret = arg0.call(arg1, arg2);
|
|
6007
|
+
return ret;
|
|
6008
|
+
}, arguments) };
|
|
4763
6009
|
imports.wbg.__wbg_entries_83c79938054e065f = function(arg0) {
|
|
4764
6010
|
const ret = Object.entries(arg0);
|
|
4765
6011
|
return ret;
|
|
@@ -4831,6 +6077,14 @@ function __wbg_get_imports() {
|
|
|
4831
6077
|
const ret = new Map();
|
|
4832
6078
|
return ret;
|
|
4833
6079
|
};
|
|
6080
|
+
imports.wbg.__wbg_new_from_slice_41e2764a343e3cb1 = function(arg0, arg1) {
|
|
6081
|
+
const ret = new Float32Array(getArrayF32FromWasm0(arg0, arg1));
|
|
6082
|
+
return ret;
|
|
6083
|
+
};
|
|
6084
|
+
imports.wbg.__wbg_new_from_slice_db0691b69e9d3891 = function(arg0, arg1) {
|
|
6085
|
+
const ret = new Uint32Array(getArrayU32FromWasm0(arg0, arg1));
|
|
6086
|
+
return ret;
|
|
6087
|
+
};
|
|
4834
6088
|
imports.wbg.__wbg_new_from_slice_e6bd3cfb5a35313d = function(arg0, arg1) {
|
|
4835
6089
|
const ret = new Int32Array(getArrayI32FromWasm0(arg0, arg1));
|
|
4836
6090
|
return ret;
|
|
@@ -4919,6 +6173,7 @@ function __wbg_finalize_init(instance, module) {
|
|
|
4919
6173
|
wasm = instance.exports;
|
|
4920
6174
|
__wbg_init.__wbindgen_wasm_module = module;
|
|
4921
6175
|
cachedDataViewMemory0 = null;
|
|
6176
|
+
cachedFloat32ArrayMemory0 = null;
|
|
4922
6177
|
cachedInt32ArrayMemory0 = null;
|
|
4923
6178
|
cachedUint32ArrayMemory0 = null;
|
|
4924
6179
|
cachedUint8ArrayMemory0 = null;
|