ldr 0.4.1 → 0.5.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.
@@ -25,6 +25,12 @@ export interface BuildPackOptions {
25
25
  /** Render a model file's own type 2-5 lines (as synthetic parts `<file>#<step>`). Default true (LDraw allows geometry in any file);
26
26
  * false reproduces packs from ldr <= 0.2.0, which dropped it. */
27
27
  looseGeometry?: boolean;
28
+ /** Distance-LOD meshes (meshoptimizer-simplified bodies/undersides; pack v2 feature "lod"). The renderer only draws a level where its
29
+ * error is under a pixel. Default true; adds ~10-20% to the compressed pack. Readers without LOD support ignore them. */
30
+ lod?: boolean;
31
+ /** Reorder triangles / vertices for GPU vertex-cache reuse (meshoptimizer). Off by default: Round 19 measured -2.7% frame time on
32
+ * Datsville full with LOD off, no change with LOD on, and +1.2% zstd size. */
33
+ reorder?: boolean;
28
34
  /** Embed the LDConfig colour table (code → hex) in the pack header. Default true. */
29
35
  colors?: boolean;
30
36
  onProgress?: (done: number, total: number) => void;
@@ -63,8 +63,12 @@ export declare class Compiler {
63
63
  }
64
64
  export declare function writePack(file: string, parts: Map<string, Compiled>, studKinds: Map<string, Compiled>, weld: boolean, extra?: Record<string, unknown>, options?: EncodeOptions): void;
65
65
  /** `texture(name)`: PNG bytes for a !TEXMAP name used by a compiled part (e.g. `compiler.texture`, or an MPD `!DATA` block). */
66
+ /** `lod`: add simplified distance-LOD meshes to part bodies / undersides (pack v2 feature "lod"; readers without LOD ignore them). */
66
67
  export type EncodeOptions = {
67
68
  texture?: (name: string) => Uint8Array | null;
69
+ lod?: boolean;
70
+ /** Reorder welded triangles / vertices for GPU vertex-cache reuse (meshoptimizer). */
71
+ reorder?: boolean;
68
72
  };
69
73
  /** Serialize compiled parts into the binary pack format read by `decodePack`/`loadPack`. `extra` keys are merged into the JSON header (e.g. `colors`). */
70
74
  export declare function encodePack(parts: Map<string, Compiled>, studKinds: Map<string, Compiled>, weld: boolean, extra?: Record<string, unknown>, options?: EncodeOptions): Uint8Array;