ldr 0.34.13 → 0.34.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 +4 -2
- package/dist/index.js +102 -63
- package/dist/load-worker.gen.d.ts +1 -1
- package/dist/node/index.js +110 -71
- 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-zkQ2hC/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-zkQ2hC/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-zkQ2hC/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-zkQ2hC/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;
|
|
@@ -848,7 +848,7 @@ function fileStepViews(f) {
|
|
|
848
848
|
return out;
|
|
849
849
|
}
|
|
850
850
|
|
|
851
|
-
// ../../../../../../../tmp/ldr-build-
|
|
851
|
+
// ../../../../../../../tmp/ldr-build-zkQ2hC/src/model.ts
|
|
852
852
|
class ModelLimitError extends Error {
|
|
853
853
|
limit;
|
|
854
854
|
code = "ldr-model-limit";
|
|
@@ -1299,7 +1299,7 @@ function blendedColourHex(code) {
|
|
|
1299
1299
|
return "#" + [0, 1, 2].map((k) => (a[k] + b[k] >> 1).toString(16).padStart(2, "0")).join("").toUpperCase();
|
|
1300
1300
|
}
|
|
1301
1301
|
|
|
1302
|
-
// ../../../../../../../tmp/ldr-build-
|
|
1302
|
+
// ../../../../../../../tmp/ldr-build-zkQ2hC/src/node/resolver.ts
|
|
1303
1303
|
var TOP_STUD_RE = /^(stud|studa|stud2|stud2a|stud6|stud6a|stud10|stud15|stud2s|stud2s2|stud-logo\d*|stud2-logo\d*)\.dat$/i;
|
|
1304
1304
|
var UNDER_STUD_RE = /^(stud3|stud3a|stud4.*|stud12|stud16.*|stud18a)\.dat$/i;
|
|
1305
1305
|
var norm2 = (ref) => ref.trim().replace(/\\/g, "/").toLowerCase();
|
|
@@ -1626,11 +1626,11 @@ function collectDeps(lib, refs) {
|
|
|
1626
1626
|
return out;
|
|
1627
1627
|
}
|
|
1628
1628
|
|
|
1629
|
-
// ../../../../../../../tmp/ldr-build-
|
|
1629
|
+
// ../../../../../../../tmp/ldr-build-zkQ2hC/src/node/compile.ts
|
|
1630
1630
|
import fs2 from "node:fs";
|
|
1631
1631
|
import path2 from "node:path";
|
|
1632
1632
|
|
|
1633
|
-
// ../../../../../../../tmp/ldr-build-
|
|
1633
|
+
// ../../../../../../../tmp/ldr-build-zkQ2hC/src/node/lod.ts
|
|
1634
1634
|
import { MeshoptSimplifier, MeshoptEncoder } from "meshoptimizer";
|
|
1635
1635
|
await Promise.all([MeshoptSimplifier.ready, MeshoptEncoder.ready]);
|
|
1636
1636
|
function reorderMesh(P, N, C, I) {
|
|
@@ -1936,7 +1936,7 @@ function levelLines(P, I, E, err, always, tol = 0.01) {
|
|
|
1936
1936
|
return out;
|
|
1937
1937
|
}
|
|
1938
1938
|
|
|
1939
|
-
// ../../../../../../../tmp/ldr-build-
|
|
1939
|
+
// ../../../../../../../tmp/ldr-build-zkQ2hC/src/node/compile.ts
|
|
1940
1940
|
class BfcState {
|
|
1941
1941
|
accum;
|
|
1942
1942
|
ccw = true;
|
|
@@ -2897,7 +2897,7 @@ function encodePack(parts, studKinds, weld, extra, options = {}) {
|
|
|
2897
2897
|
return Buffer.concat([head, ...chunks.map((c) => new Uint8Array(c.buffer, c.byteOffset, c.byteLength))]);
|
|
2898
2898
|
}
|
|
2899
2899
|
|
|
2900
|
-
// ../../../../../../../tmp/ldr-build-
|
|
2900
|
+
// ../../../../../../../tmp/ldr-build-zkQ2hC/src/node/build-pack.ts
|
|
2901
2901
|
function packCompilerOpts(o) {
|
|
2902
2902
|
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 } : {} };
|
|
2903
2903
|
}
|
|
@@ -2970,7 +2970,7 @@ function buildPack(o) {
|
|
|
2970
2970
|
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 } : {} };
|
|
2971
2971
|
}
|
|
2972
2972
|
|
|
2973
|
-
// ../../../../../../../tmp/ldr-build-
|
|
2973
|
+
// ../../../../../../../tmp/ldr-build-zkQ2hC/src/cli.ts
|
|
2974
2974
|
var HELP = `ldr pack — build a parts pack for the ldr three.js renderer
|
|
2975
2975
|
|
|
2976
2976
|
Usage:
|
package/dist/cull.d.ts
CHANGED
|
@@ -14,7 +14,8 @@ export type PrepPart = {
|
|
|
14
14
|
mask: Uint8Array | null;
|
|
15
15
|
nx: number;
|
|
16
16
|
nz: number; /** every mask cell enclosed */
|
|
17
|
-
full: boolean;
|
|
17
|
+
full: boolean; /** the pack header's part entry (`H.parts[part]`) */
|
|
18
|
+
src: any;
|
|
18
19
|
};
|
|
19
20
|
export declare function prepPart(H: any, part: string): PrepPart | null;
|
|
20
21
|
/** 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. */
|
|
@@ -82,7 +83,8 @@ export declare const STEP_NEVER = 2147483647;
|
|
|
82
83
|
export declare function forEachStud(insts: Inst[], H: any, fn: (j: number, inst: number, w: Float64Array, kind: string, color: string, stud: number) => void): void;
|
|
83
84
|
/** `steps` (optional, per instance): also compute when each stud / underside becomes hidden as the model is built step by step.
|
|
84
85
|
* Transparent instances hide nothing (studs inside their hollow stay visible through them) and keep their own undersides. */
|
|
85
|
-
|
|
86
|
+
/** `pps`: each instance's `prepPart` when the caller already has them (the scene builder looks them up once for all its passes). */
|
|
87
|
+
export declare function cullCore(insts: Inst[], H: any, steps?: ArrayLike<number>, pps?: (PrepPart | null)[]): CullResult;
|
|
86
88
|
/** Scene instances and per-instance step ranks as `createLdrObject` builds them (shared with the load worker). */
|
|
87
89
|
export declare function sceneInstances(instances: PartInstance[], H: any, useTex: boolean): {
|
|
88
90
|
all: {
|