lecodes-sdk 0.20.2 → 1.0.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.
Files changed (77) hide show
  1. package/dist/global.d.ts +17 -5
  2. package/dist/types/canvas/Canvas.d.ts +2 -0
  3. package/dist/types/gl/DecalSet.d.ts +48 -3
  4. package/dist/types/gl/Geometry.d.ts +12 -0
  5. package/dist/types/gl/Lightmap.d.ts +9 -0
  6. package/dist/types/gl/Material.d.ts +4 -0
  7. package/dist/types/gl/Mesh.d.ts +7 -1
  8. package/dist/types/gl/Model.d.ts +34 -0
  9. package/dist/types/gl/Particles.d.ts +13 -0
  10. package/dist/types/gl/Scene.d.ts +1 -1
  11. package/dist/types/gl/animation/DynamicBone.d.ts +173 -0
  12. package/dist/types/gl/{IK.d.ts → animation/IK.d.ts} +4 -4
  13. package/dist/types/gl/{Locomotion.d.ts → animation/Locomotion.d.ts} +6 -6
  14. package/dist/types/gl/{AudioSource.d.ts → audio/AudioSource.d.ts} +6 -6
  15. package/dist/types/gl/{AudioZone.d.ts → audio/AudioZone.d.ts} +4 -4
  16. package/dist/types/gl/{SceneAudio.d.ts → audio/SceneAudio.d.ts} +1 -1
  17. package/dist/types/gl/{NavAgent.d.ts → nav/NavAgent.d.ts} +4 -4
  18. package/dist/types/gl/{NavMesh.d.ts → nav/NavMesh.d.ts} +4 -4
  19. package/dist/types/gl/{CharacterController.d.ts → physics/CharacterController.d.ts} +5 -5
  20. package/dist/types/gl/{Physics.d.ts → physics/Physics.d.ts} +6 -5
  21. package/dist/types/gl/{Ragdoll.d.ts → physics/Ragdoll.d.ts} +4 -4
  22. package/dist/types/gl/{Shape.d.ts → physics/Shape.d.ts} +3 -3
  23. package/dist/types/gl/{Trigger.d.ts → physics/Trigger.d.ts} +2 -2
  24. package/dist/types/gl/{Terrain.d.ts → terrain/Terrain.d.ts} +6 -6
  25. package/dist/types/gl/{terrainMesh.d.ts → terrain/terrainMesh.d.ts} +1 -1
  26. package/dist/types/gl/vehicle/Vehicle.d.ts +300 -0
  27. package/dist/types/gl/vehicle/Wheel.d.ts +147 -0
  28. package/dist/types/inject.d.ts +28 -26
  29. package/dist/types/runtime/files.d.ts +24 -1
  30. package/dist/types/scene/defineScene.d.ts +10 -3
  31. package/dist/types.json +1 -1
  32. package/package.json +1 -1
  33. package/prompts/README.md +142 -142
  34. package/src/bridges.d.ts +1599 -1481
  35. package/src/canvas/Canvas.ts +21 -0
  36. package/src/compile/__tests__/compile.test.ts +11 -0
  37. package/src/compile/header.ts +6 -3
  38. package/src/compile/index.ts +1 -0
  39. package/src/compile/sceneEditor.ts +42 -1
  40. package/src/gl/DecalSet.ts +132 -5
  41. package/src/gl/Geometry.ts +348 -284
  42. package/src/gl/Lightmap.ts +32 -5
  43. package/src/gl/Material.ts +21 -0
  44. package/src/gl/Mesh.ts +120 -102
  45. package/src/gl/Model.ts +33 -1
  46. package/src/gl/Node.ts +1 -1
  47. package/src/gl/Particles.ts +21 -3
  48. package/src/gl/Scene.ts +1 -1
  49. package/src/gl/animation/DynamicBone.ts +459 -0
  50. package/src/gl/{IK.ts → animation/IK.ts} +4 -4
  51. package/src/gl/{Locomotion.ts → animation/Locomotion.ts} +7 -7
  52. package/src/gl/{AudioSource.ts → audio/AudioSource.ts} +7 -7
  53. package/src/gl/{AudioZone.ts → audio/AudioZone.ts} +75 -75
  54. package/src/gl/{SceneAudio.ts → audio/SceneAudio.ts} +2 -2
  55. package/src/gl/{NavAgent.ts → nav/NavAgent.ts} +5 -5
  56. package/src/gl/{NavMesh.ts → nav/NavMesh.ts} +8 -8
  57. package/src/gl/{CharacterController.ts → physics/CharacterController.ts} +5 -5
  58. package/src/gl/{Physics.ts → physics/Physics.ts} +12 -5
  59. package/src/gl/{Ragdoll.ts → physics/Ragdoll.ts} +8 -6
  60. package/src/gl/{Shape.ts → physics/Shape.ts} +3 -3
  61. package/src/gl/{Trigger.ts → physics/Trigger.ts} +45 -45
  62. package/src/gl/{physicsEvents.ts → physics/physicsEvents.ts} +1 -1
  63. package/src/gl/{Terrain.ts → terrain/Terrain.ts} +10 -10
  64. package/src/gl/{terrainMesh.ts → terrain/terrainMesh.ts} +1 -1
  65. package/src/gl/vehicle/Vehicle.ts +666 -0
  66. package/src/gl/vehicle/Wheel.ts +290 -0
  67. package/src/inject.ts +226 -224
  68. package/src/runtime/files.ts +32 -2
  69. package/src/scene/defineScene.ts +26 -10
  70. package/src/scene/level.ts +2 -2
  71. package/dist/types/gl/Gearbox.d.ts +0 -86
  72. package/dist/types/gl/Vehicle.d.ts +0 -191
  73. package/dist/types/gl/Wheel.d.ts +0 -95
  74. package/src/gl/Gearbox.ts +0 -212
  75. package/src/gl/Vehicle.ts +0 -473
  76. package/src/gl/Wheel.ts +0 -240
  77. /package/dist/types/gl/{physicsEvents.d.ts → physics/physicsEvents.d.ts} +0 -0
