melonjs 20.6.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 +10 -3
- package/build/index.d.ts.map +1 -1
- package/build/index.js +23361 -20195
- 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/lang/deprecated.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 +36 -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/lighting/light2d.d.ts +68 -2
- package/build/lighting/light2d.d.ts.map +1 -1
- package/build/lighting/light3d.d.ts.map +1 -1
- package/build/loader/loader.d.ts +63 -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/fontface.d.ts +2 -0
- package/build/loader/parsers/fontface.d.ts.map +1 -1
- package/build/loader/parsers/mtl.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 +152 -3
- package/build/physics/adapter.d.ts.map +1 -1
- package/build/physics/builtin/body.d.ts +9 -18
- 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/sat.d.ts.map +1 -1
- package/build/physics/builtin/sat3d.d.ts +46 -0
- package/build/physics/builtin/sat3d.d.ts.map +1 -1
- package/build/physics/physicseditor.d.ts +2 -0
- package/build/physics/physicseditor.d.ts.map +1 -0
- 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 +14 -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 +306 -5
- 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 +129 -28
- package/build/renderable/renderable.d.ts.map +1 -1
- package/build/renderable/sprite.d.ts +77 -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 +39 -14
- 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/state/stage.d.ts +22 -0
- package/build/state/stage.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/buffer/vertex.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/meshmaterial.d.ts +2 -0
- package/build/video/gpu/meshmaterial.d.ts.map +1 -0
- 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 +13 -1
- 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 +2 -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/shaders/multitexture-lit.d.ts.map +1 -1
- 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/lit_quad_batcher.d.ts +17 -0
- package/build/video/webgpu/batchers/lit_quad_batcher.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/texture/store.d.ts.map +1 -1
- package/build/video/webgpu/webgpu_renderer.d.ts +8 -75
- package/build/video/webgpu/webgpu_renderer.d.ts.map +1 -1
- package/package.json +1 -1
- package/skills/melonjs-3d/SKILL.md +293 -19
- package/skills/melonjs-3d-assets/SKILL.md +123 -13
- 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-lighting/SKILL.md +45 -1
- package/skills/melonjs-loading-assets/SKILL.md +1 -1
- package/skills/melonjs-particles-and-trails/SKILL.md +106 -4
- package/skills/melonjs-performance/SKILL.md +79 -2
- package/skills/melonjs-physics/SKILL.md +420 -29
- package/skills/melonjs-renderables/SKILL.md +15 -1
- package/skills/melonjs-scenes-and-state/SKILL.md +121 -1
- package/skills/melonjs-tilemaps/SKILL.md +9 -0
- 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
|
@@ -24,11 +24,60 @@ import type WebGLRenderer from "../video/webgl/webgl_renderer.js";
|
|
|
24
24
|
* allocation, no renderer reference held.
|
|
25
25
|
* @category Lighting
|
|
26
26
|
* @see stage.lights
|
|
27
|
+
* @see [Lights example](https://melonjs.github.io/melonJS/examples/#/lights) — several coloured lights over a night scene
|
|
28
|
+
* @see [Normal Map example](https://melonjs.github.io/melonJS/examples/#/normal-map) — per-pixel lighting and specular highlights
|
|
29
|
+
* @see [SpriteIlluminator example](https://melonjs.github.io/melonJS/examples/#/sprite-illuminator) — an authored normal-map workflow
|
|
30
|
+
* @example
|
|
31
|
+
* // A soft glowing spot, the simplest case. Add it like any renderable;
|
|
32
|
+
* // it registers itself with the active Stage on activation.
|
|
33
|
+
* const torch = new Light2d(x, y, 160, 160, "#ffcc88", 0.9);
|
|
34
|
+
* app.world.addChild(torch);
|
|
35
|
+
*
|
|
36
|
+
* // darkness for it to cut through (on your Stage)
|
|
37
|
+
* this.ambientLight.parseCSS("#000000d0");
|
|
38
|
+
* @example
|
|
39
|
+
* // Per-pixel lighting: the sprite reacts to the light's DIRECTION, not
|
|
40
|
+
* // just its distance, because the normal map says which way each texel
|
|
41
|
+
* // faces. `shininess` adds a highlight that slides as the light moves.
|
|
42
|
+
* await loader.preload([
|
|
43
|
+
* { name: "crate", type: "image", src: "data/img/crate.png" },
|
|
44
|
+
* { name: "crate_n", type: "image", src: "data/img/crate_n.png" },
|
|
45
|
+
* ]);
|
|
46
|
+
*
|
|
47
|
+
* const crate = new Sprite(x, y, {
|
|
48
|
+
* image: "crate",
|
|
49
|
+
* normalMap: "crate_n", // enables per-pixel lighting on this sprite
|
|
50
|
+
* shininess: 48, // 0 (the default) is matte, no highlight
|
|
51
|
+
* });
|
|
52
|
+
* app.world.addChild(crate);
|
|
53
|
+
*
|
|
54
|
+
* const lamp = new Light2d(x, y, 300, 300, "#ffffff", 1.2);
|
|
55
|
+
* // the light itself stays invisible — only its EFFECT on the crate shows
|
|
56
|
+
* lamp.illuminationOnly = true;
|
|
57
|
+
* app.world.addChild(lamp);
|
|
58
|
+
*
|
|
59
|
+
* // unlit areas are pure black without this (on your Stage)
|
|
60
|
+
* this.ambientLightingColor.setColor(40, 40, 50);
|
|
61
|
+
* @example
|
|
62
|
+
* // Several lights at once: each contributes its own diffuse shading AND
|
|
63
|
+
* // its own coloured highlight, so a normal-mapped sprite between a warm
|
|
64
|
+
* // and a cool source carries two distinct glints.
|
|
65
|
+
* app.world.addChild(new Light2d(200, 150, 260, 260, "#ffb266", 1.0));
|
|
66
|
+
* app.world.addChild(new Light2d(520, 320, 260, 260, "#66b2ff", 1.0));
|
|
67
|
+
* @example
|
|
68
|
+
* // Parented to a renderable, so it follows through the transform chain
|
|
69
|
+
* const player = new Sprite(x, y, { image: "player" });
|
|
70
|
+
* const halo = new Light2d(0, 0, 120, 120, "#fff2cc", 0.8);
|
|
71
|
+
* player.addChild(halo);
|
|
27
72
|
*/
|
|
28
73
|
export default class Light2d extends Renderable {
|
|
29
74
|
/**
|
|
30
|
-
* the color of the light
|
|
75
|
+
* the color of the light. A normal-mapped sprite's diffuse shading AND
|
|
76
|
+
* its specular highlight both take this colour, so a warm lamp gives a
|
|
77
|
+
* warm glint.
|
|
31
78
|
* @default "#FFF"
|
|
79
|
+
* @example
|
|
80
|
+
* light.color.parseCSS("#ff8844");
|
|
32
81
|
*/
|
|
33
82
|
color: Color;
|
|
34
83
|
/** The horizontal radius of the light */
|
|
@@ -36,8 +85,12 @@ export default class Light2d extends Renderable {
|
|
|
36
85
|
/** The vertical radius of the light */
|
|
37
86
|
radiusY: number;
|
|
38
87
|
/**
|
|
39
|
-
* The intensity of the light
|
|
88
|
+
* The intensity of the light. Scales both the gradient's inner alpha and
|
|
89
|
+
* the per-pixel shading a normal-mapped sprite receives from it.
|
|
40
90
|
* @default 0.7
|
|
91
|
+
* @example
|
|
92
|
+
* // pulse a torch
|
|
93
|
+
* torch.intensity = 0.8 + Math.sin(time * 0.01) * 0.15;
|
|
41
94
|
*/
|
|
42
95
|
intensity: number;
|
|
43
96
|
/**
|
|
@@ -50,6 +103,12 @@ export default class Light2d extends Renderable {
|
|
|
50
103
|
*
|
|
51
104
|
* Default `false`, preserving the legacy "soft glowing spot" behavior.
|
|
52
105
|
* @default false
|
|
106
|
+
* @example
|
|
107
|
+
* // a logical light source: it shades normal-mapped sprites but draws
|
|
108
|
+
* // no glow of its own, so you see the effect and not the lamp
|
|
109
|
+
* const sun = new Light2d(x, y, 900, 900, "#ffffff", 1.5);
|
|
110
|
+
* sun.illuminationOnly = true;
|
|
111
|
+
* app.world.addChild(sun);
|
|
53
112
|
*/
|
|
54
113
|
illuminationOnly: boolean;
|
|
55
114
|
/**
|
|
@@ -66,6 +125,13 @@ export default class Light2d extends Renderable {
|
|
|
66
125
|
*
|
|
67
126
|
* Named `lightHeight` (not just `height`) to avoid colliding with the
|
|
68
127
|
* bbox-height getter Light2d inherits from `Rect`.
|
|
128
|
+
* @example
|
|
129
|
+
* // grazing light: long shadows across the normal map's detail, good
|
|
130
|
+
* // for showing off surface relief
|
|
131
|
+
* light.lightHeight = light.radiusX * 0.02;
|
|
132
|
+
*
|
|
133
|
+
* // head-on: flatter, more even coverage of the lit hemisphere
|
|
134
|
+
* light.lightHeight = light.radiusX * 0.4;
|
|
69
135
|
*/
|
|
70
136
|
lightHeight: number;
|
|
71
137
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"light2d.d.ts","sourceRoot":"","sources":["../../src/lighting/light2d.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAe,MAAM,0BAA0B,CAAC;AAChE,OAAO,EAAE,KAAK,EAAa,MAAM,kBAAkB,CAAC;AACpD,OAAO,UAAU,MAAM,6BAA6B,CAAC;AAErD,OAAO,KAAK,cAAc,MAAM,oCA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cAAc,EAAE,MAAM,CAAC;IACvB,wDAAwD;IACxD,cAAc,EAAE,MAAM,CAAC;IAEvB;;OAEG;gBACS,OAAO,GAAE,cAAmB;CAoExC"}
|
package/build/loader/loader.d.ts
CHANGED
|
@@ -35,6 +35,26 @@ export function setOptions(options: {
|
|
|
35
35
|
* @category Assets
|
|
36
36
|
*/
|
|
37
37
|
export function setBaseURL(type: string, url?: string): void;
|
|
38
|
+
/**
|
|
39
|
+
* A registered parser, normalized by {@link loader.setParser}.
|
|
40
|
+
*
|
|
41
|
+
* Every type gets the same shape whether or not it needs the src hooks, so
|
|
42
|
+
* `load()` can treat all of them alike. The alternative — a bare function that
|
|
43
|
+
* some types decorate with extra properties — puts the knowledge of which
|
|
44
|
+
* types are special back into the caller, which is what moving it out was for.
|
|
45
|
+
* @typedef {object} AssetParser
|
|
46
|
+
* @property {Function} parse - preloads the asset and returns how many
|
|
47
|
+
* resources it will load (0 when already cached)
|
|
48
|
+
* @property {function(string): string} normalizeSrc - turns a type-specific
|
|
49
|
+
* descriptor into a bare path, before any base URL is applied. Identity unless
|
|
50
|
+
* the type overrides it
|
|
51
|
+
* @property {function(string): boolean} needsBaseURL - whether the normalized
|
|
52
|
+
* src is relative to this type's base URL. Declares only this type's own
|
|
53
|
+
* exceptions, such as a `local()` font naming an installed family — data URIs
|
|
54
|
+
* are excluded for every type before this is consulted
|
|
55
|
+
* @ignore
|
|
56
|
+
* @internal
|
|
57
|
+
*/
|
|
38
58
|
/**
|
|
39
59
|
* an asset definition to be used with the loader
|
|
40
60
|
* @typedef {object} Asset
|
|
@@ -74,6 +94,9 @@ export function setBaseURL(type: string, url?: string): void;
|
|
|
74
94
|
* {name: "ymTrack", type: "binary", src: "data/audio/main.ym"}
|
|
75
95
|
* // JSON file (used for texturePacker)
|
|
76
96
|
* {name: "texture", type: "json", src: "data/gfx/texture.json"}
|
|
97
|
+
* // JSON file holding collision shapes drawn in a physics-shape editor,
|
|
98
|
+
* // named by a body definition as `{ shapes: "shapes", id: <body name> }`
|
|
99
|
+
* {name: "shapes", type: "json", src: "data/physics/shapes.json"}
|
|
77
100
|
* // JavaScript file
|
|
78
101
|
* {name: "plugin", type: "js", src: "data/js/plugin.js"}
|
|
79
102
|
* // Font Face
|
|
@@ -145,6 +168,9 @@ export function setParser(type: string, parserFn: Function): void;
|
|
|
145
168
|
* {name: "ymTrack", type: "binary", src: "data/audio/main.ym"},
|
|
146
169
|
* // JSON file (used for texturePacker)
|
|
147
170
|
* {name: "texture", type: "json", src: "data/gfx/texture.json"},
|
|
171
|
+
* // JSON file holding collision shapes drawn in a physics-shape editor,
|
|
172
|
+
* // named by a body definition as `{ shapes: "shapes", id: <body name> }`
|
|
173
|
+
* {name: "shapes", type: "json", src: "data/physics/shapes.json"},
|
|
148
174
|
* // JavaScript file
|
|
149
175
|
* {name: "plugin", type: "js", src: "data/js/plugin.js"},
|
|
150
176
|
* // Font Face
|
|
@@ -465,6 +491,12 @@ export function getVideo(elt: string): HTMLVideoElement;
|
|
|
465
491
|
* @category Assets
|
|
466
492
|
*/
|
|
467
493
|
export function getFont(elt: string): FontFace;
|
|
494
|
+
/**
|
|
495
|
+
* additional import for TypeScript
|
|
496
|
+
* @import {CompressedImage} from "./parsers/compressed_textures/compressed_image.js";
|
|
497
|
+
* @import GLShader from "../video/webgl/glshader.js";
|
|
498
|
+
* @import ShaderEffect from "../video/effects/shadereffect.js";
|
|
499
|
+
*/
|
|
468
500
|
/**
|
|
469
501
|
* a small class to manage loading of stuff and manage resources
|
|
470
502
|
* @namespace loader
|
|
@@ -515,6 +547,34 @@ export let crossOrigin: string;
|
|
|
515
547
|
* me.loader.preload(game.resources, () => this.loaded());
|
|
516
548
|
*/
|
|
517
549
|
export let withCredentials: boolean;
|
|
550
|
+
/**
|
|
551
|
+
* A registered parser, normalized by {@link loader.setParser}.
|
|
552
|
+
*
|
|
553
|
+
* Every type gets the same shape whether or not it needs the src hooks, so
|
|
554
|
+
* `load()` can treat all of them alike. The alternative — a bare function that
|
|
555
|
+
* some types decorate with extra properties — puts the knowledge of which
|
|
556
|
+
* types are special back into the caller, which is what moving it out was for.
|
|
557
|
+
*/
|
|
558
|
+
export type AssetParser = {
|
|
559
|
+
/**
|
|
560
|
+
* - preloads the asset and returns how many
|
|
561
|
+
* resources it will load (0 when already cached)
|
|
562
|
+
*/
|
|
563
|
+
parse: Function;
|
|
564
|
+
/**
|
|
565
|
+
* - turns a type-specific
|
|
566
|
+
* descriptor into a bare path, before any base URL is applied. Identity unless
|
|
567
|
+
* the type overrides it
|
|
568
|
+
*/
|
|
569
|
+
normalizeSrc: (arg0: string) => string;
|
|
570
|
+
/**
|
|
571
|
+
* - whether the normalized
|
|
572
|
+
* src is relative to this type's base URL. Declares only this type's own
|
|
573
|
+
* exceptions, such as a `local()` font naming an installed family — data URIs
|
|
574
|
+
* are excluded for every type before this is consulted
|
|
575
|
+
*/
|
|
576
|
+
needsBaseURL: (arg0: string) => boolean;
|
|
577
|
+
};
|
|
518
578
|
/**
|
|
519
579
|
* an asset definition to be used with the loader
|
|
520
580
|
*/
|
|
@@ -668,4 +728,7 @@ export type GLTFData = {
|
|
|
668
728
|
*/
|
|
669
729
|
animations: object[];
|
|
670
730
|
};
|
|
731
|
+
import type { CompressedImage } from "./parsers/compressed_textures/compressed_image.js";
|
|
732
|
+
import type ShaderEffect from "../video/effects/shadereffect.js";
|
|
733
|
+
import type GLShader from "../video/webgl/glshader.js";
|
|
671
734
|
//# sourceMappingURL=loader.d.ts.map
|
|
@@ -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":"AAiGA;;;;GAIG;AACH,mDAEC;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,oCAdG;IAAyB,WAAW;IACV,OAAO;IACP,eAAe;CACzC,QAqBF;AAED;;;;;;;;;;;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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;;qCArgCY,mDAAmD;8BAExD,kCAAkC;0BADtC,4BAA4B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loadingscreen.d.ts","sourceRoot":"","sources":["../../src/loader/loadingscreen.js"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"loadingscreen.d.ts","sourceRoot":"","sources":["../../src/loader/loadingscreen.js"],"names":[],"mappings":";AAaA;;;;GAIG;AACH;IAmCC;;;;;;OAMG;IACH,cAEC;IA3CD;;;OAGG;IACH,kBAAmB;IAEnB;;;OAGG;IACH,iBAAkB;IAmClB;;;;OAIG;IACH,6BA+EC;IA4CD;;;;OAIG;IACH,uBAOC;;CACD;kBA1MiB,qBAAqB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fontface.d.ts","sourceRoot":"","sources":["../../../src/loader/parsers/fontface.js"],"names":[],"mappings":"AAEA;;;;;;;;;;;;GAYG;AACH,sCAXW,MAAM,CAAC,KAAK,0CAGV,MAAM,CAgElB"}
|
|
1
|
+
{"version":3,"file":"fontface.d.ts","sourceRoot":"","sources":["../../../src/loader/parsers/fontface.js"],"names":[],"mappings":"AAEA;;;;;;;;;;;;GAYG;AACH,sCAXW,MAAM,CAAC,KAAK,0CAGV,MAAM,CAgElB;;IAED;;;;;;;;;OASG;IACH,2BALW,MAAM,GACJ,MAAM,CAOlB;IAED;;;;;;;OAOG;IACH,2BALW,MAAM,GACJ,OAAO,CAMnB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mtl.d.ts","sourceRoot":"","sources":["../../../src/loader/parsers/mtl.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"mtl.d.ts","sourceRoot":"","sources":["../../../src/loader/parsers/mtl.js"],"names":[],"mappings":"AA6GA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,+BANW,MAAM,YACN,MAAM,GACJ,MAAM,CAkNlB;AAED;;;;;;;;;GASG;AACH,iCARW,MAAM,CAAC,KAAK,oDAGZ,MAAM,GACJ,MAAM,CA0ElB"}
|
package/build/math/color.d.ts
CHANGED
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* A color manipulation object.
|
|
3
|
-
* @category Math
|
|
4
|
-
*/
|
|
5
1
|
export declare class Color {
|
|
6
2
|
private normalizedRGBA;
|
|
7
3
|
/**
|
|
@@ -70,6 +66,33 @@ export declare class Color {
|
|
|
70
66
|
* @returns Reference to this object for method chaining.
|
|
71
67
|
*/
|
|
72
68
|
setFloat(r: number, g: number, b: number, alpha?: number): this;
|
|
69
|
+
/**
|
|
70
|
+
* Sets the color from LINEAR values, encoding them to sRGB.
|
|
71
|
+
*
|
|
72
|
+
* The sibling of {@link Color#setFloat}, which takes the same `0..1` range
|
|
73
|
+
* but treats it as already-sRGB. Which one you want depends entirely on
|
|
74
|
+
* where the numbers came from, and the two are NOT interchangeable: a
|
|
75
|
+
* linear `0.42` is sRGB `0.68`, not `0.42`.
|
|
76
|
+
*
|
|
77
|
+
* Reach for this whenever a value arrives from a renderer's own colour
|
|
78
|
+
* space rather than from a CSS string or an image. The common case is
|
|
79
|
+
* glTF, which defines `baseColorFactor` and `emissiveFactor` as linear
|
|
80
|
+
* (spec 3.9.2) — handing those straight to `setFloat` or scaling them by
|
|
81
|
+
* 255 into `setColor` renders every untextured material markedly too
|
|
82
|
+
* DARK, by 60 to 70 counts per channel in the midtones. It is an easy
|
|
83
|
+
* mistake to leave in, because the result still looks coherent, just
|
|
84
|
+
* moody, so lighting gets tuned against the wrong values.
|
|
85
|
+
* @param r - The red component [0.0 .. 1.0], linear.
|
|
86
|
+
* @param g - The green component [0.0 .. 1.0], linear.
|
|
87
|
+
* @param b - The blue component [0.0 .. 1.0], linear.
|
|
88
|
+
* @param [alpha=1.0] - The alpha value [0.0 .. 1.0]. Alpha is NOT a colour
|
|
89
|
+
* and carries no transfer function, so it is taken as-is.
|
|
90
|
+
* @returns Reference to this object for method chaining.
|
|
91
|
+
* @example
|
|
92
|
+
* // a glTF material factor, which the spec defines as linear
|
|
93
|
+
* mesh.tint.setLinear(...node.baseColorFactor);
|
|
94
|
+
*/
|
|
95
|
+
setLinear(r: number, g: number, b: number, alpha?: number): this;
|
|
73
96
|
/**
|
|
74
97
|
* Sets the color to the specified HSV values.
|
|
75
98
|
* @param h - The hue [0 .. 1].
|
|
@@ -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":"AAuOA,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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AAQ,EAAE,MAAM;IAQzB;;;;OAIG;IACH,QAAQ,CAAC,QAAQ,EAAE,MAAM;IAazB;;;;;;OAMG;IACH,QAAQ,CAAC,QAAQ,EAAE,IAAI,MAAM,EAAE,EAAE,IAAI,UAAQ;IAmD7C;;;;OAIG;IACH,QAAQ,CAAC,KAAK,SAAM;IAgBpB;;;OAGG;IACH,OAAO;IAIP;;;OAGG;IACH,KAAK;IAKL;;;;OAIG;IACH,MAAM,CAAC,KAAK,SAAyB;IAKrC;;;OAGG;IACH,KAAK;IAIL;;;;OAIG;IACH,MAAM,CAAC,KAAK,SAAa;CAGzB;AAED,eAAO,MAAM,SAAS,gKAwBpB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"emitter.d.ts","sourceRoot":"","sources":["../../src/particles/emitter.ts"],"names":[],"mappings":"AAGA,OAAO,SAAS,MAAM,8BAA8B,CAAC;AAMrD,OAA+B,EAC9B,KAAK,uBAAuB,EAC5B,MAAM,eAAe,CAAC;AA+DvB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CG;AACH,MAAM,CAAC,OAAO,OAAO,eAAgB,SAAQ,SAAS;;IACrD;;OAEG;IACH,QAAQ,EAAE,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"emitter.d.ts","sourceRoot":"","sources":["../../src/particles/emitter.ts"],"names":[],"mappings":"AAGA,OAAO,SAAS,MAAM,8BAA8B,CAAC;AAMrD,OAA+B,EAC9B,KAAK,uBAAuB,EAC5B,MAAM,eAAe,CAAC;AA+DvB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CG;AACH,MAAM,CAAC,OAAO,OAAO,eAAgB,SAAQ,SAAS;;IACrD;;OAEG;IACH,QAAQ,EAAE,uBAAuB,CAAC;IA4HlC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA6BG;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;IAqDrE;;;;;;;;;;;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;IAuEzB;;;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;CAqLpC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Vector2d } from "../math/vector2d.ts";
|
|
2
|
+
import type { Bounds } from "../physics/bounds.ts";
|
|
2
3
|
import Renderable from "../renderable/renderable.js";
|
|
3
4
|
import ParticleEmitter from "./emitter.ts";
|
|
4
5
|
/**
|
|
@@ -7,7 +8,27 @@ import ParticleEmitter from "./emitter.ts";
|
|
|
7
8
|
*/
|
|
8
9
|
export default class Particle extends Renderable {
|
|
9
10
|
#private;
|
|
11
|
+
/**
|
|
12
|
+
* Launch velocity.
|
|
13
|
+
*
|
|
14
|
+
* `x` and `y` are the emitter's plane. `z` is only ever non-zero when the
|
|
15
|
+
* emitter was given an {@link ParticleEmitterSettings.elevation}, and the
|
|
16
|
+
* integration below skips it entirely when it is not: a 2D emitter runs
|
|
17
|
+
* exactly the path it ran before, rather than the 3D path with a zero in
|
|
18
|
+
* it.
|
|
19
|
+
*/
|
|
10
20
|
vel: Vector2d;
|
|
21
|
+
/**
|
|
22
|
+
* Velocity along Z, kept beside `vel` rather than in it.
|
|
23
|
+
*
|
|
24
|
+
* `vel` is pooled as a `Vector2d` and every existing effect reads it as
|
|
25
|
+
* one; widening the pooled type would make every 2D emitter carry a third
|
|
26
|
+
* component it never uses. A separate number costs one double per particle
|
|
27
|
+
* and leaves the 2D path untouched.
|
|
28
|
+
*/
|
|
29
|
+
velZ: number;
|
|
30
|
+
/** whether this particle has any Z motion at all; see {@link Particle#velZ} */
|
|
31
|
+
moves3d: boolean;
|
|
11
32
|
image: HTMLCanvasElement | HTMLImageElement;
|
|
12
33
|
life: number;
|
|
13
34
|
startLife: number;
|
|
@@ -22,7 +43,7 @@ export default class Particle extends Renderable {
|
|
|
22
43
|
* @param emitter - the particle emitter
|
|
23
44
|
*/
|
|
24
45
|
constructor(emitter: ParticleEmitter);
|
|
25
|
-
updateBounds(absolute?: boolean):
|
|
46
|
+
updateBounds(absolute?: boolean): Bounds;
|
|
26
47
|
}
|
|
27
48
|
export declare const particlePool: import("../system/pool.ts").Pool<Particle, [emitter: ParticleEmitter]>;
|
|
28
49
|
//# sourceMappingURL=particle.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"particle.d.ts","sourceRoot":"","sources":["../../src/particles/particle.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,QAAQ,EAAgB,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"particle.d.ts","sourceRoot":"","sources":["../../src/particles/particle.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,QAAQ,EAAgB,MAAM,qBAAqB,CAAC;AAE7D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAGnD,OAAO,UAAU,MAAM,6BAA6B,CAAC;AAIrD,OAAO,eAAe,MAAM,cAAc,CAAC;AAU3C;;;GAGG;AACH,MAAM,CAAC,OAAO,OAAO,QAAS,SAAQ,UAAU;;IAC/C;;;;;;;;OAQG;IACH,GAAG,EAAE,QAAQ,CAAC;IACd;;;;;;;OAOG;IACH,IAAI,EAAE,MAAM,CAAC;IACb,+EAA+E;IAC/E,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,iBAAiB,GAAG,gBAAgB,CAAC;IAC5C,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,gBAAgB,EAAE,OAAO,CAAC;IAC1B,cAAc,EAAE,OAAO,CAAC;IAqBxB,KAAK,EAAE,OAAO,CAAC;IAEf;;OAEG;gBACS,OAAO,EAAE,eAAe;IAqb3B,YAAY,CAAC,QAAQ,UAAO;CA0GrC;AAED,eAAO,MAAM,YAAY,wEAWxB,CAAC"}
|
|
@@ -44,6 +44,10 @@ export interface ParticleEmitterSettings {
|
|
|
44
44
|
totalParticles: number;
|
|
45
45
|
/**
|
|
46
46
|
* Start angle for particle launch in Radians.
|
|
47
|
+
*
|
|
48
|
+
* This is the AZIMUTH: the direction within the emitter's XY plane. With
|
|
49
|
+
* {@link ParticleEmitterSettings.elevation} left at its default of `0`
|
|
50
|
+
* every particle stays in that plane, which is how all 2D emitters behave.
|
|
47
51
|
* @default Math.PI / 2
|
|
48
52
|
*/
|
|
49
53
|
angle: number;
|
|
@@ -52,6 +56,71 @@ export interface ParticleEmitterSettings {
|
|
|
52
56
|
* @default 0
|
|
53
57
|
*/
|
|
54
58
|
angleVariation: number;
|
|
59
|
+
/**
|
|
60
|
+
* Launch angle OUT of the emitter's plane, in radians.
|
|
61
|
+
*
|
|
62
|
+
* `0` fires along the plane, `Math.PI / 2` straight toward the viewer,
|
|
63
|
+
* `-Math.PI / 2` straight away. Combined with
|
|
64
|
+
* {@link ParticleEmitterSettings.elevationVariation} this is what turns a
|
|
65
|
+
* burst from a flat disc facing the camera into a sphere: without it a
|
|
66
|
+
* particle keeps the depth it was born at for its whole life, so no effect
|
|
67
|
+
* can expand along Z or trail away.
|
|
68
|
+
*
|
|
69
|
+
* Zero by default, and zero is not merely a value: an emitter with no
|
|
70
|
+
* elevation and no variation takes the same two trig call launch path it
|
|
71
|
+
* always did and never touches a Z component, so no existing effect pays
|
|
72
|
+
* anything for this.
|
|
73
|
+
* @default 0
|
|
74
|
+
* @example
|
|
75
|
+
* // a spherical burst rather than a disc
|
|
76
|
+
* new ParticleEmitter(x, y, {
|
|
77
|
+
* angle: 0, angleVariation: Math.PI * 2,
|
|
78
|
+
* elevation: 0, elevationVariation: Math.PI / 2,
|
|
79
|
+
* });
|
|
80
|
+
*/
|
|
81
|
+
elevation: number;
|
|
82
|
+
/**
|
|
83
|
+
* Variation in the launch elevation, in radians.
|
|
84
|
+
*
|
|
85
|
+
* `Math.PI / 2` with an `elevation` of `0` spreads particles over the
|
|
86
|
+
* whole sphere; a small value gives a cone around the azimuth.
|
|
87
|
+
* @default 0
|
|
88
|
+
*/
|
|
89
|
+
elevationVariation: number;
|
|
90
|
+
/**
|
|
91
|
+
* Narrowest angle off the launch axis a particle may be thrown, in radians.
|
|
92
|
+
*
|
|
93
|
+
* Together with {@link ParticleEmitterSettings.maxSpread} this selects a
|
|
94
|
+
* different way of aiming. Normally `angleVariation` and
|
|
95
|
+
* `elevationVariation` are sampled INDEPENDENTLY, which spreads particles
|
|
96
|
+
* over a rectangle of azimuth x elevation. That cannot describe a shape
|
|
97
|
+
* defined relative to a direction: a ring of debris leaving a point on a
|
|
98
|
+
* sphere is the set of directions at 90 degrees to that point's normal,
|
|
99
|
+
* and on a rectangle the required elevation is a function of the azimuth
|
|
100
|
+
* rather than independent of it.
|
|
101
|
+
*
|
|
102
|
+
* So when `maxSpread` is greater than zero, {@link
|
|
103
|
+
* ParticleEmitterSettings.angle} and {@link
|
|
104
|
+
* ParticleEmitterSettings.elevation} stop being a rectangle's centre and
|
|
105
|
+
* become an AXIS, and each particle is thrown at a polar angle between
|
|
106
|
+
* `minSpread` and `maxSpread` from it, around a uniformly random azimuth.
|
|
107
|
+
* `angleVariation` and `elevationVariation` are then unused.
|
|
108
|
+
*
|
|
109
|
+
* - `0` to `0.5` is a tight cone along the axis
|
|
110
|
+
* - either value at `Math.PI / 2` is a flat disc perpendicular to it
|
|
111
|
+
* - `0` to `Math.PI` is the whole sphere
|
|
112
|
+
* @default 0
|
|
113
|
+
*/
|
|
114
|
+
minSpread: number;
|
|
115
|
+
/**
|
|
116
|
+
* Widest angle off the launch axis a particle may be thrown, in radians.
|
|
117
|
+
*
|
|
118
|
+
* Zero, the default, leaves the emitter on the independent
|
|
119
|
+
* azimuth/elevation path it has always used. See {@link
|
|
120
|
+
* ParticleEmitterSettings.minSpread} for what a non-zero value switches to.
|
|
121
|
+
* @default 0
|
|
122
|
+
*/
|
|
123
|
+
maxSpread: number;
|
|
55
124
|
/**
|
|
56
125
|
* Minimum time each particle lives once it is emitted in ms.
|
|
57
126
|
* If greater than `maxLife`, it is clamped to `maxLife` at reset.
|
|
@@ -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;;;;;;GAMG;AACH,MAAM,WAAW,uBAAuB;IACvC;;;OAGG;IACH,KAAK,EAAE,MAAM,CAAC;IAEd;;;OAGG;IACH,MAAM,EAAE,MAAM,CAAC;IAEf;;;;;OAKG;IACH,KAAK,EAAE,iBAAiB,GAAG,gBAAgB,GAAG,SAAS,CAAC;IAExD;;;;;OAKG;IACH,WAAW,EAAE,MAAM,CAAC;IAEpB;;;OAGG;IACH,IAAI,EAAE,MAAM,CAAC;IAEb;;;OAGG;IACH,cAAc,EAAE,MAAM,CAAC;IAEvB
|
|
1
|
+
{"version":3,"file":"settings.d.ts","sourceRoot":"","sources":["../../src/particles/settings.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,SAAS,MAAM,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