ldr 0.11.0 → 0.12.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/README.md +4 -2
- package/dist/cli.js +212 -16
- package/dist/index.d.ts +3 -3
- package/dist/index.js +394 -51
- package/dist/load-worker.gen.d.ts +1 -1
- package/dist/model.d.ts +58 -1
- package/dist/node/index.js +408 -68
- package/dist/node/library.d.ts +2 -7
- package/dist/render.d.ts +4 -1
- package/package.json +1 -1
package/dist/node/library.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type FlattenOptions } from "../model.js";
|
|
1
|
+
import { type FlattenOptions, type LDrawColor } from "../model.js";
|
|
2
2
|
import { type Doc, type PartMesh, type Instance } from "../spec.js";
|
|
3
3
|
export declare class Library {
|
|
4
4
|
root: string;
|
|
@@ -26,12 +26,7 @@ export declare class Library {
|
|
|
26
26
|
private lookup;
|
|
27
27
|
/** Case-insensitive path resolve (library files are lowercase; callers may pass any case). */
|
|
28
28
|
private resolveFile;
|
|
29
|
-
colors(): Map<number,
|
|
30
|
-
name: string;
|
|
31
|
-
hex: string;
|
|
32
|
-
edge: string;
|
|
33
|
-
alpha: number;
|
|
34
|
-
}>;
|
|
29
|
+
colors(): Map<number, LDrawColor>;
|
|
35
30
|
/** Flattened triangle mesh: positions + color code per tri (16 = inherit); edges as line segments.
|
|
36
31
|
* `cond` stores type-5 lines as 12 floats each: endpoint0, endpoint1, control0, control1.
|
|
37
32
|
* Default = what a renderer without !TEXMAP support draws (`0 !:` geometry skipped, FALLBACK geometry drawn).
|
package/dist/render.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as THREE from 'three';
|
|
2
2
|
import { decodePack, type Pack } from './pack-io.js';
|
|
3
|
+
import { type ColourSurface } from './model.js';
|
|
3
4
|
export { decodePack, type Pack };
|
|
4
5
|
/** `edges`: LDraw edge lines, welded + indexed and sharing each batch's instance matrices (`'idx'` is the same as `true`).
|
|
5
6
|
* `cond`: draw type-5 conditional lines when the pack carries them (pack v2, built with `cond: true`) and edges are on. Default true.
|
|
@@ -32,9 +33,11 @@ import { type Inst } from './cull.js';
|
|
|
32
33
|
export type { Inst };
|
|
33
34
|
export declare function loadPack(url: string): Promise<Pack>;
|
|
34
35
|
export declare function makeMaterial(side: THREE.Side): THREE.MeshStandardMaterial;
|
|
36
|
+
/** Build a MeshStandard/Physical material for one LDraw finish bucket (vertex colours supply the RGB). */
|
|
37
|
+
export declare function makeFinishMaterial(side: THREE.Side, surface: ColourSurface): THREE.MeshStandardMaterial;
|
|
35
38
|
/** Material for textured (!TEXMAP) triangles: the LDraw colour as base, the PNG blended over it by its alpha (LDraw spec),
|
|
36
39
|
* and no texture outside the projection's [0,1] range. `map` should have flipY = false (v = 0 is the image's top row). */
|
|
37
|
-
export declare function makeTexturedMaterial(side: THREE.Side, map: THREE.Texture, wrapU?: boolean): THREE.MeshStandardMaterial;
|
|
40
|
+
export declare function makeTexturedMaterial(side: THREE.Side, map: THREE.Texture, wrapU?: boolean, baseMat?: THREE.MeshStandardMaterial): THREE.MeshStandardMaterial;
|
|
38
41
|
/** Decode a pack's embedded PNG into a texture (async; the texture fills in when decoded). Needs `createImageBitmap` (browsers, workers). */
|
|
39
42
|
export declare function packTexture(pack: Pack, i: number): {
|
|
40
43
|
texture: THREE.Texture;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ldr",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.12.0",
|
|
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",
|