nucleation 0.3.4 → 0.3.6

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/RenderConfig.d.ts CHANGED
@@ -31,8 +31,9 @@ export class RenderConfig {
31
31
  setPitch(pitch: number): void;
32
32
 
33
33
  /**
34
- * Set the zoom factor scaling the auto-fitted camera distance
35
- * (1.0 = frame the whole model; larger = further away). Default: 1.0.
34
+ * Set the zoom factor applied to the auto-fitted framing
35
+ * (1.0 = frame the whole model; 2.0 = twice as close; 0.5 = twice
36
+ * as far). Default: 1.0.
36
37
  */
37
38
  setZoom(zoom: number): void;
38
39
 
package/RenderConfig.mjs CHANGED
@@ -83,8 +83,9 @@ export class RenderConfig {
83
83
  }
84
84
 
85
85
  /**
86
- * Set the zoom factor scaling the auto-fitted camera distance
87
- * (1.0 = frame the whole model; larger = further away). Default: 1.0.
86
+ * Set the zoom factor applied to the auto-fitted framing
87
+ * (1.0 = frame the whole model; 2.0 = twice as close; 0.5 = twice
88
+ * as far). Default: 1.0.
88
89
  */
89
90
  setZoom(zoom) {
90
91
  wasm.RenderConfig_set_zoom(this.ffiValue, zoom);
package/Schematic.d.ts CHANGED
@@ -37,19 +37,6 @@ export class Schematic {
37
37
  */
38
38
  getBlockName(x: number, y: number, z: number): string;
39
39
 
40
- /**
41
- * Save the schematic to a file, always in Litematic format (the
42
- * extension is not consulted; use `save_to_file_with_format` for
43
- * other formats).
44
- */
45
- saveToFile(path: string): void;
46
-
47
- /**
48
- * Load a schematic from a Litematic file (this path is
49
- * Litematic-only; use `from_data` for format auto-detection).
50
- */
51
- static loadFromFile(path: string): Schematic;
52
-
53
40
  /**
54
41
  * Build a schematic from raw byte data, auto-detecting the format.
55
42
  * Supports Litematic, Sponge Schematic, and McStructure (Bedrock) formats.
@@ -555,12 +542,6 @@ export class Schematic {
555
542
  */
556
543
  saveAsB64(format: string, version: string, settings: string): string;
557
544
 
558
- /**
559
- * Save to a file. If `format` is empty, the format is auto-detected from
560
- * the file extension; `version` may be empty for the default.
561
- */
562
- saveToFileWithFormat(path: string, format: string, version: string): void;
563
-
564
545
  /**
565
546
  * Serialize as a Sponge schematic targeting a specific format version,
566
547
  * base64-encoded.
package/Schematic.mjs CHANGED
@@ -136,64 +136,6 @@ export class Schematic {
136
136
  }
137
137
  }
138
138
 
139
- /**
140
- * Save the schematic to a file, always in Litematic format (the
141
- * extension is not consulted; use `save_to_file_with_format` for
142
- * other formats).
143
- */
144
- saveToFile(path) {
145
- let functionCleanupArena = new diplomatRuntime.CleanupArena();
146
-
147
- const pathSlice = functionCleanupArena.alloc(diplomatRuntime.DiplomatBuf.sliceWrapper(wasm, diplomatRuntime.DiplomatBuf.str8(wasm, path)));
148
- const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
149
-
150
-
151
- const result = wasm.Schematic_save_to_file(diplomatReceive.buffer, this.ffiValue, pathSlice.ptr);
152
-
153
- try {
154
- if (!diplomatReceive.resultFlag) {
155
- const cause = new NucleationError(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
156
- throw new globalThis.Error('NucleationError.' + cause.value, { cause });
157
- }
158
- }
159
-
160
- finally {
161
- diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
162
- functionCleanupArena.free();
163
-
164
- diplomatReceive.free();
165
- }
166
- }
167
-
168
- /**
169
- * Load a schematic from a Litematic file (this path is
170
- * Litematic-only; use `from_data` for format auto-detection).
171
- */
172
- static loadFromFile(path) {
173
- let functionCleanupArena = new diplomatRuntime.CleanupArena();
174
-
175
- const pathSlice = functionCleanupArena.alloc(diplomatRuntime.DiplomatBuf.sliceWrapper(wasm, diplomatRuntime.DiplomatBuf.str8(wasm, path)));
176
- const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
177
-
178
-
179
- const result = wasm.Schematic_load_from_file(diplomatReceive.buffer, pathSlice.ptr);
180
-
181
- try {
182
- if (!diplomatReceive.resultFlag) {
183
- const cause = new NucleationError(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
184
- throw new globalThis.Error('NucleationError.' + cause.value, { cause });
185
- }
186
- return new Schematic(diplomatRuntime.internalConstructor, diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer), []);
187
- }
188
-
189
- finally {
190
- diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
191
- functionCleanupArena.free();
192
-
193
- diplomatReceive.free();
194
- }
195
- }
196
-
197
139
  /**
198
140
  * Build a schematic from raw byte data, auto-detecting the format.
199
141
  * Supports Litematic, Sponge Schematic, and McStructure (Bedrock) formats.
@@ -2224,36 +2166,6 @@ export class Schematic {
2224
2166
  }
2225
2167
  }
2226
2168
 
2227
- /**
2228
- * Save to a file. If `format` is empty, the format is auto-detected from
2229
- * the file extension; `version` may be empty for the default.
2230
- */
2231
- saveToFileWithFormat(path, format, version) {
2232
- let functionCleanupArena = new diplomatRuntime.CleanupArena();
2233
-
2234
- const pathSlice = functionCleanupArena.alloc(diplomatRuntime.DiplomatBuf.sliceWrapper(wasm, diplomatRuntime.DiplomatBuf.str8(wasm, path)));
2235
- const formatSlice = functionCleanupArena.alloc(diplomatRuntime.DiplomatBuf.sliceWrapper(wasm, diplomatRuntime.DiplomatBuf.str8(wasm, format)));
2236
- const versionSlice = functionCleanupArena.alloc(diplomatRuntime.DiplomatBuf.sliceWrapper(wasm, diplomatRuntime.DiplomatBuf.str8(wasm, version)));
2237
- const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
2238
-
2239
-
2240
- const result = wasm.Schematic_save_to_file_with_format(diplomatReceive.buffer, this.ffiValue, pathSlice.ptr, formatSlice.ptr, versionSlice.ptr);
2241
-
2242
- try {
2243
- if (!diplomatReceive.resultFlag) {
2244
- const cause = new NucleationError(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
2245
- throw new globalThis.Error('NucleationError.' + cause.value, { cause });
2246
- }
2247
- }
2248
-
2249
- finally {
2250
- diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
2251
- functionCleanupArena.free();
2252
-
2253
- diplomatReceive.free();
2254
- }
2255
- }
2256
-
2257
2169
  /**
2258
2170
  * Serialize as a Sponge schematic targeting a specific format version,
2259
2171
  * base64-encoded.
package/Sdf.d.ts CHANGED
@@ -18,6 +18,14 @@ export class Sdf {
18
18
 
19
19
  /**
20
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.
25
+ */
26
+ static schematicFromSdfAuto(sdfJson: string, rulesJson: string): Schematic;
27
+
28
+ /**
21
29
  * When `has_bounds` is false the tree's own AABB is used (fails with
22
30
  * `InvalidArgument` for unbounded trees) and the `min_*`/`max_*` arguments
23
31
  * are ignored.
package/Sdf.mjs CHANGED
@@ -43,6 +43,38 @@ export class Sdf {
43
43
 
44
44
  /**
45
45
  * Builds a schematic by sampling an SDF JSON tree with material rules JSON.
46
+ * Sample an SDF tree into a schematic using the tree's own AABB —
47
+ * the ergonomic path for bounded trees (all primitives except
48
+ * `plane`). Fails with `InvalidArgument` for unbounded trees; use
49
+ * `schematic_from_sdf` with explicit bounds for those.
50
+ */
51
+ static schematicFromSdfAuto(sdfJson, rulesJson) {
52
+ let functionCleanupArena = new diplomatRuntime.CleanupArena();
53
+
54
+ const sdfJsonSlice = functionCleanupArena.alloc(diplomatRuntime.DiplomatBuf.sliceWrapper(wasm, diplomatRuntime.DiplomatBuf.str8(wasm, sdfJson)));
55
+ const rulesJsonSlice = functionCleanupArena.alloc(diplomatRuntime.DiplomatBuf.sliceWrapper(wasm, diplomatRuntime.DiplomatBuf.str8(wasm, rulesJson)));
56
+ const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
57
+
58
+
59
+ const result = wasm.Sdf_schematic_from_sdf_auto(diplomatReceive.buffer, sdfJsonSlice.ptr, rulesJsonSlice.ptr);
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 Schematic(diplomatRuntime.internalConstructor, diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer), []);
67
+ }
68
+
69
+ finally {
70
+ diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
71
+ functionCleanupArena.free();
72
+
73
+ diplomatReceive.free();
74
+ }
75
+ }
76
+
77
+ /**
46
78
  * When `has_bounds` is false the tree's own AABB is used (fails with
47
79
  * `InvalidArgument` for unbounded trees) and the `min_*`/`max_*` arguments
48
80
  * are ignored.
package/nucleation.wasm CHANGED
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nucleation",
3
- "version": "0.3.4",
3
+ "version": "0.3.6",
4
4
  "description": "A high-performance Minecraft schematic parser and utility library",
5
5
  "type": "module",
6
6
  "main": "index.mjs",