nucleation 0.5.1 → 0.7.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.
- package/AnimationEffect.d.mts +44 -0
- package/AnimationEffect.d.ts +1 -1
- package/Autostack.d.mts +43 -0
- package/Autostack.d.ts +2 -2
- package/BlockPos.d.mts +28 -0
- package/BlockState.d.mts +39 -0
- package/BlockState.d.ts +1 -1
- package/Blocks.d.mts +91 -0
- package/Blocks.d.ts +1 -1
- package/Brush.d.mts +99 -0
- package/Brush.d.ts +21 -12
- package/Brush.mjs +66 -9
- package/BuildAnimation.d.mts +142 -0
- package/BuildAnimation.d.ts +5 -5
- package/BuildingTool.d.mts +46 -0
- package/BuildingTool.d.ts +4 -4
- package/CellularSdfConfig.d.mts +22 -0
- package/CellularSdfConfig.d.ts +22 -0
- package/CellularSdfConfig.mjs +69 -0
- package/ChunkMeshResult.d.mts +75 -0
- package/ChunkMeshResult.d.ts +7 -7
- package/CircuitBuilder.d.mts +118 -0
- package/CircuitBuilder.d.ts +6 -6
- package/Curve3D.d.mts +27 -0
- package/Curve3D.d.ts +1 -1
- package/DefinitionRegion.d.mts +274 -0
- package/DefinitionRegion.d.ts +5 -5
- package/Diff.d.mts +88 -0
- package/Diff.d.ts +2 -2
- package/Dimensions.d.mts +28 -0
- package/DistanceField.d.mts +39 -0
- package/DistanceField.d.ts +1 -1
- package/ExecutionMode.d.mts +42 -0
- package/ExecutionMode.d.ts +2 -2
- package/Field3.d.mts +40 -0
- package/Field3.d.ts +40 -0
- package/Field3.mjs +160 -0
- package/FieldProgram.d.mts +40 -0
- package/FieldProgram.d.ts +40 -0
- package/FieldProgram.mjs +167 -0
- package/FieldProgramBinaryOp.d.mts +42 -0
- package/FieldProgramBinaryOp.d.ts +42 -0
- package/FieldProgramBinaryOp.mjs +118 -0
- package/FieldProgramBuilder.d.mts +104 -0
- package/FieldProgramBuilder.d.ts +104 -0
- package/FieldProgramBuilder.mjs +486 -0
- package/FieldProgramDistanceKind.d.mts +26 -0
- package/FieldProgramDistanceKind.d.ts +26 -0
- package/FieldProgramDistanceKind.mjs +78 -0
- package/FieldProgramUnaryOp.d.mts +34 -0
- package/FieldProgramUnaryOp.d.ts +34 -0
- package/FieldProgramUnaryOp.mjs +102 -0
- package/FieldProgramValueType.d.mts +25 -0
- package/FieldProgramValueType.d.ts +25 -0
- package/FieldProgramValueType.mjs +75 -0
- package/FieldRange.d.mts +15 -0
- package/FieldRange.d.ts +15 -0
- package/FieldRange.mjs +108 -0
- package/Fingerprint.d.mts +44 -0
- package/Fingerprint.d.ts +2 -2
- package/GeneratedChunk.d.mts +35 -0
- package/GeneratedChunk.d.ts +35 -0
- package/GeneratedChunk.mjs +178 -0
- package/GeneratedChunkCoverage.d.mts +25 -0
- package/GeneratedChunkCoverage.d.ts +25 -0
- package/GeneratedChunkCoverage.mjs +75 -0
- package/GeneratedChunkOverlayMode.d.mts +24 -0
- package/GeneratedChunkOverlayMode.d.ts +24 -0
- package/GeneratedChunkOverlayMode.mjs +72 -0
- package/GeneratedWorldStream.d.mts +28 -0
- package/GeneratedWorldStream.d.ts +28 -0
- package/GeneratedWorldStream.mjs +86 -0
- package/Geo.d.mts +41 -0
- package/Geo.d.ts +2 -2
- package/InterpolationSpace.d.mts +25 -0
- package/IoLayout.d.mts +26 -0
- package/IoLayoutBuilder.d.mts +73 -0
- package/IoLayoutBuilder.d.ts +4 -4
- package/IoType.d.mts +41 -0
- package/ItemModelConfig.d.mts +65 -0
- package/ItemModelConfig.d.ts +1 -1
- package/ItemModelPackBuilder.d.mts +32 -0
- package/ItemModelPackBuilder.d.ts +1 -1
- package/ItemModelResult.d.mts +72 -0
- package/ItemModelResult.d.ts +7 -7
- package/ItemScale.d.mts +31 -0
- package/LayoutFunction.d.mts +52 -0
- package/LayoutFunction.d.ts +1 -1
- package/MchprsWorld.d.mts +131 -0
- package/MchprsWorld.d.ts +3 -3
- package/MeshBounds.d.mts +40 -0
- package/MeshConfig.d.mts +101 -0
- package/MeshConfig.d.ts +1 -1
- package/MeshJob.d.mts +44 -0
- package/MeshJob.d.ts +7 -7
- package/MeshPhase.d.mts +38 -0
- package/MeshProgress.d.mts +32 -0
- package/MeshProgress.d.ts +1 -1
- package/MeshResult.d.mts +65 -0
- package/MeshResult.d.ts +5 -5
- package/MultiMeshResult.d.mts +50 -0
- package/MultiMeshResult.d.ts +5 -5
- package/Nbt.d.mts +50 -0
- package/Nbt.d.ts +1 -1
- package/NucleationError.d.mts +41 -0
- package/NucleationError.d.ts +5 -0
- package/NucleationError.mjs +8 -1
- package/OutputCondition.d.mts +45 -0
- package/OutputCondition.d.ts +1 -1
- package/Palette.d.mts +145 -0
- package/Palette.d.ts +9 -1
- package/Palette.mjs +35 -0
- package/PaletteBuilder.d.mts +119 -0
- package/PaletteBuilder.d.ts +2 -2
- package/RawMeshExport.d.mts +74 -0
- package/RawMeshExport.d.ts +4 -4
- package/RedstoneGraph.d.mts +58 -0
- package/RedstoneGraph.d.ts +1 -1
- package/RegionBounds.d.mts +41 -0
- package/RenderConfig.d.mts +101 -0
- package/RenderConfig.d.ts +1 -1
- package/Renderer.d.mts +51 -0
- package/Renderer.d.ts +4 -4
- package/ResourcePack.d.mts +105 -0
- package/ResourcePack.d.ts +3 -3
- package/ResourcePackList.d.mts +32 -0
- package/Schematic.d.mts +734 -0
- package/Schematic.d.ts +4 -4
- package/SchematicBuilder.d.mts +103 -0
- package/SchematicBuilder.d.ts +2 -2
- package/SchematicRegions.d.mts +93 -0
- package/SchematicRegions.d.ts +3 -3
- package/Scripting.d.mts +40 -0
- package/Scripting.d.ts +2 -2
- package/Sdf.d.mts +234 -0
- package/Sdf.d.ts +208 -13
- package/Sdf.mjs +1106 -11
- package/SdfAxis.d.mts +25 -0
- package/SdfAxis.d.ts +25 -0
- package/SdfAxis.mjs +75 -0
- package/SdfBounds.d.mts +19 -0
- package/SdfBounds.d.ts +19 -0
- package/SdfBounds.mjs +160 -0
- package/SdfCellMode.d.mts +26 -0
- package/SdfCellMode.d.ts +26 -0
- package/SdfCellMode.mjs +78 -0
- package/SdfNormal.d.mts +16 -0
- package/SdfNormal.d.ts +16 -0
- package/SdfNormal.mjs +121 -0
- package/Shape.d.mts +143 -0
- package/Shape.d.ts +2 -2
- package/SortStrategy.d.mts +86 -0
- package/SortStrategy.d.ts +1 -1
- package/Store.d.mts +83 -0
- package/Store.d.ts +2 -2
- package/StoreIo.d.mts +71 -0
- package/StoreIo.d.ts +2 -2
- package/TextureAtlas.d.mts +40 -0
- package/TextureAtlas.d.ts +4 -4
- package/TextureInfo.d.mts +34 -0
- package/TypedCircuitExecutor.d.mts +101 -0
- package/TypedCircuitExecutor.d.ts +6 -6
- package/Value.d.mts +73 -0
- package/Value.d.ts +1 -1
- package/VideoConfig.d.mts +15 -0
- package/Voxelizer.d.mts +58 -0
- package/Voxelizer.d.ts +4 -4
- package/WorldChunkView.d.mts +75 -0
- package/WorldChunkView.d.ts +2 -2
- package/WorldGenerator.d.mts +75 -0
- package/WorldGenerator.d.ts +75 -0
- package/WorldGenerator.mjs +255 -0
- package/WorldSink.d.mts +50 -0
- package/WorldSink.d.ts +2 -2
- package/WorldStream.d.mts +45 -0
- package/WorldStream.d.ts +2 -2
- package/WsPartitionHints.d.mts +29 -0
- package/WsPartitionHints.d.ts +1 -1
- package/WsProfile.d.mts +46 -0
- package/WsProfile.d.ts +1 -1
- package/WsRunResult.d.mts +83 -0
- package/WsRunResult.d.ts +5 -5
- package/WsSegmentJob.d.mts +28 -0
- package/WsSegmentJob.d.ts +1 -1
- package/diplomat-runtime.d.mts +15 -0
- package/index.d.mts +177 -0
- package/index.d.ts +106 -70
- package/index.mjs +37 -1
- package/nucleation.wasm +0 -0
- package/package.json +2 -1
package/Schematic.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
// generated by diplomat-tool
|
|
2
|
-
import type { BlockPos } from "./BlockPos"
|
|
3
|
-
import type { BlockState } from "./BlockState"
|
|
4
|
-
import type { Dimensions } from "./Dimensions"
|
|
5
|
-
import type { NucleationError } from "./NucleationError"
|
|
2
|
+
import type { BlockPos } from "./BlockPos.mjs"
|
|
3
|
+
import type { BlockState } from "./BlockState.mjs"
|
|
4
|
+
import type { Dimensions } from "./Dimensions.mjs"
|
|
5
|
+
import type { NucleationError } from "./NucleationError.mjs"
|
|
6
6
|
import type { pointer, codepoint } from "./diplomat-runtime.d.ts";
|
|
7
7
|
|
|
8
8
|
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
// generated by diplomat-tool
|
|
2
|
+
import type { NucleationError } from "./NucleationError.mjs"
|
|
3
|
+
import type { Schematic } from "./Schematic.mjs"
|
|
4
|
+
import type { pointer, codepoint } from "./diplomat-runtime.d.ts";
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Fluent builder for schematics from character-mapped text layers.
|
|
10
|
+
*
|
|
11
|
+
* `build` is consuming (PORTING rule 11): the inner builder is held in an
|
|
12
|
+
* `Option` and taken on `build`; every method afterwards returns
|
|
13
|
+
* `AlreadyConsumed`.
|
|
14
|
+
*/
|
|
15
|
+
export class SchematicBuilder {
|
|
16
|
+
/** @internal */
|
|
17
|
+
get ffiValue(): pointer;
|
|
18
|
+
/** @internal */
|
|
19
|
+
constructor();
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Create a new builder, pre-loaded with the standard Unicode palette
|
|
24
|
+
* (override any character via `map` or `palette`).
|
|
25
|
+
*/
|
|
26
|
+
static create(): SchematicBuilder;
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Parse a builder from the canonical template text format.
|
|
30
|
+
*/
|
|
31
|
+
static fromTemplate(template: string): SchematicBuilder;
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Set the schematic name.
|
|
35
|
+
*/
|
|
36
|
+
name(name: string): void;
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Map a palette character to a block string. `ch` must contain exactly
|
|
40
|
+
* one character (its first char is used).
|
|
41
|
+
*/
|
|
42
|
+
map(ch: string, block: string): void;
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Append layers. `layers_json` is a JSON array of arrays of row strings,
|
|
46
|
+
* e.g. `[["ab","cd"],["ef","gh"]]`.
|
|
47
|
+
*/
|
|
48
|
+
layers(layersJson: string): void;
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Append a single layer of rows. `rows_json` is a JSON array of strings,
|
|
52
|
+
* e.g. `["abc", "def"]`. Equivalent to a one-element layers array.
|
|
53
|
+
*/
|
|
54
|
+
layer(rowsJson: string): void;
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Bulk-register palette characters. `pairs_json` is a JSON array of
|
|
58
|
+
* `[char, block]` two-element arrays, e.g.
|
|
59
|
+
* `[["c", "minecraft:gray_concrete"], [" ", "minecraft:air"]]`.
|
|
60
|
+
*/
|
|
61
|
+
palette(pairsJson: string): void;
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Set the build offset applied to every placed block.
|
|
65
|
+
*/
|
|
66
|
+
offset(x: number, y: number, z: number): void;
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Register the standard Unicode palette (redstone wires, repeaters,
|
|
70
|
+
* comparators, torches, blocks, air...; the same set `create`
|
|
71
|
+
* pre-loads), overwriting any clashing character mappings.
|
|
72
|
+
*/
|
|
73
|
+
useStandardPalette(): void;
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Register the minimal palette (an essentials-only subset of the
|
|
77
|
+
* standard one), overwriting any clashing character mappings.
|
|
78
|
+
*/
|
|
79
|
+
useMinimalPalette(): void;
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* Register the compact ASCII-only palette, overwriting any clashing
|
|
83
|
+
* character mappings.
|
|
84
|
+
*/
|
|
85
|
+
useCompactPalette(): void;
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* Run pre-build validation without consuming the builder.
|
|
89
|
+
*/
|
|
90
|
+
validate(): void;
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* Serialize the builder back into the canonical template format.
|
|
94
|
+
*/
|
|
95
|
+
toTemplate(): string;
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* Build the schematic. Consuming: the builder cannot be reused afterwards
|
|
99
|
+
* (subsequent calls return `AlreadyConsumed`), including after a failed
|
|
100
|
+
* build.
|
|
101
|
+
*/
|
|
102
|
+
build(): Schematic;
|
|
103
|
+
}
|
package/SchematicBuilder.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// generated by diplomat-tool
|
|
2
|
-
import type { NucleationError } from "./NucleationError"
|
|
3
|
-
import type { Schematic } from "./Schematic"
|
|
2
|
+
import type { NucleationError } from "./NucleationError.mjs"
|
|
3
|
+
import type { Schematic } from "./Schematic.mjs"
|
|
4
4
|
import type { pointer, codepoint } from "./diplomat-runtime.d.ts";
|
|
5
5
|
|
|
6
6
|
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
// generated by diplomat-tool
|
|
2
|
+
import type { DefinitionRegion } from "./DefinitionRegion.mjs"
|
|
3
|
+
import type { NucleationError } from "./NucleationError.mjs"
|
|
4
|
+
import type { Schematic } from "./Schematic.mjs"
|
|
5
|
+
import type { pointer, codepoint } from "./diplomat-runtime.d.ts";
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Namespace type for the schematic-attached definition-region operations
|
|
11
|
+
* (PORTING rule 12; the `Schematic` opaque lives in another module, so
|
|
12
|
+
* these are statics taking it explicitly, like `Autostack`).
|
|
13
|
+
*/
|
|
14
|
+
export class SchematicRegions {
|
|
15
|
+
/** @internal */
|
|
16
|
+
get ffiValue(): pointer;
|
|
17
|
+
/** @internal */
|
|
18
|
+
constructor();
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Insert (or overwrite) `region` under `name`.
|
|
23
|
+
*/
|
|
24
|
+
static add(schematic: Schematic, name: string, region: DefinitionRegion): void;
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Overwrite the region stored under `name` (identical to `add` in the
|
|
28
|
+
* old ABI too; kept as a separate method for 1:1 coverage of
|
|
29
|
+
* `schematic_update_region`).
|
|
30
|
+
*/
|
|
31
|
+
static update(schematic: Schematic, name: string, region: DefinitionRegion): void;
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* A copy of the region stored under `name`. Errors with `NotFound` when
|
|
35
|
+
* absent.
|
|
36
|
+
*/
|
|
37
|
+
static get(schematic: Schematic, name: string): DefinitionRegion;
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Remove the region stored under `name`. Errors with `NotFound` when
|
|
41
|
+
* absent.
|
|
42
|
+
*/
|
|
43
|
+
static remove(schematic: Schematic, name: string): void;
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* The names of every definition region, written as a JSON array string.
|
|
47
|
+
*/
|
|
48
|
+
static namesJson(schematic: Schematic): string;
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Create an empty region under `name`.
|
|
52
|
+
*/
|
|
53
|
+
static create(schematic: Schematic, name: string): void;
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Create a single-point region under `name`.
|
|
57
|
+
*/
|
|
58
|
+
static createFromPoint(schematic: Schematic, name: string, x: number, y: number, z: number): void;
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Create a single-box region under `name`.
|
|
62
|
+
*/
|
|
63
|
+
static createFromBounds(schematic: Schematic, name: string, minX: number, minY: number, minZ: number, maxX: number, maxY: number, maxZ: number): void;
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Create a single-box region under `name` and return a copy of it.
|
|
67
|
+
*/
|
|
68
|
+
static createRegion(schematic: Schematic, name: string, minX: number, minY: number, minZ: number, maxX: number, maxY: number, maxZ: number): DefinitionRegion;
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Add a box to the region stored under `name`. Errors with `NotFound`
|
|
72
|
+
* when absent.
|
|
73
|
+
*/
|
|
74
|
+
static addBoundsTo(schematic: Schematic, name: string, minX: number, minY: number, minZ: number, maxX: number, maxY: number, maxZ: number): void;
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Add a point to the region stored under `name`. Errors with `NotFound`
|
|
78
|
+
* when absent.
|
|
79
|
+
*/
|
|
80
|
+
static addPointTo(schematic: Schematic, name: string, x: number, y: number, z: number): void;
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* Set a metadata entry on the region stored under `name`. Errors with
|
|
84
|
+
* `NotFound` when absent.
|
|
85
|
+
*/
|
|
86
|
+
static setMetadataOn(schematic: Schematic, name: string, key: string, value: string): void;
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* Shift the region stored under `name` by (`dx`, `dy`, `dz`). Errors
|
|
90
|
+
* with `NotFound` when absent.
|
|
91
|
+
*/
|
|
92
|
+
static shiftRegion(schematic: Schematic, name: string, dx: number, dy: number, dz: number): void;
|
|
93
|
+
}
|
package/SchematicRegions.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// generated by diplomat-tool
|
|
2
|
-
import type { DefinitionRegion } from "./DefinitionRegion"
|
|
3
|
-
import type { NucleationError } from "./NucleationError"
|
|
4
|
-
import type { Schematic } from "./Schematic"
|
|
2
|
+
import type { DefinitionRegion } from "./DefinitionRegion.mjs"
|
|
3
|
+
import type { NucleationError } from "./NucleationError.mjs"
|
|
4
|
+
import type { Schematic } from "./Schematic.mjs"
|
|
5
5
|
import type { pointer, codepoint } from "./diplomat-runtime.d.ts";
|
|
6
6
|
|
|
7
7
|
|
package/Scripting.d.mts
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
// generated by diplomat-tool
|
|
2
|
+
import type { NucleationError } from "./NucleationError.mjs"
|
|
3
|
+
import type { Schematic } from "./Schematic.mjs"
|
|
4
|
+
import type { pointer, codepoint } from "./diplomat-runtime.d.ts";
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Namespace for the script-runner free functions of the old ABI
|
|
10
|
+
* (`run_lua_script`, `run_js_script`, `run_script`).
|
|
11
|
+
*/
|
|
12
|
+
export class Scripting {
|
|
13
|
+
/** @internal */
|
|
14
|
+
get ffiValue(): pointer;
|
|
15
|
+
/** @internal */
|
|
16
|
+
constructor();
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Run a Lua script file. Returns the schematic the script assigns to
|
|
21
|
+
* `result`; `NotFound` if it produced none, `Parse` if it failed, and
|
|
22
|
+
* `InvalidArgument` when built without the `scripting-lua` feature.
|
|
23
|
+
*/
|
|
24
|
+
static runLuaScript(path: string): Schematic;
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Run a JS script file. Returns the schematic the script assigns to
|
|
28
|
+
* `result`; `NotFound` if it produced none, `Parse` if it failed, and
|
|
29
|
+
* `InvalidArgument` when built without the `scripting-js` feature.
|
|
30
|
+
*/
|
|
31
|
+
static runJsScript(path: string): Schematic;
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Run a script file, auto-detecting the engine by extension (`.lua` or
|
|
35
|
+
* `.js`). Returns the schematic the script assigns to `result`; `NotFound`
|
|
36
|
+
* if it produced none, `Parse` if it failed (including unsupported
|
|
37
|
+
* extensions).
|
|
38
|
+
*/
|
|
39
|
+
static runScript(path: string): Schematic;
|
|
40
|
+
}
|
package/Scripting.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// generated by diplomat-tool
|
|
2
|
-
import type { NucleationError } from "./NucleationError"
|
|
3
|
-
import type { Schematic } from "./Schematic"
|
|
2
|
+
import type { NucleationError } from "./NucleationError.mjs"
|
|
3
|
+
import type { Schematic } from "./Schematic.mjs"
|
|
4
4
|
import type { pointer, codepoint } from "./diplomat-runtime.d.ts";
|
|
5
5
|
|
|
6
6
|
|
package/Sdf.d.mts
ADDED
|
@@ -0,0 +1,234 @@
|
|
|
1
|
+
// generated by diplomat-tool
|
|
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"
|
|
11
|
+
import type { pointer, codepoint } from "./diplomat-runtime.d.ts";
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
/**
|
|
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.
|
|
22
|
+
*/
|
|
23
|
+
export class Sdf {
|
|
24
|
+
/** @internal */
|
|
25
|
+
get ffiValue(): pointer;
|
|
26
|
+
/** @internal */
|
|
27
|
+
constructor();
|
|
28
|
+
|
|
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
|
+
|
|
219
|
+
/**
|
|
220
|
+
* Legacy JSON-first terrain helper. Prefer typed constructors and
|
|
221
|
+
* `to_shape()` with `BuildingTool.fill()` for new code.
|
|
222
|
+
*/
|
|
223
|
+
static schematicFromSdfAuto(sdfJson: string, rulesJson: string): Schematic;
|
|
224
|
+
|
|
225
|
+
/**
|
|
226
|
+
* Legacy JSON-first terrain helper with optional explicit bounds.
|
|
227
|
+
*/
|
|
228
|
+
static schematicFromSdf(sdfJson: string, rulesJson: string, hasBounds: boolean, minX: number, minY: number, minZ: number, maxX: number, maxY: number, maxZ: number): Schematic;
|
|
229
|
+
|
|
230
|
+
/**
|
|
231
|
+
* Legacy JSON-first evaluator. Prefer `Sdf.from_json_string(...).eval_at(...)`.
|
|
232
|
+
*/
|
|
233
|
+
static eval(sdfJson: string, x: number, y: number, z: number): number;
|
|
234
|
+
}
|