melonjs 20.7.0 → 20.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.
Files changed (243) hide show
  1. package/README.md +6 -3
  2. package/build/application/defaultApplicationSettings.d.ts +5 -0
  3. package/build/application/defaultApplicationSettings.d.ts.map +1 -1
  4. package/build/application/header.d.ts.map +1 -1
  5. package/build/application/settings.d.ts +88 -0
  6. package/build/application/settings.d.ts.map +1 -1
  7. package/build/audio/backend/engine.d.ts +0 -1
  8. package/build/audio/backend/sound.d.ts +0 -1
  9. package/build/camera/camera2d.d.ts.map +1 -1
  10. package/build/camera/camera3d.d.ts +95 -8
  11. package/build/camera/camera3d.d.ts.map +1 -1
  12. package/build/geometries/box3d.d.ts +24 -6
  13. package/build/geometries/box3d.d.ts.map +1 -1
  14. package/build/geometries/ellipse.d.ts +14 -0
  15. package/build/geometries/ellipse.d.ts.map +1 -1
  16. package/build/geometries/polygon.d.ts +14 -0
  17. package/build/geometries/polygon.d.ts.map +1 -1
  18. package/build/geometries/sphere.d.ts +35 -6
  19. package/build/geometries/sphere.d.ts.map +1 -1
  20. package/build/index.d.ts +9 -2
  21. package/build/index.d.ts.map +1 -1
  22. package/build/index.js +2770 -538
  23. package/build/index.js.map +4 -4
  24. package/build/input/pointerevent.d.ts +8 -0
  25. package/build/input/pointerevent.d.ts.map +1 -1
  26. package/build/level/gltf/GLTFModel.d.ts +17 -31
  27. package/build/level/gltf/GLTFModel.d.ts.map +1 -1
  28. package/build/level/gltf/GLTFScene.d.ts +40 -1
  29. package/build/level/gltf/GLTFScene.d.ts.map +1 -1
  30. package/build/level/level.d.ts +35 -0
  31. package/build/level/level.d.ts.map +1 -1
  32. package/build/level/tiled/TMXLayer.d.ts +5 -2
  33. package/build/level/tiled/TMXLayer.d.ts.map +1 -1
  34. package/build/level/tiled/TMXObject.d.ts +0 -1
  35. package/build/level/tiled/TMXTile.d.ts +2 -1
  36. package/build/level/tiled/TMXTile.d.ts.map +1 -1
  37. package/build/level/tiled/TMXTileMap.d.ts +7 -4
  38. package/build/level/tiled/TMXTileMap.d.ts.map +1 -1
  39. package/build/level/tiled/TMXTileset.d.ts +1 -1
  40. package/build/level/tiled/TMXTileset.d.ts.map +1 -1
  41. package/build/level/tiled/TMXTilesetGroup.d.ts +5 -0
  42. package/build/level/tiled/TMXTilesetGroup.d.ts.map +1 -1
  43. package/build/level/tiled/factories/shape.d.ts +0 -1
  44. package/build/level/tiled/renderer/TMXHexagonalRenderer.d.ts +6 -5
  45. package/build/level/tiled/renderer/TMXHexagonalRenderer.d.ts.map +1 -1
  46. package/build/level/tiled/renderer/TMXIsometricRenderer.d.ts +5 -0
  47. package/build/level/tiled/renderer/TMXIsometricRenderer.d.ts.map +1 -1
  48. package/build/level/tiled/renderer/TMXObliqueRenderer.d.ts +8 -7
  49. package/build/level/tiled/renderer/TMXObliqueRenderer.d.ts.map +1 -1
  50. package/build/level/tiled/renderer/TMXOrthogonalRenderer.d.ts +5 -0
  51. package/build/level/tiled/renderer/TMXOrthogonalRenderer.d.ts.map +1 -1
  52. package/build/level/tiled/renderer/TMXRenderer.d.ts +19 -4
  53. package/build/level/tiled/renderer/TMXRenderer.d.ts.map +1 -1
  54. package/build/level/tiled/renderer/autodetect.d.ts +0 -4
  55. package/build/level/tiled/renderer/autodetect.d.ts.map +1 -1
  56. package/build/loader/loader.d.ts +9 -0
  57. package/build/loader/loader.d.ts.map +1 -1
  58. package/build/loader/loadingscreen.d.ts +1 -2
  59. package/build/loader/loadingscreen.d.ts.map +1 -1
  60. package/build/loader/parsers/shader.d.ts +0 -2
  61. package/build/math/color.d.ts +27 -4
  62. package/build/math/color.d.ts.map +1 -1
  63. package/build/particles/emitter.d.ts.map +1 -1
  64. package/build/particles/particle.d.ts +22 -1
  65. package/build/particles/particle.d.ts.map +1 -1
  66. package/build/particles/settings.d.ts +69 -0
  67. package/build/particles/settings.d.ts.map +1 -1
  68. package/build/physics/adapter.d.ts +9 -1
  69. package/build/physics/adapter.d.ts.map +1 -1
  70. package/build/physics/builtin/body.d.ts +3 -2
  71. package/build/physics/builtin/body.d.ts.map +1 -1
  72. package/build/physics/builtin/builtin-adapter.d.ts.map +1 -1
  73. package/build/physics/builtin/detector.d.ts +0 -1
  74. package/build/physics/builtin/detector.d.ts.map +1 -1
  75. package/build/physics/builtin/sat.d.ts +0 -7
  76. package/build/physics/builtin/sat3d.d.ts +46 -0
  77. package/build/physics/builtin/sat3d.d.ts.map +1 -1
  78. package/build/physics/response.d.ts +45 -62
  79. package/build/physics/response.d.ts.map +1 -1
  80. package/build/renderable/collectable.d.ts +6 -1
  81. package/build/renderable/collectable.d.ts.map +1 -1
  82. package/build/renderable/colorlayer.d.ts +4 -4
  83. package/build/renderable/colorlayer.d.ts.map +1 -1
  84. package/build/renderable/container.d.ts +23 -17
  85. package/build/renderable/container.d.ts.map +1 -1
  86. package/build/renderable/entity/entity.d.ts +12 -16
  87. package/build/renderable/entity/entity.d.ts.map +1 -1
  88. package/build/renderable/frameAnimation.d.ts +1 -1
  89. package/build/renderable/groundshadow.d.ts +1 -0
  90. package/build/renderable/groundshadow.d.ts.map +1 -1
  91. package/build/renderable/imagelayer.d.ts +12 -5
  92. package/build/renderable/imagelayer.d.ts.map +1 -1
  93. package/build/renderable/instanced_mesh.d.ts +2 -9
  94. package/build/renderable/instanced_mesh.d.ts.map +1 -1
  95. package/build/renderable/mesh.d.ts +283 -4
  96. package/build/renderable/mesh.d.ts.map +1 -1
  97. package/build/renderable/nineslicesprite.d.ts +3 -13
  98. package/build/renderable/nineslicesprite.d.ts.map +1 -1
  99. package/build/renderable/renderable.d.ts +90 -27
  100. package/build/renderable/renderable.d.ts.map +1 -1
  101. package/build/renderable/sprite.d.ts +5 -19
  102. package/build/renderable/sprite.d.ts.map +1 -1
  103. package/build/renderable/sprite3d.d.ts +27 -16
  104. package/build/renderable/sprite3d.d.ts.map +1 -1
  105. package/build/renderable/text/bitmaptext.d.ts +13 -3
  106. package/build/renderable/text/bitmaptext.d.ts.map +1 -1
  107. package/build/renderable/text/bitmaptextdata.d.ts +0 -4
  108. package/build/renderable/text/bitmaptextdata.d.ts.map +1 -1
  109. package/build/renderable/text/text.d.ts +5 -3
  110. package/build/renderable/text/text.d.ts.map +1 -1
  111. package/build/renderable/text/textmetrics.d.ts +2 -0
  112. package/build/renderable/text/textmetrics.d.ts.map +1 -1
  113. package/build/renderable/trail.d.ts +0 -1
  114. package/build/renderable/trail.d.ts.map +1 -1
  115. package/build/renderable/trigger.d.ts +27 -5
  116. package/build/renderable/trigger.d.ts.map +1 -1
  117. package/build/renderable/ui/progressbar.d.ts +194 -0
  118. package/build/renderable/ui/progressbar.d.ts.map +1 -0
  119. package/build/renderable/ui/uibaseelement.d.ts +48 -3
  120. package/build/renderable/ui/uibaseelement.d.ts.map +1 -1
  121. package/build/renderable/ui/uispriteelement.d.ts +19 -3
  122. package/build/renderable/ui/uispriteelement.d.ts.map +1 -1
  123. package/build/system/legacy_pool.d.ts +2 -2
  124. package/build/system/legacy_pool.d.ts.map +1 -1
  125. package/build/system/pool.d.ts +10 -0
  126. package/build/system/pool.d.ts.map +1 -1
  127. package/build/tweens/tween.d.ts +49 -2
  128. package/build/tweens/tween.d.ts.map +1 -1
  129. package/build/video/canvas/canvas_renderer.d.ts +34 -23
  130. package/build/video/canvas/canvas_renderer.d.ts.map +1 -1
  131. package/build/video/effects/blendEffect.d.ts +0 -1
  132. package/build/video/effects/bloom.d.ts +72 -0
  133. package/build/video/effects/bloom.d.ts.map +1 -0
  134. package/build/video/effects/blur.d.ts +3 -2
  135. package/build/video/effects/blur.d.ts.map +1 -1
  136. package/build/video/effects/chromaticAberration.d.ts +3 -2
  137. package/build/video/effects/chromaticAberration.d.ts.map +1 -1
  138. package/build/video/effects/colorMatrix.d.ts +3 -2
  139. package/build/video/effects/colorMatrix.d.ts.map +1 -1
  140. package/build/video/effects/desaturate.d.ts +10 -2
  141. package/build/video/effects/desaturate.d.ts.map +1 -1
  142. package/build/video/effects/dissolve.d.ts +3 -2
  143. package/build/video/effects/dissolve.d.ts.map +1 -1
  144. package/build/video/effects/dropShadow.d.ts +3 -2
  145. package/build/video/effects/dropShadow.d.ts.map +1 -1
  146. package/build/video/effects/flash.d.ts +3 -2
  147. package/build/video/effects/flash.d.ts.map +1 -1
  148. package/build/video/effects/glow.d.ts +3 -2
  149. package/build/video/effects/glow.d.ts.map +1 -1
  150. package/build/video/effects/hologram.d.ts +3 -2
  151. package/build/video/effects/hologram.d.ts.map +1 -1
  152. package/build/video/effects/invert.d.ts +10 -2
  153. package/build/video/effects/invert.d.ts.map +1 -1
  154. package/build/video/effects/outline.d.ts +3 -2
  155. package/build/video/effects/outline.d.ts.map +1 -1
  156. package/build/video/effects/pixelate.d.ts +3 -2
  157. package/build/video/effects/pixelate.d.ts.map +1 -1
  158. package/build/video/effects/radialGradient.d.ts +8 -3
  159. package/build/video/effects/radialGradient.d.ts.map +1 -1
  160. package/build/video/effects/scanline.d.ts +3 -2
  161. package/build/video/effects/scanline.d.ts.map +1 -1
  162. package/build/video/effects/sepia.d.ts +10 -2
  163. package/build/video/effects/sepia.d.ts.map +1 -1
  164. package/build/video/effects/shadereffect.d.ts +10 -4
  165. package/build/video/effects/shadereffect.d.ts.map +1 -1
  166. package/build/video/effects/shine.d.ts +3 -2
  167. package/build/video/effects/shine.d.ts.map +1 -1
  168. package/build/video/effects/tintPulse.d.ts +3 -2
  169. package/build/video/effects/tintPulse.d.ts.map +1 -1
  170. package/build/video/effects/tonemap.d.ts +121 -0
  171. package/build/video/effects/tonemap.d.ts.map +1 -0
  172. package/build/video/effects/vignette.d.ts +3 -2
  173. package/build/video/effects/vignette.d.ts.map +1 -1
  174. package/build/video/effects/wave.d.ts +3 -2
  175. package/build/video/effects/wave.d.ts.map +1 -1
  176. package/build/video/gpu/vertexformat.d.ts +26 -0
  177. package/build/video/gpu/vertexformat.d.ts.map +1 -1
  178. package/build/video/gradient.d.ts +0 -1
  179. package/build/video/gradient.d.ts.map +1 -1
  180. package/build/video/renderer.d.ts +111 -7
  181. package/build/video/renderer.d.ts.map +1 -1
  182. package/build/video/renderstate.d.ts +2 -0
  183. package/build/video/renderstate.d.ts.map +1 -1
  184. package/build/video/rendertarget/canvasrendertarget.d.ts +3 -4
  185. package/build/video/rendertarget/canvasrendertarget.d.ts.map +1 -1
  186. package/build/video/rendertarget/render_target_pool.d.ts +0 -1
  187. package/build/video/rendertarget/webglrendertarget.d.ts +0 -1
  188. package/build/video/rendertarget/webglrendertarget.d.ts.map +1 -1
  189. package/build/video/rendertarget/webgpurendertarget.d.ts +18 -2
  190. package/build/video/rendertarget/webgpurendertarget.d.ts.map +1 -1
  191. package/build/video/texture/atlas.d.ts +1 -0
  192. package/build/video/texture/atlas.d.ts.map +1 -1
  193. package/build/video/texture/cache.d.ts +1 -3
  194. package/build/video/texture/frametexture.d.ts +0 -1
  195. package/build/video/texture/frametexture.d.ts.map +1 -1
  196. package/build/video/texture/noise_texture2d.d.ts +1 -0
  197. package/build/video/texture/noise_texture2d.d.ts.map +1 -1
  198. package/build/video/utils/autodetect.d.ts +0 -2
  199. package/build/video/webgl/batchers/batcher.d.ts +0 -9
  200. package/build/video/webgl/batchers/batcher.d.ts.map +1 -1
  201. package/build/video/webgl/batchers/lit_quad_batcher.d.ts +11 -0
  202. package/build/video/webgl/batchers/lit_quad_batcher.d.ts.map +1 -1
  203. package/build/video/webgl/batchers/material_batcher.d.ts +4 -2
  204. package/build/video/webgl/batchers/material_batcher.d.ts.map +1 -1
  205. package/build/video/webgl/batchers/mesh_batcher.d.ts +0 -3
  206. package/build/video/webgl/batchers/mesh_batcher.d.ts.map +1 -1
  207. package/build/video/webgl/batchers/quad_batcher.d.ts +4 -0
  208. package/build/video/webgl/batchers/quad_batcher.d.ts.map +1 -1
  209. package/build/video/webgl/buffer/index.d.ts +0 -1
  210. package/build/video/webgl/buffer/retained_geometry.d.ts +0 -1
  211. package/build/video/webgl/glshader.d.ts +5 -3
  212. package/build/video/webgl/glshader.d.ts.map +1 -1
  213. package/build/video/webgl/renderers/tmxlayer/orthogonal.d.ts +0 -4
  214. package/build/video/webgl/texture/store.d.ts +0 -1
  215. package/build/video/webgl/webgl_renderer.d.ts +63 -24
  216. package/build/video/webgl/webgl_renderer.d.ts.map +1 -1
  217. package/build/video/webgpu/batchers/mesh_batcher.d.ts +0 -3
  218. package/build/video/webgpu/batchers/mesh_batcher.d.ts.map +1 -1
  219. package/build/video/webgpu/batchers/quad_batcher.d.ts +0 -2
  220. package/build/video/webgpu/batchers/quad_batcher.d.ts.map +1 -1
  221. package/build/video/webgpu/batchers/webgpu_batcher.d.ts +0 -2
  222. package/build/video/webgpu/batchers/webgpu_batcher.d.ts.map +1 -1
  223. package/build/video/webgpu/pipeline/cache.d.ts.map +1 -1
  224. package/build/video/webgpu/renderers/tmxlayer/orthogonal.d.ts +0 -2
  225. package/build/video/webgpu/texture/frametexture.d.ts +0 -2
  226. package/build/video/webgpu/texture/frametexture.d.ts.map +1 -1
  227. package/build/video/webgpu/texture/store.d.ts +0 -1
  228. package/build/video/webgpu/webgpu_renderer.d.ts +7 -75
  229. package/build/video/webgpu/webgpu_renderer.d.ts.map +1 -1
  230. package/package.json +1 -1
  231. package/skills/melonjs-3d/SKILL.md +277 -19
  232. package/skills/melonjs-3d-assets/SKILL.md +76 -9
  233. package/skills/melonjs-camera-and-drawing/SKILL.md +57 -1
  234. package/skills/melonjs-effects-and-shaders/SKILL.md +341 -29
  235. package/skills/melonjs-input/SKILL.md +48 -4
  236. package/skills/melonjs-particles-and-trails/SKILL.md +106 -4
  237. package/skills/melonjs-performance/SKILL.md +79 -2
  238. package/skills/melonjs-physics/SKILL.md +101 -27
  239. package/skills/melonjs-renderables/SKILL.md +2 -1
  240. package/skills/melonjs-scenes-and-state/SKILL.md +121 -1
  241. package/skills/melonjs-ui-and-text/SKILL.md +165 -4
  242. package/build/level/gltf/srgb.d.ts +0 -20
  243. package/build/level/gltf/srgb.d.ts.map +0 -1
