nucleation 0.10.14 → 0.10.16
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/BuildAnimation.d.mts +37 -0
- package/BuildAnimation.d.ts +37 -0
- package/BuildAnimation.mjs +166 -0
- package/nucleation.wasm +0 -0
- package/package.json +1 -1
package/BuildAnimation.d.mts
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import type { AnimationEffect } from "./AnimationEffect.mjs"
|
|
3
3
|
import type { Brush } from "./Brush.mjs"
|
|
4
4
|
import type { NucleationError } from "./NucleationError.mjs"
|
|
5
|
+
import type { ResourcePack } from "./ResourcePack.mjs"
|
|
5
6
|
import type { Schematic } from "./Schematic.mjs"
|
|
6
7
|
import type { Shape } from "./Shape.mjs"
|
|
7
8
|
import type { pointer, codepoint } from "./diplomat-runtime.d.ts";
|
|
@@ -120,6 +121,42 @@ export class BuildAnimation {
|
|
|
120
121
|
|
|
121
122
|
setOperationGizmos(enabled: boolean): void;
|
|
122
123
|
|
|
124
|
+
/**
|
|
125
|
+
* Record a named point on the open group, or on the most recent group.
|
|
126
|
+
* Coordinates are the block coordinates poses use. Returns the group
|
|
127
|
+
* id the anchor belongs to.
|
|
128
|
+
*/
|
|
129
|
+
addAnchor(name: string, x: number, y: number, z: number): number;
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* Record a named point on an already recorded group.
|
|
133
|
+
*/
|
|
134
|
+
addAnchorToGroup(group: number, name: string, x: number, y: number, z: number): void;
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* Every recorded anchor as JSON: `[{ name, group, local: [x, y, z] }]`.
|
|
138
|
+
*/
|
|
139
|
+
anchorsJson(): string;
|
|
140
|
+
|
|
141
|
+
/**
|
|
142
|
+
* The build as an animated GLB — one textured node per group, TRS
|
|
143
|
+
* keyframes sampled at `fps`, anchors as child nodes, and
|
|
144
|
+
* `extras.nucleation` for opacity/tint/emissive and the camera track —
|
|
145
|
+
* base64-encoded.
|
|
146
|
+
*/
|
|
147
|
+
toAnimatedGlbB64(pack: ResourcePack, fps: number): string;
|
|
148
|
+
|
|
149
|
+
/**
|
|
150
|
+
* The finished build as a Sponge `.schem`, base64-encoded — every recorded
|
|
151
|
+
* placement applied, no timeline.
|
|
152
|
+
*/
|
|
153
|
+
toSchemB64(): string;
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
* The finished build as a `.litematic`, base64-encoded.
|
|
157
|
+
*/
|
|
158
|
+
toLitematicB64(): string;
|
|
159
|
+
|
|
123
160
|
operationsJson(): string;
|
|
124
161
|
|
|
125
162
|
frameJson(timeMs: number): string;
|
package/BuildAnimation.d.ts
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import type { AnimationEffect } from "./AnimationEffect.mjs"
|
|
3
3
|
import type { Brush } from "./Brush.mjs"
|
|
4
4
|
import type { NucleationError } from "./NucleationError.mjs"
|
|
5
|
+
import type { ResourcePack } from "./ResourcePack.mjs"
|
|
5
6
|
import type { Schematic } from "./Schematic.mjs"
|
|
6
7
|
import type { Shape } from "./Shape.mjs"
|
|
7
8
|
import type { pointer, codepoint } from "./diplomat-runtime.d.ts";
|
|
@@ -120,6 +121,42 @@ export class BuildAnimation {
|
|
|
120
121
|
|
|
121
122
|
setOperationGizmos(enabled: boolean): void;
|
|
122
123
|
|
|
124
|
+
/**
|
|
125
|
+
* Record a named point on the open group, or on the most recent group.
|
|
126
|
+
* Coordinates are the block coordinates poses use. Returns the group
|
|
127
|
+
* id the anchor belongs to.
|
|
128
|
+
*/
|
|
129
|
+
addAnchor(name: string, x: number, y: number, z: number): number;
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* Record a named point on an already recorded group.
|
|
133
|
+
*/
|
|
134
|
+
addAnchorToGroup(group: number, name: string, x: number, y: number, z: number): void;
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* Every recorded anchor as JSON: `[{ name, group, local: [x, y, z] }]`.
|
|
138
|
+
*/
|
|
139
|
+
anchorsJson(): string;
|
|
140
|
+
|
|
141
|
+
/**
|
|
142
|
+
* The build as an animated GLB — one textured node per group, TRS
|
|
143
|
+
* keyframes sampled at `fps`, anchors as child nodes, and
|
|
144
|
+
* `extras.nucleation` for opacity/tint/emissive and the camera track —
|
|
145
|
+
* base64-encoded.
|
|
146
|
+
*/
|
|
147
|
+
toAnimatedGlbB64(pack: ResourcePack, fps: number): string;
|
|
148
|
+
|
|
149
|
+
/**
|
|
150
|
+
* The finished build as a Sponge `.schem`, base64-encoded — every recorded
|
|
151
|
+
* placement applied, no timeline.
|
|
152
|
+
*/
|
|
153
|
+
toSchemB64(): string;
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
* The finished build as a `.litematic`, base64-encoded.
|
|
157
|
+
*/
|
|
158
|
+
toLitematicB64(): string;
|
|
159
|
+
|
|
123
160
|
operationsJson(): string;
|
|
124
161
|
|
|
125
162
|
frameJson(timeMs: number): string;
|
package/BuildAnimation.mjs
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import { AnimationEffect } from "./AnimationEffect.mjs"
|
|
3
3
|
import { Brush } from "./Brush.mjs"
|
|
4
4
|
import { NucleationError } from "./NucleationError.mjs"
|
|
5
|
+
import { ResourcePack } from "./ResourcePack.mjs"
|
|
5
6
|
import { Schematic } from "./Schematic.mjs"
|
|
6
7
|
import { Shape } from "./Shape.mjs"
|
|
7
8
|
import wasm from "./diplomat-wasm.mjs";
|
|
@@ -832,6 +833,171 @@ export class BuildAnimation {
|
|
|
832
833
|
}
|
|
833
834
|
}
|
|
834
835
|
|
|
836
|
+
/**
|
|
837
|
+
* Record a named point on the open group, or on the most recent group.
|
|
838
|
+
* Coordinates are the block coordinates poses use. Returns the group
|
|
839
|
+
* id the anchor belongs to.
|
|
840
|
+
*/
|
|
841
|
+
addAnchor(name, x, y, z) {
|
|
842
|
+
let functionCleanupArena = new diplomatRuntime.CleanupArena();
|
|
843
|
+
|
|
844
|
+
const nameSlice = functionCleanupArena.alloc(diplomatRuntime.DiplomatBuf.sliceWrapper(wasm, diplomatRuntime.DiplomatBuf.str8(wasm, name)));
|
|
845
|
+
const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
|
|
846
|
+
|
|
847
|
+
|
|
848
|
+
const result = wasm.BuildAnimation_add_anchor(diplomatReceive.buffer, this.ffiValue, nameSlice.ptr, x, y, z);
|
|
849
|
+
|
|
850
|
+
try {
|
|
851
|
+
if (!diplomatReceive.resultFlag) {
|
|
852
|
+
const cause = new NucleationError(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
|
|
853
|
+
throw new globalThis.Error('NucleationError.' + cause.value, { cause });
|
|
854
|
+
}
|
|
855
|
+
return (new Uint32Array(wasm.memory.buffer, diplomatReceive.buffer, 1))[0];
|
|
856
|
+
}
|
|
857
|
+
|
|
858
|
+
finally {
|
|
859
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
860
|
+
functionCleanupArena.free();
|
|
861
|
+
|
|
862
|
+
diplomatReceive.free();
|
|
863
|
+
}
|
|
864
|
+
}
|
|
865
|
+
|
|
866
|
+
/**
|
|
867
|
+
* Record a named point on an already recorded group.
|
|
868
|
+
*/
|
|
869
|
+
addAnchorToGroup(group, name, x, y, z) {
|
|
870
|
+
let functionCleanupArena = new diplomatRuntime.CleanupArena();
|
|
871
|
+
|
|
872
|
+
const nameSlice = functionCleanupArena.alloc(diplomatRuntime.DiplomatBuf.sliceWrapper(wasm, diplomatRuntime.DiplomatBuf.str8(wasm, name)));
|
|
873
|
+
const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
|
|
874
|
+
|
|
875
|
+
|
|
876
|
+
const result = wasm.BuildAnimation_add_anchor_to_group(diplomatReceive.buffer, this.ffiValue, group, nameSlice.ptr, x, y, z);
|
|
877
|
+
|
|
878
|
+
try {
|
|
879
|
+
if (!diplomatReceive.resultFlag) {
|
|
880
|
+
const cause = new NucleationError(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
|
|
881
|
+
throw new globalThis.Error('NucleationError.' + cause.value, { cause });
|
|
882
|
+
}
|
|
883
|
+
}
|
|
884
|
+
|
|
885
|
+
finally {
|
|
886
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
887
|
+
functionCleanupArena.free();
|
|
888
|
+
|
|
889
|
+
diplomatReceive.free();
|
|
890
|
+
}
|
|
891
|
+
}
|
|
892
|
+
|
|
893
|
+
/**
|
|
894
|
+
* Every recorded anchor as JSON: `[{ name, group, local: [x, y, z] }]`.
|
|
895
|
+
*/
|
|
896
|
+
anchorsJson() {
|
|
897
|
+
const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
|
|
898
|
+
|
|
899
|
+
const write = new diplomatRuntime.DiplomatWriteBuf(wasm);
|
|
900
|
+
|
|
901
|
+
|
|
902
|
+
const result = wasm.BuildAnimation_anchors_json(diplomatReceive.buffer, this.ffiValue, write.buffer);
|
|
903
|
+
|
|
904
|
+
try {
|
|
905
|
+
if (!diplomatReceive.resultFlag) {
|
|
906
|
+
const cause = new NucleationError(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
|
|
907
|
+
throw new globalThis.Error('NucleationError.' + cause.value, { cause });
|
|
908
|
+
}
|
|
909
|
+
return write.readString8();
|
|
910
|
+
}
|
|
911
|
+
|
|
912
|
+
finally {
|
|
913
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
914
|
+
diplomatReceive.free();
|
|
915
|
+
write.free();
|
|
916
|
+
}
|
|
917
|
+
}
|
|
918
|
+
|
|
919
|
+
/**
|
|
920
|
+
* The build as an animated GLB — one textured node per group, TRS
|
|
921
|
+
* keyframes sampled at `fps`, anchors as child nodes, and
|
|
922
|
+
* `extras.nucleation` for opacity/tint/emissive and the camera track —
|
|
923
|
+
* base64-encoded.
|
|
924
|
+
*/
|
|
925
|
+
toAnimatedGlbB64(pack, fps) {
|
|
926
|
+
const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
|
|
927
|
+
|
|
928
|
+
const write = new diplomatRuntime.DiplomatWriteBuf(wasm);
|
|
929
|
+
|
|
930
|
+
|
|
931
|
+
const result = wasm.BuildAnimation_to_animated_glb_b64(diplomatReceive.buffer, this.ffiValue, pack.ffiValue, fps, write.buffer);
|
|
932
|
+
|
|
933
|
+
try {
|
|
934
|
+
if (!diplomatReceive.resultFlag) {
|
|
935
|
+
const cause = new NucleationError(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
|
|
936
|
+
throw new globalThis.Error('NucleationError.' + cause.value, { cause });
|
|
937
|
+
}
|
|
938
|
+
return write.readString8();
|
|
939
|
+
}
|
|
940
|
+
|
|
941
|
+
finally {
|
|
942
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
943
|
+
diplomatReceive.free();
|
|
944
|
+
write.free();
|
|
945
|
+
}
|
|
946
|
+
}
|
|
947
|
+
|
|
948
|
+
/**
|
|
949
|
+
* The finished build as a Sponge `.schem`, base64-encoded — every recorded
|
|
950
|
+
* placement applied, no timeline.
|
|
951
|
+
*/
|
|
952
|
+
toSchemB64() {
|
|
953
|
+
const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
|
|
954
|
+
|
|
955
|
+
const write = new diplomatRuntime.DiplomatWriteBuf(wasm);
|
|
956
|
+
|
|
957
|
+
|
|
958
|
+
const result = wasm.BuildAnimation_to_schem_b64(diplomatReceive.buffer, this.ffiValue, write.buffer);
|
|
959
|
+
|
|
960
|
+
try {
|
|
961
|
+
if (!diplomatReceive.resultFlag) {
|
|
962
|
+
const cause = new NucleationError(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
|
|
963
|
+
throw new globalThis.Error('NucleationError.' + cause.value, { cause });
|
|
964
|
+
}
|
|
965
|
+
return write.readString8();
|
|
966
|
+
}
|
|
967
|
+
|
|
968
|
+
finally {
|
|
969
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
970
|
+
diplomatReceive.free();
|
|
971
|
+
write.free();
|
|
972
|
+
}
|
|
973
|
+
}
|
|
974
|
+
|
|
975
|
+
/**
|
|
976
|
+
* The finished build as a `.litematic`, base64-encoded.
|
|
977
|
+
*/
|
|
978
|
+
toLitematicB64() {
|
|
979
|
+
const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
|
|
980
|
+
|
|
981
|
+
const write = new diplomatRuntime.DiplomatWriteBuf(wasm);
|
|
982
|
+
|
|
983
|
+
|
|
984
|
+
const result = wasm.BuildAnimation_to_litematic_b64(diplomatReceive.buffer, this.ffiValue, write.buffer);
|
|
985
|
+
|
|
986
|
+
try {
|
|
987
|
+
if (!diplomatReceive.resultFlag) {
|
|
988
|
+
const cause = new NucleationError(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
|
|
989
|
+
throw new globalThis.Error('NucleationError.' + cause.value, { cause });
|
|
990
|
+
}
|
|
991
|
+
return write.readString8();
|
|
992
|
+
}
|
|
993
|
+
|
|
994
|
+
finally {
|
|
995
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
996
|
+
diplomatReceive.free();
|
|
997
|
+
write.free();
|
|
998
|
+
}
|
|
999
|
+
}
|
|
1000
|
+
|
|
835
1001
|
operationsJson() {
|
|
836
1002
|
const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
|
|
837
1003
|
|
package/nucleation.wasm
CHANGED
|
Binary file
|