ldr 0.33.0 → 0.33.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/README.md +1 -1
- package/dist/cli.js +178 -60
- package/dist/cull.d.ts +2 -0
- package/dist/index.js +17 -16
- package/dist/load-worker.gen.d.ts +1 -1
- package/dist/node/compile.d.ts +24 -0
- package/dist/node/index.js +247 -94
- package/dist/node/library.d.ts +2 -0
- package/dist/spec.d.ts +13 -0
- package/package.json +1 -1
package/dist/node/library.d.ts
CHANGED
|
@@ -43,6 +43,8 @@ export declare class Library {
|
|
|
43
43
|
/** Texture PNG bytes for a !TEXMAP name: an MPD `!DATA` block in `doc` first, then the LDraw search path with a
|
|
44
44
|
* `textures/` prefix (parts/, p/, models/, official then unofficial), then without it. Case-insensitive. */
|
|
45
45
|
texture(name: string, doc?: Doc): Uint8Array | null;
|
|
46
|
+
/** Every point of file `fname` of `doc` (type 2-5 lines, through its subfiles) has y = 0 (see `singularFix`). */
|
|
47
|
+
private flatY;
|
|
46
48
|
private emit;
|
|
47
49
|
/** Flatten a model into part instances (see `flatten` in the browser entry for the rules; `models/` library files are walked
|
|
48
50
|
* as submodels). 24 handled at render (edge color). Alias parts resolve to canonical names. MPD files and synthetic parts
|
package/dist/spec.d.ts
CHANGED
|
@@ -223,6 +223,19 @@ export declare function looseSource(f: LFile, step: number): string;
|
|
|
223
223
|
export declare function hash32(s: string): string;
|
|
224
224
|
/** Inverse of an affine LDraw matrix, or null when singular. */
|
|
225
225
|
export declare function invert(m: M): M | null;
|
|
226
|
+
/**
|
|
227
|
+
* BFC "Degenerate Matrices" (ldraw.org article 415): a subfile placed with a singular (determinant 0) matrix can't be culled.
|
|
228
|
+
* Returns null for a regular matrix. For a singular one: when the subfile lies in its own XZ plane (`flatY`: every point has y = 0),
|
|
229
|
+
* the Y column doesn't move any point, so the matrix is repaired the way LDView / L3P / LDGLite do (L3Input heritage, LDView
|
|
230
|
+
* `LDLModelLine::tryToFixPlanarMatrix`): an all-zero row gets 1 in its Y column (one row at a time), else an all-zero Y column gets 1s
|
|
231
|
+
* one row at a time; the repaired matrix (same points, determinant != 0) decides the winding and culling stays on. Otherwise culling
|
|
232
|
+
* is off for the subfile (`cull: false`). "Singular" = |det| at most 1e-9 of the product of the row lengths (the library's own
|
|
233
|
+
* near-singular references, e.g. 55297's discs at ~1e-6, keep their determinant's sign as before).
|
|
234
|
+
*/
|
|
235
|
+
export declare function singularFix(m: M, flatY: () => boolean): {
|
|
236
|
+
m: M;
|
|
237
|
+
cull: boolean;
|
|
238
|
+
} | null;
|
|
226
239
|
/**
|
|
227
240
|
* Synthetic part for a part reference wrapped by a model-level `!TEXMAP` (the map is defined in the model, not in the part file).
|
|
228
241
|
* `map` must already be in the part's own coordinates. The wrapper is a certified file that applies the map to the part, so
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ldr",
|
|
3
|
-
"version": "0.33.
|
|
3
|
+
"version": "0.33.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",
|