1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
//! SDF (signed distance function) shape and terrain generation.
//!
//! A JSON AST of distance-field primitives, boolean/smooth operators,
//! transforms, and seeded noise modifiers ([`SdfNode`]), plus a sampler that
//! rasterizes a tree into a [`crate::UniversalSchematic`] with declarative
//! [`MaterialRules`] (depth-based shells, absolute Y bands, noise gates,
//! palette-driven gradient fills, and surface scatter).
//!
//! Every binding (FFI, Python, WASM, JVM) exposes the same two entry points:
//! `from_sdf(sdf_json, rules_json[, bounds])` and `sdf_eval(sdf_json, x, y, z)`,
//! so shape definitions are portable across all consumers, and identical
//! inputs always yield identical schematics.
//!
//! ```
//! use nucleation::sdf::{SdfNode, MaterialRules, sample_to_schematic};
//!
//! let island: SdfNode = serde_json::from_str(r#"{
//! "type": "smoothUnion", "k": 4.0,
//! "a": {"type": "superPrism", "halfExtents": [32, 2, 32], "exponent": 6},
//! "b": {"type": "displace", "amplitude": 3.0, "frequency": 0.08, "seed": 42,
//! "child": {"type": "translate", "offset": [0, -14, 0],
//! "child": {"type": "ellipsoid", "radii": [26, 16, 26]}}}
//! }"#).unwrap();
//! let rules = MaterialRules::from_json(r#"{
//! "fill": [
//! {"when": {"depthBelowSurface": {"min": 0, "max": 0}}, "block": "minecraft:grass_block"},
//! {"when": {"depthBelowSurface": {"min": 1, "max": 3}}, "block": "minecraft:dirt"},
//! {"gradient": {"palette": "grayscale", "from": [60, 60, 65], "to": [140, 140, 140],
//! "axis": "y", "range": [34, 64]}}
//! ]
//! }"#).unwrap();
//! let schematic = sample_to_schematic(&island, &rules, None, "island").unwrap();
//! assert!(schematic.total_blocks() > 0);
//! ```
pub use ;
pub use ;