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,1234 @@
1
+ // generated by diplomat-tool
2
+ import { Field3 } from "./Field3.mjs"
3
+ import { FieldProgram } from "./FieldProgram.mjs"
4
+ import { NucleationError } from "./NucleationError.mjs"
5
+ import { Schematic } from "./Schematic.mjs"
6
+ import { SdfAxis } from "./SdfAxis.mjs"
7
+ import { SdfBounds } from "./SdfBounds.mjs"
8
+ import { SdfCellMode } from "./SdfCellMode.mjs"
9
+ import { SdfNormal } from "./SdfNormal.mjs"
10
+ import { Shape } from "./Shape.mjs"
11
+ import wasm from "./diplomat-wasm.mjs";
12
+ import * as diplomatRuntime from "./diplomat-runtime.mjs";
13
+
14
+ const Sdf_box_destroy_registry = new FinalizationRegistry((ptr) => {
15
+ wasm.Sdf_destroy(ptr);
16
+ });
17
+
18
+ /**
19
+ * An immutable, composable signed-distance-field expression graph.
20
+ *
21
+ * Primitive constructors and every combinator return a new graph, so values
22
+ * can be shared safely between Flow nodes and across Kotlin/Java, JavaScript,
23
+ * and Python bindings. JSON is retained only for explicit import/export and
24
+ * the legacy sampling helpers.
25
+ */
26
+ export class Sdf {
27
+ // Internal ptr reference:
28
+ #ptr = null;
29
+
30
+ // Lifetimes are only to keep dependencies alive.
31
+ // Since JS won't garbage collect until there are no incoming edges.
32
+ #selfEdge = [];
33
+
34
+ #internalConstructor(symbol, ptr, selfEdge) {
35
+ if (symbol !== diplomatRuntime.internalConstructor) {
36
+ console.error("Sdf is an Opaque type. You cannot call its constructor.");
37
+ return;
38
+ }
39
+ this.#ptr = ptr;
40
+ this.#selfEdge = selfEdge;
41
+
42
+ // Are we being borrowed? If not, we can register.
43
+ if (this.#selfEdge.length === 0) {
44
+ Sdf_box_destroy_registry.register(this, this.#ptr);
45
+ }
46
+
47
+ return this;
48
+ }
49
+ /** @internal */
50
+ get ffiValue() {
51
+ return this.#ptr;
52
+ }
53
+
54
+
55
+ static sphere(radius) {
56
+ const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
57
+
58
+
59
+ const result = wasm.Sdf_sphere(diplomatReceive.buffer, radius);
60
+
61
+ try {
62
+ if (!diplomatReceive.resultFlag) {
63
+ const cause = new NucleationError(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
64
+ throw new globalThis.Error('NucleationError.' + cause.value, { cause });
65
+ }
66
+ return new Sdf(diplomatRuntime.internalConstructor, diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer), []);
67
+ }
68
+
69
+ finally {
70
+ diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
71
+ diplomatReceive.free();
72
+ }
73
+ }
74
+
75
+ /**
76
+ * Axis-aligned rounded box, centered at the origin.
77
+ */
78
+ static boxShape(halfX, halfY, halfZ, rounding) {
79
+ const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
80
+
81
+
82
+ const result = wasm.Sdf_box_shape(diplomatReceive.buffer, halfX, halfY, halfZ, rounding);
83
+
84
+ try {
85
+ if (!diplomatReceive.resultFlag) {
86
+ const cause = new NucleationError(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
87
+ throw new globalThis.Error('NucleationError.' + cause.value, { cause });
88
+ }
89
+ return new Sdf(diplomatRuntime.internalConstructor, diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer), []);
90
+ }
91
+
92
+ finally {
93
+ diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
94
+ diplomatReceive.free();
95
+ }
96
+ }
97
+
98
+ static ellipsoid(radiusX, radiusY, radiusZ) {
99
+ const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
100
+
101
+
102
+ const result = wasm.Sdf_ellipsoid(diplomatReceive.buffer, radiusX, radiusY, radiusZ);
103
+
104
+ try {
105
+ if (!diplomatReceive.resultFlag) {
106
+ const cause = new NucleationError(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
107
+ throw new globalThis.Error('NucleationError.' + cause.value, { cause });
108
+ }
109
+ return new Sdf(diplomatRuntime.internalConstructor, diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer), []);
110
+ }
111
+
112
+ finally {
113
+ diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
114
+ diplomatReceive.free();
115
+ }
116
+ }
117
+
118
+ static torus(majorRadius, minorRadius) {
119
+ const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
120
+
121
+
122
+ const result = wasm.Sdf_torus(diplomatReceive.buffer, majorRadius, minorRadius);
123
+
124
+ try {
125
+ if (!diplomatReceive.resultFlag) {
126
+ const cause = new NucleationError(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
127
+ throw new globalThis.Error('NucleationError.' + cause.value, { cause });
128
+ }
129
+ return new Sdf(diplomatRuntime.internalConstructor, diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer), []);
130
+ }
131
+
132
+ finally {
133
+ diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
134
+ diplomatReceive.free();
135
+ }
136
+ }
137
+
138
+ /**
139
+ * Torus ring cut down to an arc. `cap_angle_degrees` is the half-aperture
140
+ * in `(0, 180]`, measured from +X and mirrored across X; `180` is a full
141
+ * torus.
142
+ */
143
+ static cappedTorus(majorRadius, minorRadius, capAngleDegrees) {
144
+ const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
145
+
146
+
147
+ const result = wasm.Sdf_capped_torus(diplomatReceive.buffer, majorRadius, minorRadius, capAngleDegrees);
148
+
149
+ try {
150
+ if (!diplomatReceive.resultFlag) {
151
+ const cause = new NucleationError(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
152
+ throw new globalThis.Error('NucleationError.' + cause.value, { cause });
153
+ }
154
+ return new Sdf(diplomatRuntime.internalConstructor, diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer), []);
155
+ }
156
+
157
+ finally {
158
+ diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
159
+ diplomatReceive.free();
160
+ }
161
+ }
162
+
163
+ /**
164
+ * Chain-link shape: a torus stretched along Z by `half_length` and
165
+ * capped by two half-tori. `half_length: 0` is a plain torus.
166
+ */
167
+ static link(majorRadius, minorRadius, halfLength) {
168
+ const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
169
+
170
+
171
+ const result = wasm.Sdf_link(diplomatReceive.buffer, majorRadius, minorRadius, halfLength);
172
+
173
+ try {
174
+ if (!diplomatReceive.resultFlag) {
175
+ const cause = new NucleationError(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
176
+ throw new globalThis.Error('NucleationError.' + cause.value, { cause });
177
+ }
178
+ return new Sdf(diplomatRuntime.internalConstructor, diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer), []);
179
+ }
180
+
181
+ finally {
182
+ diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
183
+ diplomatReceive.free();
184
+ }
185
+ }
186
+
187
+ static capsule(ax, ay, az, bx, by, bz, radius) {
188
+ const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
189
+
190
+
191
+ const result = wasm.Sdf_capsule(diplomatReceive.buffer, ax, ay, az, bx, by, bz, radius);
192
+
193
+ try {
194
+ if (!diplomatReceive.resultFlag) {
195
+ const cause = new NucleationError(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
196
+ throw new globalThis.Error('NucleationError.' + cause.value, { cause });
197
+ }
198
+ return new Sdf(diplomatRuntime.internalConstructor, diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer), []);
199
+ }
200
+
201
+ finally {
202
+ diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
203
+ diplomatReceive.free();
204
+ }
205
+ }
206
+
207
+ /**
208
+ * Convex hull of two spheres: a capsule with a linear taper between
209
+ * `r1` (at `a`) and `r2` (at `b`) instead of one constant radius.
210
+ */
211
+ static roundCone(ax, ay, az, bx, by, bz, r1, r2) {
212
+ const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
213
+
214
+
215
+ const result = wasm.Sdf_round_cone(diplomatReceive.buffer, ax, ay, az, bx, by, bz, r1, r2);
216
+
217
+ try {
218
+ if (!diplomatReceive.resultFlag) {
219
+ const cause = new NucleationError(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
220
+ throw new globalThis.Error('NucleationError.' + cause.value, { cause });
221
+ }
222
+ return new Sdf(diplomatRuntime.internalConstructor, diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer), []);
223
+ }
224
+
225
+ finally {
226
+ diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
227
+ diplomatReceive.free();
228
+ }
229
+ }
230
+
231
+ /**
232
+ * Sphere of `radius` intersected with an infinite cone of
233
+ * half-aperture `angle_degrees` (in `(0, 180)`) from the +Y axis,
234
+ * apex at the origin.
235
+ */
236
+ static solidAngle(radius, angleDegrees) {
237
+ const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
238
+
239
+
240
+ const result = wasm.Sdf_solid_angle(diplomatReceive.buffer, radius, angleDegrees);
241
+
242
+ try {
243
+ if (!diplomatReceive.resultFlag) {
244
+ const cause = new NucleationError(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
245
+ throw new globalThis.Error('NucleationError.' + cause.value, { cause });
246
+ }
247
+ return new Sdf(diplomatRuntime.internalConstructor, diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer), []);
248
+ }
249
+
250
+ finally {
251
+ diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
252
+ diplomatReceive.free();
253
+ }
254
+ }
255
+
256
+ /**
257
+ * Sphere cut by the plane `y = height`, keeping the cap above it
258
+ * (a dome). `height` must be strictly between `-radius` and
259
+ * `radius`.
260
+ */
261
+ static cutSphere(radius, height) {
262
+ const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
263
+
264
+
265
+ const result = wasm.Sdf_cut_sphere(diplomatReceive.buffer, radius, height);
266
+
267
+ try {
268
+ if (!diplomatReceive.resultFlag) {
269
+ const cause = new NucleationError(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
270
+ throw new globalThis.Error('NucleationError.' + cause.value, { cause });
271
+ }
272
+ return new Sdf(diplomatRuntime.internalConstructor, diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer), []);
273
+ }
274
+
275
+ finally {
276
+ diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
277
+ diplomatReceive.free();
278
+ }
279
+ }
280
+
281
+ /**
282
+ * Open (hollow) shell of `cut_sphere`'s dome: just the spherical
283
+ * cap surface, offset by `thickness`, with no flat floor.
284
+ */
285
+ static cutHollowSphere(radius, height, thickness) {
286
+ const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
287
+
288
+
289
+ const result = wasm.Sdf_cut_hollow_sphere(diplomatReceive.buffer, radius, height, thickness);
290
+
291
+ try {
292
+ if (!diplomatReceive.resultFlag) {
293
+ const cause = new NucleationError(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
294
+ throw new globalThis.Error('NucleationError.' + cause.value, { cause });
295
+ }
296
+ return new Sdf(diplomatRuntime.internalConstructor, diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer), []);
297
+ }
298
+
299
+ finally {
300
+ diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
301
+ diplomatReceive.free();
302
+ }
303
+ }
304
+
305
+ static cappedCylinder(radius, halfHeight) {
306
+ const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
307
+
308
+
309
+ const result = wasm.Sdf_capped_cylinder(diplomatReceive.buffer, radius, halfHeight);
310
+
311
+ try {
312
+ if (!diplomatReceive.resultFlag) {
313
+ const cause = new NucleationError(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
314
+ throw new globalThis.Error('NucleationError.' + cause.value, { cause });
315
+ }
316
+ return new Sdf(diplomatRuntime.internalConstructor, diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer), []);
317
+ }
318
+
319
+ finally {
320
+ diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
321
+ diplomatReceive.free();
322
+ }
323
+ }
324
+
325
+ /**
326
+ * Exact Y-axis cylinder with infinite extent. Sampling requires explicit bounds.
327
+ */
328
+ static infiniteCylinder(radius) {
329
+ const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
330
+
331
+
332
+ const result = wasm.Sdf_infinite_cylinder(diplomatReceive.buffer, radius);
333
+
334
+ try {
335
+ if (!diplomatReceive.resultFlag) {
336
+ const cause = new NucleationError(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
337
+ throw new globalThis.Error('NucleationError.' + cause.value, { cause });
338
+ }
339
+ return new Sdf(diplomatRuntime.internalConstructor, diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer), []);
340
+ }
341
+
342
+ finally {
343
+ diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
344
+ diplomatReceive.free();
345
+ }
346
+ }
347
+
348
+ static cappedCone(halfHeight, bottomRadius, topRadius) {
349
+ const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
350
+
351
+
352
+ const result = wasm.Sdf_capped_cone(diplomatReceive.buffer, halfHeight, bottomRadius, topRadius);
353
+
354
+ try {
355
+ if (!diplomatReceive.resultFlag) {
356
+ const cause = new NucleationError(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
357
+ throw new globalThis.Error('NucleationError.' + cause.value, { cause });
358
+ }
359
+ return new Sdf(diplomatRuntime.internalConstructor, diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer), []);
360
+ }
361
+
362
+ finally {
363
+ diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
364
+ diplomatReceive.free();
365
+ }
366
+ }
367
+
368
+ static plane(normalX, normalY, normalZ, offset) {
369
+ const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
370
+
371
+
372
+ const result = wasm.Sdf_plane(diplomatReceive.buffer, normalX, normalY, normalZ, offset);
373
+
374
+ try {
375
+ if (!diplomatReceive.resultFlag) {
376
+ const cause = new NucleationError(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
377
+ throw new globalThis.Error('NucleationError.' + cause.value, { cause });
378
+ }
379
+ return new Sdf(diplomatRuntime.internalConstructor, diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer), []);
380
+ }
381
+
382
+ finally {
383
+ diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
384
+ diplomatReceive.free();
385
+ }
386
+ }
387
+
388
+ static octahedron(size) {
389
+ const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
390
+
391
+
392
+ const result = wasm.Sdf_octahedron(diplomatReceive.buffer, size);
393
+
394
+ try {
395
+ if (!diplomatReceive.resultFlag) {
396
+ const cause = new NucleationError(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
397
+ throw new globalThis.Error('NucleationError.' + cause.value, { cause });
398
+ }
399
+ return new Sdf(diplomatRuntime.internalConstructor, diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer), []);
400
+ }
401
+
402
+ finally {
403
+ diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
404
+ diplomatReceive.free();
405
+ }
406
+ }
407
+
408
+ static hexPrism(radius, halfHeight) {
409
+ const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
410
+
411
+
412
+ const result = wasm.Sdf_hex_prism(diplomatReceive.buffer, radius, halfHeight);
413
+
414
+ try {
415
+ if (!diplomatReceive.resultFlag) {
416
+ const cause = new NucleationError(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
417
+ throw new globalThis.Error('NucleationError.' + cause.value, { cause });
418
+ }
419
+ return new Sdf(diplomatRuntime.internalConstructor, diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer), []);
420
+ }
421
+
422
+ finally {
423
+ diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
424
+ diplomatReceive.free();
425
+ }
426
+ }
427
+
428
+ static superPrism(halfX, halfY, halfZ, exponent) {
429
+ const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
430
+
431
+
432
+ const result = wasm.Sdf_super_prism(diplomatReceive.buffer, halfX, halfY, halfZ, exponent);
433
+
434
+ try {
435
+ if (!diplomatReceive.resultFlag) {
436
+ const cause = new NucleationError(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
437
+ throw new globalThis.Error('NucleationError.' + cause.value, { cause });
438
+ }
439
+ return new Sdf(diplomatRuntime.internalConstructor, diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer), []);
440
+ }
441
+
442
+ finally {
443
+ diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
444
+ diplomatReceive.free();
445
+ }
446
+ }
447
+
448
+ /**
449
+ * Hollow wireframe box: only the 12 edge beams are solid.
450
+ */
451
+ static boxFrame(halfX, halfY, halfZ, thickness) {
452
+ const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
453
+
454
+
455
+ const result = wasm.Sdf_box_frame(diplomatReceive.buffer, halfX, halfY, halfZ, thickness);
456
+
457
+ try {
458
+ if (!diplomatReceive.resultFlag) {
459
+ const cause = new NucleationError(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
460
+ throw new globalThis.Error('NucleationError.' + cause.value, { cause });
461
+ }
462
+ return new Sdf(diplomatRuntime.internalConstructor, diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer), []);
463
+ }
464
+
465
+ finally {
466
+ diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
467
+ diplomatReceive.free();
468
+ }
469
+ }
470
+
471
+ /**
472
+ * Exact but unbounded Y-axis infinite cone: apex at the origin,
473
+ * single nappe opening along +Y, half-aperture `angle_degrees`
474
+ * strictly in `(0, 90)`.
475
+ */
476
+ static infiniteCone(angleDegrees) {
477
+ const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
478
+
479
+
480
+ const result = wasm.Sdf_infinite_cone(diplomatReceive.buffer, angleDegrees);
481
+
482
+ try {
483
+ if (!diplomatReceive.resultFlag) {
484
+ const cause = new NucleationError(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
485
+ throw new globalThis.Error('NucleationError.' + cause.value, { cause });
486
+ }
487
+ return new Sdf(diplomatRuntime.internalConstructor, diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer), []);
488
+ }
489
+
490
+ finally {
491
+ diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
492
+ diplomatReceive.free();
493
+ }
494
+ }
495
+
496
+ /**
497
+ * Square-base pyramid, vertically centered: base (half-extent
498
+ * `half_base`) at `y = -height/2`, apex at `y = height/2`. `height`
499
+ * must be at least the smallest positive normal `f32`.
500
+ */
501
+ static squarePyramid(halfBase, height) {
502
+ const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
503
+
504
+
505
+ const result = wasm.Sdf_square_pyramid(diplomatReceive.buffer, halfBase, height);
506
+
507
+ try {
508
+ if (!diplomatReceive.resultFlag) {
509
+ const cause = new NucleationError(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
510
+ throw new globalThis.Error('NucleationError.' + cause.value, { cause });
511
+ }
512
+ return new Sdf(diplomatRuntime.internalConstructor, diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer), []);
513
+ }
514
+
515
+ finally {
516
+ diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
517
+ diplomatReceive.free();
518
+ }
519
+ }
520
+
521
+ static cells(frequency, seed, jitter, mode, threshold) {
522
+ const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
523
+
524
+
525
+ const result = wasm.Sdf_cells(diplomatReceive.buffer, frequency, seed, jitter, mode.ffiValue, threshold);
526
+
527
+ try {
528
+ if (!diplomatReceive.resultFlag) {
529
+ const cause = new NucleationError(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
530
+ throw new globalThis.Error('NucleationError.' + cause.value, { cause });
531
+ }
532
+ return new Sdf(diplomatRuntime.internalConstructor, diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer), []);
533
+ }
534
+
535
+ finally {
536
+ diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
537
+ diplomatReceive.free();
538
+ }
539
+ }
540
+
541
+ unionWith(other) {
542
+
543
+ const result = wasm.Sdf_union_with(this.ffiValue, other.ffiValue);
544
+
545
+ try {
546
+ return new Sdf(diplomatRuntime.internalConstructor, result, []);
547
+ }
548
+
549
+ finally {
550
+ diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
551
+ }
552
+ }
553
+
554
+ intersectionWith(other) {
555
+
556
+ const result = wasm.Sdf_intersection_with(this.ffiValue, other.ffiValue);
557
+
558
+ try {
559
+ return new Sdf(diplomatRuntime.internalConstructor, result, []);
560
+ }
561
+
562
+ finally {
563
+ diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
564
+ }
565
+ }
566
+
567
+ subtract(other) {
568
+
569
+ const result = wasm.Sdf_subtract(this.ffiValue, other.ffiValue);
570
+
571
+ try {
572
+ return new Sdf(diplomatRuntime.internalConstructor, result, []);
573
+ }
574
+
575
+ finally {
576
+ diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
577
+ }
578
+ }
579
+
580
+ smoothUnion(other, radius) {
581
+ const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
582
+
583
+
584
+ const result = wasm.Sdf_smooth_union(diplomatReceive.buffer, this.ffiValue, other.ffiValue, radius);
585
+
586
+ try {
587
+ if (!diplomatReceive.resultFlag) {
588
+ const cause = new NucleationError(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
589
+ throw new globalThis.Error('NucleationError.' + cause.value, { cause });
590
+ }
591
+ return new Sdf(diplomatRuntime.internalConstructor, diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer), []);
592
+ }
593
+
594
+ finally {
595
+ diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
596
+ diplomatReceive.free();
597
+ }
598
+ }
599
+
600
+ smoothSubtract(other, radius) {
601
+ const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
602
+
603
+
604
+ const result = wasm.Sdf_smooth_subtract(diplomatReceive.buffer, this.ffiValue, other.ffiValue, radius);
605
+
606
+ try {
607
+ if (!diplomatReceive.resultFlag) {
608
+ const cause = new NucleationError(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
609
+ throw new globalThis.Error('NucleationError.' + cause.value, { cause });
610
+ }
611
+ return new Sdf(diplomatRuntime.internalConstructor, diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer), []);
612
+ }
613
+
614
+ finally {
615
+ diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
616
+ diplomatReceive.free();
617
+ }
618
+ }
619
+
620
+ smoothIntersection(other, radius) {
621
+ const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
622
+
623
+
624
+ const result = wasm.Sdf_smooth_intersection(diplomatReceive.buffer, this.ffiValue, other.ffiValue, radius);
625
+
626
+ try {
627
+ if (!diplomatReceive.resultFlag) {
628
+ const cause = new NucleationError(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
629
+ throw new globalThis.Error('NucleationError.' + cause.value, { cause });
630
+ }
631
+ return new Sdf(diplomatRuntime.internalConstructor, diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer), []);
632
+ }
633
+
634
+ finally {
635
+ diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
636
+ diplomatReceive.free();
637
+ }
638
+ }
639
+
640
+ rounded(radius) {
641
+ const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
642
+
643
+
644
+ const result = wasm.Sdf_rounded(diplomatReceive.buffer, this.ffiValue, radius);
645
+
646
+ try {
647
+ if (!diplomatReceive.resultFlag) {
648
+ const cause = new NucleationError(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
649
+ throw new globalThis.Error('NucleationError.' + cause.value, { cause });
650
+ }
651
+ return new Sdf(diplomatRuntime.internalConstructor, diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer), []);
652
+ }
653
+
654
+ finally {
655
+ diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
656
+ diplomatReceive.free();
657
+ }
658
+ }
659
+
660
+ shell(thickness) {
661
+ const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
662
+
663
+
664
+ const result = wasm.Sdf_shell(diplomatReceive.buffer, this.ffiValue, thickness);
665
+
666
+ try {
667
+ if (!diplomatReceive.resultFlag) {
668
+ const cause = new NucleationError(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
669
+ throw new globalThis.Error('NucleationError.' + cause.value, { cause });
670
+ }
671
+ return new Sdf(diplomatRuntime.internalConstructor, diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer), []);
672
+ }
673
+
674
+ finally {
675
+ diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
676
+ diplomatReceive.free();
677
+ }
678
+ }
679
+
680
+ /**
681
+ * Symmetric difference (XOR): solid where exactly one of `self`/
682
+ * `other` is solid.
683
+ */
684
+ xorWith(other) {
685
+
686
+ const result = wasm.Sdf_xor_with(this.ffiValue, other.ffiValue);
687
+
688
+ try {
689
+ return new Sdf(diplomatRuntime.internalConstructor, result, []);
690
+ }
691
+
692
+ finally {
693
+ diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
694
+ }
695
+ }
696
+
697
+ /**
698
+ * Stretches this graph with IQ's origin-centered `opElongate` fold.
699
+ * Exactness requires a suitable origin-centered, reflection-symmetric
700
+ * child; off-center/asymmetric children are mirrored and produce only
701
+ * an estimate. Half-lengths must be finite and non-negative, with at
702
+ * least one strictly positive.
703
+ */
704
+ elongate(halfX, halfY, halfZ) {
705
+ const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
706
+
707
+
708
+ const result = wasm.Sdf_elongate(diplomatReceive.buffer, this.ffiValue, halfX, halfY, halfZ);
709
+
710
+ try {
711
+ if (!diplomatReceive.resultFlag) {
712
+ const cause = new NucleationError(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
713
+ throw new globalThis.Error('NucleationError.' + cause.value, { cause });
714
+ }
715
+ return new Sdf(diplomatRuntime.internalConstructor, diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer), []);
716
+ }
717
+
718
+ finally {
719
+ diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
720
+ diplomatReceive.free();
721
+ }
722
+ }
723
+
724
+ translate(x, y, z) {
725
+ const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
726
+
727
+
728
+ const result = wasm.Sdf_translate(diplomatReceive.buffer, this.ffiValue, x, y, z);
729
+
730
+ try {
731
+ if (!diplomatReceive.resultFlag) {
732
+ const cause = new NucleationError(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
733
+ throw new globalThis.Error('NucleationError.' + cause.value, { cause });
734
+ }
735
+ return new Sdf(diplomatRuntime.internalConstructor, diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer), []);
736
+ }
737
+
738
+ finally {
739
+ diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
740
+ diplomatReceive.free();
741
+ }
742
+ }
743
+
744
+ rotate(xDegrees, yDegrees, zDegrees) {
745
+ const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
746
+
747
+
748
+ const result = wasm.Sdf_rotate(diplomatReceive.buffer, this.ffiValue, xDegrees, yDegrees, zDegrees);
749
+
750
+ try {
751
+ if (!diplomatReceive.resultFlag) {
752
+ const cause = new NucleationError(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
753
+ throw new globalThis.Error('NucleationError.' + cause.value, { cause });
754
+ }
755
+ return new Sdf(diplomatRuntime.internalConstructor, diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer), []);
756
+ }
757
+
758
+ finally {
759
+ diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
760
+ diplomatReceive.free();
761
+ }
762
+ }
763
+
764
+ scale(factor) {
765
+ const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
766
+
767
+
768
+ const result = wasm.Sdf_scale(diplomatReceive.buffer, this.ffiValue, factor);
769
+
770
+ try {
771
+ if (!diplomatReceive.resultFlag) {
772
+ const cause = new NucleationError(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
773
+ throw new globalThis.Error('NucleationError.' + cause.value, { cause });
774
+ }
775
+ return new Sdf(diplomatRuntime.internalConstructor, diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer), []);
776
+ }
777
+
778
+ finally {
779
+ diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
780
+ diplomatReceive.free();
781
+ }
782
+ }
783
+
784
+ mirror(axis) {
785
+
786
+ const result = wasm.Sdf_mirror(this.ffiValue, axis.ffiValue);
787
+
788
+ try {
789
+ return new Sdf(diplomatRuntime.internalConstructor, result, []);
790
+ }
791
+
792
+ finally {
793
+ diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
794
+ }
795
+ }
796
+
797
+ /**
798
+ * Twists this graph about the Y axis by `amount` radians per unit
799
+ * Y (IQ's `opTwist`). *Distorted*: not guaranteed exact even when
800
+ * `self` is.
801
+ */
802
+ twist(amount) {
803
+ const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
804
+
805
+
806
+ const result = wasm.Sdf_twist(diplomatReceive.buffer, this.ffiValue, amount);
807
+
808
+ try {
809
+ if (!diplomatReceive.resultFlag) {
810
+ const cause = new NucleationError(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
811
+ throw new globalThis.Error('NucleationError.' + cause.value, { cause });
812
+ }
813
+ return new Sdf(diplomatRuntime.internalConstructor, diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer), []);
814
+ }
815
+
816
+ finally {
817
+ diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
818
+ diplomatReceive.free();
819
+ }
820
+ }
821
+
822
+ /**
823
+ * Cheaply bends this graph by `amount` radians per unit X (IQ's
824
+ * `opCheapBend`). *Distorted*: not guaranteed exact even when
825
+ * `self` is.
826
+ */
827
+ bend(amount) {
828
+ const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
829
+
830
+
831
+ const result = wasm.Sdf_bend(diplomatReceive.buffer, this.ffiValue, amount);
832
+
833
+ try {
834
+ if (!diplomatReceive.resultFlag) {
835
+ const cause = new NucleationError(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
836
+ throw new globalThis.Error('NucleationError.' + cause.value, { cause });
837
+ }
838
+ return new Sdf(diplomatRuntime.internalConstructor, diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer), []);
839
+ }
840
+
841
+ finally {
842
+ diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
843
+ diplomatReceive.free();
844
+ }
845
+ }
846
+
847
+ repeatInfinite(spacingX, spacingY, spacingZ) {
848
+ const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
849
+
850
+
851
+ const result = wasm.Sdf_repeat_infinite(diplomatReceive.buffer, this.ffiValue, spacingX, spacingY, spacingZ);
852
+
853
+ try {
854
+ if (!diplomatReceive.resultFlag) {
855
+ const cause = new NucleationError(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
856
+ throw new globalThis.Error('NucleationError.' + cause.value, { cause });
857
+ }
858
+ return new Sdf(diplomatRuntime.internalConstructor, diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer), []);
859
+ }
860
+
861
+ finally {
862
+ diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
863
+ diplomatReceive.free();
864
+ }
865
+ }
866
+
867
+ repeatCounted(spacingX, spacingY, spacingZ, countX, countY, countZ) {
868
+ const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
869
+
870
+
871
+ const result = wasm.Sdf_repeat_counted(diplomatReceive.buffer, this.ffiValue, spacingX, spacingY, spacingZ, countX, countY, countZ);
872
+
873
+ try {
874
+ if (!diplomatReceive.resultFlag) {
875
+ const cause = new NucleationError(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
876
+ throw new globalThis.Error('NucleationError.' + cause.value, { cause });
877
+ }
878
+ return new Sdf(diplomatRuntime.internalConstructor, diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer), []);
879
+ }
880
+
881
+ finally {
882
+ diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
883
+ diplomatReceive.free();
884
+ }
885
+ }
886
+
887
+ /**
888
+ * Finite rigid instances of this graph at arbitrary XYZ offsets.
889
+ * `offsets` is flat `[x0, y0, z0, x1, y1, z1, ...]` and may contain
890
+ * at most 4096 points.
891
+ */
892
+ repeatPoints(offsets) {
893
+ let functionCleanupArena = new diplomatRuntime.CleanupArena();
894
+
895
+ const offsetsSlice = functionCleanupArena.alloc(diplomatRuntime.DiplomatBuf.sliceWrapper(wasm, diplomatRuntime.DiplomatBuf.slice(wasm, offsets, "f32")));
896
+ const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
897
+
898
+
899
+ const result = wasm.Sdf_repeat_points(diplomatReceive.buffer, this.ffiValue, offsetsSlice.ptr);
900
+
901
+ try {
902
+ if (!diplomatReceive.resultFlag) {
903
+ const cause = new NucleationError(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
904
+ throw new globalThis.Error('NucleationError.' + cause.value, { cause });
905
+ }
906
+ return new Sdf(diplomatRuntime.internalConstructor, diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer), []);
907
+ }
908
+
909
+ finally {
910
+ diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
911
+ functionCleanupArena.free();
912
+
913
+ diplomatReceive.free();
914
+ }
915
+ }
916
+
917
+ displace(amplitude, frequency, seed, octaves) {
918
+ const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
919
+
920
+
921
+ const result = wasm.Sdf_displace(diplomatReceive.buffer, this.ffiValue, amplitude, frequency, seed, octaves);
922
+
923
+ try {
924
+ if (!diplomatReceive.resultFlag) {
925
+ const cause = new NucleationError(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
926
+ throw new globalThis.Error('NucleationError.' + cause.value, { cause });
927
+ }
928
+ return new Sdf(diplomatRuntime.internalConstructor, diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer), []);
929
+ }
930
+
931
+ finally {
932
+ diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
933
+ diplomatReceive.free();
934
+ }
935
+ }
936
+
937
+ /**
938
+ * Offset this surface by a reusable scalar field. The resulting zero
939
+ * set is generally an approximate field, not an exact distance field.
940
+ */
941
+ offsetByField(field, amplitude) {
942
+ const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
943
+
944
+
945
+ const result = wasm.Sdf_offset_by_field(diplomatReceive.buffer, this.ffiValue, field.ffiValue, amplitude);
946
+
947
+ try {
948
+ if (!diplomatReceive.resultFlag) {
949
+ const cause = new NucleationError(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
950
+ throw new globalThis.Error('NucleationError.' + cause.value, { cause });
951
+ }
952
+ return new Sdf(diplomatRuntime.internalConstructor, diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer), []);
953
+ }
954
+
955
+ finally {
956
+ diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
957
+ diplomatReceive.free();
958
+ }
959
+ }
960
+
961
+ warp(amplitude, frequency, seed) {
962
+ const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
963
+
964
+
965
+ const result = wasm.Sdf_warp(diplomatReceive.buffer, this.ffiValue, amplitude, frequency, seed);
966
+
967
+ try {
968
+ if (!diplomatReceive.resultFlag) {
969
+ const cause = new NucleationError(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
970
+ throw new globalThis.Error('NucleationError.' + cause.value, { cause });
971
+ }
972
+ return new Sdf(diplomatRuntime.internalConstructor, diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer), []);
973
+ }
974
+
975
+ finally {
976
+ diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
977
+ diplomatReceive.free();
978
+ }
979
+ }
980
+
981
+ evalAt(x, y, z) {
982
+
983
+ const result = wasm.Sdf_eval_at(this.ffiValue, x, y, z);
984
+
985
+ try {
986
+ return result;
987
+ }
988
+
989
+ finally {
990
+ diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
991
+ }
992
+ }
993
+
994
+ normal(x, y, z, epsilon) {
995
+ const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 13, 4, true);
996
+
997
+
998
+ const result = wasm.Sdf_normal(diplomatReceive.buffer, this.ffiValue, x, y, z, epsilon);
999
+
1000
+ try {
1001
+ if (!diplomatReceive.resultFlag) {
1002
+ const cause = new NucleationError(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
1003
+ throw new globalThis.Error('NucleationError.' + cause.value, { cause });
1004
+ }
1005
+ return SdfNormal._fromFFI(diplomatRuntime.internalConstructor, diplomatReceive.buffer);
1006
+ }
1007
+
1008
+ finally {
1009
+ diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
1010
+ diplomatReceive.free();
1011
+ }
1012
+ }
1013
+
1014
+ /**
1015
+ * Conservative finite bounds, or `NotFound` for an unbounded graph
1016
+ * (a bare `plane` or `infinite_cylinder` has no finite extent).
1017
+ */
1018
+ bounds() {
1019
+ const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 25, 4, true);
1020
+
1021
+
1022
+ const result = wasm.Sdf_bounds(diplomatReceive.buffer, this.ffiValue);
1023
+
1024
+ try {
1025
+ if (!diplomatReceive.resultFlag) {
1026
+ const cause = new NucleationError(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
1027
+ throw new globalThis.Error('NucleationError.' + cause.value, { cause });
1028
+ }
1029
+ return SdfBounds._fromFFI(diplomatRuntime.internalConstructor, diplomatReceive.buffer);
1030
+ }
1031
+
1032
+ finally {
1033
+ diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
1034
+ diplomatReceive.free();
1035
+ }
1036
+ }
1037
+
1038
+ toShape() {
1039
+ const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
1040
+
1041
+
1042
+ const result = wasm.Sdf_to_shape(diplomatReceive.buffer, this.ffiValue);
1043
+
1044
+ try {
1045
+ if (!diplomatReceive.resultFlag) {
1046
+ const cause = new NucleationError(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
1047
+ throw new globalThis.Error('NucleationError.' + cause.value, { cause });
1048
+ }
1049
+ return new Shape(diplomatRuntime.internalConstructor, diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer), []);
1050
+ }
1051
+
1052
+ finally {
1053
+ diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
1054
+ diplomatReceive.free();
1055
+ }
1056
+ }
1057
+
1058
+ toShapeBounded(minX, minY, minZ, maxX, maxY, maxZ) {
1059
+ const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
1060
+
1061
+
1062
+ const result = wasm.Sdf_to_shape_bounded(diplomatReceive.buffer, this.ffiValue, minX, minY, minZ, maxX, maxY, maxZ);
1063
+
1064
+ try {
1065
+ if (!diplomatReceive.resultFlag) {
1066
+ const cause = new NucleationError(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
1067
+ throw new globalThis.Error('NucleationError.' + cause.value, { cause });
1068
+ }
1069
+ return new Shape(diplomatRuntime.internalConstructor, diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer), []);
1070
+ }
1071
+
1072
+ finally {
1073
+ diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
1074
+ diplomatReceive.free();
1075
+ }
1076
+ }
1077
+
1078
+ static fromJsonString(json) {
1079
+ let functionCleanupArena = new diplomatRuntime.CleanupArena();
1080
+
1081
+ const jsonSlice = functionCleanupArena.alloc(diplomatRuntime.DiplomatBuf.sliceWrapper(wasm, diplomatRuntime.DiplomatBuf.str8(wasm, json)));
1082
+ const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
1083
+
1084
+
1085
+ const result = wasm.Sdf_from_json_string(diplomatReceive.buffer, jsonSlice.ptr);
1086
+
1087
+ try {
1088
+ if (!diplomatReceive.resultFlag) {
1089
+ const cause = new NucleationError(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
1090
+ throw new globalThis.Error('NucleationError.' + cause.value, { cause });
1091
+ }
1092
+ return new Sdf(diplomatRuntime.internalConstructor, diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer), []);
1093
+ }
1094
+
1095
+ finally {
1096
+ diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
1097
+ functionCleanupArena.free();
1098
+
1099
+ diplomatReceive.free();
1100
+ }
1101
+ }
1102
+
1103
+ toJson() {
1104
+ const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
1105
+
1106
+ const write = new diplomatRuntime.DiplomatWriteBuf(wasm);
1107
+
1108
+
1109
+ const result = wasm.Sdf_to_json(diplomatReceive.buffer, this.ffiValue, write.buffer);
1110
+
1111
+ try {
1112
+ if (!diplomatReceive.resultFlag) {
1113
+ const cause = new NucleationError(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
1114
+ throw new globalThis.Error('NucleationError.' + cause.value, { cause });
1115
+ }
1116
+ return write.readString8();
1117
+ }
1118
+
1119
+ finally {
1120
+ diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
1121
+ diplomatReceive.free();
1122
+ write.free();
1123
+ }
1124
+ }
1125
+
1126
+ /**
1127
+ * Wrap a validated {@link FieldProgram} as an `Sdf` graph (cloning it,
1128
+ * with its own explicit bounds and distance-kind metadata), so it
1129
+ * composes with every other combinator.
1130
+ */
1131
+ static fromProgram(program) {
1132
+
1133
+ const result = wasm.Sdf_from_program(program.ffiValue);
1134
+
1135
+ try {
1136
+ return new Sdf(diplomatRuntime.internalConstructor, result, []);
1137
+ }
1138
+
1139
+ finally {
1140
+ diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
1141
+ }
1142
+ }
1143
+
1144
+ /**
1145
+ * Legacy JSON-first terrain helper. Prefer typed constructors and
1146
+ * `to_shape()` with `BuildingTool.fill()` for new code.
1147
+ */
1148
+ static schematicFromSdfAuto(sdfJson, rulesJson) {
1149
+ let functionCleanupArena = new diplomatRuntime.CleanupArena();
1150
+
1151
+ const sdfJsonSlice = functionCleanupArena.alloc(diplomatRuntime.DiplomatBuf.sliceWrapper(wasm, diplomatRuntime.DiplomatBuf.str8(wasm, sdfJson)));
1152
+ const rulesJsonSlice = functionCleanupArena.alloc(diplomatRuntime.DiplomatBuf.sliceWrapper(wasm, diplomatRuntime.DiplomatBuf.str8(wasm, rulesJson)));
1153
+ const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
1154
+
1155
+
1156
+ const result = wasm.Sdf_schematic_from_sdf_auto(diplomatReceive.buffer, sdfJsonSlice.ptr, rulesJsonSlice.ptr);
1157
+
1158
+ try {
1159
+ if (!diplomatReceive.resultFlag) {
1160
+ const cause = new NucleationError(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
1161
+ throw new globalThis.Error('NucleationError.' + cause.value, { cause });
1162
+ }
1163
+ return new Schematic(diplomatRuntime.internalConstructor, diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer), []);
1164
+ }
1165
+
1166
+ finally {
1167
+ diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
1168
+ functionCleanupArena.free();
1169
+
1170
+ diplomatReceive.free();
1171
+ }
1172
+ }
1173
+
1174
+ /**
1175
+ * Legacy JSON-first terrain helper with optional explicit bounds.
1176
+ */
1177
+ static schematicFromSdf(sdfJson, rulesJson, hasBounds, minX, minY, minZ, maxX, maxY, maxZ) {
1178
+ let functionCleanupArena = new diplomatRuntime.CleanupArena();
1179
+
1180
+ const sdfJsonSlice = functionCleanupArena.alloc(diplomatRuntime.DiplomatBuf.sliceWrapper(wasm, diplomatRuntime.DiplomatBuf.str8(wasm, sdfJson)));
1181
+ const rulesJsonSlice = functionCleanupArena.alloc(diplomatRuntime.DiplomatBuf.sliceWrapper(wasm, diplomatRuntime.DiplomatBuf.str8(wasm, rulesJson)));
1182
+ const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
1183
+
1184
+
1185
+ const result = wasm.Sdf_schematic_from_sdf(diplomatReceive.buffer, sdfJsonSlice.ptr, rulesJsonSlice.ptr, hasBounds, minX, minY, minZ, maxX, maxY, maxZ);
1186
+
1187
+ try {
1188
+ if (!diplomatReceive.resultFlag) {
1189
+ const cause = new NucleationError(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
1190
+ throw new globalThis.Error('NucleationError.' + cause.value, { cause });
1191
+ }
1192
+ return new Schematic(diplomatRuntime.internalConstructor, diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer), []);
1193
+ }
1194
+
1195
+ finally {
1196
+ diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
1197
+ functionCleanupArena.free();
1198
+
1199
+ diplomatReceive.free();
1200
+ }
1201
+ }
1202
+
1203
+ /**
1204
+ * Legacy JSON-first evaluator. Prefer `Sdf.from_json_string(...).eval_at(...)`.
1205
+ */
1206
+ static eval(sdfJson, x, y, z) {
1207
+ let functionCleanupArena = new diplomatRuntime.CleanupArena();
1208
+
1209
+ const sdfJsonSlice = functionCleanupArena.alloc(diplomatRuntime.DiplomatBuf.sliceWrapper(wasm, diplomatRuntime.DiplomatBuf.str8(wasm, sdfJson)));
1210
+ const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
1211
+
1212
+
1213
+ const result = wasm.Sdf_eval(diplomatReceive.buffer, sdfJsonSlice.ptr, x, y, z);
1214
+
1215
+ try {
1216
+ if (!diplomatReceive.resultFlag) {
1217
+ const cause = new NucleationError(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
1218
+ throw new globalThis.Error('NucleationError.' + cause.value, { cause });
1219
+ }
1220
+ return (new Float32Array(wasm.memory.buffer, diplomatReceive.buffer, 1))[0];
1221
+ }
1222
+
1223
+ finally {
1224
+ diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
1225
+ functionCleanupArena.free();
1226
+
1227
+ diplomatReceive.free();
1228
+ }
1229
+ }
1230
+
1231
+ constructor(symbol, ptr, selfEdge) {
1232
+ return this.#internalConstructor(...arguments)
1233
+ }
1234
+ }