melonjs 20.4.0 → 20.5.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/build/audio/backend/sound.d.ts.map +1 -1
- package/build/audio/procedural.d.ts +7 -2
- package/build/audio/procedural.d.ts.map +1 -1
- package/build/audio/types.d.ts +22 -0
- package/build/audio/types.d.ts.map +1 -1
- package/build/camera/camera2d.d.ts +28 -0
- package/build/camera/camera2d.d.ts.map +1 -1
- package/build/camera/camera3d.d.ts +24 -3
- package/build/camera/camera3d.d.ts.map +1 -1
- package/build/geometries/polygon.d.ts +7 -1
- package/build/geometries/polygon.d.ts.map +1 -1
- package/build/index.d.ts +4 -0
- package/build/index.d.ts.map +1 -1
- package/build/index.js +1061 -166
- package/build/index.js.map +4 -4
- package/build/level/gltf/GLTFModel.d.ts +50 -7
- package/build/level/gltf/GLTFModel.d.ts.map +1 -1
- package/build/lighting/light3d.d.ts +20 -47
- package/build/lighting/light3d.d.ts.map +1 -1
- package/build/loader/loader.d.ts +106 -6
- package/build/loader/loader.d.ts.map +1 -1
- package/build/renderable/animation.d.ts +21 -6
- package/build/renderable/animation.d.ts.map +1 -1
- package/build/renderable/container.d.ts +27 -5
- package/build/renderable/container.d.ts.map +1 -1
- package/build/renderable/instanced_mesh.d.ts +34 -9
- package/build/renderable/instanced_mesh.d.ts.map +1 -1
- package/build/renderable/mesh.d.ts +131 -94
- package/build/renderable/mesh.d.ts.map +1 -1
- package/build/renderable/renderable.d.ts +17 -0
- package/build/renderable/renderable.d.ts.map +1 -1
- package/build/renderable/sprite3d.d.ts +12 -2
- package/build/renderable/sprite3d.d.ts.map +1 -1
- package/build/renderable/text/bitmaptext.d.ts +32 -7
- package/build/renderable/text/bitmaptext.d.ts.map +1 -1
- package/build/renderable/text/text.d.ts +78 -3
- package/build/renderable/text/text.d.ts.map +1 -1
- package/build/renderable/text/textmetrics.d.ts +2 -0
- package/build/renderable/text/textmetrics.d.ts.map +1 -1
- package/build/renderable/text/textstyle.d.ts.map +1 -1
- package/build/state/stage.d.ts +21 -0
- package/build/state/stage.d.ts.map +1 -1
- package/build/system/device.d.ts +1 -1
- package/build/system/device.d.ts.map +1 -1
- package/build/system/save.d.ts +44 -1
- package/build/system/save.d.ts.map +1 -1
- package/build/video/effects/glsl_realization.d.ts.map +1 -1
- package/build/video/effects/mesh_splice.d.ts +2 -0
- package/build/video/effects/mesh_splice.d.ts.map +1 -0
- package/build/video/effects/shadereffect.d.ts +12 -128
- package/build/video/effects/shadereffect.d.ts.map +1 -1
- package/build/video/effects/wgsl_realization.d.ts.map +1 -1
- package/build/video/gradient.d.ts +19 -0
- package/build/video/gradient.d.ts.map +1 -1
- package/build/video/renderer.d.ts.map +1 -1
- package/build/video/texture/noise_texture2d.d.ts +101 -34
- package/build/video/texture/noise_texture2d.d.ts.map +1 -1
- package/build/video/webgl/batchers/mesh_batcher.d.ts.map +1 -1
- package/build/video/webgl/glshader.d.ts +7 -2
- package/build/video/webgl/glshader.d.ts.map +1 -1
- package/build/video/webgl/webgl_renderer.d.ts.map +1 -1
- package/build/video/webgpu/batchers/lit_mesh_batcher.d.ts.map +1 -1
- package/build/video/webgpu/batchers/mesh_batcher.d.ts +6 -1
- package/build/video/webgpu/batchers/mesh_batcher.d.ts.map +1 -1
- package/build/video/webgpu/webgpu_renderer.d.ts +1 -0
- package/build/video/webgpu/webgpu_renderer.d.ts.map +1 -1
- package/package.json +1 -1
- package/skills/melonjs-3d/SKILL.md +152 -3
- package/skills/melonjs-3d-assets/SKILL.md +139 -0
- package/skills/melonjs-audio/SKILL.md +17 -0
- package/skills/melonjs-camera-and-drawing/SKILL.md +45 -0
- package/skills/melonjs-effects-and-shaders/SKILL.md +93 -1
- package/skills/melonjs-loading-assets/SKILL.md +97 -1
- package/skills/melonjs-performance/SKILL.md +55 -1
- package/skills/melonjs-physics/SKILL.md +78 -0
- package/skills/melonjs-renderables/SKILL.md +63 -1
- package/skills/melonjs-renderer-backends/SKILL.md +19 -0
- package/skills/melonjs-scenes-and-state/SKILL.md +56 -0
- package/skills/melonjs-ui-and-text/SKILL.md +124 -0
|
@@ -13,14 +13,28 @@
|
|
|
13
13
|
* loop, speed, onComplete, next })`. Here `animationspeed` is a **playback
|
|
14
14
|
* multiplier** (1 = authored speed), not a per-frame delay.
|
|
15
15
|
*
|
|
16
|
+
* The model is placed like any other renderable: `pos`, `depth` and the
|
|
17
|
+
* transform helpers (`rotate`, `scale`) move the **whole rig**, and compose
|
|
18
|
+
* with whatever the active clip is doing — so a walk cycle plays wherever the
|
|
19
|
+
* character happens to stand.
|
|
20
|
+
*
|
|
16
21
|
* Instances are created automatically by {@link GLTFScene} when the asset
|
|
17
22
|
* defines animation channels; you usually obtain one via `level.load(...)`
|
|
18
23
|
* rather than constructing it directly.
|
|
19
24
|
* @augments Container
|
|
25
|
+
* @example
|
|
26
|
+
* const boat = new me.GLTFModel(me.loader.getGLTF("boat"), { scale: 30, lit: true });
|
|
27
|
+
* boat.setCurrentAnimation("paddle", { loop: true });
|
|
28
|
+
* app.world.addChild(boat);
|
|
29
|
+
*
|
|
30
|
+
* // ...then drive it like anything else
|
|
31
|
+
* boat.pos.set(steerX, waterLevel);
|
|
32
|
+
* boat.depth = travelled;
|
|
33
|
+
* boat.rotate(lean - lastLean, AXIS_Z);
|
|
20
34
|
*/
|
|
21
35
|
export default class GLTFModel extends Container {
|
|
22
36
|
/**
|
|
23
|
-
* @param {
|
|
37
|
+
* @param {import("../../loader/loader.js").GLTFData} data - the parsed glTF descriptor, as returned by {@link loader.getGLTF}
|
|
24
38
|
* @param {object} [options]
|
|
25
39
|
* @param {number} [options.scale=1] - pixels per glTF unit (uniform scene scale)
|
|
26
40
|
* @param {boolean} [options.rightHanded=true] - glTF Y-up → engine Y-down via a rotation (no mirror)
|
|
@@ -28,7 +42,7 @@ export default class GLTFModel extends Container {
|
|
|
28
42
|
* @param {boolean} [options.castGroundShadow] - give the parts a ground shadow; omit to inherit the application setting
|
|
29
43
|
* @param {number} [options.shadowGroundY] - world Y of the floor those shadows land on
|
|
30
44
|
*/
|
|
31
|
-
constructor(data:
|
|
45
|
+
constructor(data: import("../../loader/loader.js").GLTFData, options?: {
|
|
32
46
|
scale?: number | undefined;
|
|
33
47
|
rightHanded?: boolean | undefined;
|
|
34
48
|
lit?: boolean | undefined;
|
|
@@ -66,7 +80,7 @@ export default class GLTFModel extends Container {
|
|
|
66
80
|
* another clip when this one ends, a `function` legacy completion callback
|
|
67
81
|
* (return `false` to hold the final pose), or an options object.
|
|
68
82
|
* @param {string} name - animation clip id (see {@link GLTFModel#getAnimationNames})
|
|
69
|
-
* @param {
|
|
83
|
+
* @param {AnimationOptionsInput} [options] - loop / chain / completion behavior
|
|
70
84
|
* @param {boolean} [preserveTime=false] - keep the current playback time instead of restarting at 0
|
|
71
85
|
* @returns {GLTFModel} this, for chaining
|
|
72
86
|
* @example
|
|
@@ -76,14 +90,14 @@ export default class GLTFModel extends Container {
|
|
|
76
90
|
* model.setCurrentAnimation("walk", { speed: 2 }); // twice as fast
|
|
77
91
|
* model.setCurrentAnimation("emote-yes", () => spawnFx()); // legacy callback
|
|
78
92
|
*/
|
|
79
|
-
setCurrentAnimation(name: string, options?:
|
|
93
|
+
setCurrentAnimation(name: string, options?: AnimationOptionsInput, preserveTime?: boolean): GLTFModel;
|
|
80
94
|
/**
|
|
81
95
|
* Play an animation clip, or resume the current one. A shorthand for
|
|
82
96
|
* {@link GLTFModel#setCurrentAnimation}: call with a clip name to switch to
|
|
83
97
|
* (and start) it, or with no argument to resume after {@link GLTFModel#pause}.
|
|
84
98
|
* Always clears the paused state.
|
|
85
99
|
* @param {string} [name] - clip id to play; omit to just resume
|
|
86
|
-
* @param {
|
|
100
|
+
* @param {AnimationOptionsInput} [options] - loop / chain / completion behavior (see {@link GLTFModel#setCurrentAnimation})
|
|
87
101
|
* @returns {GLTFModel} this, for chaining
|
|
88
102
|
* @example
|
|
89
103
|
* model.play("walk"); // switch to + play "walk"
|
|
@@ -91,7 +105,7 @@ export default class GLTFModel extends Container {
|
|
|
91
105
|
* model.pause();
|
|
92
106
|
* model.play(); // resume
|
|
93
107
|
*/
|
|
94
|
-
play(name?: string, options?:
|
|
108
|
+
play(name?: string, options?: AnimationOptionsInput): GLTFModel;
|
|
95
109
|
/**
|
|
96
110
|
* Pause the current animation, freezing it at its current pose. Resume with
|
|
97
111
|
* {@link GLTFModel#play}.
|
|
@@ -106,7 +120,36 @@ export default class GLTFModel extends Container {
|
|
|
106
120
|
* @returns {GLTFModel} this, for chaining
|
|
107
121
|
*/
|
|
108
122
|
stop(): GLTFModel;
|
|
123
|
+
/**
|
|
124
|
+
* {@link Container#draw} translates the renderer by `pos` so children draw
|
|
125
|
+
* in container-local space. This rig's children are already in world space,
|
|
126
|
+
* so that translation is undone here rather than doubling the placement.
|
|
127
|
+
* Paired with `autoTransform = false`, which suppresses the matching
|
|
128
|
+
* rotation fold.
|
|
129
|
+
* @param {CanvasRenderer|WebGLRenderer} renderer - a renderer instance
|
|
130
|
+
* @param {Camera2d} [viewport] - the camera rendering this frame
|
|
131
|
+
*/
|
|
132
|
+
draw(renderer: CanvasRenderer | WebGLRenderer, viewport?: Camera2d): void;
|
|
133
|
+
/**
|
|
134
|
+
* Where this model is, as a 2D box — what culling, picking and the physics
|
|
135
|
+
* broadphase all read.
|
|
136
|
+
*
|
|
137
|
+
* A `Container` has no dimensions of its own, and one left that way reports
|
|
138
|
+
* an EMPTY bounds: a model claiming to be nowhere, which the broadphase
|
|
139
|
+
* cannot place. A rig's size is known at load from the glTF scene AABB, so
|
|
140
|
+
* this is a placement of a measurement taken once in the constructor rather
|
|
141
|
+
* than a walk of the parts — `Container#updateBounds` with
|
|
142
|
+
* `enableChildBoundsUpdate` would re-measure the whole rig on every call,
|
|
143
|
+
* and that flag is for a group whose extent really is its members' union.
|
|
144
|
+
*
|
|
145
|
+
* The box is the model's bounding SPHERE squared off, so a turned model
|
|
146
|
+
* still reports something that contains it. Generous bounds only cost
|
|
147
|
+
* broadphase pruning; tight ones lose contacts.
|
|
148
|
+
* @param {boolean} [absolute=true] - in world rather than local coordinates
|
|
149
|
+
* @returns {Bounds} this model's bounding box
|
|
150
|
+
*/
|
|
151
|
+
updateBounds(absolute?: boolean): Bounds;
|
|
109
152
|
}
|
|
110
153
|
import Container from "../../renderable/container.js";
|
|
111
|
-
import type {
|
|
154
|
+
import type { AnimationOptionsInput } from "../../renderable/animation.ts";
|
|
112
155
|
//# sourceMappingURL=GLTFModel.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GLTFModel.d.ts","sourceRoot":"","sources":["../../../src/level/gltf/GLTFModel.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"GLTFModel.d.ts","sourceRoot":"","sources":["../../../src/level/gltf/GLTFModel.js"],"names":[],"mappings":"AA0DA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH;IACC;;;;;;;;OAQG;IACH,kBARW,OAAO,wBAAwB,EAAE,QAAQ,YAEjD;QAAyB,KAAK;QACJ,WAAW;QACX,GAAG;QACH,gBAAgB;QACjB,aAAa;KACxC,EAsRA;IAzQA;;;OAGG;IACH,eAAoD;IA0CpD;;;;OAIG;IACH,YAA8B;IAC9B;;;;OAIG;IACH,YAA8B;IAC9B;;;;OAIG;IACH,gBAAqB;IACrB;;;;OAIG;IACH,gBAAqB;IACrB;;;;;;;OAOG;IACH,WAAgB;IAahB;;;;;;;;;;;;OAYG;IACH,gBAAkC;IAClC;;;OAGG;IACH,iBAAwD;IAExD;;;OAGG;IACH,iBAAyD;IAqFzD;;;;OAIG;IACH,SAAc;IAiBd;;;;OAIG;IACH,gBAHU,MAAM,CAGO;IAEvB;;;;OAIG;IACH,gBAHU,OAAO,CAGU;IAE3B;;;;OAIG;IAIH;;;OAGG;IACH;;;;MAAsD;IACtD;;;;OAIG;IACH,oGAA0B;IAC1B;;;;OAIG;IACH,mBAAsB;IAOvB;;;;;OAKG;IACH,qBAJa,MAAM,EAAE,CAMpB;IAED;;;;OAIG;IACH,yBAHW,MAAM,GACJ,OAAO,CAInB;IAED;;;;;;;;;;;;;;;OAeG;IACH,0BAXW,MAAM,YACN,qBAAqB,iBACrB,OAAO,GACL,SAAS,CAgErB;IAED;;;;;;;;;;;;;OAaG;IACH,YATW,MAAM,YACN,qBAAqB,GACnB,SAAS,CAarB;IAED;;;;OAIG;IACH,SAFa,SAAS,CAKrB;IAED;;;;;;OAMG;IACH,QAFa,SAAS,CAarB;IAkDD;;;;;;OAMG;IACH;;;;;;;;;;;;;;;OAeG;IACH,WAFa,OAAO,CAInB;IAED;;;;;;;;OAQG;IACH,eAHW,cAAc,GAAC,aAAa,aAC5B,QAAQ,QAKlB;IAED;;;;;;;;;;;;;;;;;OAiBG;IACH,wBAHW,OAAO,GACL,MAAM,CAgBlB;IAED;;;OAGG;IACH,cAOC;IAED;;;;;;;;;;;;;;OAcG;IACH,eAJa,MAAM,EAAE,CA4BpB;IAED;;;;;OAKG;IACH,4DAqBC;IAED;;;;;;;OAOG;IACH,2CAJa,MAAM,EAAE,CAyCpB;IAED;;;;;;;;OAQG;IACH,+CASC;CACD;sBAvxBqB,+BAA+B;2CAUX,+BAA+B"}
|
|
@@ -14,12 +14,27 @@ export interface Light3dOptions {
|
|
|
14
14
|
*/
|
|
15
15
|
type?: "directional" | "ambient" | "point" | "spot";
|
|
16
16
|
/**
|
|
17
|
-
*
|
|
18
|
-
* and the cone axis of spot lights).
|
|
17
|
+
* World-space direction the light TRAVELS ALONG — not the direction it
|
|
18
|
+
* comes from (directional lights, and the cone axis of spot lights).
|
|
19
|
+
*
|
|
20
|
+
* Render space is **Y-down**, so a sun overhead shining onto the scene
|
|
21
|
+
* travels *downward* and its Y is **positive**: `[-0.35, 0.8, 0.45]` is a
|
|
22
|
+
* late-afternoon sun. A negative Y lights everything from underneath,
|
|
23
|
+
* which reads instantly as wrong and is the usual mistake here.
|
|
24
|
+
*
|
|
25
|
+
* Either an `[x, y, z]` array or a {@link Vector3d} — as
|
|
26
|
+
* {@link Light3dOptions.color} already takes several forms. The vector is
|
|
27
|
+
* READ, not retained: {@link Light3d#direction} remains the engine's own,
|
|
28
|
+
* and normalized, so mutating what you passed in afterwards changes
|
|
29
|
+
* nothing.
|
|
19
30
|
*/
|
|
20
|
-
direction?: [number, number, number];
|
|
21
|
-
/**
|
|
22
|
-
|
|
31
|
+
direction?: [number, number, number] | Vector3d;
|
|
32
|
+
/**
|
|
33
|
+
* World-space position (point and spot lights), as an `[x, y, z]` array or
|
|
34
|
+
* a {@link Vector3d}. Y-down again: a lamp above the floor has a
|
|
35
|
+
* **smaller** y than the floor.
|
|
36
|
+
*/
|
|
37
|
+
position?: [number, number, number] | Vector3d;
|
|
23
38
|
/**
|
|
24
39
|
* light color — a {@link Color}, a CSS color string, or an `[r, g, b]`
|
|
25
40
|
* array with components in `0..1` (the glTF convention). Defaults to white.
|
|
@@ -45,48 +60,6 @@ export interface Light3dOptions {
|
|
|
45
60
|
*/
|
|
46
61
|
outerConeAngle?: number;
|
|
47
62
|
}
|
|
48
|
-
/**
|
|
49
|
-
* A 3D light source for the mesh lighting path — the 3D counterpart of
|
|
50
|
-
* {@link Light2d}. Like `Light2d`, a `Light3d` is a world {@link Renderable}:
|
|
51
|
-
* add it to a container with `app.world.addChild(light)` and it auto-registers
|
|
52
|
-
* with the active {@link Stage}, so any lit mesh in that scene is shaded by it.
|
|
53
|
-
* Remove it from the world to turn it off. A light draws nothing itself.
|
|
54
|
-
*
|
|
55
|
-
* Four types are shaded:
|
|
56
|
-
* - **`"directional"`** — a sun: a world-space `direction`, no falloff. Shaded
|
|
57
|
-
* via half-Lambert diffuse.
|
|
58
|
-
* - **`"ambient"`** — a flat fill added to every lit pixel (the dark side of a
|
|
59
|
-
* mesh never goes fully black). `direction` / `position` are ignored.
|
|
60
|
-
* - **`"point"`** — radiates from `position`, fading quadratically to zero at
|
|
61
|
-
* `range` (the same stylized falloff as {@link Light2d}'s radius).
|
|
62
|
-
* - **`"spot"`** — a point light confined to a cone along `direction`, at
|
|
63
|
-
* full strength inside `innerConeAngle` and fading smoothly to zero at
|
|
64
|
-
* `outerConeAngle`.
|
|
65
|
-
*
|
|
66
|
-
* Fields are public and mutable, so a light can be animated at runtime
|
|
67
|
-
* (e.g. a day/night cycle rotating `direction`, a flickering torch fading
|
|
68
|
-
* `intensity`, a searchlight sweeping its cone).
|
|
69
|
-
* @category Lighting
|
|
70
|
-
* @example
|
|
71
|
-
* import { Light3d } from "melonjs";
|
|
72
|
-
*
|
|
73
|
-
* // a sun + a soft ambient fill, added to the world like any renderable
|
|
74
|
-
* const sun = new Light3d({ direction: [0.3, 1, 0.2], color: "#fff" });
|
|
75
|
-
* app.world.addChild(sun);
|
|
76
|
-
* app.world.addChild(new Light3d({ type: "ambient", intensity: 0.3 }));
|
|
77
|
-
*
|
|
78
|
-
* // a street lamp pool and a searchlight cone
|
|
79
|
-
* app.world.addChild(new Light3d({
|
|
80
|
-
* type: "point", position: [120, -40, 60], color: "#ffb45e", range: 300,
|
|
81
|
-
* }));
|
|
82
|
-
* app.world.addChild(new Light3d({
|
|
83
|
-
* type: "spot", position: [0, -200, 0], direction: [0, 1, 0],
|
|
84
|
-
* range: 800, innerConeAngle: 0.2, outerConeAngle: 0.45,
|
|
85
|
-
* }));
|
|
86
|
-
*
|
|
87
|
-
* // animate the sun in-game (direction is the way light travels)
|
|
88
|
-
* sun.direction.set(Math.sin(t), 1, Math.cos(t)).normalize();
|
|
89
|
-
*/
|
|
90
63
|
export declare class Light3d extends Renderable {
|
|
91
64
|
/** `"directional"`, `"ambient"`, `"point"` or `"spot"`. */
|
|
92
65
|
type: "directional" | "ambient" | "point" | "spot";
|
|
@@ -1 +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,qBA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,oDAAoD;IACpD,QAAQ,EAAE,QAAQ,CAAC;IACnB,uBAAuB;IACvB,KAAK,EAAE,KAAK,CAAC;IACb,qDAAqD;IACrD,SAAS,EAAE,MAAM,CAAC;IAClB;;;OAGG;IACH,KAAK,EAAE,MAAM,CAAC;IACd,iEAAiE;IACjE,cAAc,EAAE,MAAM,CAAC;IACvB,wDAAwD;IACxD,cAAc,EAAE,MAAM,CAAC;IAEvB;;OAEG;gBACS,OAAO,GAAE,cAAmB;CAoExC"}
|
package/build/loader/loader.d.ts
CHANGED
|
@@ -43,7 +43,7 @@ export function setBaseURL(type: string, url?: string): void;
|
|
|
43
43
|
* @property {string|string[]} [src] - path and/or file name of the resource (for audio assets only the path is required).
|
|
44
44
|
* 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).
|
|
45
45
|
* The loader will try each source in order and use the first one that loads successfully.
|
|
46
|
-
* @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
|
|
46
|
+
* @property {string|{glsl?: string, wgsl?: 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. A shader may instead carry a `{glsl, wgsl}` pair, so one asset serves both backends; either half may be omitted
|
|
47
47
|
* @property {boolean} [stream=false] - Set to true to not to wait for large audio or video file to be downloaded before playing.
|
|
48
48
|
* @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)
|
|
49
49
|
* @property {boolean} [loop=false] - Set to true to automatically loop the audio or video when playing
|
|
@@ -285,10 +285,34 @@ export function getJSON(elt: string): JSON;
|
|
|
285
285
|
* });
|
|
286
286
|
*/
|
|
287
287
|
export function getOBJ(elt: string): object;
|
|
288
|
+
/**
|
|
289
|
+
* One mesh primitive out of a parsed glTF/GLB scene.
|
|
290
|
+
*
|
|
291
|
+
* Spelled out rather than left as `object` so the geometry can be read from
|
|
292
|
+
* TypeScript — feeding `vertices`/`uvs`/`normals`/`indices` straight into a
|
|
293
|
+
* {@link Mesh} or {@link InstancedMesh} is the whole point of exposing it.
|
|
294
|
+
* @typedef {object} GLTFNode
|
|
295
|
+
* @property {number[]} world - accumulated world transform, 16 floats, column-major
|
|
296
|
+
* @property {Float32Array} vertices - positions, x,y,z triplets
|
|
297
|
+
* @property {Float32Array} normals - per-vertex normals
|
|
298
|
+
* @property {Float32Array} uvs - texture coordinates, u,v pairs
|
|
299
|
+
* @property {Uint16Array|Uint32Array} indices - triangle vertex indices
|
|
300
|
+
* @property {number} vertexCount - number of vertices
|
|
301
|
+
* @property {HTMLImageElement|null} image - decoded baseColor texture, or `null`
|
|
302
|
+
* @property {number[]} [baseColorFactor] - material baseColor factor, `[r, g, b, a]`
|
|
303
|
+
* @property {Uint32Array} [colors] - per-vertex colour, packed RGBA8
|
|
304
|
+
* @property {string} [textureRepeat] - wrap mode derived from the glTF sampler
|
|
305
|
+
* @property {string} [textureFilter] - magnification filter derived from the glTF sampler
|
|
306
|
+
* @property {number} [alphaCutoff] - cutout threshold from `alphaMode: "MASK"`
|
|
307
|
+
* @property {number[]} [emissive] - emissive factor, `[r, g, b]`
|
|
308
|
+
* @property {boolean} [unlit] - the material carried `KHR_materials_unlit`
|
|
309
|
+
* @property {boolean} [doubleSided] - the material is double-sided
|
|
310
|
+
* @property {string} [name] - the source node's name
|
|
311
|
+
*/
|
|
288
312
|
/**
|
|
289
313
|
* a parsed glTF/GLB scene descriptor, as returned by {@link loader.getGLTF}
|
|
290
314
|
* @typedef {object} GLTFData
|
|
291
|
-
* @property {
|
|
315
|
+
* @property {GLTFNode[]} nodes - one entry per mesh primitive
|
|
292
316
|
* @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)
|
|
293
317
|
* @property {object[]} lights - parsed `KHR_lights_punctual` lights (`type`, `color`, `intensity`, `range`, `innerConeAngle`/`outerConeAngle` for spots, world-space `direction`/`position`, `name`)
|
|
294
318
|
* @property {{min: number[], max: number[]}} bounds - world-space scene bounds in glTF units
|
|
@@ -510,9 +534,12 @@ export type Asset = {
|
|
|
510
534
|
*/
|
|
511
535
|
src?: string | string[];
|
|
512
536
|
/**
|
|
513
|
-
* - inline content if not provided through a src url: TMX data for "tmx" assets, GLSL source (the ShaderEffect fragment-body convention) for "shader" assets
|
|
537
|
+
* - inline content if not provided through a src url: TMX data for "tmx" assets, GLSL source (the ShaderEffect fragment-body convention) for "shader" assets. A shader may instead carry a `{glsl, wgsl}` pair, so one asset serves both backends; either half may be omitted
|
|
514
538
|
*/
|
|
515
|
-
data?: string
|
|
539
|
+
data?: string | {
|
|
540
|
+
glsl?: string;
|
|
541
|
+
wgsl?: string;
|
|
542
|
+
};
|
|
516
543
|
/**
|
|
517
544
|
* - Set to true to not to wait for large audio or video file to be downloaded before playing.
|
|
518
545
|
*/
|
|
@@ -526,14 +553,87 @@ export type Asset = {
|
|
|
526
553
|
*/
|
|
527
554
|
loop?: boolean;
|
|
528
555
|
};
|
|
556
|
+
/**
|
|
557
|
+
* One mesh primitive out of a parsed glTF/GLB scene.
|
|
558
|
+
*
|
|
559
|
+
* Spelled out rather than left as `object` so the geometry can be read from
|
|
560
|
+
* TypeScript — feeding `vertices`/`uvs`/`normals`/`indices` straight into a
|
|
561
|
+
* {@link Mesh} or {@link InstancedMesh} is the whole point of exposing it.
|
|
562
|
+
*/
|
|
563
|
+
export type GLTFNode = {
|
|
564
|
+
/**
|
|
565
|
+
* - accumulated world transform, 16 floats, column-major
|
|
566
|
+
*/
|
|
567
|
+
world: number[];
|
|
568
|
+
/**
|
|
569
|
+
* - positions, x,y,z triplets
|
|
570
|
+
*/
|
|
571
|
+
vertices: Float32Array;
|
|
572
|
+
/**
|
|
573
|
+
* - per-vertex normals
|
|
574
|
+
*/
|
|
575
|
+
normals: Float32Array;
|
|
576
|
+
/**
|
|
577
|
+
* - texture coordinates, u,v pairs
|
|
578
|
+
*/
|
|
579
|
+
uvs: Float32Array;
|
|
580
|
+
/**
|
|
581
|
+
* - triangle vertex indices
|
|
582
|
+
*/
|
|
583
|
+
indices: Uint16Array | Uint32Array;
|
|
584
|
+
/**
|
|
585
|
+
* - number of vertices
|
|
586
|
+
*/
|
|
587
|
+
vertexCount: number;
|
|
588
|
+
/**
|
|
589
|
+
* - decoded baseColor texture, or `null`
|
|
590
|
+
*/
|
|
591
|
+
image: HTMLImageElement | null;
|
|
592
|
+
/**
|
|
593
|
+
* - material baseColor factor, `[r, g, b, a]`
|
|
594
|
+
*/
|
|
595
|
+
baseColorFactor?: number[];
|
|
596
|
+
/**
|
|
597
|
+
* - per-vertex colour, packed RGBA8
|
|
598
|
+
*/
|
|
599
|
+
colors?: Uint32Array;
|
|
600
|
+
/**
|
|
601
|
+
* - wrap mode derived from the glTF sampler
|
|
602
|
+
*/
|
|
603
|
+
textureRepeat?: string;
|
|
604
|
+
/**
|
|
605
|
+
* - magnification filter derived from the glTF sampler
|
|
606
|
+
*/
|
|
607
|
+
textureFilter?: string;
|
|
608
|
+
/**
|
|
609
|
+
* - cutout threshold from `alphaMode: "MASK"`
|
|
610
|
+
*/
|
|
611
|
+
alphaCutoff?: number;
|
|
612
|
+
/**
|
|
613
|
+
* - emissive factor, `[r, g, b]`
|
|
614
|
+
*/
|
|
615
|
+
emissive?: number[];
|
|
616
|
+
/**
|
|
617
|
+
* - the material carried `KHR_materials_unlit`
|
|
618
|
+
*/
|
|
619
|
+
unlit?: boolean;
|
|
620
|
+
/**
|
|
621
|
+
* - the material is double-sided
|
|
622
|
+
*/
|
|
623
|
+
doubleSided?: boolean;
|
|
624
|
+
/**
|
|
625
|
+
* - the source node's name
|
|
626
|
+
*/
|
|
627
|
+
name?: string;
|
|
628
|
+
};
|
|
529
629
|
/**
|
|
530
630
|
* a parsed glTF/GLB scene descriptor, as returned by {@link loader.getGLTF}
|
|
531
631
|
*/
|
|
532
632
|
export type GLTFData = {
|
|
533
633
|
/**
|
|
534
|
-
* - one entry per mesh primitive
|
|
634
|
+
* - one entry per mesh primitive
|
|
535
635
|
*/
|
|
536
|
-
nodes:
|
|
636
|
+
nodes: GLTFNode[];
|
|
537
637
|
/**
|
|
538
638
|
* - glTF cameras, each with its `world` transform + the glTF camera parameters (`perspective` for perspective cameras, `orthographic` otherwise)
|
|
539
639
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loader.d.ts","sourceRoot":"","sources":["../../src/loader/loader.js"],"names":[],"mappings":"AAyFA;;;;GAIG;AACH,mDAEC;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,oCAdG;IAAyB,WAAW;IACV,OAAO;IACP,eAAe;CACzC,QAqBF;AAED;;;;;;;;;;;;GAYG;AACH,iCATW,MAAM,QACN,MAAM,QA6BhB;AAuGD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqDG;AAEH;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,gCAnBW,MAAM,4BA6BhB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiDG;AACH,gCAhDW,KAAK,EAAE,2CAEP,OAAO,GACL,OAAO,CAAC,IAAI,CAAC,CAoFzB;AAED;;;;;;;;;;;;;;IAcI;AACJ,4BAbW,MAAM,QAqChB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,4BAhCW,KAAK,0CAGH,MAAM,GAAC,OAAO,CAAC,IAAI,CAAC,CAqGhC;AAED;;;;;;GAMG;AACH,8BALW,KAAK,GACH,OAAO,CA6HnB;AAED;;;;GAIG;AACH,kCAyGC;AAED;;;;;GAKG;AACH,4BAJW,MAAM,GACJ,MAAM,CAUlB;AAED;;;;;GAKG;AACH,+BAJW,MAAM,GACJ,MAAM,CAUlB;AAED;;;;;GAKG;AACH,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O,CAckB;;;;;;;;UAoLrB,MAAM;;;;UACN,MAAM;;;;;;UACN,MAAM,GAAC,MAAM,EAAE;;;;WAGf,MAAM,GAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAA;KAAC;;;;aACrC,OAAO;;;;eACP,OAAO;;;;WACP,OAAO;;;;;;;;;;;;;WAypBP,MAAM,EAAE;;;;cACR,YAAY;;;;aACZ,YAAY;;;;SACZ,YAAY;;;;aACZ,WAAW,GAAC,WAAW;;;;iBACvB,MAAM;;;;WACN,gBAAgB,GAAC,IAAI;;;;sBACrB,MAAM,EAAE;;;;aACR,WAAW;;;;oBACX,MAAM;;;;oBACN,MAAM;;;;kBACN,MAAM;;;;eACN,MAAM,EAAE;;;;YACR,OAAO;;;;kBACP,OAAO;;;;WACP,MAAM;;;;;;;;;WAMN,QAAQ,EAAE;;;;aACV,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;;;;WAC9B,MAAM,EAAE;;;;gBACR,MAAM,EAAE"}
|
|
@@ -14,6 +14,26 @@ export interface AnimationOptions {
|
|
|
14
14
|
/** playback rate multiplier (1 = authored speed). */
|
|
15
15
|
speed: number;
|
|
16
16
|
}
|
|
17
|
+
/**
|
|
18
|
+
* What a caller may PASS as the second argument of `setCurrentAnimation`.
|
|
19
|
+
*
|
|
20
|
+
* The loose counterpart of {@link AnimationOptions}, which is what those
|
|
21
|
+
* choices normalize TO. Every field here is optional, because the defaults are
|
|
22
|
+
* the point: `{ loop: true }` has to be a complete thing to say. Typing an
|
|
23
|
+
* argument as the normalized shape instead makes `loop` and `speed` mandatory
|
|
24
|
+
* and turns the shortest useful call into a type error.
|
|
25
|
+
* @category Animation
|
|
26
|
+
*/
|
|
27
|
+
export type AnimationOptionsInput = string | (() => unknown) | {
|
|
28
|
+
/** called when the animation completes a cycle */
|
|
29
|
+
onComplete?: () => unknown;
|
|
30
|
+
/** name of an animation to switch to when this one finishes */
|
|
31
|
+
next?: string;
|
|
32
|
+
/** loop forever (default) or play once and hold the last frame */
|
|
33
|
+
loop?: boolean;
|
|
34
|
+
/** playback rate multiplier (1 = authored speed) */
|
|
35
|
+
speed?: number;
|
|
36
|
+
};
|
|
17
37
|
/**
|
|
18
38
|
* Normalize the polymorphic second argument of `setCurrentAnimation` into a
|
|
19
39
|
* uniform {@link AnimationOptions}. Accepts:
|
|
@@ -25,10 +45,5 @@ export interface AnimationOptions {
|
|
|
25
45
|
* @returns the normalized options
|
|
26
46
|
* @category Animation
|
|
27
47
|
*/
|
|
28
|
-
export declare function parseAnimationOptions(arg?:
|
|
29
|
-
onComplete?: () => unknown;
|
|
30
|
-
next?: string;
|
|
31
|
-
loop?: boolean;
|
|
32
|
-
speed?: number;
|
|
33
|
-
} | null): AnimationOptions;
|
|
48
|
+
export declare function parseAnimationOptions(arg?: AnimationOptionsInput | null): AnimationOptions;
|
|
34
49
|
//# sourceMappingURL=animation.d.ts.map
|
|
@@ -1 +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;CASd;AAED
|
|
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;CASd;AAED;;;;;;;;;GASG;AACH,MAAM,MAAM,qBAAqB,GAC9B,MAAM,GACN,CAAC,MAAM,OAAO,CAAC,GACf;IACA,kDAAkD;IAClD,UAAU,CAAC,EAAE,MAAM,OAAO,CAAC;IAC3B,+DAA+D;IAC/D,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,kEAAkE;IAClE,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,oDAAoD;IACpD,KAAK,CAAC,EAAE,MAAM,CAAC;CACd,CAAC;AAEL;;;;;;;;;;GAUG;AACH,wBAAgB,qBAAqB,CACpC,GAAG,CAAC,EACD,qBAAqB,GAGrB,IAAI,GACL,gBAAgB,CAiBlB"}
|
|
@@ -70,11 +70,26 @@ export default class Container extends Renderable {
|
|
|
70
70
|
*/
|
|
71
71
|
onChildChange: () => void;
|
|
72
72
|
/**
|
|
73
|
-
*
|
|
74
|
-
*
|
|
75
|
-
*
|
|
73
|
+
* Re-measure this container's bounds from its children whenever a
|
|
74
|
+
* child's bounds change. Expensive — every update walks the whole child
|
|
75
|
+
* list — and off by default, because a parent almost never needs it.
|
|
76
|
+
*
|
|
77
|
+
* Enable it for a group whose extent genuinely IS its members' union
|
|
78
|
+
* and moves as they do: a flock of birds, a squad of enemies. A
|
|
79
|
+
* container whose size is known (or fixed) should be given that size
|
|
80
|
+
* with {@link Renderable#resize} instead, which costs nothing per
|
|
81
|
+
* frame — that is what {@link GLTFModel} does, from the glTF scene's
|
|
82
|
+
* own bounding box.
|
|
83
|
+
*
|
|
84
|
+
* Note that a container with neither — no dimensions of its own and
|
|
85
|
+
* this left off — reports an EMPTY bounds (min `+Infinity`, max
|
|
86
|
+
* `-Infinity`), since {@link Container#updateBounds} then has nothing
|
|
87
|
+
* to measure. Anything reading it is wrong about where the container
|
|
88
|
+
* is, and the physics broadphase, which files every item by
|
|
89
|
+
* `getBounds()`, cannot place it at all.
|
|
76
90
|
* @type {boolean}
|
|
77
91
|
* @default false
|
|
92
|
+
* @see Renderable#getBounds
|
|
78
93
|
*/
|
|
79
94
|
enableChildBoundsUpdate: boolean;
|
|
80
95
|
/**
|
|
@@ -274,11 +289,18 @@ export default class Container extends Renderable {
|
|
|
274
289
|
removeChildNow(child: Renderable | Entity | Sprite | Collectable | Trigger | Draggable | DropTarget | NineSliceSprite | ImageLayer | ColorLayer | Light2d | UIBaseElement | UISpriteElement | UITextButton | Text | BitmapText, keepalive?: boolean): void;
|
|
275
290
|
/**
|
|
276
291
|
* Automatically set the specified property of all childs to the given value
|
|
292
|
+
*
|
|
293
|
+
* This ASSIGNS to the children — after it, their own property carries the
|
|
294
|
+
* value. To fade a subtree without touching what the children are, set
|
|
295
|
+
* {@link Renderable#alpha} on the container instead: opacity cascades at
|
|
296
|
+
* draw time and leaves every child's own value alone.
|
|
277
297
|
* @param {string} prop - property name
|
|
278
|
-
* @param {
|
|
298
|
+
* @param {*} value - property value; whatever the named property holds, so a
|
|
299
|
+
* flag is a boolean and a colour is a string, not only an object
|
|
279
300
|
* @param {boolean} [recursive=false] - recursively apply the value to child containers if true
|
|
301
|
+
* @see Renderable#alpha
|
|
280
302
|
*/
|
|
281
|
-
setChildsProperty(prop: string, value:
|
|
303
|
+
setChildsProperty(prop: string, value: any, recursive?: boolean): void;
|
|
282
304
|
/**
|
|
283
305
|
* Move the child in the group one step forward (z depth).
|
|
284
306
|
* @param {Renderable|Entity|Sprite|Collectable|Trigger|Draggable|DropTarget|NineSliceSprite|ImageLayer|ColorLayer|Light2d|UIBaseElement|UISpriteElement|UITextButton|Text|BitmapText} child - Child to be moved
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"container.d.ts","sourceRoot":"","sources":["../../src/renderable/container.js"],"names":[],"mappings":"AAoKA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH;;;;;;;;;GASG;AACH;IACC;;;;;;;OAOG;IACH,gBAPW,MAAM,MACN,MAAM,UACN,MAAM,WACN,MAAM,SACN,OAAO,
|
|
1
|
+
{"version":3,"file":"container.d.ts","sourceRoot":"","sources":["../../src/renderable/container.js"],"names":[],"mappings":"AAoKA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH;;;;;;;;;GASG;AACH;IACC;;;;;;;OAOG;IACH,gBAPW,MAAM,MACN,MAAM,UACN,MAAM,WACN,MAAM,SACN,OAAO,EAsIjB;IA/HA;;;;OAIG;IACH,iBAAuB;IAEvB;;;;OAIG;IACH,MAHU,OAAO,CAGD;IAEhB;;;;OAIG;IACH,4BAAyB;IAEzB;;;;;;;OAOG;IACH,SALU,MAAM,CAKE;IAClB;;;OAGG;IACH,wCAA8B;IAE9B;;;;OAIG;IACH,UAHU,OAAO,CAGG;IAEpB;;;;OAIG;IACH,WAHU,OAAO,CAGI;IAErB;;;;OAIG;IACH,UAHU,OAAO,CAGI;IAErB;;;OAGG;IACH,0BAEC;IAED;;;;;;;;;;;;;;;;;;;;;OAqBG;IACH,yBAJU,OAAO,CAImB;IAEpC;;;;;;;OAOG;IACH,iBANU,KAAK,CAMmC;IAqBjD,yCAMC;IAiCH,kBANU,GAAG,GAAC,GAAG,GAAC,GAAG,GAAC,OAAO,EAmB5B;IAzCD;;;;;;;;;;;;;;;;;;;;;;;;OAwBG;IACH,cAHU,G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OAIG;IACH,+BAEC;IAED;;;;OAIG;IACH,sCAEC;IAED;;;;;;;;;;;;;;;;OAgBG;IACH,mCAWC;IAED;;;;OAIG;IACH,+BAEC;IAED;;;;OAIG;IACH,+BAEC;IA+FD;;;;;;;;OAQG;IACH,iCAHW,QAAQ,GACN,QAAQ,CAMpB;CAkHD;uBAt3CsB,iBAAiB;2BA+JhB,oBAAoB;wBACrB,oBAAoB;wBACpB,aAAa;6BACR,kBAAkB;yBACtB,cAAc;+BACR,gBAAgB;gCACf,gBAAgB;iCACf,sBAAsB;4BAC3B,iBAAiB;4BACjB,iBAAiB;+BAEd,uBAAuB;iCACrB,yBAAyB;8BAC5B,sBAAsB;sBAC9B,gBAAgB;4BACV,sBAAsB;4BACxB,wBAAwB"}
|
|
@@ -79,20 +79,25 @@
|
|
|
79
79
|
* forest.visibleInstanceCount = 1200;
|
|
80
80
|
* app.world.addChild(forest, 10);
|
|
81
81
|
*/
|
|
82
|
+
/**
|
|
83
|
+
* Everything {@link InstancedMesh} takes: the instancing settings, plus every
|
|
84
|
+
* {@link MeshSettings} — they are handed to {@link Mesh} whole, so the type
|
|
85
|
+
* says so by intersection rather than by copying the list.
|
|
86
|
+
* @typedef {object} InstancedMeshOwnSettings
|
|
87
|
+
* @property {number} [instanceCount=0] - number of instances to pre-allocate. Instances start at the group origin (identity transform) until placed; `addInstance` grows past this.
|
|
88
|
+
* @property {boolean} [instanceColors=false] - give each instance its own colour (16 bytes per instance), multiplied into the mesh tint
|
|
89
|
+
* @property {boolean} [instanceData=false] - give each instance an opaque `vec4` (16 bytes per instance). Read as emissive by the built-in lit shading, or as anything at all by a custom mesh shader.
|
|
90
|
+
*/
|
|
91
|
+
/**
|
|
92
|
+
* @typedef {InstancedMeshOwnSettings & import("./mesh.js").MeshSettings} InstancedMeshSettings
|
|
93
|
+
*/
|
|
82
94
|
export default class InstancedMesh extends Mesh {
|
|
83
95
|
/**
|
|
84
96
|
* @param {number} x - the x coordinate of the group origin
|
|
85
97
|
* @param {number} y - the y coordinate of the group origin
|
|
86
|
-
* @param {
|
|
87
|
-
* @param {number} [settings.instanceCount=0] - number of instances to pre-allocate. Instances start at the group origin (identity transform) until placed; `addInstance` grows past this.
|
|
88
|
-
* @param {boolean} [settings.instanceColors=false] - give each instance its own colour (16 bytes per instance), multiplied into the mesh tint
|
|
89
|
-
* @param {boolean} [settings.instanceData=false] - give each instance an opaque `vec4` (16 bytes per instance). Read as emissive by the built-in lit shading, or as anything at all by a custom mesh shader.
|
|
98
|
+
* @param {InstancedMeshSettings} settings - every {@link Mesh} setting, plus the instancing ones
|
|
90
99
|
*/
|
|
91
|
-
constructor(x: number, y: number, settings:
|
|
92
|
-
instanceCount?: number | undefined;
|
|
93
|
-
instanceColors?: boolean | undefined;
|
|
94
|
-
instanceData?: boolean | undefined;
|
|
95
|
-
});
|
|
100
|
+
constructor(x: number, y: number, settings: InstancedMeshSettings);
|
|
96
101
|
/**
|
|
97
102
|
* The packed instance records, `instanceLayout.floats` per instance.
|
|
98
103
|
* Editable in place for bulk updates — announce those with
|
|
@@ -203,6 +208,26 @@ export default class InstancedMesh extends Mesh {
|
|
|
203
208
|
*/
|
|
204
209
|
draw(renderer: CanvasRenderer | WebGLRenderer, viewport?: Camera2d): void;
|
|
205
210
|
}
|
|
211
|
+
/**
|
|
212
|
+
* Everything {@link InstancedMesh} takes: the instancing settings, plus every
|
|
213
|
+
* {@link MeshSettings} — they are handed to {@link Mesh} whole, so the type
|
|
214
|
+
* says so by intersection rather than by copying the list.
|
|
215
|
+
*/
|
|
216
|
+
export type InstancedMeshOwnSettings = {
|
|
217
|
+
/**
|
|
218
|
+
* - number of instances to pre-allocate. Instances start at the group origin (identity transform) until placed; `addInstance` grows past this.
|
|
219
|
+
*/
|
|
220
|
+
instanceCount?: number;
|
|
221
|
+
/**
|
|
222
|
+
* - give each instance its own colour (16 bytes per instance), multiplied into the mesh tint
|
|
223
|
+
*/
|
|
224
|
+
instanceColors?: boolean;
|
|
225
|
+
/**
|
|
226
|
+
* - give each instance an opaque `vec4` (16 bytes per instance). Read as emissive by the built-in lit shading, or as anything at all by a custom mesh shader.
|
|
227
|
+
*/
|
|
228
|
+
instanceData?: boolean;
|
|
229
|
+
};
|
|
230
|
+
export type InstancedMeshSettings = InstancedMeshOwnSettings & import("./mesh.js").MeshSettings;
|
|
206
231
|
import Mesh from "./mesh.js";
|
|
207
232
|
import { Matrix3d } from "../math/matrix3d.ts";
|
|
208
233
|
//# sourceMappingURL=instanced_mesh.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"instanced_mesh.d.ts","sourceRoot":"","sources":["../../src/renderable/instanced_mesh.js"],"names":[],"mappings":"AAsBA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgFG;AACH;IACC
|
|
1
|
+
{"version":3,"file":"instanced_mesh.d.ts","sourceRoot":"","sources":["../../src/renderable/instanced_mesh.js"],"names":[],"mappings":"AAsBA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgFG;AACH;;;;;;;;GAQG;AAEH;;GAEG;AAEH;IACC;;;;OAIG;IACH,eAJW,MAAM,KACN,MAAM,YACN,qBAAqB,EAyF/B;IApFA;;;;;;;OAOG;IACH,gBAJU,MAAM,CAOf;IAED;;;;;;;OAOG;IACH,gBAFU,YAAY,CAEmB;IAEzC;;;;;;OAMG;IACH,kBAJU,MAAM,CAIS;IAUzB;;;OAGG;IACH,0BAA0B;IAG1B;;;OAGG;IACH,0BAA0B;IAE1B;;;OAGG;IACH,oBAA2B;IAC3B;;;OAGG;IACH,mBAAmB;IAEnB;;;OAGG;IACH,uBAAuB;IACvB;;;OAGG;IACH,8BAA+B;IAE/B;;;OAGG;IACH,sBAAuB;IAoBxB,yBANU,MAAM,EAgDf;IAvDD;;;;;;;;OAQG;IACH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