melonjs 19.7.1 → 19.9.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 (146) hide show
  1. package/README.md +21 -6
  2. package/build/application/application.d.ts.map +1 -1
  3. package/build/application/defaultApplicationSettings.d.ts +1 -0
  4. package/build/application/defaultApplicationSettings.d.ts.map +1 -1
  5. package/build/application/settings.d.ts +34 -0
  6. package/build/application/settings.d.ts.map +1 -1
  7. package/build/audio/audio.d.ts +1 -1
  8. package/build/audio/audio.d.ts.map +1 -1
  9. package/build/audio/backend.d.ts +21 -2
  10. package/build/audio/backend.d.ts.map +1 -1
  11. package/build/audio/playback.d.ts +8 -28
  12. package/build/audio/playback.d.ts.map +1 -1
  13. package/build/camera/camera3d.d.ts +49 -0
  14. package/build/camera/camera3d.d.ts.map +1 -1
  15. package/build/geometries/path2d.d.ts +188 -75
  16. package/build/geometries/path2d.d.ts.map +1 -1
  17. package/build/geometries/rectangle.d.ts.map +1 -1
  18. package/build/index.d.ts +11 -2
  19. package/build/index.d.ts.map +1 -1
  20. package/build/index.js +19170 -13625
  21. package/build/index.js.map +4 -4
  22. package/build/level/gltf/GLTFModel.d.ts +173 -0
  23. package/build/level/gltf/GLTFModel.d.ts.map +1 -0
  24. package/build/level/gltf/GLTFScene.d.ts +84 -0
  25. package/build/level/gltf/GLTFScene.d.ts.map +1 -0
  26. package/build/level/gltf/gltf_sampler.d.ts +49 -0
  27. package/build/level/gltf/gltf_sampler.d.ts.map +1 -0
  28. package/build/level/level.d.ts +7 -3
  29. package/build/level/level.d.ts.map +1 -1
  30. package/build/level/tiled/TMXTileMap.d.ts +5 -0
  31. package/build/level/tiled/TMXTileMap.d.ts.map +1 -1
  32. package/build/{renderable → lighting}/light2d.d.ts +79 -78
  33. package/build/lighting/light2d.d.ts.map +1 -0
  34. package/build/lighting/light3d.d.ts +86 -0
  35. package/build/lighting/light3d.d.ts.map +1 -0
  36. package/build/loader/cache.d.ts +2 -0
  37. package/build/loader/cache.d.ts.map +1 -1
  38. package/build/loader/loader.d.ts +156 -8
  39. package/build/loader/loader.d.ts.map +1 -1
  40. package/build/loader/parsers/fetchdata.d.ts +14 -0
  41. package/build/loader/parsers/fetchdata.d.ts.map +1 -1
  42. package/build/loader/parsers/gltf.d.ts +71 -0
  43. package/build/loader/parsers/gltf.d.ts.map +1 -0
  44. package/build/loader/parsers/mtl.d.ts.map +1 -1
  45. package/build/loader/parsers/shader.d.ts +47 -0
  46. package/build/loader/parsers/shader.d.ts.map +1 -0
  47. package/build/loader/parsers/video.d.ts.map +1 -1
  48. package/build/math/color.d.ts.map +1 -1
  49. package/build/math/math.d.ts +2 -2
  50. package/build/math/matrix2d.d.ts.map +1 -1
  51. package/build/math/noise.d.ts +141 -0
  52. package/build/math/noise.d.ts.map +1 -0
  53. package/build/math/observableVector2d.d.ts +1 -1
  54. package/build/math/observableVector2d.d.ts.map +1 -1
  55. package/build/math/observableVector3d.d.ts +1 -1
  56. package/build/math/observableVector3d.d.ts.map +1 -1
  57. package/build/math/vector2d.d.ts +1 -1
  58. package/build/math/vector2d.d.ts.map +1 -1
  59. package/build/math/vector3d.d.ts +1 -1
  60. package/build/math/vector3d.d.ts.map +1 -1
  61. package/build/math/vertex.d.ts +25 -0
  62. package/build/math/vertex.d.ts.map +1 -1
  63. package/build/physics/adapter.d.ts +4 -3
  64. package/build/physics/adapter.d.ts.map +1 -1
  65. package/build/physics/broadphase/aabb3d.d.ts +23 -2
  66. package/build/physics/broadphase/aabb3d.d.ts.map +1 -1
  67. package/build/renderable/anchorPoint.d.ts +80 -0
  68. package/build/renderable/anchorPoint.d.ts.map +1 -0
  69. package/build/renderable/animation.d.ts +41 -0
  70. package/build/renderable/animation.d.ts.map +1 -0
  71. package/build/renderable/collectable.d.ts +7 -1
  72. package/build/renderable/collectable.d.ts.map +1 -1
  73. package/build/renderable/container.d.ts +0 -1
  74. package/build/renderable/container.d.ts.map +1 -1
  75. package/build/renderable/entity/entity.d.ts +5 -2
  76. package/build/renderable/entity/entity.d.ts.map +1 -1
  77. package/build/renderable/frameAnimation.d.ts +154 -0
  78. package/build/renderable/frameAnimation.d.ts.map +1 -0
  79. package/build/renderable/imagelayer.d.ts +5 -2
  80. package/build/renderable/imagelayer.d.ts.map +1 -1
  81. package/build/renderable/mesh.d.ts +175 -6
  82. package/build/renderable/mesh.d.ts.map +1 -1
  83. package/build/renderable/nineslicesprite.d.ts +5 -7
  84. package/build/renderable/nineslicesprite.d.ts.map +1 -1
  85. package/build/renderable/renderable.d.ts +28 -1
  86. package/build/renderable/renderable.d.ts.map +1 -1
  87. package/build/renderable/sprite.d.ts +84 -34
  88. package/build/renderable/sprite.d.ts.map +1 -1
  89. package/build/renderable/sprite3d.d.ts +350 -0
  90. package/build/renderable/sprite3d.d.ts.map +1 -0
  91. package/build/renderable/text/bitmaptext.d.ts +24 -12
  92. package/build/renderable/text/bitmaptext.d.ts.map +1 -1
  93. package/build/renderable/text/bitmaptextdata.d.ts +24 -1
  94. package/build/renderable/text/bitmaptextdata.d.ts.map +1 -1
  95. package/build/renderable/text/text.d.ts +50 -12
  96. package/build/renderable/text/text.d.ts.map +1 -1
  97. package/build/state/stage.d.ts +20 -1
  98. package/build/state/stage.d.ts.map +1 -1
  99. package/build/system/event.d.ts +18 -2
  100. package/build/system/event.d.ts.map +1 -1
  101. package/build/video/buffer/vertex.d.ts +7 -0
  102. package/build/video/buffer/vertex.d.ts.map +1 -1
  103. package/build/video/canvas/canvas_renderer.d.ts +4 -0
  104. package/build/video/canvas/canvas_renderer.d.ts.map +1 -1
  105. package/build/video/renderer.d.ts +62 -1
  106. package/build/video/renderer.d.ts.map +1 -1
  107. package/build/video/rendertarget/render_target_pool.d.ts +17 -6
  108. package/build/video/rendertarget/render_target_pool.d.ts.map +1 -1
  109. package/build/video/texture/atlas.d.ts +3 -2
  110. package/build/video/texture/atlas.d.ts.map +1 -1
  111. package/build/video/texture/cache.d.ts +55 -6
  112. package/build/video/texture/cache.d.ts.map +1 -1
  113. package/build/video/texture/frametexture.d.ts +73 -0
  114. package/build/video/texture/frametexture.d.ts.map +1 -0
  115. package/build/video/texture/noise_texture2d.d.ts +176 -0
  116. package/build/video/texture/noise_texture2d.d.ts.map +1 -0
  117. package/build/video/texture/parser/aseprite.d.ts.map +1 -1
  118. package/build/video/texture/texture2d.d.ts +83 -0
  119. package/build/video/texture/texture2d.d.ts.map +1 -0
  120. package/build/video/webgl/batchers/batcher.d.ts.map +1 -1
  121. package/build/video/webgl/batchers/lit_mesh_batcher.d.ts +18 -0
  122. package/build/video/webgl/batchers/lit_mesh_batcher.d.ts.map +1 -0
  123. package/build/video/webgl/batchers/lit_quad_batcher.d.ts +30 -4
  124. package/build/video/webgl/batchers/lit_quad_batcher.d.ts.map +1 -1
  125. package/build/video/webgl/batchers/material_batcher.d.ts +39 -3
  126. package/build/video/webgl/batchers/material_batcher.d.ts.map +1 -1
  127. package/build/video/webgl/batchers/mesh_batcher.d.ts +52 -11
  128. package/build/video/webgl/batchers/mesh_batcher.d.ts.map +1 -1
  129. package/build/video/webgl/batchers/primitive_batcher.d.ts.map +1 -1
  130. package/build/video/webgl/batchers/quad_batcher.d.ts.map +1 -1
  131. package/build/video/webgl/buffer/index.d.ts +13 -0
  132. package/build/video/webgl/buffer/index.d.ts.map +1 -1
  133. package/build/video/webgl/effects/hologram.d.ts +0 -5
  134. package/build/video/webgl/effects/hologram.d.ts.map +1 -1
  135. package/build/video/webgl/effects/shine.d.ts +1 -6
  136. package/build/video/webgl/effects/shine.d.ts.map +1 -1
  137. package/build/video/webgl/glshader.d.ts +29 -0
  138. package/build/video/webgl/glshader.d.ts.map +1 -1
  139. package/build/video/webgl/lighting/pack3d.d.ts +32 -0
  140. package/build/video/webgl/lighting/pack3d.d.ts.map +1 -0
  141. package/build/video/webgl/shadereffect.d.ts +183 -0
  142. package/build/video/webgl/shadereffect.d.ts.map +1 -1
  143. package/build/video/webgl/webgl_renderer.d.ts +59 -1
  144. package/build/video/webgl/webgl_renderer.d.ts.map +1 -1
  145. package/package.json +5 -5
  146. package/build/renderable/light2d.d.ts.map +0 -1
