nucleation 0.6.0 → 0.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (190) hide show
  1. package/AnimationEffect.d.mts +44 -0
  2. package/AnimationEffect.d.ts +1 -1
  3. package/Autostack.d.mts +43 -0
  4. package/Autostack.d.ts +2 -2
  5. package/BlockPos.d.mts +28 -0
  6. package/BlockState.d.mts +39 -0
  7. package/BlockState.d.ts +1 -1
  8. package/Blocks.d.mts +91 -0
  9. package/Blocks.d.ts +1 -1
  10. package/Brush.d.mts +99 -0
  11. package/Brush.d.ts +21 -12
  12. package/Brush.mjs +66 -9
  13. package/BuildAnimation.d.mts +142 -0
  14. package/BuildAnimation.d.ts +5 -5
  15. package/BuildingTool.d.mts +46 -0
  16. package/BuildingTool.d.ts +4 -4
  17. package/CellularSdfConfig.d.mts +22 -0
  18. package/CellularSdfConfig.d.ts +22 -0
  19. package/CellularSdfConfig.mjs +69 -0
  20. package/ChunkMeshResult.d.mts +75 -0
  21. package/ChunkMeshResult.d.ts +7 -7
  22. package/CircuitBuilder.d.mts +118 -0
  23. package/CircuitBuilder.d.ts +6 -6
  24. package/Curve3D.d.mts +27 -0
  25. package/Curve3D.d.ts +1 -1
  26. package/DefinitionRegion.d.mts +274 -0
  27. package/DefinitionRegion.d.ts +5 -5
  28. package/Diff.d.mts +88 -0
  29. package/Diff.d.ts +2 -2
  30. package/Dimensions.d.mts +28 -0
  31. package/DistanceField.d.mts +39 -0
  32. package/DistanceField.d.ts +1 -1
  33. package/ExecutionMode.d.mts +42 -0
  34. package/ExecutionMode.d.ts +2 -2
  35. package/Field3.d.mts +40 -0
  36. package/Field3.d.ts +40 -0
  37. package/Field3.mjs +160 -0
  38. package/FieldProgram.d.mts +40 -0
  39. package/FieldProgram.d.ts +40 -0
  40. package/FieldProgram.mjs +167 -0
  41. package/FieldProgramBinaryOp.d.mts +42 -0
  42. package/FieldProgramBinaryOp.d.ts +42 -0
  43. package/FieldProgramBinaryOp.mjs +118 -0
  44. package/FieldProgramBuilder.d.mts +104 -0
  45. package/FieldProgramBuilder.d.ts +104 -0
  46. package/FieldProgramBuilder.mjs +486 -0
  47. package/FieldProgramDistanceKind.d.mts +26 -0
  48. package/FieldProgramDistanceKind.d.ts +26 -0
  49. package/FieldProgramDistanceKind.mjs +78 -0
  50. package/FieldProgramUnaryOp.d.mts +34 -0
  51. package/FieldProgramUnaryOp.d.ts +34 -0
  52. package/FieldProgramUnaryOp.mjs +102 -0
  53. package/FieldProgramValueType.d.mts +25 -0
  54. package/FieldProgramValueType.d.ts +25 -0
  55. package/FieldProgramValueType.mjs +75 -0
  56. package/FieldRange.d.mts +15 -0
  57. package/FieldRange.d.ts +15 -0
  58. package/FieldRange.mjs +108 -0
  59. package/Fingerprint.d.mts +44 -0
  60. package/Fingerprint.d.ts +2 -2
  61. package/GeneratedChunk.d.mts +35 -0
  62. package/GeneratedChunk.d.ts +35 -0
  63. package/GeneratedChunk.mjs +178 -0
  64. package/GeneratedChunkCoverage.d.mts +25 -0
  65. package/GeneratedChunkCoverage.d.ts +25 -0
  66. package/GeneratedChunkCoverage.mjs +75 -0
  67. package/GeneratedChunkOverlayMode.d.mts +24 -0
  68. package/GeneratedChunkOverlayMode.d.ts +24 -0
  69. package/GeneratedChunkOverlayMode.mjs +72 -0
  70. package/GeneratedWorldStream.d.mts +28 -0
  71. package/GeneratedWorldStream.d.ts +28 -0
  72. package/GeneratedWorldStream.mjs +86 -0
  73. package/Geo.d.mts +41 -0
  74. package/Geo.d.ts +2 -2
  75. package/InterpolationSpace.d.mts +25 -0
  76. package/IoLayout.d.mts +26 -0
  77. package/IoLayoutBuilder.d.mts +73 -0
  78. package/IoLayoutBuilder.d.ts +4 -4
  79. package/IoType.d.mts +41 -0
  80. package/ItemModelConfig.d.mts +65 -0
  81. package/ItemModelConfig.d.ts +1 -1
  82. package/ItemModelPackBuilder.d.mts +32 -0
  83. package/ItemModelPackBuilder.d.ts +1 -1
  84. package/ItemModelResult.d.mts +72 -0
  85. package/ItemModelResult.d.ts +7 -7
  86. package/ItemScale.d.mts +31 -0
  87. package/LayoutFunction.d.mts +52 -0
  88. package/LayoutFunction.d.ts +1 -1
  89. package/MchprsWorld.d.mts +131 -0
  90. package/MchprsWorld.d.ts +3 -3
  91. package/MeshBounds.d.mts +40 -0
  92. package/MeshConfig.d.mts +101 -0
  93. package/MeshConfig.d.ts +1 -1
  94. package/MeshJob.d.mts +44 -0
  95. package/MeshJob.d.ts +7 -7
  96. package/MeshPhase.d.mts +38 -0
  97. package/MeshProgress.d.mts +32 -0
  98. package/MeshProgress.d.ts +1 -1
  99. package/MeshResult.d.mts +65 -0
  100. package/MeshResult.d.ts +5 -5
  101. package/MultiMeshResult.d.mts +50 -0
  102. package/MultiMeshResult.d.ts +5 -5
  103. package/Nbt.d.mts +50 -0
  104. package/Nbt.d.ts +1 -1
  105. package/NucleationError.d.mts +41 -0
  106. package/NucleationError.d.ts +5 -0
  107. package/NucleationError.mjs +8 -1
  108. package/OutputCondition.d.mts +45 -0
  109. package/OutputCondition.d.ts +1 -1
  110. package/Palette.d.mts +145 -0
  111. package/Palette.d.ts +9 -1
  112. package/Palette.mjs +35 -0
  113. package/PaletteBuilder.d.mts +119 -0
  114. package/PaletteBuilder.d.ts +2 -2
  115. package/RawMeshExport.d.mts +74 -0
  116. package/RawMeshExport.d.ts +4 -4
  117. package/RedstoneGraph.d.mts +58 -0
  118. package/RedstoneGraph.d.ts +1 -1
  119. package/RegionBounds.d.mts +41 -0
  120. package/RenderConfig.d.mts +101 -0
  121. package/RenderConfig.d.ts +1 -1
  122. package/Renderer.d.mts +51 -0
  123. package/Renderer.d.ts +4 -4
  124. package/ResourcePack.d.mts +105 -0
  125. package/ResourcePack.d.ts +3 -3
  126. package/ResourcePackList.d.mts +32 -0
  127. package/Schematic.d.mts +734 -0
  128. package/Schematic.d.ts +4 -4
  129. package/SchematicBuilder.d.mts +103 -0
  130. package/SchematicBuilder.d.ts +2 -2
  131. package/SchematicRegions.d.mts +93 -0
  132. package/SchematicRegions.d.ts +3 -3
  133. package/Scripting.d.mts +40 -0
  134. package/Scripting.d.ts +2 -2
  135. package/Sdf.d.mts +234 -0
  136. package/Sdf.d.ts +208 -13
  137. package/Sdf.mjs +1106 -11
  138. package/SdfAxis.d.mts +25 -0
  139. package/SdfAxis.d.ts +25 -0
  140. package/SdfAxis.mjs +75 -0
  141. package/SdfBounds.d.mts +19 -0
  142. package/SdfBounds.d.ts +19 -0
  143. package/SdfBounds.mjs +160 -0
  144. package/SdfCellMode.d.mts +26 -0
  145. package/SdfCellMode.d.ts +26 -0
  146. package/SdfCellMode.mjs +78 -0
  147. package/SdfNormal.d.mts +16 -0
  148. package/SdfNormal.d.ts +16 -0
  149. package/SdfNormal.mjs +121 -0
  150. package/Shape.d.mts +143 -0
  151. package/Shape.d.ts +2 -2
  152. package/SortStrategy.d.mts +86 -0
  153. package/SortStrategy.d.ts +1 -1
  154. package/Store.d.mts +83 -0
  155. package/Store.d.ts +2 -2
  156. package/StoreIo.d.mts +71 -0
  157. package/StoreIo.d.ts +2 -2
  158. package/TextureAtlas.d.mts +40 -0
  159. package/TextureAtlas.d.ts +4 -4
  160. package/TextureInfo.d.mts +34 -0
  161. package/TypedCircuitExecutor.d.mts +101 -0
  162. package/TypedCircuitExecutor.d.ts +6 -6
  163. package/Value.d.mts +73 -0
  164. package/Value.d.ts +1 -1
  165. package/VideoConfig.d.mts +15 -0
  166. package/Voxelizer.d.mts +58 -0
  167. package/Voxelizer.d.ts +4 -4
  168. package/WorldChunkView.d.mts +75 -0
  169. package/WorldChunkView.d.ts +2 -2
  170. package/WorldGenerator.d.mts +75 -0
  171. package/WorldGenerator.d.ts +75 -0
  172. package/WorldGenerator.mjs +255 -0
  173. package/WorldSink.d.mts +50 -0
  174. package/WorldSink.d.ts +2 -2
  175. package/WorldStream.d.mts +45 -0
  176. package/WorldStream.d.ts +2 -2
  177. package/WsPartitionHints.d.mts +29 -0
  178. package/WsPartitionHints.d.ts +1 -1
  179. package/WsProfile.d.mts +46 -0
  180. package/WsProfile.d.ts +1 -1
  181. package/WsRunResult.d.mts +83 -0
  182. package/WsRunResult.d.ts +5 -5
  183. package/WsSegmentJob.d.mts +28 -0
  184. package/WsSegmentJob.d.ts +1 -1
  185. package/diplomat-runtime.d.mts +15 -0
  186. package/index.d.mts +177 -0
  187. package/index.d.ts +106 -70
  188. package/index.mjs +37 -1
  189. package/nucleation.wasm +0 -0
  190. package/package.json +2 -1
