melonjs 19.7.1 → 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 +18 -6
- 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 +17392 -14529
- 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/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/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/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 +1 -1
- package/build/renderable/light2d.d.ts.map +0 -1
|
@@ -0,0 +1,314 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A textured **quad in 3D space** — the 3D counterpart of {@link Sprite},
|
|
3
|
+
* for rendering sprites under a {@link Camera3d} (the 2.5D workflow: characters,
|
|
4
|
+
* pickups, foliage, signs, particles in a 3D scene). It's a thin {@link Mesh}
|
|
5
|
+
* subclass, so it rides the same world-space mesh pipeline (depth testing,
|
|
6
|
+
* frustum culling) and supports the same material features (`lit`, `emissive`,
|
|
7
|
+
* `alphaCutoff`).
|
|
8
|
+
*
|
|
9
|
+
* Its headline feature is **billboarding** — keeping the quad facing the camera
|
|
10
|
+
* regardless of camera orientation (see {@link Sprite3d#billboard}). With
|
|
11
|
+
* billboarding off it's a fixed-orientation quad (decals, posters, ground
|
|
12
|
+
* markers).
|
|
13
|
+
*
|
|
14
|
+
* **Frame animation** is supported through the same API as {@link Sprite}
|
|
15
|
+
* ({@link Sprite3d#addAnimation}, {@link Sprite3d#setCurrentAnimation},
|
|
16
|
+
* {@link Sprite3d#play}/`pause`/`stop`) — pass `framewidth`/`frameheight` for a
|
|
17
|
+
* spritesheet, or a packed {@link TextureAtlas}, exactly as you would for a 2D
|
|
18
|
+
* `Sprite`. Both share the {@link FrameAnimation} engine, so the timing, looping
|
|
19
|
+
* and chaining behavior is identical; `Sprite3d` maps the current frame onto the
|
|
20
|
+
* quad each step — including packer **rotated** and **trimmed** regions, mapped
|
|
21
|
+
* to full parity with the 2D `Sprite`.
|
|
22
|
+
*
|
|
23
|
+
* **Camera3d only.** Like {@link Mesh}, `Sprite3d` renders through the 3D
|
|
24
|
+
* world-space path; under a 2D `Camera2d` it falls back to the mesh's
|
|
25
|
+
* self-projection and **billboarding has no effect** (a 2D scene has no camera
|
|
26
|
+
* orientation to face). Use a regular {@link Sprite} for 2D.
|
|
27
|
+
* @augments Mesh
|
|
28
|
+
* @category Game Objects
|
|
29
|
+
* @example
|
|
30
|
+
* import { Application, Camera3d, Sprite3d } from "melonjs";
|
|
31
|
+
*
|
|
32
|
+
* // a 3D app (Camera3d is required for billboarding)
|
|
33
|
+
* const app = new Application(1024, 768, { cameraClass: Camera3d });
|
|
34
|
+
*
|
|
35
|
+
* // a tree that always faces the camera but stays upright (2.5D).
|
|
36
|
+
* // its texture has a transparent background — the mesh pass is opaque, so
|
|
37
|
+
* // `alphaCutoff` (default 0.5) discards those texels for a clean silhouette.
|
|
38
|
+
* const tree = new Sprite3d(0, 0, {
|
|
39
|
+
* image: "tree", // a preloaded image with transparency
|
|
40
|
+
* width: 64, height: 96,
|
|
41
|
+
* z: -200, // 3D depth (world z)
|
|
42
|
+
* billboard: true, // = "cylindrical"
|
|
43
|
+
* // alphaCutoff: 0.5, // the default — lower it to keep softer edges,
|
|
44
|
+
* // or set 0 for a fully-opaque quad
|
|
45
|
+
* });
|
|
46
|
+
* app.world.addChild(tree); // add it to the game world, like any Renderable
|
|
47
|
+
*
|
|
48
|
+
* // an animated, fully camera-facing pickup from a spritesheet, mirrored
|
|
49
|
+
* const coin = new Sprite3d(0, 0, {
|
|
50
|
+
* image: "coins",
|
|
51
|
+
* framewidth: 32, frameheight: 32,
|
|
52
|
+
* width: 48, height: 48,
|
|
53
|
+
* billboard: "spherical",
|
|
54
|
+
* alphaCutoff: 0.5, // cut out the transparent frame background
|
|
55
|
+
* });
|
|
56
|
+
* coin.addAnimation("spin", [0, 1, 2, 3, 4, 5]);
|
|
57
|
+
* coin.setCurrentAnimation("spin");
|
|
58
|
+
* coin.flipX(); // face the other way (mirrors the sprite)
|
|
59
|
+
* app.world.addChild(coin);
|
|
60
|
+
*/
|
|
61
|
+
export default class Sprite3d extends Mesh {
|
|
62
|
+
/**
|
|
63
|
+
* @param {number} x - world x position
|
|
64
|
+
* @param {number} y - world y position
|
|
65
|
+
* @param {object} settings - configuration
|
|
66
|
+
* @param {HTMLImageElement|TextureAtlas|string} [settings.image] - the sprite texture (image name, image, or atlas). Alias: `settings.texture`.
|
|
67
|
+
* @param {number} [settings.width=settings.framewidth] - quad width in world units (pixels)
|
|
68
|
+
* @param {number} [settings.height=settings.width] - quad height in world units
|
|
69
|
+
* @param {number} [settings.framewidth] - width of a single frame within a spritesheet (enables frame animation)
|
|
70
|
+
* @param {number} [settings.frameheight] - height of a single frame within a spritesheet
|
|
71
|
+
* @param {string} [settings.region] - region name when using a texture atlas (see {@link TextureAtlas})
|
|
72
|
+
* @param {object[]} [settings.anims] - predefined animations (same shape as {@link Sprite})
|
|
73
|
+
* @param {number} [settings.z=0] - 3D depth (world z); also settable later via `.depth`
|
|
74
|
+
* @param {boolean|string} [settings.billboard=false] - billboard mode: `false` (fixed orientation), `true` / `"cylindrical"` (faces the camera but stays upright — the 2.5D default), or `"spherical"` (faces the camera on all axes). Only applies under a `Camera3d`.
|
|
75
|
+
* @param {boolean} [settings.flipX=false] - mirror the sprite horizontally (see {@link Sprite3d#flipX})
|
|
76
|
+
* @param {boolean} [settings.flipY=false] - mirror the sprite vertically (see {@link Sprite3d#flipY})
|
|
77
|
+
* @param {boolean} [settings.lit=false] - shade through the lit mesh batcher (see {@link Mesh})
|
|
78
|
+
* @param {number[]|Float32Array} [settings.emissive] - emissive color (see {@link Mesh})
|
|
79
|
+
* @param {number} [settings.alphaCutoff=0.5] - alpha cutout threshold (see {@link Mesh}). The mesh pass is opaque (no alpha blending), so this defaults to `0.5` to discard a sprite's transparent background (clean cutout silhouette, correct depth, no sorting). Set `0` for a fully-opaque quad, or tune the threshold.
|
|
80
|
+
*/
|
|
81
|
+
constructor(x: number, y: number, settings: {
|
|
82
|
+
image?: string | HTMLImageElement | TextureAtlas | undefined;
|
|
83
|
+
width?: number | undefined;
|
|
84
|
+
height?: number | undefined;
|
|
85
|
+
framewidth?: number | undefined;
|
|
86
|
+
frameheight?: number | undefined;
|
|
87
|
+
region?: string | undefined;
|
|
88
|
+
anims?: object[] | undefined;
|
|
89
|
+
z?: number | undefined;
|
|
90
|
+
billboard?: string | boolean | undefined;
|
|
91
|
+
flipX?: boolean | undefined;
|
|
92
|
+
flipY?: boolean | undefined;
|
|
93
|
+
lit?: boolean | undefined;
|
|
94
|
+
emissive?: number[] | Float32Array<ArrayBufferLike> | undefined;
|
|
95
|
+
alphaCutoff?: number | undefined;
|
|
96
|
+
});
|
|
97
|
+
/**
|
|
98
|
+
* the quad's half-width in world units (see {@link Sprite3d#billboard}).
|
|
99
|
+
* @type {number}
|
|
100
|
+
* @ignore
|
|
101
|
+
*/
|
|
102
|
+
_halfW: number;
|
|
103
|
+
/** @ignore */
|
|
104
|
+
_halfH: number;
|
|
105
|
+
/** @ignore */
|
|
106
|
+
_refLw: number;
|
|
107
|
+
/** @ignore */
|
|
108
|
+
_refLh: number;
|
|
109
|
+
/** @ignore */
|
|
110
|
+
_flipX: boolean;
|
|
111
|
+
/** @ignore */
|
|
112
|
+
_flipY: boolean;
|
|
113
|
+
/** @ignore */
|
|
114
|
+
_region: object | null;
|
|
115
|
+
/**
|
|
116
|
+
* a callback fired when the current animation completes a cycle.
|
|
117
|
+
* @type {Function}
|
|
118
|
+
*/
|
|
119
|
+
onended: Function;
|
|
120
|
+
/** the frame-aware atlas (== this.texture) @ignore */
|
|
121
|
+
source: any;
|
|
122
|
+
/** the atlas region dictionary @ignore */
|
|
123
|
+
textureAtlas: any;
|
|
124
|
+
/** name→index map for named-region atlases @ignore */
|
|
125
|
+
atlasIndices: any;
|
|
126
|
+
/** the shared frame-animation engine @ignore */
|
|
127
|
+
_frameAnim: FrameAnimation;
|
|
128
|
+
/**
|
|
129
|
+
* Billboard mode — keeps the quad facing the active {@link Camera3d}:
|
|
130
|
+
* - `false` (default) — fixed orientation (a flat quad in the XY plane;
|
|
131
|
+
* decals, posters, ground markers).
|
|
132
|
+
* - `true` / `"cylindrical"` — faces the camera but stays upright
|
|
133
|
+
* (rotates only around the world up axis). The 2.5D default — trees,
|
|
134
|
+
* characters, items.
|
|
135
|
+
* - `"spherical"` — faces the camera on all axes (particles, glints).
|
|
136
|
+
*
|
|
137
|
+
* **Only applies under a `Camera3d`**; ignored on the 2D path.
|
|
138
|
+
*
|
|
139
|
+
* Note: while billboarding, orientation comes from the camera, so the
|
|
140
|
+
* renderable's `currentTransform` (`rotate()` / `scale()` / parent-container
|
|
141
|
+
* transforms) and `meshScale` are **not** applied — only `pos` / `depth`,
|
|
142
|
+
* `flipX` / `flipY`, and the quad's authored size. With billboarding `false`
|
|
143
|
+
* the standard {@link Mesh} world transform applies as usual.
|
|
144
|
+
* @type {boolean|string}
|
|
145
|
+
* @default false
|
|
146
|
+
*/
|
|
147
|
+
billboard: boolean | string;
|
|
148
|
+
/** the camera captured at draw time for the billboard projection @ignore */
|
|
149
|
+
_billboardCam: Camera3d | null;
|
|
150
|
+
/**
|
|
151
|
+
* defined animations, keyed by id (see {@link Sprite3d#addAnimation}).
|
|
152
|
+
* @type {object}
|
|
153
|
+
*/
|
|
154
|
+
get anim(): object;
|
|
155
|
+
/**
|
|
156
|
+
* current frame information (name / index / texture offset & size / trim).
|
|
157
|
+
* @type {object}
|
|
158
|
+
*/
|
|
159
|
+
get current(): object;
|
|
160
|
+
set dt(value: number);
|
|
161
|
+
/**
|
|
162
|
+
* elapsed time within the current animation frame, in milliseconds.
|
|
163
|
+
* @type {number}
|
|
164
|
+
*/
|
|
165
|
+
get dt(): number;
|
|
166
|
+
set animationspeed(value: number);
|
|
167
|
+
/**
|
|
168
|
+
* animation cycling speed (delay between frames in ms).
|
|
169
|
+
* @type {number}
|
|
170
|
+
* @default 100
|
|
171
|
+
*/
|
|
172
|
+
get animationspeed(): number;
|
|
173
|
+
set animationpause(value: boolean);
|
|
174
|
+
/**
|
|
175
|
+
* pause the frame animation, freezing the current frame.
|
|
176
|
+
* @type {boolean}
|
|
177
|
+
* @default false
|
|
178
|
+
*/
|
|
179
|
+
get animationpause(): boolean;
|
|
180
|
+
/**
|
|
181
|
+
* Add an animation, identical to {@link Sprite#addAnimation}.
|
|
182
|
+
* @param {string} name - animation id
|
|
183
|
+
* @param {number[]|string[]|object[]} index - frame indices / names (see {@link Sprite#addAnimation})
|
|
184
|
+
* @param {number} [animationspeed] - cycling speed in ms
|
|
185
|
+
* @returns {number} number of frames added
|
|
186
|
+
*/
|
|
187
|
+
addAnimation(name: string, index: number[] | string[] | object[], animationspeed?: number): number;
|
|
188
|
+
/**
|
|
189
|
+
* Select the active animation, identical to {@link Sprite#setCurrentAnimation}.
|
|
190
|
+
* @param {string} name - animation id
|
|
191
|
+
* @param {string|Function|object} [resetAnim] - loop / chain / completion behavior
|
|
192
|
+
* @param {boolean} [preserve_dt=false]
|
|
193
|
+
* @returns {Sprite3d} Reference to this object for method chaining
|
|
194
|
+
*/
|
|
195
|
+
setCurrentAnimation(name: string, resetAnim?: string | Function | object, preserve_dt?: boolean): Sprite3d;
|
|
196
|
+
/**
|
|
197
|
+
* Reverse the given (or current) animation in place (see {@link Sprite#reverseAnimation}).
|
|
198
|
+
* @param {string} [name] - animation id
|
|
199
|
+
* @returns {Sprite3d} Reference to this object for method chaining
|
|
200
|
+
*/
|
|
201
|
+
reverseAnimation(name?: string): Sprite3d;
|
|
202
|
+
/**
|
|
203
|
+
* Mirror the sprite horizontally (e.g. flip a character to face the other
|
|
204
|
+
* way). Unlike the 2D {@link Sprite}, the flip mirrors the quad's local
|
|
205
|
+
* geometry so it works for every billboard mode and for rotated/trimmed atlas
|
|
206
|
+
* regions alike. Takes effect immediately on the current frame.
|
|
207
|
+
* @param {boolean} [flip=true]
|
|
208
|
+
* @returns {Sprite3d} Reference to this object for method chaining
|
|
209
|
+
*/
|
|
210
|
+
flipX(flip?: boolean): Sprite3d;
|
|
211
|
+
/**
|
|
212
|
+
* Mirror the sprite vertically. See {@link Sprite3d#flipX}.
|
|
213
|
+
* @param {boolean} [flip=true]
|
|
214
|
+
* @returns {Sprite3d} Reference to this object for method chaining
|
|
215
|
+
*/
|
|
216
|
+
flipY(flip?: boolean): Sprite3d;
|
|
217
|
+
/**
|
|
218
|
+
* @returns {boolean} true if the sprite is mirrored horizontally.
|
|
219
|
+
*/
|
|
220
|
+
isFlippedX(): boolean;
|
|
221
|
+
/**
|
|
222
|
+
* @returns {boolean} true if the sprite is mirrored vertically.
|
|
223
|
+
*/
|
|
224
|
+
isFlippedY(): boolean;
|
|
225
|
+
/**
|
|
226
|
+
* Play (and optionally switch to) an animation, identical to {@link Sprite#play}.
|
|
227
|
+
* @param {string} [name] - animation id to play; omit to resume
|
|
228
|
+
* @param {string|Function|object} [options] - loop / chain / completion behavior
|
|
229
|
+
* @returns {Sprite3d} Reference to this object for method chaining
|
|
230
|
+
*/
|
|
231
|
+
play(name?: string, options?: string | Function | object): Sprite3d;
|
|
232
|
+
/**
|
|
233
|
+
* Pause the current animation, freezing the current frame (see {@link Sprite#pause}).
|
|
234
|
+
* @returns {Sprite3d} Reference to this object for method chaining
|
|
235
|
+
*/
|
|
236
|
+
pause(): Sprite3d;
|
|
237
|
+
/**
|
|
238
|
+
* Stop and reset the current animation to its first frame (see {@link Sprite#stop}).
|
|
239
|
+
* @returns {Sprite3d} Reference to this object for method chaining
|
|
240
|
+
*/
|
|
241
|
+
stop(): Sprite3d;
|
|
242
|
+
/**
|
|
243
|
+
* Force the current animation frame index (see {@link Sprite#setAnimationFrame}).
|
|
244
|
+
* @param {number} [index=0] - animation frame index
|
|
245
|
+
* @returns {Sprite3d} Reference to this object for method chaining
|
|
246
|
+
*/
|
|
247
|
+
setAnimationFrame(index?: number): Sprite3d;
|
|
248
|
+
/**
|
|
249
|
+
* Apply a texture region directly (see {@link Sprite#setRegion}).
|
|
250
|
+
* @param {object} region - typically from `texture.getRegion(name)`
|
|
251
|
+
* @returns {Sprite3d} Reference to this object for method chaining
|
|
252
|
+
*/
|
|
253
|
+
setRegion(region: object): Sprite3d;
|
|
254
|
+
/**
|
|
255
|
+
* @param {string} name - animation id
|
|
256
|
+
* @returns {boolean} true if `name` is the current animation (see {@link Sprite#isCurrentAnimation}).
|
|
257
|
+
*/
|
|
258
|
+
isCurrentAnimation(name: string): boolean;
|
|
259
|
+
/**
|
|
260
|
+
* @returns {string[]} the names of every defined animation (see {@link Sprite#getAnimationNames}).
|
|
261
|
+
*/
|
|
262
|
+
getAnimationNames(): string[];
|
|
263
|
+
/**
|
|
264
|
+
* @returns {number} the current animation frame index (see {@link Sprite#getCurrentAnimationFrame}).
|
|
265
|
+
*/
|
|
266
|
+
getCurrentAnimationFrame(): number;
|
|
267
|
+
/**
|
|
268
|
+
* The frame object for the given index within the current animation.
|
|
269
|
+
* @param {number} id - the frame id
|
|
270
|
+
* @returns {object} the frame data
|
|
271
|
+
* @ignore
|
|
272
|
+
*/
|
|
273
|
+
getAnimationFrameObjectByIndex(id: number): object;
|
|
274
|
+
/**
|
|
275
|
+
* Apply the current frame's texture region to the quad — the geometry hook
|
|
276
|
+
* called by the shared {@link FrameAnimation} engine (the 3D counterpart of
|
|
277
|
+
* {@link Sprite}'s sub-texture / size / anchor swap). Rewrites both the quad's
|
|
278
|
+
* UVs (the atlas sub-rect, with a 90° corner permutation for packer-rotated
|
|
279
|
+
* regions) and its local vertices (the trimmed art's sub-rectangle within the
|
|
280
|
+
* logical frame, scaled into the quad's world footprint), so trimmed and
|
|
281
|
+
* rotated `TextureAtlas` regions render at full parity with the 2D `Sprite`.
|
|
282
|
+
* @param {object} region - the texture region object
|
|
283
|
+
* @ignore
|
|
284
|
+
*/
|
|
285
|
+
_applyFrame(region: object): void;
|
|
286
|
+
/**
|
|
287
|
+
* Release resources (returns the engine's pooled `current.offset` to the
|
|
288
|
+
* pool), then defer to the standard mesh/renderable teardown.
|
|
289
|
+
* @ignore
|
|
290
|
+
*/
|
|
291
|
+
destroy(): void;
|
|
292
|
+
/**
|
|
293
|
+
* Capture the rendering camera so {@link Sprite3d#_projectVerticesWorld} can
|
|
294
|
+
* orient the billboard toward it. Read from the per-draw `viewport` (passed
|
|
295
|
+
* by `Container.draw`), so a multi-camera stage billboards correctly against
|
|
296
|
+
* whichever camera is drawing. When no `Camera3d` viewport is supplied the
|
|
297
|
+
* billboard is inactive and the quad renders fixed-orientation.
|
|
298
|
+
* @param {CanvasRenderer|WebGLRenderer} renderer
|
|
299
|
+
* @param {Camera2d} [viewport]
|
|
300
|
+
* @ignore
|
|
301
|
+
*/
|
|
302
|
+
draw(renderer: CanvasRenderer | WebGLRenderer, viewport?: Camera2d): void;
|
|
303
|
+
/**
|
|
304
|
+
* Orient the quad toward the camera when billboarding; otherwise defer to the
|
|
305
|
+
* standard {@link Mesh} world projection (a fixed-orientation quad).
|
|
306
|
+
* @ignore
|
|
307
|
+
*/
|
|
308
|
+
_projectVerticesWorld(offsetX: any, offsetY: any, offsetZ: any): void;
|
|
309
|
+
}
|
|
310
|
+
import Mesh from "./mesh.js";
|
|
311
|
+
import FrameAnimation from "./frameAnimation.js";
|
|
312
|
+
import Camera3d from "../camera/camera3d.ts";
|
|
313
|
+
import { TextureAtlas } from "../video/texture/atlas.js";
|
|
314
|
+
//# sourceMappingURL=sprite3d.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sprite3d.d.ts","sourceRoot":"","sources":["../../src/renderable/sprite3d.js"],"names":[],"mappings":"AAgCA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2DG;AACH;IACC;;;;;;;;;;;;;;;;;;OAkBG;IACH,eAlBW,MAAM,KACN,MAAM,YAEd;QAAwD,KAAK;QACnC,KAAK;QACL,MAAM;QACN,UAAU;QACV,WAAW;QACX,MAAM;QACJ,KAAK;QACP,CAAC;QACO,SAAS;QAChB,KAAK;QACL,KAAK;QACL,GAAG;QACW,QAAQ;QACvB,WAAW;KACvC,EAiMA;IAnHA;;;;OAIG;IACH,QAHU,MAAM,CAGA;IAChB,cAAc;IACd,eAAgB;IAIhB,cAAc;IACd,eAAe;IACf,cAAc;IACd,eAAe;IAKf,cAAc;IACd,gBAAmB;IACnB,cAAc;IACd,gBAAmB;IAEnB,cAAc;IACd,uBAAmB;IAKnB;;;OAGG;IACH,kBAAwB;IACxB,sDAAsD;IACtD,YAA0B;IAM1B,0CAA0C;IAC1C,kBAA6D;IAC7D,sDAAsD;IACtD,kBAAyC;IACzC,gDAAgD;IAChD,2BAEE;IAKF;;;;;;;;;;;;;;;;;;OAkBG;IACH,WAHU,OAAO,GAAC,MAAM,CAGoB;IAE5C,4EAA4E;IAC5E,+BAAyB;IAyC1B;;;OAGG;IACH,YAFU,MAAM,CAIf;IAED;;;OAGG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MlB;IAED;;;;OAIG;IACH,sEA2DC;CACD;iBA5tBgB,WAAW;2BADD,qBAAqB;qBAJ3B,uBAAuB;6BAGf,2BAA2B"}
|
package/build/state/stage.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import type Application from "./../application/application.ts";
|
|
2
2
|
import Camera2d from "./../camera/camera2d.ts";
|
|
3
|
+
import type Light2d from "./../lighting/light2d.ts";
|
|
4
|
+
import type { Light3d } from "./../lighting/light3d.ts";
|
|
3
5
|
import { Color } from "./../math/color.ts";
|
|
4
6
|
import type World from "./../physics/world.js";
|
|
5
|
-
import type Light2d from "./../renderable/light2d.js";
|
|
6
7
|
import type Renderer from "./../video/renderer.js";
|
|
7
8
|
interface StageSettings {
|
|
8
9
|
cameras: Camera2d[];
|
|
@@ -61,6 +62,13 @@ export default class Stage {
|
|
|
61
62
|
* @ignore
|
|
62
63
|
*/
|
|
63
64
|
_activeLights: Set<Light2d>;
|
|
65
|
+
/**
|
|
66
|
+
* Internal set of active 3D lights, auto-populated by `Light3d`'s
|
|
67
|
+
* `onActivateEvent` / `onDeactivateEvent` hooks. Read by the lit mesh
|
|
68
|
+
* batcher each frame to shade `lit` meshes under a `Camera3d`.
|
|
69
|
+
* @ignore
|
|
70
|
+
*/
|
|
71
|
+
_activeLights3d: Set<Light3d>;
|
|
64
72
|
/**
|
|
65
73
|
* an ambient light that will be added to the stage rendering
|
|
66
74
|
* @default "#000000"
|
|
@@ -99,6 +107,17 @@ export default class Stage {
|
|
|
99
107
|
* @ignore
|
|
100
108
|
*/
|
|
101
109
|
_unregisterLight(light: Light2d): void;
|
|
110
|
+
/**
|
|
111
|
+
* Called by `Light3d.onActivateEvent` to register a 3D light with the stage.
|
|
112
|
+
* Read by the lit mesh batcher. Users normally don't call this.
|
|
113
|
+
* @ignore
|
|
114
|
+
*/
|
|
115
|
+
_registerLight3d(light: Light3d): void;
|
|
116
|
+
/**
|
|
117
|
+
* Called by `Light3d.onDeactivateEvent` to deregister a 3D light.
|
|
118
|
+
* @ignore
|
|
119
|
+
*/
|
|
120
|
+
_unregisterLight3d(light: Light3d): void;
|
|
102
121
|
/**
|
|
103
122
|
* Object reset function
|
|
104
123
|
* @ignore
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stage.d.ts","sourceRoot":"","sources":["../../src/state/stage.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,WAAW,MAAM,iCAAiC,CAAC;AAC/D,OAAO,QAAQ,MAAM,yBAAyB,CAAC;AAC/C,OAAO,
|
|
1
|
+
{"version":3,"file":"stage.d.ts","sourceRoot":"","sources":["../../src/state/stage.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,WAAW,MAAM,iCAAiC,CAAC;AAC/D,OAAO,QAAQ,MAAM,yBAAyB,CAAC;AAC/C,OAAO,KAAK,OAAO,MAAM,0BAA0B,CAAC;AACpD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC3C,OAAO,KAAK,KAAK,MAAM,uBAAuB,CAAC;AAE/C,OAAO,KAAK,QAAQ,MAAM,wBAAwB,CAAC;AAEnD,UAAU,aAAa;IACtB,OAAO,EAAE,QAAQ,EAAE,CAAC;IACpB;;;;;;OAMG;IACH,WAAW,CAAC,EAAE,KACb,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,KACR,QAAQ,CAAC;IACd,YAAY,CAAC,EAAE,CAAC,GAAG,EAAE,WAAW,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,IAAI,CAAC;IAC9D,cAAc,CAAC,EAAE,CAAC,GAAG,EAAE,WAAW,KAAK,IAAI,CAAC;CAC5C;AAUD;;;;;;GAMG;AACH,MAAM,CAAC,OAAO,OAAO,KAAK;IACzB;;;;OAIG;IACH,OAAO,EAAE,GAAG,CAAC,MAAM,E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CAAC,GAAG,EAAE,WAAW,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI;IAOxD;;;;OAIG;IACH,cAAc,CAAC,GAAG,EAAE,WAAW,GAAG,IAAI;CAMtC"}
|
|
@@ -54,6 +54,13 @@ export default class VertexArrayBuffer {
|
|
|
54
54
|
* @ignore
|
|
55
55
|
*/
|
|
56
56
|
pushMesh(x: any, y: any, z: any, u: any, v: any, tint: any): this;
|
|
57
|
+
/**
|
|
58
|
+
* push a new lit-mesh vertex (mesh format + a world-space normal):
|
|
59
|
+
* x, y, z, u, v, tint, nx, ny, nz. Used by the lit mesh batcher, whose
|
|
60
|
+
* vertex layout is 12 floats (the 9 of {@link pushMesh} plus `aNormal`).
|
|
61
|
+
* @ignore
|
|
62
|
+
*/
|
|
63
|
+
pushMeshLit(x: any, y: any, z: any, u: any, v: any, tint: any, nx: any, ny: any, nz: any): this;
|
|
57
64
|
/**
|
|
58
65
|
* return a reference to the data in Float32 format
|
|
59
66
|
* @ignore
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vertex.d.ts","sourceRoot":"","sources":["../../../src/video/buffer/vertex.js"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;IACC,6CAyBC;IAvBA,gBAA4B;IAE5B,eAA0B;IAE1B,oBAAoB;IAGpB,oBAEC;IAED,qCAA8C;IAC9C,oCAA6C;IAU7C,kCAA2C;IAG5C;;;OAGG;IACH,cAEC;IAED;;;OAGG;IACH,6BAEC;IAED;;;;;;;;;;;OAWG;IACH,QAVW,MAAM,KACN,MAAM,KACN,MAAM,KACN,MAAM,KACN,MAAM,QACN,MAAM,cACN,MAAM,oBACN,MAAM,QA6BhB;IAED;;;;;;OAMG;IACH,iBALW,SAAS,CAAC,MAAM,CAAC,aACjB,MAAM,SACN,MAAM,QAahB;IAED;;;;;;;;OAQG;IACH,kEAgBC;IAED;;;OAGG;IACH,2DAMC;IAED;;;OAGG;IACH,yDAMC;IAED;;;;;;OAMG;IACH,+DAMC;CACD"}
|
|
1
|
+
{"version":3,"file":"vertex.d.ts","sourceRoot":"","sources":["../../../src/video/buffer/vertex.js"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;IACC,6CAyBC;IAvBA,gBAA4B;IAE5B,eAA0B;IAE1B,oBAAoB;IAGpB,oBAEC;IAED,qCAA8C;IAC9C,oCAA6C;IAU7C,kCAA2C;IAG5C;;;OAGG;IACH,cAEC;IAED;;;OAGG;IACH,6BAEC;IAED;;;;;;;;;;;OAWG;IACH,QAVW,MAAM,KACN,MAAM,KACN,MAAM,KACN,MAAM,KACN,MAAM,QACN,MAAM,cACN,MAAM,oBACN,MAAM,QA6BhB;IAED;;;;;;OAMG;IACH,iBALW,SAAS,CAAC,MAAM,CAAC,aACjB,MAAM,SACN,MAAM,QAahB;IAED;;;;;;;;OAQG;IACH,kEAgBC;IAED;;;;;OAKG;IACH,gGAoBC;IAED;;;OAGG;IACH,2DAMC;IAED;;;OAGG;IACH,yDAMC;IAED;;;;;;OAMG;IACH,+DAMC;CACD"}
|
|
@@ -449,6 +449,27 @@ declare class Renderer {
|
|
|
449
449
|
* @param {boolean} [enable=false]
|
|
450
450
|
*/
|
|
451
451
|
setAntiAlias(enable?: boolean): void;
|
|
452
|
+
/**
|
|
453
|
+
* Resolve the default texture filter **mode** for this renderer, decoupled
|
|
454
|
+
* from {@link Renderer#setAntiAlias} (which controls polygon-edge MSAA on GPU
|
|
455
|
+
* backends). Honors the `textureFilter` setting (`"nearest"` / `"linear"`),
|
|
456
|
+
* falling back to the `antiAlias` setting when it's `"auto"` (the default).
|
|
457
|
+
*
|
|
458
|
+
* Backend-neutral on purpose: it returns the mode as a string so each GPU
|
|
459
|
+
* backend maps it to its own enum (WebGL `gl.LINEAR` / `gl.NEAREST`, a future
|
|
460
|
+
* WebGPU renderer `GPUFilterMode`). The Canvas renderer has no per-texture
|
|
461
|
+
* filtering, so this is informational there.
|
|
462
|
+
* @returns {"linear"|"nearest"} the resolved default filter mode
|
|
463
|
+
*/
|
|
464
|
+
getDefaultTextureFilter(): "linear" | "nearest";
|
|
465
|
+
/**
|
|
466
|
+
* Set the default texture magnification/minification filter at runtime,
|
|
467
|
+
* decoupled from {@link Renderer#setAntiAlias}. The base implementation just
|
|
468
|
+
* records the setting (the Canvas renderer has no per-texture filtering);
|
|
469
|
+
* GPU backends override this to re-apply the filter to live textures.
|
|
470
|
+
* @param {"auto"|"nearest"|"linear"} [mode="auto"] - `"auto"` follows `antiAlias`
|
|
471
|
+
*/
|
|
472
|
+
setTextureFilter(mode?: "auto" | "nearest" | "linear"): void;
|
|
452
473
|
/**
|
|
453
474
|
* set/change the current projection matrix (GPU renderers only —
|
|
454
475
|
* the Canvas renderer applies projection via the 2D context's transform stack).
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"renderer.d.ts","sourceRoot":"","sources":["../../src/video/renderer.js"],"names":[],"mappings":"AAUA;;GAEG;AAEH;;;;;;;GAOG;AAEH;;;GAGG;AACH;IAiQC;;;;;;;;;;;;OAYG;IACH,2BANW,MAAM,UACN,MAAM,0BACN,OAAO,GAEL,iBAAiB,GAAC,eAAe,CAI7C;IAED;;;;;;;;;;;;OAYG;IACH,wBAFa,iBAAiB,GAAC,eAAe,CAgB7C;IA5SD;;OAEG;IACH,sBAFW,mBAAmB,EAsJ7B;IAnJA;;;;OAIG;IACH,cAFU,kBAAkB,CAS3B;IAED;;;;OAIG;IACH,iBAFU,MAAM,CAEO;IAEvB;;;;OAIG;IACH,oBAFU,MAAM,CAE6C;IAE7D;;;;OAIG;IACH,YAHU,QAAQ,CAGsD;IAExE;;;;OAIG;IACH,gBAFU,OAAO,CAES;IAE1B;;;;OAIG;IACH,aAFU,MAAM,GAAC,SAAS,CAEE;IAE5B;;;;;;OAMG;IACH,cAHU,QAAQ,GAAC,YAAY,GAAC,SAAS,CAGZ;IAE7B;;;;;OAKG;IACH,mBAHU,gBAAgB,GAAC,IAAI,CAGF;IAE7B;;;OAGG;IACH,QAF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IAEd;;;;OAIG;IACH,cAHW,KAAK,UACL,MAAM,QAMhB;IAED;;;OAGG;IACH,kBAGC;IAED;;;;;;;;;;;;;;;OAeG;IACH,gBAHW,MAAM,QAKhB;IAED;;;;;;;OAOG;IACH,cANW,MAAM,YACN,MAAM,gBAOhB;IAED;;;;;;;;OAQG;IACH,qBANW,MAAM,YACN,MAAM,gBAOhB;IAED;;;;;;;OAOG;IACH,iBANW,MAAM,YACN,MAAM,gBAOhB;CACD;;;;;+BA5kC8B,sCAAsC;yBAL5C,qBAAqB;kCAQb,sCAAsC;mBAXpD,2BAA2B;sBACxB,oBAAoB;wBAMlB,kBAAkB;yBALjB,qBAAqB;0BAavB,8BAA8B;yBAT5B,eAAe;4BAcf,wBAAwB;+BAJrB,8BAA8B;6BAChC,0BAA0B;0BAC7B,yBAAyB;6BACtB,4BAA4B"}
|
|
@@ -30,7 +30,7 @@ export function createAtlas(width: any, height: any, name?: string, repeat?: str
|
|
|
30
30
|
* return a string that identifies the texture atlas type
|
|
31
31
|
* @ignore
|
|
32
32
|
*/
|
|
33
|
-
export function identifyFormat(app: any): "
|
|
33
|
+
export function identifyFormat(app: any): "melonJS" | "texturepacker" | "shoebox" | "aseprite";
|
|
34
34
|
/**
|
|
35
35
|
* A Texture atlas class, currently supports : <br>
|
|
36
36
|
* - [TexturePacker]{@link http://www.codeandweb.com/texturepacker/} : through JSON export (standard and multipack texture atlas) <br>
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A {@link MeshBatcher} variant that shades meshes with the active stage's
|
|
3
|
+
* {@link Light3d} lights (half-Lambert diffuse from directional lights +
|
|
4
|
+
* ambient). It extends the unlit batcher, adding a world-space `aNormal`
|
|
5
|
+
* vertex attribute (12-float layout vs 9) and a lit shader.
|
|
6
|
+
*
|
|
7
|
+
* Meshes opt in via `mesh.lit` — so standalone, unlit meshes keep the lean
|
|
8
|
+
* 9-float `MeshBatcher` and pay nothing for lighting. Both batchers share the
|
|
9
|
+
* mesh-mode depth-clear state (a single clear per target) since this one
|
|
10
|
+
* inherits {@link MeshBatcher#bind}.
|
|
11
|
+
* @category Rendering
|
|
12
|
+
*/
|
|
13
|
+
export default class LitMeshBatcher extends MeshBatcher {
|
|
14
|
+
/** push the 12-float lit vertex, appending the mesh's world-space normal. @ignore */
|
|
15
|
+
_pushVertex(vertexData: any, x: any, y: any, z: any, u: any, v: any, color: any, mesh: any, i3: any): void;
|
|
16
|
+
}
|
|
17
|
+
import MeshBatcher from "./mesh_batcher.js";
|
|
18
|
+
//# sourceMappingURL=lit_mesh_batcher.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lit_mesh_batcher.d.ts","sourceRoot":"","sources":["../../../../src/video/webgl/batchers/lit_mesh_batcher.js"],"names":[],"mappings":"AAqBA;;;;;;;;;;;GAWG;AACH;IAqBC,qFAAqF;IACrF,2GAaC;CA0BD;wBAzFuB,mBAAmB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lit_quad_batcher.d.ts","sourceRoot":"","sources":["../../../../src/video/webgl/batchers/lit_quad_batcher.js"],"names":[],"mappings":"AAKA;;;GAGG;AAEH;;;;;;;;;;;;;;;GAeG;AACH;IAsEE;;;;;;OAMG;IACH,6GAAmD;IAEnD;;;;OAIG;IACH,uHAAkC;IAElC,gCAAoB;IACpB,+BAA4B;IAK7B;;;;;OAKG;IACH,2BAOC;IAsBD;;;;;;;;;;;;;;OAcG;IACH,2BANG;QAA+B,SAAS,EAAhC,YAAY;QACW,MAAM,EAA7B,YAAY;QACY,OAAO;QACd,KAAK,EAAtB,MAAM;QACc,OAAO;KACrC,QAgBA;IAED;;;;;;;;;OASG;IACH,qBAHW,gBAAgB,GAAC,iBAAiB,GAAC,eAAe,GAAC,WAAW,QAC9D,MAAM,QAahB;IAED;;;;;;;;;;OAUG;IACH,uBAHW,gBAAgB,GAAC,iBAAiB,GAAC,eAAe,GAAC,WAAW,QAC9D,MAAM,
|
|
1
|
+
{"version":3,"file":"lit_quad_batcher.d.ts","sourceRoot":"","sources":["../../../../src/video/webgl/batchers/lit_quad_batcher.js"],"names":[],"mappings":"AAKA;;;GAGG;AAEH;;;;;;;;;;;;;;;GAeG;AACH;IAsEE;;;;;;OAMG;IACH,6GAAmD;IAEnD;;;;OAIG;IACH,uHAAkC;IAElC,gCAAoB;IACpB,+BAA4B;IAK7B;;;;;OAKG;IACH,2BAOC;IAsBD;;;;;;;;;;;;;;OAcG;IACH,2BANG;QAA+B,SAAS,EAAhC,YAAY;QACW,MAAM,EAA7B,YAAY;QACY,OAAO;QACd,KAAK,EAAtB,MAAM;QACc,OAAO;KACrC,QAgBA;IAED;;;;;;;;;OASG;IACH,qBAHW,gBAAgB,GAAC,iBAAiB,GAAC,eAAe,GAAC,WAAW,QAC9D,MAAM,QAahB;IAED;;;;;;;;;;OAUG;IACH,uBAHW,gBAAgB,GAAC,iBAAiB,GAAC,eAAe,GAAC,WAAW,QAC9D,MAAM,QAgBhB;IAED;;;;;;;;;;;;;;OAcG;IACH,iBAbW,YAAY,KACZ,MAAM,KACN,MAAM,KACN,MAAM,KACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,QACN,MAAM,aACN,OAAO,cACP,gBAAgB,GAAC,iBAAiB,GAAC,IAAI,QAkHjD;CA0DD;wBAjaoC,mBAAmB;kCAIzB,0BAA0B"}
|
|
@@ -29,20 +29,61 @@ export default class MeshBatcher extends MaterialBatcher {
|
|
|
29
29
|
* @ignore
|
|
30
30
|
*/
|
|
31
31
|
init(renderer: any): void;
|
|
32
|
+
currentAlphaCutoff: any;
|
|
33
|
+
currentEmissiveR: any;
|
|
34
|
+
currentEmissiveG: any;
|
|
35
|
+
currentEmissiveB: any;
|
|
36
|
+
_onTargetChanged: (() => void) | null | undefined;
|
|
32
37
|
/**
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
* below (frame start, post-effect FBO bind/unbind), back to
|
|
37
|
-
* `false` by the first `bind()` of the new target after the
|
|
38
|
-
* lazy clear runs. Lifts depth clearing from per-mesh (legacy)
|
|
39
|
-
* to per-target — same model Three.js uses. The GPU's `LEQUAL`
|
|
40
|
-
* depth test then resolves inter-mesh occlusion per pixel
|
|
41
|
-
* against the accumulated buffer.
|
|
38
|
+
* The vertex attribute layout. The base (unlit) mesh batcher is
|
|
39
|
+
* `aVertex` (3) + `aRegion` (2) + `aColor` (4) = 9 floats. Subclasses
|
|
40
|
+
* (e.g. {@link LitMeshBatcher}) append their own attributes.
|
|
42
41
|
* @ignore
|
|
43
42
|
*/
|
|
44
|
-
|
|
45
|
-
|
|
43
|
+
_attributeLayout(renderer: any): {
|
|
44
|
+
name: string;
|
|
45
|
+
size: number;
|
|
46
|
+
type: any;
|
|
47
|
+
normalized: boolean;
|
|
48
|
+
offset: number;
|
|
49
|
+
}[];
|
|
50
|
+
/**
|
|
51
|
+
* The shader sources for this batcher (unlit by default). Subclasses
|
|
52
|
+
* override to supply a lit shader.
|
|
53
|
+
* @ignore
|
|
54
|
+
*/
|
|
55
|
+
_shaderSources(): {
|
|
56
|
+
vertex: any;
|
|
57
|
+
fragment: any;
|
|
58
|
+
};
|
|
59
|
+
/**
|
|
60
|
+
* Invalidate the per-mesh `uAlphaCutoff` / `uEmissive` caches when the bound
|
|
61
|
+
* shader (GL program) changes — the new program's uniforms are at their own
|
|
62
|
+
* defaults, so the next mesh must re-issue them rather than trust the cache.
|
|
63
|
+
* Mirrors the base batcher's `currentSamplerUnit` reset (same condition), and
|
|
64
|
+
* matters when a custom mesh shader declaring those uniforms is interleaved
|
|
65
|
+
* with the built-in one on this batcher (e.g. `drawMesh` swapping a custom
|
|
66
|
+
* shader in and back out).
|
|
67
|
+
* @ignore
|
|
68
|
+
*/
|
|
69
|
+
useShader(shader: any): void;
|
|
70
|
+
/**
|
|
71
|
+
* Write one vertex into the buffer. The base (unlit) layout is
|
|
72
|
+
* `x, y, z, u, v, color`. Subclasses override to append per-vertex data
|
|
73
|
+
* matching their {@link MeshBatcher#_attributeLayout} (e.g.
|
|
74
|
+
* {@link LitMeshBatcher} pushes the world-space normal too).
|
|
75
|
+
* @param {object} vertexData - the batcher's vertex buffer
|
|
76
|
+
* @param {number} x
|
|
77
|
+
* @param {number} y
|
|
78
|
+
* @param {number} z
|
|
79
|
+
* @param {number} u
|
|
80
|
+
* @param {number} v
|
|
81
|
+
* @param {number} color - packed ARGB Uint32
|
|
82
|
+
* @param {object} _mesh - the source mesh (unused here; for subclasses)
|
|
83
|
+
* @param {number} _i3 - the source vertex's `index * 3` (for subclasses)
|
|
84
|
+
* @ignore
|
|
85
|
+
*/
|
|
86
|
+
_pushVertex(vertexData: object, x: number, y: number, z: number, u: number, v: number, color: number, _mesh: object, _i3: number): void;
|
|
46
87
|
/**
|
|
47
88
|
* Add a textured mesh to the batch. When the mesh has a
|
|
48
89
|
* `vertexColors` array (multi-material OBJ + bound MTL), each
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mesh_batcher.d.ts","sourceRoot":"","sources":["../../../../src/video/webgl/batchers/mesh_batcher.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"mesh_batcher.d.ts","sourceRoot":"","sources":["../../../../src/video/webgl/batchers/mesh_batcher.js"],"names":[],"mappings":"AAsFA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH;IACC;;;OAGG;IACH,0BA8BC;IApBA,wBAA4B;IAI5B,sBAA0B;IAC1B,sBAA0B;IAC1B,sBAA0B;IASzB,kDAEC;IAKH;;;;;OAKG;IACH;;;;;;QAgCC;IAED;;;;OAIG;IACH;;;MAEC;IAED;;;;;;;;;OASG;IACH,6BAWC;IAyDD;;;;;;;;;;;;;;;OAeG;IACH,wBAXW,MAAM,KACN,MAAM,KACN,MAAM,KACN,MAAM,KACN,MAAM,KACN,MAAM,SACN,MAAM,SACN,MAAM,OACN,MAAM,QAKhB;IAED;;;;;;;;;;;;;;OAcG;IACH,cAHW,MAAM,QACN,MAAM,QAoJhB;CACD;gCArc+B,uBAAuB"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* A shader effect that sweeps a bright highlight band across the sprite —
|
|
3
3
|
* the classic "shine" pass commonly used for coins, gems, polished metal,
|
|
4
|
-
* and hover-highlighted UI elements.
|
|
4
|
+
* and hover-highlighted UI elements.
|
|
5
5
|
*
|
|
6
6
|
* Set `bands` > 1 to tile the sweep into N parallel glints (useful for the
|
|
7
7
|
* "etched grooves" look of a coin's rim). An optional subtle brightness
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { Light3d } from "../../../lighting/light3d.ts";
|
|
2
|
+
/**
|
|
3
|
+
* Uniform-ready packing of the active 3D lights for the mesh-lit shader.
|
|
4
|
+
* @ignore
|
|
5
|
+
*/
|
|
6
|
+
export interface PackedMeshLighting {
|
|
7
|
+
/** number of active directional lights, clamped to `MAX_LIGHTS`. */
|
|
8
|
+
count: number;
|
|
9
|
+
/** `MAX_LIGHTS × 3` surface→light directions (already negated, normalized). */
|
|
10
|
+
directions: Float32Array;
|
|
11
|
+
/** `MAX_LIGHTS × 3` directional light colors premultiplied by intensity. */
|
|
12
|
+
colors: Float32Array;
|
|
13
|
+
/** the summed ambient color (RGB, 0..1+). */
|
|
14
|
+
ambient: Float32Array;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Pack an iterable of {@link Light3d} (e.g. the active `Stage`'s 3D-light set)
|
|
18
|
+
* into the uniform arrays the mesh-lit shader reads:
|
|
19
|
+
* - **directional** lights contribute a surface→light direction (negated travel
|
|
20
|
+
* direction, normalized) + a color premultiplied by intensity, up to
|
|
21
|
+
* `MAX_LIGHTS`. Re-normalized here so a direction mutated at runtime without
|
|
22
|
+
* re-normalizing still shades correctly.
|
|
23
|
+
* - **ambient** lights are summed into a single flat ambient color.
|
|
24
|
+
*
|
|
25
|
+
* Other types (`"point"`) are skipped — not shaded yet. The same buffers are
|
|
26
|
+
* returned each call (overwritten in place).
|
|
27
|
+
* @param lights - iterable of lights, or `null`/`undefined` (treated as empty)
|
|
28
|
+
* @returns the packed lighting (reused instance)
|
|
29
|
+
* @ignore
|
|
30
|
+
*/
|
|
31
|
+
export declare function packMeshLights(lights: Iterable<Light3d> | null | undefined): PackedMeshLighting;
|
|
32
|
+
//# sourceMappingURL=pack3d.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pack3d.d.ts","sourceRoot":"","sources":["../../../../src/video/webgl/lighting/pack3d.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,8BAA8B,CAAC;AAG5D;;;GAGG;AACH,MAAM,WAAW,kBAAkB;IAClC,oEAAoE;IACpE,KAAK,EAAE,MAAM,CAAC;IACd,+EAA+E;IAC/E,UAAU,EAAE,YAAY,CAAC;IACzB,4EAA4E;IAC5E,MAAM,EAAE,YAAY,CAAC;IACrB,6CAA6C;IAC7C,OAAO,EAAE,YAAY,CAAC;CACtB;AAcD;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,cAAc,CAC7B,MAAM,EAAE,QAAQ,CAAC,OAAO,CAAC,GAAG,IAAI,GAAG,SAAS,GAC1C,kBAAkB,CAuCpB"}
|
|
@@ -316,6 +316,24 @@ export default class WebGLRenderer extends Renderer {
|
|
|
316
316
|
*/
|
|
317
317
|
setBlendMode(mode?: string, premultipliedAlpha?: boolean): string;
|
|
318
318
|
currentPremultipliedAlpha: any;
|
|
319
|
+
/**
|
|
320
|
+
* Map the backend-neutral default filter mode
|
|
321
|
+
* ({@link Renderer#getDefaultTextureFilter}) to the GL enum
|
|
322
|
+
* (`gl.LINEAR` / `gl.NEAREST`) used for textures that don't carry their own
|
|
323
|
+
* `texture.filter`. The neutral resolver lives on the base renderer so a
|
|
324
|
+
* future WebGPU backend reuses it and maps to `GPUFilterMode` instead.
|
|
325
|
+
* @returns {number} `gl.LINEAR` or `gl.NEAREST`
|
|
326
|
+
* @ignore
|
|
327
|
+
*/
|
|
328
|
+
_glTextureFilter(): number;
|
|
329
|
+
/**
|
|
330
|
+
* Re-apply a min/mag filter to every currently-bound texture across all
|
|
331
|
+
* batchers (see https://github.com/melonjs/melonJS/issues/1279). Shared by
|
|
332
|
+
* {@link WebGLRenderer#setAntiAlias} and {@link WebGLRenderer#setTextureFilter}.
|
|
333
|
+
* @param {number} filter - `gl.LINEAR` or `gl.NEAREST`
|
|
334
|
+
* @ignore
|
|
335
|
+
*/
|
|
336
|
+
_reapplyTextureFilter(filter: number): void;
|
|
319
337
|
/**
|
|
320
338
|
* Return the global alpha
|
|
321
339
|
* @returns {number} global alpha value
|