ldr 0.33.2 → 0.33.3
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 +283 -76
- package/dist/index.d.ts +2 -2
- package/dist/index.js +205 -65
- package/dist/load-worker.gen.d.ts +1 -1
- package/dist/model.d.ts +12 -1
- package/dist/node/build-pack.d.ts +4 -1
- package/dist/node/compile.d.ts +5 -0
- package/dist/node/index.js +404 -119
- package/dist/node/library.d.ts +9 -1
- package/dist/spec.d.ts +3 -0
- package/package.json +2 -1
package/dist/node/library.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { type FlattenOptions, type LDrawColor } from "../model.js";
|
|
2
2
|
import { type Doc, type PartMesh, type Instance } from "../spec.js";
|
|
3
|
+
/** Most subfile placements + triangles one `mesh` may expand to (a few lines can nest subfiles that each place the next twice). */
|
|
4
|
+
export declare const MESH_WORK_LIMIT = 1000000;
|
|
3
5
|
export declare class Library {
|
|
4
6
|
root: string;
|
|
5
7
|
unofficialRoot?: string | undefined;
|
|
@@ -43,7 +45,13 @@ export declare class Library {
|
|
|
43
45
|
/** Texture PNG bytes for a !TEXMAP name: an MPD `!DATA` block in `doc` first, then the LDraw search path with a
|
|
44
46
|
* `textures/` prefix (parts/, p/, models/, official then unofficial), then without it. Case-insensitive. */
|
|
45
47
|
texture(name: string, doc?: Doc): Uint8Array | null;
|
|
46
|
-
/**
|
|
48
|
+
/** Files being expanded by `emit` (a reference back to one is a cycle, which LDraw doesn't allow: ignored) and `emit`'s work so far. */
|
|
49
|
+
private open;
|
|
50
|
+
private work;
|
|
51
|
+
/** subfile walks + triangles one `mesh` may take before it throws `ModelLimitError` */
|
|
52
|
+
workLimit: number;
|
|
53
|
+
/** Every point of file `fname` of `doc` (type 2-5 lines, through its subfiles) has y = 0 (see `singularFix`). Past a work budget
|
|
54
|
+
* (subfiles nested exponentially) the answer is no, so the placement is drawn without culling. */
|
|
47
55
|
private flatY;
|
|
48
56
|
private emit;
|
|
49
57
|
/** Flatten a model into part instances (see `flatten` in the browser entry for the rules; `models/` library files are walked
|
package/dist/spec.d.ts
CHANGED
|
@@ -101,6 +101,9 @@ export declare function namedColorCode(id: string): number;
|
|
|
101
101
|
export declare const isNamedColor: (c: number) => boolean;
|
|
102
102
|
/** Parse LDraw color token: decimal code, direct color 0x2RRGGBB (and related 0xN…… forms), or a `!COLOUR` identifier (see `namedColorCode`). */
|
|
103
103
|
export declare function parseColor(tok: string): number;
|
|
104
|
+
/** Largest coordinate / matrix entry the library places or draws: an LDraw line or a placement beyond it is out of range and ignored
|
|
105
|
+
* (1e15 LDU is 400 million km; products of two such values stay finite in float32, so bounding boxes and GPU data stay finite). */
|
|
106
|
+
export declare const MAX_COORD = 1000000000000000;
|
|
104
107
|
/** Parse the tail of `0 !TEXMAP START|NEXT <method> <params> <png> [GLOSSMAP <png>]`. Returns null when malformed. */
|
|
105
108
|
export declare function parseTexMap(tail: string, next?: boolean): TexMap | null;
|
|
106
109
|
/** `geometryText`: keep type 2-5 lines as their source text (`src`) with empty `p` instead of parsing their numbers (for tools that
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ldr",
|
|
3
|
-
"version": "0.33.
|
|
3
|
+
"version": "0.33.3",
|
|
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",
|
|
@@ -50,6 +50,7 @@
|
|
|
50
50
|
],
|
|
51
51
|
"scripts": {
|
|
52
52
|
"build": "rm -rf dist && bun scripts/gen-worker.ts && bun scripts/build.ts && tsc -p tsconfig.build.json && bun scripts/postbuild.ts && node scripts/check-dist.mjs",
|
|
53
|
+
"fuzz": "bun fuzz/fuzz.ts",
|
|
53
54
|
"test": "bun test",
|
|
54
55
|
"prepublishOnly": "bun run build && bun test"
|
|
55
56
|
},
|