three-cad-viewer 5.0.1 → 5.0.3
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/dist/index.d.ts +1 -1
- package/dist/scene/grid.d.ts +12 -0
- package/dist/scene/nestedgroup.d.ts +1 -0
- package/dist/three-cad-viewer.esm.js +62 -14
- package/dist/three-cad-viewer.esm.js.map +1 -1
- package/dist/three-cad-viewer.esm.min.js +3 -3
- package/dist/three-cad-viewer.js +63 -13
- package/dist/three-cad-viewer.min.js +2 -2
- package/dist/utils/decode-instances.d.ts +23 -2
- package/package.json +1 -1
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
* instances via `"shape": { "ref": N }`. After decoding, the result is a
|
|
12
12
|
* standard Shapes tree with TypedArrays — identical to the existing format.
|
|
13
13
|
*/
|
|
14
|
-
import type { Shapes } from "../core/types.js";
|
|
14
|
+
import type { Shape, Shapes } from "../core/types.js";
|
|
15
15
|
/** A single base64-encoded buffer entry. */
|
|
16
16
|
interface EncodedBuffer {
|
|
17
17
|
shape: number[];
|
|
@@ -48,13 +48,34 @@ declare function decodeInlineBuffers(shapes: Shapes): void;
|
|
|
48
48
|
* Detected by the presence of an `instances` array and a `shapes` object.
|
|
49
49
|
*/
|
|
50
50
|
declare function isInstancedFormat(data: unknown): data is InstancedData;
|
|
51
|
+
/**
|
|
52
|
+
* Decode every instance's buffers from base64 into TypedArrays.
|
|
53
|
+
*
|
|
54
|
+
* This is the leaf half of the instanced format: it knows the encoding and
|
|
55
|
+
* nothing about the shapes tree. A host that receives its geometry as raw
|
|
56
|
+
* binary rather than base64 skips this step and builds the `Shape[]` itself.
|
|
57
|
+
*/
|
|
58
|
+
declare function decodeBuffers(instances: EncodedInstance[]): Shape[];
|
|
59
|
+
/**
|
|
60
|
+
* Resolve `{ ref: N }` entries in the shapes tree against decoded instances,
|
|
61
|
+
* and return the tree.
|
|
62
|
+
*
|
|
63
|
+
* This is the structural half: the same geometry referenced N times - twenty
|
|
64
|
+
* identical bolts - which every host needs whatever encoding it received the
|
|
65
|
+
* buffers in. Held separate from `decodeBuffers` so that a host holding
|
|
66
|
+
* TypedArrays already does not have to reimplement the walk.
|
|
67
|
+
*/
|
|
68
|
+
declare function resolveInstances(shapes: Shapes, decoded: Shape[]): Shapes;
|
|
51
69
|
/**
|
|
52
70
|
* Decode the instanced format into a standard Shapes object.
|
|
53
71
|
*
|
|
54
72
|
* 1. Decode all instance buffers from base64 → TypedArrays
|
|
55
73
|
* 2. Walk the shapes tree and replace { ref: N } with decoded instances
|
|
56
74
|
* 3. Return the unwrapped Shapes object
|
|
75
|
+
*
|
|
76
|
+
* Kept as the composition of the two halves above, so existing callers see
|
|
77
|
+
* no change.
|
|
57
78
|
*/
|
|
58
79
|
declare function decodeInstancedFormat(data: InstancedData): Shapes;
|
|
59
|
-
export { isInstancedFormat, decodeInstancedFormat, decodeInlineBuffers };
|
|
80
|
+
export { isInstancedFormat, decodeBuffers, resolveInstances, decodeInstancedFormat, decodeInlineBuffers, };
|
|
60
81
|
export type { InstancedData, EncodedBuffer, EncodedInstance };
|