melonjs 19.2.0 → 19.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (81) hide show
  1. package/README.md +13 -10
  2. package/build/application/application.d.ts.map +1 -1
  3. package/build/application/defaultApplicationSettings.d.ts +1 -0
  4. package/build/application/defaultApplicationSettings.d.ts.map +1 -1
  5. package/build/application/settings.d.ts +12 -0
  6. package/build/application/settings.d.ts.map +1 -1
  7. package/build/camera/camera2d.d.ts.map +1 -1
  8. package/build/index.js +2665 -629
  9. package/build/index.js.map +4 -4
  10. package/build/input/pointerevent.d.ts.map +1 -1
  11. package/build/level/tiled/TMXLayer.d.ts +72 -5
  12. package/build/level/tiled/TMXLayer.d.ts.map +1 -1
  13. package/build/level/tiled/TMXTile.d.ts +19 -1
  14. package/build/level/tiled/TMXTile.d.ts.map +1 -1
  15. package/build/level/tiled/TMXTileMap.d.ts.map +1 -1
  16. package/build/level/tiled/TMXTileset.d.ts +15 -0
  17. package/build/level/tiled/TMXTileset.d.ts.map +1 -1
  18. package/build/level/tiled/renderer/TMXHexagonalRenderer.d.ts +7 -1
  19. package/build/level/tiled/renderer/TMXHexagonalRenderer.d.ts.map +1 -1
  20. package/build/level/tiled/renderer/TMXIsometricRenderer.d.ts +7 -1
  21. package/build/level/tiled/renderer/TMXIsometricRenderer.d.ts.map +1 -1
  22. package/build/level/tiled/renderer/TMXObliqueRenderer.d.ts.map +1 -1
  23. package/build/level/tiled/renderer/TMXOrthogonalRenderer.d.ts +7 -1
  24. package/build/level/tiled/renderer/TMXOrthogonalRenderer.d.ts.map +1 -1
  25. package/build/physics/bounds.d.ts +5 -2
  26. package/build/physics/bounds.d.ts.map +1 -1
  27. package/build/physics/sat.d.ts.map +1 -1
  28. package/build/physics/world.d.ts +16 -0
  29. package/build/physics/world.d.ts.map +1 -1
  30. package/build/renderable/container.d.ts +1 -1
  31. package/build/renderable/container.d.ts.map +1 -1
  32. package/build/renderable/imagelayer.d.ts.map +1 -1
  33. package/build/renderable/light2d.d.ts +128 -18
  34. package/build/renderable/light2d.d.ts.map +1 -1
  35. package/build/renderable/sprite.d.ts +38 -6
  36. package/build/renderable/sprite.d.ts.map +1 -1
  37. package/build/state/stage.d.ts +65 -9
  38. package/build/state/stage.d.ts.map +1 -1
  39. package/build/utils/function.d.ts +1 -1
  40. package/build/utils/function.d.ts.map +1 -1
  41. package/build/video/buffer/vertex.d.ts +2 -1
  42. package/build/video/buffer/vertex.d.ts.map +1 -1
  43. package/build/video/canvas/canvas_renderer.d.ts +2 -0
  44. package/build/video/canvas/canvas_renderer.d.ts.map +1 -1
  45. package/build/video/renderer.d.ts +77 -1
  46. package/build/video/renderer.d.ts.map +1 -1
  47. package/build/video/renderstate.d.ts +20 -0
  48. package/build/video/renderstate.d.ts.map +1 -1
  49. package/build/video/texture/atlas.d.ts +26 -2
  50. package/build/video/texture/atlas.d.ts.map +1 -1
  51. package/build/video/texture/cache.d.ts.map +1 -1
  52. package/build/video/texture/resource.d.ts +113 -0
  53. package/build/video/texture/resource.d.ts.map +1 -0
  54. package/build/video/webgl/batchers/batcher.d.ts +6 -0
  55. package/build/video/webgl/batchers/batcher.d.ts.map +1 -1
  56. package/build/video/webgl/batchers/lit_quad_batcher.d.ts +109 -0
  57. package/build/video/webgl/batchers/lit_quad_batcher.d.ts.map +1 -0
  58. package/build/video/webgl/batchers/material_batcher.d.ts +8 -1
  59. package/build/video/webgl/batchers/material_batcher.d.ts.map +1 -1
  60. package/build/video/webgl/batchers/quad_batcher.d.ts +19 -1
  61. package/build/video/webgl/batchers/quad_batcher.d.ts.map +1 -1
  62. package/build/video/webgl/effects/radialGradient.d.ts +105 -0
  63. package/build/video/webgl/effects/radialGradient.d.ts.map +1 -0
  64. package/build/video/webgl/glshader.d.ts.map +1 -1
  65. package/build/video/webgl/lighting/constants.d.ts +13 -0
  66. package/build/video/webgl/lighting/constants.d.ts.map +1 -0
  67. package/build/video/webgl/lighting/pack.d.ts +76 -0
  68. package/build/video/webgl/lighting/pack.d.ts.map +1 -0
  69. package/build/video/webgl/renderers/tmxlayer/orthogonal.d.ts +108 -0
  70. package/build/video/webgl/renderers/tmxlayer/orthogonal.d.ts.map +1 -0
  71. package/build/video/webgl/shaders/multitexture-lit.d.ts +23 -0
  72. package/build/video/webgl/shaders/multitexture-lit.d.ts.map +1 -0
  73. package/build/video/webgl/utils/attributes.d.ts +7 -0
  74. package/build/video/webgl/utils/attributes.d.ts.map +1 -1
  75. package/build/video/webgl/utils/precision.d.ts +1 -1
  76. package/build/video/webgl/utils/precision.d.ts.map +1 -1
  77. package/build/video/webgl/utils/uniforms.d.ts +13 -0
  78. package/build/video/webgl/utils/uniforms.d.ts.map +1 -1
  79. package/build/video/webgl/webgl_renderer.d.ts +36 -0
  80. package/build/video/webgl/webgl_renderer.d.ts.map +1 -1
  81. package/package.json +1 -1
