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
package/README.md
CHANGED
|
@@ -61,14 +61,15 @@ Graphics
|
|
|
61
61
|
- **2D** — `Light2d` as a first-class `Renderable` (multiple dynamic lights, radial-gradient falloff, illumination-only mode, procedural rendering via `drawLight`), plus optional per-pixel normal-map shading on sprites for 3D-looking dynamic lights
|
|
62
62
|
- **3D** — `Light3d` directional, point, spot and ambient lights, added to the world like `Light2d` (half-Lambert diffuse + ambient fill, quadratic falloff and cone angles on the punctual types, runtime-manipulable for day/night), auto-loaded from a glTF scene's authored suns and lamps
|
|
63
63
|
- up to **32 simultaneous lights** on either path, with light data travelling in a uniform buffer — a static light rig costs zero GPU state changes per frame
|
|
64
|
-
- Ground ("blob") shadows for 3D objects — **on by default** — so characters and props read as standing on the floor instead of hovering. An ellipse matching the caster's own footprint and rotation, shrinking and fading with height above the ground; one extra draw per object, and **one for an entire `InstancedMesh` scatter regardless of instance count**. Controllable per object, per glTF scene (`level.load(name, { castGroundShadow })`) or application-wide. Deliberately not shadow mapping: it answers "where is this standing", which is what a 2.5D scene needs
|
|
65
|
-
- Built-in shader effects (Flash, Outline, Glow, Dissolve, CRT, Hologram, etc.) with multi-pass chaining via `addPostEffect()`, plus custom shader support on both GPU backends: `ShaderEffect` for per-sprite fragment effects (GLSL and/or WGSL bodies) and complete custom mesh shader programs via `mesh.shader` (a dual-language `GLShader`: GLSL pair and/or WGSL module)
|
|
64
|
+
- Ground ("blob") shadows for 3D objects — **on by default** — so characters and props read as standing on the floor instead of hovering. An ellipse matching the caster's own footprint and rotation, shrinking and fading with height above the ground; one extra draw per object, and **one for an entire `InstancedMesh` scatter regardless of instance count**. Shaped by the light rather than always straight down: `shadowLight` points a blob at a `Light3d` and is re-read every draw, so a day/night cycle carries every shadow with it, while `shadowOffset` slides it out from the caster's feet, `shadowStretch` lengthens it for a low sun, `shadowScale` sizes it independently of the object, and `shadowGroundNormal` lays it on a floor that is not level. All of them work on an `InstancedMesh` too, as one value for the whole set. Controllable per object, per glTF scene (`level.load(name, { castGroundShadow, shadowLight, … })`) or application-wide. Deliberately not shadow mapping: it answers "where is this standing", which is what a 2.5D scene needs
|
|
65
|
+
- Built-in shader effects (Flash, Outline, Glow, Bloom, ToneMapping, Dissolve, CRT, Hologram, etc.) with multi-pass chaining via `addPostEffect()`, plus custom shader support on both GPU backends: `ShaderEffect` for per-sprite fragment effects (GLSL and/or WGSL bodies) and complete custom mesh shader programs via `mesh.shader` (a dual-language `GLShader`: GLSL pair and/or WGSL module)
|
|
66
|
+
- Optional HDR rendering (`hdr: true`) — the camera's render targets become half-float, so additive light stops saturating on every write and `BloomEffect` thresholds on genuinely over-bright pixels instead of merely bright ones, with `ToneMappingEffect` and a `toneMapping` setting to compress the result back into display range when your art calls for it. Off by default and additive: nothing is inserted into your effect chain, so turning it on does not restyle a game whose look is built on clipped whites. On WebGPU it goes one step further — `hdrOutput: true` presents the frame in the display's own dynamic range rather than clamping it to SDR at the last step
|
|
66
67
|
- Trail renderable for fading, tapering ribbons behind moving objects (speed lines, sword slashes, magic trails)
|
|
67
68
|
- System & Bitmap Text with built-in typewriter effect
|
|
68
69
|
- Video sprite playback
|
|
69
70
|
|
|
70
71
|
Sound
|
|
71
|
-
- Web Audio support with 3D spatial audio and stereo panning
|
|
72
|
+
- Web Audio support with 3D spatial audio and stereo panning, plus a procedural tone/noise API. The playback backend began as [howler.js](https://howlerjs.com) and is now a customized derivative vendored into the engine, so this is **not** a runtime dependency (see `src/audio/backend/LICENSE`)
|
|
72
73
|
- Built-in procedural audio primitives (envelope-shaped oscillators, white/pink/brown noise) for SFX without sample assets
|
|
73
74
|
- Direct `AudioContext` / master-gain accessors for custom WebAudio graphs that mix with the engine's master volume / mute
|
|
74
75
|
|
|
@@ -191,6 +192,8 @@ Examples
|
|
|
191
192
|
* [3D Mesh](https://melonjs.github.io/melonJS/examples/#/mesh-3d) ([source](https://github.com/melonjs/melonJS/tree/master/packages/examples/src/examples/mesh3d))
|
|
192
193
|
* [3D Mesh Material](https://melonjs.github.io/melonJS/examples/#/mesh-3d-material) ([source](https://github.com/melonjs/melonJS/tree/master/packages/examples/src/examples/mesh3dMaterial))
|
|
193
194
|
* [AfterBurner Clone](https://melonjs.github.io/melonJS/examples/#/after-burner) ([source](https://github.com/melonjs/melonJS/tree/master/packages/examples/src/examples/afterBurner)) — `Camera3d` + 3D Mesh arcade shooter
|
|
195
|
+
* [Ground Shadows](https://melonjs.github.io/melonJS/examples/#/ground-shadows) ([source](https://github.com/melonjs/melonJS/tree/master/packages/examples/src/examples/groundShadows)) — every blob-shadow setting side by side under an orbiting sun, including blobs lying on a slope and a 70-instance scatter that costs one extra draw
|
|
196
|
+
* [Jungle Rabbit](https://melonjs.github.io/melonJS/examples/#/jungle-rabbit) ([source](https://github.com/melonjs/melonJS/tree/master/packages/examples/src/examples/jungleRabbit)) — a low-poly river endless runner: Blender-modelled props through `InstancedMesh`, a rigged paddling boat, a procedural valley and shadows laid on its banks
|
|
194
197
|
* [glTF Scene](https://melonjs.github.io/melonJS/examples/#/gltf) ([source](https://github.com/melonjs/melonJS/tree/master/packages/examples/src/examples/gltf)) — a Blender-authored, lit 3D scene loaded with `level.load`
|
|
195
198
|
* [glTF Animated Model](https://melonjs.github.io/melonJS/examples/#/gltf-character) ([source](https://github.com/melonjs/melonJS/tree/master/packages/examples/src/examples/gltf)) — a rigged character (Kenney Blocky Characters) with node animation, driven by the Sprite-aligned `setCurrentAnimation` / `play` / `pause` / `stop` API
|
|
196
199
|
* [Trail](https://melonjs.github.io/melonJS/examples/#/trail) ([source](https://github.com/melonjs/melonJS/tree/master/packages/examples/src/examples/trail))
|
|
@@ -5,6 +5,11 @@ export declare const defaultApplicationSettings: {
|
|
|
5
5
|
powerPreference: "default";
|
|
6
6
|
transparent: false;
|
|
7
7
|
antiAlias: false;
|
|
8
|
+
hdr: false;
|
|
9
|
+
hdrOutput: false;
|
|
10
|
+
toneMapping: "none";
|
|
11
|
+
toneMappingExposure: number;
|
|
12
|
+
toneMappingWhite: number;
|
|
8
13
|
prewarm: true;
|
|
9
14
|
textureFilter: "auto";
|
|
10
15
|
maxTextures: "auto";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"defaultApplicationSettings.d.ts","sourceRoot":"","sources":["../../src/application/defaultApplicationSettings.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,0BAA0B
|
|
1
|
+
{"version":3,"file":"defaultApplicationSettings.d.ts","sourceRoot":"","sources":["../../src/application/defaultApplicationSettings.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;;;CAyBC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"header.d.ts","sourceRoot":"","sources":["../../src/application/header.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,WAAW,MAAM,kBAAkB,CAAC;AAEhD;;;GAGG;AACH,wBAAgB,aAAa,CAAC,GAAG,EAAE,WAAW,GAAG,IAAI,
|
|
1
|
+
{"version":3,"file":"header.d.ts","sourceRoot":"","sources":["../../src/application/header.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,WAAW,MAAM,kBAAkB,CAAC;AAEhD;;;GAGG;AACH,wBAAgB,aAAa,CAAC,GAAG,EAAE,WAAW,GAAG,IAAI,CA+CpD"}
|
|
@@ -100,6 +100,94 @@ export type ApplicationSettings = {
|
|
|
100
100
|
* @default false
|
|
101
101
|
*/
|
|
102
102
|
antiAlias: boolean;
|
|
103
|
+
/**
|
|
104
|
+
* Let the post-effect chain carry color values above 1 instead of
|
|
105
|
+
* clamping at every write.
|
|
106
|
+
*
|
|
107
|
+
* Render targets become half-float rather than 8 bits per channel, which
|
|
108
|
+
* is what gives {@link BloomEffect} genuinely over-bright pixels to
|
|
109
|
+
* threshold on and {@link ToneMappingEffect} a range to compress. Off by
|
|
110
|
+
* default, for the same reasons `antiAlias` is: it costs GPU memory, and
|
|
111
|
+
* a game gets a different pipeline depending on the driver underneath.
|
|
112
|
+
*
|
|
113
|
+
* The cost is narrow. Render targets exist only while something is
|
|
114
|
+
* actually running a multi-pass effect chain, and only the CAMERA pair
|
|
115
|
+
* takes the half-float format, at 8 bytes per pixel instead of 4. Sprite
|
|
116
|
+
* chains and the advanced-blend target stay 8-bit whatever this says. A
|
|
117
|
+
* game with no camera post-effects allocates nothing either way.
|
|
118
|
+
*
|
|
119
|
+
* **Not HDR output on its own.** This is headroom THROUGH the chain:
|
|
120
|
+
* the frame is presented in SDR, so anything still above 1 at the end
|
|
121
|
+
* clamps on the blit, exactly as it did before this setting existed. See
|
|
122
|
+
* `hdrOutput` to remove that last clamp as well, on the backends that
|
|
123
|
+
* can. Nothing is added to your effect
|
|
124
|
+
* chain, so turning this on does not restyle your game. Add a
|
|
125
|
+
* `ToneMappingEffect` to the camera if you want a curve rather than that
|
|
126
|
+
* clamp, bearing in mind that every curve maps 1 to less than 1, so a
|
|
127
|
+
* look built on clipped whites will change.
|
|
128
|
+
*
|
|
129
|
+
* Ignored where it cannot be honoured: the Canvas renderer has no render
|
|
130
|
+
* targets, and a WebGL2 driver missing either half-float extension warns
|
|
131
|
+
* once, naming which half, and stays at 8 bits. Read
|
|
132
|
+
* {@link Renderer#supportsHDR} for what you actually got, and branch a
|
|
133
|
+
* grade on that rather than on this, which is only the request.
|
|
134
|
+
* @default false
|
|
135
|
+
*/
|
|
136
|
+
hdr: boolean;
|
|
137
|
+
/**
|
|
138
|
+
* Tone curve applied to the camera at the very end of its effect chain,
|
|
139
|
+
* or `"none"` to leave the frame alone.
|
|
140
|
+
*
|
|
141
|
+
* `"none"` by default, and that default is deliberate. Every curve maps 1
|
|
142
|
+
* to less than 1, so a 2D look built on clipped whites and saturated
|
|
143
|
+
* colour goes matte the moment one is applied, at any exposure. Turn it
|
|
144
|
+
* on when your art is authored in linear light and you want the
|
|
145
|
+
* highlights rolled off, not as a companion to `hdr`.
|
|
146
|
+
*
|
|
147
|
+
* Independent of `hdr`: a curve without headroom is a grade on an
|
|
148
|
+
* already-clamped frame, which is a legitimate thing to want, and
|
|
149
|
+
* headroom without a curve is the additive-accumulation win on its own.
|
|
150
|
+
* @default "none"
|
|
151
|
+
*/
|
|
152
|
+
/**
|
|
153
|
+
* Present the frame in the display's full dynamic range, instead of
|
|
154
|
+
* clamping it to SDR on the way to the screen.
|
|
155
|
+
*
|
|
156
|
+
* `hdr` gives the effect chain headroom and then clamps at the very last
|
|
157
|
+
* step, because the surface the browser presents is 8 bits per channel.
|
|
158
|
+
* This changes that surface: values above 1 reach the compositor and, on
|
|
159
|
+
* a display that has the range, are actually shown brighter.
|
|
160
|
+
*
|
|
161
|
+
* **Requires `hdr`, and changes how your game looks on an HDR display.**
|
|
162
|
+
* A 2D look built on clipped whites relies on that final clamp; remove it
|
|
163
|
+
* and everything you drove above 1 gets brighter rather than saturating.
|
|
164
|
+
* That is the point, and it is why this is a separate opt-in rather than
|
|
165
|
+
* part of `hdr`.
|
|
166
|
+
*
|
|
167
|
+
* **WebGPU only.** The WebGL2 equivalent is an unapproved specification
|
|
168
|
+
* change that no browser implements, so that backend reports `false` and
|
|
169
|
+
* presents in SDR as it always has. Query
|
|
170
|
+
* {@link Renderer#supportsHDROutput} for what was granted, and expect it
|
|
171
|
+
* to differ per backend on the same machine.
|
|
172
|
+
* @default false
|
|
173
|
+
*/
|
|
174
|
+
hdrOutput: boolean;
|
|
175
|
+
toneMapping: "none" | "aces" | "reinhard" | "exponential";
|
|
176
|
+
/**
|
|
177
|
+
* Multiplier applied before the tone curve. Above `1` lifts the image
|
|
178
|
+
* into the curve's shoulder; below `1` pulls it down. Ignored while
|
|
179
|
+
* `toneMapping` is `"none"`.
|
|
180
|
+
* @default 1
|
|
181
|
+
*/
|
|
182
|
+
toneMappingExposure: number;
|
|
183
|
+
/**
|
|
184
|
+
* The post-exposure value the tone curve should map to display white, or
|
|
185
|
+
* `0` to leave the curve its own shoulder. This is what a "brightness" or
|
|
186
|
+
* "peak" slider in a settings screen drives. Ignored while `toneMapping`
|
|
187
|
+
* is `"none"`.
|
|
188
|
+
* @default 0
|
|
189
|
+
*/
|
|
190
|
+
toneMappingWhite: number;
|
|
103
191
|
/**
|
|
104
192
|
* Warm the renderer up during `loader.preload()`, behind the loading
|
|
105
193
|
* screen, instead of paying for it on the frame that first draws (GPU
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"settings.d.ts","sourceRoot":"","sources":["../../src/application/settings.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAOH,OAAO,KAAK,QAAQ,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AACxC,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,QAAQ,MAAM,mBAAmB,CAAC;AACzC,OAAO,EAAE,YAAY,EAAE,MAAM,oCAAoC,CAAC;AAClE,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C,KAAK,SAAS,GACX,QAAQ,GACR,UAAU,GACV,SAAS,GACT,UAAU,GACV,QAAQ,GACR,QAAQ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,CAAC,EAAE,MAAM,IAAI,GACrB,IAAI;IAWP;;;;;;;;;OASG;IACH,MAAM,CACL,KAAK,EAAE,KAAK,GAAG,MAAM,EACrB,QAAQ,GAAE,MAAa,EACvB,UAAU,CAAC,EAAE,MAAM,IAAI,GACrB,IAAI;IAWP;;;;;;OAMG;IACH,eAAe,CAAC,CAAC,SAAS,YAAY,EAAE,MAAM,EAAE,CAAC,GAAG,CAAC;IAKrD;;;;;;OAMG;IACH,eAAe,CAAC,CAAC,SAAS,YAAY,EACrC,WAAW,EAAE,KAAK,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,CAAC,GACpC,CAAC,GAAG,SAAS;IAMhB;;;;;;OAMG;IACH,kBAAkB,CAAC,MAAM,EAAE,YAAY,GAAG,IAAI;IAQ9C;;;OAGG;IACH,OAAO,CAAC,MAAM,EAAE,UAAU,GAAG,IAAI;IAQjC;;;;;OAKG;IACH,SAAS,CAAC,GAAG,EAAE,UAAU,EAAE,QAAQ,GAAE,OAAsB,GAAG,OAAO;IA0BrE;;;;;;OAMG;IACH,YAAY,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,EAAE,QAAQ,GAAG,QAAQ;IAS1D;;;;;;OAMG;IACH,YAAY,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,EAAE,QAAQ,GAAG,QAAQ;CAoT1D"}
|
|
@@ -29,12 +29,16 @@ export type { Fog3dState, FogMode, FogOptions } from "./fog.ts";
|
|
|
29
29
|
* on screen (same as Camera2d). Sprite at higher `pos.z` is
|
|
30
30
|
* farther from the camera and renders smaller. Matches melonJS's
|
|
31
31
|
* 2D conventions so existing Camera2d code translates directly.
|
|
32
|
-
* - **
|
|
32
|
+
* - **Three rotation angles.** `pitch` (X axis, look up/down) and
|
|
33
33
|
* `yaw` (Y axis, look left/right) and `roll` (Z axis, bank the horizon).
|
|
34
34
|
* The view is `R(yaw) ∘ R(pitch) ∘ R(roll)` inverted; the frustum planes are
|
|
35
35
|
* extracted from that same matrix, so culling follows a banked view. The
|
|
36
36
|
* inherited `currentTransform` is still NOT read — `camera.rotate()` on a
|
|
37
37
|
* 3D camera does nothing, so set `roll` rather than rotating the camera.
|
|
38
|
+
* The basis those angles produce is readable with
|
|
39
|
+
* {@link Camera3d#getBasis} and writable with {@link Camera3d#setBasis},
|
|
40
|
+
* which is how a camera is posed over a curved surface where up is the
|
|
41
|
+
* surface normal and no pitch and yaw pair expresses it.
|
|
38
42
|
* - **Follow offset (PR B scope).** When a target is set,
|
|
39
43
|
* `followOffset` is applied in **world space**:
|
|
40
44
|
* `camera.pos = target.pos + followOffset`. Target-rotation-aware
|
|
@@ -275,6 +279,66 @@ export default class Camera3d extends Camera2d {
|
|
|
275
279
|
* @returns this camera, for chaining
|
|
276
280
|
*/
|
|
277
281
|
getBasis(right: Vector3d, up: Vector3d, forward: Vector3d): this;
|
|
282
|
+
/**
|
|
283
|
+
* Restore the camera to its initial state: at the given position, looking
|
|
284
|
+
* straight down the z axis with a level horizon.
|
|
285
|
+
*
|
|
286
|
+
* Overridden because the inherited 2D version resets only what a 2D
|
|
287
|
+
* camera has. It clears `roll`, since in 2D the roll IS the transform
|
|
288
|
+
* matrix it identity-resets, and it writes `pos.x` and `pos.y`. A 3D
|
|
289
|
+
* camera also has `pitch`, `yaw` and a depth, none of which it knows
|
|
290
|
+
* about, so `reset()` used to leave a camera pointing wherever it had
|
|
291
|
+
* been left and standing at whatever depth it had reached.
|
|
292
|
+
* @param [x=0] - world x to reset to
|
|
293
|
+
* @param [y=0] - world y to reset to
|
|
294
|
+
* @param [z=0] - depth to reset to
|
|
295
|
+
*/
|
|
296
|
+
reset(x?: number, y?: number, z?: number): void;
|
|
297
|
+
/**
|
|
298
|
+
* Pose the camera FROM a basis: the writable counterpart of
|
|
299
|
+
* {@link Camera3d#getBasis}, taking the same three vectors in the same
|
|
300
|
+
* order. `setBasis(...)` straight after `getBasis(...)` is the identity.
|
|
301
|
+
*
|
|
302
|
+
* This is what a view over a curved surface needs. Up there is the
|
|
303
|
+
* surface normal and differs at every point, so no pitch and yaw pair
|
|
304
|
+
* expresses it, and integrating angles towards it drifts and gimbals at
|
|
305
|
+
* the poles. Hand over the frame the game already has instead.
|
|
306
|
+
*
|
|
307
|
+
* The basis is decoded into `pitch`, `yaw` and `roll`, which remain the
|
|
308
|
+
* camera's only orientation state, so the view transform, the frustum
|
|
309
|
+
* planes, the fog axis and {@link Sprite3d} billboards all follow with
|
|
310
|
+
* nothing to invalidate. A consequence worth knowing: the camera can
|
|
311
|
+
* never end up holding something that is not a rotation. A non-unit or
|
|
312
|
+
* slightly sheared triple is absorbed rather than rejected, `forward`
|
|
313
|
+
* winning, then the component of `up` perpendicular to it, with `right`
|
|
314
|
+
* consulted only when `up` decides nothing. A surface frame integrated
|
|
315
|
+
* over thousands of steps drifts off orthonormal, and this is the
|
|
316
|
+
* difference between a camera that tolerates that and one that renders a
|
|
317
|
+
* sheared view.
|
|
318
|
+
*
|
|
319
|
+
* The vectors passed in are never modified.
|
|
320
|
+
*
|
|
321
|
+
* Note `up` here is the camera's local +Y column, which under this
|
|
322
|
+
* engine's Y-down render space points DOWN the screen. That is the
|
|
323
|
+
* opposite of {@link Camera3d#lookAt}'s `up`, which is the direction that
|
|
324
|
+
* should appear up on screen. The two are one negation apart, and each
|
|
325
|
+
* is the natural sense for its own call.
|
|
326
|
+
* @param right - the camera's local +X axis, in world space
|
|
327
|
+
* @param up - the camera's local +Y axis, in world space
|
|
328
|
+
* @param forward - the camera's local +Z axis: where it looks
|
|
329
|
+
* @returns this camera, for chaining
|
|
330
|
+
* @throws {Error} if any component is not finite, or every component of
|
|
331
|
+
* `forward` is zero. The axes need not be unit, or even close to it: only
|
|
332
|
+
* their directions are read.
|
|
333
|
+
* @see Camera3d#getBasis
|
|
334
|
+
* @example
|
|
335
|
+
* // a camera standing on the surface of a globe, looking along it
|
|
336
|
+
* const up = surfaceNormal(player); // differs at every point
|
|
337
|
+
* const forward = heading(player);
|
|
338
|
+
* const right = forward.clone().cross(up).normalize();
|
|
339
|
+
* camera.setBasis(right, up, forward);
|
|
340
|
+
*/
|
|
341
|
+
setBasis(right: Vector3d, up: Vector3d, forward: Vector3d): this;
|
|
278
342
|
/**
|
|
279
343
|
* The camera's world-space right axis (unit). See {@link Camera3d#getBasis}.
|
|
280
344
|
* @param out - vector to write into (returned)
|
|
@@ -303,7 +367,7 @@ export default class Camera3d extends Camera2d {
|
|
|
303
367
|
resize(w: number, h: number): this;
|
|
304
368
|
/**
|
|
305
369
|
* Point the camera at a world-space target by deriving pitch and
|
|
306
|
-
* yaw from the direction (target − camera.pos).
|
|
370
|
+
* yaw from the direction (target − camera.pos).
|
|
307
371
|
*
|
|
308
372
|
* Three call shapes:
|
|
309
373
|
* - `lookAt(x, y, z)` — raw world coordinates
|
|
@@ -312,26 +376,49 @@ export default class Camera3d extends Camera2d {
|
|
|
312
376
|
* `Renderable.lookAt(target)` signature so Camera3d is a structural
|
|
313
377
|
* drop-in replacement for Camera2d / Renderable in user code).
|
|
314
378
|
*
|
|
379
|
+
* **With no `up`, roll is untouched**, exactly as before this argument
|
|
380
|
+
* existed. Pass one to bank the horizon as well: it is the direction that
|
|
381
|
+
* should appear UP ON SCREEN, so a level horizon is `(0, -1, 0)` — this
|
|
382
|
+
* engine renders Y-down, which is why the visual up axis is negative Y.
|
|
383
|
+
* It is given no default on purpose, because defaulting it would silently
|
|
384
|
+
* zero the roll of every camera that had one.
|
|
385
|
+
*
|
|
386
|
+
* Note this is the opposite sense to {@link Camera3d#setBasis}'s `up`,
|
|
387
|
+
* which is the camera's local +Y column and points down the screen. Each
|
|
388
|
+
* is the natural reading for its own call, and they are one negation
|
|
389
|
+
* apart.
|
|
390
|
+
*
|
|
391
|
+
* When the direction to the target is parallel to `up` there is no
|
|
392
|
+
* rotation about the view axis to solve, so the roll is left as it was
|
|
393
|
+
* and the camera still points exactly at the target.
|
|
394
|
+
*
|
|
315
395
|
* Last-write-wins with manual `pitch` / `yaw` assignment: if you
|
|
316
396
|
* call `lookAt(...)` then set `camera.pitch = 0.1` directly, the
|
|
317
|
-
* next frame renders with the manual pitch.
|
|
318
|
-
* @
|
|
319
|
-
* @param
|
|
397
|
+
* next frame renders with the manual pitch. The same holds for
|
|
398
|
+
* {@link Camera3d#setBasis}.
|
|
399
|
+
* @param xOrTarget - target world x, or a target to look at: any renderable, or anything carrying `pos` or `x`/`y`/`z`
|
|
400
|
+
* @param yOrUp - target world y when the first argument is a number, otherwise the up direction
|
|
320
401
|
* @param z - target world z (only when first arg is a number)
|
|
402
|
+
* @param up - the direction to appear up on screen (only when first arg is a number)
|
|
321
403
|
* @returns this camera
|
|
404
|
+
* @example
|
|
405
|
+
* camera.lookAt(target); // pitch and yaw only
|
|
406
|
+
* camera.lookAt(target, surfaceNormal); // and bank to the surface
|
|
322
407
|
*/
|
|
323
|
-
lookAt(
|
|
408
|
+
lookAt(target: Renderable | {
|
|
324
409
|
x: number;
|
|
325
410
|
y: number;
|
|
326
411
|
z?: number;
|
|
327
412
|
pos?: ObservableVector3d;
|
|
328
|
-
},
|
|
413
|
+
}, up?: Vector3d): this;
|
|
414
|
+
lookAt(x: number, y?: number, z?: number, up?: Vector3d): this;
|
|
329
415
|
/**
|
|
330
416
|
* Convenience overload of `lookAt` accepting a {@link Vector3d}.
|
|
331
417
|
* @param target - world-space point to look at
|
|
418
|
+
* @param up - optional direction to appear up on screen; see {@link Camera3d#lookAt}
|
|
332
419
|
* @returns this camera
|
|
333
420
|
*/
|
|
334
|
-
setLookAt(target: Vector3d): this;
|
|
421
|
+
setLookAt(target: Vector3d, up?: Vector3d): this;
|
|
335
422
|
/**
|
|
336
423
|
* Set the target-local follow offset. Called once when configuring
|
|
337
424
|
* a follow-cam (e.g. behind-and-above third person:
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"camera3d.d.ts","sourceRoot":"","sources":["../../src/camera/camera3d.ts"],"names":[],"mappings":"AA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;;;;;;;;OA2BG;IACH,YAAY,CACX,KAAK,EAAE;QAAE,UAAU,EAAE,OAAO,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,EAC9C,GAAG,CAAC,EAAE,UAAU,EAAE,GAChB,UAAU,EAAE;IAkCf;;;;;;;;;;;;;;;OAeG;IACH,aAAa,CACZ,KAAK,EAAE,QAAQ,EACf,GAAG,GAAE,QAAyB,GAC5B,QAAQ,GAAG,IAAI;CAyElB"}
|
|
@@ -4,12 +4,16 @@ import { AABB3d } from "../physics/broadphase/aabb3d.ts";
|
|
|
4
4
|
/**
|
|
5
5
|
* An axis-aligned 3D box, usable as a {@link Body} collision shape.
|
|
6
6
|
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
* {@link
|
|
10
|
-
* can only ever produce a 2D pushback — see
|
|
11
|
-
* A `Box3d` pair is instead resolved by an
|
|
12
|
-
* fills {@link ResponseObject#overlapZ}.
|
|
7
|
+
* One of the two shapes that let a body collide along **Z** as well as X and
|
|
8
|
+
* Y, the other being {@link Sphere}. The planar shapes ({@link Polygon},
|
|
9
|
+
* {@link Rect}, {@link RoundRect}, {@link Ellipse}) are resolved by the 2D SAT
|
|
10
|
+
* narrowphase, which can only ever produce a 2D pushback — see
|
|
11
|
+
* {@link ResponseObject#overlapV}. A `Box3d` pair is instead resolved by an
|
|
12
|
+
* AABB-vs-AABB narrowphase that also fills {@link ResponseObject#overlapZ}.
|
|
13
|
+
*
|
|
14
|
+
* A `Box3d` is world-axis-aligned and cannot be oriented, which makes it the
|
|
15
|
+
* shape for walls, floors and crates, and the wrong one for anything that
|
|
16
|
+
* turns. Reach for a `Sphere` there.
|
|
13
17
|
*
|
|
14
18
|
* Coordinate convention matches the rest of melonJS 3D code (see
|
|
15
19
|
* {@link Camera3d}): **Y-down, +Z forward / away from the camera.**
|
|
@@ -53,6 +57,20 @@ export declare class Box3d {
|
|
|
53
57
|
* @default "Box3d"
|
|
54
58
|
*/
|
|
55
59
|
type: string;
|
|
60
|
+
/**
|
|
61
|
+
* Optional per-shape collision settings, honoured by {@link Body#addShape}
|
|
62
|
+
* and defaulted there. Declared rather than initialized: the body writes
|
|
63
|
+
* them when the shape joins it, so a class field here would emit an
|
|
64
|
+
* `undefined` own property on every shape ever built. See `addShape` for
|
|
65
|
+
* the table of defaults and what each one does.
|
|
66
|
+
* @see Body#addShape
|
|
67
|
+
*/
|
|
68
|
+
collisionType?: number;
|
|
69
|
+
collisionMask?: number;
|
|
70
|
+
/** `false` takes this shape out of collision without removing it */
|
|
71
|
+
isActive?: boolean;
|
|
72
|
+
/** `true` reports contacts but skips the position correction */
|
|
73
|
+
isTrigger?: boolean;
|
|
56
74
|
/**
|
|
57
75
|
* @param x - center of the box on the horizontal axis
|
|
58
76
|
* @param y - center of the box on the vertical axis
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"box3d.d.ts","sourceRoot":"","sources":["../../src/geometries/box3d.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAC/C,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC9C,OAAO,EAAE,MAAM,EAAE,MAAM,iCAAiC,CAAC;AAYzD
|
|
1
|
+
{"version":3,"file":"box3d.d.ts","sourceRoot":"","sources":["../../src/geometries/box3d.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAC/C,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC9C,OAAO,EAAE,MAAM,EAAE,MAAM,iCAAiC,CAAC;AAYzD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AACH,qBAAa,KAAK;IACjB;;OAEG;IACH,GAAG,EAAE,QAAQ,CAAC;IAEd;;;;OAIG;IACH,WAAW,EAAE,QAAQ,CAAC;IAEtB;;;OAGG;IACH,IAAI,SAAW;IAEf;;;;;;;OAOG;IACK,aAAa,CA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
|
|
37
37
|
*/
|
|
38
38
|
type: string;
|
|
39
|
+
/**
|
|
40
|
+
* Optional per-shape collision settings, honoured by {@link Body#addShape}
|
|
41
|
+
* and defaulted there. Declared rather than initialized: the body writes
|
|
42
|
+
* them when the shape joins it, so a class field here would emit an
|
|
43
|
+
* `undefined` own property on every shape ever built. See `addShape` for
|
|
44
|
+
* the table of defaults and what each one does.
|
|
45
|
+
* @see Body#addShape
|
|
46
|
+
*/
|
|
47
|
+
collisionType?: number;
|
|
48
|
+
collisionMask?: number;
|
|
49
|
+
/** `false` takes this shape out of collision without removing it */
|
|
50
|
+
isActive?: boolean;
|
|
51
|
+
/** `true` reports contacts but skips the position correction */
|
|
52
|
+
isTrigger?: boolean;
|
|
39
53
|
/**
|
|
40
54
|
* @param x - the center x coordinate of the ellipse
|
|
41
55
|
* @param y - the center y coordinate of the ellipse
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ellipse.d.ts","sourceRoot":"","sources":["../../src/geometries/ellipse.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,QAAQ,EAAgB,MAAM,qBAAqB,CAAC;AAC7D,OAAO,EAAE,MAAM,EAAc,MAAM,sBAAsB,CAAC;AAE1D,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAEvC;;;GAGG;AACH,qBAAa,OAAO;IACnB;;OAEG;IACH,GAAG,EAAE,QAAQ,CAAC;IASd;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;IAEf;;OAEG;IACH,OAAO,EAAE,QAAQ,CAAC;IAElB;;OAEG;IACH,OAAO,CAAC,QAAQ,CAAW;IAE3B;;OAEG;IACH,KAAK,EAAE,QAAQ,CAAC;IA8BhB;;OAEG;IACH,IAAI,KAAK,WAER;IACD,IAAI,KAAK,CAAC,KAAK,QAAA,EAMd;IAED;;OAEG;IACH,IAAI,SAAa;IAEjB;;;;;OAKG;gBAC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AC,MAAM,EAAE,QAAQ,GAAG,OAAO;IAoBpC;;;;;;;;;;;;;;OAcG;IACH,QAAQ,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,OAAO;IACvC,QAAQ,CAAC,MAAM,EAAE,QAAQ,GAAG,OAAO;IA+BnC;;;OAGG;IACH,SAAS;IAOT;;;;;OAKG;IACH,SAAS,CAAC,QAAQ,SAAK;IA2BvB;;;OAGG;IACH,KAAK;CAaL;AAED,eAAO,MAAM,WAAW,kGAYtB,CAAC"}
|
|
@@ -43,6 +43,20 @@ export declare class Polygon {
|
|
|
43
43
|
* the shape type (used internally)
|
|
44
44
|
*/
|
|
45
45
|
type: string;
|
|
46
|
+
/**
|
|
47
|
+
* Optional per-shape collision settings, honoured by {@link Body#addShape}
|
|
48
|
+
* and defaulted there. Declared rather than initialized: the body writes
|
|
49
|
+
* them when the shape joins it, so a class field here would emit an
|
|
50
|
+
* `undefined` own property on every shape ever built. See `addShape` for
|
|
51
|
+
* the table of defaults and what each one does.
|
|
52
|
+
* @see Body#addShape
|
|
53
|
+
*/
|
|
54
|
+
collisionType?: number;
|
|
55
|
+
collisionMask?: number;
|
|
56
|
+
/** `false` takes this shape out of collision without removing it */
|
|
57
|
+
isActive?: boolean;
|
|
58
|
+
/** `true` reports contacts but skips the position correction */
|
|
59
|
+
isTrigger?: boolean;
|
|
46
60
|
/**
|
|
47
61
|
* @param [x=0] - origin point of the Polygon
|
|
48
62
|
* @param [y=0] - origin point of the Polygon
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"polygon.d.ts","sourceRoot":"","sources":["../../src/geometries/polygon.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAC/C,OAAO,EAAE,QAAQ,EAAgB,MAAM,qBAAqB,CAAC;AAC7D,OAAO,EAAE,MAAM,EAAc,MAAM,sBAAsB,CAAC;AAE1D,OAAO,EAAE,OAAO,EAAE,MAAM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;;;;OAKG;IACH,KAAK,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,SAAI;IAWtB;;;;OAIG;IACH,MAAM,CAAC,CAAC,EAAE,QAAQ;IAIlB;;;;OAIG;IACH,MAAM;IA8DN;;;OAGG;IACH,UAAU;IAcV;;;OAGG;IACH,QAAQ;IAoCR;;;;;;;;;OASG;IACH,SAAS,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,OAAO;IACxC,SAAS,CAAC,MAAM,EAAE,QAAQ,GAAG,OAAO;IAoBpC;;;;;;;;OAQG;IACH,KAAK,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,IAAI;IACjC,KAAK,CAAC,MAAM,EAAE,QAAQ,GAAG,IAAI;IAgB7B;;;;;;;;;;;;;;;;OAgBG;IACH,QAAQ,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,OAAO;IACvC,QAAQ,CAAC,MAAM,EAAE,QAAQ,GAAG,OAAO;IAmCnC;;;OAGG;IACH,SAAS;IAIT;;;OAGG;IACH,YAAY;IASZ;;;OAGG;IACH,KAAK;CAYL;AAED,eAAO,MAAM,WAAW,8FAYtB,CAAC"}
|
|
@@ -7,9 +7,12 @@ import { AABB3d } from "../physics/broadphase/aabb3d.ts";
|
|
|
7
7
|
* sphere-vs-sphere / sphere-vs-AABB collision check under
|
|
8
8
|
* {@link Camera3d}.
|
|
9
9
|
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
10
|
+
* Also a BODY SHAPE. A `Body` carrying a Sphere is resolved by the
|
|
11
|
+
* builtin 3D narrowphase against another Sphere or a {@link Box3d},
|
|
12
|
+
* which is what makes it the right primitive for anything that tumbles
|
|
13
|
+
* or is laid out over a curved surface: a {@link Box3d} is
|
|
14
|
+
* world-axis-aligned and cannot be oriented, so every object whose "up"
|
|
15
|
+
* points a different way needs a shape that has no "up" at all.
|
|
13
16
|
* @category Geometry
|
|
14
17
|
* @example
|
|
15
18
|
* import { Sphere } from "melonjs";
|
|
@@ -19,6 +22,27 @@ import { AABB3d } from "../physics/broadphase/aabb3d.ts";
|
|
|
19
22
|
* a.overlaps(b); // true — surfaces touch at x = 5
|
|
20
23
|
*/
|
|
21
24
|
export declare class Sphere {
|
|
25
|
+
/**
|
|
26
|
+
* Shape tag, as the narrowphase's pair table keys on. That table is a
|
|
27
|
+
* string concat of the two shapes' types and a missing entry is a hard
|
|
28
|
+
* failure rather than a missed collision, so this has to match the
|
|
29
|
+
* entries registered in the detector exactly.
|
|
30
|
+
*/
|
|
31
|
+
type: string;
|
|
32
|
+
/**
|
|
33
|
+
* Optional per-shape collision settings, honoured by {@link Body#addShape}
|
|
34
|
+
* and defaulted there. Declared rather than initialized: the body writes
|
|
35
|
+
* them when the shape joins it, so a class field here would emit an
|
|
36
|
+
* `undefined` own property on every shape ever built. See `addShape` for
|
|
37
|
+
* the table of defaults and what each one does.
|
|
38
|
+
* @see Body#addShape
|
|
39
|
+
*/
|
|
40
|
+
collisionType?: number;
|
|
41
|
+
collisionMask?: number;
|
|
42
|
+
/** `false` takes this shape out of collision without removing it */
|
|
43
|
+
isActive?: boolean;
|
|
44
|
+
/** `true` reports contacts but skips the position correction */
|
|
45
|
+
isTrigger?: boolean;
|
|
22
46
|
/** Centre coordinates of the sphere (Y-down, +Z forward — Camera3d convention). */
|
|
23
47
|
pos: Vector3d;
|
|
24
48
|
/** Sphere radius. Negative values are treated like their absolute value in {@link Sphere.overlaps} / {@link Sphere.contains}. */
|
|
@@ -69,9 +93,14 @@ export declare class Sphere {
|
|
|
69
93
|
*/
|
|
70
94
|
overlapsAABB(aabb: AABB3d): boolean;
|
|
71
95
|
/**
|
|
72
|
-
* Smallest {@link AABB3d} containing this sphere.
|
|
73
|
-
*
|
|
74
|
-
*
|
|
96
|
+
* Smallest {@link AABB3d} containing this sphere. The same instance
|
|
97
|
+
* every time, refreshed from the current centre and radius on each
|
|
98
|
+
* call, so it is never stale: as a body shape a sphere gets moved by
|
|
99
|
+
* whoever owns it — directly through `pos`, not only through
|
|
100
|
+
* {@link Sphere.setShape} — and a cache that only refreshed on
|
|
101
|
+
* `setShape` reported the position the sphere was first asked about
|
|
102
|
+
* for the rest of its life. Callers must not hold the instance across
|
|
103
|
+
* a move and expect the old values.
|
|
75
104
|
*/
|
|
76
105
|
getBounds(): AABB3d;
|
|
77
106
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sphere.d.ts","sourceRoot":"","sources":["../../src/geometries/sphere.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAC/C,OAAO,EAAE,MAAM,EAAE,MAAM,iCAAiC,CAAC;AAGzD
|
|
1
|
+
{"version":3,"file":"sphere.d.ts","sourceRoot":"","sources":["../../src/geometries/sphere.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAC/C,OAAO,EAAE,MAAM,EAAE,MAAM,iCAAiC,CAAC;AAGzD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,qBAAa,MAAM;IAClB;;;;;OAKG;IACH,IAAI,SAAY;IAEhB;;;;;;;OAOG;IACK,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,aAAa,CAAC,EAAE,MAAM,CAAC;IAC/B,oEAAoE;IAC5D,QAAQ,CAAC,EAAE,OAAO,CAAC;IAC3B,gEAAgE;IACxD,SAAS,CAAC,EAAE,OAAO,CAAC;IAE5B,mFAAmF;IACnF,GAAG,EAAE,QAAQ,CAAC;IAEd,iIAAiI;IACjI,MAAM,EAAE,MAAM,CAAC;IAYf;;;;;OAKG;gBACS,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM;IAK3D;;;;;;;;OAQG;IACH,QAAQ,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM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