@draco-rust/decoder 0.1.0 → 0.1.2
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 +82 -7
- package/index.d.ts +96 -24
- package/index.js +378 -139
- package/index_bg.wasm +0 -0
- package/index_bg.wasm.d.ts +6 -4
- package/legacy/index.d.ts +96 -24
- package/legacy/index.js +378 -139
- package/legacy/index_bg.wasm +0 -0
- package/legacy/index_bg.wasm.d.ts +6 -4
- package/legacy/pool.d.ts +45 -0
- package/legacy/pool.js +193 -0
- package/legacy/three.d.ts +65 -0
- package/legacy/three.js +123 -0
- package/legacy/worker.js +28 -0
- package/mesh/index.d.ts +96 -24
- package/mesh/index.js +378 -139
- package/mesh/index_bg.wasm +0 -0
- package/mesh/index_bg.wasm.d.ts +6 -4
- package/mesh/pool.d.ts +45 -0
- package/mesh/pool.js +193 -0
- package/mesh/three.d.ts +65 -0
- package/mesh/three.js +123 -0
- package/mesh/worker.js +28 -0
- package/package.json +21 -5
- package/point-cloud/index.d.ts +96 -24
- package/point-cloud/index.js +378 -139
- package/point-cloud/index_bg.wasm +0 -0
- package/point-cloud/index_bg.wasm.d.ts +6 -4
- package/point-cloud/pool.d.ts +45 -0
- package/point-cloud/pool.js +193 -0
- package/point-cloud/three.d.ts +65 -0
- package/point-cloud/three.js +123 -0
- package/point-cloud/worker.js +28 -0
- package/pool.d.ts +45 -0
- package/pool.js +193 -0
- package/three.d.ts +65 -0
- package/three.js +123 -0
- package/worker.js +28 -0
package/legacy/index.d.ts
CHANGED
|
@@ -1,6 +1,76 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
|
|
4
|
+
/** The name of a typed array `decode_draco` can convert an attribute to. */
|
|
5
|
+
export type DracoArrayType =
|
|
6
|
+
| "Int8Array" | "Uint8Array" | "Int16Array" | "Uint16Array"
|
|
7
|
+
| "Int32Array" | "Uint32Array" | "Float32Array";
|
|
8
|
+
|
|
9
|
+
/** A Draco attribute type, as `semantic` names it. */
|
|
10
|
+
export type DracoSemantic = "POSITION" | "NORMAL" | "COLOR" | "TEX_COORD" | "GENERIC";
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* One attribute to decode: by `id`, its unique id, or by `semantic`, the first
|
|
14
|
+
* attribute of that type. `name` is handed back unchanged.
|
|
15
|
+
*/
|
|
16
|
+
export interface DracoAttributeRequest {
|
|
17
|
+
name?: string;
|
|
18
|
+
id?: number;
|
|
19
|
+
semantic?: DracoSemantic;
|
|
20
|
+
type?: DracoArrayType;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/** The typed arrays an attribute can come back in. */
|
|
24
|
+
export type DracoArray =
|
|
25
|
+
| Int8Array | Uint8Array | Int16Array | Uint16Array | Int32Array | Uint32Array
|
|
26
|
+
| Float32Array | Float64Array | BigInt64Array | BigUint64Array;
|
|
27
|
+
|
|
28
|
+
export interface DracoAttribute {
|
|
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
|
+
}
|
|
37
|
+
|
|
38
|
+
export interface DracoDecodeResult {
|
|
39
|
+
success: boolean;
|
|
40
|
+
error?: string;
|
|
41
|
+
warnings: string[];
|
|
42
|
+
geometry?: "mesh" | "point_cloud";
|
|
43
|
+
/** Triangle corners for a mesh, `null` for a point cloud. */
|
|
44
|
+
index: Uint32Array | null;
|
|
45
|
+
attributes: DracoAttribute[];
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Decodes a Draco stream and returns its attributes as typed arrays.
|
|
52
|
+
*
|
|
53
|
+
* `attributes` is `undefined` for every attribute in its own component type,
|
|
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 }`.
|
|
71
|
+
*/
|
|
72
|
+
export function decode_draco(data: Uint8Array, attributes: DracoAttributeRequest[] | undefined): DracoDecodeResult;
|
|
73
|
+
|
|
4
74
|
/**
|
|
5
75
|
* Install the panic hook, so a panic reads as a message rather than a trap.
|
|
6
76
|
*/
|
|
@@ -24,36 +94,38 @@ export function version(): string;
|
|
|
24
94
|
export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
|
|
25
95
|
|
|
26
96
|
export interface InitOutput {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
97
|
+
readonly memory: WebAssembly.Memory;
|
|
98
|
+
readonly decode_draco: (a: number, b: number, c: number) => number;
|
|
99
|
+
readonly init: () => void;
|
|
100
|
+
readonly parse_drc_bytes: (a: number, b: number) => number;
|
|
101
|
+
readonly supported_extensions: (a: number) => void;
|
|
102
|
+
readonly version: (a: number) => void;
|
|
103
|
+
readonly __wbindgen_export: (a: number, b: number) => number;
|
|
104
|
+
readonly __wbindgen_export2: (a: number, b: number, c: number, d: number) => number;
|
|
105
|
+
readonly __wbindgen_export3: (a: number) => void;
|
|
106
|
+
readonly __wbindgen_add_to_stack_pointer: (a: number) => number;
|
|
107
|
+
readonly __wbindgen_export4: (a: number, b: number, c: number) => void;
|
|
108
|
+
readonly __wbindgen_start: () => void;
|
|
37
109
|
}
|
|
38
110
|
|
|
39
111
|
export type SyncInitInput = BufferSource | WebAssembly.Module;
|
|
40
112
|
|
|
41
113
|
/**
|
|
42
|
-
* Instantiates the given `module`, which can either be bytes or
|
|
43
|
-
* a precompiled `WebAssembly.Module`.
|
|
44
|
-
*
|
|
45
|
-
* @param {{ module: SyncInitInput }} module - Passing `SyncInitInput` directly is deprecated.
|
|
46
|
-
*
|
|
47
|
-
* @returns {InitOutput}
|
|
48
|
-
*/
|
|
114
|
+
* Instantiates the given `module`, which can either be bytes or
|
|
115
|
+
* a precompiled `WebAssembly.Module`.
|
|
116
|
+
*
|
|
117
|
+
* @param {{ module: SyncInitInput }} module - Passing `SyncInitInput` directly is deprecated.
|
|
118
|
+
*
|
|
119
|
+
* @returns {InitOutput}
|
|
120
|
+
*/
|
|
49
121
|
export function initSync(module: { module: SyncInitInput } | SyncInitInput): InitOutput;
|
|
50
122
|
|
|
51
123
|
/**
|
|
52
|
-
* If `module_or_path` is {RequestInfo} or {URL}, makes a request and
|
|
53
|
-
* for everything else, calls `WebAssembly.instantiate` directly.
|
|
54
|
-
*
|
|
55
|
-
* @param {{ module_or_path: InitInput | Promise<InitInput> }} module_or_path - Passing `InitInput` directly is deprecated.
|
|
56
|
-
*
|
|
57
|
-
* @returns {Promise<InitOutput>}
|
|
58
|
-
*/
|
|
124
|
+
* If `module_or_path` is {RequestInfo} or {URL}, makes a request and
|
|
125
|
+
* for everything else, calls `WebAssembly.instantiate` directly.
|
|
126
|
+
*
|
|
127
|
+
* @param {{ module_or_path: InitInput | Promise<InitInput> }} module_or_path - Passing `InitInput` directly is deprecated.
|
|
128
|
+
*
|
|
129
|
+
* @returns {Promise<InitOutput>}
|
|
130
|
+
*/
|
|
59
131
|
export default function __wbg_init (module_or_path?: { module_or_path: InitInput | Promise<InitInput> } | InitInput | Promise<InitInput>): Promise<InitOutput>;
|