ldr 0.33.12 → 0.33.14
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/cull.d.ts +24 -1
- package/dist/index.js +437 -179
- package/dist/load-worker.gen.d.ts +1 -1
- package/dist/node/index.js +446 -188
- package/dist/render.d.ts +17 -2
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
// ../../../../../../../tmp/ldr-build-
|
|
3
|
+
// ../../../../../../../tmp/ldr-build-TOtjq4/src/cli.ts
|
|
4
4
|
import fs4 from "node:fs";
|
|
5
5
|
import zlib from "node:zlib";
|
|
6
6
|
|
|
7
|
-
// ../../../../../../../tmp/ldr-build-
|
|
7
|
+
// ../../../../../../../tmp/ldr-build-TOtjq4/src/node/build-pack.ts
|
|
8
8
|
import fs3 from "node:fs";
|
|
9
9
|
import path3 from "node:path";
|
|
10
10
|
|
|
11
|
-
// ../../../../../../../tmp/ldr-build-
|
|
11
|
+
// ../../../../../../../tmp/ldr-build-TOtjq4/src/node/resolver.ts
|
|
12
12
|
import fs from "node:fs";
|
|
13
13
|
import path from "node:path";
|
|
14
14
|
|
|
15
|
-
// ../../../../../../../tmp/ldr-build-
|
|
15
|
+
// ../../../../../../../tmp/ldr-build-TOtjq4/src/spec.ts
|
|
16
16
|
var norm = (s) => s.trim().toLowerCase().replace(/\\/g, "/").replace(/\/+/g, "/");
|
|
17
17
|
var COLOUR_ID_RE = /^[A-Za-z][A-Za-z0-9_]*$/;
|
|
18
18
|
var namedCodes = new Map;
|
|
@@ -817,7 +817,7 @@ function fileStepViews(f) {
|
|
|
817
817
|
return out;
|
|
818
818
|
}
|
|
819
819
|
|
|
820
|
-
// ../../../../../../../tmp/ldr-build-
|
|
820
|
+
// ../../../../../../../tmp/ldr-build-TOtjq4/src/model.ts
|
|
821
821
|
class ModelLimitError extends Error {
|
|
822
822
|
limit;
|
|
823
823
|
code = "ldr-model-limit";
|
|
@@ -1259,7 +1259,7 @@ function blendedColourHex(code) {
|
|
|
1259
1259
|
return "#" + [0, 1, 2].map((k) => (a[k] + b[k] >> 1).toString(16).padStart(2, "0")).join("").toUpperCase();
|
|
1260
1260
|
}
|
|
1261
1261
|
|
|
1262
|
-
// ../../../../../../../tmp/ldr-build-
|
|
1262
|
+
// ../../../../../../../tmp/ldr-build-TOtjq4/src/node/resolver.ts
|
|
1263
1263
|
var TOP_STUD_RE = /^(stud|studa|stud2|stud2a|stud6|stud6a|stud10|stud15|stud2s|stud2s2|stud-logo\d*|stud2-logo\d*)\.dat$/i;
|
|
1264
1264
|
var UNDER_STUD_RE = /^(stud3|stud3a|stud4.*|stud12|stud16.*|stud18a)\.dat$/i;
|
|
1265
1265
|
var norm2 = (ref) => ref.trim().replace(/\\/g, "/").toLowerCase();
|
|
@@ -1586,11 +1586,11 @@ function collectDeps(lib, refs) {
|
|
|
1586
1586
|
return out;
|
|
1587
1587
|
}
|
|
1588
1588
|
|
|
1589
|
-
// ../../../../../../../tmp/ldr-build-
|
|
1589
|
+
// ../../../../../../../tmp/ldr-build-TOtjq4/src/node/compile.ts
|
|
1590
1590
|
import fs2 from "node:fs";
|
|
1591
1591
|
import path2 from "node:path";
|
|
1592
1592
|
|
|
1593
|
-
// ../../../../../../../tmp/ldr-build-
|
|
1593
|
+
// ../../../../../../../tmp/ldr-build-TOtjq4/src/node/lod.ts
|
|
1594
1594
|
import { MeshoptSimplifier, MeshoptEncoder } from "meshoptimizer";
|
|
1595
1595
|
await Promise.all([MeshoptSimplifier.ready, MeshoptEncoder.ready]);
|
|
1596
1596
|
function reorderMesh(P, N, C, I) {
|
|
@@ -1896,7 +1896,7 @@ function levelLines(P, I, E, err, always, tol = 0.01) {
|
|
|
1896
1896
|
return out;
|
|
1897
1897
|
}
|
|
1898
1898
|
|
|
1899
|
-
// ../../../../../../../tmp/ldr-build-
|
|
1899
|
+
// ../../../../../../../tmp/ldr-build-TOtjq4/src/node/compile.ts
|
|
1900
1900
|
class BfcState {
|
|
1901
1901
|
accum;
|
|
1902
1902
|
ccw = true;
|
|
@@ -2840,7 +2840,7 @@ function encodePack(parts, studKinds, weld, extra, options = {}) {
|
|
|
2840
2840
|
return Buffer.concat([head, ...chunks.map((c) => new Uint8Array(c.buffer, c.byteOffset, c.byteLength))]);
|
|
2841
2841
|
}
|
|
2842
2842
|
|
|
2843
|
-
// ../../../../../../../tmp/ldr-build-
|
|
2843
|
+
// ../../../../../../../tmp/ldr-build-TOtjq4/src/node/build-pack.ts
|
|
2844
2844
|
function packCompilerOpts(o) {
|
|
2845
2845
|
return { studs: o.studs ?? "low", prims: o.primitives ?? "full", weld: o.weld ?? true, separateStuds: true, cond: !!o.cond, tex: !!o.textures, ...o.partWorkLimit ? { workLimit: o.partWorkLimit } : {} };
|
|
2846
2846
|
}
|
|
@@ -2913,7 +2913,7 @@ function buildPack(o) {
|
|
|
2913
2913
|
return { data: encodePack(parts, kinds, comp.opts.weld, extra, { texture, lod: o.lod !== false, reorder: !!o.reorder }), parts: parts.size, studKinds: kinds.size, missing: [...missing], ...warnings.length ? { warnings } : {} };
|
|
2914
2914
|
}
|
|
2915
2915
|
|
|
2916
|
-
// ../../../../../../../tmp/ldr-build-
|
|
2916
|
+
// ../../../../../../../tmp/ldr-build-TOtjq4/src/cli.ts
|
|
2917
2917
|
var HELP = `ldr pack — build a parts pack for the ldr three.js renderer
|
|
2918
2918
|
|
|
2919
2919
|
Usage:
|
package/dist/cull.d.ts
CHANGED
|
@@ -13,7 +13,8 @@ export type PrepPart = {
|
|
|
13
13
|
color: string[];
|
|
14
14
|
mask: Uint8Array | null;
|
|
15
15
|
nx: number;
|
|
16
|
-
nz: number;
|
|
16
|
+
nz: number; /** every mask cell enclosed */
|
|
17
|
+
full: boolean;
|
|
17
18
|
};
|
|
18
19
|
export declare function prepPart(H: any, part: string): PrepPart | null;
|
|
19
20
|
/** w = a * b for LDraw 12-number matrices (x y z a b c d e f g h i); same arithmetic as the instance flattener. */
|
|
@@ -41,6 +42,28 @@ export declare class Int3Table {
|
|
|
41
42
|
put(x: number, y: number, z: number, v: number): number;
|
|
42
43
|
private grow;
|
|
43
44
|
}
|
|
45
|
+
/** Set of integer points (x, y, z) for the stud tops of a culling pass without steps (Round 74). Studs sit on a 20-LDU lattice, so the
|
|
46
|
+
* points are grouped by (y, x mod 20, z mod 20) and a group whose lattice box is not too sparse gets a bitmap over that box: a city's
|
|
47
|
+
* 2.2M stud tops take ~4 MB of bits instead of a 140 MB hash table, and inserts / lookups hit nearby bytes (the hash table's random
|
|
48
|
+
* slots made them memory-latency bound, ~130 ms of sf-400k's culling). Points of sparse groups (a fleet's odd placements) go to an
|
|
49
|
+
* `Int3Table`. Built in one go from the points' coordinate arrays. */
|
|
50
|
+
export declare class StudTopSet {
|
|
51
|
+
private grp;
|
|
52
|
+
private gBits;
|
|
53
|
+
private gX0;
|
|
54
|
+
private gZ0;
|
|
55
|
+
private gNz;
|
|
56
|
+
private gNx;
|
|
57
|
+
private bits;
|
|
58
|
+
private rest;
|
|
59
|
+
private lk;
|
|
60
|
+
private lpx;
|
|
61
|
+
private lpz;
|
|
62
|
+
private lg;
|
|
63
|
+
private group;
|
|
64
|
+
constructor(X: Int32Array, Y: Int32Array, Z: Int32Array, n: number);
|
|
65
|
+
has(x: number, y: number, z: number): boolean;
|
|
66
|
+
}
|
|
44
67
|
export declare const inRange: (x: number, y: number, z: number) => boolean;
|
|
45
68
|
/** Culling result in flat arrays. Studs are enumerated in instance order, then each part's `studs` order (the order `forEachStud` visits). */
|
|
46
69
|
export type CullResult = {
|