nucleation 0.10.22 → 0.10.24

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 (303) hide show
  1. package/README.md +12 -0
  2. package/Schematic.d.mts +23 -0
  3. package/Schematic.d.ts +23 -0
  4. package/Schematic.mjs +70 -0
  5. package/nucleation.wasm +0 -0
  6. package/package.json +7 -2
  7. package/renderer/AnimationEffect.d.mts +44 -0
  8. package/renderer/AnimationEffect.d.ts +44 -0
  9. package/renderer/AnimationEffect.mjs +204 -0
  10. package/renderer/Autostack.d.mts +43 -0
  11. package/renderer/Autostack.d.ts +43 -0
  12. package/renderer/Autostack.mjs +134 -0
  13. package/renderer/BlockPos.d.mts +28 -0
  14. package/renderer/BlockPos.d.ts +28 -0
  15. package/renderer/BlockPos.mjs +130 -0
  16. package/renderer/BlockState.d.mts +39 -0
  17. package/renderer/BlockState.d.ts +39 -0
  18. package/renderer/BlockState.mjs +134 -0
  19. package/renderer/Blocks.d.mts +91 -0
  20. package/renderer/Blocks.d.ts +91 -0
  21. package/renderer/Blocks.mjs +308 -0
  22. package/renderer/Brush.d.mts +99 -0
  23. package/renderer/Brush.d.ts +99 -0
  24. package/renderer/Brush.mjs +335 -0
  25. package/renderer/BuildAnimation.d.mts +179 -0
  26. package/renderer/BuildAnimation.d.ts +179 -0
  27. package/renderer/BuildAnimation.mjs +1148 -0
  28. package/renderer/BuildingTool.d.mts +46 -0
  29. package/renderer/BuildingTool.d.ts +46 -0
  30. package/renderer/BuildingTool.mjs +121 -0
  31. package/renderer/CellExecutor.d.mts +51 -0
  32. package/renderer/CellExecutor.d.ts +51 -0
  33. package/renderer/CellExecutor.mjs +171 -0
  34. package/renderer/CellularSdfConfig.d.mts +22 -0
  35. package/renderer/CellularSdfConfig.d.ts +22 -0
  36. package/renderer/CellularSdfConfig.mjs +69 -0
  37. package/renderer/ChunkMeshResult.d.mts +75 -0
  38. package/renderer/ChunkMeshResult.d.ts +75 -0
  39. package/renderer/ChunkMeshResult.mjs +253 -0
  40. package/renderer/CircuitBuilder.d.mts +118 -0
  41. package/renderer/CircuitBuilder.d.ts +118 -0
  42. package/renderer/CircuitBuilder.mjs +516 -0
  43. package/renderer/Curve3D.d.mts +27 -0
  44. package/renderer/Curve3D.d.ts +27 -0
  45. package/renderer/Curve3D.mjs +101 -0
  46. package/renderer/DefinitionRegion.d.mts +274 -0
  47. package/renderer/DefinitionRegion.d.ts +274 -0
  48. package/renderer/DefinitionRegion.mjs +973 -0
  49. package/renderer/Design.d.mts +348 -0
  50. package/renderer/Design.d.ts +348 -0
  51. package/renderer/Design.mjs +1334 -0
  52. package/renderer/Diff.d.mts +88 -0
  53. package/renderer/Diff.d.ts +88 -0
  54. package/renderer/Diff.mjs +316 -0
  55. package/renderer/Dimensions.d.mts +28 -0
  56. package/renderer/Dimensions.d.ts +28 -0
  57. package/renderer/Dimensions.mjs +130 -0
  58. package/renderer/DistanceField.d.mts +39 -0
  59. package/renderer/DistanceField.d.ts +39 -0
  60. package/renderer/DistanceField.mjs +114 -0
  61. package/renderer/ExecutionMode.d.mts +42 -0
  62. package/renderer/ExecutionMode.d.ts +42 -0
  63. package/renderer/ExecutionMode.mjs +127 -0
  64. package/renderer/Field3.d.mts +40 -0
  65. package/renderer/Field3.d.ts +40 -0
  66. package/renderer/Field3.mjs +160 -0
  67. package/renderer/FieldProgram.d.mts +40 -0
  68. package/renderer/FieldProgram.d.ts +40 -0
  69. package/renderer/FieldProgram.mjs +167 -0
  70. package/renderer/FieldProgramBinaryOp.d.mts +42 -0
  71. package/renderer/FieldProgramBinaryOp.d.ts +42 -0
  72. package/renderer/FieldProgramBinaryOp.mjs +118 -0
  73. package/renderer/FieldProgramBuilder.d.mts +104 -0
  74. package/renderer/FieldProgramBuilder.d.ts +104 -0
  75. package/renderer/FieldProgramBuilder.mjs +486 -0
  76. package/renderer/FieldProgramDistanceKind.d.mts +26 -0
  77. package/renderer/FieldProgramDistanceKind.d.ts +26 -0
  78. package/renderer/FieldProgramDistanceKind.mjs +78 -0
  79. package/renderer/FieldProgramUnaryOp.d.mts +34 -0
  80. package/renderer/FieldProgramUnaryOp.d.ts +34 -0
  81. package/renderer/FieldProgramUnaryOp.mjs +102 -0
  82. package/renderer/FieldProgramValueType.d.mts +25 -0
  83. package/renderer/FieldProgramValueType.d.ts +25 -0
  84. package/renderer/FieldProgramValueType.mjs +75 -0
  85. package/renderer/FieldRange.d.mts +15 -0
  86. package/renderer/FieldRange.d.ts +15 -0
  87. package/renderer/FieldRange.mjs +109 -0
  88. package/renderer/Fingerprint.d.mts +44 -0
  89. package/renderer/Fingerprint.d.ts +44 -0
  90. package/renderer/Fingerprint.mjs +197 -0
  91. package/renderer/GeneratedChunk.d.mts +35 -0
  92. package/renderer/GeneratedChunk.d.ts +35 -0
  93. package/renderer/GeneratedChunk.mjs +178 -0
  94. package/renderer/GeneratedChunkCoverage.d.mts +25 -0
  95. package/renderer/GeneratedChunkCoverage.d.ts +25 -0
  96. package/renderer/GeneratedChunkCoverage.mjs +75 -0
  97. package/renderer/GeneratedChunkOverlayMode.d.mts +24 -0
  98. package/renderer/GeneratedChunkOverlayMode.d.ts +24 -0
  99. package/renderer/GeneratedChunkOverlayMode.mjs +72 -0
  100. package/renderer/GeneratedWorldStream.d.mts +28 -0
  101. package/renderer/GeneratedWorldStream.d.ts +28 -0
  102. package/renderer/GeneratedWorldStream.mjs +86 -0
  103. package/renderer/Geo.d.mts +41 -0
  104. package/renderer/Geo.d.ts +41 -0
  105. package/renderer/Geo.mjs +121 -0
  106. package/renderer/Hdl.d.mts +56 -0
  107. package/renderer/Hdl.d.ts +56 -0
  108. package/renderer/Hdl.mjs +163 -0
  109. package/renderer/InterpolationSpace.d.mts +25 -0
  110. package/renderer/InterpolationSpace.d.ts +25 -0
  111. package/renderer/InterpolationSpace.mjs +73 -0
  112. package/renderer/IoLayout.d.mts +26 -0
  113. package/renderer/IoLayout.d.ts +26 -0
  114. package/renderer/IoLayout.mjs +81 -0
  115. package/renderer/IoLayoutBuilder.d.mts +73 -0
  116. package/renderer/IoLayoutBuilder.d.ts +73 -0
  117. package/renderer/IoLayoutBuilder.mjs +315 -0
  118. package/renderer/IoType.d.mts +41 -0
  119. package/renderer/IoType.d.ts +41 -0
  120. package/renderer/IoType.mjs +125 -0
  121. package/renderer/ItemModelConfig.d.mts +65 -0
  122. package/renderer/ItemModelConfig.d.ts +65 -0
  123. package/renderer/ItemModelConfig.mjs +223 -0
  124. package/renderer/ItemModelPackBuilder.d.mts +32 -0
  125. package/renderer/ItemModelPackBuilder.d.ts +32 -0
  126. package/renderer/ItemModelPackBuilder.mjs +104 -0
  127. package/renderer/ItemModelResult.d.mts +72 -0
  128. package/renderer/ItemModelResult.d.ts +72 -0
  129. package/renderer/ItemModelResult.mjs +268 -0
  130. package/renderer/ItemScale.d.mts +31 -0
  131. package/renderer/ItemScale.d.ts +31 -0
  132. package/renderer/ItemScale.mjs +133 -0
  133. package/renderer/LayoutFunction.d.mts +52 -0
  134. package/renderer/LayoutFunction.d.ts +52 -0
  135. package/renderer/LayoutFunction.mjs +159 -0
  136. package/renderer/MchprsWorld.d.mts +131 -0
  137. package/renderer/MchprsWorld.d.ts +131 -0
  138. package/renderer/MchprsWorld.mjs +423 -0
  139. package/renderer/MeshBounds.d.mts +40 -0
  140. package/renderer/MeshBounds.d.ts +40 -0
  141. package/renderer/MeshBounds.mjs +181 -0
  142. package/renderer/MeshConfig.d.mts +101 -0
  143. package/renderer/MeshConfig.d.ts +101 -0
  144. package/renderer/MeshConfig.mjs +306 -0
  145. package/renderer/MeshJob.d.mts +44 -0
  146. package/renderer/MeshJob.d.ts +44 -0
  147. package/renderer/MeshJob.mjs +116 -0
  148. package/renderer/MeshPhase.d.mts +38 -0
  149. package/renderer/MeshPhase.d.ts +38 -0
  150. package/renderer/MeshPhase.mjs +90 -0
  151. package/renderer/MeshProgress.d.mts +32 -0
  152. package/renderer/MeshProgress.d.ts +32 -0
  153. package/renderer/MeshProgress.mjs +134 -0
  154. package/renderer/MeshResult.d.mts +76 -0
  155. package/renderer/MeshResult.d.ts +76 -0
  156. package/renderer/MeshResult.mjs +269 -0
  157. package/renderer/MultiMeshResult.d.mts +50 -0
  158. package/renderer/MultiMeshResult.d.ts +50 -0
  159. package/renderer/MultiMeshResult.mjs +166 -0
  160. package/renderer/Nbt.d.mts +50 -0
  161. package/renderer/Nbt.d.ts +50 -0
  162. package/renderer/Nbt.mjs +161 -0
  163. package/renderer/NucleationError.d.mts +53 -0
  164. package/renderer/NucleationError.d.ts +53 -0
  165. package/renderer/NucleationError.mjs +136 -0
  166. package/renderer/OutputCondition.d.mts +45 -0
  167. package/renderer/OutputCondition.d.ts +45 -0
  168. package/renderer/OutputCondition.mjs +129 -0
  169. package/renderer/Palette.d.mts +157 -0
  170. package/renderer/Palette.d.ts +157 -0
  171. package/renderer/Palette.mjs +487 -0
  172. package/renderer/PaletteBuilder.d.mts +119 -0
  173. package/renderer/PaletteBuilder.d.ts +119 -0
  174. package/renderer/PaletteBuilder.mjs +457 -0
  175. package/renderer/README.md +67 -0
  176. package/renderer/RawMeshExport.d.mts +74 -0
  177. package/renderer/RawMeshExport.d.ts +74 -0
  178. package/renderer/RawMeshExport.mjs +243 -0
  179. package/renderer/RedstoneGraph.d.mts +58 -0
  180. package/renderer/RedstoneGraph.d.ts +58 -0
  181. package/renderer/RedstoneGraph.mjs +242 -0
  182. package/renderer/RegionBounds.d.mts +41 -0
  183. package/renderer/RegionBounds.d.ts +41 -0
  184. package/renderer/RegionBounds.mjs +182 -0
  185. package/renderer/RenderConfig.d.mts +101 -0
  186. package/renderer/RenderConfig.d.ts +101 -0
  187. package/renderer/RenderConfig.mjs +271 -0
  188. package/renderer/Renderer.d.mts +51 -0
  189. package/renderer/Renderer.d.ts +51 -0
  190. package/renderer/Renderer.mjs +219 -0
  191. package/renderer/ResourcePack.d.mts +105 -0
  192. package/renderer/ResourcePack.d.ts +105 -0
  193. package/renderer/ResourcePack.mjs +447 -0
  194. package/renderer/ResourcePackList.d.mts +32 -0
  195. package/renderer/ResourcePackList.d.ts +32 -0
  196. package/renderer/ResourcePackList.mjs +96 -0
  197. package/renderer/Routing.d.mts +66 -0
  198. package/renderer/Routing.d.ts +66 -0
  199. package/renderer/Routing.mjs +220 -0
  200. package/renderer/Schematic.d.mts +977 -0
  201. package/renderer/Schematic.d.ts +977 -0
  202. package/renderer/Schematic.mjs +3820 -0
  203. package/renderer/SchematicBuilder.d.mts +103 -0
  204. package/renderer/SchematicBuilder.d.ts +103 -0
  205. package/renderer/SchematicBuilder.mjs +401 -0
  206. package/renderer/SchematicRegions.d.mts +93 -0
  207. package/renderer/SchematicRegions.d.ts +93 -0
  208. package/renderer/SchematicRegions.mjs +411 -0
  209. package/renderer/SchematicSplitResult.d.mts +26 -0
  210. package/renderer/SchematicSplitResult.d.ts +26 -0
  211. package/renderer/SchematicSplitResult.mjs +84 -0
  212. package/renderer/Scripting.d.mts +40 -0
  213. package/renderer/Scripting.d.ts +40 -0
  214. package/renderer/Scripting.mjs +138 -0
  215. package/renderer/Sdf.d.mts +234 -0
  216. package/renderer/Sdf.d.ts +234 -0
  217. package/renderer/Sdf.mjs +1234 -0
  218. package/renderer/SdfAxis.d.mts +25 -0
  219. package/renderer/SdfAxis.d.ts +25 -0
  220. package/renderer/SdfAxis.mjs +75 -0
  221. package/renderer/SdfBounds.d.mts +19 -0
  222. package/renderer/SdfBounds.d.ts +19 -0
  223. package/renderer/SdfBounds.mjs +161 -0
  224. package/renderer/SdfCellMode.d.mts +26 -0
  225. package/renderer/SdfCellMode.d.ts +26 -0
  226. package/renderer/SdfCellMode.mjs +78 -0
  227. package/renderer/SdfNormal.d.mts +16 -0
  228. package/renderer/SdfNormal.d.ts +16 -0
  229. package/renderer/SdfNormal.mjs +122 -0
  230. package/renderer/Shape.d.mts +143 -0
  231. package/renderer/Shape.d.ts +143 -0
  232. package/renderer/Shape.mjs +458 -0
  233. package/renderer/SortStrategy.d.mts +86 -0
  234. package/renderer/SortStrategy.d.ts +86 -0
  235. package/renderer/SortStrategy.mjs +272 -0
  236. package/renderer/Store.d.mts +83 -0
  237. package/renderer/Store.d.ts +83 -0
  238. package/renderer/Store.mjs +369 -0
  239. package/renderer/StoreIo.d.mts +71 -0
  240. package/renderer/StoreIo.d.ts +71 -0
  241. package/renderer/StoreIo.mjs +292 -0
  242. package/renderer/TextureAtlas.d.mts +40 -0
  243. package/renderer/TextureAtlas.d.ts +40 -0
  244. package/renderer/TextureAtlas.mjs +122 -0
  245. package/renderer/TextureInfo.d.mts +34 -0
  246. package/renderer/TextureInfo.d.ts +34 -0
  247. package/renderer/TextureInfo.mjs +149 -0
  248. package/renderer/TickSettleMode.d.mts +34 -0
  249. package/renderer/TickSettleMode.d.ts +34 -0
  250. package/renderer/TickSettleMode.mjs +84 -0
  251. package/renderer/TickSimulation.d.mts +572 -0
  252. package/renderer/TickSimulation.d.ts +572 -0
  253. package/renderer/TickSimulation.mjs +1299 -0
  254. package/renderer/TypedCircuitExecutor.d.mts +101 -0
  255. package/renderer/TypedCircuitExecutor.d.ts +101 -0
  256. package/renderer/TypedCircuitExecutor.mjs +378 -0
  257. package/renderer/Value.d.mts +73 -0
  258. package/renderer/Value.d.ts +73 -0
  259. package/renderer/Value.mjs +275 -0
  260. package/renderer/VideoConfig.d.mts +15 -0
  261. package/renderer/VideoConfig.d.ts +15 -0
  262. package/renderer/VideoConfig.mjs +44 -0
  263. package/renderer/VoxelModel.d.mts +34 -0
  264. package/renderer/VoxelModel.d.ts +34 -0
  265. package/renderer/VoxelModel.mjs +113 -0
  266. package/renderer/Voxelizer.d.mts +80 -0
  267. package/renderer/Voxelizer.d.ts +80 -0
  268. package/renderer/Voxelizer.mjs +261 -0
  269. package/renderer/WorldChunkView.d.mts +75 -0
  270. package/renderer/WorldChunkView.d.ts +75 -0
  271. package/renderer/WorldChunkView.mjs +224 -0
  272. package/renderer/WorldGenerator.d.mts +75 -0
  273. package/renderer/WorldGenerator.d.ts +75 -0
  274. package/renderer/WorldGenerator.mjs +255 -0
  275. package/renderer/WorldSink.d.mts +50 -0
  276. package/renderer/WorldSink.d.ts +50 -0
  277. package/renderer/WorldSink.mjs +177 -0
  278. package/renderer/WorldStream.d.mts +45 -0
  279. package/renderer/WorldStream.d.ts +45 -0
  280. package/renderer/WorldStream.mjs +184 -0
  281. package/renderer/WsPartitionHints.d.mts +29 -0
  282. package/renderer/WsPartitionHints.d.ts +29 -0
  283. package/renderer/WsPartitionHints.mjs +102 -0
  284. package/renderer/WsProfile.d.mts +46 -0
  285. package/renderer/WsProfile.d.ts +46 -0
  286. package/renderer/WsProfile.mjs +152 -0
  287. package/renderer/WsRunResult.d.mts +83 -0
  288. package/renderer/WsRunResult.d.ts +83 -0
  289. package/renderer/WsRunResult.mjs +326 -0
  290. package/renderer/WsSegmentJob.d.mts +28 -0
  291. package/renderer/WsSegmentJob.d.ts +28 -0
  292. package/renderer/WsSegmentJob.mjs +81 -0
  293. package/renderer/diplomat-runtime.d.mts +15 -0
  294. package/renderer/diplomat-runtime.d.ts +15 -0
  295. package/renderer/diplomat-runtime.mjs +779 -0
  296. package/renderer/diplomat-wasm.mjs +52 -0
  297. package/renderer/diplomat.config.mjs +5 -0
  298. package/renderer/index.d.mts +193 -0
  299. package/renderer/index.d.ts +193 -0
  300. package/renderer/index.mjs +196 -0
  301. package/renderer/nucleation.wasm +0 -0
  302. package/renderer/veneer/design.d.ts +167 -0
  303. package/renderer/veneer/design.mjs +480 -0