@@ -11,6 +11,19 @@ export declare function openFilePicker(options: OpenFilePickerOptions & {
11
11
  /** Anything writable as-is: text, raw bytes, or a buffer the host already holds
12
12
  * (a picked `File`, a `FetchResponse`, a `Canvas.toFile()` snapshot). */
13
13
  export type FileData = string | Uint8Array | ArrayBuffer | File | FetchResponse;
14
+ /** One directory entry, as `files.ls` / `files.stat` report it. */
15
+ export type FileEntry = {
16
+ /** The last path segment. */
17
+ name: string;
18
+ /** Relative to the listed directory, `/`-separated — equal to `name` unless the listing was
19
+ * recursive. Join it onto the directory you listed to read the file. */
20
+ path: string;
21
+ kind: "file" | "dir";
22
+ /** Bytes; 0 for a directory. */
23
+ size: number;
24
+ /** Last modification, ms since the epoch (a `Date` value). */
25
+ modified: number;
26
+ };
14
27
  export declare const files: {
15
28
  /** Is there a filesystem here (desktop)? False on web/mobile, where every other call rejects. */
16
29
  readonly supported: boolean;
@@ -24,10 +37,20 @@ export declare const files: {
24
37
  readBytes(path: string): Promise<Uint8Array | null>;
25
38
  /** Delete a file, or a directory (empty, or any directory with `{ recursive: true }`). Deleting
26
39
  * something already gone is success — what's promised is that the path is free afterwards. */
27
- delete(path: string, options?: {
40
+ rm(path: string, options?: {
28
41
  recursive?: boolean;
29
42
  }): Promise<void>;
30
43
  /** Create a directory and any missing parents. An existing directory is fine. */
31
44
  mkdir(path: string): Promise<void>;
45
+ /** The entries of a directory, sorted by path — null when there is no such directory (an empty
46
+ * one is `[]`, so `(await files.ls("saves")) ?? []` covers both). `{ recursive: true }` walks
47
+ * the subfolders too; each entry's `path` is then relative to the directory listed. A path that
48
+ * is a file, not a directory, rejects. Filter in JS — `entries.filter(e => e.name.endsWith(".json"))`. */
49
+ ls(path: string, options?: {
50
+ recursive?: boolean;
51
+ }): Promise<FileEntry[] | null>;
52
+ /** What is at `path`: a file or a directory entry (`path` equal to `name`), or null when nothing
53
+ * is there — `(await files.stat(p)) !== null` is the exists check. */
54
+ stat(path: string): Promise<FileEntry | null>;
32
55
  };
33
56
  export {};
@@ -5,10 +5,10 @@ import { Scene, type SceneOptions } from "../gl/Scene";
5
5
  import { Node } from "../gl/Node";
6
6
  import { Mesh } from "../gl/Mesh";
7
7
  import { Model } from "../gl/Model";
8
- import { type TerrainLayer, type TerrainRegion, type TerrainOptions } from "../gl/Terrain";
8
+ import { type TerrainLayer, type TerrainRegion, type TerrainOptions } from "../gl/terrain/Terrain";
9
9
  import { Light, type SunOptions } from "../gl/Light";
10
10
  import { type MaterialDef } from "./material";
11
- import type { CylinderOptions, PlaneOptions, SphereOptions } from "../gl/Geometry";
11
+ import type { CapsuleOptions, CylinderOptions, PlaneOptions, SphereOptions } from "../gl/Geometry";
12
12
  export type MeshDef = {
13
13
  kind: "box";
14
14
  size?: Vec3Like | number;
@@ -17,6 +17,8 @@ export type MeshDef = {
17
17
  } & SphereOptions) | ({
18
18
  kind: "cylinder";
19
19
  } & CylinderOptions) | ({
20
+ kind: "capsule";
21
+ } & CapsuleOptions) | ({
20
22
  kind: "plane";
21
23
  } & PlaneOptions);
22
24
  export type LightDef = {
@@ -173,6 +175,10 @@ export type SceneLightmapDef = {
173
175
  * ambient cube (2026-08-31) movers shade like the statics and the default is right; it stays as a
174
176
  * trim. See `LightmapLoadOptions.volumeBoost`. */
175
177
  volumeBoost?: number;
178
+ /** Occluder-only statics (props without lightmap UVs): `"baked"` (default) = their shadow is in the
179
+ * atlas, they stop casting in real time and the shadow pass draws only the movers; `"realtime"` =
180
+ * they keep casting (their shadow on other non-receiver props). See `LightmapLoadOptions.occluderShadows`. */
181
+ occluderShadows?: "baked" | "realtime";
176
182
  };
177
183
  /** `env.navmesh` — the level's navigation mesh (see navmesh.md): the file `lecodes navmesh bake`
178
184
  * writes, the agent size it is built for, and the named areas. Absent = no navigation. */
@@ -256,7 +262,8 @@ export type ModelPartRow = {
256
262
  * not parts, skipped. Filtering BEFORE segment math keeps `name[i]` indices stable no matter
257
263
  * what defs are parented in. */
258
264
  export declare const modelPartRows: (root: Node) => ModelPartRow[];
259
- /** The static verdict for one node def (the editor's "Baked lighting" switch shows the same rule). */
265
+ /** The static verdict for one node def (the editor's "Baked lighting" switch shows the same rule).
266
+ * Children of a mover are movers too — buildNodes carries that down, this is the node's own verdict. */
260
267
  export declare const isLightmapStatic: (def: SceneNodeDef) => boolean;
261
268
  /** Edit mode: play the preview pose on a model node (`editor: { clip, time }`) — idempotent, the
262
269
  * harness re-applies it on inspector edits. No clip = back to the rest pose. */