@driftengine/assets 4.7.0 → 4.7.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/dist/readModel.d.ts +2 -1
- package/dist/readModel.js +14 -13
- package/package.json +4 -4
- package/src/readModel.ts +14 -13
package/dist/readModel.d.ts
CHANGED
|
@@ -149,6 +149,8 @@ export interface ModelImport {
|
|
|
149
149
|
* whole call in a worker and keep the parse off the main thread.
|
|
150
150
|
*/
|
|
151
151
|
export declare function readModel(source: ModelSource): Promise<ModelImport>;
|
|
152
|
+
/** The separate levels of detail a bundle ships beside its model, finest first. */
|
|
153
|
+
export declare function levelsBeside(model: string, names: readonly string[]): string[];
|
|
152
154
|
/**
|
|
153
155
|
* The collision hull a vehicle folder ships beside its model, or null.
|
|
154
156
|
*
|
|
@@ -162,5 +164,4 @@ export declare function readModel(source: ModelSource): Promise<ModelImport>;
|
|
|
162
164
|
* reader and no writer — a format decision about whether a hull is triangle soup or a set of
|
|
163
165
|
* convex hulls, and not one an import should make in passing.
|
|
164
166
|
*/
|
|
165
|
-
export declare function levelsBeside(model: string, names: readonly string[]): string[];
|
|
166
167
|
export declare function colliderBeside(names: readonly string[]): string | null;
|
package/dist/readModel.js
CHANGED
|
@@ -383,19 +383,7 @@ function base64Bytes(base64) {
|
|
|
383
383
|
out[i] = binary.charCodeAt(i);
|
|
384
384
|
return out;
|
|
385
385
|
}
|
|
386
|
-
/**
|
|
387
|
-
* The collision hull a vehicle folder ships beside its model, or null.
|
|
388
|
-
*
|
|
389
|
-
* **A convention, not a statement in any file**, which is why it is one named function instead of
|
|
390
|
-
* a rule spread through the baker: a folder naming its hull differently gets no collider and the
|
|
391
|
-
* baker says what it looked for, rather than leaving a consumer to wonder why physics has nothing
|
|
392
|
-
* to work with.
|
|
393
|
-
*
|
|
394
|
-
* It is read by the ordinary reader and baked as its own asset. Carrying a hull *inside* the
|
|
395
|
-
* model's own file would mean defining `COLL`, which is a declared FourCC with no payload, no
|
|
396
|
-
* reader and no writer — a format decision about whether a hull is triangle soup or a set of
|
|
397
|
-
* convex hulls, and not one an import should make in passing.
|
|
398
|
-
*/
|
|
386
|
+
/** The separate levels of detail a bundle ships beside its model, finest first. */
|
|
399
387
|
export function levelsBeside(model, names) {
|
|
400
388
|
/*
|
|
401
389
|
* `<name>_lod_<letter>.kn5` beside `<name>.kn5`, finest first, which is the order the letters
|
|
@@ -410,6 +398,19 @@ export function levelsBeside(model, names) {
|
|
|
410
398
|
.sort((a, b) => a.match[1].toLowerCase().localeCompare(b.match[1].toLowerCase()))
|
|
411
399
|
.map((entry) => entry.name);
|
|
412
400
|
}
|
|
401
|
+
/**
|
|
402
|
+
* The collision hull a vehicle folder ships beside its model, or null.
|
|
403
|
+
*
|
|
404
|
+
* **A convention, not a statement in any file**, which is why it is one named function instead of
|
|
405
|
+
* a rule spread through the baker: a folder naming its hull differently gets no collider and the
|
|
406
|
+
* baker says what it looked for, rather than leaving a consumer to wonder why physics has nothing
|
|
407
|
+
* to work with.
|
|
408
|
+
*
|
|
409
|
+
* It is read by the ordinary reader and baked as its own asset. Carrying a hull *inside* the
|
|
410
|
+
* model's own file would mean defining `COLL`, which is a declared FourCC with no payload, no
|
|
411
|
+
* reader and no writer — a format decision about whether a hull is triangle soup or a set of
|
|
412
|
+
* convex hulls, and not one an import should make in passing.
|
|
413
|
+
*/
|
|
413
414
|
export function colliderBeside(names) {
|
|
414
415
|
return names.find((name) => name.toLowerCase() === 'collider.kn5') ?? null;
|
|
415
416
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@driftengine/assets",
|
|
3
|
-
"version": "4.7.
|
|
3
|
+
"version": "4.7.1",
|
|
4
4
|
"description": "Model readers and the streaming loader for the .drft container",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"type": "module",
|
|
@@ -27,11 +27,11 @@
|
|
|
27
27
|
],
|
|
28
28
|
"sideEffects": false,
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@driftengine/drft": "4.7.
|
|
31
|
-
"@driftengine/texture": "4.7.
|
|
30
|
+
"@driftengine/drft": "4.7.1",
|
|
31
|
+
"@driftengine/texture": "4.7.1"
|
|
32
32
|
},
|
|
33
33
|
"peerDependencies": {
|
|
34
|
-
"@driftengine/core": "4.7.
|
|
34
|
+
"@driftengine/core": "4.7.1"
|
|
35
35
|
},
|
|
36
36
|
"author": "Drift Technologies",
|
|
37
37
|
"repository": {
|
package/src/readModel.ts
CHANGED
|
@@ -523,19 +523,7 @@ function base64Bytes(base64: string): Uint8Array {
|
|
|
523
523
|
return out;
|
|
524
524
|
}
|
|
525
525
|
|
|
526
|
-
/**
|
|
527
|
-
* The collision hull a vehicle folder ships beside its model, or null.
|
|
528
|
-
*
|
|
529
|
-
* **A convention, not a statement in any file**, which is why it is one named function instead of
|
|
530
|
-
* a rule spread through the baker: a folder naming its hull differently gets no collider and the
|
|
531
|
-
* baker says what it looked for, rather than leaving a consumer to wonder why physics has nothing
|
|
532
|
-
* to work with.
|
|
533
|
-
*
|
|
534
|
-
* It is read by the ordinary reader and baked as its own asset. Carrying a hull *inside* the
|
|
535
|
-
* model's own file would mean defining `COLL`, which is a declared FourCC with no payload, no
|
|
536
|
-
* reader and no writer — a format decision about whether a hull is triangle soup or a set of
|
|
537
|
-
* convex hulls, and not one an import should make in passing.
|
|
538
|
-
*/
|
|
526
|
+
/** The separate levels of detail a bundle ships beside its model, finest first. */
|
|
539
527
|
export function levelsBeside(model: string, names: readonly string[]): string[] {
|
|
540
528
|
/*
|
|
541
529
|
* `<name>_lod_<letter>.kn5` beside `<name>.kn5`, finest first, which is the order the letters
|
|
@@ -556,6 +544,19 @@ export function levelsBeside(model: string, names: readonly string[]): string[]
|
|
|
556
544
|
.map((entry) => entry.name);
|
|
557
545
|
}
|
|
558
546
|
|
|
547
|
+
/**
|
|
548
|
+
* The collision hull a vehicle folder ships beside its model, or null.
|
|
549
|
+
*
|
|
550
|
+
* **A convention, not a statement in any file**, which is why it is one named function instead of
|
|
551
|
+
* a rule spread through the baker: a folder naming its hull differently gets no collider and the
|
|
552
|
+
* baker says what it looked for, rather than leaving a consumer to wonder why physics has nothing
|
|
553
|
+
* to work with.
|
|
554
|
+
*
|
|
555
|
+
* It is read by the ordinary reader and baked as its own asset. Carrying a hull *inside* the
|
|
556
|
+
* model's own file would mean defining `COLL`, which is a declared FourCC with no payload, no
|
|
557
|
+
* reader and no writer — a format decision about whether a hull is triangle soup or a set of
|
|
558
|
+
* convex hulls, and not one an import should make in passing.
|
|
559
|
+
*/
|
|
559
560
|
export function colliderBeside(names: readonly string[]): string | null {
|
|
560
561
|
return names.find((name) => name.toLowerCase() === 'collider.kn5') ?? null;
|
|
561
562
|
}
|