package/Sdf.d.ts CHANGED
@@ -1,13 +1,24 @@
1
1
  // generated by diplomat-tool
2
- import type { NucleationError } from "./NucleationError"
3
- import type { Schematic } from "./Schematic"
2
+ import type { Field3 } from "./Field3.mjs"
3
+ import type { FieldProgram } from "./FieldProgram.mjs"
4
+ import type { NucleationError } from "./NucleationError.mjs"
5
+ import type { Schematic } from "./Schematic.mjs"
6
+ import type { SdfAxis } from "./SdfAxis.mjs"
7
+ import type { SdfBounds } from "./SdfBounds.mjs"
8
+ import type { SdfCellMode } from "./SdfCellMode.mjs"
9
+ import type { SdfNormal } from "./SdfNormal.mjs"
10
+ import type { Shape } from "./Shape.mjs"
4
11
  import type { pointer, codepoint } from "./diplomat-runtime.d.ts";
5
12
 
6
13
 
7
14
 
8
15
  /**
9
- * Namespace for the SDF free functions of the old ABI (`schematic_from_sdf`,
10
- * `sdf_eval`).
16
+ * An immutable, composable signed-distance-field expression graph.
17
+ *
18
+ * Primitive constructors and every combinator return a new graph, so values
19
+ * can be shared safely between Flow nodes and across Kotlin/Java, JavaScript,
20
+ * and Python bindings. JSON is retained only for explicit import/export and
21
+ * the legacy sampling helpers.
11
22
  */