@@ -116,6 +116,12 @@ export class Batcher {
116
116
  * called by the WebGL renderer when a batcher becomes the current one
117
117
  */
118
118
  bind(): void;
119
+ /**
120
+ * called by the WebGL renderer when this batcher is being replaced by another.
121
+ * Disables this batcher's vertex attribute locations so they don't leak across
122
+ * (otherwise stale stride/offset state can cause INVALID_OPERATION on the next draw).
123
+ */
124
+ unbind(): void;
119
125
  /**
120
126
  * Select the shader to use for compositing
121
127
  * @see GLShader
@@ -1 +1 @@
1
- {"version":3,"file":"batcher.d.ts","sourceRoot":"","sources":["../../../../src/video/webgl/batchers/batcher.js"],"names":[],"mappings":"AAmBA;;;;GAIG;AACH;IACC;;;;;;;;;;;;;;;OAeG;IACH,sBAfW,aAAa,YAErB;QAA2B,UAAU,EACrC;YAAoC,IAAI,EAAhC,MAAM;YACsB,IAAI,EAAhC,MAAM;YACsB,IAAI,EAAhC,MAAM;YACuB,UAAU,EAAvC,OAAO;YACqB,MAAM,EAAlC,MAAM;SACd;QAAyB,MAAM,EAC/B;YAAgC,MAAM,EAA9B,MAAM;YACkB,QAAQ,EAAhC,MAAM;SACd;QAA0B,WAAW;QACV,OAAO;QACR,iBAAiB;KAC7C,EAGA;IAED;;;OAGG;IACH,yCA6HC;IA3HA,cAAwB;IAGxB,QAAqB;IAGrB,gBAA2C;IAE3C;;;OAGG;IACH,oCAA8B;IAE9B;;;OAGG;IACH,oCAA8B;IAE9B;;;;OAIG;IACH,yBAA6B;IAE7B;;;;OAIG;IACH,iCAAoB;IAEpB;;;;;OAKG;IACH,2BAAe;IAEf;;;;;OAKG;IACH,+BAAmB;IAEnB;;;OAGG;IACH,0CAAsB;IAqCtB;;;OAGG;IACH,sCAA0E;IAE1E;;;OAGG;IACH,oCAA+C;IAE/C;;;;OAIG;IACH,+CAA0B;IAE1B;;;;OAIG;IACH,iDAAuB;IAUxB;;;OAGG;IACH,cAUC;IAED;;OAEG;IACH,aAYC;IAED;;;;OAIG;IACH,kBAFW,QAAQ,QAqBlB;IAHE,uCAA4B;IAK/B;;;;;;;OAOG;IACH,mBANW,MAAM,QACN,MAAM,QACN,MAAM,cACN,OAAO,UACP,MAAM,QA+BhB;IAED;;;OAGG;IACH,sBAFW,QAAQ,QAIlB;IAED;;;;OAIG;IACH,oBAFW,MAAM,EAAE,QAOlB;IAED;;;OAGG;IACH,aAFW,MAAM,QAyEhB;CACD;;qBAhXoB,gBAAgB;8BAFP,wBAAwB;6BACzB,oBAAoB;8BAMtB,2BAA2B;+BADxB,wBAAwB"}
1
+ {"version":3,"file":"batcher.d.ts","sourceRoot":"","sources":["../../../../src/video/webgl/batchers/batcher.js"],"names":[],"mappings":"AAmBA;;;;GAIG;AACH;IACC;;;;;;;;;;;;;;;OAeG;IACH,sBAfW,aAAa,YAErB;QAA2B,UAAU,EACrC;YAAoC,IAAI,EAAhC,MAAM;YACsB,IAAI,EAAhC,MAAM;YACsB,IAAI,EAAhC,MAAM;YACuB,UAAU,EAAvC,OAAO;YACqB,MAAM,EAAlC,MAAM;SACd;QAAyB,MAAM,EAC/B;YAAgC,MAAM,EAA9B,MAAM;YACkB,QAAQ,EAAhC,MAAM;SACd;QAA0B,WAAW;QACV,OAAO;QACR,iBAAiB;KAC7C,EAGA;IAED;;;OAGG;IACH,yCA6HC;IA3HA,cAAwB;IAGxB,QAAqB;IAGrB,gBAA2C;IAE3C;;;OAGG;IACH,oCAA8B;IAE9B;;;OAGG;IACH,oCAA8B;IAE9B;;;;OAIG;IACH,yBAA6B;IAE7B;;;;OAIG;IACH,iCAAoB;IAEpB;;;;;OAKG;IACH,2BAAe;IAEf;;;;;OAKG;IACH,+BAAmB;IAEnB;;;OAGG;IACH,0CAAsB;IAqCtB;;;OAGG;IACH,sCAA0E;IAE1E;;;OAGG;IACH,oCAA+C;IAE/C;;;;OAIG;IACH,+CAA0B;IAE1B;;;;OAIG;IACH,iDAAuB;IAUxB;;;OAGG;IACH,cAUC;IAED;;OAEG;IACH,aAYC;IAED;;;;OAIG;IACH,eAaC;IAED;;;;OAIG;IACH,kBAFW,QAAQ,QA8BlB;IAHE,uCAA4B;IAK/B;;;;;;;OAOG;IACH,mBANW,MAAM,QACN,MAAM,QACN,MAAM,cACN,OAAO,UACP,MAAM,QA+BhB;IAED;;;OAGG;IACH,sBAFW,QAAQ,QAIlB;IAED;;;;OAIG;IACH,oBAFW,MAAM,EAAE,QAOlB;IAED;;;OAGG;IACH,aAFW,MAAM,QAyEhB;CACD;;qBA7YoB,gBAAgB;8BAFP,wBAAwB;6BACzB,oBAAoB;8BAMtB,2BAA2B;+BADxB,wBAAwB"}
@@ -0,0 +1,109 @@
1
+ /**
2
+ * additional import for TypeScript
3
+ * @import {TextureAtlas} from "./../../texture/atlas.js";
4
+ */
5
+ /**
6
+ * Lit-aware variant of `QuadBatcher` for the SpriteIlluminator workflow.
7
+ *
8
+ * Adds a 5th vertex attribute (`aNormalTextureId`) so each quad knows
9
+ * which paired normal-map sampler to read, and bundles the per-frame
10
+ * light uniforms (`uLightPos`, `uLightColor`, `uLightHeight`, `uAmbient`)
11
+ * that the lit fragment shader iterates.
12
+ *
13
+ * Texture-slot capacity is halved relative to `QuadBatcher` because each
14
+ * sprite may need a paired (color, normal) sampler — color goes to unit
15
+ * `n`, normal to unit `maxBatchTextures + n`. The `WebGLRenderer` only
16
+ * dispatches sprites here when the scene actually needs lighting (active
17
+ * `Light2d` AND the sprite has a `normalMap`); unlit sprites stay on
18
+ * `QuadBatcher` and pay nothing.
19
+ * @category Rendering
20
+ */
21
+ export default class LitQuadBatcher extends QuadBatcher {
22
+ /**
23
+ * normal-map texture per color slot — keyed by the same unit index as
24
+ * `boundTextures`. Used by `addQuad` to detect when a normal-map slot
25
+ * needs (re-)uploading, mirroring the color-texture cache.
26
+ * @type {Array<HTMLImageElement|HTMLCanvasElement|OffscreenCanvas|ImageBitmap|null>}
27
+ * @ignore
28
+ */
29
+ boundNormalMaps: (ImageBitmap | HTMLImageElement | HTMLCanvasElement | OffscreenCanvas | null)[] | undefined;
30
+ /**
31
+ * Map from a normal-map source image to its GL texture object.
32
+ * @type {Map<HTMLImageElement|HTMLCanvasElement|OffscreenCanvas|ImageBitmap, WebGLTexture>}
33
+ * @ignore
34
+ */
35
+ normalMapTextures: Map<ImageBitmap | HTMLImageElement | HTMLCanvasElement | OffscreenCanvas, WebGLTexture> | undefined;
36
+ _lightCount: number | undefined;
37
+ _maxLights: number | undefined;
38
+ /**
39
+ * Bind the paired normal sampler uniforms (`uNormalSampler0..N-1`)
40
+ * to texture units `maxBatchTextures..2*maxBatchTextures-1`. Called
41
+ * from `init` and `reset`.
42
+ * @ignore
43
+ */
44
+ bindNormalSamplers(): void;
45
+ /**
46
+ * Upload per-frame Light2d uniforms used by the lit fragment path.
47
+ * Called once per camera per frame (before the world tree walk).
48
+ * Lights past `MAX_LIGHTS` are silently ignored.
49
+ *
50
+ * Coordinates must be supplied in the same space as the renderer's
51
+ * pre-projection vertex coords (i.e. camera-local / FBO-local),
52
+ * matching `Stage.drawLighting`'s convention.
53
+ * @param {object} uniforms
54
+ * @param {Float32Array} uniforms.positions - flat array of `[x, y, radius, intensity]` per light, length = 4 * count
55
+ * @param {Float32Array} uniforms.colors - flat array of `[r, g, b]` per light, length = 3 * count
56
+ * @param {Float32Array} [uniforms.heights] - flat array of per-light height, length = MAX_LIGHTS
57
+ * @param {number} uniforms.count - number of lights to render (clamped to MAX_LIGHTS)
58
+ * @param {number[]} [uniforms.ambient] - `[r, g, b]` ambient floor (0..1 each)
59
+ */
60
+ setLightUniforms(uniforms: {
61
+ positions: Float32Array;
62
+ colors: Float32Array;
63
+ heights?: Float32Array<ArrayBufferLike> | undefined;
64
+ count: number;
65
+ ambient?: number[] | undefined;
66
+ }): void;
67
+ /**
68
+ * Bind a normal-map image to the given GL texture unit. Uploads on
69
+ * first use (via `uploadNormalMap`) and rebinds the cached
70
+ * `WebGLTexture` on subsequent calls. Mirrors the
71
+ * `bindTexture2D` / `createTexture2D` split used by `MaterialBatcher`,
72
+ * but for normal-map textures which live outside the color
73
+ * `TextureCache` (cached per-image in `normalMapTextures`).
74
+ * @param {HTMLImageElement|HTMLCanvasElement|OffscreenCanvas|ImageBitmap} image - normal-map source
75
+ * @param {number} unit - GL texture unit (already offset by `maxBatchTextures`)
76
+ */
77
+ bindNormalMap(image: HTMLImageElement | HTMLCanvasElement | OffscreenCanvas | ImageBitmap, unit: number): void;
78
+ /**
79
+ * Upload a normal-map image to GL and cache the resulting `WebGLTexture`
80
+ * for future `bindNormalMap` calls. Not meant to be called directly —
81
+ * `bindNormalMap` invokes this on the first use of a given image.
82
+ *
83
+ * `premultipliedAlpha = false` — normal maps store linear-encoded
84
+ * surface normals; multiplying through alpha would corrupt the
85
+ * encoding for any non-opaque texel.
86
+ * @param {HTMLImageElement|HTMLCanvasElement|OffscreenCanvas|ImageBitmap} image - normal-map source
87
+ * @param {number} unit - GL texture unit (already offset by `maxBatchTextures`)
88
+ */
89
+ uploadNormalMap(image: HTMLImageElement | HTMLCanvasElement | OffscreenCanvas | ImageBitmap, unit: number): void;
90
+ /**
91
+ * Add a textured quad with optional paired normal map.
92
+ * @param {TextureAtlas} texture - Source texture atlas
93
+ * @param {number} x - Destination x-coordinate
94
+ * @param {number} y - Destination y-coordinate
95
+ * @param {number} w - Destination width
96
+ * @param {number} h - Destination height
97
+ * @param {number} u0 - Texture UV (u0) value
98
+ * @param {number} v0 - Texture UV (v0) value
99
+ * @param {number} u1 - Texture UV (u1) value
100
+ * @param {number} v1 - Texture UV (v1) value
101
+ * @param {number} tint - tint color (UINT32 argb)
102
+ * @param {boolean} [reupload=false] - Force the texture to be reuploaded
103
+ * @param {HTMLImageElement|HTMLCanvasElement|null} [normalMap=null] - paired normal-map (SpriteIlluminator workflow)
104
+ */
105
+ addQuad(texture: TextureAtlas, x: number, y: number, w: number, h: number, u0: number, v0: number, u1: number, v1: number, tint: number, reupload?: boolean, normalMap?: HTMLImageElement | HTMLCanvasElement | null): void;
106
+ }
107
+ import QuadBatcher from "./quad_batcher.js";
108
+ import type { TextureAtlas } from "./../../texture/atlas.js";
109
+ //# sourceMappingURL=lit_quad_batcher.d.ts.map
@@ -0,0 +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;IAoEE;;;;;;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,QAiBhB;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,QA0EjD;CAwDD;wBAtXoC,mBAAmB;kCAIzB,0BAA0B"}
@@ -57,8 +57,15 @@ export class MaterialBatcher extends Batcher {
57
57
  unbindTexture2D(texture?: WebGLTexture, unit?: number): number;
58
58
  /**
59
59
  * @ignore
60
+ * @param {TextureAtlas|TextureResource} texture
61
+ * @param {number} [w] - ignored when the source has its own `width` (the
62
+ * common case); kept for the legacy signature where callers passed a
63
+ * destination size. Forwarded only as a last-resort default.
64
+ * @param {number} [h] - same as `w`.
65
+ * @param {boolean} [force=false]
66
+ * @param {boolean} [flush=true]
60
67
  */
61
- uploadTexture(texture: any, w: any, h: any, force?: boolean, flush?: boolean): any;
68
+ uploadTexture(texture: TextureAtlas | TextureResource, w?: number, h?: number, force?: boolean, flush?: boolean): any;
62
69
  }
63
70
  import { Batcher } from "./batcher.js";
64
71
  import type { TextureAtlas } from "./../../texture/atlas.js";
@@ -1 +1 @@
1
- {"version":3,"file":"material_batcher.d.ts","sourceRoot":"","sources":["../../../../src/video/webgl/batchers/material_batcher.js"],"names":[],"mappings":"AAGA;;;GAGG;AAEH;;;;GAIG;AACH;IAQE;;;OAGG;IACH,wBAA4B;IAE5B;;;OAGG;IACH,iCAAuB;IA0BxB;;;;;;;;;;;OAWG;IACH,sBAVW,MAAM,WACN,8DAAM,iBAAiB,GAAC,SAAS,GAAC,UAAU,EAAE,GAAC,YAAY,EAAE,UAC7D,MAAM,WACN,MAAM,MACN,MAAM,MACN,MAAM,uBACN,OAAO,WACP,OAAO,kCACL,YAAY,CAmHxB;IAED;;;OAGG;IACH,yBAFW,YAAY,GAAC,YAAY,QAiBnC;IAED;;;;OAIG;IACH,mBAHW,MAAM,GACJ,YAAY,CAIxB;IAED;;;;OAIG;IACH,uBAHW,YAAY,QACZ,MAAM,yBAsBhB;IAED;;;;;OAKG;IACH,0BAJW,YAAY,SACZ,MAAM,GACJ,MAAM,CAalB;IAED;;OAEG;IACH,mFAsBC;CACD;wBA7RuB,cAAc;kCAIP,0BAA0B"}
1
+ {"version":3,"file":"material_batcher.d.ts","sourceRoot":"","sources":["../../../../src/video/webgl/batchers/material_batcher.js"],"names":[],"mappings":"AAGA;;;GAGG;AAEH;;;;GAIG;AACH;IAQE;;;OAGG;IACH,wBAA4B;IAE5B;;;OAGG;IACH,iCAAuB;IA0BxB;;;;;;;;;;;OAWG;IACH,sBAVW,MAAM,WACN,8DAAM,iBAAiB,GAAC,SAAS,GAAC,UAAU,EAAE,GAAC,YAAY,EAAE,UAC7D,MAAM,WACN,MAAM,MACN,MAAM,MACN,MAAM,uBACN,OAAO,WACP,OAAO,kCACL,YAAY,CA6IxB;IAED;;;OAGG;IACH,yBAFW,YAAY,GAAC,YAAY,QAiBnC;IAED;;;;OAIG;IACH,mBAHW,MAAM,GACJ,YAAY,CAIxB;IAED;;;;OAIG;IACH,uBAHW,YAAY,QACZ,MAAM,yBAsBhB;IAED;;;;;OAKG;IACH,0BAJW,YAAY,SACZ,MAAM,GACJ,MAAM,CAalB;IAED;;;;;;;;;OASG;IACH,uBARW,YAAY,GAAC,eAAe,MAC5B,MAAM,MAGN,MAAM,UACN,OAAO,UACP,OAAO,OAiDjB;CACD;wBAvVuB,cAAc;kCAIP,0BAA0B"}
@@ -1,3 +1,8 @@
1
+ /**
2
+ * additional import for TypeScript
3
+ * @import {TextureAtlas} from "./../../texture/atlas.js";
4
+ */
5
+ export const V_ARRAY: Vector2d[];
1
6
  /**
2
7
  * A WebGL Compositor object. This class handles all of the WebGL state<br>
3
8
  * Pushes texture regions or shape geometry into WebGL buffers, automatically flushes to GPU
@@ -22,6 +27,18 @@ export default class QuadBatcher extends MaterialBatcher {
22
27
  * @ignore
23
28
  */
24
29
  useMultiTexture: boolean | undefined;
30
+ /**
31
+ * (Re-)create the index buffer for quad batching (4 verts + 6 indices per quad).
32
+ * Called from `init` and `reset` (after context loss).
33
+ * @ignore
34
+ */
35
+ createIndexBuffer(): void;
36
+ /**
37
+ * Bind the color sampler uniforms (`uSampler0..uSamplerN-1`) to their
38
+ * respective texture units. Called from `init` and `reset`.
39
+ * @ignore
40
+ */
41
+ bindColorSamplers(): void;
25
42
  /**
26
43
  * Select the shader to use for compositing.
27
44
  * Multi-texture batching is automatically enabled when the default
@@ -55,10 +72,11 @@ export default class QuadBatcher extends MaterialBatcher {
55
72
  * @param {number} u1 - Texture UV (u1) value.
56
73
  * @param {number} v1 - Texture UV (v1) value.
57
74
  * @param {number} tint - tint color to be applied to the texture in UINT32 (argb) format
58
- * @param {boolean} reupload - Force the texture to be reuploaded even if already bound
75
+ * @param {boolean} [reupload=false] - Force the texture to be reuploaded even if already bound
59
76
  */
60
77
  addQuad(texture: TextureAtlas, x: number, y: number, w: number, h: number, u0: number, v0: number, u1: number, v1: number, tint: number, reupload?: boolean): void;
61
78
  }
