lecodes-sdk 2.4.6 → 2.4.7

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.
@@ -18,6 +18,11 @@ export type LightmapLoadOptions = {
18
18
  * `{ through, diffuse }` adds the share the fibres SCATTER - the cloth's underside glows like a matte panel and lights
19
19
  * what is under it by the solid angle it fills, with no picture. Dense canvas: `{ through: 0.08, diffuse: 0.25 }`. */
20
20
  transmit?: Record<string, LightmapTransmit>;
21
+ /** FOR THE BAKE: CUBES BY NAME — regular expressions (ECMAScript, case-sensitive) searched in every record's key
22
+ * (`<node key>@<ordinal>`: `"SM_pipe"` takes every pipe node, `"@1$"` the second mesh of each): a record that matches
23
+ * leaves the atlas like a small or thin one — an occluder lit by ambient cubes baked where it stands — whatever its size
24
+ * or charts. Added to the CLI's `--cube` patterns (both apply). */
25
+ cube?: string[];
21
26
  };
22
27
  /** one `transmit` entry (LightmapLoadOptions.transmit): the straight share, or both shares */
23
28
  export type LightmapTransmit = number | {
@@ -49,6 +54,10 @@ export type LightmapFiles = {
49
54
  /** THE LIGHT GRID for movers (`<stem>.lgrid`, `lecodes lightmap bake --volume`): the baked ambient light of every
50
55
  * place a mover can be. Absent = movers keep the scene's IBL. */
51
56
  volume?: string;
57
+ /** THE PACKED LIGHTMAP UV1 (`<stem>-uv1.bin`, the .bake's `uv1`): the bake packs every mesh's lightmap charts into a
58
+ * square of their own and its rects map that uv1 — the engine swaps it into the models' TEXCOORD_1 first. Required
59
+ * when the bake names one. */
60
+ uv1?: string;
52
61
  };
53
62
  /** The lightmap material's data views (`Lightmap.debug`); "direct" / "indirect" bind a `--split` bake's pages instead. */
54
63
  export type LightmapDebugMode = "off" | "irradiance" | "albedo" | "normal" | "shadingNormal" | "share" | "skyVis" | "atlas" | "direction" | "lux" | "relief" | "direct" | "indirect" | "probe" | "probeMap" | "skyPath" | "probePath";
@@ -69,6 +78,14 @@ export type LightmapProbe = {
69
78
  world: [number, number, number];
70
79
  distance: number;
71
80
  };
81
+ /** `Lightmap.add`'s options */
82
+ export type LightmapAddOptions = {
83
+ /** Bake it as AMBIENT CUBES instead of atlas texels: an occluder (its shadow and bounce stay in the atlas) whose own
84
+ * light is baked where it stands — the way the bake treats small and thin objects (`--min-texels`, `--thin-texels`),
85
+ * here by hand: a pipe run, a fence, a prop whose charts show their seams. A long one takes a slab of cubes per metre
86
+ * (`--object-slab`). Default false. */
87
+ cube?: boolean;
88
+ };
72
89
  export declare class Lightmap {
73
90
  /** True while `lecodes lightmap bake` runs the app — skip menus and build the scene straight away. */
74
91
  static get baking(): boolean;
@@ -81,8 +98,8 @@ export declare class Lightmap {
81
98
  * both receivers and occluders in the bake (a model without lightmap UVs, or with materials the lightmap shader
82
99
  * declines — alpha cards — is an occluder alone; a terrain is ONE rect, built with `Material.terrainLightmap()`).
83
100
  * `key` names the entry in the .bake (default: the node's name + a running number, `container#3`); pass one when
84
- * names are not stable. */
85
- static add(node: Node, key?: string): Node;
101
+ * names are not stable. `{ cube: true }` bakes it as ambient cubes instead of atlas texels (`LightmapAddOptions`). */
102
+ static add(node: Node, key?: string, options?: LightmapAddOptions): Node;
86
103
  private static next;
87
104
  private static movers;
88
105
  private static volumeOn;
@@ -93,6 +110,10 @@ export declare class Lightmap {
93
110
  * the subtree back to the scene's IBL. Safe before the level's bake has loaded. */
94
111
  static track(node: Node, on?: boolean): void;
95
112
  private static loadVolume;
113
+ /** THE PACKED UV1 the bake's rects map (the .bake's `uv1`), into the host BEFORE any rect is applied: the host swaps it
114
+ * into the models' TEXCOORD_1 as their rects go on. A bake without one clears the last (the models' own uv1 back).
115
+ * False = the bake needs it and it cannot be had - its rects would read the wrong texels. */
116
+ private static loadUv1;
96
117
  /** Forget every registration (a scene rebuild). */
97
118
  static clear(): void;
98
119
  /** THE MOVERS' SUN SHADOWS ON THE BAKED STATICS (a bot, a barrel, the player's rifle darkening the ground under
@@ -110,8 +131,8 @@ export declare class Lightmap {
110
131
  * applied (no bake yet, a host without the feature, bake mode). */
111
132
  private static scene;
112
133
  static load(scene: Scene, files: LightmapFiles, options?: LightmapLoadOptions): Promise<LightmapInfo | null>;
113
- /** The bake's `<key>#k` instances by their base key: the parts of a GLB unwrapped in groups (k = extras.lightmapGroup). */
114
- private static groupsOf;
134
+ /** The bake's `<key>@k` records by their node key: a model's meshes (k = the primitive's ordinal in its file). */
135
+ private static recordsOf;
115
136
  /** Switch every lightmapped surface to a DATA view (or back with `"off"` / 0). Level-wide, instant —
116
137
  * except "direct" / "indirect", which load that page set the first time (a `--split` bake listed in the scene). */
117
138
  static debug(mode: LightmapDebugMode | number, params?: LightmapDebugParams): void;
@@ -12,8 +12,8 @@ export interface TrianglePick {
12
12
  mesh: string;
13
13
  primitive: number;
14
14
  material: string;
15
- /** the node's lightmap group (scene-file extras), when it has one */
16
- lightmapGroup?: number;
15
+ /** the primitive's index over its file's meshes: the lightmap bake's record `<key>@<ordinal>` */
16
+ lightmapOrdinal: number;
17
17
  /** triangle index within the primitive (index-buffer order), and whether the ray came from behind */
18
18
  triangle: number;
19
19
  backface: boolean;
@@ -83,8 +83,8 @@ export declare class Model extends Node {
83
83
  total?: number;
84
84
  }) => void;
85
85
  /** Baked lighting (engines/bake). `true` = a STATIC: loads through the lightmap material so
86
- * `Lightmap.load` can bind its atlas rect (the GLB needs TEXCOORD_1 — `lecodes assets doctor
87
- * --lightmap-uv`) and takes nothing from the real-time lights once the bake applies. Omitted / `false` =
86
+ * `Lightmap.load` can bind its atlas rect (the GLB needs TEXCOORD_1 —
87
+ * `lecodes assets unwrap`, which `lightmap bake` runs itself on raw GLBs) and takes nothing from the real-time lights once the bake applies. Omitted / `false` =
88
88
  * the standard shader, lit real-time (movers). Hosts without lightmap support ignore it. */
89
89
  lightmap?: boolean;
90
90
  /** Vegetation: load through the FOLIAGE tier (see `Foliage`) — wind, touch bending, distance fade,
@@ -130,8 +130,12 @@ export type SceneNodeDef = {
130
130
  /** Baked lighting (a scene with `env.lightmap`): is this model/mesh node a lightmap STATIC — a
131
131
  * receiver and an occluder in the bake, real-time shadow casting off once the bake applies?
132
132
  * Default: static unless a `Physics` aspect moves the node (`dynamic` — Physics' default — or
133
- * `kinematic`). Set it only to override that rule; prefab subtrees inherit the verdict. */
134
- lightmap?: boolean;
133
+ * `kinematic`). Set it only to override that rule; prefab subtrees inherit the verdict.
134
+ * `'cube'` = a static whose every mesh bakes as AMBIENT CUBES instead of atlas texels — an occluder (its shadow and
135
+ * bounce stay in the bake) lit where it stands, the way the bake treats small and thin props on its own: a pipe run, a
136
+ * fence, a prop whose lightmap seams show. A prefab marked `'cube'` bakes its statics that way too. By name for a whole
137
+ * kit: `env.lightmap.cube`. */
138
+ lightmap?: boolean | "cube";
135
139
  /** `model` nodes: vegetation — load through the FOLIAGE tier (wind, touch bending, per-copy tint; see
136
140
  * `Foliage`). `{ fade: [start, end] }` also thins the cards out over that distance range (m) and drops the
137
141
  * copy past `end` — for ground cover. The fade is per ASSET: every node of the same GLB shares it. */
@@ -184,10 +188,19 @@ export type SceneLightmapDef = {
184
188
  * `{ through, diffuse }` splits it: `through` goes straight (the picture of the map), `diffuse` is scattered by the
185
189
  * fibres (the underside glows, a soft fill with no picture) - dense canvas: `{ through: 0.08, diffuse: 0.25 }`. */
186
190
  transmit?: Record<string, LightmapTransmit>;
191
+ /** FOR THE BAKE: CUBES BY NAME — regular expressions (ECMAScript, case-sensitive) searched in every baked mesh's key
192
+ * (`<node path>@<ordinal>`): `['SM_pipe', 'SM_fence']` bakes every pipe and fence node as ambient cubes instead of atlas
193
+ * texels, like a node's `lightmap: 'cube'`. The CLI's `--cube` adds to these. */
194
+ cube?: string[];
187
195
  /** `asset('./assets/lightmap/level.lgrid')` — THE LIGHT GRID for movers: every node a Physics aspect or a
188
196
  * CharacterController moves (and what code marks with `Lightmap.track`) takes its ambient light from the bake at the
189
197
  * place it is at, whatever its shader. Absent = movers keep the scene's IBL. */
190
198
  volume?: string;
199
+ /** `asset('./assets/lightmap/level-uv1.bin')` — THE PACKED LIGHTMAP UV1 the bake's rects map: it packs every mesh's
200
+ * lightmap charts into a square of their own instead of the unwrap's (once per mesh, whatever model holds it), and the
201
+ * engine swaps this into the models' TEXCOORD_1 before the rects go on. Required when the bake wrote one (the .bake's `uv1`): without it the statics
202
+ * read the wrong texels, so the bake is not applied. */
203
+ uv1?: string;
191
204
  /** A DEBUG multiplier on the atlas' lux (default 1). */
192
205
  lightScale?: number;
193
206
  };
@@ -1,4 +1,4 @@
1
- export declare const SDK_VERSION = "2.4.6";
1
+ export declare const SDK_VERSION = "2.4.7";
2
2
  /** The major of a semver string, or null when it is not one. */
3
3
  export declare const sdkMajor: (version: string | null | undefined) => number | null;
4
4
  /** The `// sdk: <version>` line of a compiled bundle's header (sdk/src/compile/header.ts), read from