12
23
  export class Sdf {
13
24
  /** @internal */
@@ -16,24 +27,208 @@ export class Sdf {
16
27
  constructor();
17
28
 
18
29
 
30
+ static sphere(radius: number): Sdf;
31
+
32
+ /**
33
+ * Axis-aligned rounded box, centered at the origin.
34
+ */
35
+ static boxShape(halfX: number, halfY: number, halfZ: number, rounding: number): Sdf;
36
+
37
+ static ellipsoid(radiusX: number, radiusY: number, radiusZ: number): Sdf;
38
+
39
+ static torus(majorRadius: number, minorRadius: number): Sdf;
40
+
41
+ /**
42
+ * Torus ring cut down to an arc. `cap_angle_degrees` is the half-aperture
43
+ * in `(0, 180]`, measured from +X and mirrored across X; `180` is a full
44
+ * torus.
45
+ */
46
+ static cappedTorus(majorRadius: number, minorRadius: number, capAngleDegrees: number): Sdf;
47
+
48
+ /**
49
+ * Chain-link shape: a torus stretched along Z by `half_length` and
50
+ * capped by two half-tori. `half_length: 0` is a plain torus.
51
+ */
52
+ static link(majorRadius: number, minorRadius: number, halfLength: number): Sdf;
53
+
54
+ static capsule(ax: number, ay: number, az: number, bx: number, by: number, bz: number, radius: number): Sdf;
55
+
56
+ /**
57
+ * Convex hull of two spheres: a capsule with a linear taper between
58
+ * `r1` (at `a`) and `r2` (at `b`) instead of one constant radius.
59
+ */
60
+ static roundCone(ax: number, ay: number, az: number, bx: number, by: number, bz: number, r1: number, r2: number): Sdf;
61
+
62
+ /**
63
+ * Sphere of `radius` intersected with an infinite cone of
64
+ * half-aperture `angle_degrees` (in `(0, 180)`) from the +Y axis,
65
+ * apex at the origin.
66
+ */
67
+ static solidAngle(radius: number, angleDegrees: number): Sdf;
68
+
69
+ /**
70
+ * Sphere cut by the plane `y = height`, keeping the cap above it
71
+ * (a dome). `height` must be strictly between `-radius` and
72
+ * `radius`.
73
+ */
74
+ static cutSphere(radius: number, height: number): Sdf;
75
+
76
+ /**
77
+ * Open (hollow) shell of `cut_sphere`'s dome: just the spherical
78
+ * cap surface, offset by `thickness`, with no flat floor.
79
+ */
80
+ static cutHollowSphere(radius: number, height: number, thickness: number): Sdf;
81
+
82
+ static cappedCylinder(radius: number, halfHeight: number): Sdf;
83
+
84
+ /**
85
+ * Exact Y-axis cylinder with infinite extent. Sampling requires explicit bounds.
86
+ */
87
+ static infiniteCylinder(radius: number): Sdf;
88
+
89
+ static cappedCone(halfHeight: number, bottomRadius: number, topRadius: number): Sdf;
90
+
91
+ static plane(normalX: number, normalY: number, normalZ: number, offset: number): Sdf;
92
+
93
+ static octahedron(size: number): Sdf;
94
+
95
+ static hexPrism(radius: number, halfHeight: number): Sdf;
96
+
97
+ static superPrism(halfX: number, halfY: number, halfZ: number, exponent: number): Sdf;
98
+
99
+ /**
100
+ * Hollow wireframe box: only the 12 edge beams are solid.
101
+ */
102
+ static boxFrame(halfX: number, halfY: number, halfZ: number, thickness: number): Sdf;
103
+
104
+ /**
105
+ * Exact but unbounded Y-axis infinite cone: apex at the origin,
106
+ * single nappe opening along +Y, half-aperture `angle_degrees`
107
+ * strictly in `(0, 90)`.
108
+ */
109
+ static infiniteCone(angleDegrees: number): Sdf;
110
+
111
+ /**
112
+ * Square-base pyramid, vertically centered: base (half-extent
113
+ * `half_base`) at `y = -height/2`, apex at `y = height/2`. `height`
114
+ * must be at least the smallest positive normal `f32`.
115
+ */
116
+ static squarePyramid(halfBase: number, height: number): Sdf;
117
+
118
+ static cells(frequency: number, seed: number, jitter: number, mode: SdfCellMode, threshold: number): Sdf;
119
+
120
+ unionWith(other: Sdf): Sdf;
121
+
122
+ intersectionWith(other: Sdf): Sdf;
123
+
124
+ subtract(other: Sdf): Sdf;
125
+
126
+ smoothUnion(other: Sdf, radius: number): Sdf;
127
+
128
+ smoothSubtract(other: Sdf, radius: number): Sdf;
129
+
130
+ smoothIntersection(other: Sdf, radius: number): Sdf;
131
+
132
+ rounded(radius: number): Sdf;
133
+
134
+ shell(thickness: number): Sdf;
135
+
136
+ /**
137
+ * Symmetric difference (XOR): solid where exactly one of `self`/
138
+ * `other` is solid.
139
+ */
140
+ xorWith(other: Sdf): Sdf;
141
+
142
+ /**
143
+ * Stretches this graph with IQ's origin-centered `opElongate` fold.
144
+ * Exactness requires a suitable origin-centered, reflection-symmetric
145
+ * child; off-center/asymmetric children are mirrored and produce only
146
+ * an estimate. Half-lengths must be finite and non-negative, with at
147
+ * least one strictly positive.
148
+ */
149
+ elongate(halfX: number, halfY: number, halfZ: number): Sdf;
150
+
151
+ translate(x: number, y: number, z: number): Sdf;
152
+
153
+ rotate(xDegrees: number, yDegrees: number, zDegrees: number): Sdf;
154
+
155
+ scale(factor: number): Sdf;
156
+
157
+ mirror(axis: SdfAxis): Sdf;
158
+
159
+ /**
160
+ * Twists this graph about the Y axis by `amount` radians per unit
161
+ * Y (IQ's `opTwist`). *Distorted*: not guaranteed exact even when
162
+ * `self` is.
163
+ */
164
+ twist(amount: number): Sdf;
165
+
166
+ /**
167
+ * Cheaply bends this graph by `amount` radians per unit X (IQ's
168
+ * `opCheapBend`). *Distorted*: not guaranteed exact even when
169
+ * `self` is.
170
+ */
171
+ bend(amount: number): Sdf;
172
+
173
+ repeatInfinite(spacingX: number, spacingY: number, spacingZ: number): Sdf;
174
+
175
+ repeatCounted(spacingX: number, spacingY: number, spacingZ: number, countX: number, countY: number, countZ: number): Sdf;
176
+
177
+ /**
178
+ * Finite rigid instances of this graph at arbitrary XYZ offsets.
179
+ * `offsets` is flat `[x0, y0, z0, x1, y1, z1, ...]` and may contain
180
+ * at most 4096 points.
181
+ */
182
+ repeatPoints(offsets: Array<number>): Sdf;
183
+
184
+ displace(amplitude: number, frequency: number, seed: number, octaves: number): Sdf;
185
+
186
+ /**
187
+ * Offset this surface by a reusable scalar field. The resulting zero
188
+ * set is generally an approximate field, not an exact distance field.
189
+ */
190
+ offsetByField(field: Field3, amplitude: number): Sdf;
191
+
192
+ warp(amplitude: number, frequency: number, seed: number): Sdf;
193
+
194
+ evalAt(x: number, y: number, z: number): number;
195
+
196
+ normal(x: number, y: number, z: number, epsilon: number): SdfNormal;
197
+
198
+ /**
199
+ * Conservative finite bounds, or `NotFound` for an unbounded graph
200
+ * (a bare `plane` or `infinite_cylinder` has no finite extent).
201
+ */
202
+ bounds(): SdfBounds;
203
+
204
+ toShape(): Shape;
205
+
206
+ toShapeBounded(minX: number, minY: number, minZ: number, maxX: number, maxY: number, maxZ: number): Shape;
207
+
208
+ static fromJsonString(json: string): Sdf;
209
+
210
+ toJson(): string;
211
+
212
+ /**
213
+ * Wrap a validated {@link FieldProgram} as an `Sdf` graph (cloning it,
214
+ * with its own explicit bounds and distance-kind metadata), so it
215
+ * composes with every other combinator.
216
+ */
217
+ static fromProgram(program: FieldProgram): Sdf;
218
+
19
219
  /**
20
- * Builds a schematic by sampling an SDF JSON tree with material rules JSON.
21
- * Sample an SDF tree into a schematic using the tree's own AABB —
22
- * the ergonomic path for bounded trees (all primitives except
23
- * `plane`). Fails with `InvalidArgument` for unbounded trees; use
24
- * `schematic_from_sdf` with explicit bounds for those.
220
+ * Legacy JSON-first terrain helper. Prefer typed constructors and
221
+ * `to_shape()` with `BuildingTool.fill()` for new code.
25
222
  */
26
223
  static schematicFromSdfAuto(sdfJson: string, rulesJson: string): Schematic;
27
224
 
28
225
  /**
29
- * When `has_bounds` is false the tree's own AABB is used (fails with
30
- * `InvalidArgument` for unbounded trees) and the `min_*`/`max_*` arguments
31
- * are ignored.
226
+ * Legacy JSON-first terrain helper with optional explicit bounds.
32
227
  */
33
228
  static schematicFromSdf(sdfJson: string, rulesJson: string, hasBounds: boolean, minX: number, minY: number, minZ: number, maxX: number, maxY: number, maxZ: number): Schematic;
34
229
 
35
230
  /**
36
- * Evaluates an SDF JSON tree at a point, returning the signed distance.
231
+ * Legacy JSON-first evaluator. Prefer `Sdf.from_json_string(...).eval_at(...)`.
37
232
  */
38
233
  static eval(sdfJson: string, x: number, y: number, z: number): number;
39
234
  }