ldr 0.13.0 → 0.15.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/dist/cli.js +11 -11
- package/dist/index.d.ts +3 -3
- package/dist/index.js +213 -131
- package/dist/node/index.js +220 -138
- package/dist/render.d.ts +13 -17
- package/dist/scene.d.ts +20 -0
- 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-MHOtAg/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-MHOtAg/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-MHOtAg/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-MHOtAg/src/spec.ts
|
|
16
16
|
var norm = (s) => s.trim().toLowerCase().replace(/\\/g, "/").replace(/\/+/g, "/");
|
|
17
17
|
function parseColor(tok) {
|
|
18
18
|
if (/^0x/i.test(tok))
|
|
@@ -705,7 +705,7 @@ function fileStepViews(f) {
|
|
|
705
705
|
return out;
|
|
706
706
|
}
|
|
707
707
|
|
|
708
|
-
// ../../../../../../../tmp/ldr-build-
|
|
708
|
+
// ../../../../../../../tmp/ldr-build-MHOtAg/src/model.ts
|
|
709
709
|
var CALLOUT_END = 999999;
|
|
710
710
|
var stepKey = (steps) => steps.map((x) => String(x).padStart(6, "0")).join(".") + "~";
|
|
711
711
|
function flatten(doc, opts = {}) {
|
|
@@ -1055,7 +1055,7 @@ function parseLDConfig(text) {
|
|
|
1055
1055
|
return out;
|
|
1056
1056
|
}
|
|
1057
1057
|
|
|
1058
|
-
// ../../../../../../../tmp/ldr-build-
|
|
1058
|
+
// ../../../../../../../tmp/ldr-build-MHOtAg/src/node/resolver.ts
|
|
1059
1059
|
var TOP_STUD_RE = /^(stud|studa|stud2|stud2a|stud6|stud6a|stud10|stud15|stud2s|stud2s2|stud-logo\d*|stud2-logo\d*)\.dat$/i;
|
|
1060
1060
|
var UNDER_STUD_RE = /^(stud3|stud3a|stud4.*|stud12|stud16.*|stud18a)\.dat$/i;
|
|
1061
1061
|
var norm2 = (ref) => ref.trim().replace(/\\/g, "/").toLowerCase();
|
|
@@ -1325,11 +1325,11 @@ function collectDeps(lib, refs) {
|
|
|
1325
1325
|
return out;
|
|
1326
1326
|
}
|
|
1327
1327
|
|
|
1328
|
-
// ../../../../../../../tmp/ldr-build-
|
|
1328
|
+
// ../../../../../../../tmp/ldr-build-MHOtAg/src/node/compile.ts
|
|
1329
1329
|
import fs2 from "node:fs";
|
|
1330
1330
|
import path2 from "node:path";
|
|
1331
1331
|
|
|
1332
|
-
// ../../../../../../../tmp/ldr-build-
|
|
1332
|
+
// ../../../../../../../tmp/ldr-build-MHOtAg/src/node/lod.ts
|
|
1333
1333
|
import { MeshoptSimplifier, MeshoptEncoder } from "meshoptimizer";
|
|
1334
1334
|
await Promise.all([MeshoptSimplifier.ready, MeshoptEncoder.ready]);
|
|
1335
1335
|
function reorderMesh(P, N, C, I) {
|
|
@@ -1521,7 +1521,7 @@ function lodChain(P, C, I) {
|
|
|
1521
1521
|
return out;
|
|
1522
1522
|
}
|
|
1523
1523
|
|
|
1524
|
-
// ../../../../../../../tmp/ldr-build-
|
|
1524
|
+
// ../../../../../../../tmp/ldr-build-MHOtAg/src/node/compile.ts
|
|
1525
1525
|
function loadColors(root) {
|
|
1526
1526
|
const map = new Map;
|
|
1527
1527
|
for (const l of fs2.readFileSync(path2.join(root, "LDConfig.ldr"), "latin1").split(/\r?\n/)) {
|
|
@@ -2104,7 +2104,7 @@ function encodePack(parts, studKinds, weld, extra, options = {}) {
|
|
|
2104
2104
|
return Buffer.concat([head, ...chunks.map((c) => new Uint8Array(c.buffer, c.byteOffset, c.byteLength))]);
|
|
2105
2105
|
}
|
|
2106
2106
|
|
|
2107
|
-
// ../../../../../../../tmp/ldr-build-
|
|
2107
|
+
// ../../../../../../../tmp/ldr-build-MHOtAg/src/node/build-pack.ts
|
|
2108
2108
|
function buildPack(o) {
|
|
2109
2109
|
const lib = new Library(o.ldrawRoot);
|
|
2110
2110
|
const refs = new Map;
|
|
@@ -2172,7 +2172,7 @@ function buildPack(o) {
|
|
|
2172
2172
|
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 } : {} };
|
|
2173
2173
|
}
|
|
2174
2174
|
|
|
2175
|
-
// ../../../../../../../tmp/ldr-build-
|
|
2175
|
+
// ../../../../../../../tmp/ldr-build-MHOtAg/src/cli.ts
|
|
2176
2176
|
var HELP = `ldr pack — build a parts pack for the ldr three.js renderer
|
|
2177
2177
|
|
|
2178
2178
|
Usage:
|
package/dist/index.d.ts
CHANGED
|
@@ -4,10 +4,10 @@ export { flatten, parseModel, sequenceSteps, stepKey, parseLDConfig, parseColour
|
|
|
4
4
|
export { planStepViews, isolateMask, viewDir, instanceBoxes, MIN_VIS, REORIENT } from "./instructions.js";
|
|
5
5
|
export type { StepCameraView, StepCameraOptions, Vec3 } from "./instructions.js";
|
|
6
6
|
export type { PartInstance, FlattenOptions, LDrawColor, LDrawFinish, LDrawFinishType, LDrawMaterialGrain, ColourSurface } from "./model.js";
|
|
7
|
-
export { loadPack, decodePack, buildLdrScene, makeMaterial, makeFinishMaterial, createInstancedEdges, computeCulling, cullCore, forEachStud, conditionalLines, createInstancedConditionalEdges, conditionalLineVisible, warmPackGeometry } from "./render.js";
|
|
7
|
+
export { loadPack, decodePack, buildLdrScene, buildLdrSceneAsync, makeMaterial, makeFinishMaterial, createInstancedEdges, computeCulling, cullCore, forEachStud, conditionalLines, createInstancedConditionalEdges, conditionalLineVisible, warmPackGeometry } from "./render.js";
|
|
8
8
|
export { precomputeCull, sceneInstances } from "./cull.js";
|
|
9
|
-
export type { Pack, LdrParams, Inst, CullResult } from "./render.js";
|
|
10
|
-
export { createLdrObject } from "./scene.js";
|
|
9
|
+
export type { Pack, LdrParams, Inst, CullResult, BuildLdrSceneAsyncOptions } from "./render.js";
|
|
10
|
+
export { createLdrObject, createLdrObjectAsync } from "./scene.js";
|
|
11
11
|
export type { LdrObject, LdrObjectOptions, LdrStats, ColorSource } from "./scene.js";
|
|
12
12
|
export { decompressPack } from "./pack-io.js";
|
|
13
13
|
export { loadModel, loadParts, loadPartsIndex, mergePacks, prepareModel, DEFAULT_PARTS_CDN } from "./cdn.js";
|