79
+ import { Vector2d } from "../../../math/vector2d.ts";
62
80
  import { MaterialBatcher } from "./material_batcher.js";
63
81
  import type { TextureAtlas } from "./../../texture/atlas.js";
64
82
  //# sourceMappingURL=quad_batcher.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"quad_batcher.d.ts","sourceRoot":"","sources":["../../../../src/video/webgl/batchers/quad_batcher.js"],"names":[],"mappings":"AAmBA;;;;GAIG;AACH;IACC;;;OAGG;IACH,0BAkEC;IAjEA;;;;OAIG;IACH,qCAA0D;IA4C1D;;;;;OAKG;IACH,qCAA2B;IAY5B;;;;;;;OAOG;IACH,kBAFW,QAAQ,GAAC,YAAY,QAK/B;IAgED;;;;;;;;;;OAUG;IACH,oBAPW,YAAY,KACZ,MAAM,KACN,MAAM,SACN,MAAM,UACN,MAAM,UACN,QAAQ,GAAC,YAAY,QA4B/B;IAED;;;;;;;;;;;;;OAaG;IACH,iBAZW,YAAY,KACZ,MAAM,KACN,MAAM,KACN,MAAM,KACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,QACN,MAAM,aACN,OAAO,QAqDjB;CACD;gCAjR+B,uBAAuB;kCAIxB,0BAA0B"}
