ldr 0.34.0 → 0.34.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/NOTICE.md +21 -0
- package/README.md +1 -1
- package/dist/cli.js +11 -11
- package/dist/index.js +447 -157
- package/dist/node/index.js +459 -169
- package/dist/usdz.d.ts +26 -1
- package/package.json +10 -5
package/dist/usdz.d.ts
CHANGED
|
@@ -9,16 +9,31 @@ export interface UsdzOptions {
|
|
|
9
9
|
scale?: number;
|
|
10
10
|
/** Colour override: LDraw colour key -> "#rrggbb" (or undefined to use the pack's table). */
|
|
11
11
|
color?: (key: string) => string | undefined;
|
|
12
|
+
/** Drop parts no outside view sees (software z-buffer from 26 directions). Default true. */
|
|
13
|
+
occlusion?: boolean;
|
|
12
14
|
}
|
|
13
15
|
export interface UsdzResult {
|
|
14
16
|
data: Uint8Array;
|
|
15
17
|
triangles: number;
|
|
16
18
|
meshes: number;
|
|
19
|
+
/** Detail used: the largest simplification error allowed (LDU, 0 = full detail) and the stud geometry. */
|
|
17
20
|
level: {
|
|
18
|
-
|
|
21
|
+
maxErr: number;
|
|
19
22
|
studs: 'full' | 'box' | 'none';
|
|
20
23
|
};
|
|
24
|
+
/** Distinct part meshes (instanced USD prototypes). */
|
|
25
|
+
prototypes: number;
|
|
26
|
+
/** Parts dropped because no direction sees them (inside the model). */
|
|
27
|
+
hiddenParts: number;
|
|
21
28
|
}
|
|
29
|
+
type Geo = {
|
|
30
|
+
pos: Float32Array;
|
|
31
|
+
nrm: Float32Array | null;
|
|
32
|
+
col: ArrayLike<number> | null;
|
|
33
|
+
idx: ArrayLike<number> | null;
|
|
34
|
+
u8: boolean;
|
|
35
|
+
tris: number;
|
|
36
|
+
};
|
|
22
37
|
/** Export placed parts as a USDZ (AR Quick Look) model. `instances` / `pack` as for `createLdrObject` (e.g. `loadModel`'s result). */
|
|
23
38
|
export declare function toUSDZ(instances: PartInstance[], pack: Pack, options?: UsdzOptions): UsdzResult;
|
|
24
39
|
export declare function crc32(d: Uint8Array): number;
|
|
@@ -27,3 +42,13 @@ export declare function zipStored(files: {
|
|
|
27
42
|
name: string;
|
|
28
43
|
data: Uint8Array;
|
|
29
44
|
}[]): Uint8Array;
|
|
45
|
+
/** Which instances no outside view sees: an orthographic ID z-buffer (`RES`^2) from the 6 axis and 8 corner directions, every opaque
|
|
46
|
+
* item drawn with its instance id, an instance kept when one of its pixels wins in some view. See-through instances are always kept
|
|
47
|
+
* and never occlude. Returns 1 per hidden instance. */
|
|
48
|
+
export declare function hiddenInstances<T extends {
|
|
49
|
+
k: number;
|
|
50
|
+
m: ArrayLike<number>;
|
|
51
|
+
color: string;
|
|
52
|
+
b: any;
|
|
53
|
+
}>(n: number, items: T[], geo: (it: T) => Geo | null, clear: (c: string) => boolean, RES?: number): Uint8Array;
|
|
54
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ldr",
|
|
3
|
-
"version": "0.34.
|
|
3
|
+
"version": "0.34.2",
|
|
4
4
|
"description": "High-performance LEGO (LDraw) rendering for three.js: instanced parts packs, hidden stud/tube culling, low-detail studs, indexed edges, build steps.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Evan Bacon",
|
|
@@ -11,8 +11,10 @@
|
|
|
11
11
|
"url": "git+https://github.com/EvanBacon/ldr.git",
|
|
12
12
|
"directory": "packages/ldr"
|
|
13
13
|
},
|
|
14
|
-
"homepage": "https://
|
|
15
|
-
"bugs":
|
|
14
|
+
"homepage": "https://lego.bacon.md",
|
|
15
|
+
"bugs": {
|
|
16
|
+
"url": "https://github.com/EvanBacon/ldr/issues"
|
|
17
|
+
},
|
|
16
18
|
"keywords": [
|
|
17
19
|
"lego",
|
|
18
20
|
"ldraw",
|
|
@@ -24,7 +26,9 @@
|
|
|
24
26
|
"mpd",
|
|
25
27
|
"ldr",
|
|
26
28
|
"bricks",
|
|
27
|
-
"3d"
|
|
29
|
+
"3d",
|
|
30
|
+
"usdz",
|
|
31
|
+
"mcp"
|
|
28
32
|
],
|
|
29
33
|
"main": "./dist/index.js",
|
|
30
34
|
"module": "./dist/index.js",
|
|
@@ -46,7 +50,8 @@
|
|
|
46
50
|
"files": [
|
|
47
51
|
"dist",
|
|
48
52
|
"README.md",
|
|
49
|
-
"LICENSE"
|
|
53
|
+
"LICENSE",
|
|
54
|
+
"NOTICE.md"
|
|
50
55
|
],
|
|
51
56
|
"scripts": {
|
|
52
57
|
"build": "rm -rf dist && bun scripts/gen-worker.ts && bun scripts/build.ts && tsc -p tsconfig.build.json && bun scripts/postbuild.ts && node scripts/check-dist.mjs",
|