melonjs 20.12.0 → 20.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +66 -22
- package/build/application/application.d.ts +6 -1
- package/build/application/application.d.ts.map +1 -1
- package/build/application/header.d.ts.map +1 -1
- package/build/application/resize.d.ts.map +1 -1
- package/build/application/settings.d.ts +13 -8
- package/build/application/settings.d.ts.map +1 -1
- package/build/audio/audio.d.ts +8 -4
- package/build/audio/audio.d.ts.map +1 -1
- package/build/audio/backend/engine.d.ts.map +1 -1
- package/build/audio/playback.d.ts +2 -2
- package/build/audio/playback.d.ts.map +1 -1
- package/build/audio/spatial.d.ts.map +1 -1
- package/build/audio/types.d.ts +15 -5
- package/build/audio/types.d.ts.map +1 -1
- package/build/camera/camera2d.d.ts +12 -9
- package/build/camera/camera2d.d.ts.map +1 -1
- package/build/camera/camera3d.d.ts +11 -8
- package/build/camera/camera3d.d.ts.map +1 -1
- package/build/camera/effects/fade_effect.d.ts.map +1 -1
- package/build/geometries/ellipse.d.ts +3 -0
- package/build/geometries/ellipse.d.ts.map +1 -1
- package/build/geometries/line.d.ts.map +1 -1
- package/build/geometries/path2d.d.ts +9 -8
- package/build/geometries/path2d.d.ts.map +1 -1
- package/build/geometries/polygon.d.ts +2 -1
- package/build/geometries/polygon.d.ts.map +1 -1
- package/build/index.d.ts +14 -3
- package/build/index.d.ts.map +1 -1
- package/build/index.js +50215 -45051
- package/build/index.js.map +4 -4
- package/build/input/gamepad.d.ts.map +1 -1
- package/build/input/keyboard.d.ts.map +1 -1
- package/build/input/pointerevent.d.ts.map +1 -1
- package/build/level/gltf/GLTFModel.d.ts.map +1 -1
- package/build/level/level.d.ts.map +1 -1
- package/build/level/tiled/TMXLayer.d.ts +50 -15
- package/build/level/tiled/TMXLayer.d.ts.map +1 -1
- package/build/level/tiled/TMXTileMap.d.ts +14 -4
- package/build/level/tiled/TMXTileMap.d.ts.map +1 -1
- package/build/level/tiled/TMXTileset.d.ts.map +1 -1
- package/build/level/tiled/TMXUtils.d.ts.map +1 -1
- package/build/level/tiled/renderer/TMXHexagonalRenderer.d.ts.map +1 -1
- package/build/level/tiled/renderer/TMXIsometricRenderer.d.ts.map +1 -1
- package/build/level/tiled/renderer/TMXObliqueRenderer.d.ts +1 -0
- package/build/level/tiled/renderer/TMXObliqueRenderer.d.ts.map +1 -1
- package/build/level/tiled/renderer/TMXOrthogonalRenderer.d.ts.map +1 -1
- package/build/level/tiled/renderer/TMXRenderer.d.ts +7 -3
- package/build/level/tiled/renderer/TMXRenderer.d.ts.map +1 -1
- package/build/level/tiled/renderer/TMXStaggeredRenderer.d.ts.map +1 -1
- package/build/lighting/light3d.d.ts +55 -0
- package/build/lighting/light3d.d.ts.map +1 -1
- package/build/loader/cache.d.ts +146 -97
- package/build/loader/cache.d.ts.map +1 -1
- package/build/loader/internal-types.d.ts +69 -0
- package/build/loader/internal-types.d.ts.map +1 -0
- package/build/loader/loader.d.ts +589 -253
- package/build/loader/loader.d.ts.map +1 -1
- package/build/loader/parsers/audio.d.ts.map +1 -1
- package/build/loader/parsers/fontface.d.ts.map +1 -1
- package/build/loader/parsers/gltf.d.ts.map +1 -1
- package/build/loader/parsers/tmx.d.ts.map +1 -1
- package/build/math/color.d.ts +4 -0
- package/build/math/color.d.ts.map +1 -1
- package/build/math/math.d.ts +6 -1
- package/build/math/math.d.ts.map +1 -1
- package/build/math/noise.d.ts +16 -16
- package/build/math/noise.d.ts.map +1 -1
- package/build/math/observableVector2d.d.ts +6 -6
- package/build/math/observableVector2d.d.ts.map +1 -1
- package/build/math/observableVector3d.d.ts +8 -8
- package/build/math/observableVector3d.d.ts.map +1 -1
- package/build/particles/emitter.d.ts +15 -3
- package/build/particles/emitter.d.ts.map +1 -1
- package/build/particles/particle.d.ts +6 -0
- package/build/particles/particle.d.ts.map +1 -1
- package/build/particles/settings.d.ts +22 -5
- package/build/particles/settings.d.ts.map +1 -1
- package/build/physics/adapter.d.ts +64 -25
- package/build/physics/adapter.d.ts.map +1 -1
- package/build/physics/builtin/body.d.ts +23 -4
- package/build/physics/builtin/body.d.ts.map +1 -1
- package/build/physics/builtin/builtin-adapter.d.ts +25 -3
- package/build/physics/builtin/builtin-adapter.d.ts.map +1 -1
- package/build/physics/builtin/detector.d.ts.map +1 -1
- package/build/physics/builtin/raycast.d.ts.map +1 -1
- package/build/physics/world.d.ts +40 -10
- package/build/physics/world.d.ts.map +1 -1
- package/build/renderable/container.d.ts +41 -6
- package/build/renderable/container.d.ts.map +1 -1
- package/build/renderable/draggable.d.ts.map +1 -1
- package/build/renderable/frameAnimation.d.ts.map +1 -1
- package/build/renderable/instanced_mesh.d.ts +16 -14
- package/build/renderable/instanced_mesh.d.ts.map +1 -1
- package/build/renderable/mesh.d.ts +62 -5
- package/build/renderable/mesh.d.ts.map +1 -1
- package/build/renderable/renderable.d.ts.map +1 -1
- package/build/renderable/sprite.d.ts +4 -2
- package/build/renderable/sprite.d.ts.map +1 -1
- package/build/renderable/text/bitmaptext.d.ts +12 -3
- package/build/renderable/text/bitmaptext.d.ts.map +1 -1
- package/build/renderable/text/text.d.ts +147 -4
- package/build/renderable/text/text.d.ts.map +1 -1
- package/build/renderable/text/textmetrics.d.ts +10 -2
- package/build/renderable/text/textmetrics.d.ts.map +1 -1
- package/build/renderable/text/textstyle.d.ts.map +1 -1
- package/build/renderable/trigger.d.ts +5 -0
- package/build/renderable/trigger.d.ts.map +1 -1
- package/build/renderable/ui/panelpaint.d.ts +5 -1
- package/build/renderable/ui/panelpaint.d.ts.map +1 -1
- package/build/renderable/ui/progressbar.d.ts +267 -95
- package/build/renderable/ui/progressbar.d.ts.map +1 -1
- package/build/renderable/ui/uibaseelement.d.ts +443 -50
- package/build/renderable/ui/uibaseelement.d.ts.map +1 -1
- package/build/renderable/ui/uicheckbox.d.ts +383 -0
- package/build/renderable/ui/uicheckbox.d.ts.map +1 -0
- package/build/renderable/ui/uifocus.d.ts +6 -0
- package/build/renderable/ui/uifocus.d.ts.map +1 -0
- package/build/renderable/ui/uilabel.d.ts +31 -0
- package/build/renderable/ui/uilabel.d.ts.map +1 -0
- package/build/renderable/ui/uipanel.d.ts +589 -116
- package/build/renderable/ui/uipanel.d.ts.map +1 -1
- package/build/renderable/ui/uiskin.d.ts +25 -0
- package/build/renderable/ui/uiskin.d.ts.map +1 -0
- package/build/renderable/ui/uislider.d.ts +518 -0
- package/build/renderable/ui/uislider.d.ts.map +1 -0
- package/build/renderable/ui/uispriteelement.d.ts +161 -85
- package/build/renderable/ui/uispriteelement.d.ts.map +1 -1
- package/build/renderable/ui/uitextbutton.d.ts +369 -63
- package/build/renderable/ui/uitextbutton.d.ts.map +1 -1
- package/build/state/stage.d.ts.map +1 -1
- package/build/system/device.d.ts +11 -2
- package/build/system/device.d.ts.map +1 -1
- package/build/system/fullscreen.d.ts.map +1 -1
- package/build/system/pool.d.ts.map +1 -1
- package/build/system/save.d.ts +2 -1
- package/build/system/save.d.ts.map +1 -1
- package/build/tweens/tween.d.ts +5 -2
- package/build/tweens/tween.d.ts.map +1 -1
- package/build/utils/fetchdata.d.ts.map +1 -1
- package/build/utils/utils.d.ts.map +1 -1
- package/build/video/canvas/canvas_renderer.d.ts +16 -19
- package/build/video/canvas/canvas_renderer.d.ts.map +1 -1
- package/build/video/canvas_factory.d.ts.map +1 -1
- package/build/video/effects/shadereffect.d.ts +127 -0
- package/build/video/effects/shadereffect.d.ts.map +1 -1
- package/build/video/renderer.d.ts +20 -4
- package/build/video/renderer.d.ts.map +1 -1
- package/build/video/renderstate.d.ts +26 -3
- package/build/video/renderstate.d.ts.map +1 -1
- package/build/video/utils/tessellation.d.ts +11 -0
- package/build/video/utils/tessellation.d.ts.map +1 -1
- package/build/video/webgl/batchers/lit_mesh_batcher.d.ts.map +1 -1
- package/build/video/webgl/webgl_renderer.d.ts +3 -6
- package/build/video/webgl/webgl_renderer.d.ts.map +1 -1
- package/build/video/webgpu/batchers/lit_mesh_batcher.d.ts.map +1 -1
- package/build/video/webgpu/batchers/primitive_batcher.d.ts.map +1 -1
- package/build/video/webgpu/webgpu_renderer.d.ts +3 -6
- package/build/video/webgpu/webgpu_renderer.d.ts.map +1 -1
- package/package.json +1 -1
- package/skills/melonjs/SKILL.md +41 -17
- package/skills/melonjs-20-migration/SKILL.md +50 -7
- package/skills/melonjs-3d/SKILL.md +138 -38
- package/skills/melonjs-3d-assets/SKILL.md +83 -33
- package/skills/melonjs-audio/SKILL.md +62 -19
- package/skills/melonjs-camera-and-drawing/SKILL.md +135 -8
- package/skills/melonjs-deployment/SKILL.md +92 -14
- package/skills/melonjs-display-and-scaling/SKILL.md +8 -3
- package/skills/melonjs-effects-and-shaders/SKILL.md +47 -15
- package/skills/melonjs-events/SKILL.md +6 -3
- package/skills/melonjs-getting-started/SKILL.md +6 -2
- package/skills/melonjs-input/SKILL.md +102 -16
- package/skills/melonjs-lighting/SKILL.md +13 -1
- package/skills/melonjs-loading-assets/SKILL.md +255 -39
- package/skills/melonjs-math/SKILL.md +26 -8
- package/skills/melonjs-particles-and-trails/SKILL.md +77 -9
- package/skills/melonjs-performance/SKILL.md +18 -8
- package/skills/melonjs-physics/SKILL.md +435 -128
- package/skills/melonjs-plugins/SKILL.md +50 -11
- package/skills/melonjs-renderables/SKILL.md +31 -7
- package/skills/melonjs-renderer-backends/SKILL.md +38 -17
- package/skills/melonjs-scenes-and-state/SKILL.md +45 -5
- package/skills/melonjs-sprites-and-animation/SKILL.md +37 -2
- package/skills/melonjs-tilemaps/SKILL.md +149 -17
- package/skills/melonjs-ui-and-text/SKILL.md +674 -42
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loader.d.ts","sourceRoot":"","sources":["../../src/loader/loader.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"loader.d.ts","sourceRoot":"","sources":["../../src/loader/loader.js"],"names":[],"mappings":"AA+OA;;;;GAIG;AACH,mDAEC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,oCAtBG;IAAy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BnB;AA4HD;;;;;;;;;;;;;;GAcG;AACH,kCAqBC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmDG;AACH,8BA7BW,MAAM,UACN,KAAK,EAAE,QA2CjB;AA2DD;;;;;;;;;;;;GAYG;AACH,8BATW,MAAM,GACJ,KAAK,EAAE,GAAC,SAAS,CAW7B;AAED;;;;;;;;;;;;;;GAcG;AACH,6BAVW,MAAM,GACJ,OAAO,CAWnB;AArxDD;;;;;;GAMG;AAEH;;;;;;;;GAQG;AACH;;;GAGG;AACH;;;;GAIG;AACH,2BAAwB;AAExB;;;;;;;;;GASG;AACH;;EAA0B;AAE1B;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAZU,MAAM,CAYO;AAEvB;;;;;;;;;;;;;;;;;GAiBG;AACH,4BAZU,OAAO,CAYkB;;;;;;;;;;;;;;;;UAgjBrB,MAAM;;;;;;;;;UAGN,MAAM;;;;;;;;;;;;UAMN,MAAM,GAAC,MAAM,EAAE;;;;;;;;WASf,MAAM,GAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAA;KAAC;;;;;aAKrC,OAAO;;;;;;eAEP,OAAO;;;;WAGP,OAAO;;;;;;;;;;uBA/oBR,OAAO,mBAAmB,EAAE,QAAQ;;;;uBAIpC,OAAO,mBAAmB,EAAE,QAAQ"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"audio.d.ts","sourceRoot":"","sources":["../../../src/loader/parsers/audio.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"audio.d.ts","sourceRoot":"","sources":["../../../src/loader/parsers/audio.js"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;GAiBG;AACH,mCARW,MAAM,CAAC,KAAK,oDAGZ,MAAM,GACJ,MAAM,CAMlB;AAED;;;;;;GAMG;AACH,kCALW,MAAM,GACJ,OAAO,CAMnB;AAED;;;;;;GAMG;AACH,oCALW,MAAM,GACJ,OAAO,CAMnB;AAED;;;;GAIG;AACH,uCAEC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fontface.d.ts","sourceRoot":"","sources":["../../../src/loader/parsers/fontface.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"fontface.d.ts","sourceRoot":"","sources":["../../../src/loader/parsers/fontface.js"],"names":[],"mappings":"AAGA;;;;;;;;;;;;GAYG;AACH,sCAXW,MAAM,CAAC,KAAK,0CAGV,MAAM,CA6DlB;;IAED;;;;;;;;;OASG;IACH,2BALW,MAAM,GACJ,MAAM,CAOlB;IAED;;;;;;;OAOG;IACH,2BALW,MAAM,GACJ,OAAO,CAMnB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gltf.d.ts","sourceRoot":"","sources":["../../../src/loader/parsers/gltf.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"gltf.d.ts","sourceRoot":"","sources":["../../../src/loader/parsers/gltf.js"],"names":[],"mappings":"AA4CA;;;;;;GAMG;AACH,sCALW,WAAW,GACT;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,UAAU,GAAG,IAAI,CAAA;CAAE,CAmCpD;AAsED;;;;;GAKG;AACH,+EAgCC;AA8KD;;;;;;;;;;;GAWG;AACH,oCARW,MAAM,EAAE,eACR,MAAM,EAAE,YACR,MAAM,EAAE,SACR,MAAM,EAAE,GACN,MAAM,EAAE,CAqCpB;AAED;;;;;;;;GAQG;AACH,wCAPW,MAAM,EAAE,YACR,MAAM,EAAE,SACR,MAAM,EAAE,GACN,MAAM,EAAE,CAMpB;AAED;;;;GAIG;AACH,gDASC;AAsED;;;;;;GAMG;AACH,kEAWC;AAED;;;;GAIG;AACH,oDAEC;AAmID;;;;;;;;;;;GAWG;AACH,uCAVW,WAAW,YACX,MAAM,aAGN,MAAM,GAEJ,OAAO,CAAC,MAAM,CAAC,CAsa3B;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH;;;;;;;;;GASG;AAEH;;;;;;;;;GASG;AACH,kCARW,MAAM,CAAC,KAAK,oDAGZ,MAAM,GACJ,MAAM,CA8BlB;;;;;;;;;;;;WAjEa,MAAM,EAAE;;;;cACR,YAAY;;;;aACZ,YAAY;;;;SACZ,YAAY;;;;aACZ,WAAW,GAAC,WAAW;;;;iBACvB,MAAM;;;;WACN,gBAAgB,GAAC,IAAI;;;;sBACrB,MAAM,EAAE;;;;aACR,WAAW;;;;oBACX,MAAM;;;;oBACN,MAAM;;;;kBACN,MAAM;;;;eACN,MAAM,EAAE;;;;YACR,OAAO;;;;kBACP,OAAO;;;;WACP,MAAM;;;;;;;;;WAMN,QAAQ,EAAE;;;;aACV,KAAK,CAAC;QAAC,KAAK,EAAE,MAAM,EAAE,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,WAAW,CAAC,EAAE;YAAC,IAAI,CAAC,EAAE,MAAM,CAAC;YAAC,WAAW,CAAC,EAAE,MAAM,CAAC;YAAC,KAAK,CAAC,EAAE,MAAM,CAAC;YAAC,IAAI,CAAC,EAAE,MAAM,CAAA;SAAC,CAAC;QAAC,YAAY,CAAC,EAAE,MAAM,CAAA;KAAC,CAAC;;;;YAClJ,MAAM,EAAE;;;;YACR;QAAC,GAAG,EAAE,MAAM,EAAE,CAAC;QAAC,GAAG,EAAE,MAAM,EAAE,CAAA;KAAC;;;;WAC9B,MAAM,EAAE;;;;gBACR,MAAM,EAAE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tmx.d.ts","sourceRoot":"","sources":["../../../src/loader/parsers/tmx.js"],"names":[],"mappings":"AAMA;;;;;;;;;GASG;AACH,2FALW,MAAM,GACJ,MAAM,
|
|
1
|
+
{"version":3,"file":"tmx.d.ts","sourceRoot":"","sources":["../../../src/loader/parsers/tmx.js"],"names":[],"mappings":"AAMA;;;;;;;;;GASG;AACH,2FALW,MAAM,GACJ,MAAM,CA4FlB"}
|
package/build/math/color.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"color.d.ts","sourceRoot":"","sources":["../../src/math/color.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"color.d.ts","sourceRoot":"","sources":["../../src/math/color.ts"],"names":[],"mappings":"AAmOA;;;GAGG;AACH,qBAAa,KAAK;IACjB,OAAO,CAAC,cAAc,CAAe;IAErC;;;;;;OAMG;gBACS,CAAC,GAAE,KAAK,GAAG,MAAM,GAAG,MAAU,EAAE,CAAC,SAAI,EAAE,CAAC,SAAI,EAAE,KAAK,SAAM;IAcrE;;;OAGG;IACH,IAAI,CAAC,WAEJ;IAED;;;OAGG;IACH,IAAI,CAAC,CAAC,KAAK,QAAA,EAEV;IAED;;;OAGG;IACH,IAAI,CAAC,WAEJ;IAED;;;OAGG;IACH,IAAI,CAAC,CAAC,KAAK,QAAA,EAEV;IAED;;;OAGG;IACH,IAAI,CAAC,WAEJ;IAED;;;OAGG;IACH,IAAI,CAAC,CAAC,KAAK,QAAA,EAEV;IAED;;;OAGG;IACH,IAAI,KAAK,WAER;IAED;;;OAGG;IACH,IAAI,KAAK,CAAC,KAAK,QAAA,EAEd;IAED;;;;;;;OAOG;IACH,QAAQ,CAAC,CAAC,GAAE,MAAU,EAAE,CAAC,GAAE,MAAU,EAAE,CAAC,GAAE,MAAU,EAAE,KAAK,SAAM;IASjE;;;;;;;OAOG;IACH,QAAQ,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,KAAK,SAAM;IASrD;;;;;;;;;;;;;;;;;;;;;;;;;OAyBG;IACH,SAAS,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,KAAK,SAAM;IAStD;;;;;;OAMG;IACH,MAAM,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EA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;
|
|
|
30
30
|
export declare function isPowerOfTwo(val: number): boolean;
|
|
31
31
|
/**
|
|
32
32
|
* returns true if the given value is a power of four
|
|
33
|
+
* (1, 4, 16, 64, …). Like {@link isPowerOfTwo}, only a positive integer can
|
|
34
|
+
* be one: a fraction, a negative number, `NaN` or `Infinity` is not.
|
|
33
35
|
* @param val number to test
|
|
34
36
|
* @returns true if number is a power of four
|
|
35
37
|
*/
|
|
@@ -97,13 +99,16 @@ export declare function randomFloat(min: number, max: number): number;
|
|
|
97
99
|
*/
|
|
98
100
|
export declare function weightedRandom(min: number, max: number): number;
|
|
99
101
|
/**
|
|
100
|
-
* round a value to the specified number of digit
|
|
102
|
+
* round a value to the specified number of digit.
|
|
103
|
+
* Rounds to the nearest value, and a tie the way `Math.round` does, toward
|
|
104
|
+
* positive infinity: `round(2.5)` is 3 and `round(-2.5)` is -2.
|
|
101
105
|
* @param num - value to be rounded.
|
|
102
106
|
* @param [dec] - number of decimal digit to be rounded to.
|
|
103
107
|
* @returns rounded value
|
|
104
108
|
* @example
|
|
105
109
|
* // round a specific value to 2 digits
|
|
106
110
|
* math.round(10.33333, 2); // return 10.33
|
|
111
|
+
* math.round(-2.7); // return -3
|
|
107
112
|
*/
|
|
108
113
|
export declare function round(num: number, dec?: number): number;
|
|
109
114
|
/**
|
package/build/math/math.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"math.d.ts","sourceRoot":"","sources":["../../src/math/math.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;GAEG;AACH,eAAO,MAAM,UAAU,QAAkB,CAAC;AAE1C;;GAEG;AACH,eAAO,MAAM,UAAU,QAAkB,CAAC;AAE1C;;GAEG;AACH,eAAO,MAAM,GAAG,QAAc,CAAC;AAE/B;;GAEG;AACH,eAAO,MAAM,GAAG,QAAgB,CAAC;AAEjC;;GAEG;AACH,eAAO,MAAM,OAAO,WAAW,CAAC;AAEhC;;;;GAIG;AACH,wBAAgB,YAAY,CA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AC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,SAAI,WAE1E;AAED;;;;GAIG;AACH,wBAAgB,GAAG,CAAC,CAAC,EAAE,MAAM,UAE5B;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,IAAI,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAE5D;AAED;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAgB,IAAI,CACnB,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,EACd,EAAE,EAAE,MAAM,GACR,MAAM,CAER;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,EAAE,QAAQ,EAAE,MAAM,UAS3D"}
|
package/build/math/noise.d.ts
CHANGED
|
@@ -1,19 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Coherent value/gradient noise with fractal (fBm / ridged) layering.
|
|
3
|
-
*
|
|
4
|
-
* `Noise` is the renderer-free *algorithm*: a CPU-samplable field you can read
|
|
5
|
-
* directly with {@link Noise#getNoise2d} / {@link Noise#getNoise3d} for gameplay
|
|
6
|
-
* (heightmaps, terrain, spawn jitter, flow fields), or feed to a
|
|
7
|
-
* {@link NoiseTexture2d} to bake it into a drawable texture.
|
|
8
|
-
*
|
|
9
|
-
* Each sample returns a value in the `[-1, 1]` range. The field is fully
|
|
10
|
-
* deterministic for a given `seed`, so the same parameters always reproduce the
|
|
11
|
-
* same field.
|
|
12
|
-
* @category Math
|
|
13
|
-
* @example
|
|
14
|
-
* const noise = new me.Noise({ type: "simplex", seed: 1337, frequency: 0.02, octaves: 4 });
|
|
15
|
-
* const h = noise.getNoise2d(x, y); // -1 .. 1
|
|
16
|
-
*/
|
|
17
1
|
export type NoiseType = "simplex" | "perlin" | "value" | "valueCubic" | "cellular";
|
|
18
2
|
export type FractalType = "none" | "fbm" | "ridged" | "pingPong";
|
|
19
3
|
export interface NoiseSettings {
|
|
@@ -52,6 +36,22 @@ export interface NoiseSettings {
|
|
|
52
36
|
/** constant offset added to sample coordinates (default `0`) */
|
|
53
37
|
offsetZ?: number;
|
|
54
38
|
}
|
|
39
|
+
/**
|
|
40
|
+
* Coherent value/gradient noise with fractal (fBm / ridged) layering.
|
|
41
|
+
*
|
|
42
|
+
* `Noise` is the renderer-free *algorithm*: a CPU-samplable field you can read
|
|
43
|
+
* directly with {@link Noise#getNoise2d} / {@link Noise#getNoise3d} for gameplay
|
|
44
|
+
* (heightmaps, terrain, spawn jitter, flow fields), or feed to a
|
|
45
|
+
* {@link NoiseTexture2d} to bake it into a drawable texture.
|
|
46
|
+
*
|
|
47
|
+
* Each sample returns a value in the `[-1, 1]` range. The field is fully
|
|
48
|
+
* deterministic for a given `seed`, so the same parameters always reproduce the
|
|
49
|
+
* same field.
|
|
50
|
+
* @category Math
|
|
51
|
+
* @example
|
|
52
|
+
* const noise = new me.Noise({ type: "simplex", seed: 1337, frequency: 0.02, octaves: 4 });
|
|
53
|
+
* const h = noise.getNoise2d(x, y); // -1 .. 1
|
|
54
|
+
*/
|
|
55
55
|
export declare class Noise {
|
|
56
56
|
type: NoiseType;
|
|
57
57
|
seed: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"noise.d.ts","sourceRoot":"","sources":["../../src/math/noise.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"noise.d.ts","sourceRoot":"","sources":["../../src/math/noise.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,SAAS,GAClB,SAAS,GACT,QAAQ,GACR,OAAO,GACP,YAAY,GACZ,UAAU,CAAC;AACd,MAAM,MAAM,WAAW,GAAG,MAAM,GAAG,KAAK,GAAG,QAAQ,GAAG,UAAU,CAAC;AAEjE,MAAM,WAAW,aAAa;IAC7B,mDAAmD;IACnD,IAAI,CAAC,EAAE,SAA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AAM,CAAC;IAC5B,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;gBASJ,QAAQ,GAAE,aAAkB;IAwBxC;;;;OAIG;IACH,SAAS,CAAC,IAAI,EAAE,MAAM;IAoBtB;;;;OAIG;IACH,UAAU,CAAC,CAAC,EAAE,MAAM;IAIpB;;;;;OAKG;IACH,UAAU,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM;IA8B/B;;;;;;;OAOG;IACH,UAAU,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM;CAskB1C"}
|
|
@@ -46,9 +46,9 @@ export declare class ObservableVector2d {
|
|
|
46
46
|
set y(value: number);
|
|
47
47
|
/**
|
|
48
48
|
* Sets the callback function to be called when the point changes.
|
|
49
|
-
* @param callback - The callback function.
|
|
49
|
+
* @param callback - The callback function, or `undefined` to remove it.
|
|
50
50
|
*/
|
|
51
|
-
setCallback(callback: () => void): void;
|
|
51
|
+
setCallback(callback: (() => void) | undefined): void;
|
|
52
52
|
/**
|
|
53
53
|
* set the Vector x and y properties to 0
|
|
54
54
|
* @returns Reference to this object for method chaining
|
|
@@ -119,7 +119,7 @@ export declare class ObservableVector2d {
|
|
|
119
119
|
* @param high maximum component value
|
|
120
120
|
* @returns Reference to this object for method chaining
|
|
121
121
|
*/
|
|
122
|
-
clampSelf(low: number, high: number):
|
|
122
|
+
clampSelf(low: number, high: number): this;
|
|
123
123
|
/**
|
|
124
124
|
* Update this vector with the minimum value between this and the passed vector
|
|
125
125
|
* @param v other vector
|
|
@@ -141,7 +141,7 @@ export declare class ObservableVector2d {
|
|
|
141
141
|
* Floor this vector values
|
|
142
142
|
* @returns Reference to this object for method chaining
|
|
143
143
|
*/
|
|
144
|
-
floorSelf():
|
|
144
|
+
floorSelf(): this;
|
|
145
145
|
/**
|
|
146
146
|
* Ceil the vector values
|
|
147
147
|
* @returns new Vector2d
|
|
@@ -151,7 +151,7 @@ export declare class ObservableVector2d {
|
|
|
151
151
|
* Ceil this vector values
|
|
152
152
|
* @returns Reference to this object for method chaining
|
|
153
153
|
*/
|
|
154
|
-
ceilSelf():
|
|
154
|
+
ceilSelf(): this;
|
|
155
155
|
/**
|
|
156
156
|
* Negate the vector values
|
|
157
157
|
* @returns new Vector2d
|
|
@@ -161,7 +161,7 @@ export declare class ObservableVector2d {
|
|
|
161
161
|
* Negate this vector values
|
|
162
162
|
* @returns Reference to this object for method chaining
|
|
163
163
|
*/
|
|
164
|
-
negateSelf():
|
|
164
|
+
negateSelf(): this;
|
|
165
165
|
/**
|
|
166
166
|
* Copy the x,y values of the passed vector to this one
|
|
167
167
|
* @param v other vector
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"observableVector2d.d.ts","sourceRoot":"","sources":["../../src/math/observableVector2d.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAsBzC;;;GAGG;AACH,qBAAa,kBAAkB;IAiB9B,OAAO,CAAC,eAAe,CAAiB;IAExC;;;;;OAKG;gBACS,CAAC,GAAE,MAAU,EAAE,CAAC,GAAE,MAAU,EAAE,QAAQ,CAAC,EAAE,MAAM,IAAI;IAsB/D;;;;;OAKG;IACH,GAAG,CAAC,CAAC,SAAI,EAAE,CAAC,SAAI;IAShB;;;;;OAKG;IACH,QAAQ,CAAC,CAAC,SAAI,EAAE,CAAC,SAAI;IAQrB;;OAEG;IACH,IAAI,CAAC,IAQQ,MAAM,CANlB;IAED;;;OAGG;IACH,IAAI,CAAC,CAAC,KAAK,EAAE,MAAM,EAElB;IAED;;OAEG;IACH,IAAI,CAAC,IAQQ,MAAM,CANlB;IAED;;;OAGG;IACH,IAAI,CAAC,CAAC,KAAK,EAAE,MAAM,EAElB;IAED;;;OAGG;IACH,WAAW,CAAC,QAAQ,EAAE,MAAM,IAAI;
|
|
1
|
+
{"version":3,"file":"observableV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AkB,EAAE,MAAM,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM;IAQtE;;;;;OAKG;IACH,WAAW,CAAC,MAAM,EAAE,QAAQ,GAAG,kBAAkB,EAAE,IAAI,EAAE,MAAM;IAiB/D;;;;;;;;OAQG;IACH,QAAQ,CAAC,CAAC,EAAE,QAAQ,GAAG,kBAAkB;IAIzC;;;;OAIG;IACH,KAAK,CAAC,CAAC,EAAE,QAAQ,GAAG,kBAAkB;IAItC;;;;OAIG;IACH,OAAO,CAAC,CAAC,EAAE,QAAQ,GAAG,kBAAkB;IAIxC;;;;;OAKG;IACH,QAAQ,CAAC,CAAC,EAAE,QAAQ,GAAG,kBAAkB;IAIzC;;;;OAIG;IACH,KAAK,CAAC,EAAE,CAAC,EAAE,MAAM,IAAI;IAIrB;;;OAGG;IACH,QAAQ;IAIR;;OAEG;IACH,MAAM;CAGN;AAED,eAAO,MAAM,sBAAsB,mHAEgC,IAAI,EAcrE,CAAC"}
|
|
@@ -53,9 +53,9 @@ export declare class ObservableVector3d {
|
|
|
53
53
|
set z(value: number);
|
|
54
54
|
/**
|
|
55
55
|
* Sets the callback function to be called when the point changes.
|
|
56
|
-
* @param callback - The callback function.
|
|
56
|
+
* @param callback - The callback function, or `undefined` to remove it.
|
|
57
57
|
*/
|
|
58
|
-
setCallback(callback: () => void): void;
|
|
58
|
+
setCallback(callback: (() => void) | undefined): void;
|
|
59
59
|
/**
|
|
60
60
|
* set the Vector x and y properties to 0
|
|
61
61
|
* @returns Reference to this object for method chaining
|
|
@@ -127,7 +127,7 @@ export declare class ObservableVector3d {
|
|
|
127
127
|
* @param high upper bound
|
|
128
128
|
* @returns Reference to this object for method chaining
|
|
129
129
|
*/
|
|
130
|
-
clampSelf(low: number, high: number):
|
|
130
|
+
clampSelf(low: number, high: number): this;
|
|
131
131
|
/**
|
|
132
132
|
* Update this vector with the minimum value between this and the passed vector
|
|
133
133
|
* @param v other vector
|
|
@@ -149,7 +149,7 @@ export declare class ObservableVector3d {
|
|
|
149
149
|
* Floor this vector values
|
|
150
150
|
* @returns Reference to this object for method chaining
|
|
151
151
|
*/
|
|
152
|
-
floorSelf():
|
|
152
|
+
floorSelf(): this;
|
|
153
153
|
/**
|
|
154
154
|
* Ceil the vector values
|
|
155
155
|
* @returns new Vector3d
|
|
@@ -159,7 +159,7 @@ export declare class ObservableVector3d {
|
|
|
159
159
|
* Ceil this vector values
|
|
160
160
|
* @returns Reference to this object for method chaining
|
|
161
161
|
*/
|
|
162
|
-
ceilSelf():
|
|
162
|
+
ceilSelf(): this;
|
|
163
163
|
/**
|
|
164
164
|
* Negate the vector values
|
|
165
165
|
* @returns new Vector3d
|
|
@@ -169,7 +169,7 @@ export declare class ObservableVector3d {
|
|
|
169
169
|
* Negate this vector values
|
|
170
170
|
* @returns Reference to this object for method chaining
|
|
171
171
|
*/
|
|
172
|
-
negateSelf():
|
|
172
|
+
negateSelf(): this;
|
|
173
173
|
/**
|
|
174
174
|
* Copy the components of the given vector into this one
|
|
175
175
|
* @param v other vector
|
|
@@ -186,13 +186,13 @@ export declare class ObservableVector3d {
|
|
|
186
186
|
* normalize this vector (scale the vector so that its magnitude is 1)
|
|
187
187
|
* @returns Reference to this object for method chaining
|
|
188
188
|
*/
|
|
189
|
-
normalize():
|
|
189
|
+
normalize(): this;
|
|
190
190
|
/**
|
|
191
191
|
* change this vector to be perpendicular to what it was before.<br>
|
|
192
192
|
* (Effectively rotates it 90 degrees in a clockwise direction around the z axis)
|
|
193
193
|
* @returns Reference to this object for method chaining
|
|
194
194
|
*/
|
|
195
|
-
perp():
|
|
195
|
+
perp(): this;
|
|
196
196
|
/**
|
|
197
197
|
* Rotate this vector (counter-clockwise) by the specified angle (in radians) around the z axis
|
|
198
198
|
* @param angle - The angle to rotate (in radians)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"observableVector3d.d.ts","sourceRoot":"","sources":["../../src/math/observableVector3d.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE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QAAQ,GAAG,kBAAkB,EAAE,KAAK,EAAE,MAAM;IAUrD;;;;;;;;OAQG;IACH,IAAI,CACH,MAAM,EAAE,QAAQ,GAAG,QAAQ,GAAG,kBAAkB,EAChD,MAAM,EAAE,MAAM,EACd,EAAE,EAAE,MAAM;IAUX;;;;;OAKG;IACH,WAAW,CAAC,MAAM,EAAE,QAAQ,GAAG,QAAQ,GAAG,kBAAkB,EAAE,IAAI,EAAE,MAAM;IAuB1E;;;;OAIG;IACH,QAAQ,CAAC,CAAC,EAAE,QAAQ,GAAG,QAAQ,GAAG,kBAAkB;IAIpD;;;;OAIG;IACH,KAAK,CAAC,CAAC,EAAE,QAAQ,GAAG,QAAQ,GAAG,kBAAkB;IAIjD;;;;OAIG;IACH,OAAO,CAAC,CAAC,EAAE,QAAQ,GAAG,QAAQ,GAAG,kBAAkB;IAKnD;;;;;OAKG;IACH,QAAQ,CAAC,CAAC,EAAE,QAAQ,GAAG,QAAQ,GAAG,kBAAkB;IAQpD;;;;OAIG;IACH,KAAK,CAAC,EAAE,CAAC,EAAE,MAAM,IAAI;IAIrB;;;OAGG;IACH,QAAQ;IAIR;;OAEG;IACH,MAAM;CAGN;AAED,eAAO,MAAM,sBAAsB,2IAMhB,IAAI,EAerB,CAAC"}
|
|
@@ -16,6 +16,13 @@ import { type ParticleEmitterSettings } from "./settings.ts";
|
|
|
16
16
|
* emitter.blendMode = "overlay"; // live particles AND future ones
|
|
17
17
|
* ```
|
|
18
18
|
*
|
|
19
|
+
* ### Visibility layers
|
|
20
|
+
*
|
|
21
|
+
* Particles are on their emitter's {@link Renderable#visibilityLayer}: they
|
|
22
|
+
* are born on it, and follow a change to it on the emitter's next `update`.
|
|
23
|
+
* So a camera whose {@link Camera2d#cullMask} draws only the emitter's layer
|
|
24
|
+
* draws the emitter's particles as well.
|
|
25
|
+
*
|
|
19
26
|
* ### Reference space
|
|
20
27
|
*
|
|
21
28
|
* A particle stores a position, and
|
|
@@ -44,6 +51,7 @@ import { type ParticleEmitterSettings } from "./settings.ts";
|
|
|
44
51
|
* const emitter = new ParticleEmitter(x, y, { referenceSpace: "world" });
|
|
45
52
|
* ```
|
|
46
53
|
* @category Particles
|
|
54
|
+
* @see [Particle Editor](https://melonjs.github.io/melonJS/examples/#/particle-editor) — tune an emitter live, in 2D or 3D, and copy the matching code
|
|
47
55
|
*/
|
|
48
56
|
export default class ParticleEmitter extends Container {
|
|
49
57
|
#private;
|
|
@@ -52,11 +60,15 @@ export default class ParticleEmitter extends Container {
|
|
|
52
60
|
*/
|
|
53
61
|
settings: ParticleEmitterSettings;
|
|
54
62
|
/**
|
|
55
|
-
*
|
|
56
|
-
*
|
|
63
|
+
* The spawn area (`settings.width` by `settings.height`) is centred on
|
|
64
|
+
* (x, y). After construction `pos` is the area's top left corner, as on
|
|
65
|
+
* any renderable: to move the emitter to a new point, offset by half the
|
|
66
|
+
* area.
|
|
67
|
+
* @param x - x position of the centre of the spawn area
|
|
68
|
+
* @param y - y position of the centre of the spawn area
|
|
57
69
|
* @param [settings=ParticleEmitterSettings] - the settings for the particle emitter.
|
|
58
70
|
* @example
|
|
59
|
-
* // Create a particle emitter
|
|
71
|
+
* // Create a particle emitter centred on 100, 100
|
|
60
72
|
* let emitter = new ParticleEmitter(100, 100, {
|
|
61
73
|
* width: 16,
|
|
62
74
|
* height : 16,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"emitter.d.ts","sourceRoot":"","sources":["../../src/particles/emitter.ts"],"names":[],"mappings":"AAIA,OAAO,SAAS,MAAM,8BAA8B,CAAC;
|
|
1
|
+
{"version":3,"file":"emitter.d.ts","sourceRoot":"","sources":["../../src/particles/emitter.ts"],"names":[],"mappings":"AAIA,OAAO,SAAS,MAAM,8BAA8B,CAAC;AAKrD,OAA+B,EAC9B,KAAK,uBAAuB,EAC5B,MAAM,eAAe,CAAC;AAqJvB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoDG;AACH,MAAM,CAAC,OAAO,OAAO,eAAgB,SAAQ,SAAS;;IACrD;;OAEG;IACH,QAAQ,EAAE,uBAAuB,CAAC;IAiJlC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAiCG;gBAEF,CAAC,EAAE,MAAM,EACT,CAAC,EAAE,MAAM,EACT,QAAQ,GAAE,OAAO,CAAC,uBAAuB,CAAM;IAwCvC,KAAK,CAAC,QAAQ,GAAE,OAAO,CAAC,uBAAuB,CAAM,GAAG,IAAI;IAmDrE;;;;;;;;;;;OAWG;IACH,IAAI,cAAc,IAAI,OAAO,GAAG,OAAO,GAAG,SAAS,CAElD;IAED,IAAI,cAAc,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,GAAG,SAAS,EAQtD;IAyHD;;;OAGG;IACH,eAAe,IAAI,MAAM;IAIzB;;;OAGG;IACH,eAAe,IAAI,MAAM;IAyEzB;;;OAGG;IACH,SAAS,IAAI,OAAO;IAIpB;;;OAGG;IACH,eAAe,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI;IAQxC;;OAEG;IACH,UAAU,IAAI,IAAI;IAIlB;;;OAGG;IACH,cAAc,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI;CAkKpC"}
|
|
@@ -45,6 +45,12 @@ export default class Particle extends Renderable {
|
|
|
45
45
|
private _frameIndex;
|
|
46
46
|
/** @ignore */
|
|
47
47
|
private _animateFrames;
|
|
48
|
+
/**
|
|
49
|
+
* whether the image is the emitter's built-in square, the shared white
|
|
50
|
+
* pixel: drawn whole, stretched to the particle's size
|
|
51
|
+
* @ignore
|
|
52
|
+
*/
|
|
53
|
+
private _builtin;
|
|
48
54
|
/**
|
|
49
55
|
* @param emitter - the particle emitter
|
|
50
56
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"particle.d.ts","sourceRoot":"","sources":["../../src/particles/particle.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,QAAQ,EAAgB,MAAM,qBAAqB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ter from "./emitter.ts";
|
|
|
6
6
|
* to the constructor or {@link ParticleEmitter#reset}.
|
|
7
7
|
* @category Particles
|
|
8
8
|
* @see {@link ParticleEmitter}
|
|
9
|
+
* @see [Particle Editor](https://melonjs.github.io/melonJS/examples/#/particle-editor) — every setting on a slider, with the code or JSON to copy
|
|
9
10
|
*/
|
|
10
11
|
export interface ParticleEmitterSettings {
|
|
11
12
|
/**
|
|
12
|
-
* Width of the particle spawn area.
|
|
13
|
+
* Width of the particle spawn area. The constructor centres the area on
|
|
14
|
+
* the point it is given; `pos` is then its top left corner.
|
|
13
15
|
* @default 1
|
|
14
16
|
*/
|
|
15
17
|
width: number;
|
|
@@ -19,8 +21,23 @@ export interface ParticleEmitterSettings {
|
|
|
19
21
|
*/
|
|
20
22
|
height: number;
|
|
21
23
|
/**
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
+
* Depth of the particle spawn area, along Z: each particle is born at a
|
|
25
|
+
* random depth within it, centered on the emitter. With
|
|
26
|
+
* {@link ParticleEmitterSettings.width} and
|
|
27
|
+
* {@link ParticleEmitterSettings.height} it makes the area a box, so under
|
|
28
|
+
* a {@link Camera3d} rain falls through a volume instead of a sheet facing
|
|
29
|
+
* the viewer. A 2D camera does not show the depth itself; with an order
|
|
30
|
+
* dependent blend mode, the particles are then sorted by it.
|
|
31
|
+
* <br><br>
|
|
32
|
+
* Not {@link Renderable#depth}, the emitter's own position along Z.
|
|
33
|
+
* @default 0
|
|
34
|
+
*/
|
|
35
|
+
depth: number;
|
|
36
|
+
/**
|
|
37
|
+
* Image used for particles texture. Without one, particles are white
|
|
38
|
+
* squares of {@link textureSize} pixels, colored by `tint`: every such
|
|
39
|
+
* emitter draws the renderer's one shared white pixel, stretched, so none
|
|
40
|
+
* makes a texture of its own.
|
|
24
41
|
* @default undefined
|
|
25
42
|
* @see {@link textureSize}
|
|
26
43
|
*/
|
|
@@ -61,8 +78,8 @@ export interface ParticleEmitterSettings {
|
|
|
61
78
|
*/
|
|
62
79
|
randomFrame?: boolean;
|
|
63
80
|
/**
|
|
64
|
-
*
|
|
65
|
-
*
|
|
81
|
+
* Size, in pixels, of the white square particles are drawn as when the
|
|
82
|
+
* emitter has no {@link image}.
|
|
66
83
|
* @default 8
|
|
67
84
|
* @see {@link image}
|
|
68
85
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"settings.d.ts","sourceRoot":"","sources":["../../src/particles/settings.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,SAAS,MAAM,4BAA4B,CAAC;AACxD,OAAO,KAAK,eAAe,MAAM,cAAc,CAAC;AAEhD
|
|
1
|
+
{"version":3,"file":"settings.d.ts","sourceRoot":"","sources":["../../src/particles/settings.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,SAAS,MAAM,4BAA4B,CAAC;AACxD,OAAO,KAAK,eAAe,MAAM,cAAc,CAAC;AAEhD;;;;;;;GAOG;AACH,MAAM,WAAW,uBAAuB;IACvC;;;;OAIG;IACH,KAAK,EAAE,MAAM,CAAC;IAEd;;;OAGG;IACH,MAAM,EAAE,MAAM,CAAC;IAEf;;;;;;;;;;;OAWG;IACH,KAAK,EAAE,MAAM,CAAC;IAEd;;;;;;;OAOG;IACH,KAAK,EAAE,iBAAiB,GAAG,gBAAgB,GAAG,SAAS,CAAC;IAExD;;;;;OAKG;IACH,UAAU,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAEhC;;;;;OAKG;IACH,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAEjC;;;;;;;;OAQG;IACH,MAAM,CAAC,EAAE,SAAS,MAAM,EAAE,GAAG,SAAS,CAAC;IAEvC;;;;;;;;;OASG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IAEtB;;;;;OAKG;IACH,WAAW,EAAE,MAAM,CAAC;IAEpB;;;;OAIG;IACH,IAAI,EAAE,MAAM,CAAC;IAEb;;;;;;;;;;;;;;;;;;;;;;OAsBG;IACH,YAAY,CAAC,EAAE,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H,cAAc,EAAE,OAAO,GAAG,OAAO,GAAG,SAAS,CAAC;IAE9C;;;OAGG;IACH,YAAY,EAAE,MAAM,CAAC;IAErB;;;OAGG;IACH,SAAS,EAAE,MAAM,CAAC;IAElB;;;;OAIG;IACH,QAAQ,EAAE,MAAM,CAAC;IAEjB;;;;OAIG;IACH,YAAY,EAAE,MAAM,CAAC;IAErB;;;;;;;;;;;OAWG;IACH,cAAc,EAAE,OAAO,CAAC;IAExB;;;;;;OAMG;IACH,qBAAqB,EAAE,OAAO,CAAC;IAE/B;;;;;;;OAOG;IACH,UAAU,EAAE,CAAC,CAAC,IAAI,EAAE,eAAe,KAAK,IAAI,CAAC,GAAG,SAAS,CAAC;CAC1D;AAED;;;GAGG;AACH,QAAA,MAAM,8BAA8B,EAAE,uBA4CrC,CAAC;AAEF,eAAe,8BAA8B,CAAC"}
|
|
@@ -13,6 +13,11 @@ import type World from "./world.js";
|
|
|
13
13
|
* `dynamic` bodies are simulated (player, projectiles); `kinematic`
|
|
14
14
|
* bodies are user-positioned but participate in collision (moving
|
|
15
15
|
* platforms, elevators).
|
|
16
|
+
*
|
|
17
|
+
* The planck and Rapier adapters simulate `kinematic` as such. The builtin
|
|
18
|
+
* and matter adapters build a dynamic body, which falls under gravity; for a
|
|
19
|
+
* portable moving platform use `static` and move it with
|
|
20
|
+
* {@link PhysicsAdapter.setPosition}.
|
|
16
21
|
*/
|
|
17
22
|
export type BodyType = "static" | "dynamic" | "kinematic";
|
|
18
23
|
/**
|
|
@@ -22,14 +27,16 @@ export type BodyType = "static" | "dynamic" | "kinematic";
|
|
|
22
27
|
* body's rather than replacing them — `collisionType`, `collisionMask`,
|
|
23
28
|
* `isTrigger` and `isActive`. See {@link Body#addShape} for the semantics.
|
|
24
29
|
*
|
|
25
|
-
* Adapter support: the builtin and
|
|
26
|
-
* them onto per-
|
|
30
|
+
* Adapter support: the builtin, planck and Rapier adapters honour them
|
|
31
|
+
* (planck and Rapier map them onto per-collider filters, which both engines
|
|
32
|
+
* provide natively). The matter
|
|
27
33
|
* adapter does NOT — its `collisionFilter` and `isSensor` belong to a body, not
|
|
28
|
-
* to the parts it is built from, so per-shape values are ignored there
|
|
34
|
+
* to the parts it is built from, so per-shape values are ignored there, except
|
|
35
|
+
* `isActive: false`, which leaves the shape out of the body.
|
|
29
36
|
*
|
|
30
37
|
* **The two 3D shapes are builtin-only.** `Box3d` and `Sphere` exist because
|
|
31
|
-
* the builtin solver resolves along Z; the matter and
|
|
32
|
-
* engines with no depth to resolve and THROW when handed either one. They are
|
|
38
|
+
* the builtin solver resolves along Z; the matter, planck and Rapier adapters
|
|
39
|
+
* are 2D engines with no depth to resolve and THROW when handed either one. They are
|
|
33
40
|
* in this union because a body definition is otherwise portable and these are
|
|
34
41
|
* body shapes, not because every adapter accepts them: a game that wants to
|
|
35
42
|
* stay adapter-portable builds its bodies from the planar three.
|
|
@@ -51,11 +58,13 @@ export type BodyShape = Rect | Ellipse | Polygon | Box3d | Sphere;
|
|
|
51
58
|
* at least one of these handlers. Declaring none costs nothing.
|
|
52
59
|
*
|
|
53
60
|
* **Supported on every backend.** The builtin detector enumerates shape pairs
|
|
54
|
-
* directly; `@melonjs/planck-adapter
|
|
55
|
-
* melonJS shape onto one native collider
|
|
56
|
-
* contacts per collider pair, so
|
|
57
|
-
*
|
|
58
|
-
*
|
|
61
|
+
* directly; `@melonjs/planck-adapter`, `@melonjs/matter-adapter` and
|
|
62
|
+
* `@melonjs/rapier2d-adapter` map one melonJS shape onto one native collider
|
|
63
|
+
* and their engines already report contacts per collider pair, so they
|
|
64
|
+
* dispatch these natively. The adapters
|
|
65
|
+
* derive the SAT fields from their `normal` and `depth`, as the builtin
|
|
66
|
+
* defines them: `overlapN` is `-normal`, `overlapV` is `overlapN * depth`, and
|
|
67
|
+
* the Z fields are 0.
|
|
59
68
|
*
|
|
60
69
|
* **Receiver-symmetric**, exactly like `CollisionResponse`: `a` and `shapeA`
|
|
61
70
|
* are always the side whose handler is firing, `b` and `shapeB` the partner.
|
|
@@ -153,9 +162,9 @@ export interface CollisionResponse {
|
|
|
153
162
|
depth: number;
|
|
154
163
|
/**
|
|
155
164
|
* Engine-native contact pair object. **Shape is adapter-specific** —
|
|
156
|
-
* `Matter.Pair` under `@melonjs/matter-adapter`, a `
|
|
157
|
-
*
|
|
158
|
-
*
|
|
165
|
+
* `Matter.Pair` under `@melonjs/matter-adapter`, a planck `Contact` under
|
|
166
|
+
* `@melonjs/planck-adapter`, `{ collider1, collider2 }` (the two collider
|
|
167
|
+
* handles) under `@melonjs/rapier2d-adapter`. Reading this commits your code to a specific
|
|
159
168
|
* engine; use the portable `normal` / `depth` fields for
|
|
160
169
|
* adapter-portable handlers.
|
|
161
170
|
*
|
|
@@ -206,7 +215,11 @@ export interface CollisionResponse {
|
|
|
206
215
|
* itself (e.g. `adapter.setVelocity(r, v)` always works).
|
|
207
216
|
*/
|
|
208
217
|
export interface PhysicsBody {
|
|
209
|
-
/**
|
|
218
|
+
/**
|
|
219
|
+
* Set linear velocity, in pixels per step on the builtin and matter
|
|
220
|
+
* adapters (a step is 1/60 s) and in pixels per second on planck and
|
|
221
|
+
* Rapier.
|
|
222
|
+
*/
|
|
210
223
|
setVelocity(x: number, y: number): void;
|
|
211
224
|
/** Read linear velocity; writes into `out` if provided to avoid an alloc. */
|
|
212
225
|
getVelocity(out?: Vector2d): Vector2d;
|
|
@@ -325,8 +338,8 @@ export interface BodyDefinition {
|
|
|
325
338
|
* Number applies uniformly; `{x, y}` damps each axis independently
|
|
326
339
|
* (melonJS-specific — Matter only supports scalar and will average).
|
|
327
340
|
*
|
|
328
|
-
* It damps ROTATION as well as translation on the matter and
|
|
329
|
-
* adapters, so it is also what stops a body spinning once something has
|
|
341
|
+
* It damps ROTATION as well as translation on the matter, planck and
|
|
342
|
+
* Rapier adapters, so it is also what stops a body spinning once something has
|
|
330
343
|
* set it turning. Left at `0`, a spin never decays. The builtin adapter
|
|
331
344
|
* maps it onto its per-axis `body.friction` damping vector instead, and
|
|
332
345
|
* has no rotation to damp.
|
|
@@ -373,8 +386,8 @@ export interface BodyDefinition {
|
|
|
373
386
|
/**
|
|
374
387
|
* Disable rotation simulation, so the body keeps whatever angle it has.
|
|
375
388
|
*
|
|
376
|
-
* Defaults to whatever the underlying engine defaults to, which for
|
|
377
|
-
* matter and
|
|
389
|
+
* Defaults to whatever the underlying engine defaults to, which for
|
|
390
|
+
* matter, planck and Rapier is `false`: a rigid body turns when something turns
|
|
378
391
|
* it. Pass `true` for anything that must stay upright, such as a
|
|
379
392
|
* platformer actor that should never tip over.
|
|
380
393
|
*
|
|
@@ -474,7 +487,7 @@ export interface ShapeEntry {
|
|
|
474
487
|
* shape file, which is resolved into real shapes when the renderable is added
|
|
475
488
|
* to a container — so every adapter receives the same
|
|
476
489
|
* {@link BodyDefinition}, and one definition works unchanged on the builtin,
|
|
477
|
-
* matter and
|
|
490
|
+
* matter, planck and Rapier backends alike.
|
|
478
491
|
* @example
|
|
479
492
|
* // preload the file the shape editor exported, like any other JSON
|
|
480
493
|
* { name: "shapes", type: "json", src: "data/physics/shapes.json" }
|
|
@@ -534,7 +547,7 @@ export interface AdapterCapabilities {
|
|
|
534
547
|
raycasts: boolean;
|
|
535
548
|
/**
|
|
536
549
|
* supports {@link PhysicsAdapter.raycast3d}. 2D-only adapters
|
|
537
|
-
* (matter, planck) report `false` and omit the method; users can
|
|
550
|
+
* (matter, planck, Rapier) report `false` and omit the method; users can
|
|
538
551
|
* branch on this flag before calling
|
|
539
552
|
* `world.adapter.raycast3d?.(...)` to skip a no-op delegation.
|
|
540
553
|
*/
|
|
@@ -684,7 +697,9 @@ export interface PhysicsAdapter {
|
|
|
684
697
|
/**
|
|
685
698
|
* Register a body with the simulation. Returns an opaque handle that
|
|
686
699
|
* becomes `renderable.body`. Each adapter chooses its own concrete
|
|
687
|
-
* body type — see the class doc for the convention.
|
|
700
|
+
* body type — see the class doc for the convention. Like the builtin
|
|
701
|
+
* `Body` constructor, it sets `renderable.isKinematic` to `false`, so the
|
|
702
|
+
* renderable takes part in physics and receives pointer events.
|
|
688
703
|
*
|
|
689
704
|
* **Prefer the declarative path.** Set `renderable.bodyDef` and call
|
|
690
705
|
* `Container.addChild(renderable)` — the container auto-invokes
|
|
@@ -719,9 +734,9 @@ export interface PhysicsAdapter {
|
|
|
719
734
|
setAngle?(renderable: Renderable, angle: number): void;
|
|
720
735
|
/** Read absolute rotation angle (radians). Returns 0 if not tracked. */
|
|
721
736
|
getAngle?(renderable: Renderable): number;
|
|
722
|
-
/** Set angular velocity
|
|
737
|
+
/** Set angular velocity: radians per step, per second on planck and Rapier. */
|
|
723
738
|
setAngularVelocity?(renderable: Renderable, omega: number): void;
|
|
724
|
-
/** Read angular velocity
|
|
739
|
+
/** Read angular velocity, in the same unit. Returns 0 if not tracked. */
|
|
725
740
|
getAngularVelocity?(renderable: Renderable): number;
|
|
726
741
|
/** Apply an angular impulse (`Δω = τ / inertia`). */
|
|
727
742
|
applyTorque?(renderable: Renderable, torque: number): void;
|
|
@@ -745,8 +760,9 @@ export interface PhysicsAdapter {
|
|
|
745
760
|
/**
|
|
746
761
|
* Read the body's current velocity cap (mirror of
|
|
747
762
|
* {@link setMaxVelocity}). Returns plain `{x, y}` so callers don't
|
|
748
|
-
* need to import a vector type.
|
|
749
|
-
*
|
|
763
|
+
* need to import a vector type. A body with no cap reports `Infinity`
|
|
764
|
+
* on both axes; a builtin `Body` always has one, 490 by default. Optional — adapters that don't implement velocity caps
|
|
765
|
+
* omit this method.
|
|
750
766
|
*/
|
|
751
767
|
getMaxVelocity?(renderable: Renderable): {
|
|
752
768
|
x: number;
|
|
@@ -869,4 +885,27 @@ export interface PhysicsAdapter {
|
|
|
869
885
|
*/
|
|
870
886
|
getBodyShapes(renderable: Renderable): readonly BodyShape[];
|
|
871
887
|
}
|
|
888
|
+
/**
|
|
889
|
+
* The static side every physics adapter class shares, next to its
|
|
890
|
+
* constructor. `load()` resolves once the adapter can be constructed, and
|
|
891
|
+
* `create()` waits for it, then constructs: an adapter whose engine is plain
|
|
892
|
+
* JavaScript (the builtin, matter and planck adapters) resolves `load()` at
|
|
893
|
+
* once, while one built on WebAssembly downloads and compiles it there. So
|
|
894
|
+
* `await X.create(options)` is the same line for every adapter, at boot or
|
|
895
|
+
* before {@link World#setAdapter}; `new X(options)` stays available wherever
|
|
896
|
+
* the adapter needs no loading.
|
|
897
|
+
* @example
|
|
898
|
+
* const app = new Application(800, 600, {
|
|
899
|
+
* physic: await PlanckAdapter.create({ gravity: { x: 0, y: 320 } }),
|
|
900
|
+
* });
|
|
901
|
+
* // later, between two screens
|
|
902
|
+
* app.world.setAdapter(await MatterAdapter.create());
|
|
903
|
+
*/
|
|
904
|
+
export interface PhysicsAdapterClass<T extends PhysicsAdapter = PhysicsAdapter, O = any> {
|
|
905
|
+
new (options?: O): T;
|
|
906
|
+
/** Resolves once the adapter can be constructed. Every call returns the same promise. */
|
|
907
|
+
load(): Promise<void>;
|
|
908
|
+
/** Resolves with a new adapter: waits for `load()`, then constructs it. */
|
|
909
|
+
create(options?: O): Promise<T>;
|
|
910
|
+
}
|
|
872
911
|
//# sourceMappingURL=adapter.d.ts.map
|