@@ -10,7 +10,7 @@
10
10
  * @import NineSliceSprite from "./nineslicesprite.js";
11
11
  * @import ImageLayer from "./imagelayer.js";
12
12
  * @import ColorLayer from "./colorlayer.js";
13
- * @import Light2d from "./light2d.js";
13
+ * @import Light2d from "../lighting/light2d.ts";
14
14
  * @import UIBaseElement from "./ui/uibaseelement.ts";
15
15
  * @import UISpriteElement from "./ui/uispriteelement.ts";
16
16
  * @import UITextButton from "./ui/uitextbutton.ts";
@@ -19,6 +19,9 @@
19
19
  * @import {Bounds} from "./../physics/bounds.ts";
20
20
  * @import CanvasRenderer from "./../video/canvas/canvas_renderer.js";
21
21
  * @import WebGLRenderer from "./../video/webgl/webgl_renderer.js";
22
+ * @import {Matrix3d} from "../math/matrix3d.ts";
23
+ * @import Camera2d from "../camera/camera2d.ts";
24
+ * @import Renderer from "../video/renderer.js";
22
25
  */
23
26
  /**
24
27
  * Container represents a collection of child objects.
@@ -144,7 +147,13 @@ export default class Container extends Renderable {
144
147
  * if the given child implements an onActivateEvent method, that method will be called
145
148
  * once the child is added to this container.
146
149
  * @param {Renderable|Entity|Sprite|Collectable|Trigger|Draggable|DropTarget|NineSliceSprite|ImageLayer|ColorLayer|Light2d|UIBaseElement|UISpriteElement|UITextButton|Text|BitmapText} child - Child to be added
147
- * @param {number} [z] - forces the z index of the child to the specified value
150
+ * @param {number} [z] - forces the z index of the child to the specified
151
+ * value. This depth is scoped to THIS container: it orders the child among
152
+ * its siblings only, and says nothing about children of another container.
153
+ * Both drawing and pointer hit-testing resolve a cross-container pair at
154
+ * the common ancestor instead, so to put a whole subtree in front use
155
+ * {@link Container#moveToTop} on the container rather than a large `z` on
156
+ * something inside it. Left out, `autoDepth` numbers children from 1.
148
157
  * @returns {Renderable} the added child
149
158
  */
