ldr 0.14.0 → 0.15.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/dist/cli.js +11 -11
- package/dist/index.d.ts +3 -3
- package/dist/index.js +192 -93
- package/dist/node/index.js +199 -100
- package/dist/render.d.ts +13 -21
- package/dist/scene.d.ts +18 -0
- package/package.json +1 -1
package/dist/scene.d.ts
CHANGED
|
@@ -51,6 +51,10 @@ export interface LdrObjectOptions {
|
|
|
51
51
|
/** LOD: skip undersides that can't be seen: while the camera is behind every bottom face of a cluster's (same-orientation) parts and
|
|
52
52
|
* studs are under 4 px, or where the body is drawn as its closed bounding box. Default true. */
|
|
53
53
|
lodUnder?: boolean;
|
|
54
|
+
/** Progressive build (createLdrObjectAsync / loadModel): soft cap on contiguous main-thread work between yields, ms. Default 8. */
|
|
55
|
+
sliceMs?: number;
|
|
56
|
+
/** Progressive build: called after each yield; the live object already holds finished batches — render for TTFP. */
|
|
57
|
+
onSlice?: () => void | Promise<void>;
|
|
54
58
|
}
|
|
55
59
|
export interface LdrStats {
|
|
56
60
|
instances: number;
|
|
@@ -61,6 +65,10 @@ export interface LdrStats {
|
|
|
61
65
|
undersTotal: number;
|
|
62
66
|
undersHidden: number;
|
|
63
67
|
buildMs: number;
|
|
68
|
+
/** Progressive build: longest contiguous main-thread slice (ms). */
|
|
69
|
+
longestSliceMs?: number;
|
|
70
|
+
/** Progressive build: number of yields during scene construction. */
|
|
71
|
+
buildYields?: number;
|
|
64
72
|
/** Conditional-line batches (draw calls) created; 0 for packs without conditional lines. */
|
|
65
73
|
condBatches?: number;
|
|
66
74
|
/** Textured batches (one per part x texture) and distinct textures; 0 for packs without textures. */
|
|
@@ -97,8 +105,18 @@ export interface LdrObject {
|
|
|
97
105
|
getBox(target?: THREE.Box3): THREE.Box3;
|
|
98
106
|
dispose(): void;
|
|
99
107
|
}
|
|
108
|
+
/**
|
|
109
|
+
* Build a three.js object for a flattened model using a parts pack.
|
|
110
|
+
* Instances whose part is not in the pack are skipped and listed in `stats.missing`.
|
|
111
|
+
*/
|
|
100
112
|
/**
|
|
101
113
|
* Build a three.js object for a flattened model using a parts pack.
|
|
102
114
|
* Instances whose part is not in the pack are skipped and listed in `stats.missing`.
|
|
103
115
|
*/
|
|
104
116
|
export declare function createLdrObject(instances: PartInstance[], pack: Pack, options?: LdrObjectOptions): LdrObject;
|
|
117
|
+
/**
|
|
118
|
+
* Progressive/async variant of `createLdrObject`: yields about every `sliceMs` (default 8) so the main thread stays responsive.
|
|
119
|
+
* Meshes land on `object` as batches finish; pass `onSlice` to render for a fast time-to-first-pixel.
|
|
120
|
+
* Final visuals and stats match the sync path (same generator).
|
|
121
|
+
*/
|
|
122
|
+
export declare function createLdrObjectAsync(instances: PartInstance[], pack: Pack, options?: LdrObjectOptions): Promise<LdrObject>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ldr",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.15.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",
|