1
+ {"version":3,"file":"quad_batcher.d.ts","sourceRoot":"","sources":["../../../../src/video/webgl/batchers/quad_batcher.js"],"names":[],"mappings":"AAMA;;;GAGG;AAMH,iCAKE;AAEF;;;;GAIG;AACH;IACC;;;OAGG;IACH,0BAwDC;IAvDA;;;;OAIG;IACH,qCAA0D;IAyC1D;;;;;OAKG;IACH,qCAA2B;IAK5B;;;;OAIG;IACH,0BAQC;IAED;;;;OAIG;IACH,0BAIC;IAED;;;;;;;OAOG;IACH,kBAFW,QAAQ,GAAC,YAAY,QAK/B;IAoDD;;;;;;;;;;OAUG;IACH,oBAPW,YAAY,KACZ,MAAM,KACN,MAAM,SACN,MAAM,UACN,MAAM,UACN,QAAQ,GAAC,YAAY,QAoD/B;IAED;;;;;;;;;;;;;OAaG;IACH,iBAZW,YAAY,KACZ,MAAM,KACN,MAAM,KACN,MAAM,KACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,QACN,MAAM,aACN,OAAO,QAqDjB;CACD;yBApTwB,2BAA2B;gCAIpB,uBAAuB;kCAIxB,0BAA0B"}
@@ -0,0 +1,105 @@
1
+ /**
2
+ * additional import for TypeScript
3
+ * @import { Color } from "../../../math/color.ts";
4
+ * @import { default as WebGLRenderer } from "../webgl_renderer.js";
5
+ */
6
+ /**
7
+ * A procedural radial-gradient shader effect: solid color at the center
8
+ * fading linearly to fully transparent at the edge of the host quad.
9
+ * The falloff is naturally elliptical for non-square quads.
10
+ *
11
+ * **UV-space caveat.** The `apply(color, uv)` function receives
12
+ * `vRegion` — the atlas UVs of the host quad. The falloff math
13
+ * (`length(uv * 2 - 1)`) assumes those UVs span `[0, 1] × [0, 1]`,
14
+ * which is true when the quad samples a full-rect texture (a
15
+ * dedicated 1×1 white pixel, a non-atlased Sprite, an FBO blit, or
16
+ * the engine-provided light atlas used by `WebGLRenderer.drawLight`).
17
+ * If you attach this effect to a Sprite that uses a *sub-region* of a
18
+ * larger atlas, `uv` will be in `[u0..u1] × [v0..v1]` and the radial
19
+ * center will be misplaced. For atlas-based renderables, set the
20
+ * effect's `uColor`/`uIntensity` and pair it with a Sprite whose
21
+ * texture covers a full atlas, or use a Sprite created from a
22
+ * standalone image.
23
+ *
24
+ * The falloff curve is **linear** (`f = clamp(1 - d, 0, 1)`) to match
25
+ * the Canvas 2D `createRadialGradient` two-stop output exactly. Output
26
+ * is premultiplied so the result composes correctly under additive
27
+ * (`"lighter"`) blending across overlapping quads.
28
+ *
29
+ * Color & intensity come from **two stacked sources**, multiplied
30
+ * together: the `uColor`/`uIntensity` uniforms (set per-effect via
31
+ * `setColor` / `setIntensity` — the natural API for a single-instance
32
+ * shader attached to a renderable) AND the per-vertex tint coming
33
+ * through `aColor` (used by `WebGLRenderer.drawLight` to encode each
34
+ * light's color + intensity in the vertex stream so multiple lights
35
+ * sharing this shader can batch into a single draw call). For typical
36
+ * standalone usage the per-vertex tint is `(1,1,1,1)` and the uniforms
37
+ * drive the look; for the Light2d batching path the uniforms stay at
38
+ * defaults and the tint carries everything.
39
+ * @category Effects
40
+ * @example
41
+ * // Soft white spot, 50% peak alpha at center
42
+ * const spot = new RadialGradientEffect(renderer, { intensity: 0.5 });
43
+ * @example
44
+ * // Tinted hotspot — orange center, full brightness, sized via the
45
+ * // host quad's bounds
46
+ * const hot = new RadialGradientEffect(renderer, {
47
+ * color: new Color(255, 128, 64),
48
+ * intensity: 1.0,
49
+ * });
50
+ * hot.setIntensity(2.0); // pulse brighter at runtime
51
+ * @example
52
+ * // Pickup highlight — attach to any Renderable so it renders inside
53
+ * // the renderable's bounding rect (anchorPoint applies). Combine with
54
+ * // `blendMode = "lighter"` for the additive glow look.
55
+ * pickup.shader = new RadialGradientEffect(renderer, {
56
+ * color: new Color(120, 255, 200), // mint green
57
+ * intensity: 0.8,
58
+ * });
59
+ * pickup.blendMode = "lighter";
60
+ * @example
61
+ * // Damage / impact indicator — short-lived elliptical flash on hit.
62
+ * // The quad's width/height drive the falloff aspect for free.
63
+ * const flash = new RadialGradientEffect(renderer, {
64
+ * color: new Color(255, 32, 32),
65
+ * intensity: 1.5,
66
+ * });
67
+ * // animate intensity to fade out
68
+ * tween.to({ intensity: 0 }, 200).onUpdate((s) => flash.setIntensity(s.intensity));
69
+ * @example
70
+ * // Debug overlay — draw a soft circle wherever the player is to mark
71
+ * // a trigger zone, without baking a texture per zone.
72
+ * const zoneMarker = new RadialGradientEffect(renderer, {
73
+ * color: new Color(80, 160, 255),
74
+ * intensity: 0.4,
75
+ * });
76
+ */
77
+ export default class RadialGradientEffect extends ShaderEffect {
78
+ /**
79
+ * @param {WebGLRenderer} renderer - the current renderer instance
80
+ * @param {object} [options] - initial uniform values
81
+ * @param {Color} [options.color] - center color (0..255 RGB); defaults to white
82
+ * @param {number} [options.intensity=1] - peak alpha at the center (0..1+)
83
+ */
84
+ constructor(renderer: WebGLRenderer, options?: {
85
+ color?: Color | undefined;
86
+ intensity?: number | undefined;
87
+ });
88
+ _colorBuf: Float32Array<ArrayBuffer>;
89
+ /**
90
+ * Set the center color. RGB only — alpha is ignored (the radial
91
+ * falloff supplies the per-pixel alpha).
92
+ * @param {Color} color - 0..255 RGB color
93
+ */
94
+ setColor(color: Color): void;
95
+ /**
96
+ * Set the peak intensity. Acts as a brightness multiplier on the
97
+ * falloff curve; values above 1 over-saturate the center of the gradient.
98
+ * @param {number} intensity - 0..1+ multiplier
99
+ */
100
+ setIntensity(intensity: number): void;
101
+ }
102
+ import ShaderEffect from "../shadereffect.js";
103
+ import type { Color } from "../../../math/color.ts";
104
+ import type { default as WebGLRenderer } from "../webgl_renderer.js";
105
+ //# sourceMappingURL=radialGradient.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"radialGradient.d.ts","sourceRoot":"","sources":["../../../../src/video/webgl/effects/radialGradient.js"],"names":[],"mappings":"AAEA;;;;GAIG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsEG;AACH;IACC;;;;;OAKG;IACH,sBALW,aAAa,YAErB;QAAwB,KAAK;QACJ,SAAS;KACpC,EA0CA;IAZA,qCAAoC;IAcrC;;;;OAIG;IACH,gBAFW,KAAK,QAOf;IAED;;;;OAIG;IACH,wBAFW,MAAM,QAIhB;CACD;yBArJwB,oBAAoB;2BAInB,wBAAwB;8CACL,sBAAsB"}
@@ -1 +1 @@
1
- {"version":3,"file":"glshader.d.ts","sourceRoot":"","sources":["../../../src/video/webgl/glshader.js"],"names":[],"mappings":"AAOA;;;GAGG;AACH;IACC;;;;;;;;;;;;;;;;;;;;;;;;;;OA0BG;IACH,gBA1BW,qBAAqB,UACrB,MAAM,YACN,MAAM,cACN,MAAM,EAyEhB;IAjDA;;;OAGG;IACH,IAFU,qBAAqB,CAEnB;IAEZ;;;OAGG;IACH,QAFU,MAAM,CAKf;IAED;;;OAGG;IACH,UAFU,MAAM,CAKf;IAED;;;OAGG;IACH,YAFU,KAAK,EAAE,CAEiC;IAElD;;;OAGG;IACH,SAFU,YAAY,CAOrB;IAED;;;OAGG;IACH,UAFU,MAAM,CAE8B;IAM/C;;OAEG;IACH,aAEC;IAED;;;;OAIG;IACH,wBAHW,MAAM,GACJ,KAAK,CASjB;IAED;;;;;;OAMG;IACH,iBALW,MAAM,SACN,MAAM,GAAC,YAAY,QAiB7B;IAED;;;;;OAKG;IACH,wBAJW,qBAAqB,cACrB,MAAM,EAAE,UACR,MAAM,QAsBhB;IAED;;OAEG;IACH,gBAQC;CACD"}
1
+ {"version":3,"file":"glshader.d.ts","sourceRoot":"","sources":["../../../src/video/webgl/glshader.js"],"names":[],"mappings":"AAOA;;;GAGG;AACH;IACC;;;;;;;;;;;;;;;;;;;;;;;;;;OA0BG;IACH,gBA1BW,qBAAqB,UACrB,MAAM,YACN,MAAM,cACN,MAAM,EAyEhB;IAjDA;;;OAGG;IACH,IAFU,qBAAqB,CAEnB;IAEZ;;;OAGG;IACH,QAFU,MAAM,CAKf;IAED;;;OAGG;IACH,UAFU,MAAM,CAKf;IAED;;;OAGG;IACH,YAFU,KAAK,EAAE,CAEiC;IAElD;;;OAGG;IACH,SAFU,YAAY,CAOrB;IAED;;;OAGG;IACH,UAFU,MAAM,CAE8B;IAM/C;;OAEG;IACH,aAEC;IAED;;;;OAIG;IACH,wBAHW,MAAM,GACJ,KAAK,CASjB;IAED;;;;;;OAMG;IACH,iBALW,MAAM,SACN,MAAM,GAAC,YAAY,QAiB7B;IAED;;;;;OAKG;IACH,wBAJW,qBAAqB,cACrB,MAAM,EAAE,UACR,MAAM,QAmBhB;IAED;;OAEG;IACH,gBAQC;CACD"}
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Constants shared between the lit fragment shader (`multitexture-lit.js`),
3
+ * the lit batcher (`LitQuadBatcher`), and the uniform packer (`pack.ts`).
4
+ * Kept in a tiny standalone module so the three consumers don't depend on
5
+ * each other transitively for a single integer.
6
+ */
7
+ /**
8
+ * Maximum number of `Light2d` instances the lit fragment shader supports
9
+ * concurrently per draw call. Lights past this index are ignored. Sized
10
+ * to keep the GLSL uniform arrays comfortably within WebGL1 limits.
11
+ */
12
+ export declare const MAX_LIGHTS = 8;
13
+ //# sourceMappingURL=constants.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../src/video/webgl/lighting/constants.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;;;GAIG;AACH,eAAO,MAAM,UAAU,IAAI,CAAC"}
@@ -0,0 +1,76 @@
1
+ /**
2
+ * Per-frame scratch buffer for `packLights()`. Pre-allocates one entry
3
+ * per light slot so the per-camera-per-frame upload doesn't allocate.
4
+ */
5
+ export interface LightUniformScratch {
6
+ positions: Float32Array;
7
+ colors: Float32Array;
8
+ heights: Float32Array;
9
+ ambient: number[];
10
+ }
11
+ /**
12
+ * Result of `packLights()` — typed-array views into the scratch plus the
13
+ * actual count. `WebGLRenderer.setLightUniforms` forwards this to
14
+ * `LitQuadBatcher.setLightUniforms` for upload.
15
+ */
16
+ export interface LightUniforms extends LightUniformScratch {
17
+ count: number;
18
+ }
19
+ /**
20
+ * Allocate a fresh scratch buffer sized for `MAX_LIGHTS` slots. One per
21
+ * renderer is enough; reuse across frames.
22
+ */
23
+ export declare function createLightUniformScratch(): LightUniformScratch;
24
+ /**
25
+ * Light2d-shaped duck-type — anything `packLights()` reads from. Avoids
26
+ * importing `Light2d` directly (keeps this module renderer-agnostic).
27
+ */
28
+ interface LightLike {
29
+ getBounds(): {
30
+ centerX: number;
31
+ centerY: number;
32
+ width: number;
33
+ height: number;
34
+ };
35
+ intensity: number;
36
+ color: {
37
+ r: number;
38
+ g: number;
39
+ b: number;
40
+ };
41
+ lightHeight: number;
42
+ }
43
+ /** Color-shaped duck-type for the ambient floor. */
44
+ interface ColorLike {
45
+ r: number;
46
+ g: number;
47
+ b: number;
48
+ }
49
+ /**
50
+ * Pack the active scene lights into the scratch buffer in a shape the
51
+ * lit fragment shader uploads directly.
52
+ *
53
+ * Light positions are translated from world-space (where
54
+ * `light.getBounds().centerX/Y` lives) into the renderer's
55
+ * pre-projection coords by subtracting `(translateX, translateY)` —
56
+ * the same translate `Camera2d.draw()` applies to the world container.
57
+ * This matches what `Stage.drawLighting` does for the cutout pass, so
58
+ * the lit fragment's `lightPos - vWorldPos` math lines up with the
59
+ * camera's view.
60
+ *
61
+ * Lights past `MAX_LIGHTS` (8) are silently dropped. Unused slots are
62
+ * zero-filled so stale data from a previous frame can't leak into the
63
+ * shader.
64
+ *
65
+ * Pure function: deterministic given the same inputs, no I/O, scratch
66
+ * is the only mutable target.
67
+ * @param lights - active lights iterable (e.g. `Stage._activeLights`); falsy treated as empty
68
+ * @param ambient - ambient floor color (0..255 RGB); falsy treated as black
69
+ * @param translateX - world-to-screen X translate (matches `Camera2d.draw()`)
70
+ * @param translateY - world-to-screen Y translate
71
+ * @param scratch - pre-allocated scratch (see `createLightUniformScratch`)
72
+ * @returns the scratch with `count` filled in
73
+ */
74
+ export declare function packLights(lights: Iterable<LightLike> | null | undefined, ambient: ColorLike | null | undefined, translateX: number, translateY: number, scratch: LightUniformScratch): LightUniforms;
75
+ export {};
76
+ //# sourceMappingURL=pack.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pack.d.ts","sourceRoot":"","sources":["../../../../src/video/webgl/lighting/pack.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,MAAM,WAAW,mBAAmB;IACnC,SAAS,EAAE,YAAY,CAAC;IACxB,MAAM,EAAE,YAAY,CAAC;IACrB,OAAO,EAAE,YAAY,CAAC;IACtB,OAAO,EAAE,MAAM,EAAE,CAAC;CAClB;AAED;;;;GAIG;AACH,MAAM,WAAW,aAAc,SAAQ,mBAAmB;IACzD,KAAK,EAAE,MAAM,CAAC;CACd;AAED;;;GAGG;AACH,wBAAgB,yBAAyB,IAAI,mBAAmB,CAO/D;AAED;;;GAGG;AACH,UAAU,SAAS;IAClB,SAAS,IAAI;QACZ,OAAO,EAAE,MAAM,CAAC;QAChB,OAAO,EAAE,MAAM,CAAC;QAChB,KAAK,EAAE,MAAM,CAAC;QACd,MAAM,EAAE,MAAM,CAAC;KACf,CAAC;IACF,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IAC3C,WAAW,EAAE,MAAM,CAAC;CACpB;AAED,oDAAoD;AACpD,UAAU,SAAS;IAClB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACV;AAED;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAgB,UAAU,CACzB,MAAM,EAAE,QAAQ,CAAC,SAAS,CAAC,GAAG,IAAI,GAAG,SAAS,EAC9C,OAAO,EAAE,SAAS,GAAG,IAAI,GAAG,SAAS,EACrC,UAAU,EAAE,MAAM,EAClB,UAAU,EAAE,MAAM,EAClB,OAAO,EAAE,mBAAmB,GAC1B,aAAa,CA4Cf"}
@@ -0,0 +1,108 @@
1
+ /**
2
+ * GPU-accelerated renderer for orthogonal TMX tile layers (WebGL2). Draws
3
+ * the visible region of a layer as one screen-aligned quad per tileset
4
+ * referenced by the layer — the fragment shader samples a per-layer GID
5
+ * index texture and the tileset atlas, eliminating the per-tile draw
6
+ * loop. The visible rect, GID range, tile size, opacity, and tint are
7
+ * pushed as uniforms; the index texture is uploaded once at activation
8
+ * and re-uploaded only when `layer.dataVersion` changes (mutations from
9
+ * `setTile`/`clearTile`).
10
+ *
11
+ * The per-layer index texture is a `BufferTextureResource` flowing
12
+ * through the standard `TextureCache` / batcher path — same lane as
13
+ * every other texture in the engine. Dynamic unit allocation, correct
14
+ * `boundTextures` bookkeeping, and per-resource premultiplied-alpha /
15
+ * filter all come for free; nothing here pokes `gl.bindTexture` or
16
+ * `gl.activeTexture` directly.
17
+ *
18
+ * Cache lifecycle: one `BufferTextureResource` per `TMXLayer`. Tile
19
+ * layers don't come and go individually — they only churn on game reset
20
+ * — so the cache is freed in bulk via `reset()`, called from
21
+ * `WebGLRenderer.reset()` (which the `GAME_RESET` event already
22
+ * triggers).
23
+ *
24
+ * @ignore
25
+ */
26
+ export default class OrthogonalTMXLayerGPURenderer {
27
+ /**
28
+ * @param {WebGLRenderer} renderer - the WebGL renderer instance
29
+ */
30
+ constructor(renderer: WebGLRenderer);
31
+ renderer: WebGLRenderer;
32
+ gl: WebGLRenderingContext;
33
+ shader: GLShader;
34
+ resources: Map<any, any>;
35
+ animLookups: Map<any, any>;
36
+ _v2: Float32Array<ArrayBuffer>;
37
+ _v4: Float32Array<ArrayBuffer>;
38
+ /**
39
+ * Free every cached per-layer index texture and empty the local
40
+ * resource map. Called from `WebGLRenderer.reset()` (which
41
+ * `GAME_RESET` triggers) so each level transition starts clean.
42
+ * @ignore
43
+ */
44
+ reset(): void;
45
+ /**
46
+ * Write a `vec2` uniform without allocating a fresh Float32Array per
47
+ * call. Both components flow into the shared `_v2` scratch buffer,
48
+ * which `setUniform` reads synchronously and forwards to
49
+ * `gl.uniform2fv` — so reusing the buffer across calls is safe.
50
+ * @param {string} name
51
+ * @param {number} x
52
+ * @param {number} y
53
+ * @private
54
+ */
55
+ private _setV2;
56
+ /**
57
+ * `vec4` counterpart to {@link _setV2}.
58
+ * @param {string} name
59
+ * @param {number} x
60
+ * @param {number} y
61
+ * @param {number} z
62
+ * @param {number} w
63
+ * @private
64
+ */
65
+ private _setV4;
66
+ /**
67
+ * Get-or-create the per-tileset animation-lookup entry. Returns
68
+ * `undefined` for tilesets that have no animated tiles (the shader's
69
+ * `uAnimEnabled` uniform is then set to 0 and the lookup texture is
70
+ * not bound).
71
+ *
72
+ * The entry holds a `tileCount × 1` RGBA8 `BufferTextureResource`
73
+ * where texel `localId` encodes the CURRENT frame's local id as
74
+ * `R = lo byte, G = hi byte` (same encoding as the GID index
75
+ * texture). Each call walks `tileset.animations` and rewrites
76
+ * dirty texels — `tileset.update(dt)` (driven by the layer) advances
77
+ * `anim.cur.tileid` independently of this renderer.
78
+ *
79
+ * @param {object} tileset
80
+ * @param {number} tileCount - tiles in the tileset's atlas grid
81
+ * (`atlasCols * atlasRows`)
82
+ * @returns {{resource: BufferTextureResource, data: Uint8Array,
83
+ * tileCount: number, dirty: boolean}|undefined}
84
+ */
85
+ _getOrUpdateAnimLookup(tileset: object, tileCount: number): {
86
+ resource: BufferTextureResource;
87
+ data: Uint8Array;
88
+ tileCount: number;
89
+ dirty: boolean;
90
+ } | undefined;
91
+ /**
92
+ * Get-or-create the per-layer index `BufferTextureResource`.
93
+ * @param {TMXLayer} layer
94
+ * @returns {BufferTextureResource}
95
+ */
96
+ _getResource(layer: TMXLayer): BufferTextureResource;
97
+ /**
98
+ * Draw an orthogonal TMX layer through the shader path.
99
+ * @param {TMXLayer} layer
100
+ * @param {object} rect - the visible viewport rect (world coords)
101
+ */
102
+ draw(layer: TMXLayer, rect: object): void;
103
+ }
104
+ import type { default as WebGLRenderer } from "../../webgl_renderer.js";
105
+ import GLShader from "../../glshader.js";
106
+ import { BufferTextureResource } from "../../../texture/resource.js";
107
+ import type { default as TMXLayer } from "../../../../level/tiled/TMXLayer.js";
108
+ //# sourceMappingURL=orthogonal.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"orthogonal.d.ts","sourceRoot":"","sources":["../../../../../src/video/webgl/renderers/tmxlayer/orthogonal.js"],"names":[],"mappings":"AAeA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH;IACC;;OAEG;IACH,sBAFW,aAAa,EAkCvB;IA/BA,wBAAwB;IACxB,0BAAqB;IAUrB,iBAKC;IAMD,yBAA0B;IAI1B,2BAA4B;IAG5B,+BAA8B;IAC9B,+BAA8B;IAG/B;;;;;OAKG;IACH,cAyBC;IAED;;;;;;;;;OASG;IACH,eAIC;IAED;;;;;;;;OAQG;IACH,eAMC;IAED;;;;;;;;;;;;;;;;;;OAkBG;IACH,gCANW,MAAM,aACN,MAAM,GAEJ;QAAC,QAAQ,EAAE,qBAAqB,CAAC;QAAC,IAAI,EAAE,UAAU,CAAC;QAC3D,SAAS,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,OAAO,CAAA;KAAC,GAAC,SAAS,CA+ChD;IAED;;;;OAIG;IACH,oBAHW,QAAQ,GACN,qBAAqB,CA6BjC;IAED;;;;OAIG;IACH,YAHW,QAAQ,QACR,MAAM,QA0JhB;CACD;8CA1Y4C,yBAAyB;qBAPjD,mBAAmB;sCADF,8BAA8B;yCAO5B,qCAAqC"}
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Generate the fragment shader for `LitQuadBatcher` — the SpriteIlluminator
3
+ * path that supports per-pixel normal-map lighting from up to `MAX_LIGHTS`
4
+ * point lights.
5
+ *
6
+ * Sprites without a `normalMap` push `aNormalTextureId = -1` and take the
7
+ * unlit fast path inside this same shader (sample color, multiply by
8
+ * vertex color, return) so lit and unlit sprites can share the lit batch
9
+ * when they coexist with active lights. The cost vs the truly-unlit
10
+ * `QuadBatcher` shader is one varying read + one comparison per fragment.
11
+ *
12
+ * The light's "height above the sprite plane" is encoded as a small
13
+ * fraction of the light's radius (default `0.075`) so that lights
14
+ * exactly at a fragment's screen position don't produce degenerate
15
+ * flat shading.
16
+ * @param {number} maxTextures - the number of color/normal texture units to support
17
+ * @returns {string} GLSL fragment shader source
18
+ * @ignore
19
+ */
20
+ export function buildLitMultiTextureFragment(maxTextures: number): string;
21
+ export { MAX_LIGHTS };
22
+ import { MAX_LIGHTS } from "../lighting/constants.ts";
23
+ //# sourceMappingURL=multitexture-lit.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"multitexture-lit.d.ts","sourceRoot":"","sources":["../../../../src/video/webgl/shaders/multitexture-lit.js"],"names":[],"mappings":"AAgCA;;;;;;;;;;;;;;;;;;GAkBG;AACH,0DAJW,MAAM,GACJ,MAAM,CAiFlB;;2BAjI0B,0BAA0B"}
@@ -1,4 +1,11 @@
1
1
  /**
2
+ * Pick out every vertex attribute name from a shader source, regardless of
3
+ * GLSL version. GLSL 1.00 marks attributes with the `attribute` storage
4
+ * qualifier; GLSL ES 3.00 reuses `in` at file scope for the same purpose
5
+ * (and `in` inside function parameter lists, which we exclude by requiring
6
+ * the qualifier to start at the beginning of a line). Skipping the 3.00
7
+ * form leaves the shader with no bound vertex data and the rasterizer
8
+ * silently degenerates every triangle.
2
9
  * @ignore
3
10
  */