150
159
  addChild(child: Renderable | Entity | Sprite | Collectable | Trigger | Draggable | DropTarget | NineSliceSprite | ImageLayer | ColorLayer | Light2d | UIBaseElement | UISpriteElement | UITextButton | Text | BitmapText, z?: number): Renderable;
@@ -256,12 +265,6 @@ export default class Container extends Renderable {
256
265
  * @returns {Renderable[]} an array of renderable object
257
266
  */
258
267
  getChildren(): Renderable[];
259
- /**
260
- * update the bounding box for this container.
261
- * @param {boolean} [absolute=true] - update the bounds size and position in (world) absolute coordinates
262
- * @returns {Bounds} this container bounding box Rectangle object
263
- */
264
- updateBounds(absolute?: boolean): Bounds;
265
268
  /**
266
269
  * Checks if this container is root or if it's attached to the root container.
267
270
  * @returns {boolean} true if this container is root or if it's attached to the root container
@@ -313,6 +316,11 @@ export default class Container extends Renderable {
313
316
  moveDown(child: Renderable | Entity | Sprite | Collectable | Trigger | Draggable | DropTarget | NineSliceSprite | ImageLayer | ColorLayer | Light2d | UIBaseElement | UISpriteElement | UITextButton | Text | BitmapText): void;
314
317
  /**
315
318
  * Move the specified child to the top(z depth).
319
+ *
320
+ * Moves the whole subtree: the child's own children keep their depths among
321
+ * themselves and come with it, because depth is resolved per container. This
322
+ * is how one overlapping panel is brought in front of another, for drawing
323
+ * and for pointer hit-testing alike.
316
324
  * @param {Renderable|Entity|Sprite|Collectable|Trigger|Draggable|DropTarget|NineSliceSprite|ImageLayer|ColorLayer|Light2d|UIBaseElement|UISpriteElement|UITextButton|Text|BitmapText} child - Child to be moved
317
325
  */
318
326
  moveToTop(child: Renderable | Entity | Sprite | Collectable | Trigger | Draggable | DropTarget | NineSliceSprite | ImageLayer | ColorLayer | Light2d | UIBaseElement | UISpriteElement | UITextButton | Text | BitmapText): void;
@@ -337,15 +345,11 @@ export default class Container extends Renderable {
337
345
  */
338
346
  sortNow(recursive?: boolean): void;
339
347
  /**
340
- * A container additionally offsets its children by its own position — the
341
- * `translate()` at the top of {@link Container#draw} — which is what makes
342
- * a child's coordinates mean "relative to my parent" rather than naming a
343
- * place in the world. A leaf renderable has no such term.
344
- * @protected
345
- * @param {Matrix3d} out - matrix to write into
346
- * @returns {Matrix3d} `out`, for chaining
348
+ * draw this renderable (automatically called by melonJS)
349
+ * @param {Renderer} renderer - a renderer instance
350
+ * @param {Camera2d} [viewport] - the viewport to (re)draw
347
351
  */
348
- protected getLocalTransform(out: Matrix3d): Matrix3d;
352
+ draw(renderer: Renderer, viewport?: Camera2d): void;
349
353
  }
350
354
  import Renderable from "./renderable.js";
351
355
  import type { Color } from "./../math/color.ts";
@@ -358,10 +362,12 @@ import type { DropTarget } from "./dragndrop.js";
358
362
  import type NineSliceSprite from "./nineslicesprite.js";
359
363
  import type ImageLayer from "./imagelayer.js";
360
364
  import type ColorLayer from "./colorlayer.js";
365
+ import type Light2d from "../lighting/light2d.ts";
361
366
  import type UIBaseElement from "./ui/uibaseelement.ts";
362
367
  import type UISpriteElement from "./ui/uispriteelement.ts";
363
368
  import type UITextButton from "./ui/uitextbutton.ts";
364
369
  import type Text from "./text/text.js";
365
370
  import type BitmapText from "./text/bitmaptext.js";
366
- import type { Bounds } from "./../physics/bounds.ts";
371
+ import type Renderer from "../video/renderer.js";
372
+ import type Camera2d from "../camera/camera2d.ts";
367
373
  //# sourceMappingURL=container.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"container.d.ts","sourceRoot":"","sources":["../../src/renderable/container.js"],"names":[],"mappings":"AA6LA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH;;;;;;;;;GASG;AACH;IACC;;;;;;;OAOG;IACH,gBAPW,MAAM,MACN,MAAM,UACN,MAAM,WACN,MAAM,SACN,OAAO,EAsIjB;IA/HA;;;;OAIG;IACH,iBAAuB;IAEvB;;;;OAIG;IACH,MAHU,OAAO,CAGD;IAEhB;;;;OAIG;IACH,4BAAyB;IAEzB;;;;;;;OAOG;IACH,SALU,MAAM,CAKE;IAClB;;;OAGG;IACH,wCAA8B;IAE9B;;;;OAIG;IACH,UAHU,OAAO,CAGG;IAEpB;;;;OAIG;IACH,WAHU,OAAO,CAGI;IAErB;;;;OAIG;IACH,UAHU,OAAO,CAGI;IAErB;;;OAGG;IACH,0BAEC;IAED;;;;;;;;;;;;;;;;;;;;;OAqBG;IACH,yBAJU,OAAO,CAImB;IAEpC;;;;;;;O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AS,aAAa,GAAC,eAAe,GAAC,YAAY,GAAC,IAAI,GAAC,UAAU,QAiBpL;IAED;;;OAGG;IACH,iBAFW,OAAO,QA8BjB;IAED;;;;;;;;OAQG;IACH,oBAFW,OAAO,QAoBjB;IAiBD;;;;OAIG;IACH,+BAEC;IAED;;;;OAIG;IACH,sCAEC;IAED;;;;;;;;;;;;;;;;OAgBG;IACH,mCAWC;IAED;;;;OAIG;IACH,+BAEC;IAED;;;;OAIG;IACH,+BAEC;IA+FD;;;;;;;;OAQG;IACH,iCAHW,QAAQ,GACN,QAAQ,CAMpB;CAkHD;uBA34CsB,iBAAiB;2BAoLhB,oBAAoB;wBACrB,oBAAoB;wBACpB,aAAa;6BACR,kBAAkB;yBACtB,cAAc;+BACR,gBAAgB;gCACf,gBAAgB;iCACf,sBAAsB;4BAC3B,iBAAiB;4BACjB,iBAAiB;+BAEd,uBAAuB;iCACrB,yBAAyB;8BAC5B,sBAAsB;sBAC9B,gBAAgB;4BACV,sBAAsB;4BACxB,wBAAwB"}
1
+ {"version":3,"file":"container.d.ts","sourceRoot":"","sources":["../../src/renderable/container.js"],"names":[],"mappings":"AA6LA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH;;;;;;;;;GASG;AACH;IACC;;;;;;;OAOG;IACH,gBAPW,MAAM,MACN,MAAM,UACN,MAAM,WACN,MAAM,SACN,OAAO,EAsIjB;IA/HA;;;;OAIG;IACH,iBAAuB;IAEvB;;;;OAIG;IACH,MAHU,OAAO,CAGD;IAEhB;;;;OAIG;IACH,4BAAyB;IAEzB;;;;;;;OAOG;IACH,SALU,MAAM,CAKE;IAClB;;;OAGG;IACH,wCAA8B;IAE9B;;;;OAIG;IACH,UAHU,OAAO,CAGG;IAEpB;;;;OAIG;IACH,WAHU,OAAO,CAGI;IAErB;;;;OAIG;IACH,UAHU,OAAO,CAGI;IAErB;;;OAGG;IACH,0BAEC;IAED;;;;;;;;;;;;;;;;;;;;;OAqBG;IACH,yBAJU,OAAO,CAIm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IAAI,GAAC,UAAU,QAapL;IAED;;;OAGG;IACH,oBAFW,UAAU,GAAC,MAAM,GAAC,MAAM,GAAC,WAAW,GAAC,OAAO,GAAC,SAAS,GAAC,UAAU,GAAC,eAAe,GAAC,UAAU,GAAC,UAAU,GAAC,OAAO,GAAC,aAAa,GAAC,eAAe,GAAC,YAAY,GAAC,IAAI,GAAC,UAAU,QAiBpL;IAED;;;OAGG;IACH,iBAFW,OAAO,QA8BjB;IAED;;;;;;;;OAQG;IACH,oBAFW,OAAO,QAoBjB;IAiBD;;;;OAIG;IACH,+BAEC;IAED;;;;;;;;;;;;;;;;;;;;;OAqBG;IACH,sCAuCC;IAED;;;;;;;;;;;;;;;;OAgBG;IACH,mCAWC;IAED;;;;OAIG;IACH,+BAEC;IAED;;;;OAIG;IACH,+BAEC;IAmHD;;;;OAIG;IACH,eAHW,QAAQ,aACR,QAAQ,QA4GlB;CACD;uBAv+CsB,iBAAiB;2BAoLhB,oBAAoB;wBACrB,oBAAoB;wBACpB,aAAa;6BACR,kBAAkB;yBACtB,cAAc;+BACR,gBAAgB;gCACf,gBAAgB;iCACf,sBAAsB;4BAC3B,iBAAiB;4BACjB,iBAAiB;yBACpB,wBAAwB;+BAClB,uBAAuB;iCACrB,yBAAyB;8BAC5B,sBAAsB;sBAC9B,gBAAgB;4BACV,sBAAsB;0BAMxB,sBAAsB;0BADtB,uBAAuB"}
@@ -6,6 +6,10 @@
6
6
  * @import {Bounds} from "./../../physics/bounds.ts";
7
7
  * @import CanvasRenderer from "./../../video/canvas/canvas_renderer.js";
8
8
  * @import WebGLRenderer from "./../../video/webgl/webgl_renderer.js";
9
+ * @import {Matrix3d} from "../../math/matrix3d.ts";
10
+ * @import {Vector2d} from "../../math/vector2d.ts";
11
+ * @import Camera2d from "../../camera/camera2d.ts";
12
+ * @import Renderer from "../../video/renderer.js";
9
13
  **/
10
14
  /**
11
15
  * a Generic Object Entity
@@ -178,7 +182,7 @@ export default class Entity extends Renderable {
178
182
  anchorPoint?: string | Vector2d | {
179
183
  x: number;
180
184
  y: number;
181
- };
185
+ } | undefined;
182
186
  framewidth?: number | undefined;
183
187
  frameheight?: number | undefined;
184
188
  type?: string | undefined;
@@ -203,34 +207,26 @@ export default class Entity extends Renderable {
203
207
  * @type {boolean}
204
208
  */
205
209
  alive: boolean;
206
- /**
207
- * update the bounding box for this entity.
208
- * @param {boolean} [absolute=true] - update the bounds size and position in (world) absolute coordinates
209
- * @returns {Bounds} this entity bounding box Rectangle object
210
- */
211
- updateBounds(absolute?: boolean): Bounds;
212
210
  /**
213
211
  * update the bounds when the body is modified
214
212
  */
215
213
  onBodyUpdate(): void;
216
214
  preDraw(renderer: any): void;
217
215
  /**
218
- * An entity replaces {@link Renderable#preDraw} wholesale — no flip, no
219
- * conjugation, no anchor offset, just its position biased by the body
220
- * bounds — so the inherited composition would describe a transform this
221
- * class never applies. Mirrors the `preDraw` above instead.
222
- * @protected
223
- * @param {Matrix3d} out - matrix to write into
224
- * @returns {Matrix3d} `out`, for chaining
216
+ * draw this entity (automatically called by melonJS)
217
+ * @param {Renderer} renderer - a renderer instance
218
+ * @param {Camera2d} [viewport] - the viewport to (re)draw
225
219
  */
226
- protected getLocalTransform(out: Matrix3d): Matrix3d;
220
+ draw(renderer: Renderer, viewport?: Camera2d): void;
227
221
  /**
228
222
  * onDeactivateEvent Notification function
229
223
  */
230
224
  onDeactivateEvent(): void;
231
225
  }