@@ -0,0 +1,86 @@
1
+ import { Color } from "../math/color.ts";
2
+ import { Vector3d } from "../math/vector3d.ts";
3
+ import Renderable from "../renderable/renderable.js";
4
+ /**
5
+ * Options accepted by the {@link Light3d} constructor.
6
+ * @category Lighting
7
+ */
8
+ export interface Light3dOptions {
9
+ /**
10
+ * light type. `"directional"` (a sun — shaded) and `"ambient"` (a flat fill
11
+ * added to every lit pixel) are used today; `"point"` is reserved.
12
+ */
13
+ type?: "directional" | "ambient" | "point";
14
+ /** world-space direction the light travels along (directional lights). */
15
+ direction?: [number, number, number];
16
+ /** world-space position (point lights — reserved for a future release). */
17
+ position?: [number, number, number];
18
+ /**
19
+ * light color — a {@link Color}, a CSS color string, or an `[r, g, b]`
20
+ * array with components in `0..1` (the glTF convention). Defaults to white.
21
+ */
22
+ color?: Color | string | [number, number, number];
23
+ /** scalar multiplier on the light's contribution. Defaults to `1`. */
24
+ intensity?: number;
25
+ }
26
+ /**
27
+ * A 3D light source for the mesh lighting path — the 3D counterpart of
28
+ * {@link Light2d}. Like `Light2d`, a `Light3d` is a world {@link Renderable}:
29
+ * add it to a container with `app.world.addChild(light)` and it auto-registers
30
+ * with the active {@link Stage}, so any lit mesh in that scene is shaded by it.
31
+ * Remove it from the world to turn it off. A light draws nothing itself.
32
+ *
33
+ * Two types are used today:
34
+ * - **`"directional"`** — a sun: a world-space `direction`, no falloff. Shaded
35
+ * via half-Lambert diffuse.
36
+ * - **`"ambient"`** — a flat fill added to every lit pixel (the dark side of a
37
+ * mesh never goes fully black). `direction` / `position` are ignored.
38
+ *
39
+ * `"point"` is reserved for a future release. Fields are public and mutable, so
40
+ * a light can be animated at runtime (e.g. a day/night cycle rotating
41
+ * `direction`, or fading `intensity`).
42
+ * @category Lighting
43
+ * @example
44
+ * import { Light3d } from "melonjs";
45
+ *
46
+ * // a sun + a soft ambient fill, added to the world like any renderable
47
+ * const sun = new Light3d({ direction: [0.3, 1, 0.2], color: "#fff" });
48
+ * app.world.addChild(sun);
49
+ * app.world.addChild(new Light3d({ type: "ambient", intensity: 0.3 }));
50
+ *
51
+ * // animate the sun in-game (direction is the way light travels)
52
+ * sun.direction.set(Math.sin(t), 1, Math.cos(t)).normalize();
53
+ */
54
+ export declare class Light3d extends Renderable {
55
+ /** `"directional"` / `"ambient"` (shaded) or `"point"` (reserved). */
56
+ type: "directional" | "ambient" | "point";
57
+ /** world-space travel direction (directional lights); kept normalized. */
58
+ direction: Vector3d;
59
+ /** world-space position (point lights — reserved). */
60
+ position: Vector3d;
61
+ /** the light color. */
62
+ color: Color;
63
+ /** scalar multiplier on the light's contribution. */
64
+ intensity: number;
65
+ /**
66
+ * @param [options] - see {@link Light3dOptions}
67
+ */
68
+ constructor(options?: Light3dOptions);
69
+ /**
70
+ * Register with the active stage's 3D-light set on activation (when added to
71
+ * a rooted container), mirroring {@link Light2d}.
72
+ * @ignore
73
+ */
74
+ onActivateEvent(): void;
75
+ /**
76
+ * Deregister from the active stage when removed from the world.
77
+ * @ignore
78
+ */
79
+ onDeactivateEvent(): void;
80
+ /**
81
+ * A light has no visual representation.
82
+ * @ignore
83
+ */
84
+ draw(): void;
85
+ }
86
+ //# sourceMappingURL=light3d.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"light3d.d.ts","sourceRoot":"","sources":["../../src/lighting/light3d.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACzC,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAC/C,OAAO,UAAU,MAAM,6BAA6B,CAAC;AAGrD;;;GAGG;AACH,MAAM,WAAW,cAAc;IAC9B;;;OAGG;IACH,IAAI,CAAC,EAAE,aAAa,GAAG,SAAS,GAAG,OAAO,CAAC;IAC3C,0EAA0E;IAC1E,SAAS,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;IACrC,2EAA2E;IAC3E,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;IACpC;;;OAGG;IACH,KAAK,CAAC,EAAE,KAAK,GAAG,MAAM,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;IAClD,sEAAsE;IACtE,SAAS,CAAC,EAAE,MAAM,CAAC;CACnB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,qBAAa,OAAQ,SAAQ,UAAU;IACtC,sEAAsE;IAC7D,IAAI,EAAE,aAAa,GAAG,SAAS,GAAG,OAAO,CAAC;IACnD,0EAA0E;IAC1E,SAAS,EAAE,QAAQ,CAAC;IACpB,sDAAsD;IACtD,QAAQ,EAAE,QAAQ,CAAC;IACnB,uBAAuB;IACvB,KAAK,EAAE,KAAK,CAAC;IACb,qDAAqD;IACrD,SAAS,EAAE,MAAM,CAAC;IAElB;;OAEG;gBACS,OAAO,GAAE,cAAmB;IAgDxC;;;;OAIG;IACM,eAAe;IAIxB;;;OAGG;IACM,iBAAiB;IAI1B;;;OAGG;IACM,IAAI;CACb"}
@@ -9,4 +9,6 @@ export const videoList: {};
9
9
  export const fontList: {};
