ldr 0.17.0 → 0.19.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 +2 -0
- package/dist/cdn.d.ts +1 -1
- package/dist/cli.js +11 -11
- package/dist/index.d.ts +1 -1
- package/dist/index.js +60 -16
- package/dist/load-worker.gen.d.ts +1 -1
- package/dist/node/index.d.ts +2 -0
- package/dist/node/index.js +310 -23
- package/dist/node/promote.d.ts +25 -0
- package/dist/parts-cdn.d.ts +20 -0
- package/package.json +1 -1
package/dist/node/promote.d.ts
CHANGED
|
@@ -9,3 +9,28 @@ export declare function promoteFlexParts(text: string): {
|
|
|
9
9
|
text: string;
|
|
10
10
|
promoted: string[];
|
|
11
11
|
};
|
|
12
|
+
export type DecimateFlexOptions = {
|
|
13
|
+
/** Merge every pair of adjacent ring quads (default true → 16-gon becomes 8-gon). */
|
|
14
|
+
halveRings?: boolean;
|
|
15
|
+
/** Minimum quads in a closed ring (default 8). */
|
|
16
|
+
minRing?: number;
|
|
17
|
+
/** Drop type-5 conditional lines in decimated parts (default true). */
|
|
18
|
+
dropCond?: boolean;
|
|
19
|
+
/** Drop type-4 quads not in a detected tube ring (rib fillet detail; default true). */
|
|
20
|
+
dropNonRing?: boolean;
|
|
21
|
+
};
|
|
22
|
+
/** Decimate tube rings in promoted flex `Unofficial_Part` files: 16→8 sides and drop non-ring rib detail. */
|
|
23
|
+
export declare function decimateFlexGeometry(text: string, opts?: DecimateFlexOptions): {
|
|
24
|
+
text: string;
|
|
25
|
+
decimated: string[];
|
|
26
|
+
quadsIn: number;
|
|
27
|
+
quadsOut: number;
|
|
28
|
+
};
|
|
29
|
+
/** Promote LDCad flex files to embedded parts, then decimate tube rings (Round 35 + 37). */
|
|
30
|
+
export declare function prepareFlexParts(text: string, decimate?: DecimateFlexOptions | false): {
|
|
31
|
+
text: string;
|
|
32
|
+
promoted: string[];
|
|
33
|
+
decimated: string[];
|
|
34
|
+
quadsIn: number;
|
|
35
|
+
quadsOut: number;
|
|
36
|
+
};
|
package/dist/parts-cdn.d.ts
CHANGED
|
@@ -47,6 +47,10 @@ export interface PrepareOptions extends LoadPartsOptions {
|
|
|
47
47
|
name?: string;
|
|
48
48
|
/** Instruction-booklet step order for repeated submodels (see `FlattenOptions.callouts`). Default false. */
|
|
49
49
|
callouts?: boolean;
|
|
50
|
+
/** Abort after parts are merged when full-detail body triangles exceed this (phones: avoid OOM). See `BudgetError`. */
|
|
51
|
+
maxBodyTris?: number;
|
|
52
|
+
/** Abort when the merged parts pack byte length exceeds this. See `BudgetError`. */
|
|
53
|
+
maxPackBytes?: number;
|
|
50
54
|
}
|
|
51
55
|
export interface PreparedModel {
|
|
52
56
|
insts: PartInstance[];
|
|
@@ -62,5 +66,21 @@ export interface PreparedModel {
|
|
|
62
66
|
};
|
|
63
67
|
cull?: CullResult;
|
|
64
68
|
}
|
|
69
|
+
/** Full-detail body triangles across all instances that have a pack entry (sum of `part.body.tris`). */
|
|
70
|
+
export declare function bodyTriangles(insts: PartInstance[], pack: Pack): number;
|
|
71
|
+
/** Thrown by `prepareModel` / `loadModel` when `maxBodyTris` or `maxPackBytes` is set and the prepared model exceeds it. */
|
|
72
|
+
export declare class BudgetError extends Error {
|
|
73
|
+
readonly code: "ldr-budget";
|
|
74
|
+
readonly bodyTris: number;
|
|
75
|
+
readonly packBytes: number;
|
|
76
|
+
readonly maxBodyTris?: number;
|
|
77
|
+
readonly maxPackBytes?: number;
|
|
78
|
+
constructor(m: {
|
|
79
|
+
bodyTris: number;
|
|
80
|
+
packBytes: number;
|
|
81
|
+
maxBodyTris?: number;
|
|
82
|
+
maxPackBytes?: number;
|
|
83
|
+
});
|
|
84
|
+
}
|
|
65
85
|
/** Everything in `loadModel` before three.js: fetch + parse the model, fetch + inflate + merge its parts. No DOM/three (runs in a Worker). */
|
|
66
86
|
export declare function prepareModel(source: string, o?: PrepareOptions): Promise<PreparedModel>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ldr",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.19.0",
|
|
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",
|