melonjs 20.1.1 → 20.3.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 +88 -10
- package/build/application/settings.d.ts +4 -2
- package/build/application/settings.d.ts.map +1 -1
- package/build/audio/audio.d.ts +2 -2
- package/build/audio/audio.d.ts.map +1 -1
- package/build/audio/backend/buffer.d.ts +26 -0
- package/build/audio/backend/buffer.d.ts.map +1 -0
- package/build/audio/backend/cache.d.ts +2 -0
- package/build/audio/backend/cache.d.ts.map +1 -0
- package/build/audio/backend/core.d.ts +24 -0
- package/build/audio/backend/core.d.ts.map +1 -0
- package/build/audio/backend/engine.d.ts +54 -0
- package/build/audio/backend/engine.d.ts.map +1 -0
- package/build/audio/backend/sound.d.ts +79 -0
- package/build/audio/backend/sound.d.ts.map +1 -0
- package/build/audio/backend/spatial.d.ts +191 -0
- package/build/audio/backend/spatial.d.ts.map +1 -0
- package/build/audio/backend/types.d.ts +97 -0
- package/build/audio/backend/types.d.ts.map +1 -0
- package/build/audio/backend/voice.d.ts +33 -0
- package/build/audio/backend/voice.d.ts.map +1 -0
- package/build/audio/playback.d.ts +49 -4
- package/build/audio/playback.d.ts.map +1 -1
- package/build/audio/{backend.d.ts → state.d.ts} +13 -11
- package/build/audio/state.d.ts.map +1 -0
- package/build/audio/types.d.ts +93 -1
- package/build/audio/types.d.ts.map +1 -1
- package/build/camera/camera3d.d.ts +5 -5
- package/build/const.d.ts +2 -2
- package/build/index.d.ts.map +1 -1
- package/build/index.js +10048 -10341
- package/build/index.js.map +4 -4
- package/build/input/input.d.ts +19 -0
- package/build/input/input.d.ts.map +1 -1
- package/build/input/pointerevent.d.ts.map +1 -1
- package/build/lang/deprecated.d.ts +4 -2
- package/build/lang/deprecated.d.ts.map +1 -1
- package/build/level/gltf/GLTFScene.d.ts +12 -0
- package/build/level/gltf/GLTFScene.d.ts.map +1 -1
- package/build/level/tiled/TMXObjectFactory.d.ts.map +1 -1
- package/build/loader/loader.d.ts +4 -40
- package/build/loader/loader.d.ts.map +1 -1
- package/build/loader/parsers/audio.d.ts +31 -0
- package/build/loader/parsers/audio.d.ts.map +1 -0
- package/build/loader/parsers/shader.d.ts.map +1 -1
- package/build/particles/emitter.d.ts +81 -3
- package/build/particles/emitter.d.ts.map +1 -1
- package/build/particles/particle.d.ts +62 -1
- package/build/particles/particle.d.ts.map +1 -1
- package/build/particles/settings.d.ts +50 -7
- package/build/particles/settings.d.ts.map +1 -1
- package/build/physics/adapter.d.ts +3 -3
- package/build/physics/builtin/body.d.ts +23 -24
- package/build/physics/builtin/body.d.ts.map +1 -1
- package/build/physics/builtin/detector.d.ts +1 -1
- package/build/plugin/plugin.d.ts +9 -1
- package/build/plugin/plugin.d.ts.map +1 -1
- package/build/polyfill/index.d.ts +1 -4
- package/build/polyfill/index.d.ts.map +1 -1
- package/build/renderable/container.d.ts +10 -0
- package/build/renderable/container.d.ts.map +1 -1
- package/build/renderable/entity/entity.d.ts +10 -0
- package/build/renderable/entity/entity.d.ts.map +1 -1
- package/build/renderable/mesh.d.ts +16 -0
- package/build/renderable/mesh.d.ts.map +1 -1
- package/build/renderable/renderable.d.ts +122 -32
- package/build/renderable/renderable.d.ts.map +1 -1
- package/build/renderable/sprite.d.ts +7 -7
- package/build/renderable/sprite.d.ts.map +1 -1
- package/build/state/stage.d.ts +4 -2
- package/build/state/stage.d.ts.map +1 -1
- package/build/system/event.d.ts +1 -1
- package/build/system/platform.d.ts +21 -1
- package/build/system/platform.d.ts.map +1 -1
- package/build/utils/fetchdata.d.ts.map +1 -0
- package/build/video/blendmodes.d.ts +107 -0
- package/build/video/blendmodes.d.ts.map +1 -0
- package/build/video/canvas/canvas_renderer.d.ts +31 -24
- package/build/video/canvas/canvas_renderer.d.ts.map +1 -1
- package/build/video/effects/blendEffect.d.ts +57 -0
- package/build/video/effects/blendEffect.d.ts.map +1 -0
- package/build/video/effects/blur.d.ts +4 -4
- package/build/video/effects/blur.d.ts.map +1 -1
- package/build/video/effects/chromaticAberration.d.ts +5 -5
- package/build/video/effects/chromaticAberration.d.ts.map +1 -1
- package/build/video/effects/colorMatrix.d.ts +5 -5
- package/build/video/effects/colorMatrix.d.ts.map +1 -1
- package/build/video/effects/desaturate.d.ts +5 -5
- package/build/video/effects/desaturate.d.ts.map +1 -1
- package/build/video/effects/dissolve.d.ts +4 -4
- package/build/video/effects/dissolve.d.ts.map +1 -1
- package/build/video/effects/dropShadow.d.ts +5 -5
- package/build/video/effects/dropShadow.d.ts.map +1 -1
- package/build/video/effects/flash.d.ts +4 -4
- package/build/video/effects/flash.d.ts.map +1 -1
- package/build/video/effects/glow.d.ts +5 -5
- package/build/video/effects/glow.d.ts.map +1 -1
- package/build/video/effects/hologram.d.ts +4 -4
- package/build/video/effects/hologram.d.ts.map +1 -1
- package/build/video/effects/invert.d.ts +5 -5
- package/build/video/effects/invert.d.ts.map +1 -1
- package/build/video/effects/outline.d.ts +6 -6
- package/build/video/effects/outline.d.ts.map +1 -1
- package/build/video/effects/pixelate.d.ts +4 -4
- package/build/video/effects/pixelate.d.ts.map +1 -1
- package/build/video/effects/radialGradient.d.ts +2 -2
- package/build/video/effects/scanline.d.ts +6 -6
- package/build/video/effects/scanline.d.ts.map +1 -1
- package/build/video/effects/sepia.d.ts +5 -5
- package/build/video/effects/sepia.d.ts.map +1 -1
- package/build/video/effects/shadereffect.d.ts +12 -10
- package/build/video/effects/shadereffect.d.ts.map +1 -1
- package/build/video/effects/shine.d.ts +3 -3
- package/build/video/effects/shine.d.ts.map +1 -1
- package/build/video/effects/tintPulse.d.ts +4 -4
- package/build/video/effects/tintPulse.d.ts.map +1 -1
- package/build/video/effects/vignette.d.ts +6 -6
- package/build/video/effects/vignette.d.ts.map +1 -1
- package/build/video/effects/wave.d.ts +4 -4
- package/build/video/effects/wave.d.ts.map +1 -1
- package/build/video/renderer.d.ts +3 -4
- package/build/video/renderer.d.ts.map +1 -1
- package/build/video/rendertarget/canvasrendertarget.d.ts +1 -0
- package/build/video/rendertarget/canvasrendertarget.d.ts.map +1 -1
- package/build/video/texture/atlas.d.ts +1 -1
- package/build/video/webgl/batchers/batcher.d.ts.map +1 -1
- package/build/video/webgl/glshader.d.ts +2 -2
- package/build/video/webgl/glshader.d.ts.map +1 -1
- package/build/video/webgl/utils/program.d.ts.map +1 -1
- package/build/video/webgl/webgl_renderer.d.ts +117 -29
- package/build/video/webgl/webgl_renderer.d.ts.map +1 -1
- package/build/video/webgpu/batchers/quad_batcher.d.ts +7 -0
- package/build/video/webgpu/batchers/quad_batcher.d.ts.map +1 -1
- package/build/video/webgpu/pipeline/cache.d.ts +0 -9
- package/build/video/webgpu/pipeline/cache.d.ts.map +1 -1
- package/build/video/webgpu/webgpu_renderer.d.ts +101 -6
- package/build/video/webgpu/webgpu_renderer.d.ts.map +1 -1
- package/package.json +6 -10
- package/skills/AGENTS.md +67 -0
- package/skills/melonjs/SKILL.md +156 -0
- package/skills/melonjs-20-migration/SKILL.md +160 -0
- package/skills/melonjs-3d/SKILL.md +226 -0
- package/skills/melonjs-3d-assets/SKILL.md +239 -0
- package/skills/melonjs-audio/SKILL.md +215 -0
- package/skills/melonjs-camera-and-drawing/SKILL.md +171 -0
- package/skills/melonjs-deployment/SKILL.md +113 -0
- package/skills/melonjs-effects-and-shaders/SKILL.md +177 -0
- package/skills/melonjs-events/SKILL.md +159 -0
- package/skills/melonjs-getting-started/SKILL.md +183 -0
- package/skills/melonjs-input/SKILL.md +166 -0
- package/skills/melonjs-lighting/SKILL.md +139 -0
- package/skills/melonjs-loading-assets/SKILL.md +157 -0
- package/skills/melonjs-particles-and-trails/SKILL.md +136 -0
- package/skills/melonjs-performance/SKILL.md +178 -0
- package/skills/melonjs-physics/SKILL.md +321 -0
- package/skills/melonjs-plugins/SKILL.md +191 -0
- package/skills/melonjs-renderables/SKILL.md +214 -0
- package/skills/melonjs-renderer-backends/SKILL.md +173 -0
- package/skills/melonjs-scenes-and-state/SKILL.md +180 -0
- package/skills/melonjs-sprites-and-animation/SKILL.md +173 -0
- package/skills/melonjs-tilemaps/SKILL.md +193 -0
- package/skills/melonjs-ui-and-text/SKILL.md +175 -0
- package/build/audio/backend.d.ts.map +0 -1
- package/build/loader/parsers/fetchdata.d.ts.map +0 -1
- /package/build/{loader/parsers → utils}/fetchdata.d.ts +0 -0
|
@@ -24,6 +24,34 @@ export default class WebGLRenderer extends Renderer {
|
|
|
24
24
|
*/
|
|
25
25
|
_effectProjectionStack: Matrix3d;
|
|
26
26
|
_effectPassDepth: number;
|
|
27
|
+
/**
|
|
28
|
+
* Advanced-blend state. The six CSS modes fixed-function cannot
|
|
29
|
+
* express are composited by capturing the destination, rendering the
|
|
30
|
+
* draw to an offscreen target, and blitting that through
|
|
31
|
+
* {@link BlendEffect}. All of it is created lazily — a game that
|
|
32
|
+
* never asks for an advanced mode pays nothing.
|
|
33
|
+
*
|
|
34
|
+
* `_advancedBlendBusy` is a DEPTH, not a flag: the bracket nests
|
|
35
|
+
* inside itself (the composite blit re-enters `setBatcher`, and
|
|
36
|
+
* `toFrameTexture` does too), so a boolean would be cleared by the
|
|
37
|
+
* inner scope while the outer one is still running.
|
|
38
|
+
* @ignore
|
|
39
|
+
*/
|
|
40
|
+
_advancedBlendEffect: BlendEffect | undefined;
|
|
41
|
+
/** @ignore */
|
|
42
|
+
_advancedBlendCapture: any;
|
|
43
|
+
/** @ignore */
|
|
44
|
+
_advancedBlendTarget: WebGLRenderTarget | undefined;
|
|
45
|
+
/** @ignore */
|
|
46
|
+
_advancedBlendOpen: boolean;
|
|
47
|
+
/** @ignore */
|
|
48
|
+
_advancedBlendBusy: number;
|
|
49
|
+
/** @ignore */
|
|
50
|
+
_advancedBlendParent: import("../rendertarget/rendertarget.ts").default | null | undefined;
|
|
51
|
+
/** @ignore */
|
|
52
|
+
_advancedBlendStencil: boolean;
|
|
53
|
+
/** @ignore */
|
|
54
|
+
_advancedBlendWarned: Set<any>;
|
|
27
55
|
/**
|
|
28
56
|
* sets or returns the shape used to join two line segments where they meet.
|
|
29
57
|
* Out of the three possible values for this property: "round", "bevel", and "miter", only "round" is supported for now in WebGL
|
|
@@ -105,11 +133,26 @@ export default class WebGLRenderer extends Renderer {
|
|
|
105
133
|
* @type {WebGLBatcher}
|
|
106
134
|
*/
|
|
107
135
|
currentBatcher: WebGLBatcher;
|
|
136
|
+
set currentProgram(value: WebGLProgram | undefined);
|
|
108
137
|
/**
|
|
109
|
-
*
|
|
110
|
-
*
|
|
138
|
+
* Returns the WebGLContext instance for the renderer
|
|
139
|
+
* return a reference to the system 2d Context
|
|
140
|
+
* @returns {WebGLRenderingContext} the current WebGL context
|
|
111
141
|
*/
|
|
112
|
-
|
|
142
|
+
/**
|
|
143
|
+
* The shader program the GL context actually has bound.
|
|
144
|
+
*
|
|
145
|
+
* Backed by the CONTEXT rather than by a field on this renderer, because
|
|
146
|
+
* `GLShader` binds programs too — writing a uniform calls `useProgram`,
|
|
147
|
+
* and a freshly linked program is left bound — and it is constructed with
|
|
148
|
+
* a bare `gl`, so it cannot reach a renderer-owned cache. A field here
|
|
149
|
+
* would silently drift out of step with GL, and every batcher that
|
|
150
|
+
* compares against it (`syncProgram`, the mesh and primitive paths) would
|
|
151
|
+
* skip a rebind it actually needed, drawing a pending batch through the
|
|
152
|
+
* wrong program.
|
|
153
|
+
* @type {WebGLProgram|undefined}
|
|
154
|
+
*/
|
|
155
|
+
get currentProgram(): WebGLProgram | undefined;
|
|
113
156
|
/**
|
|
114
157
|
* the GL texture unit currently active (`gl.activeTexture`) — global
|
|
115
158
|
* GL state, so tracked once per renderer and shared by every batcher
|
|
@@ -163,7 +206,7 @@ export default class WebGLRenderer extends Renderer {
|
|
|
163
206
|
deleteMeshGeometry(mesh: object): void;
|
|
164
207
|
_lightShader: RadialGradientEffect | undefined;
|
|
165
208
|
_lightAtlas: TextureAtlas | undefined;
|
|
166
|
-
_frameTexture:
|
|
209
|
+
_frameTexture: any;
|
|
167
210
|
_orthogonalTMXGPURenderer: OrthogonalTMXLayerGPURenderer | null | undefined;
|
|
168
211
|
/**
|
|
169
212
|
* Draw a TMX tile layer through whichever path the layer's `renderMode`
|
|
@@ -255,6 +298,8 @@ export default class WebGLRenderer extends Renderer {
|
|
|
255
298
|
* @ignore
|
|
256
299
|
*/
|
|
257
300
|
_getLightAtlas(): TextureAtlas;
|
|
301
|
+
/** @ignore */
|
|
302
|
+
_toFrameTexture(options?: {}): any;
|
|
258
303
|
/**
|
|
259
304
|
* The renderer-owned shared frame-capture slot, minted lazily so it has a
|
|
260
305
|
* stable identity from the moment an effect is constructed — before the
|
|
@@ -283,6 +328,37 @@ export default class WebGLRenderer extends Renderer {
|
|
|
283
328
|
invalidateTextureUnit(unit: number, except?: WebGLBatcher): void;
|
|
284
329
|
/** @ignore */
|
|
285
330
|
endPostEffect(renderable: any): void;
|
|
331
|
+
/**
|
|
332
|
+
* Say once, per excluded path and mode, that an advanced blend mode is
|
|
333
|
+
* falling back to `"normal"`. A silent data-dependent fallback is exactly
|
|
334
|
+
* what the advanced-blend work exists to remove, so the exclusions are
|
|
335
|
+
* loud.
|
|
336
|
+
* @param {string} what - the excluded path, named for the message
|
|
337
|
+
* @ignore
|
|
338
|
+
*/
|
|
339
|
+
_warnAdvancedBlendFallback(what: string): void;
|
|
340
|
+
/**
|
|
341
|
+
* Close a pending advanced-blend bracket, if one is open and we are not
|
|
342
|
+
* already inside the bracket machinery. The safe form to call from any
|
|
343
|
+
* path that is about to disturb the destination.
|
|
344
|
+
* @ignore
|
|
345
|
+
*/
|
|
346
|
+
_drainAdvancedBlend(): void;
|
|
347
|
+
/**
|
|
348
|
+
* Open an advanced-blend bracket: capture the destination, then redirect
|
|
349
|
+
* this draw into an offscreen target. Closed by {@link _closeAdvancedBlend}
|
|
350
|
+
* at the next draw, flush or clear.
|
|
351
|
+
* @returns {boolean} false when the effect could not be realized, in which
|
|
352
|
+
* case the draw proceeds unbracketed (plain source-over)
|
|
353
|
+
* @ignore
|
|
354
|
+
*/
|
|
355
|
+
_openAdvancedBlend(): boolean;
|
|
356
|
+
/**
|
|
357
|
+
* Close an advanced-blend bracket: drain the offscreen, return to the
|
|
358
|
+
* parent target, and composite through {@link BlendEffect}.
|
|
359
|
+
* @ignore
|
|
360
|
+
*/
|
|
361
|
+
_closeAdvancedBlend(): void;
|
|
286
362
|
/**
|
|
287
363
|
* Clears the gl context with the given color.
|
|
288
364
|
* @param {Color|string} [color="#000000"] - CSS color.
|
|
@@ -448,15 +524,11 @@ export default class WebGLRenderer extends Renderer {
|
|
|
448
524
|
* add a straight line from the current point to the start of the current sub-path. If the shape has already been closed or has only one point, this function does nothing
|
|
449
525
|
*/
|
|
450
526
|
closePath(): void;
|
|
451
|
-
/**
|
|
452
|
-
* Returns the WebGLContext instance for the renderer
|
|
453
|
-
* return a reference to the system 2d Context
|
|
454
|
-
* @returns {WebGLRenderingContext} the current WebGL context
|
|
455
|
-
*/
|
|
456
527
|
getContext(): WebGLRenderingContext;
|
|
457
528
|
/**
|
|
458
529
|
* set the current blend mode for this renderer. <br>
|
|
459
|
-
*
|
|
530
|
+
* Both GPU renderers support the full set — the Canvas fallback supports
|
|
531
|
+
* every mode below except `"none"`: <br>
|
|
460
532
|
* - "normal" : draws new content on top of the existing content <br>
|
|
461
533
|
* <img src="../images/normal-blendmode.png" width="180"/> <br>
|
|
462
534
|
* - "add", "additive", or "lighter" : color values are added together <br>
|
|
@@ -465,19 +537,33 @@ export default class WebGLRenderer extends Renderer {
|
|
|
465
537
|
* <img src="../images/multiply-blendmode.png" width="180"/> <br>
|
|
466
538
|
* - "screen" : pixels are inverted, multiplied, and inverted again (opposite of multiply) <br>
|
|
467
539
|
* <img src="../images/screen-blendmode.png" width="180"/> <br>
|
|
468
|
-
* WebGL2 additionally supports: <br>
|
|
469
540
|
* - "darken" : retains the darkest pixels of both layers <br>
|
|
470
541
|
* <img src="../images/darken-blendmode.png" width="180"/> <br>
|
|
471
542
|
* - "lighten" : retains the lightest pixels of both layers <br>
|
|
472
543
|
* <img src="../images/lighten-blendmode.png" width="180"/> <br>
|
|
544
|
+
* - "overlay" : multiplies or screens, depending on the backdrop <br>
|
|
545
|
+
* <img src="../images/overlay-blendmode.png" width="180"/> <br>
|
|
546
|
+
* - "hard-light" : overlay with the layers swapped — a harsh spotlight <br>
|
|
547
|
+
* <img src="../images/hard-light-blendmode.png" width="180"/> <br>
|
|
548
|
+
* - "soft-light" : a diffused spotlight, gentler than hard-light <br>
|
|
549
|
+
* <img src="../images/soft-light-blendmode.png" width="180"/> <br>
|
|
550
|
+
* - "color-dodge" : brightens the backdrop to reflect the source <br>
|
|
551
|
+
* <img src="../images/color-dodge-blendmode.png" width="180"/> <br>
|
|
552
|
+
* - "color-burn" : darkens the backdrop to reflect the source <br>
|
|
553
|
+
* <img src="../images/color-burn-blendmode.png" width="180"/> <br>
|
|
554
|
+
* - "difference" : the absolute difference of the two layers <br>
|
|
555
|
+
* <img src="../images/difference-blendmode.png" width="180"/> <br>
|
|
556
|
+
* - "exclusion" : like difference, but lower in contrast <br>
|
|
557
|
+
* <img src="../images/exclusion-blendmode.png" width="180"/> <br>
|
|
473
558
|
* - "none" : blending disabled — the source replaces the destination
|
|
474
|
-
* outright, alpha included
|
|
475
|
-
*
|
|
476
|
-
*
|
|
477
|
-
*
|
|
559
|
+
* outright, alpha included <br>
|
|
560
|
+
* A few draw types cannot honour every mode — 3D meshes, and fills using
|
|
561
|
+
* a {@link Gradient} — and fall back to "normal" with a one-time console
|
|
562
|
+
* warning. `setBlendMode` returns what it actually applied, so comparing
|
|
563
|
+
* the result against your request detects that case.
|
|
478
564
|
* @see https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/globalCompositeOperation
|
|
479
565
|
* @param {string} [mode="normal"] - blend mode
|
|
480
|
-
* @param {boolean} [premultipliedAlpha=true] - whether textures use premultiplied alpha (affects source blend factor)
|
|
566
|
+
* @param {boolean} [premultipliedAlpha=true] - whether textures use premultiplied alpha (affects the source blend factor)
|
|
481
567
|
* @returns {string} the blend mode actually applied (may differ if the requested mode is unsupported)
|
|
482
568
|
*/
|
|
483
569
|
setBlendMode(mode?: string, premultipliedAlpha?: boolean): string;
|
|
@@ -580,24 +666,24 @@ export default class WebGLRenderer extends Renderer {
|
|
|
580
666
|
* Reset (overrides) the renderer transformation matrix to the
|
|
581
667
|
* identity one, and then apply the given transformation matrix.
|
|
582
668
|
* @param {Matrix2d|Matrix3d|number} a - a matrix to transform by, or the a component to multiply the current matrix by
|
|
583
|
-
* @param {number} b - the b component to multiply the current matrix by
|
|
584
|
-
* @param {number} c - the c component to multiply the current matrix by
|
|
585
|
-
* @param {number} d - the d component to multiply the current matrix by
|
|
586
|
-
* @param {number} e - the e component to multiply the current matrix by
|
|
587
|
-
* @param {number} f - the f component to multiply the current matrix by
|
|
669
|
+
* @param {number} [b] - the b component to multiply the current matrix by; omitted when `a` is a matrix
|
|
670
|
+
* @param {number} [c] - the c component to multiply the current matrix by; omitted when `a` is a matrix
|
|
671
|
+
* @param {number} [d] - the d component to multiply the current matrix by; omitted when `a` is a matrix
|
|
672
|
+
* @param {number} [e] - the e component to multiply the current matrix by; omitted when `a` is a matrix
|
|
673
|
+
* @param {number} [f] - the f component to multiply the current matrix by; omitted when `a` is a matrix
|
|
588
674
|
*/
|
|
589
|
-
setTransform(a: Matrix2d | Matrix3d | number, b
|
|
675
|
+
setTransform(a: Matrix2d | Matrix3d | number, b?: number, c?: number, d?: number, e?: number, f?: number): void;
|
|
590
676
|
/**
|
|
591
677
|
* Multiply given matrix into the renderer tranformation matrix
|
|
592
678
|
* @see {@link WebGLRenderer.setTransform} which will reset the current transform matrix prior to performing the new transformation
|
|
593
679
|
* @param {Matrix2d|Matrix3d|number} a - a matrix to transform by, or the a component to multiply the current matrix by
|
|
594
|
-
* @param {number} b - the b component to multiply the current matrix by
|
|
595
|
-
* @param {number} c - the c component to multiply the current matrix by
|
|
596
|
-
* @param {number} d - the d component to multiply the current matrix by
|
|
597
|
-
* @param {number} e - the e component to multiply the current matrix by
|
|
598
|
-
* @param {number} f - the f component to multiply the current matrix by
|
|
680
|
+
* @param {number} [b] - the b component to multiply the current matrix by; omitted when `a` is a matrix
|
|
681
|
+
* @param {number} [c] - the c component to multiply the current matrix by; omitted when `a` is a matrix
|
|
682
|
+
* @param {number} [d] - the d component to multiply the current matrix by; omitted when `a` is a matrix
|
|
683
|
+
* @param {number} [e] - the e component to multiply the current matrix by; omitted when `a` is a matrix
|
|
684
|
+
* @param {number} [f] - the f component to multiply the current matrix by; omitted when `a` is a matrix
|
|
599
685
|
*/
|
|
600
|
-
transform(a: Matrix2d | Matrix3d | number, b
|
|
686
|
+
transform(a: Matrix2d | Matrix3d | number, b?: number, c?: number, d?: number, e?: number, f?: number): void;
|
|
601
687
|
/**
|
|
602
688
|
* A mask limits rendering elements to the shape and position of the given mask object.
|
|
603
689
|
* If the drawing or rendering area is larger than the mask, only the intersecting part of the renderable will be visible.
|
|
@@ -613,14 +699,16 @@ export default class WebGLRenderer extends Renderer {
|
|
|
613
699
|
import Renderer from "./../renderer.js";
|
|
614
700
|
import RenderTargetPool from "../rendertarget/render_target_pool.js";
|
|
615
701
|
import { Matrix3d } from "../../math/matrix3d.ts";
|
|
702
|
+
import BlendEffect from "../effects/blendEffect.js";
|
|
703
|
+
import WebGLRenderTarget from "../rendertarget/webglrendertarget.js";
|
|
616
704
|
import { GLSamplerCache } from "./utils/samplercache.js";
|
|
617
705
|
import { Bounds } from "../../physics/bounds.ts";
|
|
618
706
|
import { WebGLBatcher } from "./batchers/batcher.js";
|
|
619
707
|
import TextureCache from "./../texture/cache.js";
|
|
620
708
|
import RadialGradientEffect from "../effects/radialGradient.js";
|
|
621
709
|
import { TextureAtlas } from "./../texture/atlas.js";
|
|
622
|
-
import { FrameTexture } from "./../texture/frametexture.js";
|
|
623
710
|
import OrthogonalTMXLayerGPURenderer from "./renderers/tmxlayer/orthogonal.js";
|
|
711
|
+
import { FrameTexture } from "./../texture/frametexture.js";
|
|
624
712
|
import { Color } from "./../../math/color.ts";
|
|
625
713
|
import type { Rect } from "./../../geometries/rectangle.ts";
|
|
626
714
|
import type { RoundRect } from "./../../geometries/roundrect.ts";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webgl_renderer.d.ts","sourceRoot":"","sources":["../../../src/video/webgl/webgl_renderer.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"webgl_renderer.d.ts","sourceRoot":"","sources":["../../../src/video/webgl/webgl_renderer.js"],"names":[],"mappings":"AAwGA;;;GAGG;AACH;IAQE;;;;;OAKG;IACH,oBAJU,MAAM,CAIU;IAU1B;;;;OAIG;IACH,IAFU,qBAAqB,CAEI;IAgBnC,oCAIE;IAEF;;;;OAIG;IAIH,wBANU,QAAQ,CAMc;IAChC,yBAAyB;IAEzB;;;;;;;;;;;;OAYG;IACH,8CAAqC;IACrC,cAAc;IACd,2BAAsC;IACtC,cAAc;IACd,oDAAqC;IACrC,cAAc;IACd,4BAA+B;IAC/B,cAAc;IACd,2BAA2B;IAC3B,cAAc;IACd,2FAAgC;IAChC,cAAc;IACd,+BAAkC;IAClC,cAAc;IACd,+BAAqC;IASrC;;;;;OAKG;IACH,UAHU,MAAM,CAGO;IAEvB;;;OAGG;IACH,cAFU,WAAW,CAEqB;IAE1C;;;;;;;OAOG;IACH,cAHU,cAAc,CAGuB;IAE/C;;;;;;;;;;;;;OAaG;IACH,cAHU,YAAY,CAG4B;IAElD;;;;OAIG;IACH,sBAHU,MAAM,CAMf;IACD;;;;;;;;OAQG;IACH,0BAHU,MAAM,CAGiB;IAEjC;;;;OAIG;IACH,iBAHU,MAAM,CAMf;IAED;;;OAGG;IACH;;;QAEE;IAIF,kBAA6B;IAG7B,kBAAoB;IAGpB,sBAA4B;IAM5B,wBAAwB;IAExB;;;;OAIG;IACH,kBAFU,QAAQ,CAEuC;IAEzD;;;OAGG;IACH,gBAFU,YAAY,CAES;IAiiEhC,0BANU,YAAY,GAAC,SAAS,EAQ/B;IAxBD;;;;OAIG;IACH;;;;;;;;;;;;OAYG;IACH,sBA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;IACH,aAPW,QAAQ,GAAC,QAAQ,GAAC,MAAM,MACxB,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,QAmChB;IA2GD;;;;;;;OAOG;IACH,eAHW,IAAI,GAAC,SAAS,GAAC,OAAO,GAAC,IAAI,GAAC,OAAO,WACnC,OAAO,QA0DjB;IArCE,sCAA4B;;CAoD/B;qBAn6GoB,kBAAkB;6BACV,uCAAuC;yBAvB3C,wBAAwB;wBAmBzB,2BAA2B;8BAKrB,sCAAsC;+BAoBrC,yBAAyB;uBA3CjC,yBAAyB;6BAgCnB,uBAAuB;yBAP3B,uBAAuB;iCANf,8BAA8B;6BAKrB,uBAAuB;0CAevB,oCAAoC;6BAbjD,8BAA8B;sBA5B1B,uBAAuB;0BAiDjC,iCAAiC;+BAC5B,iCAAiC;6BACnC,6BAA6B;0BAChC,4BAA4B;6BACzB,+BAA+B;8BAC9B,wBAAwB"}
|
|
@@ -23,11 +23,18 @@ export default class WebGPUQuadBatcher extends WebGPUBatcher {
|
|
|
23
23
|
currentMaterial: any;
|
|
24
24
|
currentEffect: any;
|
|
25
25
|
slotTable: TextureSlotTable | undefined;
|
|
26
|
+
_memoView: any;
|
|
26
27
|
/** @type {{view: GPUTextureView, sampler: GPUSampler}[]} indexed by slot */
|
|
27
28
|
segmentEntries: {
|
|
28
29
|
view: GPUTextureView;
|
|
29
30
|
sampler: GPUSampler;
|
|
30
31
|
}[] | undefined;
|
|
32
|
+
/** @ignore */
|
|
33
|
+
_memoFilter: any;
|
|
34
|
+
/** @ignore */
|
|
35
|
+
_memoWrap: any;
|
|
36
|
+
/** @ignore */
|
|
37
|
+
_memoSlot: number | undefined;
|
|
31
38
|
segmentGroup: GPUBindGroup | null | undefined;
|
|
32
39
|
/** @type {Map<string, GPUBindGroup>} */
|
|
33
40
|
composedGroups: Map<string, GPUBindGroup> | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"quad_batcher.d.ts","sourceRoot":"","sources":["../../../../src/video/webgpu/batchers/quad_batcher.js"],"names":[],"mappings":"AAOA;;;;;;;;;;;;;;;GAeG;AACH;IACC;;;OAGG;IACH,wBAHW,OAAO,uBAAuB,EAAE,OAAO,
|
|
1
|
+
{"version":3,"file":"quad_batcher.d.ts","sourceRoot":"","sources":["../../../../src/video/webgpu/batchers/quad_batcher.js"],"names":[],"mappings":"AAOA;;;;;;;;;;;;;;;GAeG;AACH;IACC;;;OAGG;IACH,wBAHW,OAAO,uBAAuB,EAAE,OAAO,uBAwGjD;IAjEA,qBAA2B;IAM3B,mBAAyB;IASzB,wCAcE;IAHC,eAAqB;IAIxB,4EAA4E;IAC5E;cADkB,cAAc;iBAAW,UAAU;oBAC7B;IAGxB,cAAc;IACd,iBAAuB;IACvB,cAAc;IACd,eAAqB;IACrB,cAAc;IACd,8BAAkB;IAElB,8CAAwB;IAIxB,wCAAwC;IACxC,sDAA+B;IAE/B,8CAAgC;IAChC,mCAAuB;IAQvB,0CAKE;IAKH;;;;;;;;;;;;;;;OAeG;IACH,iBAZW,MAAM,KACN,MAAM,KACN,MAAM,KACN,MAAM,KACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,QACN,MAAM,aACN,OAAO,QAyEjB;IAED;;;;;;;;;;OAUG;IACH,wBALW,MAAM,YACN,OAAO,GACL,MAAM,CAuDlB;IAED;;;OAGG;IACH,+BAOC;IAED;;;;;;;OAOG;IACH,uBAHa,YAAY,CA+BxB;IAED;;;OAGG;IACH,qBAQC;IAED;;;;;OAKG;IACH,2BAGC;IAED;;;;;;;;;OASG;IACH,0HAgBC;IAED;;;;;;;;;;;;;;;;OAgBG;IACH,oBATW,OAAO,0CAA0C,EAAE,OAAO,KAC1D,MAAM,KACN,MAAM,KACN,MAAM,KACN,MAAM,WACN,YAAY,cACZ,OAAO,QAyDjB;IAqBD;;OAEG;IACH,oCA6BC;IAED;;;;;OAKG;IACH,8BAEC;IAED;;;;;;OAMG;IACH,yBAHW,MAAM,QAuChB;CAwBD;0BA3kByB,qBAAqB;iCAHd,2BAA2B"}
|
|
@@ -1,12 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Normalize a user-facing blend-mode string to a cache-key token — the
|
|
3
|
-
* same collapsing the WebGL backend applies ("add"/"lighter" → additive,
|
|
4
|
-
* unknown → normal).
|
|
5
|
-
* @param {string} mode - blend mode as set through `setBlendMode`
|
|
6
|
-
* @returns {string} normalized token
|
|
7
|
-
* @ignore
|
|
8
|
-
*/
|
|
9
|
-
export function normalizeBlendMode(mode: string): string;
|
|
10
1
|
/**
|
|
11
2
|
* Texture slots per quad draw segment — the quad family batches quads
|
|
12
3
|
* across up to this many distinct textures before a flush is forced (the
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cache.d.ts","sourceRoot":"","sources":["../../../../src/video/webgpu/pipeline/cache.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"cache.d.ts","sourceRoot":"","sources":["../../../../src/video/webgpu/pipeline/cache.js"],"names":[],"mappings":"AA6BA;;;;;;;GAOG;AACH,gCAAiC,CAAC,CAAC;AAEnC;;;;;;;GAOG;AACH,mCAAoC,sBAAsB,CAAC;AA6E3D;;;;;;;;;;;;GAYG;AACH;IAwKC;;;OAGG;IACH,4BAAwB;IA3KxB;;;OAGG;IACH,oBAHW,SAAS,UACT,MAAM,EAmKhB;IAhKA,kBAAoB;IACpB,eAAoB;IACpB,oBAAoB;IACpB,6CAA6C;IAC7C,WADW,GAAG,CAAC,MAAM,EAAE,iBAAiB,CAAC,CACf;IAC1B,kEAAkE;IAClE,eADW,GAAG,CAAC,MAAM,EAAE;QAAC,MAAM,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,MAAM,EAAE,CAAA;KAAC,CAAC,CAChC;IAG9B,gCAaE;IACF,qCAaE;IACF,mCAME;IAYF,uCAQE;IAiBF,wCAGE;IAGF;;;;;MAmBC;IAGD;;;;;MAaC;IAKD,0DAA0D;IAC1D,mBADW,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CACI;IAGlC,+BAAgC;IAChC,mGAAmG;IACnG,qBADW,GAAG,CAAC,MAAM,EAAE;QAAC,MAAM,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,MAAM,EAAE,CAAA;KAAC,CAAC,CAC1B;IAGpC,+EAA+E;IAC/E,eADW,GAAG,CAAC,MAAM,EAAE,kBAAkB,CAAC,CACZ;IAM9B,gCAGE;IACF,6BAIE;IAEF;;;;;;OAMG;IACH,OAFU,MAAM,CAE+B;IAShD;;;;;;;;;;;;;OAaG;IACH,qBATW,MAAM,YAEd;QAAuC,gBAAgB;QAE9B,eAAe;QAEf,KAAK;KAC9B,GAAU,MAAM,CAsClB;IAED;;;;;;;;OAQG;IACH,2BAJW,MAAM,WACN,uBAAuB,EAAE,GACvB,kBAAkB,CAY9B;IAED;;;;;;;;;;;;;;;OAeG;IACH,gCAJW,MAAM,UACN,MAAM,GAAC,MAAM,EAAE,eACf;QAAC,MAAM,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAC,EAAE,QAqC5C;IAED;;;;;;;;;;;;;;OAcG;IACH,eAbW,MAAM,YACN,MAAM,aACN,MAAM,sBACN,OAAO,gBACP,MAAM,cACN;QAAC,QAAQ,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,CAAA;KAAC,GAMnC,iBAAiB,CA4E7B;IAED;;;OAGG;IACH,cAEC;CACD"}
|
|
@@ -50,6 +50,37 @@ export default class WebGPURenderer extends Renderer {
|
|
|
50
50
|
readonly preferredFormat: string | undefined;
|
|
51
51
|
cache: TextureCache;
|
|
52
52
|
currentTransform: Matrix3d;
|
|
53
|
+
/**
|
|
54
|
+
* Advanced-blend state — the WebGPU twin of the WebGL bracket, and
|
|
55
|
+
* deliberately the same shape. The six CSS modes fixed-function
|
|
56
|
+
* cannot express are composited by capturing the destination,
|
|
57
|
+
* rendering the draw to an offscreen target, then blitting that
|
|
58
|
+
* through {@link BlendEffect}. All lazily created.
|
|
59
|
+
*
|
|
60
|
+
* `_advancedBlendBusy` is a DEPTH, not a flag: the bracket nests
|
|
61
|
+
* inside itself (the composite blit re-enters `setBatcher`).
|
|
62
|
+
*
|
|
63
|
+
* One documented difference from WebGL: masks need no handling here.
|
|
64
|
+
* `beginPass` attaches the shared depth/stencil texture whatever the
|
|
65
|
+
* current target is, so an armed mask clips the offscreen draw
|
|
66
|
+
* directly — where the GL backend has to disable the test (its
|
|
67
|
+
* offscreen FBO owns a separate, zeroed stencil) and let the
|
|
68
|
+
* composite carry the clip instead. Same result, different route.
|
|
69
|
+
* @ignore
|
|
70
|
+
*/
|
|
71
|
+
_advancedBlendEffect: BlendEffect | undefined;
|
|
72
|
+
/** @ignore */
|
|
73
|
+
_advancedBlendCapture: any;
|
|
74
|
+
/** @ignore */
|
|
75
|
+
_advancedBlendTarget: WebGPURenderTarget | undefined;
|
|
76
|
+
/** @ignore */
|
|
77
|
+
_advancedBlendOpen: boolean;
|
|
78
|
+
/** @ignore */
|
|
79
|
+
_advancedBlendBusy: number;
|
|
80
|
+
/** @ignore */
|
|
81
|
+
_advancedBlendParent: WebGPURenderTarget | null;
|
|
82
|
+
/** @ignore */
|
|
83
|
+
_advancedBlendWarned: Set<any>;
|
|
53
84
|
onGameReset: () => void;
|
|
54
85
|
onCanvasResize: () => void;
|
|
55
86
|
GPUVendor: string | undefined;
|
|
@@ -102,6 +133,8 @@ export default class WebGPURenderer extends Renderer {
|
|
|
102
133
|
height: number;
|
|
103
134
|
} | undefined;
|
|
104
135
|
}): Texture2d | null;
|
|
136
|
+
/** @ignore */
|
|
137
|
+
_toFrameTexture(options?: {}): any;
|
|
105
138
|
/**
|
|
106
139
|
* Draw a pooled render target through an effect's pipeline as a
|
|
107
140
|
* screen-space quad — the compositing primitive of the post-effect
|
|
@@ -118,6 +151,35 @@ export default class WebGPURenderer extends Renderer {
|
|
|
118
151
|
* @override
|
|
119
152
|
*/
|
|
120
153
|
override blitEffect(source: import("../rendertarget/webgpurendertarget.js").default, x: number, y: number, width: number, height: number, effect: ShaderEffect, keepBlend?: boolean): void;
|
|
154
|
+
/**
|
|
155
|
+
* Say once, per excluded path and mode, that an advanced blend mode is
|
|
156
|
+
* falling back to `"normal"`. A silent data-dependent fallback is exactly
|
|
157
|
+
* what the advanced-blend work exists to remove, so the exclusions are
|
|
158
|
+
* loud.
|
|
159
|
+
* @param {string} what - the excluded path, named for the message
|
|
160
|
+
* @ignore
|
|
161
|
+
*/
|
|
162
|
+
_warnAdvancedBlendFallback(what: string): void;
|
|
163
|
+
/**
|
|
164
|
+
* Close a pending advanced-blend bracket, if one is open and we are not
|
|
165
|
+
* already inside the bracket machinery.
|
|
166
|
+
* @ignore
|
|
167
|
+
*/
|
|
168
|
+
_drainAdvancedBlend(): void;
|
|
169
|
+
/**
|
|
170
|
+
* Open an advanced-blend bracket: capture the destination, then redirect
|
|
171
|
+
* this draw into an offscreen target.
|
|
172
|
+
* @returns {boolean} false when the effect could not be realized, in which
|
|
173
|
+
* case the draw proceeds unbracketed (plain source-over)
|
|
174
|
+
* @ignore
|
|
175
|
+
*/
|
|
176
|
+
_openAdvancedBlend(): boolean;
|
|
177
|
+
/**
|
|
178
|
+
* Close an advanced-blend bracket: drain the offscreen, retarget to the
|
|
179
|
+
* parent, and composite through {@link BlendEffect}.
|
|
180
|
+
* @ignore
|
|
181
|
+
*/
|
|
182
|
+
_closeAdvancedBlend(): void;
|
|
121
183
|
/**
|
|
122
184
|
* Clear the current clip region with the given color — a full-viewport
|
|
123
185
|
* triangle clipped by the active scissor, drawn with blending replaced
|
|
@@ -227,13 +289,45 @@ export default class WebGPURenderer extends Renderer {
|
|
|
227
289
|
*/
|
|
228
290
|
getGlobalAlpha(): number;
|
|
229
291
|
/**
|
|
230
|
-
*
|
|
231
|
-
*
|
|
232
|
-
*
|
|
233
|
-
*
|
|
234
|
-
*
|
|
292
|
+
* set the current blend mode for this renderer. <br>
|
|
293
|
+
* Both GPU renderers support the full set — the Canvas fallback supports
|
|
294
|
+
* every mode below except `"none"`: <br>
|
|
295
|
+
* - "normal" : draws new content on top of the existing content <br>
|
|
296
|
+
* <img src="../images/normal-blendmode.png" width="180"/> <br>
|
|
297
|
+
* - "add", "additive", or "lighter" : color values are added together <br>
|
|
298
|
+
* <img src="../images/add-blendmode.png" width="180"/> <br>
|
|
299
|
+
* - "multiply" : pixels are multiplied, resulting in a darker picture <br>
|
|
300
|
+
* <img src="../images/multiply-blendmode.png" width="180"/> <br>
|
|
301
|
+
* - "screen" : pixels are inverted, multiplied, and inverted again (opposite of multiply) <br>
|
|
302
|
+
* <img src="../images/screen-blendmode.png" width="180"/> <br>
|
|
303
|
+
* - "darken" : retains the darkest pixels of both layers <br>
|
|
304
|
+
* <img src="../images/darken-blendmode.png" width="180"/> <br>
|
|
305
|
+
* - "lighten" : retains the lightest pixels of both layers <br>
|
|
306
|
+
* <img src="../images/lighten-blendmode.png" width="180"/> <br>
|
|
307
|
+
* - "overlay" : multiplies or screens, depending on the backdrop <br>
|
|
308
|
+
* <img src="../images/overlay-blendmode.png" width="180"/> <br>
|
|
309
|
+
* - "hard-light" : overlay with the layers swapped — a harsh spotlight <br>
|
|
310
|
+
* <img src="../images/hard-light-blendmode.png" width="180"/> <br>
|
|
311
|
+
* - "soft-light" : a diffused spotlight, gentler than hard-light <br>
|
|
312
|
+
* <img src="../images/soft-light-blendmode.png" width="180"/> <br>
|
|
313
|
+
* - "color-dodge" : brightens the backdrop to reflect the source <br>
|
|
314
|
+
* <img src="../images/color-dodge-blendmode.png" width="180"/> <br>
|
|
315
|
+
* - "color-burn" : darkens the backdrop to reflect the source <br>
|
|
316
|
+
* <img src="../images/color-burn-blendmode.png" width="180"/> <br>
|
|
317
|
+
* - "difference" : the absolute difference of the two layers <br>
|
|
318
|
+
* <img src="../images/difference-blendmode.png" width="180"/> <br>
|
|
319
|
+
* - "exclusion" : like difference, but lower in contrast <br>
|
|
320
|
+
* <img src="../images/exclusion-blendmode.png" width="180"/> <br>
|
|
321
|
+
* - "none" : blending disabled — the source replaces the destination
|
|
322
|
+
* outright, alpha included <br>
|
|
323
|
+
* A few draw types cannot honour every mode — 3D meshes, and fills using
|
|
324
|
+
* a {@link Gradient} — and fall back to "normal" with a one-time console
|
|
325
|
+
* warning. `setBlendMode` returns what it actually applied, so comparing
|
|
326
|
+
* the result against your request detects that case.
|
|
327
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/globalCompositeOperation
|
|
328
|
+
* @param {string} [mode="normal"] - blend mode
|
|
235
329
|
* @param {boolean} [premultipliedAlpha=true] - whether textures use premultiplied alpha (affects the source blend factor)
|
|
236
|
-
* @returns {string} the blend mode actually applied
|
|
330
|
+
* @returns {string} the blend mode actually applied (may differ if the requested mode is unsupported)
|
|
237
331
|
*/
|
|
238
332
|
setBlendMode(mode?: string, premultipliedAlpha?: boolean): string;
|
|
239
333
|
/**
|
|
@@ -529,6 +623,7 @@ import WebGPUBufferArena from "./buffer/arena.js";
|
|
|
529
623
|
import WebGPUUniformRing from "./buffer/uniformring.js";
|
|
530
624
|
import WebGPUTextureStore from "./texture/store.js";
|
|
531
625
|
import WebGPURenderTarget from "../rendertarget/webgpurendertarget.js";
|
|
626
|
+
import BlendEffect from "../effects/blendEffect.js";
|
|
532
627
|
import { Color } from "../../math/color.ts";
|
|
533
628
|
import WebGPUBatcher from "./batchers/webgpu_batcher.js";
|
|
534
629
|
import RadialGradientEffect from "../effects/radialGradient.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webgpu_renderer.d.ts","sourceRoot":"","sources":["../../../src/video/webgpu/webgpu_renderer.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"webgpu_renderer.d.ts","sourceRoot":"","sources":["../../../src/video/webgpu/webgpu_renderer.js"],"names":[],"mappings":"AAyDA;;;;;;;;;;;;;;;GAeG;AACH,iDANW,OAAO,qBACP,OAAO,GACL;IAAC,WAAW,EAAE,MAAM,CAAC;IAAC,Y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AM,UACN,MAAM,QAIhB;IAED;;;;;;;OAOG;IACH,aANW,MAAM,KACN,MAAM,SACN,MAAM,UACN,MAAM,SACN,MAAM,QAIhB;IAED;;OAEG;IACH,kBAEC;IAED;;;;OAIG;IACH,eAHW,IAAI,GAAC,SAAS,GAAC,OAAO,GAAC,IAAI,GAAC,OAAO,GAAC,MAAM,SAC1C,OAAO,QA2BjB;IAED;;;OAGG;IACH,aAFW,IAAI,GAAC,SAAS,GAAC,OAAO,GAAC,IAAI,GAAC,OAAO,GAAC,MAAM,QAIpD;IAmCD;;;;;OAKG;IACH,+BAwCC;IAED;;;OAGG;IACH,cAFa,gBAAgB,CAI5B;CAqFD;qBAtgHoB,gBAAgB;0CAyBK,oCAAoC;yBArBrD,qBAAqB;yBAzBrB,wBAAwB;uBAC1B,yBAAyB;gCA4CU,qBAAqB;8BAFjD,mBAAmB;8BACnB,yBAAyB;+BAKxB,oBAAoB;+BA1BpB,uCAAuC;wBAL9C,2BAA2B;sBAnBlB,qBAAqB;0BA2C5B,8BAA8B;iCAvBvB,8BAA8B;6BAKrB,qBAAqB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "melonjs",
|
|
3
|
-
"version": "20.
|
|
3
|
+
"version": "20.3.0",
|
|
4
4
|
"description": "melonJS Game Engine",
|
|
5
5
|
"homepage": "http://www.melonjs.org/",
|
|
6
6
|
"type": "module",
|
|
@@ -50,16 +50,12 @@
|
|
|
50
50
|
},
|
|
51
51
|
"files": [
|
|
52
52
|
"build",
|
|
53
|
-
"
|
|
53
|
+
"skills",
|
|
54
54
|
"README.md",
|
|
55
|
-
"CHANGELOG"
|
|
55
|
+
"CHANGELOG",
|
|
56
|
+
"package.json"
|
|
56
57
|
],
|
|
57
|
-
"dependencies": {
|
|
58
|
-
"core-js": "^3.48.0",
|
|
59
|
-
"howler": "2.2.4"
|
|
60
|
-
},
|
|
61
58
|
"devDependencies": {
|
|
62
|
-
"@types/howler": "^2.2.13",
|
|
63
59
|
"@types/node": "^25.6.0",
|
|
64
60
|
"concurrently": "^9.2.1",
|
|
65
61
|
"del-cli": "^7.0.0",
|
|
@@ -81,8 +77,8 @@
|
|
|
81
77
|
"build": "pnpm lint && tsx scripts/build.js && pnpm types",
|
|
82
78
|
"dist": "pnpm clean && pnpm lint && pnpm vitest run && pnpm build && pnpm doc && cp ../../README.md .",
|
|
83
79
|
"dist:publish": "pnpm clean && pnpm lint && pnpm build && pnpm doc && cp ../../README.md .",
|
|
84
|
-
"doc": "typedoc src/index.ts --tsconfig tsconfig.build.json --readme DOC_README.md --hideGenerator --name 'melonJS' --navigation.includeCategories true --categorizeByGroup false",
|
|
85
|
-
"doc:watch": "typedoc src/index.ts --tsconfig tsconfig.build.json --readme DOC_README.md --hideGenerator --name 'melonJS' --navigation.includeCategories true --categorizeByGroup false --watch --skipErrorChecking --preserveWatchOutput --logLevel Error",
|
|
80
|
+
"doc": "tsx scripts/check-doc-readme.ts && typedoc src/index.ts --tsconfig tsconfig.build.json --readme ../../DOC_README.md --hideGenerator --name 'melonJS' --navigation.includeCategories true --categorizeByGroup false && tsx scripts/generate-llms-txt.ts",
|
|
81
|
+
"doc:watch": "typedoc src/index.ts --tsconfig tsconfig.build.json --readme ../../DOC_README.md --hideGenerator --name 'melonJS' --navigation.includeCategories true --categorizeByGroup false --watch --skipErrorChecking --preserveWatchOutput --logLevel Error",
|
|
86
82
|
"serve": "serve docs",
|
|
87
83
|
"prepublishOnly": "pnpm dist:publish",
|
|
88
84
|
"clean": "tsx scripts/clean.ts",
|
package/skills/AGENTS.md
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
# melonJS — agent instructions
|
|
2
|
+
|
|
3
|
+
> **This is a template for a game that *uses* melonJS, not instructions for
|
|
4
|
+
> working on the engine itself.** Copy it to your own project root:
|
|
5
|
+
>
|
|
6
|
+
> ```bash
|
|
7
|
+
> cp node_modules/melonjs/skills/AGENTS.md ./AGENTS.md
|
|
8
|
+
> ```
|
|
9
|
+
>
|
|
10
|
+
> Already have an `AGENTS.md`? Paste the sections below into it. Codex, Cursor,
|
|
11
|
+
> Gemini CLI and anything else following the `AGENTS.md` convention will read it
|
|
12
|
+
> from your project root. Claude Code users should install the plugin instead —
|
|
13
|
+
> `/plugin marketplace add melonjs/melonJS` — which registers the same guidance
|
|
14
|
+
> as 23 routed skills.
|
|
15
|
+
|
|
16
|
+
This project uses **melonJS 20.x**, an open-source HTML5 game engine covering
|
|
17
|
+
2D, 2.5D and 3D, running on WebGPU, WebGL 2 or Canvas with automatic fallback.
|
|
18
|
+
|
|
19
|
+
## Read these before writing engine code
|
|
20
|
+
|
|
21
|
+
Task-oriented guides ship with the package at `node_modules/melonjs/skills/`,
|
|
22
|
+
one directory per subsystem, each ending with a symptom → cause table.
|
|
23
|
+
|
|
24
|
+
**Start at `node_modules/melonjs/skills/melonjs/SKILL.md`** — it routes to the
|
|
25
|
+
right one for the task. Do not read all of them; read the router, then the one
|
|
26
|
+
or two it points at.
|
|
27
|
+
|
|
28
|
+
For anything the guides do not cover, fetch
|
|
29
|
+
<https://melonjs.github.io/melonJS/llms.txt> — an index of every exported class,
|
|
30
|
+
function and type with a one-line summary and a link to its reference page,
|
|
31
|
+
regenerated on every docs build. Deprecated entries are marked. Do not infer an
|
|
32
|
+
API from the shape of the engine; look it up.
|
|
33
|
+
|
|
34
|
+
## Three rules that produce code which runs and is wrong
|
|
35
|
+
|
|
36
|
+
1. **`await app.init()` is mandatory** since 20.0. The `Application` constructor
|
|
37
|
+
builds the world but no renderer, so `addChild` silently succeeds while
|
|
38
|
+
`new Sprite(...)` throws a `TypeError` that names neither the class nor the
|
|
39
|
+
missing call.
|
|
40
|
+
2. **`addChild(child, z)` is the only way to set draw order.** `renderable.z`
|
|
41
|
+
does not exist. Setting `depth` before `addChild` is overwritten by
|
|
42
|
+
`autoDepth`; setting it after does not resort.
|
|
43
|
+
3. **`isKinematic` defaults to `true`**, which silently excludes a renderable
|
|
44
|
+
from pointer events and from the physics broadphase. Plain `Renderable` and
|
|
45
|
+
`Sprite` subclasses need `this.isKinematic = false` — attaching a `Body`
|
|
46
|
+
sets it for you.
|
|
47
|
+
|
|
48
|
+
## Most melonJS bugs are silent, not fatal
|
|
49
|
+
|
|
50
|
+
The engine warns and degrades rather than throwing. A shader effect on the
|
|
51
|
+
Canvas fallback, a `Camera3d` without a GPU backend, a pooled object whose
|
|
52
|
+
`onResetEvent` forgets a property — all render *something*. When output looks
|
|
53
|
+
wrong rather than crashing, check the console for a one-shot warning and consult
|
|
54
|
+
the relevant skill's symptom table before debugging the game logic.
|
|
55
|
+
|
|
56
|
+
## Prefer built-in features
|
|
57
|
+
|
|
58
|
+
Before hand-rolling: `ParticleEmitter`, `Trail`, `Tween`, the built-in
|
|
59
|
+
`ShaderEffect` presets, `Light2d` / `Light3d`, `UIBaseElement` /
|
|
60
|
+
`UITextButton`, `NineSliceSprite`, `TextureAtlas`, `BitmapText`,
|
|
61
|
+
`CanvasRenderTarget` for bake-once drawing, `viewport.shake` / `fadeIn` /
|
|
62
|
+
`fadeOut`, and `save` for persistence.
|
|
63
|
+
|
|
64
|
+
Companion packages cover the rest: `@melonjs/planck-adapter` and
|
|
65
|
+
`@melonjs/matter-adapter` (physics), `@melonjs/spine-plugin` (skeletal
|
|
66
|
+
animation), `@melonjs/tiled-inflate-plugin` (**required** for compressed Tiled
|
|
67
|
+
maps), `@melonjs/debug-plugin`, `@melonjs/capacitor-plugin`.
|