232
226
  import Renderable from "../renderable.js";
233
- import type { Bounds } from "./../../physics/bounds.ts";
227
+ import type Renderer from "../../video/renderer.js";
228
+ import type Camera2d from "../../camera/camera2d.ts";
229
+ import type { Vector2d } from "../../math/vector2d.ts";
234
230
  import type { Rect } from "./../../geometries/rectangle.ts";
235
231
  import type { Polygon } from "../../geometries/polygon.ts";
236
232
  import type { Line } from "./../../geometries/line.ts";
@@ -1 +1 @@
1
- {"version":3,"file":"entity.d.ts","sourceRoot":"","sources":["../../../src/renderable/entity/entity.js"],"names":[],"mappings":"AAQA;;;;;;;;I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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6IG;AACH;IACC;;;OAGG;IACH,mCAAkC;IAElC;;;;;;;;;;;;;;;;;;OAkBG;IACH,eAlBW,MAAM,KACN,MAAM,YAGd;QAAyB,KAAK,EAAtB,MAAM;QACW,MAAM,EAAvB,MAAM;QACY,IAAI;QACJ,EAAE;QACI,KAAK;QACkB,WAAW;eAAvC,MAAM;eAAG,MAAM;;QAChB,UAAU;QACV,WAAW;QACX,IAAI;QACJ,aAAa;QACc,MAAM;QACjC,OAAO;KACjC,EAgGF;IApFA;;;;OAIG;IACH,gBAAkB;IA0FnB,sBAPU,UAAU,EAmBnB;IArBD;;;OAGG;IAEH,kBAHU,UAAU,CAKnB;IAxDA;;;OAGG;IACH,IAFU,MAAM,CAEW;IAE3B;;;;OAIG;IACH,OAFU,OAAO,CAEA;IA6DlB;;;OAGG;IACH,yBAKC;IAiCD;;OAEG;IACH,qBAEC;IAED,6BAkBC;IA2BD;;;;OAIG;IACH,eAHW,QAAQ,aACR,QAAQ,QAclB;IAoBD;;OAEG;IACH,0BAIC;CACD;uBA3bsB,kBAAkB;0BAchB,yBAAyB;0BADzB,0BAA0B;8BADxB,wBAAwB;0BAP5B,iCAAiC;6BAE9B,6BAA6B;0BAHhC,4BAA4B;6BAEzB,+BAA+B"}
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * additional import for TypeScript
3
3
  * @import { TextureAtlas } from "../video/texture/atlas.js";
