@draco-rust/decoder 0.2.0 → 0.3.1
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/README.md +9 -3
- package/index.d.ts +67 -71
- package/index.js +1 -582
- package/index_bg.wasm +0 -0
- package/index_bg.wasm.d.ts +2 -2
- package/legacy/index.d.ts +67 -71
- package/legacy/index.js +1 -582
- package/legacy/index_bg.wasm +0 -0
- package/legacy/index_bg.wasm.d.ts +2 -2
- package/legacy/pool-core.d.ts +44 -0
- package/legacy/pool-core.js +250 -0
- package/legacy/pool.d.ts +6 -29
- package/legacy/pool.js +15 -184
- package/legacy/tasks.js +2 -0
- package/legacy/worker.js +24 -10
- package/mesh/index.d.ts +67 -71
- package/mesh/index.js +1 -582
- package/mesh/index_bg.wasm +0 -0
- package/mesh/index_bg.wasm.d.ts +2 -2
- package/mesh/pool-core.d.ts +44 -0
- package/mesh/pool-core.js +250 -0
- package/mesh/pool.d.ts +6 -29
- package/mesh/pool.js +15 -184
- package/mesh/tasks.js +2 -0
- package/mesh/worker.js +24 -10
- package/package.json +4 -4
- package/point-cloud/index.d.ts +67 -71
- package/point-cloud/index.js +1 -582
- package/point-cloud/index_bg.wasm +0 -0
- package/point-cloud/index_bg.wasm.d.ts +2 -2
- package/point-cloud/pool-core.d.ts +44 -0
- package/point-cloud/pool-core.js +250 -0
- package/point-cloud/pool.d.ts +6 -29
- package/point-cloud/pool.js +15 -184
- package/point-cloud/tasks.js +2 -0
- package/point-cloud/worker.js +24 -10
- package/pool-core.d.ts +44 -0
- package/pool-core.js +250 -0
- package/pool.d.ts +6 -29
- package/pool.js +15 -184
- package/tasks.js +2 -0
- package/worker.js +24 -10
package/mesh/index.d.ts
CHANGED
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
|
|
4
4
|
/** The name of a typed array `decode_draco` can convert an attribute to. */
|
|
5
5
|
export type DracoArrayType =
|
|
6
|
-
| "Int8Array" | "Uint8Array" | "Int16Array" | "Uint16Array"
|
|
7
|
-
| "Int32Array" | "Uint32Array" | "Float32Array";
|
|
6
|
+
| "Int8Array" | "Uint8Array" | "Int16Array" | "Uint16Array"
|
|
7
|
+
| "Int32Array" | "Uint32Array" | "Float32Array";
|
|
8
8
|
|
|
9
9
|
/** A Draco attribute type, as `semantic` names it. */
|
|
10
10
|
export type DracoSemantic = "POSITION" | "NORMAL" | "COLOR" | "TEX_COORD" | "GENERIC";
|
|
@@ -14,62 +14,58 @@ export type DracoSemantic = "POSITION" | "NORMAL" | "COLOR" | "TEX_COORD" | "GEN
|
|
|
14
14
|
* attribute of that type. `name` is handed back unchanged.
|
|
15
15
|
*/
|
|
16
16
|
export interface DracoAttributeRequest {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
17
|
+
name?: string;
|
|
18
|
+
id?: number;
|
|
19
|
+
semantic?: DracoSemantic;
|
|
20
|
+
type?: DracoArrayType;
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
/** The typed arrays an attribute can come back in. */
|
|
24
24
|
export type DracoArray =
|
|
25
|
-
| Int8Array | Uint8Array | Int16Array | Uint16Array | Int32Array | Uint32Array
|
|
26
|
-
| Float32Array | Float64Array | BigInt64Array | BigUint64Array;
|
|
25
|
+
| Int8Array | Uint8Array | Int16Array | Uint16Array | Int32Array | Uint32Array
|
|
26
|
+
| Float32Array | Float64Array | BigInt64Array | BigUint64Array;
|
|
27
27
|
|
|
28
28
|
export interface DracoAttribute {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
29
|
+
/** The request's `name`, or else the name the stream's metadata gives it. */
|
|
30
|
+
name?: string;
|
|
31
|
+
uniqueId: number;
|
|
32
|
+
semantic: DracoSemantic;
|
|
33
|
+
array: DracoArray;
|
|
34
|
+
itemSize: number;
|
|
35
|
+
normalized: boolean;
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
-
export interface
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
attributes: DracoAttribute[];
|
|
38
|
+
export interface DracoDecodeOptions {
|
|
39
|
+
/**
|
|
40
|
+
* The index's array: `"Uint32Array"`, the default, or `"auto"`, which uses a
|
|
41
|
+
* `Uint16Array` when every point number fits, at most 65536 points, and
|
|
42
|
+
* halves what a worker sends back.
|
|
43
|
+
*/
|
|
44
|
+
index?: "Uint32Array" | "auto";
|
|
46
45
|
}
|
|
47
46
|
|
|
48
|
-
|
|
47
|
+
export interface DracoDecodeResult {
|
|
48
|
+
success: boolean;
|
|
49
|
+
error?: string;
|
|
50
|
+
warnings: string[];
|
|
51
|
+
geometry?: "mesh" | "point_cloud";
|
|
52
|
+
/** Triangle corners for a mesh, `null` for a point cloud. */
|
|
53
|
+
index: Uint32Array | Uint16Array | null;
|
|
54
|
+
attributes: DracoAttribute[];
|
|
55
|
+
}
|
|
49
56
|
|
|
50
57
|
/**
|
|
51
|
-
* Decodes a Draco stream and returns its attributes as typed arrays
|
|
52
|
-
*
|
|
53
|
-
*
|
|
54
|
-
* or an array of requests `{ name, id, semantic, type }`:
|
|
55
|
-
*
|
|
56
|
-
* - `id`, a unique id, finds that attribute, as glTF's
|
|
57
|
-
* `KHR_draco_mesh_compression` names them; a missing one is an error.
|
|
58
|
-
* - `semantic` (`"POSITION"`, `"NORMAL"`, `"COLOR"`, `"TEX_COORD"` or
|
|
59
|
-
* `"GENERIC"`) finds the first attribute of that type instead, as a `.drc`
|
|
60
|
-
* file is read; a missing one is left out.
|
|
61
|
-
* - `type`, a typed array's name such as `"Float32Array"` or
|
|
62
|
-
* `"Uint16Array"`, converts the values the way upstream's
|
|
63
|
-
* `GetAttributeDataArrayForAllPoints` does; without it the values keep
|
|
64
|
-
* their own type. A value the type cannot hold is an error.
|
|
65
|
-
*
|
|
66
|
-
* The result is `{ success, error, warnings, geometry, index, attributes }`,
|
|
67
|
-
* where `geometry` is `"mesh"` or `"point_cloud"` as the stream's header says,
|
|
68
|
-
* `index` a `Uint32Array` of triangle corners for a mesh and `null` for a
|
|
69
|
-
* point cloud, and each attribute `{ name, uniqueId, semantic, array,
|
|
70
|
-
* itemSize, normalized }`.
|
|
58
|
+
* Decodes a Draco stream and returns its attributes as typed arrays: every
|
|
59
|
+
* attribute in its own type, or the ones `attributes` requests, converted as
|
|
60
|
+
* upstream's `GetAttributeDataArrayForAllPoints` converts them.
|
|
71
61
|
*/
|
|
72
|
-
export function decode_draco(
|
|
62
|
+
export function decode_draco(
|
|
63
|
+
data: Uint8Array,
|
|
64
|
+
attributes?: DracoAttributeRequest[],
|
|
65
|
+
options?: DracoDecodeOptions,
|
|
66
|
+
): DracoDecodeResult;
|
|
67
|
+
|
|
68
|
+
|
|
73
69
|
|
|
74
70
|
/**
|
|
75
71
|
* Install the panic hook, so a panic reads as a message rather than a trap.
|
|
@@ -94,38 +90,38 @@ export function version(): string;
|
|
|
94
90
|
export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
|
|
95
91
|
|
|
96
92
|
export interface InitOutput {
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
93
|
+
readonly memory: WebAssembly.Memory;
|
|
94
|
+
readonly decode_draco: (a: number, b: number, c: number, d: number) => number;
|
|
95
|
+
readonly parse_drc_bytes: (a: number, b: number) => number;
|
|
96
|
+
readonly supported_extensions: (a: number) => void;
|
|
97
|
+
readonly version: (a: number) => void;
|
|
98
|
+
readonly init: () => void;
|
|
99
|
+
readonly __wbindgen_export: (a: number, b: number) => number;
|
|
100
|
+
readonly __wbindgen_export2: (a: number, b: number, c: number, d: number) => number;
|
|
101
|
+
readonly __wbindgen_export3: (a: number) => void;
|
|
102
|
+
readonly __wbindgen_add_to_stack_pointer: (a: number) => number;
|
|
103
|
+
readonly __wbindgen_export4: (a: number, b: number, c: number) => void;
|
|
104
|
+
readonly __wbindgen_start: () => void;
|
|
109
105
|
}
|
|
110
106
|
|
|
111
107
|
export type SyncInitInput = BufferSource | WebAssembly.Module;
|
|
112
108
|
|
|
113
109
|
/**
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
110
|
+
* Instantiates the given `module`, which can either be bytes or
|
|
111
|
+
* a precompiled `WebAssembly.Module`.
|
|
112
|
+
*
|
|
113
|
+
* @param {{ module: SyncInitInput }} module - Passing `SyncInitInput` directly is deprecated.
|
|
114
|
+
*
|
|
115
|
+
* @returns {InitOutput}
|
|
116
|
+
*/
|
|
121
117
|
export function initSync(module: { module: SyncInitInput } | SyncInitInput): InitOutput;
|
|
122
118
|
|
|
123
119
|
/**
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
120
|
+
* If `module_or_path` is {RequestInfo} or {URL}, makes a request and
|
|
121
|
+
* for everything else, calls `WebAssembly.instantiate` directly.
|
|
122
|
+
*
|
|
123
|
+
* @param {{ module_or_path: InitInput | Promise<InitInput> }} module_or_path - Passing `InitInput` directly is deprecated.
|
|
124
|
+
*
|
|
125
|
+
* @returns {Promise<InitOutput>}
|
|
126
|
+
*/
|
|
131
127
|
export default function __wbg_init (module_or_path?: { module_or_path: InitInput | Promise<InitInput> } | InitInput | Promise<InitInput>): Promise<InitOutput>;
|