melonjs 19.7.0 → 19.8.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.
- package/README.md +27 -13
- package/build/application/application.d.ts.map +1 -1
- package/build/application/defaultApplicationSettings.d.ts +1 -0
- package/build/application/defaultApplicationSettings.d.ts.map +1 -1
- package/build/application/settings.d.ts +34 -0
- package/build/application/settings.d.ts.map +1 -1
- package/build/camera/camera3d.d.ts +49 -0
- package/build/camera/camera3d.d.ts.map +1 -1
- package/build/index.d.ts +7 -2
- package/build/index.d.ts.map +1 -1
- package/build/index.js +17430 -14562
- package/build/index.js.map +4 -4
- package/build/level/gltf/GLTFModel.d.ts +173 -0
- package/build/level/gltf/GLTFModel.d.ts.map +1 -0
- package/build/level/gltf/GLTFScene.d.ts +84 -0
- package/build/level/gltf/GLTFScene.d.ts.map +1 -0
- package/build/level/gltf/gltf_sampler.d.ts +49 -0
- package/build/level/gltf/gltf_sampler.d.ts.map +1 -0
- package/build/level/level.d.ts +7 -3
- package/build/level/level.d.ts.map +1 -1
- package/build/level/tiled/TMXLayer.d.ts.map +1 -1
- package/build/level/tiled/TMXTileMap.d.ts +5 -0
- package/build/level/tiled/TMXTileMap.d.ts.map +1 -1
- package/build/{renderable → lighting}/light2d.d.ts +79 -78
- package/build/lighting/light2d.d.ts.map +1 -0
- package/build/lighting/light3d.d.ts +86 -0
- package/build/lighting/light3d.d.ts.map +1 -0
- package/build/loader/cache.d.ts +1 -0
- package/build/loader/cache.d.ts.map +1 -1
- package/build/loader/loader.d.ts +95 -5
- package/build/loader/loader.d.ts.map +1 -1
- package/build/loader/parsers/gltf.d.ts +71 -0
- package/build/loader/parsers/gltf.d.ts.map +1 -0
- package/build/loader/parsers/mtl.d.ts.map +1 -1
- package/build/math/math.d.ts +2 -2
- package/build/math/matrix3d.d.ts +1 -1
- package/build/math/vertex.d.ts +25 -0
- package/build/math/vertex.d.ts.map +1 -1
- package/build/physics/broadphase/aabb3d.d.ts +23 -2
- package/build/physics/broadphase/aabb3d.d.ts.map +1 -1
- package/build/renderable/animation.d.ts +41 -0
- package/build/renderable/animation.d.ts.map +1 -0
- package/build/renderable/container.d.ts +0 -1
- package/build/renderable/container.d.ts.map +1 -1
- package/build/renderable/frameAnimation.d.ts +154 -0
- package/build/renderable/frameAnimation.d.ts.map +1 -0
- package/build/renderable/mesh.d.ts +151 -6
- package/build/renderable/mesh.d.ts.map +1 -1
- package/build/renderable/renderable.d.ts +22 -0
- package/build/renderable/renderable.d.ts.map +1 -1
- package/build/renderable/sprite.d.ts +74 -28
- package/build/renderable/sprite.d.ts.map +1 -1
- package/build/renderable/sprite3d.d.ts +314 -0
- package/build/renderable/sprite3d.d.ts.map +1 -0
- package/build/renderable/ui/uitextbutton.d.ts +2 -1
- package/build/renderable/ui/uitextbutton.d.ts.map +1 -1
- package/build/state/stage.d.ts +20 -1
- package/build/state/stage.d.ts.map +1 -1
- package/build/video/buffer/vertex.d.ts +7 -0
- package/build/video/buffer/vertex.d.ts.map +1 -1
- package/build/video/renderer.d.ts +21 -0
- package/build/video/renderer.d.ts.map +1 -1
- package/build/video/texture/atlas.d.ts +1 -1
- package/build/video/webgl/batchers/lit_mesh_batcher.d.ts +18 -0
- package/build/video/webgl/batchers/lit_mesh_batcher.d.ts.map +1 -0
- package/build/video/webgl/batchers/lit_quad_batcher.d.ts.map +1 -1
- package/build/video/webgl/batchers/mesh_batcher.d.ts +52 -11
- package/build/video/webgl/batchers/mesh_batcher.d.ts.map +1 -1
- package/build/video/webgl/effects/shine.d.ts +1 -1
- package/build/video/webgl/lighting/pack3d.d.ts +32 -0
- package/build/video/webgl/lighting/pack3d.d.ts.map +1 -0
- package/build/video/webgl/webgl_renderer.d.ts +18 -0
- package/build/video/webgl/webgl_renderer.d.ts.map +1 -1
- package/package.json +2 -2
- 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
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package/build/loader/cache.d.ts
CHANGED
|
@@ -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"}
|
package/build/loader/loader.d.ts
CHANGED
|
@@ -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}
|
|
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,52 @@ 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;
|
|
288
344
|
/**
|
|
289
345
|
* return the specified MTL material data
|
|
290
346
|
* @memberof loader
|
|
@@ -419,4 +475,38 @@ export let onError: Function;
|
|
|
419
475
|
* an asset definition to be used with the loader
|
|
420
476
|
*/
|
|
421
477
|
export type Asset = object;
|
|
478
|
+
/**
|
|
479
|
+
* a parsed glTF/GLB scene descriptor, as returned by {@link loader.getGLTF}
|
|
480
|
+
*/
|
|
481
|
+
export type GLTFData = {
|
|
482
|
+
/**
|
|
483
|
+
* - one entry per mesh primitive (accumulated `world` transform, `vertices`, `normals`, `uvs`, `indices`, `vertexCount`, decoded baseColor `image`, `doubleSided`)
|
|
484
|
+
*/
|
|
485
|
+
nodes: object[];
|
|
486
|
+
/**
|
|
487
|
+
* - glTF cameras, each with its `world` transform + the glTF camera parameters (`perspective` for perspective cameras, `orthographic` otherwise)
|
|
488
|
+
*/
|
|
489
|
+
cameras: Array<{
|
|
490
|
+
world: number[];
|
|
491
|
+
type?: string;
|
|
492
|
+
perspective?: {
|
|
493
|
+
yfov?: number;
|
|
494
|
+
aspectRatio?: number;
|
|
495
|
+
znear?: number;
|
|
496
|
+
zfar?: number;
|
|
497
|
+
};
|
|
498
|
+
orthographic?: object;
|
|
499
|
+
}>;
|
|
500
|
+
/**
|
|
501
|
+
* - parsed `KHR_lights_punctual` lights (`type`, `color`, `intensity`, `range`, world-space `direction`/`position`, `name`)
|
|
502
|
+
*/
|
|
503
|
+
lights: object[];
|
|
504
|
+
/**
|
|
505
|
+
* - world-space scene bounds in glTF units
|
|
506
|
+
*/
|
|
507
|
+
bounds: {
|
|
508
|
+
min: number[];
|
|
509
|
+
max: number[];
|
|
510
|
+
};
|
|
511
|
+
};
|
|
422
512
|
//# sourceMappingURL=loader.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loader.d.ts","sourceRoot":"","sources":["../../src/loader/loader.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"loader.d.ts","sourceRoot":"","sources":["../../src/loader/loader.js"],"names":[],"mappings":"AAqFA;;;GAGG;AACH,mDAEC;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,oCAdG;IAAyB,WAAW;IACV,OAAO;IACP,eAAe;CACzC,QAqBF;AAED;;;;;;;;;;;;;;GAcG;AACH,iCATW,MAAM,QACN,MAAM,QAwBhB;AAoID;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8CG;AAEH;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,gCAnBW,MAAM,4BA6BhB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkDG;AACH,gCAhDW,KAAK,EAAE,2CAEP,OAAO,GACL,OAAO,CAAC,IAAI,CAAC,CAo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AAM,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"}
|
|
@@ -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":"
|
|
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"}
|
package/build/math/math.d.ts
CHANGED
|
@@ -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
|
|
153
|
-
*
|
|
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
|
package/build/math/matrix3d.d.ts
CHANGED
|
@@ -122,7 +122,7 @@ export declare class Matrix3d {
|
|
|
122
122
|
applyInverse(v: Vector3d | Vector2d): Vector2d | Vector3d;
|
|
123
123
|
/**
|
|
124
124
|
* generate an orthogonal projection matrix, with the result replacing the current matrix
|
|
125
|
-
* <img src="images/
|
|
125
|
+
* <img src="images/glortho.gif"/><br>
|
|
126
126
|
* @param left - farthest left on the x-axis
|
|
127
127
|
* @param right - farthest right on the x-axis
|
|
128
128
|
* @param bottom - farthest down on the y-axis
|
package/build/math/vertex.d.ts
CHANGED
|
@@ -21,6 +21,31 @@ export declare function normalizeVertices(vertices: Float32Array): void;
|
|
|
21
21
|
* @param zScale - scale factor for Z output (0 = don't compute Z)
|
|
22
22
|
*/
|
|
23
23
|
export declare function projectVertices(src: Float32Array, dst: Float32Array, count: number, matrix: Float32Array, width: number, height: number, offsetX?: number, offsetY?: number, zScale?: number): void;
|
|
24
|
+
/**
|
|
25
|
+
* Extend an axis-aligned bounding box by a set of 3D vertices transformed
|
|
26
|
+
* through a 4x4 matrix (translation included). `min` / `max` are updated in
|
|
27
|
+
* place, so the function can be called repeatedly to accumulate the bounds of
|
|
28
|
+
* many transformed vertex sets (e.g. every node of a scene graph). Seed `min`
|
|
29
|
+
* with `+Infinity` and `max` with `-Infinity` before the first call.
|
|
30
|
+
* @param src - source vertex positions (x,y,z triplets)
|
|
31
|
+
* @param count - number of vertices to read from `src`
|
|
32
|
+
* @param matrix - 4x4 matrix values (column-major, 16 elements)
|
|
33
|
+
* @param min - `[x,y,z]` lower corner, extended in place
|
|
34
|
+
* @param max - `[x,y,z]` upper corner, extended in place
|
|
35
|
+
*/
|
|
36
|
+
export declare function transformedBounds(src: Float32Array, count: number, matrix: ArrayLike<number>, min: number[], max: number[]): void;
|
|
37
|
+
/**
|
|
38
|
+
* Compute the bounding-sphere radius of a set of 3D vertices around the local
|
|
39
|
+
* origin — the distance to the farthest vertex. When a matrix is supplied,
|
|
40
|
+
* each vertex is taken through its rotation/scale columns (the translation is
|
|
41
|
+
* ignored, so the radius stays centered on the transform's own origin). Handy
|
|
42
|
+
* for frustum / culling bounds on a transformed mesh.
|
|
43
|
+
* @param src - source vertex positions (x,y,z triplets)
|
|
44
|
+
* @param count - number of vertices to read from `src`
|
|
45
|
+
* @param [matrix] - optional 4x4 matrix (column-major); only the upper 3x3 rotation/scale is applied
|
|
46
|
+
* @returns the radius of the smallest origin-centered sphere enclosing the vertices
|
|
47
|
+
*/
|
|
48
|
+
export declare function boundingRadius(src: Float32Array, count: number, matrix?: ArrayLike<number>): number;
|
|
24
49
|
/**
|
|
25
50
|
* Compute the averaged perpendicular normal at a vertex in a 2D polyline.
|
|
26
51
|
* At interior vertices, normals from both adjacent edges are averaged
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vertex.d.ts","sourceRoot":"","sources":["../../src/math/vertex.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAE9C;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,YAAY,QA8CvD;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,eAAe,CAC9B,GAAG,EAAE,YAAY,EACjB,GAAG,EAAE,YAAY,EACjB,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,YAAY,EACpB,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,EACd,OAAO,SAAI,EACX,OAAO,SAAI,EACX,MAAM,SAAI,QA0DV;AAID;;;;;;;;GAQG;AACH,wBAAgB,mBAAmB,CAClC,MAAM,EAAE,OAAO,EAAE,EACjB,KAAK,EAAE,MAAM,EACb,GAAG,GAAE,OAAwB,GAC3B,OAAO,CAwCT;AAqBD;;;;;;GAMG;AACH,wBAAgB,UAAU,CAAC,MAAM,EAAE,QAAQ,EAAE,GAAG,QAAQ,EAAE,CAmDzD"}
|
|
1
|
+
{"version":3,"file":"vertex.d.ts","sourceRoot":"","sources":["../../src/math/vertex.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAE9C;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,YAAY,QA8CvD;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,eAAe,CAC9B,GAAG,EAAE,YAAY,EACjB,GAAG,EAAE,YAAY,EACjB,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,YAAY,EACpB,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,EACd,OAAO,SAAI,EACX,OAAO,SAAI,EACX,MAAM,SAAI,QA0DV;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,iBAAiB,CAChC,GAAG,EAAE,YAAY,EACjB,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,SAAS,CAAC,MAAM,CAAC,EACzB,GAAG,EAAE,MAAM,EAAE,EACb,GAAG,EAAE,MAAM,EAAE,QA4Cb;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,cAAc,CAC7B,GAAG,EAAE,YAAY,EACjB,KAAK,EAAE,MAAM,EACb,MAAM,CAAC,EAAE,SAAS,CAAC,MAAM,CAAC,GACxB,MAAM,CAwCR;AAID;;;;;;;;GAQG;AACH,wBAAgB,mBAAmB,CAClC,MAAM,EAAE,OAAO,EAAE,EACjB,KAAK,EAAE,MAAM,EACb,GAAG,GAAE,OAAwB,GAC3B,OAAO,CAwCT;AAqBD;;;;;;GAMG;AACH,wBAAgB,UAAU,CAAC,MAAM,EAAE,QAAQ,EAAE,GAAG,QAAQ,EAAE,CAmDzD"}
|
|
@@ -15,8 +15,10 @@ import type { XYZPoint } from "../../utils/types.ts";
|
|
|
15
15
|
*
|
|
16
16
|
* Lives next to {@link Octree} under `physics/broadphase/` rather
|
|
17
17
|
* than `math/` to mirror {@link Bounds} (which lives in `physics/`,
|
|
18
|
-
* not `math/`).
|
|
19
|
-
*
|
|
18
|
+
* not `math/`). It originated as a broadphase-internal primitive; it is
|
|
19
|
+
* now also the public 3D-bounds type returned by {@link Mesh#getBounds3d}
|
|
20
|
+
* (the 3D analog of {@link Renderable#getBounds} → {@link Bounds}), built
|
|
21
|
+
* from mesh geometry via {@link AABB3d#fromVertices}.
|
|
20
22
|
* @category Geometry
|
|
21
23
|
*/
|
|
22
24
|
export declare class AABB3d {
|
|
@@ -107,6 +109,25 @@ export declare class AABB3d {
|
|
|
107
109
|
* @param [clear] - reset this AABB before folding
|
|
108
110
|
*/
|
|
109
111
|
addAABB(aabb: AABB3d, clear?: boolean): void;
|
|
112
|
+
/**
|
|
113
|
+
* Build this AABB from a flat vertex buffer (`x,y,z` triplets), optionally
|
|
114
|
+
* transformed by a column-major 4×4 matrix — the bridge from raw mesh /
|
|
115
|
+
* glTF geometry (e.g. a {@link Mesh}'s vertices or a parsed glTF node) to an
|
|
116
|
+
* `AABB3d`. **Replaces** the current bounds (seeds empty, then folds in the
|
|
117
|
+
* `count` vertices); for the point-array form use {@link AABB3d#addPoint}.
|
|
118
|
+
*
|
|
119
|
+
* The per-vertex math is **delegated to {@link transformedBounds}** (the
|
|
120
|
+
* shared `math/vertex.ts` helper) rather than duplicated here, so the
|
|
121
|
+
* flat-buffer ↔ AABB conversion stays in one place. Allocation-free.
|
|
122
|
+
* @param src - source vertex positions (`x,y,z` triplets)
|
|
123
|
+
* @param count - number of vertices to read from `src`
|
|
124
|
+
* @param [matrix] - optional column-major 4×4 (16 elements); identity if omitted
|
|
125
|
+
* @returns this AABB, for chaining
|
|
126
|
+
* @example
|
|
127
|
+
* // bounds of a glTF node's geometry under its world transform
|
|
128
|
+
* const box = new AABB3d().fromVertices(node.vertices, node.vertexCount, node.world);
|
|
129
|
+
*/
|
|
130
|
+
fromVertices(src: Float32Array, count: number, matrix?: ArrayLike<number>): this;
|
|
110
131
|
/**
|
|
111
132
|
* Returns a deep copy of this AABB.
|
|
112
133
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"aabb3d.d.ts","sourceRoot":"","sources":["../../../src/physics/broadphase/aabb3d.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"aabb3d.d.ts","sourceRoot":"","sources":["../../../src/physics/broadphase/aabb3d.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAElD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAYrD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,qBAAa,MA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AC,EAAE,QAAQ,GAAG,QAAQ;IAS/B;;;;;OAKG;IACH,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,UAAQ;IAkBnC;;;;;;;;;;;;;;;;;OAiBG;IACH,YAAY,CAAC,GAAG,EAAE,YAAY,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,SAAS,CAAC,MAAM,CAAC;IAgBzE;;OAEG;IACH,KAAK;CAGL"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Normalized options for a played animation, shared by the 2D {@link Sprite}
|
|
3
|
+
* frame-animation path and the 3D {@link Mesh} keyframe-animation path so both
|
|
4
|
+
* accept the same `setCurrentAnimation(name, …)` second argument.
|
|
5
|
+
* @category Animation
|
|
6
|
+
*/
|
|
7
|
+
export interface AnimationOptions {
|
|
8
|
+
/** called when the animation completes a cycle (each loop, or once if `loop: false`). */
|
|
9
|
+
onComplete?: (() => unknown) | undefined;
|
|
10
|
+
/** name of an animation to switch to when this one finishes. */
|
|
11
|
+
next?: string | undefined;
|
|
12
|
+
/** loop forever (default) or play once and hold the last frame. */
|
|
13
|
+
loop: boolean;
|
|
14
|
+
/** playback rate multiplier (1 = authored speed). */
|
|
15
|
+
speed: number;
|
|
16
|
+
/**
|
|
17
|
+
* the argument was a bare function — the legacy `Sprite` callback whose
|
|
18
|
+
* `false` return holds the last frame. Carried so callers can preserve that
|
|
19
|
+
* exact contract; not part of the public options shape.
|
|
20
|
+
* @ignore
|
|
21
|
+
*/
|
|
22
|
+
legacyFn?: boolean;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Normalize the polymorphic second argument of `setCurrentAnimation` into a
|
|
26
|
+
* uniform {@link AnimationOptions}. Accepts:
|
|
27
|
+
* - `undefined` → loop forever
|
|
28
|
+
* - a `string` → the name of the next animation to chain to
|
|
29
|
+
* - a `function` → legacy completion callback (return `false` to hold the last frame)
|
|
30
|
+
* - an options object → `{ onComplete, next, loop, speed }`
|
|
31
|
+
* @param arg - the second argument passed to `setCurrentAnimation`
|
|
32
|
+
* @returns the normalized options
|
|
33
|
+
* @category Animation
|
|
34
|
+
*/
|
|
35
|
+
export declare function parseAnimationOptions(arg?: string | (() => unknown) | {
|
|
36
|
+
onComplete?: () => unknown;
|
|
37
|
+
next?: string;
|
|
38
|
+
loop?: boolean;
|
|
39
|
+
speed?: number;
|
|
40
|
+
} | null): AnimationOptions;
|
|
41
|
+
//# sourceMappingURL=animation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"animation.d.ts","sourceRoot":"","sources":["../../src/renderable/animation.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,WAAW,gBAAgB;IAChC,yFAAyF;IACzF,UAAU,CAAC,EAAE,CAAC,MAAM,OAAO,CAAC,GAAG,SAAS,CAAC;IACzC,gEAAgE;IAChE,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC1B,mEAAmE;IACnE,IAAI,EAAE,OAAO,CAAC;IACd,qDAAqD;IACrD,KAAK,EAAE,MAAM,CAAC;IACd;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;CACnB;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,qBAAqB,CACpC,GAAG,CAAC,EACD,MAAM,GACN,CAAC,MAAM,OAAO,CAAC,GACf;IACA,UAAU,CAAC,EAAE,MAAM,OAAO,CAAC;IAC3B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;CACd,GAGD,IAAI,GACL,gBAAgB,CAiBlB"}
|
|
@@ -380,7 +380,6 @@ import type { DropTarget } from "./dragndrop.js";
|
|
|
380
380
|
import type NineSliceSprite from "./nineslicesprite.js";
|
|
381
381
|
import type ImageLayer from "./imagelayer.js";
|
|
382
382
|
import type ColorLayer from "./colorlayer.js";
|
|
383
|
-
import type Light2d from "./light2d.js";
|
|
384
383
|
import type UIBaseElement from "./ui/uibaseelement.ts";
|
|
385
384
|
import type UISpriteElement from "./ui/uispriteelement.ts";
|
|
386
385
|
import type UITextButton from "./ui/uitextbutton.ts";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"container.d.ts","sourceRoot":"","sources":["../../src/renderable/container.js"],"names":[],"mappings":"AA8GA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH;;;;;;;;;GASG;AACH;IACC;;;;;;;OAOG;IACH,gBAPW,MAAM,MACN,MAAM,UACN,MAAM,WACN,MAAM,SACN,OAAO,EA0GjB;IAnGA;;;OAGG;IACH,iBAAuB;IAEvB;;;;OAIG;IACH,MAHU,OAAO,CAGD;IAEhB;;;OAGG;IACH,4BAAyB;IAEzB;;;;;OAKG;IACH,SAHU,MAAM,CAGE;IAClB,wCAA8B;IAE9B;;;;OAIG;IACH,UAHU,OAAO,CAGG;IAEpB;;;;OAIG;IACH,WAHU,OAAO,CAGI;IAErB;;;;OAIG;IACH,UAHU,OAAO,CAGI;IAErB;;;OAGG;IACH,0BAEC;IAED;;;;;;OAMG;IACH,yBAHU,OAAO,CAGmB;IAEpC;;;;;;;OAOG;IACH,iBANU,KAAK,CAMmC;IAuDnD,kBANU,GAAG,GAAC,GAAG,GAAC,GAAG,GAAC,OAAO,EAmB5B;IAzCD;;;;;;;;;;;;;;;;;;;;;;;;OAwBG;IACH,cAHU,GAAG,GAAC,GAAG,GAAC,GAAG,GAAC,OAAO,CAK5B;IAgBD;;OAEG;IACH,cAmBC;IAED;;;;;;;;;;;;;OAaG;IACH,gBAJW,UAAU,GAAC,MAAM,GAAC,MAAM,GAAC,WAAW,GAAC,OAAO,GAAC,SAAS,GAAC,UAAU,GAAC,eAAe,GAAC,UAAU,GAAC,UAAU,
|
|
1
|
+
{"version":3,"file":"container.d.ts","sourceRoot":"","sources":["../../src/renderable/container.js"],"names":[],"mappings":"AA8GA;;;;;;;;;;;;;;;;;;;;;GAqBG;A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