4
- * @import { Vector2d } from "../math/vector2d.js";
4
+ * @import { Vector2d } from "../math/vector2d.ts";
5
5
  */
6
6
  /**
7
7
  * The shared **frame-animation engine** behind {@link Sprite} (2D) and
@@ -1,2 +1,3 @@
1
1
 
2
+ export function getInstancedShadowQuad(mesh: any, MeshClass: any, axX: any, axZ: any, azX: any, azZ: any, version: any, nx?: number, ny?: number, nz?: number): any;
2
3
  //# sourceMappingURL=groundshadow.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"groundshadow.d.ts","sourceRoot":"","sources":["../../src/renderable/groundshadow.js"],"names":[],"mappings":"AA4CA;;;;;;;;;;GAUG;AACH,oCAJa,iBAAiB,GAAC,eAAe,CAuC7C;AAED;;;;;GAKG;AACH,2CAEC;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,4CANW,YAAY,eACZ,MAAM,GACJ,OAAO,CA+BnB;AAkBD;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wCARW,MAAM,OACN,OAAO,wBAGL,MAAM,CAkClB;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,6CATW,MAAM,8BAEN,MAAM,SACN,MAAM,WACN,MAAM,GACJ,MAAM,CAuClB;AAED;;;;;;GAMG;AACH,6CAJW,MAAM,QAWhB"}
1
+ {"version":3,"file":"groundshadow.d.ts","sourceRoot":"","sources":["../../src/renderable/groundshadow.js"],"names":[],"mappings":"AA4CA;;;;;;;;;;GAUG;AACH,oCAJa,iBAAiB,GAAC,eAAe,CAuC7C;AAED;;;;;GAKG;AACH,2CAEC;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,4CANW,YAAY,eACZ,MAAM,GACJ,OAAO,CA+BnB;AAkBD;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wCARW,MAAM,OACN,OAAO,wBAGL,MAAM,CAkClB;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,kCATW,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,OACN,YAAY,QAoBtB;AAgBD;;;;;;;;;;;;;;GAcG;AACH,oCAPW,MAAM,MACN,MAAM,MACN,MAAM,OACN,YAAY,QAgBtB;AAcD;;;;;;;;;;GAUG;AACH,4CALW,MAAM,GACJ,MAAM,CASlB;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,iCAVW,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,QACN,MAAM,OACN,YAAY,GAAC,MAAM,EAAE,GACnB,YAAY,GAAC,MAAM,EAAE,CASjC;AAuDD,oKAgFC;AAED;;;;;;GAMG;AACH,6CAJW,MAAM,QAWhB;AAzPD;;;;;;;;;;;GAWG;AACH,yCAAkE;AA+BlE,oDAAoD;AACpD;;;;;;;;GAQG;AACH,iCAAkC,CAAC,CAAC"}
@@ -1,6 +1,11 @@
1
1
  /**
2
2
  * additional import for TypeScript
3
- * @import {Vector2d} from "../math/vector2d.js";
3
+ * @import {Vector2d} from "../math/vector2d.ts";
4
+ * @import Camera2d from "../camera/camera2d.ts";
5
+ * @import CanvasRenderer from "../video/canvas/canvas_renderer.js";
6
+ * @import {CompressedImage} from "../loader/parsers/compressed_textures/compressed_image.js";
7
+ * @import WebGLRenderer from "../video/webgl/webgl_renderer.js";
8
+ * @import Renderer from "../video/renderer.js";
4
9
  */
5
10
  /**
6
11
  * a generic Image Layer Object
@@ -70,13 +75,15 @@ export default class ImageLayer extends Sprite {
70
75
  resize(w: number, h: number): this;
71
76
  /**
72
77
  * draw this ImageLayer (automatically called by melonJS)
73
- * @protected
74
- * @param {CanvasRenderer|WebGLRenderer} renderer - a renderer instance
78
+ * @param {Renderer} renderer - a renderer instance
75
79
  * @param {Camera2d} [viewport] - the viewport to (re)draw
76
80
  */
77
- protected draw(renderer: CanvasRenderer | WebGLRenderer, viewport?: Camera2d): void;
81
+ draw(renderer: Renderer, viewport?: Camera2d): void;
78
82
  onDeactivateEvent(): void;
79
83
  }
80
84
  import Sprite from "./sprite.js";
81
- import type { Vector2d } from "../math/vector2d.js";
85
+ import type { Vector2d } from "../math/vector2d.ts";
86
+ import type Renderer from "../video/renderer.js";
87
+ import type Camera2d from "../camera/camera2d.ts";
88
+ import type { CompressedImage } from "../loader/parsers/compressed_textures/compressed_image.js";
82
89
  //# sourceMappingURL=imagelayer.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"imagelayer.d.ts","sourceRoot":"","sources":["../../src/renderable/imagelayer.js"],"names":[],"mapp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AGA;;;OAGG;IACH,4BAAoB;IAGlB,6BAAoB;IACpB,6BAAoB;IAkBvB,wBAsBC;IAED;;;;OAIG;IACH,UAHW,MAAM,KACN,MAAM,QAOhB;IAED;;;;OAIG;IACH,sBASC;IARA;;;OAGG;IACH,cAGC;IAGF;;;;OAIG;IACH,oBA+CC;IAED;;;;;;;;;;;;;;;;OAgBG;IACH,6BAmBC;IAED;;;;OAIG;IACH,eAHW,QAAQ,aACR,QAAQ,QAyElB;IAGD,0BAMC;CAYD;mBAxXkB,aAAa;8BAIL,qBAAqB;0BAKvB,sBAAsB;0BAJtB,uBAAuB;qCAEd,2DAA2D"}