4
11
  export function extractAttributes(gl: any, shader: any): {};
@@ -1 +1 @@
1
- {"version":3,"file":"attributes.d.ts","sourceRoot":"","sources":["../../../../src/video/webgl/utils/attributes.js"],"names":[],"mappings":"AAAA;;GAEG;AACH,4DAYC"}
1
+ {"version":3,"file":"attributes.d.ts","sourceRoot":"","sources":["../../../../src/video/webgl/utils/attributes.js"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,4DAmBC"}
@@ -1,5 +1,5 @@
1
1
  /**
2
- * set precision for the fiven shader source
2
+ * set precision for the given shader source
3
3
  * won't do anything if the precision is already specified
4
4
  * @ignore
5
5
  */
@@ -1 +1 @@
1
- {"version":3,"file":"precision.d.ts","sourceRoot":"","sources":["../../../../src/video/webgl/utils/precision.js"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,4DAKC;AAED;;;;;;GAMG;AACH,0CAJW,qBAAqB,kBACrB,OAAO,GACL,MAAM,CAoBlB"}
1
+ {"version":3,"file":"precision.d.ts","sourceRoot":"","sources":["../../../../src/video/webgl/utils/precision.js"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,4DA+BC;AAED;;;;;;GAMG;AACH,0CAJW,qBAAqB,kBACrB,OAAO,GACL,MAAM,CAoBlB"}
@@ -1,4 +1,17 @@
1
1
  /**
2
+ * Build the `uniforms` proxy object for a compiled shader program.
3
+ *
4
+ * Each detected uniform gets a defineProperty getter (returns its
5
+ * `WebGLUniformLocation`) and a setter that pushes the value to GL. The
6
+ * setter caches the last value it sent and skips the underlying
7
+ * `gl.uniform*` call when the incoming value matches — uniform writes are
8
+ * cheap individually, but a typical per-frame draw pass sets a dozen of
9
+ * them per shader, and most are layer-lifetime constants (`uMapSize`,
10
+ * `uCellSize`, `uOpacity`, projection matrix on idle frames, etc.).
11
+ *
12
+ * Cache scope is per-shader: each `GLShader` calls `extractUniforms` once
13
+ * and gets its own closure-captured `cache` map, so caches don't leak
14
+ * across programs.
2
15
  * @ignore
3
16
  */
4
17
  export function extractUniforms(gl: any, shader: any): {};
@@ -1 +1 @@
1
- {"version":3,"file":"uniforms.d.ts","sourceRoot":"","sources":["../../../../src/video/webgl/utils/uniforms.js"],"names":[],"mappings":"AAuBA;;GAEG;AACH,0DAuDC"}
1
+ {"version":3,"file":"uniforms.d.ts","sourceRoot":"","sources":["../../../../src/video/webgl/utils/uniforms.js"],"names":[],"mappings":"AA0FA;;;;;;;;;;;;;;;GAeG;AACH,0DAmEC"}