ldr 0.34.0 → 0.34.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/usdz.d.ts CHANGED
@@ -9,16 +9,29 @@ 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
- body: number;
21
+ maxErr: number;
19
22
  studs: 'full' | 'box' | 'none';
20
23
  };
24
+ /** Parts dropped because no direction sees them (inside the model). */
25
+ hiddenParts: number;
21
26
  }
27
+ type Geo = {
28
+ pos: Float32Array;
29
+ nrm: Float32Array | null;
30
+ col: ArrayLike<number> | null;
31
+ idx: ArrayLike<number> | null;
32
+ u8: boolean;
33
+ tris: number;
34
+ };
22
35
  /** Export placed parts as a USDZ (AR Quick Look) model. `instances` / `pack` as for `createLdrObject` (e.g. `loadModel`'s result). */
23
36
  export declare function toUSDZ(instances: PartInstance[], pack: Pack, options?: UsdzOptions): UsdzResult;
24
37
  export declare function crc32(d: Uint8Array): number;
@@ -27,3 +40,13 @@ export declare function zipStored(files: {
27
40
  name: string;
28
41
  data: Uint8Array;
29
42
  }[]): Uint8Array;
43
+ /** Which instances no outside view sees: an orthographic ID z-buffer (`RES`^2) from the 6 axis and 8 corner directions, every opaque
44
+ * item drawn with its instance id, an instance kept when one of its pixels wins in some view. See-through instances are always kept
45
+ * and never occlude. Returns 1 per hidden instance. */
46
+ export declare function hiddenInstances<T extends {
47
+ k: number;
48
+ m: ArrayLike<number>;
49
+ color: string;
50
+ b: any;
51
+ }>(n: number, items: T[], geo: (it: T) => Geo | null, clear: (c: string) => boolean, RES?: number): Uint8Array;
52
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ldr",
3
- "version": "0.34.0",
3
+ "version": "0.34.1",
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://github.com/EvanBacon/ldr#readme",
15
- "bugs": "https://github.com/EvanBacon/ldr/issues",
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",