minidraco 0.3.0 → 0.4.0
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 +7 -8
- package/dist/index.d.ts +10 -1
- package/dist/index.js +1482 -652
- package/dist/three.d.ts +10 -1
- package/dist/three.js +1480 -650
- package/dist/worker.js +1482 -652
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -39,21 +39,20 @@ const mesh = decodeDracoMesh(new Uint8Array(bytes))
|
|
|
39
39
|
|
|
40
40
|
## Performance
|
|
41
41
|
|
|
42
|
-
Median across
|
|
42
|
+
Median across an 18-model corpus vs [draco.js](https://github.com/mrdoob/draco.js) and the official
|
|
43
43
|
[draco3d](https://www.npmjs.com/package/draco3d) wasm decoder (full results in
|
|
44
44
|
[BENCH.md](https://github.com/verekia/minidraco/blob/main/BENCH.md)):
|
|
45
45
|
|
|
46
46
|
| benchmark | vs draco.js | vs draco3d wasm |
|
|
47
47
|
| --------------------------------------------- | --------------- | --------------- |
|
|
48
|
-
| single-threaded decode — bun (JSC) |
|
|
49
|
-
| single-threaded decode — Chrome (V8) |
|
|
50
|
-
| `GLTFLoader.parse`, worker pool — Chrome (V8) | 🟢 1.
|
|
48
|
+
| single-threaded decode — bun (JSC) | 🟢 1.23× faster | 🟢 1.32× faster |
|
|
49
|
+
| single-threaded decode — Chrome (V8) | 🟢 1.26× faster | 🟢 1.06× faster |
|
|
50
|
+
| `GLTFLoader.parse`, worker pool — Chrome (V8) | 🟢 1.46× faster | 🔴 1.05× slower |
|
|
51
51
|
|
|
52
|
-
|
|
53
|
-
`GLTFLoader.parse` with the main thread left free.
|
|
52
|
+
Faster than draco.js across the corpus, ahead of the wasm decoder single-threaded, and
|
|
53
|
+
competitive in a real `GLTFLoader.parse` with the main thread left free.
|
|
54
54
|
|
|
55
|
-
🟢
|
|
56
|
-
to fetch and compile before the first decode, so the first model on screen appears sooner.
|
|
55
|
+
🟢 There's no `draco_decoder.wasm` to fetch and compile before the first decode, so minidraco (and draco.js) often beat the wasm decoder on first load (not reflected on the benchmark).
|
|
57
56
|
|
|
58
57
|
## Download size
|
|
59
58
|
|
package/dist/index.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ declare class DataBuffer {
|
|
|
3
3
|
constructor();
|
|
4
4
|
update(data: Uint8Array | ArrayBufferView | ArrayBuffer | null | undefined, size: number, offset?: number): boolean;
|
|
5
5
|
resize(newSize: number): void;
|
|
6
|
+
adoptScratch(size: number): void;
|
|
6
7
|
write(bytePos: number, inArray: Uint8Array | ArrayBufferView | ArrayBuffer, dataSize: number): void;
|
|
7
8
|
get data(): Uint8Array;
|
|
8
9
|
get dataSize(): number;
|
|
@@ -44,10 +45,15 @@ declare class GeometryAttribute {
|
|
|
44
45
|
|
|
45
46
|
declare class AttributeTransformData {
|
|
46
47
|
_transformType: number;
|
|
47
|
-
|
|
48
|
+
_bytes: Uint8Array;
|
|
49
|
+
_view: DataView;
|
|
50
|
+
_size: number;
|
|
48
51
|
constructor();
|
|
49
52
|
get transformType(): number;
|
|
50
53
|
set transformType(type: number);
|
|
54
|
+
get dataSize(): number;
|
|
55
|
+
get data(): Uint8Array;
|
|
56
|
+
_reserve(sizeNeeded: number): void;
|
|
51
57
|
setParameterValue(byteOffset: number, value: number, type: string): void;
|
|
52
58
|
appendParameterValue(value: number, type: string): void;
|
|
53
59
|
_typeSize(type: string): number;
|
|
@@ -81,6 +87,7 @@ declare class PointAttribute extends GeometryAttribute {
|
|
|
81
87
|
constructor(geometryAttribute?: GeometryAttribute);
|
|
82
88
|
init(attributeType: number, numComponents: number, dataType: number, normalized: boolean, numAttributeValues: number): void;
|
|
83
89
|
reset(numAttributeValues: number): boolean;
|
|
90
|
+
resetScratch(numAttributeValues: number): boolean;
|
|
84
91
|
get size(): number;
|
|
85
92
|
mappedIndex(pointIndex: number): number;
|
|
86
93
|
get isMappingIdentity(): boolean;
|
|
@@ -89,6 +96,8 @@ declare class PointAttribute extends GeometryAttribute {
|
|
|
89
96
|
setIdentityMapping(): void;
|
|
90
97
|
setExplicitMapping(numPoints: number): void;
|
|
91
98
|
setExplicitMappingUnfilled(numPoints: number): void;
|
|
99
|
+
setExplicitMappingShared(map: Uint32Array): void;
|
|
100
|
+
setExplicitMappingScratch(numPoints: number): void;
|
|
92
101
|
setAttributeTransformData(transformData: AttributeTransformData): void;
|
|
93
102
|
convertValue(attIndex: number, outVal: number[] | Int32Array | Uint32Array | Float32Array | Float64Array): void;
|
|
94
103
|
extractTo<C extends new (length: number) => ExtractTypedArray>(OutputTypedArray: C, numPoints: number): InstanceType<C>;
|