excalibur 0.33.0-alpha.99 → 1.1.0-alpha.310
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/.nvmrc +1 -1
- package/CHANGELOG.md +206 -5
- package/build/esm/excalibur.development.js +37363 -35202
- package/build/esm/excalibur.js +37363 -35202
- package/build/esm/excalibur.min.development.js +18360 -23963
- package/build/esm/excalibur.min.js +18360 -23963
- package/build/{dist → esm/src/engine}/actions/action/move-by.d.ts +1 -4
- package/build/{dist → esm/src/engine}/actions/action/move-to.d.ts +1 -4
- package/build/{dist → esm/src/engine}/actions/action/repeat-forever.d.ts +8 -0
- package/build/{dist → esm/src/engine}/actions/action/rotate-by.d.ts +9 -3
- package/build/{dist → esm/src/engine}/actions/action-context.d.ts +9 -43
- package/build/{dist → esm/src/engine}/actions/actions-component.d.ts +3 -41
- package/build/{dist → esm/src/engine}/actions/actions-system.d.ts +2 -3
- package/build/{dist → esm/src/engine}/actions/index.d.ts +0 -2
- package/build/{dist → esm/src/engine}/actor.d.ts +19 -30
- package/build/{dist → esm/src/engine}/camera.d.ts +13 -10
- package/build/{dist → esm/src/engine}/collision/body-component.d.ts +11 -20
- package/build/{dist → esm/src/engine}/collision/bounding-box.d.ts +3 -10
- package/build/{dist → esm/src/engine}/collision/collider-component.d.ts +17 -2
- package/build/{dist → esm/src/engine}/collision/colliders/circle-collider.d.ts +8 -0
- package/build/{dist → esm/src/engine}/collision/colliders/closest-line-jump-table.d.ts +1 -1
- package/build/{dist → esm/src/engine}/collision/colliders/collider.d.ts +7 -1
- package/build/{dist/collision/colliders/shape.d.ts → esm/src/engine/collision/colliders/colliders.d.ts} +50 -0
- package/build/{dist → esm/src/engine}/collision/colliders/collision-jump-table.d.ts +2 -1
- package/build/{dist → esm/src/engine}/collision/colliders/edge-collider.d.ts +25 -1
- package/build/{dist → esm/src/engine}/collision/colliders/polygon-collider.d.ts +23 -0
- package/build/esm/src/engine/collision/colliders/sat-shape.d.ts +27 -0
- package/build/{dist → esm/src/engine}/collision/colliders/separating-axis.d.ts +11 -6
- package/build/{dist → esm/src/engine}/collision/collision-system.d.ts +9 -5
- package/build/{dist → esm/src/engine}/collision/detection/collision-contact.d.ts +6 -0
- package/build/{dist → esm/src/engine}/collision/detection/dynamic-tree.d.ts +9 -11
- package/build/{dist → esm/src/engine}/collision/detection/pair.d.ts +9 -0
- package/build/{dist → esm/src/engine}/collision/detection/quad-tree.d.ts +2 -2
- package/build/{dist → esm/src/engine}/collision/detection/sparse-hash-grid-collision-processor.d.ts +7 -2
- package/build/{dist → esm/src/engine}/collision/detection/sparse-hash-grid.d.ts +11 -3
- package/build/{dist → esm/src/engine}/collision/group/collision-group-manager.d.ts +1 -1
- package/build/{dist → esm/src/engine}/collision/index.d.ts +2 -1
- package/build/{dist → esm/src/engine}/collision/motion-system.d.ts +2 -3
- package/build/{dist → esm/src/engine}/collision/physics-config.d.ts +7 -0
- package/build/{dist → esm/src/engine}/collision/physics-world.d.ts +34 -33
- package/build/esm/src/engine/collision/solver/realistic-solver.d.ts +50 -0
- package/build/{dist → esm/src/engine}/collision/solver/solver.d.ts +4 -2
- package/build/{dist → esm/src/engine}/debug/debug-config.d.ts +16 -0
- package/build/{dist → esm/src/engine}/debug/debug-system.d.ts +3 -3
- package/build/esm/src/engine/deprecated.d.ts +1 -0
- package/build/{dist → esm/src/engine}/director/director.d.ts +13 -8
- package/build/{dist → esm/src/engine}/director/slide.d.ts +2 -2
- package/build/{dist → esm/src/engine}/director/transition.d.ts +1 -4
- package/build/{dist → esm/src/engine}/engine.d.ts +58 -8
- package/build/{dist → esm/src/engine}/entity-component-system/component.d.ts +1 -1
- package/build/{dist → esm/src/engine}/entity-component-system/components/motion-component.d.ts +1 -0
- package/build/{dist → esm/src/engine}/entity-component-system/components/pause-component.d.ts +2 -0
- package/build/{dist → esm/src/engine}/entity-component-system/components/tags-component.d.ts +1 -0
- package/build/{dist → esm/src/engine}/entity-component-system/components/transform-component.d.ts +1 -0
- package/build/{dist → esm/src/engine}/entity-component-system/entity.d.ts +0 -10
- package/build/{dist → esm/src/engine}/entity-component-system/index.d.ts +0 -1
- package/build/{dist → esm/src/engine}/entity-component-system/query.d.ts +1 -1
- package/build/{dist → esm/src/engine}/entity-component-system/system.d.ts +11 -4
- package/build/{dist → esm/src/engine}/entity-component-system/world.d.ts +1 -5
- package/build/{dist → esm/src/engine}/events/media-events.d.ts +3 -3
- package/build/{dist → esm/src/engine}/events.d.ts +4 -4
- package/build/{dist → esm/src/engine}/graphics/animation.d.ts +15 -5
- package/build/{dist → esm/src/engine}/graphics/context/circle-renderer/circle-renderer.d.ts +5 -0
- package/build/{dist → esm/src/engine}/graphics/context/debug-text.d.ts +13 -1
- package/build/{dist → esm/src/engine}/graphics/context/excalibur-graphics-context-2d-canvas.d.ts +13 -3
- package/build/{dist → esm/src/engine}/graphics/context/excalibur-graphics-context-webgl.d.ts +43 -6
- package/build/{dist → esm/src/engine}/graphics/context/excalibur-graphics-context.d.ts +108 -4
- package/build/esm/src/engine/graphics/context/framebuffer.d.ts +154 -0
- package/build/esm/src/engine/graphics/context/glsl.d.ts +47 -0
- package/build/{dist → esm/src/engine}/graphics/context/material-renderer/material-renderer.d.ts +1 -0
- package/build/esm/src/engine/graphics/context/material.d.ts +208 -0
- package/build/esm/src/engine/graphics/context/shader-pipeline/effects/bloom-effect.d.ts +80 -0
- package/build/esm/src/engine/graphics/context/shader-pipeline/effects/blur-passes.d.ts +75 -0
- package/build/esm/src/engine/graphics/context/shader-pipeline/effects/glow-passes.d.ts +93 -0
- package/build/esm/src/engine/graphics/context/shader-pipeline/shader-pass.d.ts +138 -0
- package/build/esm/src/engine/graphics/context/shader-pipeline/shader-pipeline.d.ts +91 -0
- package/build/{dist → esm/src/engine}/graphics/context/shader.d.ts +43 -6
- package/build/{dist → esm/src/engine}/graphics/context/texture-loader.d.ts +1 -1
- package/build/{dist → esm/src/engine}/graphics/context/webgl-util.d.ts +2 -2
- package/build/{dist → esm/src/engine}/graphics/debug-graphics-component.d.ts +1 -0
- package/build/{dist → esm/src/engine}/graphics/filtering.d.ts +1 -1
- package/build/{dist → esm/src/engine}/graphics/font-common.d.ts +2 -2
- package/build/{dist → esm/src/engine}/graphics/font-text-instance.d.ts +5 -5
- package/build/{dist → esm/src/engine}/graphics/font.d.ts +3 -3
- package/build/{dist → esm/src/engine}/graphics/graphics-component.d.ts +28 -15
- package/build/{dist → esm/src/engine}/graphics/graphics-group.d.ts +6 -0
- package/build/{dist → esm/src/engine}/graphics/graphics-system.d.ts +3 -3
- package/build/{dist → esm/src/engine}/graphics/image-source.d.ts +1 -1
- package/build/{dist → esm/src/engine}/graphics/index.d.ts +8 -0
- package/build/{dist → esm/src/engine}/graphics/offscreen-system.d.ts +2 -2
- package/build/{dist → esm/src/engine}/graphics/parallax-component.d.ts +1 -0
- package/build/{dist → esm/src/engine}/graphics/post-processor/color-blindness-post-processor.d.ts +3 -5
- package/build/esm/src/engine/graphics/post-processor/post-processor.d.ts +66 -0
- package/build/esm/src/engine/graphics/post-processor/shader-pipeline-post-processor.d.ts +45 -0
- package/build/{dist → esm/src/engine}/graphics/sprite-font.d.ts +3 -3
- package/build/{dist → esm/src/engine}/index.d.ts +5 -5
- package/build/{dist → esm/src/engine}/input/gamepad.d.ts +4 -7
- package/build/{dist → esm/src/engine}/input/keyboard.d.ts +3 -3
- package/build/{dist → esm/src/engine}/input/pointer-component.d.ts +1 -0
- package/build/{dist → esm/src/engine}/input/pointer-event-receiver.d.ts +13 -0
- package/build/{dist → esm/src/engine}/input/pointer-system.d.ts +3 -3
- package/build/{dist → esm/src/engine}/interfaces/index.d.ts +0 -2
- package/build/{dist → esm/src/engine}/label.d.ts +2 -2
- package/build/esm/src/engine/lighting/cone-light-component.d.ts +47 -0
- package/build/esm/src/engine/lighting/darkness-component.d.ts +34 -0
- package/build/esm/src/engine/lighting/flicker-options.d.ts +17 -0
- package/build/esm/src/engine/lighting/flicker-system.d.ts +19 -0
- package/build/esm/src/engine/lighting/index.d.ts +8 -0
- package/build/esm/src/engine/lighting/light-occluder-component.d.ts +66 -0
- package/build/esm/src/engine/lighting/lighting-config.d.ts +47 -0
- package/build/esm/src/engine/lighting/lighting-system.d.ts +153 -0
- package/build/esm/src/engine/lighting/point-light-component.d.ts +46 -0
- package/build/{dist → esm/src/engine}/math/affine-matrix.d.ts +8 -1
- package/build/esm/src/engine/math/coord-plane.d.ts +52 -0
- package/build/{dist → esm/src/engine}/math/graph.d.ts +2 -3
- package/build/{dist → esm/src/engine}/math/index.d.ts +2 -0
- package/build/{dist → esm/src/engine}/math/line-segment.d.ts +1 -1
- package/build/{dist → esm/src/engine}/math/matrix.d.ts +25 -0
- package/build/{dist → esm/src/engine}/math/ray.d.ts +1 -1
- package/build/{dist → esm/src/engine}/math/transform.d.ts +9 -0
- package/build/{dist → esm/src/engine}/math/vector.d.ts +16 -13
- package/build/esm/src/engine/math/vector3.d.ts +163 -0
- package/build/esm/src/engine/math/vector4.d.ts +157 -0
- package/build/{dist → esm/src/engine}/particles/gpu-particle-emitter.d.ts +2 -2
- package/build/{dist → esm/src/engine}/particles/particle-emitter.d.ts +2 -2
- package/build/{dist → esm/src/engine}/particles/particles.d.ts +6 -1
- package/build/esm/src/engine/plugin.d.ts +253 -0
- package/build/{dist → esm/src/engine}/resources/resource.d.ts +8 -0
- package/build/{dist → esm/src/engine}/resources/sound/index.d.ts +1 -1
- package/build/esm/src/engine/resources/sound/sound-manager.d.ts +378 -0
- package/build/esm/src/engine/resources/sound/sound-track.d.ts +176 -0
- package/build/esm/src/engine/resources/sound/sound.d.ts +351 -0
- package/build/{dist → esm/src/engine}/scene.d.ts +13 -7
- package/build/{dist → esm/src/engine}/screen-element.d.ts +2 -2
- package/build/{dist → esm/src/engine}/screen.d.ts +97 -29
- package/build/{dist → esm/src/engine}/tile-map/isometric-entity-component.d.ts +1 -0
- package/build/{dist → esm/src/engine}/tile-map/isometric-entity-system.d.ts +2 -3
- package/build/{dist → esm/src/engine}/tile-map/isometric-map.d.ts +0 -10
- package/build/{dist → esm/src/engine}/tile-map/tile-map.d.ts +2 -0
- package/build/{dist → esm/src/engine}/timer.d.ts +5 -8
- package/build/{dist/util/pool.d.ts → esm/src/engine/util/arena-pool.d.ts} +15 -4
- package/build/{dist → esm/src/engine}/util/browser.d.ts +8 -0
- package/build/{dist → esm/src/engine}/util/detector.d.ts +1 -1
- package/build/{dist → esm/src/engine}/util/draw-util.d.ts +2 -2
- package/build/{dist → esm/src/engine}/util/index.d.ts +0 -1
- package/build/{dist → esm/src/engine}/util/pause-system.d.ts +7 -1
- package/build/{dist → esm/src/engine}/util/rental-pool.d.ts +1 -0
- package/build/{dist → esm/src/engine}/util/serializer.d.ts +1 -1
- package/build/{dist → esm/src/engine}/util/state-machine.d.ts +1 -1
- package/package.json +38 -44
- package/tsconfig.json +38 -1
- package/.devcontainer/devcontainer.json +0 -26
- package/.git-blame-ignore-revs +0 -3
- package/.gitattributes +0 -70
- package/.gitmodules +0 -0
- package/.husky/pre-commit +0 -1
- package/.prettierrc +0 -8
- package/build/dist/collision/solver/realistic-solver.d.ts +0 -28
- package/build/dist/deprecated.d.ts +0 -0
- package/build/dist/entity-component-system/tag-query.d.ts +0 -28
- package/build/dist/excalibur.development.js +0 -35408
- package/build/dist/excalibur.js +0 -35408
- package/build/dist/excalibur.min.development.js +0 -931
- package/build/dist/excalibur.min.js +0 -931
- package/build/dist/graphics/context/material.d.ts +0 -102
- package/build/dist/graphics/context/render-source.d.ts +0 -7
- package/build/dist/graphics/context/render-target.d.ts +0 -60
- package/build/dist/graphics/post-processor/post-processor.d.ts +0 -36
- package/build/dist/interfaces/audio-implementation.d.ts +0 -25
- package/build/dist/interfaces/audio.d.ts +0 -55
- package/build/dist/math/coord-plane.d.ts +0 -15
- package/build/dist/resources/sound/sound-manager.d.ts +0 -102
- package/build/dist/resources/sound/sound.d.ts +0 -215
- package/build/dist/resources/sound/web-audio-instance.d.ts +0 -49
- package/build/dist/util/decorators.d.ts +0 -15
- package/build/dist/util/easing-functions.d.ts +0 -89
- package/build/dist/util/sound.d.ts +0 -5
- package/deno.json +0 -10
- package/eslint.config.mjs +0 -210
- package/playground/README.md +0 -71
- package/playground/index.html +0 -75
- package/playground/package-lock.json +0 -1976
- package/playground/package.json +0 -27
- package/playground/public/favicon.ico +0 -0
- package/playground/public/icon.png +0 -0
- package/playground/public/logo-white@2x.png +0 -0
- package/playground/public/logo@2x.png +0 -0
- package/playground/public/player-run.png +0 -0
- package/playground/public/rpg-audio/License.txt +0 -21
- package/playground/public/rpg-audio/audio/handleCoins.ogg +0 -0
- package/playground/public/social.jpg +0 -0
- package/playground/public/social.png +0 -0
- package/playground/public/tiny-town/License.txt +0 -22
- package/playground/public/tiny-town/tilemap/tilemap.png +0 -0
- package/playground/tsconfig.json +0 -26
- package/playground/tsdown.config.ts +0 -13
- package/playground/vite.config.ts +0 -5
- package/vite.config.common.js +0 -27
- package/vite.config.ts +0 -78
- package/vitest.config.ts +0 -41
- /package/build/{dist → esm/src/engine}/actions/action/action-sequence.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/actions/action/blink.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/actions/action/call-method.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/actions/action/curve-by.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/actions/action/curve-to.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/actions/action/delay.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/actions/action/die.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/actions/action/ease-by.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/actions/action/ease-to.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/actions/action/fade.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/actions/action/flash.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/actions/action/follow.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/actions/action/meet.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/actions/action/parallel-actions.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/actions/action/repeat.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/actions/action/rotate-to.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/actions/action/scale-by.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/actions/action/scale-to.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/actions/action-queue.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/actions/action.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/actions/actionable.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/collision/colliders/composite-collider.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/collision/collision-type.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/collision/detection/collision-processor.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/collision/detection/dynamic-tree-collision-processor.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/collision/detection/ray-cast-hit.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/collision/detection/ray-cast-options.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/collision/detection/spatial-partition-strategy.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/collision/group/collision-group.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/collision/integrator.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/collision/island.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/collision/side.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/collision/solver/arcade-solver.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/collision/solver/contact-bias.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/collision/solver/contact-constraint-point.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/collision/solver-strategy.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/color.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/context.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/debug/debug-flags.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/debug/index.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/director/cross-fade.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/director/default-loader.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/director/fade-in-out.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/director/index.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/director/loader.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/entity-component-system/entity-manager.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/entity-component-system/priority.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/entity-component-system/query-manager.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/entity-component-system/system-manager.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/entity-component-system/types.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/event-emitter.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/events/ex-event.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/events/pointer-events.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/excalibur.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/flags.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/garbage-collector.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/graphics/canvas.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/graphics/circle.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/graphics/context/debug-circle-renderer/debug-circle-renderer.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/graphics/context/debug-line-renderer/debug-line-renderer.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/graphics/context/debug-point-renderer/debug-point-renderer.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/graphics/context/draw-call.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/graphics/context/image-renderer/image-renderer.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/graphics/context/image-renderer-v2/image-renderer-v2.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/graphics/context/particle-renderer/particle-renderer.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/graphics/context/quad-index-buffer.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/graphics/context/rectangle-renderer/rectangle-renderer.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/graphics/context/renderer.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/graphics/context/screen-pass-painter/screen-pass-painter.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/graphics/context/state-stack.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/graphics/context/transform-stack.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/graphics/context/uniform-buffer.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/graphics/context/vertex-buffer.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/graphics/context/vertex-layout.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/graphics/debug.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/graphics/font-cache.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/graphics/graphic.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/graphics/graphics-diagnostics.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/graphics/line.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/graphics/nine-slice.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/graphics/polygon.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/graphics/post-processor/color-blindness-mode.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/graphics/post-processor/screen-shader.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/graphics/raster.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/graphics/rectangle.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/graphics/sprite-sheet.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/graphics/sprite.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/graphics/text.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/graphics/tiled-animation.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/graphics/tiled-sprite.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/graphics/transform-interpolation.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/graphics/wrapping.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/id.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/input/capture-pointer-config.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/input/input-host.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/input/input-mapper.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/input/native-pointer-button.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/input/pointer-abstraction.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/input/pointer-button.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/input/pointer-event.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/input/pointer-events-to-object-dispatcher.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/input/pointer-scope.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/input/pointer-type.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/input/wheel-delta-mode.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/input/wheel-event.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/interfaces/clonable.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/interfaces/evented.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/interfaces/lifecycle-events.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/interfaces/loadable.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/interfaces/pointer-event-handlers.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/math/bezier-curve.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/math/easings.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/math/global-coordinates.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/math/lerp.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/math/projection.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/math/random.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/math/rotation-type.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/math/util.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/math/vector-view.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/math/watch-vector.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/particles/emitter-type.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/particles/gpu-particle-renderer.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/particles/index.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/polyfill.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/resources/font.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/resources/gif.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/resources/index.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/resources/sound/audio-context.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/tile-map/index.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/trigger.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/util/assert.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/util/clock.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/util/coroutine.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/util/fps.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/util/future.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/util/iframe.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/util/log.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/util/observable.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/util/required.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/util/semaphore.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/util/string.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/util/toaster.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/util/util.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/util/watch.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/util/web-audio.d.ts +0 -0
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
import { Color } from '../../color';
|
|
2
|
+
import type { ExcaliburGraphicsContext } from './excalibur-graphics-context';
|
|
3
|
+
import type { Shader, UniformDictionary } from './shader';
|
|
4
|
+
import type { ImageSource } from '../image-source';
|
|
5
|
+
import { ImageFiltering } from '../filtering';
|
|
6
|
+
import { Framebuffer } from './framebuffer';
|
|
7
|
+
import type { ShaderPassLike, ShaderPipelineLike } from './shader-pipeline/shader-pipeline';
|
|
8
|
+
type MaterialSharedOptions = {
|
|
9
|
+
/**
|
|
10
|
+
* Name the material for debugging
|
|
11
|
+
*/
|
|
12
|
+
name?: string;
|
|
13
|
+
/**
|
|
14
|
+
* Excalibur graphics context to create the material (only WebGL is supported at the moment)
|
|
15
|
+
*/
|
|
16
|
+
graphicsContext?: ExcaliburGraphicsContext;
|
|
17
|
+
/**
|
|
18
|
+
* Optionally specify a vertex shader
|
|
19
|
+
*
|
|
20
|
+
* If none supplied the default will be used
|
|
21
|
+
*
|
|
22
|
+
* ```
|
|
23
|
+
* #version 300 es
|
|
24
|
+
* // vertex position in local space
|
|
25
|
+
* in vec2 a_position;
|
|
26
|
+
* in vec2 a_uv;
|
|
27
|
+
* out vec2 v_uv;
|
|
28
|
+
* // orthographic projection matrix
|
|
29
|
+
* uniform mat4 u_matrix;
|
|
30
|
+
* // world space transform matrix
|
|
31
|
+
* uniform mat4 u_transform;
|
|
32
|
+
* void main() {
|
|
33
|
+
* // Set the vertex position using the ortho & transform matrix
|
|
34
|
+
* gl_Position = u_matrix * u_transform * vec4(a_position, 0.0, 1.0);
|
|
35
|
+
* // Pass through the UV coord to the fragment shader
|
|
36
|
+
* v_uv = a_uv;
|
|
37
|
+
* }
|
|
38
|
+
* ```
|
|
39
|
+
*/
|
|
40
|
+
vertexSource?: string;
|
|
41
|
+
/**
|
|
42
|
+
* Add custom color, by default ex.Color.Transparent
|
|
43
|
+
*/
|
|
44
|
+
color?: Color;
|
|
45
|
+
/**
|
|
46
|
+
* Add additional images to the material, you are limited by the GPU's maximum texture slots
|
|
47
|
+
*
|
|
48
|
+
* Specify a dictionary of uniform sampler names to ImageSource, they are also bound as named
|
|
49
|
+
* sources in every pass when `passes` is provided
|
|
50
|
+
*/
|
|
51
|
+
images?: Record<string, ImageSource>;
|
|
52
|
+
/**
|
|
53
|
+
* Optionally set starting uniforms on a shader, they are also forwarded to every pass when
|
|
54
|
+
* `passes` is provided
|
|
55
|
+
*/
|
|
56
|
+
uniforms?: UniformDictionary;
|
|
57
|
+
};
|
|
58
|
+
type MaterialShaderOptions = // single pass custom shading
|
|
59
|
+
{
|
|
60
|
+
/**
|
|
61
|
+
* The fragment shader applied when the graphic is drawn on screen
|
|
62
|
+
*
|
|
63
|
+
* *Note: Excalibur image alpha's are pre-multiplied
|
|
64
|
+
*
|
|
65
|
+
* Pre-built varyings:
|
|
66
|
+
*
|
|
67
|
+
* * `in vec2 v_uv` - UV coordinate
|
|
68
|
+
* * `in vec2 v_screenuv` - UV coordinate
|
|
69
|
+
*
|
|
70
|
+
* Pre-built uniforms:
|
|
71
|
+
*
|
|
72
|
+
* * `uniform sampler2D u_graphic` - The current graphic displayed by the GraphicsComponent
|
|
73
|
+
* * `uniform sampler2D u_image` - Synonym for `u_graphic`
|
|
74
|
+
* * `uniform sampler2D u_original` - The pre-effect graphic; equal to `u_graphic`/`u_image` when there is no pipeline
|
|
75
|
+
* * `uniform sampler2D u_screen_texture` - The screen texture, bound when referenced in the source
|
|
76
|
+
* * `uniform vec2 u_resolution` - The current resolution of the screen (in pixels)
|
|
77
|
+
* * `uniform vec2 u_graphic_resolution` - The current resolution of the graphic (in pixels)
|
|
78
|
+
* * `uniform vec2 u_size;` - The current size of the graphic (in pixels)
|
|
79
|
+
* * `uniform vec4 u_color` - The current color of the material
|
|
80
|
+
* * `uniform float u_opacity` - The current opacity of the graphics context
|
|
81
|
+
* * `uniform float u_time_ms` - The current time in milliseconds
|
|
82
|
+
* * `uniform mat4 u_matrix` - The orthographic projection matrix
|
|
83
|
+
* * `uniform mat4 u_transform` - The current geometry transform matrix
|
|
84
|
+
*/
|
|
85
|
+
fragmentSource: string;
|
|
86
|
+
passes?: undefined;
|
|
87
|
+
padding?: undefined;
|
|
88
|
+
} | {
|
|
89
|
+
/**
|
|
90
|
+
* Multipass pipeline run on the graphic's texture offscreen before it is drawn.
|
|
91
|
+
*
|
|
92
|
+
* Provide an ordered list of passes (bare fragment strings or {@apilink ShaderPass}), or any
|
|
93
|
+
* {@apilink ShaderPipelineLike} implementation ({@apilink BloomEffect}, {@apilink GlowEffect},
|
|
94
|
+
* {@apilink BlurEffect}, or your own pass graph).
|
|
95
|
+
*
|
|
96
|
+
* The material's `uniforms`, `images`, and built-ins (`u_opacity`, `u_color`,
|
|
97
|
+
* `u_graphic_resolution`, `u_size`) are forwarded to every pass.
|
|
98
|
+
*/
|
|
99
|
+
passes: ShaderPassLike[] | ShaderPipelineLike;
|
|
100
|
+
/**
|
|
101
|
+
* The **final composite** fragment shader: it draws the pipeline's output (bound as
|
|
102
|
+
* `u_graphic`, with `u_image` as a synonym) on screen and is where screen-space work like
|
|
103
|
+
* `u_screen_texture` belongs. The pre-effect graphic is also available as `u_original`, so
|
|
104
|
+
* the composite can mix the processed result with the untouched source.
|
|
105
|
+
*
|
|
106
|
+
* When omitted a passthrough composite is used that draws the pipeline output with the
|
|
107
|
+
* context opacity applied.
|
|
108
|
+
*/
|
|
109
|
+
fragmentSource?: string;
|
|
110
|
+
/**
|
|
111
|
+
* Extra transparent pixels (in source-texture pixels) added around the graphic when running
|
|
112
|
+
* `passes`, so effects like blur/glow are not clipped to the graphic's quad. The on-screen
|
|
113
|
+
* quad expands to match. Default 0.
|
|
114
|
+
*/
|
|
115
|
+
padding?: number;
|
|
116
|
+
};
|
|
117
|
+
export type MaterialOptions = MaterialShaderOptions & MaterialSharedOptions;
|
|
118
|
+
/**
|
|
119
|
+
* {@apilink MaterialOptions} without the graphics context, preserving the valid
|
|
120
|
+
* fragmentSource/passes combinations, used by {@apilink ExcaliburGraphicsContextWebGL.createMaterial}
|
|
121
|
+
*/
|
|
122
|
+
export type MaterialOptionsWithoutContext = MaterialShaderOptions & Omit<MaterialSharedOptions, 'graphicsContext'>;
|
|
123
|
+
export interface MaterialImageOptions {
|
|
124
|
+
filtering?: ImageFiltering;
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Passed to {@apilink Material.update}'s callback for batch-updating a material mid-frame.
|
|
128
|
+
*/
|
|
129
|
+
export interface MaterialContext {
|
|
130
|
+
/**
|
|
131
|
+
* The material's uniforms, the same dictionary as `material.uniforms` changes
|
|
132
|
+
* reach the composite shader and, when `passes` is used, are forwarded to every pass
|
|
133
|
+
*/
|
|
134
|
+
uniforms: UniformDictionary;
|
|
135
|
+
/**
|
|
136
|
+
* Every compiled {@apilink Shader} this material drives, in order
|
|
137
|
+
*/
|
|
138
|
+
shaders: Shader[];
|
|
139
|
+
/**
|
|
140
|
+
* The same shaders as `shaders`, keyed by {@apilink Shader.name}.
|
|
141
|
+
*/
|
|
142
|
+
shadersByName: Map<string, Shader>;
|
|
143
|
+
}
|
|
144
|
+
export declare class Material {
|
|
145
|
+
static BuiltInUniforms: string[];
|
|
146
|
+
private static _ID;
|
|
147
|
+
/**
|
|
148
|
+
* Unique identifier for this material, useful for debugging and tooling
|
|
149
|
+
*/
|
|
150
|
+
readonly id: number;
|
|
151
|
+
private _logger;
|
|
152
|
+
private _name;
|
|
153
|
+
private _shader;
|
|
154
|
+
private _color;
|
|
155
|
+
private _initialized;
|
|
156
|
+
private _fragmentSource;
|
|
157
|
+
private _vertexSource;
|
|
158
|
+
private _images;
|
|
159
|
+
private _uniforms;
|
|
160
|
+
private _graphicsContext?;
|
|
161
|
+
private _passes?;
|
|
162
|
+
private _pipeline;
|
|
163
|
+
private _padding;
|
|
164
|
+
private _seedFramebuffer?;
|
|
165
|
+
private _outputFramebuffer;
|
|
166
|
+
constructor(options: MaterialOptions);
|
|
167
|
+
private _initialize;
|
|
168
|
+
get uniforms(): UniformDictionary;
|
|
169
|
+
get images(): Record<string, ImageSource>;
|
|
170
|
+
get color(): Color;
|
|
171
|
+
set color(c: Color);
|
|
172
|
+
get name(): string;
|
|
173
|
+
/**
|
|
174
|
+
* Vertex source this material was created with (before shader compilation)
|
|
175
|
+
*/
|
|
176
|
+
get vertexSource(): string;
|
|
177
|
+
/**
|
|
178
|
+
* Fragment source this material was created with (before shader compilation)
|
|
179
|
+
*/
|
|
180
|
+
get fragmentSource(): string;
|
|
181
|
+
get isOverridingGraphic(): boolean;
|
|
182
|
+
get isUsingScreenTexture(): boolean;
|
|
183
|
+
get isUsingOriginalTexture(): boolean;
|
|
184
|
+
/**
|
|
185
|
+
* The multipass pipeline run on the graphic before the composite fragment, if any
|
|
186
|
+
*/
|
|
187
|
+
get pipeline(): ShaderPipelineLike | null;
|
|
188
|
+
/**
|
|
189
|
+
* Extra transparent pixels added around the graphic when running the pipeline
|
|
190
|
+
*/
|
|
191
|
+
get padding(): number;
|
|
192
|
+
/**
|
|
193
|
+
* Lazily creates/resizes the padded framebuffer
|
|
194
|
+
* @internal
|
|
195
|
+
*/
|
|
196
|
+
getSeedFramebuffer(width: number, height: number): Framebuffer;
|
|
197
|
+
/**
|
|
198
|
+
* Lazily creates/resizes the final output for compositing
|
|
199
|
+
* @internal
|
|
200
|
+
*/
|
|
201
|
+
getOutputFramebuffer(width: number, height: number, filtering?: ImageFiltering | null): Framebuffer;
|
|
202
|
+
update(callback: (context: MaterialContext) => any): void;
|
|
203
|
+
getShader(): Shader | null;
|
|
204
|
+
addImageSource(samplerName: string, image: ImageSource): void;
|
|
205
|
+
removeImageSource(samplerName: string): void;
|
|
206
|
+
use(): void;
|
|
207
|
+
}
|
|
208
|
+
export {};
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import type { ExcaliburGraphicsContextWebGL } from '../../excalibur-graphics-context-webgl';
|
|
2
|
+
import type { Shader } from '../../shader';
|
|
3
|
+
import type { ShaderPassDestination, ShaderPassSource } from '../shader-pass';
|
|
4
|
+
import type { ShaderPipelineLike, ShaderPipelineProcessOptions } from '../shader-pipeline';
|
|
5
|
+
export interface BloomEffectOptions {
|
|
6
|
+
graphicsContext: ExcaliburGraphicsContextWebGL;
|
|
7
|
+
/**
|
|
8
|
+
* Luminance cutoff (0-1) above which pixels contribute to the bloom, default 0.8
|
|
9
|
+
*/
|
|
10
|
+
threshold?: number;
|
|
11
|
+
/**
|
|
12
|
+
* Multiplies the bloom light **added on top of** the original image, default 1.
|
|
13
|
+
*
|
|
14
|
+
* 1 is the neutral amount, values above 1 read as hotter, values below 1 are subtle.
|
|
15
|
+
*/
|
|
16
|
+
intensity?: number;
|
|
17
|
+
/**
|
|
18
|
+
* Depth of the downsample/upsample ladder, default 4.
|
|
19
|
+
*
|
|
20
|
+
* Each level halves the resolution, more levels produce a wider, softer bloom for the same cost
|
|
21
|
+
* profile. Clamped to at least 1.
|
|
22
|
+
*/
|
|
23
|
+
levels?: number;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Multipass bloom: bright areas of the source are extracted, blurred down a progressive
|
|
27
|
+
* downsample ladder, accumulated back up with tent-filter upsampling, and added onto the
|
|
28
|
+
* original image.
|
|
29
|
+
*
|
|
30
|
+
* Implements {@apilink ShaderPipelineLike} as a non-linear pass graph, so it plugs into either
|
|
31
|
+
* integration point:
|
|
32
|
+
*
|
|
33
|
+
* ```typescript
|
|
34
|
+
* // fullscreen
|
|
35
|
+
* game.graphicsContext.addPostProcessor(
|
|
36
|
+
* new ex.ShaderPipelinePostProcessor({
|
|
37
|
+
* passes: new ex.BloomEffect({ graphicsContext, threshold: 0.6, intensity: 1.5 })
|
|
38
|
+
* })
|
|
39
|
+
* );
|
|
40
|
+
*
|
|
41
|
+
* // or per-graphic
|
|
42
|
+
* actor.graphics.material = new ex.Material({
|
|
43
|
+
* graphicsContext,
|
|
44
|
+
* passes: new ex.BloomEffect({ graphicsContext, threshold: 0.5 }),
|
|
45
|
+
* padding: 32 // room for the bloom halo
|
|
46
|
+
* });
|
|
47
|
+
* ```
|
|
48
|
+
*/
|
|
49
|
+
export declare class BloomEffect implements ShaderPipelineLike {
|
|
50
|
+
private _graphicsContext;
|
|
51
|
+
private _levels;
|
|
52
|
+
private _threshold;
|
|
53
|
+
private _downsample;
|
|
54
|
+
private _upsampleMerge;
|
|
55
|
+
private _combine;
|
|
56
|
+
private _downFramebuffers;
|
|
57
|
+
private _upFramebuffers;
|
|
58
|
+
private _disposed;
|
|
59
|
+
constructor(options: BloomEffectOptions);
|
|
60
|
+
/**
|
|
61
|
+
* Luminance cutoff (0-1) above which pixels contribute to the bloom
|
|
62
|
+
*/
|
|
63
|
+
get threshold(): number;
|
|
64
|
+
set threshold(value: number);
|
|
65
|
+
/**
|
|
66
|
+
* Multiplies the bloom light **added on top of** the original image.
|
|
67
|
+
*
|
|
68
|
+
* 1 is the neutral amount, values above 1 read as hotter, values below 1 are subtle.
|
|
69
|
+
*/
|
|
70
|
+
get intensity(): number;
|
|
71
|
+
set intensity(value: number);
|
|
72
|
+
private _ensureFramebuffers;
|
|
73
|
+
process(source: ShaderPassSource, destination: ShaderPassDestination, options?: ShaderPipelineProcessOptions): void;
|
|
74
|
+
/**
|
|
75
|
+
* Every internal pass's compiled {@apilink Shader}, in the order they run: threshold,
|
|
76
|
+
* downsample, upsample-merge, combine
|
|
77
|
+
*/
|
|
78
|
+
getShaders(): Shader[];
|
|
79
|
+
dispose(): void;
|
|
80
|
+
}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import type { ExcaliburGraphicsContextWebGL } from '../../excalibur-graphics-context-webgl';
|
|
2
|
+
import type { Shader } from '../../shader';
|
|
3
|
+
import type { ShaderPassDestination, ShaderPassSource } from '../shader-pass';
|
|
4
|
+
import { ShaderPass } from '../shader-pass';
|
|
5
|
+
import type { ShaderPipelineLike, ShaderPipelineProcessOptions } from '../shader-pipeline';
|
|
6
|
+
export interface BlurPassesOptions {
|
|
7
|
+
graphicsContext: ExcaliburGraphicsContextWebGL;
|
|
8
|
+
/**
|
|
9
|
+
* Resolution the blur runs at relative to the source, default 0.5 (half resolution).
|
|
10
|
+
*
|
|
11
|
+
* Lower is cheaper and blurrier, the final pass linearly upsamples back to full resolution.
|
|
12
|
+
*/
|
|
13
|
+
scale?: number;
|
|
14
|
+
/**
|
|
15
|
+
* Blur radius multiplier in texels of the (downsampled) blur resolution, default 1
|
|
16
|
+
*/
|
|
17
|
+
strength?: number;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Blurring premultiplied colors directly is the correct alpha handling for a weighted average,
|
|
21
|
+
* so this fragment opts out of the glsl tag's straight-alpha authoring space.
|
|
22
|
+
*
|
|
23
|
+
* Expects `u_direction` (e.g. `vec(1, 0)` for horizontal) and `u_strength` uniforms.
|
|
24
|
+
*/
|
|
25
|
+
export declare const gaussianBlurFragmentSource: string;
|
|
26
|
+
/**
|
|
27
|
+
* Separable 9-tap gaussian blur: a horizontal pass at `scale` resolution followed by a vertical
|
|
28
|
+
* pass that linearly upsamples back to the destination resolution.
|
|
29
|
+
*
|
|
30
|
+
* ```typescript
|
|
31
|
+
* const material = new ex.Material({
|
|
32
|
+
* graphicsContext,
|
|
33
|
+
* passes: createBlurPasses({ graphicsContext }),
|
|
34
|
+
* padding: 8 // give the blur room so it is not clipped to the graphic
|
|
35
|
+
* });
|
|
36
|
+
*
|
|
37
|
+
* // or fullscreen
|
|
38
|
+
* game.graphicsContext.addPostProcessor(
|
|
39
|
+
* new ex.ShaderPipelinePostProcessor({ passes: createBlurPasses({ graphicsContext }) })
|
|
40
|
+
* );
|
|
41
|
+
* ```
|
|
42
|
+
*/
|
|
43
|
+
export declare function createBlurPasses(options: BlurPassesOptions): ShaderPass[];
|
|
44
|
+
/**
|
|
45
|
+
* Separable gaussian blur wrapped in a convenient object with live-tunable settings, the
|
|
46
|
+
* ergonomic counterpart to {@apilink createBlurPasses}.
|
|
47
|
+
*
|
|
48
|
+
* ```typescript
|
|
49
|
+
* const blur = new ex.BlurEffect({ graphicsContext, strength: 2 });
|
|
50
|
+
* actor.graphics.material = new ex.Material({ graphicsContext, passes: blur, padding: 16 });
|
|
51
|
+
*
|
|
52
|
+
* blur.strength = 4; // animate any time, applies next frame
|
|
53
|
+
* ```
|
|
54
|
+
*/
|
|
55
|
+
export declare class BlurEffect implements ShaderPipelineLike {
|
|
56
|
+
/**
|
|
57
|
+
* Resolution the blur runs at relative to the source, fixed at construction
|
|
58
|
+
*/
|
|
59
|
+
readonly scale: number;
|
|
60
|
+
private _pipeline;
|
|
61
|
+
private _horizontal;
|
|
62
|
+
private _vertical;
|
|
63
|
+
constructor(options: BlurPassesOptions);
|
|
64
|
+
/**
|
|
65
|
+
* Blur radius multiplier in texels of the (downsampled) blur resolution
|
|
66
|
+
*/
|
|
67
|
+
get strength(): number;
|
|
68
|
+
set strength(value: number);
|
|
69
|
+
process(source: ShaderPassSource, destination: ShaderPassDestination, options?: ShaderPipelineProcessOptions): void;
|
|
70
|
+
/**
|
|
71
|
+
* Every internal pass's compiled {@apilink Shader}, in the order they run
|
|
72
|
+
*/
|
|
73
|
+
getShaders(): Shader[];
|
|
74
|
+
dispose(): void;
|
|
75
|
+
}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { Color } from '../../../../color';
|
|
2
|
+
import type { ExcaliburGraphicsContextWebGL } from '../../excalibur-graphics-context-webgl';
|
|
3
|
+
import type { Shader } from '../../shader';
|
|
4
|
+
import type { ShaderPassDestination, ShaderPassSource } from '../shader-pass';
|
|
5
|
+
import { ShaderPass } from '../shader-pass';
|
|
6
|
+
import type { ShaderPipelineLike, ShaderPipelineProcessOptions } from '../shader-pipeline';
|
|
7
|
+
export interface GlowPassesOptions {
|
|
8
|
+
graphicsContext: ExcaliburGraphicsContextWebGL;
|
|
9
|
+
/**
|
|
10
|
+
* Glow color, default white
|
|
11
|
+
*/
|
|
12
|
+
color?: Color;
|
|
13
|
+
/**
|
|
14
|
+
* Resolution the glow blur runs at relative to the source, default 0.5 (half resolution)
|
|
15
|
+
*/
|
|
16
|
+
scale?: number;
|
|
17
|
+
/**
|
|
18
|
+
* Blur radius multiplier in texels of the (downsampled) glow resolution, default 2
|
|
19
|
+
*/
|
|
20
|
+
strength?: number;
|
|
21
|
+
/**
|
|
22
|
+
* Multiplies the halo's **opacity**, default 1.
|
|
23
|
+
*
|
|
24
|
+
* The halo saturates at full opacity, so 0-1 is the useful range for fading a glow in and
|
|
25
|
+
* out; values above 1 make the core denser and hotter before saturating.
|
|
26
|
+
*/
|
|
27
|
+
intensity?: number;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Outer glow: the graphic's silhouette is tinted with the glow color, gaussian blurred at reduced
|
|
31
|
+
* resolution, and the original graphic is composited back over the halo.
|
|
32
|
+
*
|
|
33
|
+
* Designed for per-graphic use with a {@apilink Material}, where `padding` gives the halo room
|
|
34
|
+
* outside the graphic's quad:
|
|
35
|
+
*
|
|
36
|
+
* ```typescript
|
|
37
|
+
* actor.graphics.material = new ex.Material({
|
|
38
|
+
* graphicsContext,
|
|
39
|
+
* passes: ex.createGlowPasses({ graphicsContext, color: ex.Color.Cyan, strength: 3 }),
|
|
40
|
+
* padding: 16
|
|
41
|
+
* });
|
|
42
|
+
* ```
|
|
43
|
+
*/
|
|
44
|
+
export declare function createGlowPasses(options: GlowPassesOptions): ShaderPass[];
|
|
45
|
+
/**
|
|
46
|
+
* Outer glow wrapped in a convenient object with live-tunable settings, the ergonomic
|
|
47
|
+
* counterpart to {@apilink createGlowPasses}.
|
|
48
|
+
*
|
|
49
|
+
* ```typescript
|
|
50
|
+
* const glow = new ex.GlowEffect({ graphicsContext, color: ex.Color.Cyan, strength: 3 });
|
|
51
|
+
* actor.graphics.material = new ex.Material({ graphicsContext, passes: glow, padding: 16 });
|
|
52
|
+
*
|
|
53
|
+
* glow.intensity = 2; // animate any time, applies next frame
|
|
54
|
+
* glow.color = ex.Color.Magenta;
|
|
55
|
+
* ```
|
|
56
|
+
*/
|
|
57
|
+
export declare class GlowEffect implements ShaderPipelineLike {
|
|
58
|
+
/**
|
|
59
|
+
* Resolution the glow blur runs at relative to the source, fixed at construction
|
|
60
|
+
*/
|
|
61
|
+
readonly scale: number;
|
|
62
|
+
private _pipeline;
|
|
63
|
+
private _silhouette;
|
|
64
|
+
private _horizontal;
|
|
65
|
+
private _vertical;
|
|
66
|
+
private _color;
|
|
67
|
+
constructor(options: GlowPassesOptions);
|
|
68
|
+
/**
|
|
69
|
+
* Glow color. Assign a new color to change it, mutating the color instance in place
|
|
70
|
+
* will not be picked up.
|
|
71
|
+
*/
|
|
72
|
+
get color(): Color;
|
|
73
|
+
set color(value: Color);
|
|
74
|
+
/**
|
|
75
|
+
* Multiplies the halo's **opacity**.
|
|
76
|
+
*
|
|
77
|
+
* The halo saturates at full opacity, so 0-1 is the useful range for fading a glow in and
|
|
78
|
+
* out; values above 1 make the core denser and hotter before saturating.
|
|
79
|
+
*/
|
|
80
|
+
get intensity(): number;
|
|
81
|
+
set intensity(value: number);
|
|
82
|
+
/**
|
|
83
|
+
* Blur radius multiplier in texels of the (downsampled) glow resolution
|
|
84
|
+
*/
|
|
85
|
+
get strength(): number;
|
|
86
|
+
set strength(value: number);
|
|
87
|
+
process(source: ShaderPassSource, destination: ShaderPassDestination, options?: ShaderPipelineProcessOptions): void;
|
|
88
|
+
/**
|
|
89
|
+
* Every internal pass's compiled {@apilink Shader}, in the order they run
|
|
90
|
+
*/
|
|
91
|
+
getShaders(): Shader[];
|
|
92
|
+
dispose(): void;
|
|
93
|
+
}
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
import { ImageFiltering } from '../../filtering';
|
|
2
|
+
import { ImageSource } from '../../image-source';
|
|
3
|
+
import type { ExcaliburGraphicsContextWebGL } from '../excalibur-graphics-context-webgl';
|
|
4
|
+
import { Framebuffer } from '../framebuffer';
|
|
5
|
+
import type { Shader, UniformDictionary } from '../shader';
|
|
6
|
+
/**
|
|
7
|
+
* Anything a {@apilink ShaderPass} can sample from: a {@apilink Framebuffer}, a loaded
|
|
8
|
+
* {@apilink ImageSource}, or a raw premultiplied `WebGLTexture`
|
|
9
|
+
*/
|
|
10
|
+
export type ShaderPassSource = Framebuffer | ImageSource | WebGLTexture;
|
|
11
|
+
/**
|
|
12
|
+
* Where a {@apilink ShaderPass} renders to: a {@apilink Framebuffer}, or `null` for the canvas backbuffer.
|
|
13
|
+
*
|
|
14
|
+
* Inside an engine frame use {@apilink ExcaliburGraphicsContextWebGL.drawTarget} to composite into the frame.
|
|
15
|
+
*/
|
|
16
|
+
export type ShaderPassDestination = Framebuffer | null;
|
|
17
|
+
export interface ShaderPassOptions {
|
|
18
|
+
graphicsContext: ExcaliburGraphicsContextWebGL;
|
|
19
|
+
/**
|
|
20
|
+
* Name the pass for debugging
|
|
21
|
+
*/
|
|
22
|
+
name?: string;
|
|
23
|
+
/**
|
|
24
|
+
* Fragment source, processed with the {@apilink glsl} tagged template (straight-alpha authoring,
|
|
25
|
+
* automatic `#version`/`precision`).
|
|
26
|
+
*
|
|
27
|
+
* Conventions available to every pass:
|
|
28
|
+
*
|
|
29
|
+
* * `uniform sampler2D u_image` - the source (positional shorthand); named sources bind to their record keys
|
|
30
|
+
* * `uniform sampler2D u_graphic` - synonym for `u_image`
|
|
31
|
+
* * `uniform sampler2D u_original` - the pipeline's original, pre-pass source
|
|
32
|
+
* * `uniform vec2 u_resolution` - destination resolution in pixels
|
|
33
|
+
* * `uniform vec2 u_texelSize` - `1.0 / primary source resolution`
|
|
34
|
+
* * `uniform float u_time_ms` - total time in milliseconds
|
|
35
|
+
* * `uniform float u_elapsed_ms` - elapsed milliseconds since the last frame when provided
|
|
36
|
+
* * `in vec2 v_uv` - 0-1 UV over the destination
|
|
37
|
+
*
|
|
38
|
+
* If omitted the pass is a passthrough (`fragColor = texture(u_image, v_uv)`)
|
|
39
|
+
*/
|
|
40
|
+
fragmentSource?: string;
|
|
41
|
+
/**
|
|
42
|
+
* Declarative per-pass uniforms, the same watched dictionary as {@apilink Shader.uniforms}
|
|
43
|
+
*/
|
|
44
|
+
uniforms?: UniformDictionary;
|
|
45
|
+
/**
|
|
46
|
+
* Relative resolution of this pass's output when {@apilink ShaderPipeline} auto-allocates its
|
|
47
|
+
* intermediate framebuffer, e.g. `0.5` renders at half resolution. Default 1.
|
|
48
|
+
*/
|
|
49
|
+
scale?: number;
|
|
50
|
+
/**
|
|
51
|
+
* Filtering used when this pass's auto-allocated intermediate framebuffer is sampled by the
|
|
52
|
+
* next pass. Default {@apilink ImageFiltering.Blended} (linear).
|
|
53
|
+
*/
|
|
54
|
+
filtering?: ImageFiltering;
|
|
55
|
+
}
|
|
56
|
+
export interface ShaderPassDrawOptions {
|
|
57
|
+
/**
|
|
58
|
+
* Single-source shorthand, bound as `u_image`
|
|
59
|
+
*/
|
|
60
|
+
source?: ShaderPassSource;
|
|
61
|
+
/**
|
|
62
|
+
* Named sources, each record key is bound as the sampler uniform of that name
|
|
63
|
+
*/
|
|
64
|
+
sources?: Record<string, ShaderPassSource>;
|
|
65
|
+
/**
|
|
66
|
+
* Where to render: a {@apilink Framebuffer} or `null` for the canvas backbuffer
|
|
67
|
+
*/
|
|
68
|
+
destination: ShaderPassDestination;
|
|
69
|
+
/**
|
|
70
|
+
* Per-draw uniform values, merged over (and persisted into) the pass uniforms
|
|
71
|
+
*/
|
|
72
|
+
uniforms?: UniformDictionary;
|
|
73
|
+
/**
|
|
74
|
+
* Elapsed milliseconds forwarded to `u_elapsed_ms`
|
|
75
|
+
*/
|
|
76
|
+
elapsed?: number;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Pixel dimensions of a {@apilink ShaderPassSource}, falling back to the canvas drawing buffer
|
|
80
|
+
* for raw `WebGLTexture`s which have no queryable dimensions
|
|
81
|
+
*/
|
|
82
|
+
export declare function getSourceDimensions(graphicsContext: ExcaliburGraphicsContextWebGL, source: ShaderPassSource): [width: number, height: number];
|
|
83
|
+
/**
|
|
84
|
+
* A single shader pass: draws a full-destination quad with a fragment shader, reading explicit
|
|
85
|
+
* sources and writing to an explicit destination.
|
|
86
|
+
*
|
|
87
|
+
* ```typescript
|
|
88
|
+
* const tint = new ex.ShaderPass({ graphicsContext, fragmentSource: myGlsl });
|
|
89
|
+
* tint.draw(sourceFramebuffer, destinationFramebuffer);
|
|
90
|
+
*
|
|
91
|
+
* // multiple named sources + per-draw uniforms
|
|
92
|
+
* merge.draw({
|
|
93
|
+
* sources: { u_smaller: quarterRes, u_larger: halfRes },
|
|
94
|
+
* destination: halfResOut,
|
|
95
|
+
* uniforms: { u_strength: 2 }
|
|
96
|
+
* });
|
|
97
|
+
* ```
|
|
98
|
+
*
|
|
99
|
+
* There is no hidden bind state to sequence, each draw states its inputs and output.
|
|
100
|
+
*/
|
|
101
|
+
export declare class ShaderPass {
|
|
102
|
+
private _logger;
|
|
103
|
+
readonly name: string;
|
|
104
|
+
/**
|
|
105
|
+
* Relative resolution used by {@apilink ShaderPipeline} for this pass's intermediate framebuffer
|
|
106
|
+
*/
|
|
107
|
+
readonly scale: number;
|
|
108
|
+
/**
|
|
109
|
+
* Filtering used by {@apilink ShaderPipeline} for this pass's intermediate framebuffer
|
|
110
|
+
*/
|
|
111
|
+
readonly filtering: ImageFiltering;
|
|
112
|
+
private _graphicsContext;
|
|
113
|
+
private _fragmentSource;
|
|
114
|
+
private _initialUniforms;
|
|
115
|
+
private _shader;
|
|
116
|
+
private _layout;
|
|
117
|
+
private _disposed;
|
|
118
|
+
constructor(options: ShaderPassOptions);
|
|
119
|
+
private _initialize;
|
|
120
|
+
/**
|
|
121
|
+
* The compiled {@apilink Shader} backing this pass, compiling it if necessary
|
|
122
|
+
*/
|
|
123
|
+
getShader(): Shader;
|
|
124
|
+
/**
|
|
125
|
+
* Declarative uniforms for this pass, changes are uploaded on the next draw
|
|
126
|
+
*/
|
|
127
|
+
get uniforms(): UniformDictionary;
|
|
128
|
+
private _resolveSource;
|
|
129
|
+
/**
|
|
130
|
+
* Draws the pass, `source` binds as `u_image`
|
|
131
|
+
*/
|
|
132
|
+
draw(source: ShaderPassSource, destination: ShaderPassDestination): void;
|
|
133
|
+
draw(options: ShaderPassDrawOptions): void;
|
|
134
|
+
/**
|
|
135
|
+
* Deletes the compiled shader program, the pass cannot be used afterwards
|
|
136
|
+
*/
|
|
137
|
+
dispose(): void;
|
|
138
|
+
}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import type { ExcaliburGraphicsContextWebGL } from '../excalibur-graphics-context-webgl';
|
|
2
|
+
import type { Shader, UniformDictionary } from '../shader';
|
|
3
|
+
import type { ShaderPassDestination, ShaderPassSource } from './shader-pass';
|
|
4
|
+
import { ShaderPass } from './shader-pass';
|
|
5
|
+
export interface ShaderPipelineProcessOptions {
|
|
6
|
+
/**
|
|
7
|
+
* Elapsed milliseconds forwarded to each pass's `u_elapsed_ms`
|
|
8
|
+
*/
|
|
9
|
+
elapsed?: number;
|
|
10
|
+
/**
|
|
11
|
+
* Uniform values forwarded to every pass, merged over each pass's own uniforms.
|
|
12
|
+
*
|
|
13
|
+
* Materials use this to flow their custom uniforms and built-ins into the pipeline.
|
|
14
|
+
*/
|
|
15
|
+
uniforms?: UniformDictionary;
|
|
16
|
+
/**
|
|
17
|
+
* Additional named sources bound to every pass after its own (`u_image`, `u_graphic`, `u_original`, ...),
|
|
18
|
+
* each record key is bound as the sampler uniform of that name.
|
|
19
|
+
*
|
|
20
|
+
* Materials use this to flow their `images` into the pipeline. Reserved pass source names
|
|
21
|
+
* cannot be overridden.
|
|
22
|
+
*/
|
|
23
|
+
sources?: Record<string, ShaderPassSource>;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Adds `extra` sources onto `sources` without clobbering the pass's own reserved names
|
|
27
|
+
* @internal
|
|
28
|
+
*/
|
|
29
|
+
export declare function mergePassSources(sources: Record<string, ShaderPassSource>, extra?: Record<string, ShaderPassSource>): Record<string, ShaderPassSource>;
|
|
30
|
+
/**
|
|
31
|
+
* Anything that can transform a source into a destination through one or more shader passes.
|
|
32
|
+
*
|
|
33
|
+
* {@apilink ShaderPipeline} is the built-in linear implementation; implement this directly for
|
|
34
|
+
* non-linear pass graphs (for example bloom's downsample/upsample ladder) and plug it into a
|
|
35
|
+
* {@apilink Material} or {@apilink ShaderPipelinePostProcessor} the same way.
|
|
36
|
+
*/
|
|
37
|
+
export interface ShaderPipelineLike {
|
|
38
|
+
process(source: ShaderPassSource, destination: ShaderPassDestination, options?: ShaderPipelineProcessOptions): void;
|
|
39
|
+
dispose?(): void;
|
|
40
|
+
/**
|
|
41
|
+
* Every compiled {@apilink Shader} this pipeline drives, in pass order. Optional — a pass graph
|
|
42
|
+
* that can't enumerate its own passes may omit this; {@apilink Material.update} falls back to
|
|
43
|
+
* just the composite shader when it's missing.
|
|
44
|
+
*/
|
|
45
|
+
getShaders?(): Shader[];
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* A {@apilink ShaderPass}, or a bare fragment source string that wraps into one
|
|
49
|
+
*/
|
|
50
|
+
export type ShaderPassLike = string | ShaderPass;
|
|
51
|
+
export interface ShaderPipelineOptions {
|
|
52
|
+
graphicsContext: ExcaliburGraphicsContextWebGL;
|
|
53
|
+
/**
|
|
54
|
+
* Name the pipeline for debugging
|
|
55
|
+
*/
|
|
56
|
+
name?: string;
|
|
57
|
+
/**
|
|
58
|
+
* Ordered passes, each one reads the previous pass's output as `u_image` (`u_graphic` is
|
|
59
|
+
* accepted as a synonym; the pipeline source for the first pass) and can read the original
|
|
60
|
+
* pipeline source as `u_original`
|
|
61
|
+
*/
|
|
62
|
+
passes: ShaderPassLike[];
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Runs an ordered chain of {@apilink ShaderPass}es:
|
|
66
|
+
* `source → pass0 → fb0 → pass1 → fb1 → ... → destination`
|
|
67
|
+
*
|
|
68
|
+
* Intermediate framebuffers are allocated lazily, one per pass, sized by each pass's `scale`
|
|
69
|
+
* relative to the source. The final pass renders into the caller's destination at the
|
|
70
|
+
* destination's own size, which is what upsamples a downscaled chain back up.
|
|
71
|
+
*/
|
|
72
|
+
export declare class ShaderPipeline implements ShaderPipelineLike {
|
|
73
|
+
readonly name: string;
|
|
74
|
+
readonly passes: ShaderPass[];
|
|
75
|
+
private _graphicsContext;
|
|
76
|
+
private _intermediates;
|
|
77
|
+
private _disposed;
|
|
78
|
+
constructor(options: ShaderPipelineOptions);
|
|
79
|
+
/**
|
|
80
|
+
* Runs every pass in order, rendering the final pass into `destination`
|
|
81
|
+
*/
|
|
82
|
+
process(source: ShaderPassSource, destination: ShaderPassDestination, options?: ShaderPipelineProcessOptions): void;
|
|
83
|
+
/**
|
|
84
|
+
* Every pass's compiled {@apilink Shader}, in pass order
|
|
85
|
+
*/
|
|
86
|
+
getShaders(): Shader[];
|
|
87
|
+
/**
|
|
88
|
+
* Disposes the passes and intermediate framebuffers, the pipeline cannot be used afterwards
|
|
89
|
+
*/
|
|
90
|
+
dispose(): void;
|
|
91
|
+
}
|