@@ -139,7 +139,7 @@ export default class InstancedMesh extends Mesh {
139
139
  * @returns {number} the new instance's index
140
140
  */
141
141
  addInstance(transform?: Matrix3d, options?: {
142
- color?: any;
142
+ color?: Color | undefined;
143
143
  data?: number[] | undefined;
144
144
  }): number;
145
145
  /**
@@ -199,14 +199,6 @@ export default class InstancedMesh extends Mesh {
199
199
  * forest.needsInstanceUpdate = true;
200
200
  */
201
201
  set needsInstanceUpdate(value: any);
202
- /**
203
- * Draw the instanced mesh. Under a GPU backend this is one instanced
204
- * draw call; the Canvas renderer has no instancing, so each instance is
205
- * drawn through the ordinary mesh path instead.
206
- * @param {CanvasRenderer|WebGLRenderer} renderer - a renderer instance
207
- * @param {Camera2d} [viewport] - the camera rendering this frame
208
- */
209
- draw(renderer: CanvasRenderer | WebGLRenderer, viewport?: Camera2d): void;
210
202
  }
211
203
  /**
212
204
  * Everything {@link InstancedMesh} takes: the instancing settings, plus every
@@ -230,4 +222,5 @@ export type InstancedMeshOwnSettings = {
230
222
  export type InstancedMeshSettings = InstancedMeshOwnSettings & import("./mesh.js").MeshSettings;
231
223
  import Mesh from "./mesh.js";
232
224
  import { Matrix3d } from "../math/matrix3d.ts";
225
+ import type { Color } from "../math/color.ts";
233
226
  //# sourceMappingURL=instanced_mesh.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"instanced_mesh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oCAIC;IAED;;;;;;OAMG;IACH,cAJa,MAAM,EAAE,CAapB;IAED;;;;;;;;OAQG;IACH,iCALW,MAAM,GACJ,MAAM,CAelB;IAED;;;;OAIG;IACH,2BAIC;IAED;;;;;;;;OAQG;IACH;;;;;;;;;;;;OAYG;IACH,0BAkCC;IAdC;;;OAGG;IACH,gCAAsC;IAqDxC;;;;;;OAMG;IACH,eAHW,cAAc,GAAC,aAAa,aAC5B,QAAQ,QA6BlB;IAED;;;;;;;;;;OAUG;IACH,qCALW,cAAc,aACd,QAAQ,QA8BlB;IAED;;;;OAIG;IACH;;;;;;;;;;;;;;;OAeG;IACH,qCAJW,aAAa,QAsEvB;CAOD;;;;;;;;;;oBA1qBa,MAAM;;;;qBACN,OAAO;;;;mBACP,OAAO;;oCAIR,wBAAwB,GAAG,OAAO,WAAW,EAAE,YAAY;iBAxGvD,WAAW;yBATH,qBAAqB"}
1
+ {"version":3,"file":"instanced_mesh.d.ts","sourceRoot":"","sources":["../../src/renderable/instanced_mesh.js"],"names":[],"mappings":"AA4CA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgFG;AACH;;;;;;;;GAQG;AAEH;;GAEG;AAEH;IACC;;;;OAIG;IACH,eAJW,MAAM,KACN,MAAM,YACN,qBAAqB,EAyF/B;IApFA;;;;;;;OAOG;IACH,gBAJU,MAAM,CAOf;IAED;;;;;;;OAOG;IACH,gBAFU,YAAY,CAEmB;IAEzC;;;;;;OAMG;IACH,kBAJU,MAAM,CAIS;IAUzB;;;OAGG;IACH,0BAA0B;IAG1B;;;OAGG;IACH,0BAA0B;IAE1B;;;OAGG;IACH,oBAA2B;IAC3B;;;OAGG;IACH,mBAAmB;IAEnB;;;OAGG;IACH,uBAAuB;IACvB;;;OAGG;IACH,8BAA+B;IAE/B;;;OAGG;IACH,sBAAuB;IAoBxB,yBANU,MAAM,EAgDf;IAvDD;;;;;;;;O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});
306
306
  */
307
307
  transparent: boolean | undefined;
308
+ /**
309
+ * Whether geometry in front of this mesh hides it.
310
+ *
311
+ * Depth TEST, not depth WRITE. The two are different questions and the
312
+ * engine answers them in different places: writing is policy, and the
313
+ * transparent pass already turns it off for everything blended so
314
+ * overlapping draws blend instead of fighting. Testing is an authoring
315
+ * choice, and this is it.
316
+ *
317
+ * `false` is for something with no surface to be occluded ON. An
318
+ * additive glow is the case that forced it: it is a screen-space
319
+ * effect wearing a mesh's clothes, carrying a world position only so
320
+ * it can sort and move with the thing it belongs to. Left depth
321
+ * tested, a flat billboard is sliced along a straight line the moment
322
+ * any geometry is nearer at some pixel — most visibly where a glowing
323
+ * object passes near the limb of something round.
324
+ *
325
+ * Leave it `true` for anything that is genuinely in the scene. A
326
+ * muzzle flash behind a wall should still be behind the wall; this is
327
+ * not a synonym for "additive".
328
+ *
329
+ * Honoured in the transparent pass, so a mesh wanting it also wants
330
+ * {@link Mesh#transparent}. The Canvas renderer has no depth buffer
331
+ * and ignores it.
332
+ * @type {boolean}
333
+ * @default true
334
+ * @example
335
+ * // a glow that belongs to the rock, but is never cut by the planet
336
+ * const halo = new Sprite3d(0, 0, {
337
+ * image: glowTexture,
338
+ * width: 64, height: 64,
339
+ * billboard: "spherical",
340
+ * blendMode: "additive",
341
+ * transparent: true,
342
+ * alphaCutoff: 0,
343
+ * depthTest: false,
344
+ * });
345
+ */
346
+ depthTest: boolean;
308
347
  /**
309
348
  * World Y of the floor the shadow lands on, or `undefined` (the
310
349
  * default) to mean "this object is standing on the ground" — the
@@ -321,6 +360,13 @@ export default class Mesh extends Renderable {
321
360
  * object above it.
322
361
  * @type {number|undefined}
323
362
  * @default undefined
363
+ * @example
364
+ * // a collectible bobbing above the floor: naming the floor is what
365
+ * // lets the blob shrink and fade as it rises. Left unset the blob
366
+ * // rides the object's own base and never leaves it.
367
+ * const coin = new Mesh(x, floorY, { ...geometry, castGroundShadow: true });
368
+ * coin.shadowGroundY = floorY;
369
+ * coin.pos.y = floorY - 40 - 30 * Math.sin(t);
324
370
  */
325
371
  shadowGroundY: number | undefined;
326
372
  /**
@@ -330,6 +376,148 @@ export default class Mesh extends Renderable {
330
376
  * @default 0.45
331
377
  */
332
378
  shadowOpacity: number;
