529e74c1a6
Add the real LDraw LEGO parts (LeoCAD-style) as the posable objects.
- Vendor the curated 15-part LDraw closure under public/ldraw so it is
served at /blocs-pro/ldraw/ after build (CC BY 4.0, credits kept).
- src/utils/ldraw.js loads each part via three's LDrawLoader, caches the
geometry per type, applies the LDU->world scale and Y flip to match the
existing grid, and tints surfaces with the active colour.
- A LeoCAD-style PartsBar (colour row + category tabs + part grid) picks
the active part; Create mode places it at the grid cell and stores a
JSON-only brick { uID, type, color, position/dimensions, rotation } so
the piece syncs to peers like any other brick.
- Brick.jsx renders the cached LDraw clone for typed bricks and keeps the
parametric box as a fallback. Edit-mode tooling (select / move / colour
/ delete) walks up to the brick group so it works on multi-mesh pieces;
selection is shown with an emissive tint instead of the stud wireframe.
47 lines
2.6 KiB
Markdown
47 lines
2.6 KiB
Markdown
# LDraw parts — credits & license
|
||
|
||
The `.dat` files under `parts/` (and the primitives they reference) come from
|
||
the **LDraw Parts Library** (the official, community-maintained library of LEGO
|
||
part definitions).
|
||
|
||
- **Source (upstream):** https://library.ldraw.org/ (`complete.zip` update package)
|
||
- **Provenance (pinned mirror):** the full library is mirrored, audited and frozen
|
||
in our Gitea at **`electron-rare/ldraw-library-mirror`**
|
||
(`https://git.saillant.cc/electron-rare/ldraw-library-mirror`). The subset below
|
||
is the dependency closure of curated parts extracted from that mirror.
|
||
- **License:** **CC BY 4.0** (Creative Commons Attribution 4.0 International).
|
||
Each `.dat` carries its own `0 !LICENSE Licensed under CC BY 4.0` header.
|
||
- **Attribution:** original part authors are credited in each file's
|
||
`0 Author:` / `0 !HISTORY` headers. The library founder is James Jessiman.
|
||
|
||
Only a **curated, kid-friendly subset** is vendored here, not the full library:
|
||
|
||
| Part | Description | Part | Description |
|
||
|--------|------------------------|--------|------------------------|
|
||
| 3001 | Brick 2×4 | 3024 | Plate 1×1 |
|
||
| 3003 | Brick 2×2 | 3068b | Tile 2×2 (groove) |
|
||
| 3004 | Brick 1×2 | 3069b | Tile 1×2 (groove) |
|
||
| 3005 | Brick 1×1 | 3040b | Slope 45° 2×1 |
|
||
| 3010 | Brick 1×4 | 3039 | Slope 45° 2×2 |
|
||
| 3020 | Plate 2×4 | 3062b | Round Brick 1×1 |
|
||
| 3022 | Plate 2×2 | 3941 | Round Brick 2×2 |
|
||
| 3023b | Plate 1×2 | | |
|
||
|
||
`manifest.json` lists the full **dependency closure** (each part + every
|
||
sub-file / primitive it references, recursively) flattened under `parts/` so the
|
||
web `LDrawLoader` resolves every reference on its first probe (no 404 noise).
|
||
`fileMap` forces `s/` sub-parts to stay relative to `parts/`.
|
||
|
||
## How to regenerate / extend the set
|
||
|
||
The closure is built from a local copy of the LDraw library
|
||
(`library.ldraw.org/library/updates/complete.zip`) with a small Python script
|
||
that walks line-type-1 references recursively and copies the closure here,
|
||
emitting `manifest.json`. To add a part, add its `.dat` id to the seed list and
|
||
re-run the builder, then extend `LDRAW_PARTS` / `PART_ORDER` in
|
||
`js/games/ldraw-parts.js` and the `ld:*` entries in `js/games/blocs.logic.js`.
|
||
|
||
> **LEGO®** is a trademark of the LEGO Group, which does not sponsor, authorize
|
||
> or endorse this project. LDraw part *definitions* are an independent,
|
||
> community work licensed CC BY 4.0.
|