10
10
  export const objList: {};
11
11
  export const mtlList: {};
12
+ export const gltfList: {};
13
+ export const shaderList: {};
12
14
  //# sourceMappingURL=cache.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"cache.d.ts","sourceRoot":"","sources":["../../src/loader/cache.js"],"names":[],"mappings":"AAAA;;GAEG;AAGH,yBAA0B;AAG1B,yBAA0B;AAG1B,yBAA0B;AAG1B,0BAA2B;AAG3B,2BAA4B;AAG5B,0BAA2B;AAG3B,yBAA0B;AAG1B,yBAA0B"}
1
+ {"version":3,"file":"cache.d.ts","sourceRoot":"","sources":["../../src/loader/cache.js"],"names":[],"mappings":"AAAA;;GAEG;AAGH,yBAA0B;AAG1B,yBAA0B;AAG1B,yBAA0B;AAG1B,0BAA2B;AAG3B,2BAA4B;AAG5B,0BAA2B;AAG3B,yBAA0B;AAG1B,yBAA0B;AAG1B,0BAA2B;AAK3B,4BAA6B"}
@@ -32,7 +32,7 @@ export function setOptions(options: {
32
32
  * @name setBaseURL
33
33
  * @memberof loader
34
34
  * @public
35
- * @param {string} type - "*", "audio", "video", "binary", "image", "json", "js", "tmx", "tsx", "fontface", "aseprite"
35
+ * @param {string} type - "*", "audio", "video", "binary", "image", "json", "js", "tmx", "tsx", "fontface", "aseprite", "shader"
36
36
  * @param {string} [url="./"] - default base URL
37
37
  * @example
38
38
  * // change the base URL relative address for audio assets
@@ -47,11 +47,11 @@ export function setBaseURL(type: string, url?: string): void;
47
47
  * @typedef {object} Asset
48
48
  * @memberof loader
49
49
  * @property {string} name - name of the asset
50
- * @property {string} type - the type of the asset ("audio"|"binary"|"image"|"json"|"js"|"tmx"|"tmj"|"tsx"|"tsj"|"fontface"|"video"|"aseprite")
50
+ * @property {string} type - the type of the asset ("audio"|"binary"|"image"|"json"|"js"|"tmx"|"tmj"|"tsx"|"tsj"|"fontface"|"video"|"aseprite"|"shader")
51
51
  * @property {string|string[]} [src] - path and/or file name of the resource (for audio assets only the path is required).
52
52
  * For image assets, an array of sources can be provided as a fallback chain (e.g. compressed texture formats by priority, with a PNG fallback).
53
53
  * The loader will try each source in order and use the first one that loads successfully.
54
- * @property {string} [data] - TMX data if not provided through a src url
54
+ * @property {string} [data] - inline content if not provided through a src url: TMX data for "tmx" assets, GLSL source (the ShaderEffect fragment-body convention) for "shader" assets
55
55
  * @property {boolean} [stream=false] - Set to true to not to wait for large audio or video file to be downloaded before playing.
56
56
  * @property {boolean} [autoplay=false] - Set to true to automatically start playing audio or video when loaded or added to a scene (using autoplay might require user iteraction to enable it)
57
57
  * @property {boolean} [loop=false] - Set to true to automatically loop the audio or video when playing
@@ -118,6 +118,9 @@ export function setParser(type: string, parserFn: Function): void;
118
118
  * @param {Asset[]} assets - list of assets to load
119
119
  * @param {Function} [onloadcb=loader.onload] - function to be called when all resources are loaded
120
120
  * @param {boolean} [switchToLoadState=true] - automatically switch to the loading screen
121
+ * @returns {Promise<void>} resolves once every asset has loaded (rejects on a
122
+ * load failure). The `onloadcb` callback is still invoked on success, so both
123
+ * the callback and `await` forms work — use whichever you prefer.
121
124
  * @example
122
125
  * game.assets = [
123
126
  * // PNG tileset
@@ -154,11 +157,13 @@ export function setParser(type: string, parserFn: Function): void;
154
157
  * me.loader.load({name: "avatar", type:"video", src: "data:video/mp4;base64,AAAAIGZ0eXBpc29tAAACAGlzb21pc28yYXZjMW1wNDEAAAAIZnJlZ..."};
155
158
  * ];
156
159
  * ...
157
- * // set all resources to be loaded
160
+ * // set all resources to be loaded (callback form)
158
161
  * me.loader.preload(game.assets, () => this.loaded());
162
+ * // ...or await it (the callback still fires too)
163
+ * await me.loader.preload(game.assets);
159
164
  * @category Assets
160
165
  */
161
- export function preload(assets: Asset[], onloadcb?: Function, switchToLoadState?: boolean): void;
166
+ export function preload(assets: Asset[], onloadcb?: Function, switchToLoadState?: boolean): Promise<void>;
162
167
  /**
163
168
  * retry loading assets after a loading failure
164
169
  * @memberof loader
@@ -182,10 +187,15 @@ export function reload(src: string): void;
182
187
  * @param {Asset} asset
183
188
  * @param {Function} [onload] - function to be called when the asset is loaded
184
189
  * @param {Function} [onerror] - function to be called in case of error
185
- * @returns {number} the amount of corresponding resource to be preloaded
190
+ * @returns {number|Promise<void>} with `onload`/`onerror` provided, the amount
191
+ * of corresponding resource to be preloaded (the legacy callback form). With
192
+ * **both omitted**, a Promise that resolves once the asset has loaded, so you
193
+ * can `await loader.load(asset)` for a one-off dynamic load.
186
194
  * @example
187
- * // load an image asset
195
+ * // load an image asset (callback form)
188
196
  * me.loader.load({name: "avatar", type:"image", src: "data/avatar.png"}, () => this.onload(), () => this.onerror());
197
+ * // ...or await a single dynamic asset (no callbacks)
198
+ * await me.loader.load({name: "avatar", type: "image", src: "data/avatar.png"});
189
199
  * // load a compressed texture with fallback chain
190
200
  * me.loader.load({name: "terrain", type:"image", src: ["data/gfx/terrain.astc.ktx", "data/gfx/terrain.dds", "data/gfx/terrain.png"]}, () => this.onload());
191
201
  * // load a base64 image asset
@@ -206,7 +216,7 @@ export function reload(src: string): void;
206
216
  * });
207
217
  * @category Assets
208
218
  */
209
- export function load(asset: Asset, onload?: Function, onerror?: Function): number;
219
+ export function load(asset: Asset, onload?: Function, onerror?: Function): number | Promise<void>;
210
220
  /**
211
221
  * unload the specified asset to free memory
212
222
  * @memberof loader
@@ -285,6 +295,110 @@ export function getJSON(elt: string): JSON;
285
295
  * });
286
296
  */
287
297
  export function getOBJ(elt: string): object;
298
+ /**
299
+ * a parsed glTF/GLB scene descriptor, as returned by {@link loader.getGLTF}
300
+ * @typedef {object} GLTFData
301
+ * @property {object[]} nodes - one entry per mesh primitive (accumulated `world` transform, `vertices`, `normals`, `uvs`, `indices`, `vertexCount`, decoded baseColor `image`, `doubleSided`)
302
+ * @property {Array<{world: number[], type?: string, perspective?: {yfov?: number, aspectRatio?: number, znear?: number, zfar?: number}, orthographic?: object}>} cameras - glTF cameras, each with its `world` transform + the glTF camera parameters (`perspective` for perspective cameras, `orthographic` otherwise)
303
+ * @property {object[]} lights - parsed `KHR_lights_punctual` lights (`type`, `color`, `intensity`, `range`, world-space `direction`/`position`, `name`)
304
+ * @property {{min: number[], max: number[]}} bounds - world-space scene bounds in glTF units
305
+ */
306
+ /**
307
+ * return the parsed glTF/GLB scene descriptor for the given asset name.
308
+ *
309
+ * The descriptor is `{ nodes, cameras, lights, bounds }`:
310
+ * - `nodes` — one entry per mesh primitive, each carrying its accumulated
311
+ * `world` transform (16 floats, column-major), `vertices`, `normals`,
312
+ * `uvs`, `indices`, `vertexCount`, a decoded baseColor `image` (or `null`),
313
+ * and a `doubleSided` flag.
314
+ * - `cameras` — glTF cameras, each with its `world` transform + perspective
315
+ * parameters.
316
+ * - `lights` — parsed `KHR_lights_punctual` lights (`type`, `color`,
317
+ * `intensity`, world-space `direction`/`position`); empty without the
318
+ * extension. The level director instantiates directional ones automatically.
319
+ * - `bounds` — world-space `{ min, max }` (glTF units), handy for framing.
320
+ *
321
+ * Most code never needs this: a preloaded glTF/GLB auto-registers with the
322
+ * {@link level} director, so the whole scene loads into a container in one
323
+ * call via `me.level.load(name)` — exactly like a Tiled map. Reach for
324
+ * `getGLTF` only when you want to inspect the raw descriptor (e.g. to frame
325
+ * a `Camera3d` from the embedded camera).
326
+ * @memberof loader
327
+ * @param {string} elt - name of the glTF/GLB file (as specified in the preload list)
328
+ * @returns {GLTFData|null} the parsed scene descriptor, or `null` if not found
329
+ * @category Assets
330
+ * @example
331
+ * me.loader.preload(
332
+ * [{ name: "diorama", type: "glb", src: "scenes/diorama.glb" }],
333
+ * () => {
334
+ * // load the whole scene into the world (view under a Camera3d)
335
+ * me.level.load("diorama", { scale: 32 });
336
+ *
337
+ * // ...or inspect the raw descriptor for custom framing
338
+ * const scene = me.loader.getGLTF("diorama");
339
+ * const { min, max } = scene.bounds;
340
+ * },
341
+ * );
342
+ */
343
+ export function getGLTF(elt: string): GLTFData | null;
344
+ /**
345
+ * Return the precompiled `ShaderEffect` for the given "shader" asset —
346
+ * compiled once during preloading, ready to assign to a renderable or
347
+ * camera `shader` property.
348
+ *
349
+ * **This returns a SHARED instance**: the *same* `ShaderEffect` object on
350
+ * every call, owned by the loader (its `shared` flag is `true`). That means:
351
+ * - it is safe to assign to any number of renderables — none of their
352
+ * cleanup paths will auto-destroy it, only {@link loader.unload} /
353
+ * {@link loader.unloadAll} free it (and its GL program);
354
+ * - all of them share ONE set of uniform values — `setUniform` on it
355
+ * affects every renderable using the shader.
356
+ *
357
+ * When a renderable needs its **own** uniform values, make a private,
358
+ * caller-owned copy with `ShaderEffect.clone()` — the clone's `shared` flag
359
+ * is reset to `false`, so it is auto-destroyed with the renderable it is
360
+ * assigned to, like any hand-constructed effect.
361
+ *
362
+ * A shader asset declared as a **`{vertex, fragment}` program pair** (see
363
+ * the example) compiles into a raw {@link GLShader} instead — the type the
364
+ * advanced paths take directly (a `Mesh` custom shader,
365
+ * `renderer.customShader`, a custom batcher). Same shared-instance
366
+ * semantics, and `GLShader.clone()` likewise yields a caller-owned copy.
367
+ *
368
+ * Shader assets are WebGL-only: under the Canvas renderer a fragment-body
369
+ * asset returns an inert `ShaderEffect` stub (same behavior as constructing
370
+ * one directly), and a program-pair asset returns `null` (a raw GL program
371
+ * has no canvas analog). Note that shader assets require `video.init()` to
372
+ * have been called — an inherent precondition of the preload flow, since
373
+ * the loading screen itself needs the renderer.
374
+ * @memberof loader
375
+ * @param {string} elt - name of the shader asset (as specified in the preload list)
376
+ * @returns {ShaderEffect|GLShader|null} the shared, precompiled shader, or `null` if not found
377
+ * @category Assets
378
+ * @example
379
+ * me.loader.preload([
380
+ * // from a file (or data: URI)
381
+ * { name: "waterRipple", type: "shader", src: "shaders/waterRipple.frag" },
382
+ * // or inline GLSL via the `data` field
383
+ * { name: "flash", type: "shader", data: `
384
+ * uniform float uIntensity;
385
+ * vec4 apply(vec4 color, vec2 uv) { return mix(color, vec4(1.0), uIntensity); }
386
+ * ` },
387
+ * // or a complete {vertex, fragment} program pair → a raw GLShader
388
+ * { name: "toonMesh", type: "shader", src: {
389
+ * vertex: "shaders/toon.vert",
390
+ * fragment: "shaders/toon.frag",
391
+ * } },
392
+ * ], () => {
393
+ * // one shared program — same uniform state for every user
394
+ * mySprite.shader = me.loader.getShader("waterRipple");
395
+ * // private copy with its own uniforms (caller-owned, shared = false)
396
+ * boss.shader = me.loader.getShader("flash").clone();
397
+ * // a program pair comes back as a GLShader, e.g. for a custom Mesh shader
398
+ * renderer.drawMesh(myMesh, { shader: me.loader.getShader("toonMesh") });
399
+ * });
400
+ */
401
+ export function getShader(elt: string): ShaderEffect | GLShader | null;
288
402
  /**
289
403
  * return the specified MTL material data
290
404
  * @memberof loader
@@ -419,4 +533,38 @@ export let onError: Function;
419
533
  * an asset definition to be used with the loader
420
534
  */
421
535
  export type Asset = object;
536
+ /**
537
+ * a parsed glTF/GLB scene descriptor, as returned by {@link loader.getGLTF}
538
+ */
539
+ export type GLTFData = {
540
+ /**
541
+ * - one entry per mesh primitive (accumulated `world` transform, `vertices`, `normals`, `uvs`, `indices`, `vertexCount`, decoded baseColor `image`, `doubleSided`)
542
+ */
543
+ nodes: object[];
544
+ /**
545
+ * - glTF cameras, each with its `world` transform + the glTF camera parameters (`perspective` for perspective cameras, `orthographic` otherwise)
546
+ */
547
+ cameras: Array<{
548
+ world: number[];
549
+ type?: string;
550
+ perspective?: {
551
+ yfov?: number;
552
+ aspectRatio?: number;
553
+ znear?: number;
554
+ zfar?: number;
555
+ };
556
+ orthographic?: object;
557
+ }>;
558
+ /**
559
+ * - parsed `KHR_lights_punctual` lights (`type`, `color`, `intensity`, `range`, world-space `direction`/`position`, `name`)
560
+ */
561
+ lights: object[];
562
+ /**
563
+ * - world-space scene bounds in glTF units
564
+ */
565
+ bounds: {
566
+ min: number[];
567
+ max: number[];
568
+ };
569
+ };
422
570
  //# sourceMappingURL=loader.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"loader.d.ts","sourceRoot":"","sources":["../../src/loader/loader.js"],"names":[],"mappings":"AAmFA;;;GAGG;AACH,mDAEC;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,oCAdG;IAAyB,WAAW;IACV,OAAO;IACP,eAAe;CACzC,QAqBF;AAED;;;;;;;;;;;;;;GAcG;AACH,iCATW,MAAM,QACN,MAAM,QAwBhB;AAiID;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8CG;AAEH;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,gCAnBW,MAAM,4BA6BhB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CG;AACH,gCA3CW,KAAK,EAAE,2CAEP,OAAO,QAiFjB;AAED;;;;;;;;;;;;;;;IAeI;AACJ,4BAbW,MAAM,QAqChB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,4BA3BW,KAAK,0CAGH,MAAM,CA4DlB;AAED;;;;;;;GAOG;AACH,8BALW,KAAK,GACH,OAAO,CAiGnB;AAED;;;;;GAKG;AACH,kCAqFC;AAED;;;;;;GAMG;AACH,4BAJW,MAAM,GACJ,MAAM,CAUlB;AAED;;;;;;GAMG;AACH,+BAJW,MAAM,GACJ,MAAM,CAUlB;AAED;;;;;;GAMG;AACH,gCAJW,MAAM,GACJ,gBAAgB,GAAC,eAAe,GAAC,IAAI,CAWjD;AAED;;;;;;GAMG;AACH,6BAJW,MAAM,GACJ,IAAI,CAUhB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,4BA1BW,MAAM,GACJ,MAAM,CAgClB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,4BA1BW,MAAM,GACJ,MAAM,CA+BlB;AAED;;;;;;GAMG;AACH,8BAJW,MAAM,GACJ,gBAAgB,CAU5B;AAED;;;;;;GAMG;AACH,6BAJW,MAAM,GACJ,QAAQ,CAUpB;AAh4BD;;;GAGG;AAGH,2BAAwB;AAExB;;GAEG;AACH;;EAA0B;AAE1B;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAbU,MAAM,CAaO;AAEvB;;;;;;;;;;;;;;;;GAgBG;AACH,4BAbU,OAAO,CAakB;AAyEnC;;;;;;;;;GASG;AACH,4BAAkB;AAElB;;;;;;;;;;;GAWG;AACH,gCAAsB;AAEtB;;;;;;;;;;GAUG;AACH,6BAAmB;;;;oBA4FN,MAAM"}
1
+ {"version":3,"file":"loader.d.ts","sourceRoot":"","sources":["../../src/loader/loader.js"],"names":[],"mappings":"AAuFA;;;GAGG;AACH,mDAEC;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,oCAdG;IAAyB,WAAW;IACV,OAAO;IACP,eAAe;CACzC,QAqBF;AAED;;;;;;;;;;;;;;GAcG;AACH,iCATW,MAAM,QACN,MAAM,QAyBhB;AAqID;;;;;;;;;;;;;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M,GACJ,gBAAgB,CAU5B;AAED;;;;;;GAMG;AACH,6BAJW,MAAM,GACJ,QAAQ,CAUpB;AAzlCD;;;GAGG;AAGH,2BAAwB;AAExB;;GAEG;AACH;;EAA0B;AAE1B;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAbU,MAAM,CAaO;AAEvB;;;;;;;;;;;;;;;;GAgBG;AACH,4BAbU,OAAO,CAakB;AA0EnC;;;;;;;;;GASG;AACH,4BAAkB;AAElB;;;;;;;;;;;GAWG;AACH,gCAAsB;AAEtB;;;;;;;;;;GAUG;AACH,6BAAmB;;;;oBAgGN,MAAM;;;;;;;;WAiqBL,MAAM,EAAE;;;;aACR,KAAK,CAAC;QAAC,KAAK,EAAE,MAAM,EAAE,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,WAAW,CAAC,EAAE;YAAC,IAAI,CAAC,EAAE,MAAM,CAAC;YAAC,WAAW,CAAC,EAAE,MAAM,CAAC;YAAC,KAAK,CAAC,EAAE,MAAM,CAAC;YAAC,IAAI,CAAC,EAAE,MAAM,CAAA;SAAC,CAAC;QAAC,YAAY,CAAC,EAAE,MAAM,CAAA;KAAC,CAAC;;;;YAClJ,MAAM,EAAE;;;;YACR;QAAC,GAAG,EAAE,MAAM,EAAE,CAAC;QAAC,GAAG,EAAE,MAAM,EAAE,CAAA;KAAC"}
@@ -1,3 +1,17 @@
1
+ /**
2
+ * Whether `url` must be loaded over the `file:` scheme — either an absolute
3
+ * `file://` URL, or a relative URL resolved against a `file:` document (the
4
+ * case for a Cordova/Capacitor build packaged into an APK, where the app runs
5
+ * from `file://`). `fetch()` cannot load such URLs in several WebView contexts
6
+ * (it rejects with an opaque network error), whereas `XMLHttpRequest` can. The
7
+ * document `protocol` is injectable so the relative-URL branch is unit-testable
8
+ * (`location` is non-configurable in a real browser).
9
+ * @param {string} url
10
+ * @param {string} [protocol] - the hosting document's protocol
11
+ * @returns {boolean}
12
+ * @ignore
13
+ */
14
+ export function isFileProtocol(url: string, protocol?: string): boolean;
1
15
  /**
2
16
  * Fetches data from the specified URL.
3
17
  * @param {string} url - The URL to fetch the data from.
@@ -1 +1 @@
1
- {"version":3,"file":"fetchdata.d.ts","sourceRoot":"","sources":["../../../src/loader/parsers/fetchdata.js"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,+BAdW,MAAM,gBACN,MAAM,aACN,MAAM,gBAuChB"}
1
+ {"version":3,"file":"fetchdata.d.ts","sourceRoot":"","sources":["../../../src/loader/parsers/fetchdata.js"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,oCALW,MAAM,aACN,MAAM,GACJ,OAAO,CAKnB;AA2DD;;;;;;;;;;;;;;;GAeG;AACH,+BAdW,MAAM,gBACN,MAAM,aACN,MAAM,gBAkDhB"}
@@ -0,0 +1,71 @@
1
+ /**
2
+ * Split a GLB binary container into its JSON description and binary buffer.
3
+ * @param {ArrayBuffer} arrayBuffer
4
+ * @returns {{ json: object, bin: Uint8Array | null }}
5
+ * @ignore
6
+ */
7
+ export function parseGLB(arrayBuffer: ArrayBuffer): {
8
+ json: object;
9
+ bin: Uint8Array | null;
10
+ };
11
+ /**
12
+ * Read an accessor into a flat TypedArray (stride-aware, non-interleaved
13
+ * fast-path covered as a subset).
14
+ * @ignore
15
+ */
16
+ export function readAccessor(json: any, buffers: any, accessorIndex: any): any;
17
+ /**
18
+ * Compose a column-major 4x4 local matrix from translation / rotation
19
+ * (quaternion) / scale arrays — the glTF TRS convention — writing into `out`.
20
+ * In-place so the per-frame animation pose path allocates nothing.
21
+ * @param {number[]} out - 16-element destination (returned)
22
+ * @param {number[]} translation - [tx, ty, tz]
23
+ * @param {number[]} rotation - quaternion [qx, qy, qz, qw]
24
+ * @param {number[]} scale - [sx, sy, sz]
25
+ * @returns {number[]} `out`
26
+ * @ignore
27
+ */
28
+ export function composeTRSInto(out: number[], translation: number[], rotation: number[], scale: number[]): number[];
29
+ /**
30
+ * Allocating form of {@link composeTRSInto} — returns a fresh 16-element array.
31
+ * @param {number[]} translation - [tx, ty, tz]
32
+ * @param {number[]} rotation - quaternion [qx, qy, qz, qw]
33
+ * @param {number[]} scale - [sx, sy, sz]
34
+ * @returns {number[]} 16-element column-major matrix
35
+ * @ignore
36
+ */
37
+ export function composeTRS(translation: number[], rotation: number[], scale: number[]): number[];
38
+ /** Compose a node's local matrix from its `matrix` or TRS fields. @ignore */
39
+ export function nodeLocalMatrix(node: any): any;
40
+ /**
41
+ * Column-major 4x4 multiply `a * b`, writing into `out`. `out` must NOT alias
42
+ * `a` or `b` (results are written as they're computed). In-place so the
43
+ * per-frame pose path allocates nothing.
44
+ * @ignore
45
+ */
46
+ export function multiplyMatrixInto(out: any, a: any, b: any): any;
47
+ /** Allocating form of {@link multiplyMatrixInto}: `a * b` → fresh array. @ignore */
48
+ export function multiplyMatrix(a: any, b: any): any;
49
+ /**
50
+ * Parse a glTF/GLB ArrayBuffer into a flat, instantiable scene descriptor.
51
+ * @param {ArrayBuffer} arrayBuffer - the .glb / .gltf bytes
52
+ * @param {string} [baseURI] - the asset's own URL, used to resolve external
53
+ * `.bin` buffers and image files referenced by relative `uri`. Omit for a fully
54
+ * self-contained GLB (embedded buffers + data-URI / bufferView images).
55
+ * @param {object} [settings] - loader settings forwarded to `fetchData` for
56
+ * external resources (crossOrigin / withCredentials / nocache).
57
+ * @returns {Promise<object>} `{ nodes, cameras, lights, bounds, graph, animations }`
58
+ * @ignore
59
+ */
60
+ export function parseGLTF(arrayBuffer: ArrayBuffer, baseURI?: string, settings?: object): Promise<object>;
61
+ /**
62
+ * parse/preload a glTF/GLB file
63
+ * @param {loader.Asset} data - asset data
64
+ * @param {Function} [onload] - function to be called when the resource is loaded
65
+ * @param {Function} [onerror] - function to be called in case of error
66
+ * @param {Object} [settings] - Additional settings to be passed when loading the asset
67
+ * @returns {number} the amount of corresponding resource parsed/preloaded
68
+ * @ignore
69
+ */
70
+ export function preloadGLTF(data: loader.Asset, onload?: Function, onerror?: Function, settings?: Object): number;
71
+ //# sourceMappingURL=gltf.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gltf.d.ts","sourceRoot":"","sources":["../../../src/loader/parsers/gltf.js"],"names":[],"mappings":"AAyCA;;;;;GAKG;AACH,sCAJW,WAAW,GACT;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,UAAU,GAAG,IAAI,CAAA;CAAE,CAkCpD;AAmED;;;;GAIG;AACH,+EAgCC;AAqCD;;;;;;;;;;GAUG;AACH,oCAPW,MAAM,EAAE,eACR,MAAM,EAAE,YACR,MAAM,EAAE,SACR,MAAM,EAAE,GACN,MAAM,EAAE,CAoCpB;AAED;;;;;;;GAOG;AACH,wCANW,MAAM,EAAE,YACR,MAAM,EAAE,SACR,MAAM,EAAE,GACN,MAAM,EAAE,CAKpB;AAED,6EAA6E;AAC7E,gDASC;AAiED;;;;;GAKG;AACH,kEAWC;AAED,oFAAoF;AACpF,oDAEC;AAuED;;;;;;;;;;GAUG;AACH,uCATW,WAAW,YACX,MAAM,aAGN,MAAM,GAEJ,OAAO,CAAC,MAAM,CAAC,CA+X3B;AAED;;;;;;;;GAQG;AACH,kCAPW,MAAM,CAAC,KAAK,oDAGZ,MAAM,GACJ,MAAM,CA6BlB"}
@@ -1 +1 @@
1
- {"version":3,"file":"mtl.d.ts","sourceRoot":"","sources":["../../../src/loader/parsers/mtl.js"],"names":[],"mappings":"AA+HA;;;;;;;;GAQG;AACH,iCAPW,MAAM,CAAC,KAAK,oDAGZ,MAAM,GACJ,MAAM,CAyBlB"}
1
+ {"version":3,"file":"mtl.d.ts","sourceRoot":"","sources":["../../../src/loader/parsers/mtl.js"],"names":[],"mappings":"AAgJA;;;;;;;;GAQG;AACH,iCAPW,MAAM,CAAC,KAAK,oDAGZ,MAAM,GACJ,MAAM,CAuElB"}
@@ -0,0 +1,47 @@
1
+ /**
2
+ * compile a shader asset's source into its shared, loader-owned instance:
3
+ * a fragment body (the `apply()` convention) compiles into a
4
+ * {@link ShaderEffect}; a full `{vertex, fragment}` program pair compiles
5
+ * into a raw {@link GLShader} — for the advanced paths that take one (a
6
+ * `Mesh` custom shader, `renderer.customShader`, a custom batcher).
7
+ * Program pairs are WebGL-only: under the Canvas renderer a pair asset
8
+ * stores `null` (with a warning) — a raw GL program has no canvas analog,
9
+ * unlike ShaderEffect's inert Canvas stub.
10
+ * @param {string|{vertex: string, fragment: string, precision?: string}} source - the fragment body, or a complete program pair
11
+ * @returns {ShaderEffect|GLShader|null} the compiled asset, flagged `shared`
12
+ * @throws if called before `video.init()` (no renderer to compile against)
13
+ * @ignore
14
+ */
15
+ export function compileShaderAsset(source: string | {
16
+ vertex: string;
17
+ fragment: string;
18
+ precision?: string;
19
+ }): ShaderEffect | GLShader | null;
20
+ /**
21
+ * parse/preload a shader asset, from a `src` URL (or data: URI) or inline
22
+ * GLSL via the `data` field. Two source shapes are accepted:
23
+ *
24
+ * - a GLSL **fragment body** following the ShaderEffect convention (uniform
25
+ * declarations + `vec4 apply(vec4, vec2)`) → compiles into a shared
26
+ * {@link ShaderEffect};
27
+ * - a complete **program pair** — `src: {vertex: url, fragment: url}` or
28
+ * `data: {vertex: glsl, fragment: glsl}` — → compiles into a shared raw
29
+ * {@link GLShader}, for the advanced paths that take one (a `Mesh`
30
+ * custom shader, `renderer.customShader`, a custom batcher).
31
+ *
32
+ * Always compiled AT LOAD TIME, so the GLSL compile cost lands in the
33
+ * loading screen and compile errors carry the asset name. `video.init()`
34
+ * is an inherent precondition of the preload flow (the loading screen
35
+ * itself needs the renderer, and a failed init throws and halts) —
36
+ * loading a shader without it fails with a clear error.
37
+ * @param {loader.Asset} data - asset data
38
+ * @param {Function} [onload] - function to be called when the resource is loaded
39
+ * @param {Function} [onerror] - function to be called in case of error
40
+ * @param {Object} [settings] - Additional settings to be passed when loading the asset
41
+ * @returns {number} the amount of corresponding resource parsed/preloaded
42
+ * @ignore
43
+ */
44
+ export function preloadShader(data: loader.Asset, onload?: Function, onerror?: Function, settings?: Object): number;
45
+ import ShaderEffect from "../../video/webgl/shadereffect.js";
46
+ import GLShader from "../../video/webgl/glshader.js";
47
+ //# sourceMappingURL=shader.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shader.d.ts","sourceRoot":"","sources":["../../../src/loader/parsers/shader.js"],"names":[],"mappings":"AAeA;;;;;;;;;;;;;GAaG;AACH,2CALW,MAAM,GAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAA;CAAC,GAC3D,YAAY,GAAC,QAAQ,GAAC,IAAI,CAuCtC;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,oCAPW,MAAM,CAAC,KAAK,oDAGZ,MAAM,GACJ,MAAM,CAqGlB;yBA1LwB,mCAAmC;qBADvC,+BAA+B"}
@@ -1 +1 @@
1
- {"version":3,"file":"video.d.ts","sourceRoot":"","sources":["../../../src/loader/parsers/video.js"],"names":[],"mappings":"AAMA;;;;;;;;GAQG;AACH,mCAPW,MAAM,CAAC,KAAK,oDAGZ,MAAM,GACJ,MAAM,CAqFlB"}
1
+ {"version":3,"file":"video.d.ts","sourceRoot":"","sources":["../../../src/loader/parsers/video.js"],"names":[],"mappings":"AAMA;;;;;;;;GAQG;AACH,mCAPW,MAAM,CAAC,KAAK,oDAGZ,MAAM,GACJ,MAAM,CAkGlB"}
@@ -1 +1 @@
1
- {"version":3,"file":"color.d.ts","sourceRoot":"","sources":["../../src/math/color.ts"],"names":[],"mappings":"AA0MA;;;GAGG;AACH,qBAAa,KAAK;IACjB,OAAO,CAAC,cAAc,CAAe;IAErC;;;;;;OAMG;gBACS,CAAC,GAAE,KAAK,GAAG,MAAM,GAAG,MAAU,EAAE,CAAC,SAAI,EAAE,CAAC,SAAI,EAAE,KAAK,SAAM;IAcrE;;;OAGG;IACH,IAAI,CAAC,WAEJ;IAED;;;OAGG;IACH,IAAI,CAAC,CAAC,KAAK,QAAA,E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H,KAAK;IAKL;;;;OAIG;IACH,MAAM,CAAC,KAAK,SAAyB;IAKrC;;;OAGG;IACH,KAAK;IAIL;;;;OAIG;IACH,MAAM,CAAC,KAAK,SAAa;CAGzB;AAED,eAAO,MAAM,SAAS,gKAwBpB,CAAC"}
@@ -149,8 +149,8 @@ export declare function lerp(a: number, b: number, t: number): number;
149
149
  * After total elapsed time `t_total` (in seconds), the result
150
150
  * satisfies
151
151
  * `result = current + (target - current) * (1 - exp(-lambda * t_total))`
152
- * regardless of how `t_total` was split across `dt` calls. Same
153
- * algorithm as `THREE.MathUtils.damp` in Three.js.
152
+ * regardless of how `t_total` was split across `dt` calls — the standard
153
+ * frame-rate-independent exponential `damp` formulation.
154
154
  *
155
155
  * `lambda` is the decay rate in `1/seconds` — higher = snappier
156
156
  * convergence. A rule of thumb: `lambda = 5` reaches ≈ 99% of the
@@ -1 +1 @@
1
- {"version":3,"file":"matrix2d.d.ts","sourceRoot":"","sources":["../../src/math/matrix2d.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAC;AAE/C,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAEzC,KAAK,cAAc,GAChB,CAAC,QAAQ,CAAC,GACV,CAAC,QAAQ,CAAC,GACV,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,GAChD,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,GACxE,CAAC,SAAS,CAAC,GACX,EAAE,CAAC;AAcN;;;;;GAKG;AACH,qBAAa,QAAQ;IACpB;;OAEG;IACH,GAAG,EAAE,YAAY,CAAC;IAElB;;;OAGG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