379
+ /**
380
+ * Multiplier for the ground shadow's footprint, independent of the
381
+ * object's size, ground height and opacity. Values above `1` can reveal
382
+ * the blob beneath a wide prop; values below `1` tighten it.
383
+ * Non-positive or non-finite values hide the shadow. Can be changed live
384
+ * on an {@link InstancedMesh} too: the set's shared quad is rewritten in
385
+ * place rather than rebuilt, so animating it allocates nothing.
386
+ * @type {number}
387
+ * @default 1
388
+ * @example
389
+ * // a crate's own blob hides underneath it, so widen it until the edge
390
+ * // shows; `0` and below hide the shadow and leave the mesh drawn
391
+ * crate.shadowScale = 1.6;
392
+ */
393
+ shadowScale: number;
394
+ /**
395
+ * How far to slide the ground shadow along
396
+ * {@link Mesh#shadowDirectionX}/{@link Mesh#shadowDirectionZ}, in
397
+ * multiples of the blob's OWN radius, which is what gives the look of
398
+ * a light that is not directly overhead.
399
+ *
400
+ * A ratio rather than a world distance. The distance that reads right
401
+ * is the one that shifts a stretched ellipse far enough for its
402
+ * trailing edge to stay at the caster's feet, which is about
403
+ * `stretch - 1` of its radius, so a world distance has to be retuned
404
+ * for every size of thing and cannot serve the parts of one glTF model
405
+ * at all. {@link Mesh#shadowScale} rides in that radius, so widening
406
+ * the blob carries the offset with it.
407
+ *
408
+ * Honoured ONLY when {@link Mesh#shadowGroundY} is set. The blob is a
409
+ * flat quad on one named plane with no contact with terrain, so sliding
410
+ * it across a plane the game has not named puts it somewhere there may
411
+ * be no floor at all. Setting `shadowGroundY` is the game saying where
412
+ * its floor is, and that is the only case where an offset is honest.
413
+ *
414
+ * An {@link InstancedMesh} honours it too, as one throw shared by the
415
+ * whole set, measured in the SET's own blob radius.
416
+ * @type {number}
417
+ * @default 0
418
+ */
419
+ shadowOffset: number;
420
+ /**
421
+ * How much longer the ground shadow is along its direction, for the
422
+ * look of a low light. `1` leaves it round.
423
+ *
424
+ * Clamped to 3, and the blob fades as it stretches: this is art
425
+ * direction, not a projection, and the further it is pulled the less
426
+ * there is to believe. Values below `1` are treated as `1`; shortening
427
+ * the blob is what {@link Mesh#shadowScale} is for.
428
+ *
429
+ * An {@link InstancedMesh} honours it too: one stretch along one
430
+ * direction for the whole set, baked into the quad its blobs share
431
+ * rather than into the matrix that also places them.
432
+ * @type {number}
433
+ * @default 1
434
+ */
435
+ shadowStretch: number;
436
+ /**
437
+ * X of the ground direction the shadow is cast along.
438
+ * @type {number}
439
+ * @default 0
440
+ * @see Mesh#shadowOffset
441
+ */
442
+ shadowDirectionX: number;
443
+ /**
444
+ * Z of the ground direction the shadow is cast along. Together with
445
+ * {@link Mesh#shadowDirectionX}, a zero-length pair means no offset and
446
+ * no stretch.
447
+ * @type {number}
448
+ * @default 0
449
+ * @see Mesh#shadowOffset
450
+ */
451
+ shadowDirectionZ: number;
452
+ /**
453
+ * A {@link Light3d} to take the shadow direction from, instead of
454
+ * setting it by hand.
455
+ *
456
+ * Read every draw, so a sun that moves carries the shadow with it.
457
+ * NOTHING is inferred: the engine never picks a dominant light for you,
458
+ * because a scene with several has no non-arbitrary answer and one with
459
+ * none has no answer at all. Name the light or get no direction.
460
+ * @type {Light3d|undefined}
461
+ * @example
462
+ * // one sun, every shadow in the scene following it. Read every draw,
463
+ * // so a day/night cycle needs nothing else.
464
+ * const sun = new Light3d({ direction: [0.4, 1, 0.2] });
465
+ * app.world.addChild(sun);
466
+ * for (const prop of props) {
467
+ * prop.castGroundShadow = true;
468
+ * prop.shadowGroundY = floorY;
469
+ * prop.shadowLight = sun; // instead of shadowDirectionX / Z
470
+ * prop.shadowOffset = 0.8; // slid out from its feet, in blob radii
471
+ * prop.shadowStretch = 2; // and pulled long, for a low sun
472
+ * }
473
+ * // later: turning the sun turns every blob with it
474
+ * sun.direction.set(Math.sin(t), 1, Math.cos(t)).normalize();
475
+ */
476
+ shadowLight: Light3d | undefined;
477
+ /**
478
+ * Takes an array or a `Vector3d` and keeps a normalized copy of its own,
479
+ * so a game that goes on mutating what it passed does not steer this
480
+ * mesh's shadow by accident. `undefined` puts the blob back level.
481
+ * @param {number[]|Vector3d|undefined} value - the floor's up normal
482
+ * @example
483
+ * // a prop standing on a 20 degree hillside: `shadowGroundY` says where
484
+ * // the floor is, this says which way it faces. World up is (0, -1, 0),
485
+ * // because render space is Y-down.
486
+ * prop.shadowGroundY = groundAt(prop.pos.x);
487
+ * prop.shadowGroundNormal = [Math.sin(0.35), -Math.cos(0.35), 0];
488
+ */
489
+ set shadowGroundNormal(value: number[] | Vector3d | undefined);
490
+ /**
491
+ * The UP normal of the floor this object's shadow lands on, for a
492
+ * surface that is not level.
493
+ *
494
+ * {@link Mesh#shadowGroundY} says where the floor is and this says
495
+ * which way it faces, so it is honoured only alongside it: tilting the
496
+ * fallback plane, which is the caster's own bounds, has no anchor to
497
+ * tilt about. Defaults to world up, which is `(0, -1, 0)` because
498
+ * render space is Y-down, and that default reproduces a level blob
499
+ * exactly.
500
+ *
501
+ * The blob is ROTATED onto the plane, not projected, so it keeps its
502
+ * shape; it still sits directly under the caster rather than sliding
503
+ * along the slope, and it is still a flat quad with no contact with
504
+ * what it lies on. The tilt is clamped at 75 degrees, past which an
505
+ * edge-on blob has nothing left to show.
506
+ *
507
+ * On an {@link InstancedMesh} the plane serves the WHOLE set: it passes
508
+ * through the set's origin at `shadowGroundY` and faces this way, and
509
+ * every blob is projected onto it whatever height its own instance sits
510
+ * at, exactly as the level case puts every blob at one height. A scatter
511
+ * spread over curved ground is therefore one set per flat facet, each
512
+ * with the facet's own plane, not one set with an averaged normal.
513
+ * @type {Vector3d|undefined}
514
+ * @default undefined
515
+ * @example
516
+ * // a prop resting on a 20 degree slope that falls away along +x
517
+ * prop.shadowGroundY = floorY;
518
+ * prop.shadowGroundNormal = [Math.sin(0.35), -Math.cos(0.35), 0];
519
+ */
520
+ get shadowGroundNormal(): Vector3d | undefined;
333
521
  /**
334
522
  * whether to cull back-facing triangles
335
523
  * @type {boolean}
@@ -502,6 +690,29 @@ export default class Mesh extends Renderable {
502
690
  * }
503
691
  */
504
692
  setVertexColor(index: number, color: Color): void;
693
+ set shader(value: GLShader | undefined);
694
+ /**
695
+ * A custom shader hosted on this mesh's draw, replacing the built-in
696
+ * mesh shading: a {@link GLShader} carrying a `{vertex, fragment}`
697
+ * GLSL program (hosted by the WebGL renderer) and/or a complete
698
+ * `wgsl` module (hosted by the WebGPU renderer — see the GLShader
699
+ * class docs for the module contract). One object serves both
700
+ * backends; a shader without a realization for the active backend
701
+ * (or `null`) degrades to the built-in shading. The tint, texture,
702
+ * placement and (for `lit` meshes) light data keep flowing through
703
+ * their usual uniforms — the custom shader decides what to do with
704
+ * them.
705
+ * @type {GLShader|undefined}
706
+ * @example
707
+ * me.loader.preload([{ name: "toon", type: "shader", src: {
708
+ * vertex: "shaders/toon.vert", // GLSL pair for WebGL
709
+ * fragment: "shaders/toon.frag",
710
+ * wgsl: "shaders/toon.wgsl", // complete module for WebGPU
711
+ * }}], () => {
712
+ * myMesh.addPostEffect(me.loader.getShader("toon"));
713
+ * });
714
+ */
715
+ get shader(): GLShader | undefined;
505
716
  /**
506
717
  * The mesh's world-space 3D axis-aligned bounding box. This is the 3D analog
507
718
  * of {@link Renderable#getBounds} (which returns a flat 2D box from
@@ -517,6 +728,41 @@ export default class Mesh extends Renderable {
517
728
  * @returns {AABB3d} the world-space bounding box (reused instance)
518
729
  */