@@ -0,0 +1,75 @@
1
+ // generated by diplomat-tool
2
+ import type { BlockPos } from "./BlockPos.mjs"
3
+ import type { MeshConfig } from "./MeshConfig.mjs"
4
+ import type { MeshResult } from "./MeshResult.mjs"
5
+ import type { NucleationError } from "./NucleationError.mjs"
6
+ import type { ResourcePack } from "./ResourcePack.mjs"
7
+ import type { Schematic } from "./Schematic.mjs"
8
+ import type { TextureAtlas } from "./TextureAtlas.mjs"
9
+ import type { pointer, codepoint } from "./diplomat-runtime.d.ts";
10
+
11
+
12
+
13
+ /**
14
+ * Per-chunk mesh results. Wraps {@link crate::meshing::ChunkMeshResult}.
15
+ */
16
+ export class ChunkMeshResult {
17
+ /** @internal */
18
+ get ffiValue(): pointer;
19
+ /** @internal */
20
+ constructor();
21
+
22
+
23
+ /**
24
+ * Mesh with the default chunk size (old ABI: `schematic_mesh_by_chunk`).
25
+ */
26
+ static create(schematic: Schematic, pack: ResourcePack, config: MeshConfig): ChunkMeshResult;
27
+
28
+ /**
29
+ * Mesh with an explicit chunk size (old ABI: `schematic_mesh_by_chunk_size`).
30
+ */
31
+ static createWithSize(schematic: Schematic, pack: ResourcePack, config: MeshConfig, chunkSize: number): ChunkMeshResult;
32
+
33
+ /**
34
+ * Mesh chunks against a pre-built shared atlas, synchronously
35
+ * (old ABI: `schematic_mesh_chunks_with_atlas`). For progress
36
+ * reporting use {@link MeshJob::start} instead.
37
+ */
38
+ static createWithAtlas(schematic: Schematic, pack: ResourcePack, config: MeshConfig, chunkSize: number, atlas: TextureAtlas): ChunkMeshResult;
39
+
40
+ /**
41
+ * Number of chunk meshes.
42
+ */
43
+ chunkCount(): number;
44
+
45
+ /**
46
+ * Coordinate of the `index`-th chunk (old ABI:
47
+ * `chunkmeshresult_chunk_coordinates` returned all of them flat).
48
+ */
49
+ chunkCoordinateAt(index: number): BlockPos;
50
+
51
+ /**
52
+ * The mesh for one chunk coordinate (cloned).
53
+ */
54
+ getMesh(cx: number, cy: number, cz: number): MeshResult;
55
+
56
+ /**
57
+ * Total vertex count across all chunk meshes.
58
+ */
59
+ totalVertexCount(): number;
60
+
61
+ /**
62
+ * Total triangle count across all chunk meshes.
63
+ */
64
+ totalTriangleCount(): number;
65
+
66
+ /**
67
+ * All chunk meshes serialized in the NUCM cache format, base64-encoded.
68
+ */
69
+ nucmDataB64(): string;
70
+
71
+ /**
72
+ * NUCM v2 with a shared atlas, base64-encoded.
73
+ */
74
+ nucmDataWithAtlasB64(atlas: TextureAtlas): string;
75
+ }
@@ -0,0 +1,253 @@
1
+ // generated by diplomat-tool
2
+ import { BlockPos } from "./BlockPos.mjs"
3
+ import { MeshConfig } from "./MeshConfig.mjs"
4
+ import { MeshResult } from "./MeshResult.mjs"
5
+ import { NucleationError } from "./NucleationError.mjs"
6
+ import { ResourcePack } from "./ResourcePack.mjs"
7
+ import { Schematic } from "./Schematic.mjs"
8
+ import { TextureAtlas } from "./TextureAtlas.mjs"
9
+ import wasm from "./diplomat-wasm.mjs";
10
+ import * as diplomatRuntime from "./diplomat-runtime.mjs";
11
+
12
+ const ChunkMeshResult_box_destroy_registry = new FinalizationRegistry((ptr) => {
13
+ wasm.ChunkMeshResult_destroy(ptr);
14
+ });
15
+
16
+ /**
17
+ * Per-chunk mesh results. Wraps {@link crate::meshing::ChunkMeshResult}.
18
+ */
19
+ export class ChunkMeshResult {
20
+ // Internal ptr reference:
21
+ #ptr = null;
22
+
23
+ // Lifetimes are only to keep dependencies alive.
24
+ // Since JS won't garbage collect until there are no incoming edges.
25
+ #selfEdge = [];
26
+
27
+ #internalConstructor(symbol, ptr, selfEdge) {
28
+ if (symbol !== diplomatRuntime.internalConstructor) {
29
+ console.error("ChunkMeshResult is an Opaque type. You cannot call its constructor.");
30
+ return;
31
+ }
32
+ this.#ptr = ptr;
33
+ this.#selfEdge = selfEdge;
34
+
35
+ // Are we being borrowed? If not, we can register.
36
+ if (this.#selfEdge.length === 0) {
37
+ ChunkMeshResult_box_destroy_registry.register(this, this.#ptr);
38
+ }
39
+
40
+ return this;
41
+ }
42
+ /** @internal */
43
+ get ffiValue() {
44
+ return this.#ptr;
45
+ }
46
+
47
+
48
+ /**
49
+ * Mesh with the default chunk size (old ABI: `schematic_mesh_by_chunk`).
50
+ */
51
+ static create(schematic, pack, config) {
52
+ const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
53
+
54
+
55
+ const result = wasm.ChunkMeshResult_create(diplomatReceive.buffer, schematic.ffiValue, pack.ffiValue, config.ffiValue);
56
+
57
+ try {
58
+ if (!diplomatReceive.resultFlag) {
59
+ const cause = new NucleationError(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
60
+ throw new globalThis.Error('NucleationError.' + cause.value, { cause });
61
+ }
62
+ return new ChunkMeshResult(diplomatRuntime.internalConstructor, diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer), []);
63
+ }
64
+
65
+ finally {
66
+ diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
67
+ diplomatReceive.free();
68
+ }
69
+ }
70
+
71
+ /**
72
+ * Mesh with an explicit chunk size (old ABI: `schematic_mesh_by_chunk_size`).
73
+ */
74
+ static createWithSize(schematic, pack, config, chunkSize) {
75
+ const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
76
+
77
+
78
+ const result = wasm.ChunkMeshResult_create_with_size(diplomatReceive.buffer, schematic.ffiValue, pack.ffiValue, config.ffiValue, chunkSize);
79
+
80
+ try {
81
+ if (!diplomatReceive.resultFlag) {
82
+ const cause = new NucleationError(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
83
+ throw new globalThis.Error('NucleationError.' + cause.value, { cause });
84
+ }
85
+ return new ChunkMeshResult(diplomatRuntime.internalConstructor, diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer), []);
86
+ }
87
+
88
+ finally {
89
+ diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
90
+ diplomatReceive.free();
91
+ }
92
+ }
93
+
94
+ /**
95
+ * Mesh chunks against a pre-built shared atlas, synchronously
96
+ * (old ABI: `schematic_mesh_chunks_with_atlas`). For progress
97
+ * reporting use {@link MeshJob::start} instead.
98
+ */
99
+ static createWithAtlas(schematic, pack, config, chunkSize, atlas) {
100
+ const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
101
+
102
+
103
+ const result = wasm.ChunkMeshResult_create_with_atlas(diplomatReceive.buffer, schematic.ffiValue, pack.ffiValue, config.ffiValue, chunkSize, atlas.ffiValue);
104
+
105
+ try {
106
+ if (!diplomatReceive.resultFlag) {
107
+ const cause = new NucleationError(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
108
+ throw new globalThis.Error('NucleationError.' + cause.value, { cause });
109
+ }
110
+ return new ChunkMeshResult(diplomatRuntime.internalConstructor, diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer), []);
111
+ }
112
+
113
+ finally {
114
+ diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
115
+ diplomatReceive.free();
116
+ }
117
+ }
118
+
119
+ /**
120
+ * Number of chunk meshes.
121
+ */
122
+ chunkCount() {
123
+
124
+ const result = wasm.ChunkMeshResult_chunk_count(this.ffiValue);
125
+
126
+ try {
127
+ return result;
128
+ }
129
+
130
+ finally {
131
+ diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
132
+ }
133
+ }
134
+
135
+ /**
136
+ * Coordinate of the `index`-th chunk (old ABI:
137
+ * `chunkmeshresult_chunk_coordinates` returned all of them flat).
138
+ */
139
+ chunkCoordinateAt(index) {
140
+ const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 13, 4, true);
141
+
142
+
143
+ const result = wasm.ChunkMeshResult_chunk_coordinate_at(diplomatReceive.buffer, this.ffiValue, index);
144
+
145
+ try {
146
+ if (!diplomatReceive.resultFlag) {
147
+ const cause = new NucleationError(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
148
+ throw new globalThis.Error('NucleationError.' + cause.value, { cause });
149
+ }
150
+ return BlockPos._fromFFI(diplomatRuntime.internalConstructor, diplomatReceive.buffer);
151
+ }
152
+
153
+ finally {
154
+ diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
155
+ diplomatReceive.free();
156
+ }
157
+ }
158
+
159
+ /**
160
+ * The mesh for one chunk coordinate (cloned).
161
+ */
162
+ getMesh(cx, cy, cz) {
163
+ const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
164
+
165
+
166
+ const result = wasm.ChunkMeshResult_get_mesh(diplomatReceive.buffer, this.ffiValue, cx, cy, cz);
167
+
168
+ try {
169
+ if (!diplomatReceive.resultFlag) {
170
+ const cause = new NucleationError(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
171
+ throw new globalThis.Error('NucleationError.' + cause.value, { cause });
172
+ }
173
+ return new MeshResult(diplomatRuntime.internalConstructor, diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer), []);
174
+ }
175
+
176
+ finally {
177
+ diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
178
+ diplomatReceive.free();
179
+ }
180
+ }
181
+
182
+ /**
183
+ * Total vertex count across all chunk meshes.
184
+ */
185
+ totalVertexCount() {
186
+
187
+ const result = wasm.ChunkMeshResult_total_vertex_count(this.ffiValue);
188
+
189
+ try {
190
+ return result;
191
+ }
192
+
193
+ finally {
194
+ diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
195
+ }
196
+ }
197
+
198
+ /**
199
+ * Total triangle count across all chunk meshes.
200
+ */
201
+ totalTriangleCount() {
202
+
203
+ const result = wasm.ChunkMeshResult_total_triangle_count(this.ffiValue);
204
+
205
+ try {
206
+ return result;
207
+ }
208
+
209
+ finally {
210
+ diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
211
+ }
212
+ }
213
+
214
+ /**
215
+ * All chunk meshes serialized in the NUCM cache format, base64-encoded.
216
+ */
217
+ nucmDataB64() {
218
+ const write = new diplomatRuntime.DiplomatWriteBuf(wasm);
219
+
220
+ wasm.ChunkMeshResult_nucm_data_b64(this.ffiValue, write.buffer);
221
+
222
+ try {
223
+ return write.readString8();
224
+ }
225
+
226
+ finally {
227
+ diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
228
+ write.free();
229
+ }
230
+ }
231
+
232
+ /**
233
+ * NUCM v2 with a shared atlas, base64-encoded.
234
+ */
235
+ nucmDataWithAtlasB64(atlas) {
236
+ const write = new diplomatRuntime.DiplomatWriteBuf(wasm);
237
+
238
+ wasm.ChunkMeshResult_nucm_data_with_atlas_b64(this.ffiValue, atlas.ffiValue, write.buffer);
239
+
240
+ try {
241
+ return write.readString8();
242
+ }
243
+
244
+ finally {
245
+ diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
246
+ write.free();
247
+ }
248
+ }
249
+
250
+ constructor(symbol, ptr, selfEdge) {
251
+ return this.#internalConstructor(...arguments)
252
+ }
253
+ }
@@ -0,0 +1,118 @@
1
+ // generated by diplomat-tool
2
+ import type { IoType } from "./IoType.mjs"
3
+ import type { LayoutFunction } from "./LayoutFunction.mjs"
4
+ import type { NucleationError } from "./NucleationError.mjs"
5
+ import type { Schematic } from "./Schematic.mjs"
6
+ import type { SortStrategy } from "./SortStrategy.mjs"
7
+ import type { TypedCircuitExecutor } from "./TypedCircuitExecutor.mjs"
8
+ import type { pointer, codepoint } from "./diplomat-runtime.d.ts";
9
+
10
+
11
+
12
+ /**
13
+ * High-level circuit builder. `build`/`build_validated` consume it
14
+ * (PORTING rule 11). Regions are given as flat `[x,y,z,...]` positions
15
+ * (see module notes).
16
+ */
17
+ export class CircuitBuilder {
18
+ /** @internal */
19
+ get ffiValue(): pointer;
20
+ /** @internal */
21
+ constructor();
22
+
23
+
24
+ /**
25
+ * Create a builder for a schematic (cloned; no IO defined yet).
26
+ */
27
+ static create(schematic: Schematic): CircuitBuilder;
28
+
29
+ /**
30
+ * Create a builder pre-populated from Insign annotations.
31
+ */
32
+ static fromInsign(schematic: Schematic): CircuitBuilder;
33
+
34
+ /**
35
+ * Add an input with full control.
36
+ */
37
+ withInput(name: string, ioType: IoType, layout: LayoutFunction, regionPositions: Array<number>): void;
38
+
39
+ /**
40
+ * Add an input with full control and a custom sort strategy.
41
+ */
42
+ withInputSorted(name: string, ioType: IoType, layout: LayoutFunction, regionPositions: Array<number>, sort: SortStrategy): void;
43
+
44
+ /**
45
+ * Add an input with automatic layout inference.
46
+ */
47
+ withInputAuto(name: string, ioType: IoType, regionPositions: Array<number>): void;
48
+
49
+ /**
50
+ * Add an input with automatic layout inference and a custom sort.
51
+ */
52
+ withInputAutoSorted(name: string, ioType: IoType, regionPositions: Array<number>, sort: SortStrategy): void;
53
+
54
+ /**
55
+ * Add an output with full control.
56
+ */
57
+ withOutput(name: string, ioType: IoType, layout: LayoutFunction, regionPositions: Array<number>): void;
58
+
59
+ /**
60
+ * Add an output with full control and a custom sort strategy.
61
+ */
62
+ withOutputSorted(name: string, ioType: IoType, layout: LayoutFunction, regionPositions: Array<number>, sort: SortStrategy): void;
63
+
64
+ /**
65
+ * Add an output with automatic layout inference.
66
+ */
67
+ withOutputAuto(name: string, ioType: IoType, regionPositions: Array<number>): void;
68
+
69
+ /**
70
+ * Add an output with automatic layout inference and a custom sort.
71
+ */
72
+ withOutputAutoSorted(name: string, ioType: IoType, regionPositions: Array<number>, sort: SortStrategy): void;
73
+
74
+ /**
75
+ * Set simulation options.
76
+ */
77
+ withOptions(optimize: boolean, ioOnly: boolean): void;
78
+
79
+ /**
80
+ * Set the state mode ("stateless" | "stateful" | "manual").
81
+ */
82
+ withStateMode(mode: string): void;
83
+
84
+ /**
85
+ * Validate the configuration without consuming the builder.
86
+ */
87
+ validate(): void;
88
+
89
+ /**
90
+ * Build the executor. Consumes the builder.
91
+ */
92
+ build(): TypedCircuitExecutor;
93
+
94
+ /**
95
+ * Build the executor with validation. Consumes the builder.
96
+ */
97
+ buildValidated(): TypedCircuitExecutor;
98
+
99
+ /**
100
+ * Number of inputs defined so far (0 if the builder was consumed).
101
+ */
102
+ inputCount(): number;
103
+
104
+ /**
105
+ * Number of outputs defined so far (0 if the builder was consumed).
106
+ */
107
+ outputCount(): number;
108
+
109
+ /**
110
+ * Input names as a JSON array string.
111
+ */
112
+ inputNamesJson(): string;
113
+
114
+ /**
115
+ * Output names as a JSON array string.
116
+ */
117
+ outputNamesJson(): string;
118
+ }
@@ -0,0 +1,118 @@
1
+ // generated by diplomat-tool
2
+ import type { IoType } from "./IoType.mjs"
3
+ import type { LayoutFunction } from "./LayoutFunction.mjs"
4
+ import type { NucleationError } from "./NucleationError.mjs"
5
+ import type { Schematic } from "./Schematic.mjs"
6
+ import type { SortStrategy } from "./SortStrategy.mjs"
7
+ import type { TypedCircuitExecutor } from "./TypedCircuitExecutor.mjs"
8
+ import type { pointer, codepoint } from "./diplomat-runtime.d.ts";
9
+
10
+
11
+
12
+ /**
13
+ * High-level circuit builder. `build`/`build_validated` consume it
14
+ * (PORTING rule 11). Regions are given as flat `[x,y,z,...]` positions
15
+ * (see module notes).
16
+ */
17
+ export class CircuitBuilder {
18
+ /** @internal */
19
+ get ffiValue(): pointer;
20
+ /** @internal */
21
+ constructor();
22
+
23
+
24
+ /**
25
+ * Create a builder for a schematic (cloned; no IO defined yet).
26
+ */
27
+ static create(schematic: Schematic): CircuitBuilder;
28
+
29
+ /**
30
+ * Create a builder pre-populated from Insign annotations.
31
+ */
32
+ static fromInsign(schematic: Schematic): CircuitBuilder;
33
+
34
+ /**
35
+ * Add an input with full control.
36
+ */
37
+ withInput(name: string, ioType: IoType, layout: LayoutFunction, regionPositions: Array<number>): void;
38
+
39
+ /**
40
+ * Add an input with full control and a custom sort strategy.
41
+ */
42
+ withInputSorted(name: string, ioType: IoType, layout: LayoutFunction, regionPositions: Array<number>, sort: SortStrategy): void;
43
+
44
+ /**
45
+ * Add an input with automatic layout inference.
46
+ */
47
+ withInputAuto(name: string, ioType: IoType, regionPositions: Array<number>): void;
48
+
49
+ /**
50
+ * Add an input with automatic layout inference and a custom sort.
51
+ */
52
+ withInputAutoSorted(name: string, ioType: IoType, regionPositions: Array<number>, sort: SortStrategy): void;
53
+
54
+ /**
55
+ * Add an output with full control.
56
+ */
57
+ withOutput(name: string, ioType: IoType, layout: LayoutFunction, regionPositions: Array<number>): void;
58
+
59
+ /**
60
+ * Add an output with full control and a custom sort strategy.
61
+ */
62
+ withOutputSorted(name: string, ioType: IoType, layout: LayoutFunction, regionPositions: Array<number>, sort: SortStrategy): void;
63
+
64
+ /**
65
+ * Add an output with automatic layout inference.
66
+ */
67
+ withOutputAuto(name: string, ioType: IoType, regionPositions: Array<number>): void;
68
+
69
+ /**
70
+ * Add an output with automatic layout inference and a custom sort.
71
+ */
72
+ withOutputAutoSorted(name: string, ioType: IoType, regionPositions: Array<number>, sort: SortStrategy): void;
73
+
74
+ /**
75
+ * Set simulation options.
76
+ */
77
+ withOptions(optimize: boolean, ioOnly: boolean): void;
78
+
79
+ /**
80
+ * Set the state mode ("stateless" | "stateful" | "manual").
81
+ */
82
+ withStateMode(mode: string): void;
83
+
84
+ /**
85
+ * Validate the configuration without consuming the builder.
86
+ */
87
+ validate(): void;
88
+
89
+ /**
90
+ * Build the executor. Consumes the builder.
91
+ */
92
+ build(): TypedCircuitExecutor;
93
+
94
+ /**
95
+ * Build the executor with validation. Consumes the builder.
96
+ */
97
+ buildValidated(): TypedCircuitExecutor;
98
+
99
+ /**
100
+ * Number of inputs defined so far (0 if the builder was consumed).
101
+ */
102
+ inputCount(): number;
103
+
104
+ /**
105
+ * Number of outputs defined so far (0 if the builder was consumed).
106
+ */
107
+ outputCount(): number;
108
+
109
+ /**
110
+ * Input names as a JSON array string.
111
+ */
112
+ inputNamesJson(): string;
113
+
114
+ /**
115
+ * Output names as a JSON array string.
116
+ */
117
+ outputNamesJson(): string;
118
+ }