lecodes-sdk 2.4.8 → 2.4.10
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/global.d.ts +4 -0
- package/dist/host.d.ts +13 -2
- package/dist/types/gl/Light.d.ts +7 -2
- package/dist/types/gl/Lightmap.d.ts +45 -25
- package/dist/types/gl/Material.d.ts +16 -2
- package/dist/types/gl/Particles.d.ts +1 -1
- package/dist/types/inject.d.ts +1 -0
- package/dist/types/scene/defineScene.d.ts +15 -54
- package/dist/types/version.d.ts +1 -1
- package/dist/types.json +1 -1
- package/package.json +1 -1
- package/src/compile/assetMacro.ts +2 -2
- package/src/compile/bakeMacro.ts +243 -0
- package/src/compile/bundler.ts +38 -6
- package/src/compile/compileProject.ts +13 -7
- package/src/compile/index.ts +2 -1
- package/src/compile/resourceSlots.ts +4 -3
- package/src/gl/Light.ts +280 -274
- package/src/gl/Lightmap.ts +123 -81
- package/src/gl/Material.ts +36 -2
- package/src/gl/Particles.ts +1 -1
- package/src/host.d.ts +13 -2
- package/src/inject.ts +1 -0
- package/src/scene/defineScene.ts +26 -59
- package/src/version.ts +1 -1
package/dist/global.d.ts
CHANGED
|
@@ -390,6 +390,10 @@ declare global {
|
|
|
390
390
|
type Light = SDK.Light
|
|
391
391
|
type LightDef = SDK.LightDef
|
|
392
392
|
type Lightmap = SDK.Lightmap
|
|
393
|
+
type LightmapDef = SDK.LightmapDef
|
|
394
|
+
type LightmapFiles = SDK.LightmapFiles
|
|
395
|
+
type LightmapOptions = SDK.LightmapOptions
|
|
396
|
+
type LightmapTransmit = SDK.LightmapTransmit
|
|
393
397
|
type LineLayer = SDK.LineLayer
|
|
394
398
|
type LineLayerOptions = SDK.LineLayerOptions
|
|
395
399
|
type LitMaterialDef = SDK.LitMaterialDef
|
package/dist/host.d.ts
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
// JS-runtime globals provided by the host engine (web viewer / desktop / iOS), NOT by the SDK.
|
|
2
2
|
// Declared only so SDK and user code type-check — never bundled or injected.
|
|
3
3
|
|
|
4
|
-
// The
|
|
5
|
-
//
|
|
4
|
+
// The SDK types the macros return: an SVG image source, the same `SvgSource` a project has as a
|
|
5
|
+
// global, and the lightmap def `bake()` compiles to (build-types.ts points these imports into
|
|
6
|
+
// dist/types when it copies the file).
|
|
6
7
|
import type { SvgSource } from "./types/runtime/misc"
|
|
8
|
+
import type { LightmapDef, LightmapOptions } from "./types/gl/Lightmap"
|
|
7
9
|
|
|
8
10
|
declare global {
|
|
9
11
|
/** As in the browser, but the delay is REQUIRED (the native runtime throws without it) and no
|
|
@@ -50,6 +52,15 @@ declare global {
|
|
|
50
52
|
* comments and string literals are text, not macros. */
|
|
51
53
|
function asset(path: string): string
|
|
52
54
|
|
|
55
|
+
/** THE LEVEL'S BAKE: `lecodes lightmap bake` writes `<stem>.bake` (a JSON manifest) and the files it names next to
|
|
56
|
+
* it. Compile-time macro: the manifest is read, every file it names is staged, and the call becomes the literal
|
|
57
|
+
* `Lightmap.load` takes — `env: { lightmap: bake('./assets/lightmap/level.bake') }` in a scene file. The path is a
|
|
58
|
+
* string literal, relative to the file that calls it (`./`, `../`), else to the project root. No file yet →
|
|
59
|
+
* `{ data: null, path }`: the level runs unbaked and says so; under `lecodes lightmap bake` this is the target the
|
|
60
|
+
* bake writes. A file the manifest names that is missing fails the compile. `options` (an object literal, copied
|
|
61
|
+
* as written) are the level's bake / load options. */
|
|
62
|
+
function bake(path: `${string}.bake`, options?: LightmapOptions): LightmapDef
|
|
63
|
+
|
|
53
64
|
/** Compile-time macro: installs a font and returns its family name — using a font IS declaring
|
|
54
65
|
* it. A registry id (`font("manrope")`) resolves against the font registry; a project path
|
|
55
66
|
* (`font("./fonts/Brand.ttf")`) reads family/weight/italic from the file itself. `opts`
|
package/dist/types/gl/Light.d.ts
CHANGED
|
@@ -92,6 +92,11 @@ export type SpotOptions = {
|
|
|
92
92
|
innerAngle?: number;
|
|
93
93
|
/** A spot's shadow is one 2D shadow map (a point light's is a cubemap); off by default. */
|
|
94
94
|
castShadows?: boolean;
|
|
95
|
+
/**
|
|
96
|
+
* Where the cone points, as a sun's `direction`: it sets the node's rotation (live as `light.direction`). Default:
|
|
97
|
+
* the node's forward (-Z) - aim it later with `lookAt` / `eulerAngles`.
|
|
98
|
+
*/
|
|
99
|
+
direction?: Vec3Like;
|
|
95
100
|
};
|
|
96
101
|
export declare class Light extends Node {
|
|
97
102
|
private _intensity;
|
|
@@ -111,8 +116,8 @@ export declare class Light extends Node {
|
|
|
111
116
|
_innerAngle: number;
|
|
112
117
|
/**
|
|
113
118
|
* A spot light — a flashlight, a headlight, a stage light. It shines along the node's forward (-Z): position
|
|
114
|
-
* it like any node and aim it with `lookAt`. Real time only: the lightmap bake takes no spot lights,
|
|
115
|
-
* lights the baked statics live too.
|
|
119
|
+
* it like any node and aim it with `direction` or `lookAt`. Real time only: the lightmap bake takes no spot lights,
|
|
120
|
+
* so a spot lights the baked statics live too.
|
|
116
121
|
*/
|
|
117
122
|
static spot(options?: SpotOptions): Light;
|
|
118
123
|
/** A spot's full cone angle in degrees — live (a flashlight's focus). */
|
|
@@ -1,15 +1,21 @@
|
|
|
1
1
|
import { Node } from "./Node";
|
|
2
2
|
import type { Scene } from "./Scene";
|
|
3
|
-
|
|
3
|
+
/** The level's bake / load options: `bake()`'s second argument (an object literal, copied into the def as written). */
|
|
4
|
+
export type LightmapOptions = {
|
|
4
5
|
/** A DEBUG multiplier on the atlas' lux (default 1): the atlas is physical, so this is a knob for looking,
|
|
5
6
|
* not a look. */
|
|
6
7
|
lightScale?: number;
|
|
7
|
-
/**
|
|
8
|
-
* emissive
|
|
9
|
-
*
|
|
8
|
+
/** FOR THE BAKE: the radiance in cd / m² of emission 1.0 on this level (emissive factor x strength x map) - every lit
|
|
9
|
+
* region of an emissive surface bakes as a rectangle lamp. An imported pack's emission is a LOOK, tuned for the eye;
|
|
10
|
+
* this is where the level says what its panels really give: a 1.3 m ceiling panel of ~8000 lm is ~1600 nits. Default:
|
|
11
|
+
* what the camera makes of 1.0 (`1.2 x 2^EV100`). 0 = emissive surfaces light nothing. The CLI's `--emissive-nits`
|
|
12
|
+
* wins over it. A `Material.lit` glow with `emissiveNits` of its own emits those instead. */
|
|
10
13
|
emissiveNits?: number;
|
|
11
|
-
/** `false` = the emissive surfaces light NOTHING in the bake
|
|
12
|
-
*
|
|
14
|
+
/** `false` = the emissive surfaces light NOTHING in the bake - the level is lit by its lamps (a `kind: 'point'` light
|
|
15
|
+
* with a `bakeArea` next to every panel, the Unity packs' way) and the panels are decoration; `emissiveNits` then only
|
|
16
|
+
* says how bright their glow is DRAWN (scene-referred: nits through the camera's exposure). Default true. The
|
|
17
|
+
* OVERRIDE over every surface's own switch (`Material.lit`'s `emissiveBake`, a GLB material's extras
|
|
18
|
+
* `{"lecodes":{"emissiveBake":false}}`), which vetoes one material while the rest still light the level. */
|
|
13
19
|
emissiveBake?: boolean;
|
|
14
20
|
/** FOR THE BAKE: materials that let light THROUGH them, by their glTF name (`"name*"` = every name with that start):
|
|
15
21
|
* the share of a shadow ray that passes, tinted by the material's base colour x map - an awning's warm, patterned light
|
|
@@ -24,7 +30,7 @@ export type LightmapLoadOptions = {
|
|
|
24
30
|
* or charts. Added to the CLI's `--cube` patterns (both apply). */
|
|
25
31
|
cube?: string[];
|
|
26
32
|
};
|
|
27
|
-
/** one `transmit` entry (
|
|
33
|
+
/** one `transmit` entry (LightmapOptions.transmit): the straight share, or both shares */
|
|
28
34
|
export type LightmapTransmit = number | {
|
|
29
35
|
through?: number;
|
|
30
36
|
diffuse?: number;
|
|
@@ -39,26 +45,34 @@ export type LightmapInfo = {
|
|
|
39
45
|
total: number;
|
|
40
46
|
missing: string[];
|
|
41
47
|
};
|
|
48
|
+
/** The bake's files as `bake()` reads them off the `.bake` manifest at compile time — each one staged like an asset()
|
|
49
|
+
* (every name in the manifest is relative to the `.bake`'s folder). Written by the macro, never by hand. */
|
|
42
50
|
export type LightmapFiles = {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
51
|
+
/** The `.bake` (the manifest) — null until `lecodes lightmap bake` has written it: the level then runs unbaked. */
|
|
52
|
+
data: string | null;
|
|
53
|
+
/** Project-relative path of the `.bake`, always set: what the messages name, and where `lecodes lightmap bake` writes. */
|
|
54
|
+
path: string;
|
|
55
|
+
/** The irradiance atlas (`<stem>-light[_n].ktx2`), every page in order. */
|
|
56
|
+
light: string[];
|
|
57
|
+
/** The aux atlas (`<stem>-aux[_n].ktx2`: sun / sky visibility + light direction), pages like `light`. */
|
|
58
|
+
aux: string[];
|
|
48
59
|
/** DEBUG: the direct-light-only pages a `--split` bake wrote (`<stem>-direct[_n].ktx2`), for the "direct" view. */
|
|
49
|
-
direct?: string
|
|
60
|
+
direct?: string[];
|
|
50
61
|
/** DEBUG: the bounce-only pages of a `--split` bake (`<stem>-indirect[_n].ktx2`), for the "indirect" view. */
|
|
51
|
-
indirect?: string
|
|
62
|
+
indirect?: string[];
|
|
52
63
|
/** The reflection probes (`<stem>-probes.ktx2`), when the bake placed some (`lecodes lightmap bake --probe-spacing`). */
|
|
53
64
|
probes?: string;
|
|
54
|
-
/** THE LIGHT GRID for movers (`<stem>.lgrid`, `lecodes lightmap bake --volume`):
|
|
55
|
-
*
|
|
65
|
+
/** THE LIGHT GRID for movers (`<stem>.lgrid`, `lecodes lightmap bake --volume`): every node a Physics aspect or a
|
|
66
|
+
* CharacterController moves (and what code marks with `Lightmap.track`) takes its ambient light from the bake at the
|
|
67
|
+
* place it is at, whatever its shader. Absent = movers keep the scene's IBL. */
|
|
56
68
|
volume?: string;
|
|
57
|
-
/** THE PACKED LIGHTMAP UV1 (`<stem>-uv1.bin
|
|
58
|
-
*
|
|
59
|
-
* when the bake names one. */
|
|
69
|
+
/** THE PACKED LIGHTMAP UV1 (`<stem>-uv1.bin`): the bake packs every mesh's lightmap charts into a square of their own
|
|
70
|
+
* and its rects map that uv1 — the engine swaps it into the models' TEXCOORD_1 before the rects go on. */
|
|
60
71
|
uv1?: string;
|
|
61
72
|
};
|
|
73
|
+
/** What `bake('<path>.bake', options)` compiles to — the files of the bake and the level's options in one literal:
|
|
74
|
+
* `env.lightmap` in a scene file, `Lightmap.load`'s argument in a hand-built scene. */
|
|
75
|
+
export type LightmapDef = LightmapFiles & LightmapOptions;
|
|
62
76
|
/** The lightmap material's data views (`Lightmap.debug`); "direct" / "indirect" bind a `--split` bake's pages instead. */
|
|
63
77
|
export type LightmapDebugMode = "off" | "irradiance" | "albedo" | "normal" | "shadingNormal" | "share" | "skyVis" | "atlas" | "direction" | "lux" | "relief" | "direct" | "indirect" | "probe" | "probeMap" | "skyPath" | "probePath";
|
|
64
78
|
export type LightmapDebugParams = {
|
|
@@ -103,7 +117,7 @@ export declare class Lightmap {
|
|
|
103
117
|
private static next;
|
|
104
118
|
private static movers;
|
|
105
119
|
private static volumeOn;
|
|
106
|
-
/** A MOVER takes its ambient light from the level's baked LIGHT GRID (`
|
|
120
|
+
/** A MOVER takes its ambient light from the level's baked LIGHT GRID (the bake's `.lgrid`) at the place it is at,
|
|
107
121
|
* every frame — whatever its shader: the standard glTF one or a custom lit material. Every Model / Mesh under `node`
|
|
108
122
|
* is marked (a character, a weapon with its parts). A scene file does this itself for every node a Physics aspect or
|
|
109
123
|
* a CharacterController moves; call it for what CODE spawns — an enemy, a pickup, a projectile. `on = false` hands
|
|
@@ -127,14 +141,15 @@ export declare class Lightmap {
|
|
|
127
141
|
/** The loaded bake's sun (TO the sun ×3, its illuminance rgb, the sun map's levels), null without a sun map. */
|
|
128
142
|
private static sunArgs;
|
|
129
143
|
private static applySun;
|
|
130
|
-
/** Apply a bake — or, under `lecodes lightmap bake`, run it.
|
|
131
|
-
* applied (no bake yet, a host without the
|
|
144
|
+
/** Apply a bake — or, under `lecodes lightmap bake`, run it. `def` is what `bake('<path>.bake', options)` compiled
|
|
145
|
+
* to (a scene file's `env.lightmap`). Resolves to null when nothing was applied (no bake yet, a host without the
|
|
146
|
+
* feature, bake mode). */
|
|
132
147
|
private static scene;
|
|
133
|
-
static load(scene: Scene,
|
|
148
|
+
static load(scene: Scene, def: LightmapDef): Promise<LightmapInfo | null>;
|
|
134
149
|
/** The bake's `<key>@k` records by their node key: a model's meshes (k = the primitive's ordinal in its file). */
|
|
135
150
|
private static recordsOf;
|
|
136
151
|
/** Switch every lightmapped surface to a DATA view (or back with `"off"` / 0). Level-wide, instant —
|
|
137
|
-
* except "direct" / "indirect", which load that page set the first time (a
|
|
152
|
+
* except "direct" / "indirect", which load that page set the first time (a bake made with `--split`). */
|
|
138
153
|
static debug(mode: LightmapDebugMode | number, params?: LightmapDebugParams): void;
|
|
139
154
|
/** Bind another page set of the bound bake to every surface (the "direct" / "indirect" views). */
|
|
140
155
|
private static show;
|
|
@@ -152,7 +167,12 @@ export declare class Lightmap {
|
|
|
152
167
|
static probe(screenX: number, screenY: number): LightmapProbe | null;
|
|
153
168
|
/** A material's colour uniform as "#rrggbbaa" (the float4 uniform path sets its alpha); white without one. */
|
|
154
169
|
private static colorUniform;
|
|
155
|
-
/** The lightmap material for a static Mesh, from whatever lit material it carried (colour, map, roughness, metallic)
|
|
170
|
+
/** The lightmap material for a static Mesh, from whatever lit material it carried (colour, map, roughness, metallic)
|
|
171
|
+
* — and its GLOW, so a glowing Mesh looks the same before and after the bake applies: `emissive` (linear) becomes the
|
|
172
|
+
* lightmap material's `emissiveFactor` at strength 1; its own `emissiveNits` go over with `emissiveOwn` 1, which the
|
|
173
|
+
* level-wide write (`lightmapSetOptions`) leaves alone. A glow without nits takes the level's, like a GLB panel:
|
|
174
|
+
* screen-referred under a level of 0 nits, else emission x the level's nits through the exposure — the same as
|
|
175
|
+
* before the bake when the level's nits are the camera's (the default). */
|
|
156
176
|
private static meshMaterial;
|
|
157
177
|
private static bake;
|
|
158
178
|
}
|
|
@@ -112,12 +112,25 @@ export type ParticlesMaterialOptions = {
|
|
|
112
112
|
* length = size + stretch·|velocity|. Default 0.05. */
|
|
113
113
|
stretch?: number;
|
|
114
114
|
};
|
|
115
|
-
/** `Material.lit` options — PBR scalars on top of the color/map pair. */
|
|
115
|
+
/** `Material.lit` options — PBR scalars on top of the color/map pair, and the surface's own glow. */
|
|
116
116
|
export type LitMaterialOptions = MaterialColorOptions & MaterialStateOptions & {
|
|
117
117
|
/** Perceptual roughness, 0 (mirror) … 1 (matte). Unset = the shader's default. */
|
|
118
118
|
roughness?: number;
|
|
119
119
|
/** Metallic factor, 0 (dielectric) … 1 (metal). Unset = the shader's default. */
|
|
120
120
|
metallic?: number;
|
|
121
|
+
/** The surface's GLOW, added on top of its lit colour: a ceiling panel, a screen, a sign. Any colour (sRGB, like
|
|
122
|
+
* `color`); an `[r, g, b]` array may go past 1 — an HDR colour, its hue in sRGB and the excess a linear multiplier
|
|
123
|
+
* (`[4, 3.6, 3]` = `[1, 0.9, 0.75]` four times as bright). Unset = no glow. */
|
|
124
|
+
emissive?: ColorInput;
|
|
125
|
+
/** The glow's luminance in cd / m² (nits) for `emissive` 1.0 — `#ffffff` at 1600 is a typical ceiling panel. Set,
|
|
126
|
+
* the glow is drawn SCENE-referred: through the camera's exposure, as bright as the light it gives the room in a
|
|
127
|
+
* bake. Unset (or 0) = SCREEN-referred: the colour is drawn as it is whatever the exposure, and a bake counts it at
|
|
128
|
+
* the level's `emissiveNits` (what the camera makes of 1.0 unless the level says otherwise). */
|
|
129
|
+
emissiveNits?: number;
|
|
130
|
+
/** `false` = decoration: the glow is drawn, but a lightmap bake does not light the level with it (Unity's "Global
|
|
131
|
+
* Illumination: None") — the level's lamps do. Default true: a glowing static lights the level like a lamp. The
|
|
132
|
+
* level-wide `bake('…', { emissiveBake: false })` overrides it for every surface. */
|
|
133
|
+
emissiveBake?: boolean;
|
|
121
134
|
};
|
|
122
135
|
export declare class Material {
|
|
123
136
|
readonly shader: FetchResponse | "unknown";
|
|
@@ -139,7 +152,8 @@ export declare class Material {
|
|
|
139
152
|
set map(value: Texture | Canvas | null);
|
|
140
153
|
/** The material an instance handle is of; a host that carries none under `name` is an error naming it. */
|
|
141
154
|
private static _builtin;
|
|
142
|
-
/** PBR lit material.
|
|
155
|
+
/** PBR lit material. `emissive` / `emissiveNits` / `emissiveBake` are its glow (`LitMaterialOptions`); the uniforms
|
|
156
|
+
* are written only for a material that asks for a glow, so a plain lit material never names them. */
|
|
143
157
|
static lit(options?: LitMaterialOptions): Material;
|
|
144
158
|
/** Unlit (flat) material — opaque unless `transparent` asks for alpha blending. */
|
|
145
159
|
static unlit(options?: UnlitMaterialOptions): Material;
|
|
@@ -184,7 +184,7 @@ export type ParticlesOptions = ParticlesMaterialOptions & {
|
|
|
184
184
|
* without this the engine picks who covers whom per frame (smoke popping over a fireball).
|
|
185
185
|
* Default 0; a fireball wants 2, its smoke 1, a smoke trail -1. */
|
|
186
186
|
order?: number;
|
|
187
|
-
/** Sprites take the light of the PLACE each one is in — the level's baked light grid (`
|
|
187
|
+
/** Sprites take the light of the PLACE each one is in — the level's baked light grid (the bake's `.lgrid`).
|
|
188
188
|
* A sprite is unlit: its colour is the picture, which is right for fire and wrong for dust — a puff kicked up
|
|
189
189
|
* under an awning glows as if it stood in the sun. With `lit` every particle's colour is multiplied by the light
|
|
190
190
|
* where it is, relative to the level's OPEN ground: exactly the authored colour out in the sun, the ambient's
|
package/dist/types/inject.d.ts
CHANGED
|
@@ -130,6 +130,7 @@ export type { DynamicBoneCurve, DynamicBoneFloor, DynamicBoneColliders } from ".
|
|
|
130
130
|
export type { IKTwoBone, IKLookAt } from "./gl/animation/IK";
|
|
131
131
|
export { Light } from "./gl/Light";
|
|
132
132
|
export { Lightmap } from "./gl/Lightmap";
|
|
133
|
+
export type { LightmapDef, LightmapFiles, LightmapOptions, LightmapTransmit } from "./gl/Lightmap";
|
|
133
134
|
export { Foliage } from "./gl/Foliage";
|
|
134
135
|
export type { FoliageOptions, FoliageWind } from "./gl/Foliage";
|
|
135
136
|
export { Terrain } from "./gl/terrain/Terrain";
|
|
@@ -4,10 +4,10 @@ import { Scene, type SceneOptions } from "../gl/Scene";
|
|
|
4
4
|
import { Node } from "../gl/Node";
|
|
5
5
|
import { Mesh } from "../gl/Mesh";
|
|
6
6
|
import { Model } from "../gl/Model";
|
|
7
|
-
import { type
|
|
7
|
+
import { type LightmapDef } from "../gl/Lightmap";
|
|
8
8
|
import { type FoliageOptions } from "../gl/Foliage";
|
|
9
9
|
import { type TerrainLayer, type TerrainRegion, type TerrainOptions } from "../gl/terrain/Terrain";
|
|
10
|
-
import { Light, type SunOptions } from "../gl/Light";
|
|
10
|
+
import { Light, type PointOptions, type SpotOptions, type SunOptions } from "../gl/Light";
|
|
11
11
|
import { type MaterialDef } from "./material";
|
|
12
12
|
import type { CapsuleOptions, CylinderOptions, PlaneOptions, SphereOptions } from "../gl/Geometry";
|
|
13
13
|
import { GizmoBuffer } from "./gizmos";
|
|
@@ -23,9 +23,16 @@ export type MeshDef = {
|
|
|
23
23
|
} & CapsuleOptions) | ({
|
|
24
24
|
kind: "plane";
|
|
25
25
|
} & PlaneOptions);
|
|
26
|
-
|
|
26
|
+
/** The `light: {}` source block, by `kind` — `Light.sun` / `Light.point` / `Light.spot` with the node's transform: a
|
|
27
|
+
* point light's `bakeArea` panel lies in the node's local XZ plane and emits along its local -Y, so `eulerAngles`
|
|
28
|
+
* tilts it; a spot shines along the node's -Z (`direction` aims it, as a sun's does). */
|
|
29
|
+
export type LightDef = ({
|
|
27
30
|
kind: "sun";
|
|
28
|
-
} & SunOptions
|
|
31
|
+
} & SunOptions) | ({
|
|
32
|
+
kind: "point";
|
|
33
|
+
} & PointOptions) | ({
|
|
34
|
+
kind: "spot";
|
|
35
|
+
} & SpotOptions);
|
|
29
36
|
/** A stamp: the terrain conforms to another node of this file (a road) at load — see Terrain.conform. */
|
|
30
37
|
export type TerrainStampDef = {
|
|
31
38
|
/** Path of the node (a Mesh, a Model, or a node holding them) the ground hugs. */
|
|
@@ -134,7 +141,7 @@ export type SceneNodeDef = {
|
|
|
134
141
|
* `'cube'` = a static whose every mesh bakes as AMBIENT CUBES instead of atlas texels — an occluder (its shadow and
|
|
135
142
|
* 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
143
|
* 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
|
|
144
|
+
* kit: the `cube` option of `env.lightmap`'s `bake()`. */
|
|
138
145
|
lightmap?: boolean | "cube";
|
|
139
146
|
/** `model` nodes: vegetation — load through the FOLIAGE tier (wind, touch bending, per-copy tint; see
|
|
140
147
|
* `Foliage`). `{ fade: [start, end] }` also thins the cards out over that distance range (m) and drops the
|
|
@@ -156,54 +163,6 @@ export type SceneCameraDef = CameraProjectionDef & {
|
|
|
156
163
|
/** Point the camera looks at. */
|
|
157
164
|
target?: Vec3Like;
|
|
158
165
|
};
|
|
159
|
-
/** `env.lightmap` — the level's baked lighting (engines/bake): the files `lecodes lightmap bake`
|
|
160
|
-
* writes. Absent = real-time only. */
|
|
161
|
-
export type SceneLightmapDef = {
|
|
162
|
-
/** `asset('./assets/lightmap/level.bake')` */
|
|
163
|
-
data: string;
|
|
164
|
-
/** `asset('./assets/lightmap/level-light.ktx2')` — or, for a bake that took more than one atlas PAGE
|
|
165
|
-
* (`lecodes lightmap bake --pages`), every page in order: `[asset('x-light.ktx2'), asset('x-light_1.ktx2')]`. */
|
|
166
|
-
light: string | string[];
|
|
167
|
-
/** `asset('./assets/lightmap/level-aux.ktx2')` (pages like `light`) — sun / sky visibility + light direction. */
|
|
168
|
-
aux: string | string[];
|
|
169
|
-
/** DEBUG: the page sets a `lecodes lightmap bake --split` wrote (`<stem>-direct[_n].ktx2`, `<stem>-indirect[_n].ktx2`),
|
|
170
|
-
* pages like `light` — the `Lightmap.debug("direct" | "indirect")` views bind them in place of `light`. */
|
|
171
|
-
direct?: string | string[];
|
|
172
|
-
indirect?: string | string[];
|
|
173
|
-
/** `asset('./assets/lightmap/level-probes.ktx2')` — the bake's reflection probes (one prefiltered cubemap of the level's
|
|
174
|
-
* radiance per probe; every static reflects the nearest). Absent = statics reflect the sky's SH alone. */
|
|
175
|
-
probes?: string;
|
|
176
|
-
/** FOR THE BAKE: the radiance in cd / m² of emission 1.0 on this level (emissive factor x strength x map) - every lit
|
|
177
|
-
* region of an emissive surface bakes as a rectangle lamp. An imported pack's emission is a LOOK (the school's panels
|
|
178
|
-
* say 10); this is where the level says what they give: a 1.3 m ceiling panel of ~8000 lm is ~1600 nits. Default: what
|
|
179
|
-
* the camera makes of 1.0 (`1.2 x 2^EV100`). 0 = emissive surfaces light nothing. `--emissive-nits` overrides. */
|
|
180
|
-
emissiveNits?: number;
|
|
181
|
-
/** `false` = the emissive surfaces light nothing in the bake - the level is lit by its lamps (`Light.point` with a
|
|
182
|
-
* `bakeArea` next to every panel, the Unity packs' way) and the panels are decoration; `emissiveNits` then only says how
|
|
183
|
-
* bright their glow is DRAWN (scene-referred: nits through the camera's exposure). Default true. */
|
|
184
|
-
emissiveBake?: boolean;
|
|
185
|
-
/** FOR THE BAKE: materials that let light THROUGH them, by glTF material name (`"name*"` = every name with that start) →
|
|
186
|
-
* the share of a shadow ray that passes, tinted by the material's base colour x map: `{ mat_awning: 0.3 }` puts the
|
|
187
|
-
* awning's warm, patterned light on the sand. The surface stays opaque - baked, drawn as before, a shadow caster.
|
|
188
|
-
* `{ through, diffuse }` splits it: `through` goes straight (the picture of the map), `diffuse` is scattered by the
|
|
189
|
-
* fibres (the underside glows, a soft fill with no picture) - dense canvas: `{ through: 0.08, diffuse: 0.25 }`. */
|
|
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[];
|
|
195
|
-
/** `asset('./assets/lightmap/level.lgrid')` — THE LIGHT GRID for movers: every node a Physics aspect or a
|
|
196
|
-
* CharacterController moves (and what code marks with `Lightmap.track`) takes its ambient light from the bake at the
|
|
197
|
-
* place it is at, whatever its shader. Absent = movers keep the scene's IBL. */
|
|
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;
|
|
204
|
-
/** A DEBUG multiplier on the atlas' lux (default 1). */
|
|
205
|
-
lightScale?: number;
|
|
206
|
-
};
|
|
207
166
|
/** `env.navmesh` — the level's navigation mesh (see navmesh.md): the file `lecodes navmesh bake`
|
|
208
167
|
* writes, the agent size it is built for, and the named areas. Absent = no navigation. */
|
|
209
168
|
export type SceneNavmeshDef = {
|
|
@@ -220,8 +179,10 @@ export type SceneNavmeshDef = {
|
|
|
220
179
|
areas?: Record<string, number>;
|
|
221
180
|
};
|
|
222
181
|
export type SceneDef = {
|
|
182
|
+
/** `lightmap` = the level's baked lighting (engines/bake): `bake('./assets/lightmap/level.bake', { …options })`, the
|
|
183
|
+
* macro that reads the bake's manifest at compile time (`LightmapDef`). Absent = real-time only. */
|
|
223
184
|
env?: SceneOptions & {
|
|
224
|
-
lightmap?:
|
|
185
|
+
lightmap?: LightmapDef;
|
|
225
186
|
navmesh?: SceneNavmeshDef;
|
|
226
187
|
foliage?: FoliageOptions;
|
|
227
188
|
};
|
package/dist/types/version.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "2.4.
|
|
1
|
+
export declare const SDK_VERSION = "2.4.10";
|
|
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
|