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.
- package/README.md +6 -3
- package/build/application/defaultApplicationSettings.d.ts +5 -0
- package/build/application/defaultApplicationSettings.d.ts.map +1 -1
- package/build/application/header.d.ts.map +1 -1
- package/build/application/settings.d.ts +88 -0
- package/build/application/settings.d.ts.map +1 -1
- package/build/audio/backend/engine.d.ts +0 -1
- package/build/audio/backend/sound.d.ts +0 -1
- package/build/camera/camera2d.d.ts.map +1 -1
- package/build/camera/camera3d.d.ts +95 -8
- package/build/camera/camera3d.d.ts.map +1 -1
- package/build/geometries/box3d.d.ts +24 -6
- package/build/geometries/box3d.d.ts.map +1 -1
- package/build/geometries/ellipse.d.ts +14 -0
- package/build/geometries/ellipse.d.ts.map +1 -1
- package/build/geometries/polygon.d.ts +14 -0
- package/build/geometries/polygon.d.ts.map +1 -1
- package/build/geometries/sphere.d.ts +35 -6
- package/build/geometries/sphere.d.ts.map +1 -1
- package/build/index.d.ts +9 -2
- package/build/index.d.ts.map +1 -1
- package/build/index.js +2770 -538
- package/build/index.js.map +4 -4
- package/build/input/pointerevent.d.ts +8 -0
- package/build/input/pointerevent.d.ts.map +1 -1
- package/build/level/gltf/GLTFModel.d.ts +17 -31
- package/build/level/gltf/GLTFModel.d.ts.map +1 -1
- package/build/level/gltf/GLTFScene.d.ts +40 -1
- package/build/level/gltf/GLTFScene.d.ts.map +1 -1
- package/build/level/level.d.ts +35 -0
- package/build/level/level.d.ts.map +1 -1
- package/build/level/tiled/TMXLayer.d.ts +5 -2
- package/build/level/tiled/TMXLayer.d.ts.map +1 -1
- package/build/level/tiled/TMXObject.d.ts +0 -1
- package/build/level/tiled/TMXTile.d.ts +2 -1
- package/build/level/tiled/TMXTile.d.ts.map +1 -1
- package/build/level/tiled/TMXTileMap.d.ts +7 -4
- package/build/level/tiled/TMXTileMap.d.ts.map +1 -1
- package/build/level/tiled/TMXTileset.d.ts +1 -1
- package/build/level/tiled/TMXTileset.d.ts.map +1 -1
- package/build/level/tiled/TMXTilesetGroup.d.ts +5 -0
- package/build/level/tiled/TMXTilesetGroup.d.ts.map +1 -1
- package/build/level/tiled/factories/shape.d.ts +0 -1
- package/build/level/tiled/renderer/TMXHexagonalRenderer.d.ts +6 -5
- package/build/level/tiled/renderer/TMXHexagonalRenderer.d.ts.map +1 -1
- package/build/level/tiled/renderer/TMXIsometricRenderer.d.ts +5 -0
- package/build/level/tiled/renderer/TMXIsometricRenderer.d.ts.map +1 -1
- package/build/level/tiled/renderer/TMXObliqueRenderer.d.ts +8 -7
- package/build/level/tiled/renderer/TMXObliqueRenderer.d.ts.map +1 -1
- package/build/level/tiled/renderer/TMXOrthogonalRenderer.d.ts +5 -0
- package/build/level/tiled/renderer/TMXOrthogonalRenderer.d.ts.map +1 -1
- package/build/level/tiled/renderer/TMXRenderer.d.ts +19 -4
- package/build/level/tiled/renderer/TMXRenderer.d.ts.map +1 -1
- package/build/level/tiled/renderer/autodetect.d.ts +0 -4
- package/build/level/tiled/renderer/autodetect.d.ts.map +1 -1
- package/build/loader/loader.d.ts +9 -0
- package/build/loader/loader.d.ts.map +1 -1
- package/build/loader/loadingscreen.d.ts +1 -2
- package/build/loader/loadingscreen.d.ts.map +1 -1
- package/build/loader/parsers/shader.d.ts +0 -2
- package/build/math/color.d.ts +27 -4
- package/build/math/color.d.ts.map +1 -1
- package/build/particles/emitter.d.ts.map +1 -1
- package/build/particles/particle.d.ts +22 -1
- package/build/particles/particle.d.ts.map +1 -1
- package/build/particles/settings.d.ts +69 -0
- package/build/particles/settings.d.ts.map +1 -1
- package/build/physics/adapter.d.ts +9 -1
- package/build/physics/adapter.d.ts.map +1 -1
- package/build/physics/builtin/body.d.ts +3 -2
- package/build/physics/builtin/body.d.ts.map +1 -1
- package/build/physics/builtin/builtin-adapter.d.ts.map +1 -1
- package/build/physics/builtin/detector.d.ts +0 -1
- package/build/physics/builtin/detector.d.ts.map +1 -1
- package/build/physics/builtin/sat.d.ts +0 -7
- package/build/physics/builtin/sat3d.d.ts +46 -0
- package/build/physics/builtin/sat3d.d.ts.map +1 -1
- package/build/physics/response.d.ts +45 -62
- package/build/physics/response.d.ts.map +1 -1
- package/build/renderable/collectable.d.ts +6 -1
- package/build/renderable/collectable.d.ts.map +1 -1
- package/build/renderable/colorlayer.d.ts +4 -4
- package/build/renderable/colorlayer.d.ts.map +1 -1
- package/build/renderable/container.d.ts +23 -17
- package/build/renderable/container.d.ts.map +1 -1
- package/build/renderable/entity/entity.d.ts +12 -16
- package/build/renderable/entity/entity.d.ts.map +1 -1
- package/build/renderable/frameAnimation.d.ts +1 -1
- package/build/renderable/groundshadow.d.ts +1 -0
- package/build/renderable/groundshadow.d.ts.map +1 -1
- package/build/renderable/imagelayer.d.ts +12 -5
- package/build/renderable/imagelayer.d.ts.map +1 -1
- package/build/renderable/instanced_mesh.d.ts +2 -9
- package/build/renderable/instanced_mesh.d.ts.map +1 -1
- package/build/renderable/mesh.d.ts +283 -4
- package/build/renderable/mesh.d.ts.map +1 -1
- package/build/renderable/nineslicesprite.d.ts +3 -13
- package/build/renderable/nineslicesprite.d.ts.map +1 -1
- package/build/renderable/renderable.d.ts +90 -27
- package/build/renderable/renderable.d.ts.map +1 -1
- package/build/renderable/sprite.d.ts +5 -19
- package/build/renderable/sprite.d.ts.map +1 -1
- package/build/renderable/sprite3d.d.ts +27 -16
- package/build/renderable/sprite3d.d.ts.map +1 -1
- package/build/renderable/text/bitmaptext.d.ts +13 -3
- package/build/renderable/text/bitmaptext.d.ts.map +1 -1
- package/build/renderable/text/bitmaptextdata.d.ts +0 -4
- package/build/renderable/text/bitmaptextdata.d.ts.map +1 -1
- package/build/renderable/text/text.d.ts +5 -3
- package/build/renderable/text/text.d.ts.map +1 -1
- package/build/renderable/text/textmetrics.d.ts +2 -0
- package/build/renderable/text/textmetrics.d.ts.map +1 -1
- package/build/renderable/trail.d.ts +0 -1
- package/build/renderable/trail.d.ts.map +1 -1
- package/build/renderable/trigger.d.ts +27 -5
- package/build/renderable/trigger.d.ts.map +1 -1
- package/build/renderable/ui/progressbar.d.ts +194 -0
- package/build/renderable/ui/progressbar.d.ts.map +1 -0
- package/build/renderable/ui/uibaseelement.d.ts +48 -3
- package/build/renderable/ui/uibaseelement.d.ts.map +1 -1
- package/build/renderable/ui/uispriteelement.d.ts +19 -3
- package/build/renderable/ui/uispriteelement.d.ts.map +1 -1
- package/build/system/legacy_pool.d.ts +2 -2
- package/build/system/legacy_pool.d.ts.map +1 -1
- package/build/system/pool.d.ts +10 -0
- package/build/system/pool.d.ts.map +1 -1
- package/build/tweens/tween.d.ts +49 -2
- package/build/tweens/tween.d.ts.map +1 -1
- package/build/video/canvas/canvas_renderer.d.ts +34 -23
- package/build/video/canvas/canvas_renderer.d.ts.map +1 -1
- package/build/video/effects/blendEffect.d.ts +0 -1
- package/build/video/effects/bloom.d.ts +72 -0
- package/build/video/effects/bloom.d.ts.map +1 -0
- package/build/video/effects/blur.d.ts +3 -2
- package/build/video/effects/blur.d.ts.map +1 -1
- package/build/video/effects/chromaticAberration.d.ts +3 -2
- package/build/video/effects/chromaticAberration.d.ts.map +1 -1
- package/build/video/effects/colorMatrix.d.ts +3 -2
- package/build/video/effects/colorMatrix.d.ts.map +1 -1
- package/build/video/effects/desaturate.d.ts +10 -2
- package/build/video/effects/desaturate.d.ts.map +1 -1
- package/build/video/effects/dissolve.d.ts +3 -2
- package/build/video/effects/dissolve.d.ts.map +1 -1
- package/build/video/effects/dropShadow.d.ts +3 -2
- package/build/video/effects/dropShadow.d.ts.map +1 -1
- package/build/video/effects/flash.d.ts +3 -2
- package/build/video/effects/flash.d.ts.map +1 -1
- package/build/video/effects/glow.d.ts +3 -2
- package/build/video/effects/glow.d.ts.map +1 -1
- package/build/video/effects/hologram.d.ts +3 -2
- package/build/video/effects/hologram.d.ts.map +1 -1
- package/build/video/effects/invert.d.ts +10 -2
- package/build/video/effects/invert.d.ts.map +1 -1
- package/build/video/effects/outline.d.ts +3 -2
- package/build/video/effects/outline.d.ts.map +1 -1
- package/build/video/effects/pixelate.d.ts +3 -2
- package/build/video/effects/pixelate.d.ts.map +1 -1
- package/build/video/effects/radialGradient.d.ts +8 -3
- package/build/video/effects/radialGradient.d.ts.map +1 -1
- package/build/video/effects/scanline.d.ts +3 -2
- package/build/video/effects/scanline.d.ts.map +1 -1
- package/build/video/effects/sepia.d.ts +10 -2
- package/build/video/effects/sepia.d.ts.map +1 -1
- package/build/video/effects/shadereffect.d.ts +10 -4
- package/build/video/effects/shadereffect.d.ts.map +1 -1
- package/build/video/effects/shine.d.ts +3 -2
- package/build/video/effects/shine.d.ts.map +1 -1
- package/build/video/effects/tintPulse.d.ts +3 -2
- package/build/video/effects/tintPulse.d.ts.map +1 -1
- package/build/video/effects/tonemap.d.ts +121 -0
- package/build/video/effects/tonemap.d.ts.map +1 -0
- package/build/video/effects/vignette.d.ts +3 -2
- package/build/video/effects/vignette.d.ts.map +1 -1
- package/build/video/effects/wave.d.ts +3 -2
- package/build/video/effects/wave.d.ts.map +1 -1
- package/build/video/gpu/vertexformat.d.ts +26 -0
- package/build/video/gpu/vertexformat.d.ts.map +1 -1
- package/build/video/gradient.d.ts +0 -1
- package/build/video/gradient.d.ts.map +1 -1
- package/build/video/renderer.d.ts +111 -7
- package/build/video/renderer.d.ts.map +1 -1
- package/build/video/renderstate.d.ts +2 -0
- package/build/video/renderstate.d.ts.map +1 -1
- package/build/video/rendertarget/canvasrendertarget.d.ts +3 -4
- package/build/video/rendertarget/canvasrendertarget.d.ts.map +1 -1
- package/build/video/rendertarget/render_target_pool.d.ts +0 -1
- package/build/video/rendertarget/webglrendertarget.d.ts +0 -1
- package/build/video/rendertarget/webglrendertarget.d.ts.map +1 -1
- package/build/video/rendertarget/webgpurendertarget.d.ts +18 -2
- package/build/video/rendertarget/webgpurendertarget.d.ts.map +1 -1
- package/build/video/texture/atlas.d.ts +1 -0
- package/build/video/texture/atlas.d.ts.map +1 -1
- package/build/video/texture/cache.d.ts +1 -3
- package/build/video/texture/frametexture.d.ts +0 -1
- package/build/video/texture/frametexture.d.ts.map +1 -1
- package/build/video/texture/noise_texture2d.d.ts +1 -0
- package/build/video/texture/noise_texture2d.d.ts.map +1 -1
- package/build/video/utils/autodetect.d.ts +0 -2
- package/build/video/webgl/batchers/batcher.d.ts +0 -9
- package/build/video/webgl/batchers/batcher.d.ts.map +1 -1
- package/build/video/webgl/batchers/lit_quad_batcher.d.ts +11 -0
- package/build/video/webgl/batchers/lit_quad_batcher.d.ts.map +1 -1
- package/build/video/webgl/batchers/material_batcher.d.ts +4 -2
- package/build/video/webgl/batchers/material_batcher.d.ts.map +1 -1
- package/build/video/webgl/batchers/mesh_batcher.d.ts +0 -3
- package/build/video/webgl/batchers/mesh_batcher.d.ts.map +1 -1
- package/build/video/webgl/batchers/quad_batcher.d.ts +4 -0
- package/build/video/webgl/batchers/quad_batcher.d.ts.map +1 -1
- package/build/video/webgl/buffer/index.d.ts +0 -1
- package/build/video/webgl/buffer/retained_geometry.d.ts +0 -1
- package/build/video/webgl/glshader.d.ts +5 -3
- package/build/video/webgl/glshader.d.ts.map +1 -1
- package/build/video/webgl/renderers/tmxlayer/orthogonal.d.ts +0 -4
- package/build/video/webgl/texture/store.d.ts +0 -1
- package/build/video/webgl/webgl_renderer.d.ts +63 -24
- package/build/video/webgl/webgl_renderer.d.ts.map +1 -1
- package/build/video/webgpu/batchers/mesh_batcher.d.ts +0 -3
- package/build/video/webgpu/batchers/mesh_batcher.d.ts.map +1 -1
- package/build/video/webgpu/batchers/quad_batcher.d.ts +0 -2
- package/build/video/webgpu/batchers/quad_batcher.d.ts.map +1 -1
- package/build/video/webgpu/batchers/webgpu_batcher.d.ts +0 -2
- package/build/video/webgpu/batchers/webgpu_batcher.d.ts.map +1 -1
- package/build/video/webgpu/pipeline/cache.d.ts.map +1 -1
- package/build/video/webgpu/renderers/tmxlayer/orthogonal.d.ts +0 -2
- package/build/video/webgpu/texture/frametexture.d.ts +0 -2
- package/build/video/webgpu/texture/frametexture.d.ts.map +1 -1
- package/build/video/webgpu/texture/store.d.ts +0 -1
- package/build/video/webgpu/webgpu_renderer.d.ts +7 -75
- package/build/video/webgpu/webgpu_renderer.d.ts.map +1 -1
- package/package.json +1 -1
- package/skills/melonjs-3d/SKILL.md +277 -19
- package/skills/melonjs-3d-assets/SKILL.md +76 -9
- package/skills/melonjs-camera-and-drawing/SKILL.md +57 -1
- package/skills/melonjs-effects-and-shaders/SKILL.md +341 -29
- package/skills/melonjs-input/SKILL.md +48 -4
- package/skills/melonjs-particles-and-trails/SKILL.md +106 -4
- package/skills/melonjs-performance/SKILL.md +79 -2
- package/skills/melonjs-physics/SKILL.md +101 -27
- package/skills/melonjs-renderables/SKILL.md +2 -1
- package/skills/melonjs-scenes-and-state/SKILL.md +121 -1
- package/skills/melonjs-ui-and-text/SKILL.md +165 -4
- package/build/level/gltf/srgb.d.ts +0 -20
- package/build/level/gltf/srgb.d.ts.map +0 -1
|
@@ -22,6 +22,14 @@ export default class Trigger extends Renderable {
|
|
|
22
22
|
* @param {number} [settings.lightIntensityScale] - Scale the glTF lights' authored intensity. See {@link level.load}
|
|
23
23
|
* @param {boolean} [settings.castGroundShadow] - Enable ground shadows for glTF meshes. See {@link level.load}
|
|
24
24
|
* @param {number} [settings.shadowGroundY] - World Y for glTF ground shadows. See {@link level.load}
|
|
25
|
+
* @param {number} [settings.shadowOpacity] - How dark those blobs are. See {@link level.load}
|
|
26
|
+
* @param {number} [settings.shadowScale] - Blob footprint multiplier. See {@link level.load}
|
|
27
|
+
* @param {number} [settings.shadowOffset] - Slide them along the light, in blob radii. See {@link level.load}
|
|
28
|
+
* @param {number} [settings.shadowStretch] - Lengthen them along it. See {@link level.load}
|
|
29
|
+
* @param {number} [settings.shadowDirectionX] - X of the ground direction they are cast along. See {@link level.load}
|
|
30
|
+
* @param {number} [settings.shadowDirectionZ] - Z of that direction. See {@link level.load}
|
|
31
|
+
* @param {number[]|Vector3d} [settings.shadowGroundNormal] - Up normal of the floor, for a scene that is not level. See {@link level.load}
|
|
32
|
+
* @param {Light3d} [settings.shadowLight] - A light to take the shadow direction from. See {@link level.load}
|
|
25
33
|
* @example
|
|
26
34
|
* // fade transition (default)
|
|
27
35
|
* world.addChild(new Trigger(x, y, {
|
|
@@ -59,12 +67,12 @@ export default class Trigger extends Renderable {
|
|
|
59
67
|
height?: number | undefined;
|
|
60
68
|
shapes?: Rect[] | Polygon[] | Line[] | Ellipse[] | undefined;
|
|
61
69
|
duration?: number | undefined;
|
|
62
|
-
color?: string | Color;
|
|
70
|
+
color?: string | Color | undefined;
|
|
63
71
|
transition?: string | undefined;
|
|
64
|
-
shape?: Ellipse |
|
|
72
|
+
shape?: Polygon | Ellipse | undefined;
|
|
65
73
|
event?: string | undefined;
|
|
66
74
|
to?: string | undefined;
|
|
67
|
-
container?: string | Container;
|
|
75
|
+
container?: string | Container | undefined;
|
|
68
76
|
onLoaded?: Function | undefined;
|
|
69
77
|
flatten?: boolean | undefined;
|
|
70
78
|
setViewportBounds?: boolean | undefined;
|
|
@@ -74,11 +82,19 @@ export default class Trigger extends Renderable {
|
|
|
74
82
|
lightIntensityScale?: number | undefined;
|
|
75
83
|
castGroundShadow?: boolean | undefined;
|
|
76
84
|
shadowGroundY?: number | undefined;
|
|
85
|
+
shadowOpacity?: number | undefined;
|
|
86
|
+
shadowScale?: number | undefined;
|
|
87
|
+
shadowOffset?: number | undefined;
|
|
88
|
+
shadowStretch?: number | undefined;
|
|
89
|
+
shadowDirectionX?: number | undefined;
|
|
90
|
+
shadowDirectionZ?: number | undefined;
|
|
91
|
+
shadowGroundNormal?: number[] | Vector3d;
|
|
92
|
+
shadowLight?: any;
|
|
77
93
|
});
|
|
78
94
|
color: any;
|
|
79
95
|
duration: number | undefined;
|
|
80
96
|
transition: string;
|
|
81
|
-
transitionShape:
|
|
97
|
+
transitionShape: Polygon | Ellipse | undefined;
|
|
82
98
|
fading: boolean;
|
|
83
99
|
type: any;
|
|
84
100
|
id: any;
|
|
@@ -88,7 +104,7 @@ export default class Trigger extends Renderable {
|
|
|
88
104
|
};
|
|
89
105
|
bodyDef: {
|
|
90
106
|
type: string;
|
|
91
|
-
shapes:
|
|
107
|
+
shapes: undefined[] | Polygon[] | Ellipse[];
|
|
92
108
|
collisionType: number;
|
|
93
109
|
collisionMask: number;
|
|
94
110
|
isSensor: boolean;
|
|
@@ -107,4 +123,10 @@ export default class Trigger extends Renderable {
|
|
|
107
123
|
onCollisionStart(): void;
|
|
108
124
|
}
|
|
109
125
|
import Renderable from "./renderable.js";
|
|
126
|
+
import type { Polygon } from "../geometries/polygon.ts";
|
|
127
|
+
import type { Ellipse } from "../geometries/ellipse.ts";
|
|
128
|
+
import type { Rect } from "../geometries/rectangle.ts";
|
|
129
|
+
import type { Line } from "../geometries/line.ts";
|
|
130
|
+
import type { Color } from "../math/color.ts";
|
|
131
|
+
import type Container from "./container.js";
|
|
110
132
|
//# sourceMappingURL=trigger.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"trigger.d.ts","sourceRoot":"","sources":["../../src/renderable/trigger.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"trigger.d.ts","sourceRoot":"","sources":["../../src/renderable/trigger.js"],"names":[],"mappings":"AAiEA;IACC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA8DG;IACH,eA9DW,MAAM,KACN,MAAM,YAEd;QAA0B,KAAK;QACL,MAAM;QACqB,MAAM;QACjC,QAAQ;QACF,KAAK;QACX,UAAU;QACD,KAAK;QACd,KAAK;QACL,EAAE;QACQ,SAAS;QACjB,QAAQ;QACT,OAAO;QACP,iBAAiB;QAClB,KAAK;QACJ,WAAW;QACX,MAAM;QACP,mBAAmB;QAClB,gBAAgB;QACjB,aAAa;QACb,aAAa;QACb,WAAW;QACX,YAAY;QACZ,aAAa;QACb,gBAAgB;QAChB,gBAAgB;QACL,kBAAkB,GAA/C,MAAM,EAAE,GAAC,QAAQ;QACE,WAAW;KACtC,EAyFF;IApDA,WAA4C;IAC5C,6BAAiC;IACjC,mBAA+C;IAC/C,+CAAqC;IACrC,gBAAmB;IAInB,UAAyB;IACzB,QAAqB;IACrB,8BAA4B;IAG5B;;MAEC;IAwBD;;;;;;MAMC;IASF;;;OAGG;IACH;;MAQC;IAED;;;OAGG;IACH,+BAwFC;IAED;;;;;OAKG;IACH,yBAIC;CACD;uBA3SsB,iBAAiB;6BASd,0BAA0B;6BAF1B,0BAA0B;0BAG7B,4BAA4B;0BAF5B,uBAAuB;2BAHtB,kBAAkB;2BAChB,gBAAgB"}
|
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
import { Color } from "../../math/color.ts";
|
|
2
|
+
import { on } from "../../system/event.ts";
|
|
3
|
+
import type { Gradient } from "../../video/gradient.js";
|
|
4
|
+
import type Renderer from "../../video/renderer.js";
|
|
5
|
+
import Renderable from "../renderable.js";
|
|
6
|
+
import Text from "../text/text.js";
|
|
7
|
+
/**
|
|
8
|
+
* The name of any event the engine knows about.
|
|
9
|
+
*
|
|
10
|
+
* Derived from `on` rather than naming the `Events` map, which is internal to
|
|
11
|
+
* the event module; this gets the same set without widening that surface.
|
|
12
|
+
*/
|
|
13
|
+
type EventName = Parameters<typeof on>[0];
|
|
14
|
+
/** anything {@link Renderer#setColor} will take */
|
|
15
|
+
type Paint = Color | string | Gradient;
|
|
16
|
+
/** which way the fill grows */
|
|
17
|
+
export type ProgressBarDirection = "left-to-right" | "right-to-left" | "top-to-bottom" | "bottom-to-top";
|
|
18
|
+
/**
|
|
19
|
+
* Everything {@link ProgressBar} takes.
|
|
20
|
+
*/
|
|
21
|
+
export interface ProgressBarSettings {
|
|
22
|
+
/** the bar's full width, in pixels */
|
|
23
|
+
width: number;
|
|
24
|
+
/** the bar's full height, in pixels */
|
|
25
|
+
height: number;
|
|
26
|
+
/** the value that reads as empty */
|
|
27
|
+
min?: number;
|
|
28
|
+
/** the value that reads as full */
|
|
29
|
+
max?: number;
|
|
30
|
+
/** where to start */
|
|
31
|
+
value?: number;
|
|
32
|
+
/** which edge the fill grows from */
|
|
33
|
+
direction?: ProgressBarDirection;
|
|
34
|
+
/** behind the fill; `null` leaves it hollow, showing whatever is behind */
|
|
35
|
+
trackColor?: Paint | null;
|
|
36
|
+
/**
|
|
37
|
+
* the fill itself. A {@link Color} is re-read every frame, so mutating the
|
|
38
|
+
* one you passed animates the bar
|
|
39
|
+
*/
|
|
40
|
+
fillColor?: Paint;
|
|
41
|
+
/** drawn around the track; `null` for none */
|
|
42
|
+
borderColor?: Paint | null;
|
|
43
|
+
/** how thick that border is */
|
|
44
|
+
borderWidth?: number;
|
|
45
|
+
/** how far the fill sits inside the track, per side */
|
|
46
|
+
padding?: number;
|
|
47
|
+
/** corner radius; `0` is square */
|
|
48
|
+
radius?: number;
|
|
49
|
+
/** called whenever the value actually moves */
|
|
50
|
+
onChange?: (value: number, ratio: number) => void;
|
|
51
|
+
/** draw a label over the bar */
|
|
52
|
+
showLabel?: boolean;
|
|
53
|
+
/** the label's font family */
|
|
54
|
+
font?: string;
|
|
55
|
+
/** the label's font size, in pixels */
|
|
56
|
+
fontSize?: number;
|
|
57
|
+
/** the label's colour */
|
|
58
|
+
labelFillStyle?: Paint;
|
|
59
|
+
/** what the label says; the default is a rounded percentage */
|
|
60
|
+
labelFormat?: (value: number, ratio: number) => string;
|
|
61
|
+
/**
|
|
62
|
+
* an event to take the value from, instead of setting it by hand.
|
|
63
|
+
*
|
|
64
|
+
* The bar subscribes for as long as it exists and unsubscribes when it is
|
|
65
|
+
* destroyed, which is the point: a subscription that outlives what it
|
|
66
|
+
* drives is a listener writing into a freed object.
|
|
67
|
+
*/
|
|
68
|
+
bindEvent?: EventName;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* A bar that shows one value between two bounds.
|
|
72
|
+
*
|
|
73
|
+
* A health bar, a shield gauge, a cooldown, a loading bar: all the same
|
|
74
|
+
* object, and the engine's own loading screen is built on this one. Set
|
|
75
|
+
* {@link ProgressBar#value} and it redraws.
|
|
76
|
+
*
|
|
77
|
+
* It draws the track, the fill, the border and the label itself, in that
|
|
78
|
+
* order, which is the point of it being ONE renderable rather than a track
|
|
79
|
+
* sprite with a fill sprite on top. Two renderables at the same place have to
|
|
80
|
+
* be told which is in front, and that question has to be answered again every
|
|
81
|
+
* time either one moves.
|
|
82
|
+
*
|
|
83
|
+
* ## The colour can follow the value
|
|
84
|
+
*
|
|
85
|
+
* `fillColor` is read at draw time rather than copied, so passing a
|
|
86
|
+
* {@link Color} you keep hold of and mutating it is all a value-driven colour
|
|
87
|
+
* takes. That is deliberately not built in, because every game wants a
|
|
88
|
+
* different rule and most want the colour somewhere else too, next to a shader
|
|
89
|
+
* uniform or a glow:
|
|
90
|
+
*
|
|
91
|
+
* ```js
|
|
92
|
+
* const full = new Color().parseCSS("#7fe0ff");
|
|
93
|
+
* const empty = new Color().parseCSS("#ff2a1e");
|
|
94
|
+
* const mixed = new Color();
|
|
95
|
+
*
|
|
96
|
+
* const shield = new ProgressBar(x, y, {
|
|
97
|
+
* width: 190, height: 13,
|
|
98
|
+
* trackColor: null, // a hollow frame
|
|
99
|
+
* borderColor: "rgba(122, 190, 235, 0.8)",
|
|
100
|
+
* padding: 2,
|
|
101
|
+
* fillColor: mixed, // kept, not copied
|
|
102
|
+
* });
|
|
103
|
+
*
|
|
104
|
+
* // each frame
|
|
105
|
+
* mixed.copy(empty).lerp(full, hp);
|
|
106
|
+
* shield.value = hp;
|
|
107
|
+
* ```
|
|
108
|
+
*
|
|
109
|
+
* Blinking is the same story: {@link Renderable#setOpacity} already does it,
|
|
110
|
+
* on whatever clock the game is already keeping.
|
|
111
|
+
* @category UI
|
|
112
|
+
* @example
|
|
113
|
+
* // a loading bar
|
|
114
|
+
* const bar = new ProgressBar(0, 100, {
|
|
115
|
+
* width: renderer.width, height: 4,
|
|
116
|
+
* trackColor: "black", fillColor: "#55aa00",
|
|
117
|
+
* });
|
|
118
|
+
* event.on(event.LOADER_PROGRESS, (progress) => { bar.value = progress; });
|
|
119
|
+
* @example
|
|
120
|
+
* // a label, and a value that is not a fraction
|
|
121
|
+
* const hp = new ProgressBar(20, 20, {
|
|
122
|
+
* width: 200, height: 24,
|
|
123
|
+
* min: 0, max: 100, value: 100,
|
|
124
|
+
* fillColor: "#c0392b", radius: 6,
|
|
125
|
+
* showLabel: true,
|
|
126
|
+
* labelFormat: (v) => `${Math.round(v)} HP`,
|
|
127
|
+
* });
|
|
128
|
+
*/
|
|
129
|
+
export default class ProgressBar extends Renderable {
|
|
130
|
+
/** the value that reads as empty */
|
|
131
|
+
min: number;
|
|
132
|
+
/** the value that reads as full */
|
|
133
|
+
max: number;
|
|
134
|
+
/** which edge the fill grows from */
|
|
135
|
+
direction: ProgressBarDirection;
|
|
136
|
+
/** behind the fill; `null` leaves it hollow */
|
|
137
|
+
trackColor: Paint | null;
|
|
138
|
+
/** the fill. A {@link Color} here is re-read every frame */
|
|
139
|
+
fillColor: Paint;
|
|
140
|
+
/** drawn around the track; `null` for none */
|
|
141
|
+
borderColor: Paint | null;
|
|
142
|
+
/** how thick that border is */
|
|
143
|
+
borderWidth: number;
|
|
144
|
+
/** how far the fill sits inside the track, per side */
|
|
145
|
+
padding: number;
|
|
146
|
+
/** corner radius; `0` is square */
|
|
147
|
+
radius: number;
|
|
148
|
+
/** called whenever the value actually moves */
|
|
149
|
+
onChange?: ((value: number, ratio: number) => void) | undefined;
|
|
150
|
+
/** what the label says */
|
|
151
|
+
labelFormat: (value: number, ratio: number) => string;
|
|
152
|
+
/** the label, when `showLabel` was asked for */
|
|
153
|
+
label?: Text | undefined;
|
|
154
|
+
/** the event the value is taken from, if any */
|
|
155
|
+
readonly bindEvent?: EventName | undefined;
|
|
156
|
+
/**
|
|
157
|
+
* @param x - position of the bar's left edge
|
|
158
|
+
* @param y - position of its top edge
|
|
159
|
+
* @param settings - see {@link ProgressBarSettings}
|
|
160
|
+
*/
|
|
161
|
+
constructor(x: number, y: number, settings: ProgressBarSettings);
|
|
162
|
+
/**
|
|
163
|
+
* Where the bar is now, between {@link ProgressBar#min} and
|
|
164
|
+
* {@link ProgressBar#max}.
|
|
165
|
+
*
|
|
166
|
+
* Writing a value outside that range clamps rather than throwing, since
|
|
167
|
+
* the usual source is a health or a timer that has just gone past its own
|
|
168
|
+
* limit. Writing the value it already has does nothing at all, so
|
|
169
|
+
* `onChange` means the value MOVED.
|
|
170
|
+
*/
|
|
171
|
+
get value(): number;
|
|
172
|
+
set value(v: number);
|
|
173
|
+
/**
|
|
174
|
+
* The value as a fraction, `0` at `min` and `1` at `max`.
|
|
175
|
+
*
|
|
176
|
+
* This is what the fill is drawn from, and what a caller usually wants for
|
|
177
|
+
* anything else keyed to the same number. Read only; set
|
|
178
|
+
* {@link ProgressBar#value}.
|
|
179
|
+
*/
|
|
180
|
+
get ratio(): number;
|
|
181
|
+
/**
|
|
182
|
+
* Set the value, for chaining.
|
|
183
|
+
* @param v - the new value, clamped to the bar's bounds
|
|
184
|
+
* @returns this bar
|
|
185
|
+
*/
|
|
186
|
+
setValue(v: number): this;
|
|
187
|
+
/**
|
|
188
|
+
* Draw the track, the fill, the border and the label, in that order.
|
|
189
|
+
* @param renderer - the renderer to draw with
|
|
190
|
+
*/
|
|
191
|
+
draw(renderer: Renderer): void;
|
|
192
|
+
}
|
|
193
|
+
export {};
|
|
194
|
+
//# sourceMappingURL=progressbar.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"progressbar.d.ts","sourceRoot":"","sources":["../../../src/renderable/ui/progressbar.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,EAAa,MAAM,qBAAqB,CAAC;AAEvD,OAAO,EAAO,EAAE,EAAE,MAAM,uBAAuB,CAAC;AAChD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,KAAK,QAAQ,MAAM,yBAAyB,CAAC;AACpD,OAAO,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AM,CAAC,CAAwB;IACvC,iFAAiF;IACjF,OAAO,CAAC,IAAI,CAAmB;IAC/B,OAAO,CAAC,QAAQ,CAAM;IAEtB;;;;OAIG;gBACS,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,mBAAmB;IAyD/D;;;;;;;;OAQG;IACH,IAAI,KAAK,IAII,MAAM,CAFlB;IAED,IAAI,KAAK,CAAC,CAAC,EAAE,MAAM,EAWlB;IAED;;;;;;OAMG;IACH,IAAI,KAAK,WAGR;IAYD;;;;OAIG;IACH,QAAQ,CAAC,CAAC,EAAE,MAAM;IA8FlB;;;OAGG;IACM,IAAI,CAAC,QAAQ,EAAE,QAAQ;CAoHhC"}
|
|
@@ -4,7 +4,36 @@ import Container from "../container.js";
|
|
|
4
4
|
/**
|
|
5
5
|
* This is a basic clickable and draggable container which you can use in your game UI.
|
|
6
6
|
* Use this for example if you want to display a panel that contains text, images or other UI elements.
|
|
7
|
+
*
|
|
8
|
+
* Regions under the pointer are asked in the order they are drawn, topmost
|
|
9
|
+
* first, and the walk carries on downwards until a handler returns `false`. An
|
|
10
|
+
* element that can overlap another one is therefore not opaque until it says
|
|
11
|
+
* so: by default a widget it covers still answers clicks and still lights up on
|
|
12
|
+
* hover. {@link UIBaseElement#onClick}, {@link UIBaseElement#onRelease} and
|
|
13
|
+
* {@link UIBaseElement#onOver} each consume by returning `false`.
|
|
7
14
|
* @category UI
|
|
15
|
+
* @example
|
|
16
|
+
* // a panel that is opaque to the pointer and comes to the front when picked
|
|
17
|
+
* class Panel extends UIBaseElement {
|
|
18
|
+
* onClick() {
|
|
19
|
+
* this.ancestor.moveToTop(this);
|
|
20
|
+
* return false;
|
|
21
|
+
* }
|
|
22
|
+
* // the frame the pointer crosses in
|
|
23
|
+
* onOver() {
|
|
24
|
+
* return false;
|
|
25
|
+
* }
|
|
26
|
+
* // and every frame after that, when the pointer is already inside and
|
|
27
|
+
* // `onOver` no longer fires
|
|
28
|
+
* onActivateEvent() {
|
|
29
|
+
* super.onActivateEvent();
|
|
30
|
+
* me.input.registerPointerEvent("pointermove", this, () => false);
|
|
31
|
+
* }
|
|
32
|
+
* onDeactivateEvent() {
|
|
33
|
+
* me.input.releasePointerEvent("pointermove", this);
|
|
34
|
+
* super.onDeactivateEvent();
|
|
35
|
+
* }
|
|
36
|
+
* }
|
|
8
37
|
*/
|
|
9
38
|
export default class UIBaseElement extends Container {
|
|
10
39
|
/**
|
|
@@ -65,12 +94,28 @@ export default class UIBaseElement extends Container {
|
|
|
65
94
|
*/
|
|
66
95
|
onMove(_event?: Pointer): void;
|
|
67
96
|
/**
|
|
68
|
-
* function called when the pointer is over the object
|
|
97
|
+
* function called when the pointer is over the object.
|
|
98
|
+
*
|
|
99
|
+
* Fires once, on the frame the pointer crosses into the element. To stay
|
|
100
|
+
* opaque for as long as the pointer rests on it, an element also wants a
|
|
101
|
+
* `"pointermove"` callback registered through
|
|
102
|
+
* {@link input.registerPointerEvent} returning `false`, since by then the
|
|
103
|
+
* pointer is already inside and this no longer runs.
|
|
69
104
|
* @param _event - the event object
|
|
105
|
+
* @returns return false if we need to stop propagating the event, so that an
|
|
106
|
+
* element covered by this one does not also light up on hover
|
|
70
107
|
*/
|
|
71
|
-
onOver(_event?: Pointer): void;
|
|
108
|
+
onOver(_event?: Pointer): boolean | void;
|
|
72
109
|
/**
|
|
73
|
-
* function called when the pointer is leaving the object area
|
|
110
|
+
* function called when the pointer is leaving the object area.
|
|
111
|
+
*
|
|
112
|
+
* Fires when the pointer leaves the element's bounds, and also when it is
|
|
113
|
+
* still inside them but something drawn above has consumed the move, since
|
|
114
|
+
* the pointer is then over that instead.
|
|
115
|
+
*
|
|
116
|
+
* Unlike {@link UIBaseElement#onOver} this one cannot consume the event, on
|
|
117
|
+
* purpose: an element that suppressed its own leave would stay in its hover
|
|
118
|
+
* state after the pointer had gone.
|
|
74
119
|
* @param _event - the event object
|
|
75
120
|
*/
|
|
76
121
|
onOut(_event?: Pointer): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"uibaseelement.d.ts","sourceRoot":"","sources":["../../../src/renderable/ui/uibaseelement.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,OAAO,MAAM,0BAA0B,CAAC;AACpD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAIvD,OAAO,SAAS,MAAM,iBAAiB,CAAC;AAExC
|
|
1
|
+
{"version":3,"file":"uibaseelement.d.ts","sourceRoot":"","sources":["../../../src/renderable/ui/uibaseelement.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,OAAO,MAAM,0BAA0B,CAAC;AACpD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAIvD,OAAO,SAAS,MAAM,iBAAiB,CAAC;AAExC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,MAAM,CAAC,OAAO,OAAO,aAAc,SAAQ,SAAS;IACnD;;;;;OAKG;IACM,QAAQ,UAAQ;IAEzB;;;OAGG;IACH,WAAW,EAAE,OAAO,CAAC;IAErB;;;OAGG;IACH,WAAW,EAAE,OAAO,CAAC;IAErB;;;OAGG;IACH,aAAa,EAAE,MAAM,CAAC;IAEtB;;;OAGG;IACH,UAAU,EAAE,OAAO,CAAC;IAEpB;;;OAGG;IACH,KAAK,EAAE,OAAO,CAAC;IAEf;;;OAGG;IACH,QAAQ,EAAE,OAAO,CAAC;IAGlB,WAAW,EAAE,MAAM,CAAC;IAGpB,UAAU,EAAE,QAAQ,GAAG,SAAS,CAAC;IAEjC;;;;;OAKG;gBACS,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,EAAE,MAAM;IA+CxD;;;;OAIG;IAEH,OAAO,CAAC,MAAM,CAAC,EAAE,OAAO,GAAG,OAAO;IAuClC;;;OAGG;IAEH,MAAM,CAAC,MAAM,CAAC,EAAE,OAAO,GAAG,IAAI;IAI9B;;;;;;;;;;;OAWG;IAEH,MAAM,CAAC,MAAM,CAAC,EAAE,OAAO,GAAG,OAAO,GAAG,IAAI;IAuBxC;;;;;;;;;;;OAWG;IAEH,KAAK,CAAC,MAAM,CAAC,EAAE,OAAO,GAAG,IAAI;IAmB7B;;;;OAIG;IAEH,SAAS,CAAC,MAAM,CAAC,EAAE,OAAO,GAAG,OAAO;IAkBpC;;;OAGG;IACH,MAAM,IAAI,IAAI;CA4Dd"}
|
|
@@ -74,12 +74,28 @@ export default class UISpriteElement extends Sprite {
|
|
|
74
74
|
*/
|
|
75
75
|
onClick(_event?: Pointer): boolean;
|
|
76
76
|
/**
|
|
77
|
-
* function called when the pointer is over the object
|
|
77
|
+
* function called when the pointer is over the object.
|
|
78
|
+
*
|
|
79
|
+
* Fires once, on the frame the pointer crosses into the element. To stay
|
|
80
|
+
* opaque for as long as the pointer rests on it, an element also wants a
|
|
81
|
+
* `"pointermove"` callback registered through
|
|
82
|
+
* {@link input.registerPointerEvent} returning `false`, since by then the
|
|
83
|
+
* pointer is already inside and this no longer runs.
|
|
78
84
|
* @param _event - the event object
|
|
85
|
+
* @returns return false if we need to stop propagating the event, so that an
|
|
86
|
+
* element covered by this one does not also light up on hover
|
|
79
87
|
*/
|
|
80
|
-
onOver(_event?: Pointer): void;
|
|
88
|
+
onOver(_event?: Pointer): boolean | void;
|
|
81
89
|
/**
|
|
82
|
-
* function called when the pointer is leaving the object area
|
|
90
|
+
* function called when the pointer is leaving the object area.
|
|
91
|
+
*
|
|
92
|
+
* Fires when the pointer leaves the element's bounds, and also when it is
|
|
93
|
+
* still inside them but something drawn above has consumed the move, since
|
|
94
|
+
* the pointer is then over that instead.
|
|
95
|
+
*
|
|
96
|
+
* Unlike {@link UISpriteElement#onOver} this one cannot consume the event, on
|
|
97
|
+
* purpose: an element that suppressed its own leave would stay in its hover
|
|
98
|
+
* state after the pointer had gone.
|
|
83
99
|
* @param _event - the event object
|
|
84
100
|
*/
|
|
85
101
|
onOut(_event?: Pointer): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"uispriteelement.d.ts","sourceRoot":"","sources":["../../../src/renderable/ui/uispriteelement.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,OAAO,MAAM,0BAA0B,CAAC;AAEpD,OAAO,MAAM,MAAM,gBAAgB,CAAC;AAEpC;;;GAGG;AACH,MAAM,CAAC,OAAO,OAAO,eAAgB,SAAQ,MAAM;IAClD;;;;;OAKG;IACM,QAAQ,UAAQ;IAEzB;;;OAGG;IACH,WAAW,EAAE,OAAO,CAAC;IAErB;;;OAGG;IACH,aAAa,EAAE,MAAM,CAAC;IAEtB;;;OAGG;IACH,UAAU,EAAE,OAAO,CAAC;IAEpB;;;OAGG;IACH,KAAK,EAAE,OAAO,CAAC;IAGf,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,OAAO,CAAC;IAElB;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA4BG;gBAEF,CAAC,EAAE,MAAM,EACT,CAAC,EAAE,MAAM,EACT,QAAQ,EAAE;QAAE,KAAK,EAAE,GAAG,CAAC;QAAC,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;KAAE;IAyC7C;;;;OAIG;IAEH,OAAO,CAAC,MAAM,CAAC,EAAE,OAAO,GAAG,OAAO;IAelC
|
|
1
|
+
{"version":3,"file":"uispriteelement.d.ts","sourceRoot":"","sources":["../../../src/renderable/ui/uispriteelement.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,OAAO,MAAM,0BAA0B,CAAC;AAEpD,OAAO,MAAM,MAAM,gBAAgB,CAAC;AAEpC;;;GAGG;AACH,MAAM,CAAC,OAAO,OAAO,eAAgB,SAAQ,MAAM;IAClD;;;;;OAKG;IACM,QAAQ,UAAQ;IAEzB;;;OAGG;IACH,WAAW,EAAE,OAAO,CAAC;IAErB;;;OAGG;IACH,aAAa,EAAE,MAAM,CAAC;IAEtB;;;OAGG;IACH,UAAU,EAAE,OAAO,CAAC;IAEpB;;;OAGG;IACH,KAAK,EAAE,OAAO,CAAC;IAGf,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,OAAO,CAAC;IAElB;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA4BG;gBAEF,CAAC,EAAE,MAAM,EACT,CAAC,EAAE,MAAM,EACT,QAAQ,EAAE;QAAE,KAAK,EAAE,GAAG,CAAC;QAAC,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;KAAE;IAyC7C;;;;OAIG;IAEH,OAAO,CAAC,MAAM,CAAC,EAAE,OAAO,GAAG,OAAO;IAelC;;;;;;;;;;;OAWG;IAEH,MAAM,CAAC,MAAM,CAAC,EAAE,OAAO,GAAG,OAAO,GAAG,IAAI;IAgBxC;;;;;;;;;;;OAWG;IAEH,KAAK,CAAC,MAAM,CAAC,EAAE,OAAO,GAAG,IAAI;IAmB7B;;;;OAIG;IAEH,SAAS,CAAC,MAAM,CAAC,EAAE,OAAO,GAAG,OAAO;IAkBpC;;;OAGG;IACH,MAAM,IAAI,IAAI;CAyCd"}
|
|
@@ -76,7 +76,7 @@ declare class ObjectPool {
|
|
|
76
76
|
/**
|
|
77
77
|
* Pull a new instance of the requested object (if added into the object pool)
|
|
78
78
|
* @param {string} name - as used in {@link pool.register}
|
|
79
|
-
* @param {...*}
|
|
79
|
+
* @param {...*} args - arguments to be passed when instantiating/reinitializing the object
|
|
80
80
|
* @returns {object} the instance of the requested object
|
|
81
81
|
* @example
|
|
82
82
|
* me.pool.register("bullet", BulletEntity, true);
|
|
@@ -94,7 +94,7 @@ declare class ObjectPool {
|
|
|
94
94
|
* app.world.removeChild(enemy);
|
|
95
95
|
* app.world.removeChild(bullet);
|
|
96
96
|
*/
|
|
97
|
-
pull(name: string, ...args
|
|
97
|
+
pull(name: string, ...args: any[]): object;
|
|
98
98
|
/**
|
|
99
99
|
* purge the object pool from any inactive object <br>
|
|
100
100
|
* Object pooling must be enabled for this function to work<br>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"legacy_pool.d.ts","sourceRoot":"","sources":["../../src/system/legacy_pool.js"],"names":[],"mappings":"AASA;;;;;GAKG;AACH,kEAEC;;AAmND;;;;;;;;;;;;;;GAcG;AACH,+BAA8B;AAhO9B;;;;;;;;;;;;GAYG;AACH;IAEE,gBAAqB;IACrB,yBAAyB;IAEzB;;;;;;;;;;;;;;OAcG;IACH,mBARU,OAAO,CAQY;IAG9B;;;;;;;;;;;;;;;;;;;;;;;OAuBG;IACH,oBAhBW,MAAM,YACN,MAAM,cACN,OAAO,QAsCjB;IAED;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,WAnBW,MAAM,
|
|
1
|
+
{"version":3,"file":"legacy_pool.d.ts","sourceRoot":"","sources":["../../src/system/legacy_pool.js"],"names":[],"mappings":"AASA;;;;;GAKG;AACH,kEAEC;;AAmND;;;;;;;;;;;;;;GAcG;AACH,+BAA8B;AAhO9B;;;;;;;;;;;;GAYG;AACH;IAEE,gBAAqB;IACrB,yBAAyB;IAEzB;;;;;;;;;;;;;;OAcG;IACH,mBARU,OAAO,CAQY;IAG9B;;;;;;;;;;;;;;;;;;;;;;;OAuBG;IACH,oBAhBW,MAAM,YACN,MAAM,cACN,OAAO,QAsCjB;IAED;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,WAnBW,MAAM,WACH,GAAC,EAAA,GACF,MAAM,CAsClB;IAED;;;;OAIG;IACH,cAOC;IAED;;;;;;;;;OASG;IACH,UAJW,MAAM,iBACN,OAAO,GACL,OAAO,CAgBnB;IAED;;;;OAIG;IACH,aAHW,MAAM,GACJ,OAAO,CAInB;IAED;;;;;;;;;;OAUG;IACH,cAPW,MAAM,GACJ,OAAO,CAcnB;IAED;;;OAGG;IACH,oBAFa,MAAM,CAIlB;CACD"}
|
package/build/system/pool.d.ts
CHANGED
|
@@ -12,6 +12,16 @@ export interface CreatePoolOptions<T, A extends unknown[]> {
|
|
|
12
12
|
reset?: Reset<A>;
|
|
13
13
|
release?: Release;
|
|
14
14
|
}
|
|
15
|
+
/**
|
|
16
|
+
* Register a pool instance to the pool registry.
|
|
17
|
+
*
|
|
18
|
+
* Public because `pool.js` re-exports it. Marked internal it was stripped
|
|
19
|
+
* from the declarations while that re-export kept naming it, which left the
|
|
20
|
+
* public `pool` module exporting something no longer declared.
|
|
21
|
+
* @param key - the name this pool is reachable by
|
|
22
|
+
* @param pool - the pool instance to register under it
|
|
23
|
+
*/
|
|
24
|
+
export declare const registerPool: (key: string, pool: Pool<any, any[]>) => void;
|
|
15
25
|
export declare const createPool: <T, A extends unknown[]>(options: (...args: A) => CreatePoolOptions<T, A>) => Pool<T, A>;
|
|
16
26
|
export {};
|
|
17
27
|
//# sourceMappingURL=pool.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pool.d.ts","sourceRoot":"","sources":["../../src/system/pool.ts"],"names":[],"mappings":"AAOA,MAAM,WAAW,IAAI,CAAC,CAAC,EAAE,CAAC,SAAS,OAAO,EAAE;IAC3C,GAAG,CAAC,GAAG,IAAI,EAAE,CAAC,GAAG,CAAC,CAAC;IACnB,OAAO,CAAC,MAAM,EAAE,CAAC,GAAG,IAAI,CAAC;IACzB,KAAK,IAAI,IAAI,CAAC;IACd,IAAI,IAAI,MAAM,CAAC;IACf,IAAI,IAAI,MAAM,CAAC;CACf;AAED,KAAK,KAAK,CAAC,CAAC,SAAS,OAAO,EAAE,IAAI,CAAC,CAAC,GAAG,IAAI,EAAE,CAAC,KAAK,IAAI,CAAC,GAAG,SAAS,CAAC;AACrE,KAAK,OAAO,GAAG,CAAC,MAAM,IAAI,CAAC,GAAG,SAAS,CAAC;AAExC,MAAM,WAAW,iBAAiB,CAAC,CAAC,EAAE,CAAC,SAAS,OAAO,EAAE;IACxD,QAAQ,EAAE,CAAC,CAAC;IACZ,KAAK,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC;IACjB,OAAO,CAAC,EAAE,OAAO,CAAC;CAClB;
|
|
1
|
+
{"version":3,"file":"pool.d.ts","sourceRoot":"","sources":["../../src/system/pool.ts"],"names":[],"mappings":"AAOA,MAAM,WAAW,IAAI,CAAC,CAAC,EAAE,CAAC,SAAS,OAAO,EAAE;IAC3C,GAAG,CAAC,GAAG,IAAI,EAAE,CAAC,GAAG,CAAC,CAAC;IACnB,OAAO,CAAC,MAAM,EAAE,CAAC,GAAG,IAAI,CAAC;IACzB,KAAK,IAAI,IAAI,CAAC;IACd,IAAI,IAAI,MAAM,CAAC;IACf,IAAI,IAAI,MAAM,CAAC;CACf;AAED,KAAK,KAAK,CAAC,CAAC,SAAS,OAAO,EAAE,IAAI,CAAC,CAAC,GAAG,IAAI,EAAE,CAAC,KAAK,IAAI,CAAC,GAAG,SAAS,CAAC;AACrE,KAAK,OAAO,GAAG,CAAC,MAAM,IAAI,CAAC,GAAG,SAAS,CAAC;AAExC,MAAM,WAAW,iBAAiB,CAAC,CAAC,EAAE,CAAC,SAAS,OAAO,EAAE;IACxD,QAAQ,EAAE,CAAC,CAAC;IACZ,KAAK,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC;IACjB,OAAO,CAAC,EAAE,OAAO,CAAC;CAClB;AAKD;;;;;;;;GAQG;AACH,eAAO,MAAM,YAAY,GAAI,KAAK,MAAM,EAAE,MAAM,IAAI,CAAC,GAAG,EAAE,GAAG,EAAE,CAAC,SAE/D,CAAC;AAQF,eAAO,MAAM,UAAU,GAAI,CAAC,EAAE,CAAC,SAAS,OAAO,EAAE,EAChD,SAAS,CAAC,GAAG,IAAI,EAAE,CAAC,KAAK,iBAAiB,CAAC,CAAC,EAAE,CAAC,CAAC,KAC9C,IAAI,CAAC,CAAC,EAAE,CAAC,CA0EX,CAAC"}
|
package/build/tweens/tween.d.ts
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
import { EasingFunction } from "./easing.js";
|
|
2
2
|
import { InterpolationFunction } from "./interpolation.js";
|
|
3
|
+
/**
|
|
4
|
+
* Called once when a tween starts, with `this` bound to the tweened object.
|
|
5
|
+
* @see Tween#onStart
|
|
6
|
+
*/
|
|
7
|
+
export type OnStartCallback<T> = (this: T) => void;
|
|
8
|
+
/**
|
|
9
|
+
* Called on every tween step with the eased progress in `[0, 1]`, and `this`
|
|
10
|
+
* bound to the tweened object.
|
|
11
|
+
* @see Tween#onUpdate
|
|
12
|
+
*/
|
|
13
|
+
export type OnUpdateCallback<T> = (this: T, value: number) => void;
|
|
14
|
+
/**
|
|
15
|
+
* Called once when a tween finishes, with `this` bound to the tweened object.
|
|
16
|
+
* @see Tween#onComplete
|
|
17
|
+
*/
|
|
18
|
+
export type OnCompleteCallback<T> = (this: T) => void;
|
|
3
19
|
/**
|
|
4
20
|
* A tweening engine for smoothly interpolating object properties over time.
|
|
5
21
|
* Based on <a href="https://github.com/sole/Tween.js">tween.js</a> with
|
|
@@ -140,12 +156,43 @@ export default class Tween {
|
|
|
140
156
|
onComplete(onCompleteCallback: OnCompleteCallback<object>): this;
|
|
141
157
|
/**
|
|
142
158
|
* Available easing functions, accessed via `Tween.Easing`.
|
|
143
|
-
*
|
|
144
|
-
*
|
|
159
|
+
*
|
|
160
|
+
* Eleven families, each providing `In`, `Out` and `InOut`. `In` applies the
|
|
161
|
+
* curve at the start, `Out` at the end, and `InOut` at both. `Out` is what
|
|
162
|
+
* most UI wants: the value arrives decisively rather than creeping in.
|
|
163
|
+
*
|
|
164
|
+
* | family | shape | reach for it when |
|
|
165
|
+
* | --- | --- | --- |
|
|
166
|
+
* | `Linear.None` | no curve at all | the value IS the progress, e.g. a loading bar |
|
|
167
|
+
* | `Quadratic` `Cubic` `Quartic` `Quintic` | progressively sharper power curves | general motion; higher powers start slower and finish harder |
|
|
168
|
+
* | `Sinusoidal` | gentlest of all | a drift or a breath that should not call attention |
|
|
169
|
+
* | `Exponential` | extreme, near-instant at one end | something that snaps |
|
|
170
|
+
* | `Circular` | hard, like the quarter of a circle | a mechanical slide |
|
|
171
|
+
* | `Back` | **overshoots past the target and settles back** | impact: a stamp, a button press, anything that should land rather than arrive |
|
|
172
|
+
* | `Elastic` | overshoots repeatedly, oscillating | springy, cartoon motion |
|
|
173
|
+
* | `Bounce` | lands and bounces, settling | something falling onto a surface |
|
|
174
|
+
*
|
|
175
|
+
* `Back` and `Elastic` overshoot, so the value LEAVES the range between
|
|
176
|
+
* your start and end: clamp anything that cannot take it, an opacity or a
|
|
177
|
+
* colour channel in particular. Note the direction of the overshoot follows
|
|
178
|
+
* the direction of travel, so a value tweened DOWN to its target overshoots
|
|
179
|
+
* below it.
|
|
180
|
+
* @see https://easings.net/ for a visual reference of every curve
|
|
145
181
|
* @example
|
|
146
182
|
* me.Tween.Easing.Quadratic.InOut
|
|
147
183
|
* me.Tween.Easing.Bounce.Out
|
|
148
184
|
* me.Tween.Easing.Elastic.In
|
|
185
|
+
* @example
|
|
186
|
+
* // a stamp: scale falls to 1 and springs through it
|
|
187
|
+
* const driver = { scale: 5 };
|
|
188
|
+
* new me.Tween(driver)
|
|
189
|
+
* .to({ scale: 1 }, { duration: 420 })
|
|
190
|
+
* .easing(me.Tween.Easing.Back.Out)
|
|
191
|
+
* .onUpdate(() => {
|
|
192
|
+
* label.currentTransform.identity();
|
|
193
|
+
* label.scale(driver.scale);
|
|
194
|
+
* })
|
|
195
|
+
* .start();
|
|
149
196
|
*/
|
|
150
197
|
static get Easing(): {
|
|
151
198
|
Linear: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tween.d.ts","sourceRoot":"","sources":["../../src/tweens/tween.ts"],"names":[],"mappings":"AAWA,OAAO,EAAU,cAAc,EAAE,MAAM,aAAa,CAAC;AACrD,OAAO,EAAiB,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"tween.d.ts","sourceRoot":"","sources":["../../src/tweens/tween.ts"],"names":[],"mappings":"AAWA,OAAO,EAAU,cAAc,EAAE,MAAM,aAAa,CAAC;AACrD,OAAO,EAAiB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,MAAM,CAAC,KAAK,EAAE,MAAM;IAKpB;;;;OAIG;IACH,WAAW,CAAC,MAAM,EAAE,MAAM;IAK1B;;;;;OAKG;IACH,IAAI,CAAC,IAAI,EAAE,OAAO;IAKlB;;;;OAIG;IACH,MAAM,CAAC,MAAM,EAAE,cAAc;IAK7B;;;;OAIG;IACH,aAAa,CAAC,aAAa,EAAE,qBAAqB;IAKlD;;;;OAIG;IACH,KAAK,CAAC,GAAG,MAAM,EAAE,KAAK,EAAE;IAKxB;;;;OAIG;IACH,OAAO,CAAC,eAAe,EAAE,eAAe,CAAC,MAAM,CAAC;IAKhD;;;;OAIG;IACH,QAAQ,CAAC,gBAAgB,EAAE,gBAAgB,CAAC,MAAM,CAAC;IAKnD;;;;OAIG;IACH,UAAU,CAAC,kBAAkB,EAAE,kBAAkB,CAAC,MAAM,CAAC;IA0HzD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAuCG;IACH,MAAM,KAAK,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MAEhB;IAED;;;;;;;OAOG;IACH,MAAM,KAAK,aAAa;;;;MAEvB;CACD;AAED,eAAO,MAAM,SAAS,wDASpB,CAAC"}
|
|
@@ -8,21 +8,45 @@
|
|
|
8
8
|
* @import {Matrix2d} from "../../math/matrix2d.ts";
|
|
9
9
|
* @import {Bounds} from "../../physics/bounds.ts";
|
|
10
10
|
* @import {default as Texture2d} from "../texture/texture2d.ts";
|
|
11
|
+
* @import {Matrix3d} from "../../math/matrix3d.ts";
|
|
12
|
+
* @import Mesh from "../../renderable/mesh.js";
|
|
13
|
+
* @import {ApplicationSettings} from "../../application/settings.ts";
|
|
14
|
+
* @import {Box3d} from "../../geometries/box3d.ts";
|
|
15
|
+
* @import {Sphere} from "../../geometries/sphere.ts";
|
|
11
16
|
*/
|
|
12
17
|
/**
|
|
13
18
|
* a canvas renderer object
|
|
14
19
|
* @category Rendering
|
|
15
20
|
*/
|
|
16
21
|
export default class CanvasRenderer extends Renderer {
|
|
17
|
-
cache: TextureCache;
|
|
18
22
|
onGameReset: () => void;
|
|
19
23
|
/**
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
+
* Capture the current frame into a {@link Texture2d} — the Canvas-renderer
|
|
25
|
+
* counterpart of {@link WebGLRenderer#toFrameTexture}, keeping the
|
|
26
|
+
* `toDataURL` / `toBlob` / `toImageBitmap` family renderer-complete. Backed
|
|
27
|
+
* by an offscreen `<canvas>` copy of the drawing buffer (Canvas rendering is
|
|
28
|
+
* immediate, so no flush is needed). Custom shaders don't run under the
|
|
29
|
+
* Canvas renderer, so the result is a plain drawable for CPU-side reuse
|
|
30
|
+
* rather than a live shader input.
|
|
31
|
+
* @param {object} [options]
|
|
32
|
+
* @param {Texture2d|null} [options.target] - controls the destination: omit
|
|
33
|
+
* for the shared renderer slot (default); pass a capture previously
|
|
34
|
+
* returned by this method to refresh it in place; pass `null` to mint a
|
|
35
|
+
* fresh, caller-owned capture (mirrors {@link WebGLRenderer#toFrameTexture})
|
|
36
|
+
* @param {Bounds|{x: number, y: number, width: number, height: number}} [options.region] - capture
|
|
37
|
+
* only this sub-region (canvas pixels, top-left origin). A {@link Bounds}
|
|
38
|
+
* (or any `{x, y, width, height}`); from a {@link Rect} pass `rect.getBounds()`.
|
|
39
|
+
* @returns {Texture2d} a texture holding the captured frame
|
|
24
40
|
*/
|
|
25
|
-
|
|
41
|
+
toFrameTexture(options?: {
|
|
42
|
+
target?: Texture2d | null | undefined;
|
|
43
|
+
region?: Bounds | {
|
|
44
|
+
x: number;
|
|
45
|
+
y: number;
|
|
46
|
+
width: number;
|
|
47
|
+
height: number;
|
|
48
|
+
} | undefined;
|
|
49
|
+
}): Texture2d;
|
|
26
50
|
/**
|
|
27
51
|
* set the current blend mode for this renderer. <br>
|
|
28
52
|
* This renderer supports every mode below except `"none"`: <br>
|
|
@@ -195,17 +219,6 @@ export default class CanvasRenderer extends Renderer {
|
|
|
195
219
|
* @param {number} radii - The corner radius.
|
|
196
220
|
*/
|
|
197
221
|
roundRect(x: number, y: number, width: number, height: number, radii: number): void;
|
|
198
|
-
/**
|
|
199
|
-
* stroke the given shape or the current defined path
|
|
200
|
-
* @param {Rect|RoundRect|Polygon|Line|Ellipse|Bounds} [shape] - a shape object to stroke
|
|
201
|
-
* @param {boolean} [fill=false] - fill the shape with the current color if true
|
|
202
|
-
*/
|
|
203
|
-
stroke(shape?: Rect | RoundRect | Polygon | Line | Ellipse | Bounds, fill?: boolean): void;
|
|
204
|
-
/**
|
|
205
|
-
* fill the given shape or the current defined path
|
|
206
|
-
* @param {Rect|RoundRect|Polygon|Line|Ellipse|Bounds} [shape] - a shape object to fill
|
|
207
|
-
*/
|
|
208
|
-
fill(shape?: Rect | RoundRect | Polygon | Line | Ellipse | Bounds): void;
|
|
209
222
|
/**
|
|
210
223
|
* add a straight line from the current point to the start of the current sub-path. If the shape has already been closed or has only one point, this function does nothing
|
|
211
224
|
*/
|
|
@@ -317,13 +330,11 @@ export default class CanvasRenderer extends Renderer {
|
|
|
317
330
|
transform(a: Matrix2d | Matrix3d | number, b?: number, c?: number, d?: number, e?: number, f?: number): void;
|
|
318
331
|
}
|
|
319
332
|
import Renderer from "./../renderer.js";
|
|
320
|
-
import
|
|
333
|
+
import type { default as Texture2d } from "../texture/texture2d.ts";
|
|
334
|
+
import type { Bounds } from "../../physics/bounds.ts";
|
|
321
335
|
import { Color } from "./../../math/color.ts";
|
|
322
|
-
import type
|
|
323
|
-
import type { RoundRect } from "./../../geometries/roundrect.ts";
|
|
336
|
+
import type Mesh from "../../renderable/mesh.js";
|
|
324
337
|
import type { Polygon } from "../../geometries/polygon.ts";
|
|
325
|
-
import type { Line } from "./../../geometries/line.ts";
|
|
326
|
-
import type { Ellipse } from "./../../geometries/ellipse.ts";
|
|
327
|
-
import type { Bounds } from "../../physics/bounds.ts";
|
|
328
338
|
import type { Matrix2d } from "../../math/matrix2d.ts";
|
|
339
|
+
import type { Matrix3d } from "../../math/matrix3d.ts";
|
|
329
340
|
//# sourceMappingURL=canvas_renderer.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"canvas_renderer.d.ts","sourceRoot":"","sources":["../../../src/video/canvas/canvas_renderer.js"],"names":[],"mappings":"AAcA
|
|
1
|
+
{"version":3,"file":"canvas_renderer.d.ts","sourceRoot":"","sources":["../../../src/video/canvas/canvas_renderer.js"],"names":[],"mappings":"AAcA;;;;;;;;;;;;;;;GAeG;AAEH;;;GAGG;AACH;IAiBE;;;OAGG;IACH,oBAAmC;IAiCnC,wBAEC;IAyBD;;;OAGG;IACH,8CAA4B;IAG7B;;;;;;;;;;;;;;;;;OAiBG;IACH,yBATG;QAAiC,MAAM;QAIwC,MAAM;eAAlE,MAAM;eAAK,MAAM;mBAAS,MAAM;oBAAU,MAAM;;KAGnE,GAAU,SAAS,CA8ErB;IAxBE;;;OAGG;IACH,mBAA0B;IAiD7B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAyCG;IACH,oBAHW,MAAM,GACJ,MAAM,CA2ClB;IAWD;;;;OAIG;IACH,mBAHW,KAAK,GAAC,MAAM,WACZ,OAAO,QAajB;IAED;;;;;;OAMG;IACH,aALW,MAAM,KACN,MAAM,SACN,MAAM,UACN,MAAM,QAIhB;IAED;;;;;;;;;;;OAWG;IACH,qBAVW,gBAAgB,GAAC,eAAe,GAAC,gBAAgB,GAAC,iBAAiB,GAAC,WAAW,GAAC,eAAe,GAAC,UAAU,WAC1G,MAAM,GACJ,aAAa,CAezB;IAiID;;;;;;;;OAQG;IACH,qBAPW,aAAa,KACb,MAAM,KACN,MAAM,SACN,MAAM,UACN,MAAM,QAiBhB;IAED;;;;;;;;;;;;;;;;;;;OAmBG;IACH,eAFW,IAAI,QAwOd;IA1LE;;;OAGG;IACH,kEAAyD;IACzD;;;OAGG;IACH,uFAA2D;IAa5D;;;OAGG;IACH,o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;OAGG;IACH,kBAFa,MAAM,CAIlB;IA6BD;;;OAGG;IACH,oBAXU,MAAM,EAcf;IAjBD;;;;;OAKG;IACH,gBAHU,MAAM,CAKf;IAWD;;;;;;;;;OASG;IACH,gBAPW,QAAQ,GAAC,QAAQ,GAAC,MAAM,MACxB,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,QAKhB;IAED;;;;;;;;;OASG;IACH,aAPW,QAAQ,GAAC,QAAQ,GAAC,MAAM,MACxB,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,QA+BhB;IA8GC;;;OAGG;IACH,2CAAkC;CAgGpC;qBAnjDoB,kBAAkB;yBACd,uBAAuB;0CAYT,yBAAyB;4BADvC,yBAAyB;sBAtB5B,uBAAuB;sBAyBxB,0BAA0B;6BAPrB,6BAA6B;8BAG5B,wBAAwB;8BAGxB,wBAAwB"}
|
|
@@ -1,3 +1,2 @@
|
|
|
1
1
|
export const wgslFragment: "\nstruct BlendUniforms {\n\tuBlendMode : f32,\n};\n@group(3) @binding(0) var<uniform> fx : BlendUniforms;\n@group(3) @binding(1) var backdrop : texture_2d<f32>;\n@group(3) @binding(2) var backdrop_sampler : sampler;\n\n// HardLight(Cb, Cs) \u2014 also the kernel for Overlay, which the W3C spec\n// defines as HardLight with the arguments swapped\nfn ME_hardLight(b : vec3f, s : vec3f) -> vec3f {\n\tlet lo = 2.0 * b * s;\n\tlet hi = 1.0 - 2.0 * (1.0 - b) * (1.0 - s);\n\treturn mix(lo, hi, step(vec3f(0.5), s));\n}\n\nfn ME_softLight(b : vec3f, s : vec3f) -> vec3f {\n\tlet d = mix(((16.0 * b - 12.0) * b + 4.0) * b, sqrt(b), step(vec3f(0.25), b));\n\tlet lo = b - (1.0 - 2.0 * s) * b * (1.0 - b);\n\tlet hi = b + (2.0 * s - 1.0) * (d - b);\n\treturn mix(lo, hi, step(vec3f(0.5), s));\n}\n\n// Cb == 0 wins over Cs == 1, so it is applied last\nfn ME_colorDodge(b : vec3f, s : vec3f) -> vec3f {\n\tvar r = min(vec3f(1.0), b / max(1.0 - s, vec3f(1e-4)));\n\tr = mix(r, vec3f(1.0), step(vec3f(1.0), s));\n\treturn mix(r, vec3f(0.0), step(b, vec3f(0.0)));\n}\n\n// Cb == 1 wins over Cs == 0, so it is applied last\nfn ME_colorBurn(b : vec3f, s : vec3f) -> vec3f {\n\tvar r = 1.0 - min(vec3f(1.0), (1.0 - b) / max(s, vec3f(1e-4)));\n\tr = mix(r, vec3f(0.0), step(s, vec3f(0.0)));\n\treturn mix(r, vec3f(1.0), step(vec3f(1.0), b));\n}\n\nfn ME_blend(b : vec3f, s : vec3f) -> vec3f {\n\tif (fx.uBlendMode < 0.5) { return abs(b - s); }\n\tif (fx.uBlendMode < 1.5) { return ME_hardLight(s, b); }\n\tif (fx.uBlendMode < 2.5) { return ME_hardLight(b, s); }\n\tif (fx.uBlendMode < 3.5) { return ME_colorDodge(b, s); }\n\tif (fx.uBlendMode < 4.5) { return ME_colorBurn(b, s); }\n\tif (fx.uBlendMode < 5.5) { return ME_softLight(b, s); }\n\tif (fx.uBlendMode < 6.5) { return min(b, s); }\n\treturn max(b, s);\n}\n\nfn apply(color : vec4f, uv : vec2f) -> vec4f {\n\t// sampled BEFORE any branch, so plain textureSampleLevel is safe here\n\tlet Cb = textureSampleLevel(backdrop, backdrop_sampler, screen_uv, 0.0).rgb;\n\tlet a = color.a;\n\tlet Cs = color.rgb / max(a, 1e-4);\n\tlet B = clamp(ME_blend(Cb, Cs), vec3f(0.0), vec3f(1.0));\n\treturn vec4f(a * B, a);\n}\n";
|
|
2
|
-
import ShaderEffect from "./shadereffect.js";
|
|
3
2
|
//# sourceMappingURL=blendEffect.d.ts.map
|