ldr 0.2.0 → 0.3.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 +5 -3
- package/dist/cli.js +784 -188
- package/dist/index.d.ts +3 -3
- package/dist/index.js +554 -32
- package/dist/node/build-pack.d.ts +6 -0
- package/dist/node/compile.d.ts +29 -2
- package/dist/node/index.js +969 -71
- package/dist/node/library.d.ts +9 -2
- package/dist/node/resolver.d.ts +1 -0
- package/dist/render.d.ts +26 -0
- package/dist/scene.d.ts +18 -0
- package/dist/spec.d.ts +83 -7
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -52,7 +52,7 @@ Packs contain only the parts you ask for, so they're small: a 10k-brick Datsvill
|
|
|
52
52
|
|
|
53
53
|
```bash
|
|
54
54
|
ldr pack --ldraw <dir> -o <out.bin|.zst|.gz> [model.ldr ...] [--part 3001.dat ...] [--all-parts]
|
|
55
|
-
[--studs low|full] [--prims full|low] [--no-weld] [--no-colors]
|
|
55
|
+
[--studs low|full] [--prims full|low] [--no-weld] [--no-colors] [--cond] [--textures]
|
|
56
56
|
```
|
|
57
57
|
|
|
58
58
|
Or from code (Node/Bun):
|
|
@@ -80,9 +80,11 @@ The pack embeds the LDConfig colour table by default, so no extra colour file is
|
|
|
80
80
|
| `decompressPack(bytes)` / `decodePack(buffer)` | Same, from bytes you already have (zstd/gzip auto-detected). |
|
|
81
81
|
| `createLdrObject(instances, pack, options?) → LdrObject` | High-level three.js object. |
|
|
82
82
|
| `createInstancedEdges(pos, instancedMesh, material?)` | Welded, indexed edge lines sharing an InstancedMesh's matrices (for custom batching). |
|
|
83
|
+
| `conditionalLines(pack, entry, which?)` / `createInstancedConditionalEdges(cond, instancedMesh, material?)` | Type-5 conditional lines from a `--cond` pack (stride 12: p0, p1, c0, c1), drawn by a vertex shader only where the control points fall on the same side of the projected line. |
|
|
84
|
+
| `makeTexturedMaterial(side, texture, wrapU?)` / `packTexture(pack, i)` / `texmapUV` / `texmapTriangleUV` | Printed / sticker parts from a `--textures` pack: a `!TEXMAP` UV material (image alpha blends over the part colour, untextured outside [0,1]) and the decoded embedded PNG. UV conventions follow LDView (v = 0 is the image's top row). |
|
|
83
85
|
| `buildLdrScene`, `computeCulling`, `makeMaterial` | Low-level renderer used by the benchmarks. |
|
|
84
86
|
|
|
85
|
-
`LdrObjectOptions`: `edges` (default `true`), `cullStuds` (`true`), `cullUndersides` (`true`), `side` (`"front"` \| `"double"`, default `"front"`), `material` (`"plastic"` \| `"standard"`), `colors` (Map / record / function override), `fallbackColor`, `ldrawSpace` (keep -Y up), `scale`, `step
|
|
87
|
+
`LdrObjectOptions`: `edges` (default `true`), `cullStuds` (`true`), `cullUndersides` (`true`), `side` (`"front"` \| `"double"`, default `"front"`), `material` (`"plastic"` \| `"standard"`), `colors` (Map / record / function override), `fallbackColor`, `ldrawSpace` (keep -Y up), `scale`, `step`, `conditionalLines` (default `true`; only has an effect with packs built with `--cond`), `conditionalStudLines` (default `true`; `false` skips stud silhouettes, ~half the conditional-line GPU cost but most of their visible effect on stud-heavy scenes), `textures` (default `true`; only has an effect with packs built with `--textures`; `object.texturesReady` resolves when images are decoded).
|
|
86
88
|
|
|
87
89
|
`LdrObject`: `object`, `stats` (`instances`, `drawn`, `missing[]`, `studsHidden/Total`, `undersHidden/Total`, `buildMs`), `stepCount`, `setStep(n | null)`, `setEdges(on)`, `setCulling(studs, undersides)`, `setSide(side)`, `getBox()`, `dispose()`.
|
|
88
90
|
|
|
@@ -110,7 +112,7 @@ Visual-diff studies show culling and single-sided faces are lossless (≤0.009%
|
|
|
110
112
|
|
|
111
113
|
## Notes & limitations
|
|
112
114
|
|
|
113
|
-
- Transparent colours render opaque
|
|
115
|
+
- Transparent colours render opaque. Conditional (type-5) lines are drawn only from packs built with `--cond` (pack v2, opt-in: +8–14% zstd size on Datsville); default packs carry type-2 edges only. Printed parts show their `!TEXMAP` images only from packs built with `--textures` (pack v2, opt-in; the PNGs dominate the size); default packs draw the parts' FALLBACK geometry. Model-level `!TEXMAP` around a part reference (rather than inside the part file) and textured parts embedded in an MPD are not rendered yet.
|
|
114
116
|
- `setStep` rebuilds batches (fast for instruction-sized models; culling is recomputed for the partial build).
|
|
115
117
|
- Coordinates: LDraw units (1 stud = 20 LDU); the object is rotated to +Y up unless `ldrawSpace: true`.
|
|
116
118
|
|