519
730
  getBounds3d(): AABB3d;
731
+ /**
732
+ * Draw the mesh (automatically called by melonJS). Picks between two
733
+ * projection paths based on the camera that was active when this mesh
734
+ * was added to the world (captured in {@link Mesh#onActivateEvent}):
735
+ *
736
+ * - **Camera3d** → world-space output via {@link Mesh#_projectVerticesWorld}.
737
+ * Vertices land in world coordinates at `(pos.x, pos.y, depth)`; the
738
+ * camera's perspective handles the final projection per-frame on the
739
+ * GPU. Triangle winding is reversed once at first draw so back-face
740
+ * culling stays correct under the Y-flip.
741
+ * - **Camera2d** (or no camera) → legacy self-projection via
742
+ * {@link Mesh#projectionMatrix} × {@link Renderable#currentTransform},
743
+ * emitting vertices in pixel-ish space directly. Backwards-compatible
744
+ * with single-mesh-in-a-2D-scene usage.
745
+ *
746
+ * Multi-material meshes need no extra `drawMesh` calls per material vs
747
+ * single-material — each material's diffuse color is baked into
748
+ * `vertexColors` at construction time and pushed through the renderer's
749
+ * per-vertex `aColor` (GPU backends) or per-triangle solid-fill (Canvas)
750
+ * path. The GPU batchers may still chunk very large meshes across multiple
751
+ * `drawElements` calls to fit its vertex/index buffer limits, and split the
752
+ * draw once per entry in {@link Mesh#textureGroups} when the materials
753
+ * carry different diffuse textures (#1573).
754
+ *
755
+ * The active path is picked from the `viewport` passed in by
756
+ * `Container.draw`, NOT from the activation-time `_useWorldSpace`
757
+ * flag. The flag is kept as a fallback only for callers that
758
+ * invoke `draw(renderer)` without a viewport (tests, batched
759
+ * builds). Without the per-draw read, a stage with multiple
760
+ * cameras (Camera3d main + Camera2d minimap, say) would run the
761
+ * wrong projection on whichever camera didn't match activation.
762
+ * @param {Renderer} renderer - a renderer instance
763
+ * @param {Camera2d} [viewport] - the camera rendering this frame
764
+ */
765
+ draw(renderer: Renderer, viewport?: Camera2d): void;
520
766
  /**
521
767
  * Render the mesh at its current state (transforms, projection, tint) to an offscreen canvas.
522
768
  * The returned canvas can be used with `renderer.drawImage()`, as a `Sprite` image source,
@@ -576,7 +822,7 @@ export type MeshSettings = {
576
822
  /**
577
823
  * - display width in pixels. With normalization on (the default) the model is scaled to fit this size; with `normalize: false` this is the uniform pixels-per-unit scale applied to the raw geometry. With `normalize: false` and an explicit `scale`, an omitted `width`/`height` is derived from the GEOMETRY's own extent, the way a Sprite takes its size from its frame — a mesh that reports no extent misleads frustum culling, pointer picking and the physics broadphase alike.
578
824
  */
579
- width: number;
825
+ width?: number;
580
826
  /**
581
827
  * - display height in pixels (normalized models only; ignored when `normalize: false`)
582
828
  */
@@ -649,6 +895,10 @@ export type MeshSettings = {
649
895
  * - draw in the transparent pass (blended, back-to-front, no depth write). Omit and a mesh goes transparent whenever its draw alpha is fractional; `true` for soft-alpha textures; `false` to stay opaque however faded
650
896
  */
651
897
  transparent?: boolean;
898
+ /**
899
+ * - whether geometry in front of this mesh hides it. `false` draws it over whatever is already there, for a glow or an overlay that has no surface to be occluded ON. Separate from the depth WRITE the transparent pass turns off on its own. Transparent pass only, GPU backends only
900
+ */
901
+ depthTest?: boolean;
652
902
  /**
653
903
  * - set `false` to exempt this mesh from the camera's distance fog ({@link Camera3d#setFog}); omit to fog whenever the camera does
654
904
  */
@@ -661,14 +911,43 @@ export type MeshSettings = {
661
911
  * - opacity of the shadow directly beneath the object, before any height fade.
662
912
  */
663
913
  shadowOpacity?: number;
914
+ /**
915
+ * - multiplier for the ground shadow's footprint. Non-positive or non-finite values hide the shadow without hiding the mesh.
916
+ */
917
+ shadowScale?: number;
918
+ /**
919
+ * - how far to slide the shadow along `shadowDirectionX`/`shadowDirectionZ`, in multiples of the blob's own radius, for the look of a light that is not directly overhead. A ratio rather than a world distance so one value serves casters of any size. Honoured only when `shadowGroundY` is set, since the blob is a flat quad and sliding it off a plane the game has NOT named puts it somewhere there is no floor. On an `InstancedMesh` it is one throw for the whole set.
920
+ */
921
+ shadowOffset?: number;
922
+ /**
923
+ * - how much longer the blob is along `shadowDirectionX`/`shadowDirectionZ`, for the look of a low light. Clamped to 3, and the shadow fades as it stretches. On an `InstancedMesh` it is one stretch for the whole set.
924
+ */
925
+ shadowStretch?: number;
926
+ /**
927
+ * - x of the ground direction the shadow is cast along. Together with `shadowDirectionZ`, zero length means no offset and no stretch.
928
+ */
929
+ shadowDirectionX?: number;
930
+ /**
931
+ * - z of the ground direction the shadow is cast along.
932
+ */
933
+ shadowDirectionZ?: number;
934
+ /**
935
+ * - the UP normal of the floor the shadow lands on, for a surface that is not level. Needs `shadowGroundY`, which says where that floor is; this says which way it faces. Defaults to world up, and the tilt is clamped at 75 degrees. On an `InstancedMesh` one plane serves the whole set, through the set's origin at `shadowGroundY`, so a scatter over curved ground is one set per facet.
936
+ */
937
+ shadowGroundNormal?: number[] | Vector3d;
938
+ /**
939
+ * - a {@link Light3d} to take the direction from instead of setting it by hand. Read every draw, so a moving sun carries the shadow with it. Nothing is inferred from the scene: no light here means no direction.
940
+ */
941
+ shadowLight?: Light3d;
664
942
  };
665
943
  import Renderable from "./renderable.js";
666
944
  import { TextureAtlas } from "./../video/texture/atlas.js";
945
+ import { Vector3d } from "../math/vector3d.ts";
667
946
  import { Color } from "../math/color.ts";
668
947
  import { Matrix3d } from "../math/matrix3d.ts";
669
- import { Vector2d } from "../math/vector2d.ts";
670
- import { Polygon } from "../geometries/polygon.ts";
948
+ import type GLShader from "../video/webgl/glshader.js";
671
949
  import { AABB3d } from "../physics/broadphase/aabb3d.ts";
672
- import type WebGLRenderer from "./../video/webgl/webgl_renderer.js";
950
+ import Renderer from "./../video/renderer.js";
951
+ import type Camera2d from "../camera/camera2d.ts";
673
952
  import Texture2d from "./../video/texture/texture2d.ts";
674
953
  //# sourceMappingURL=mesh.d.ts.map