excalibur 0.28.3 → 0.28.4
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/.gitattributes +63 -63
- package/CHANGELOG.md +2003 -1955
- package/LICENSE.md +25 -25
- package/README.md +134 -134
- package/STYLEGUIDE.md +136 -136
- package/build/dist/Actions/Action/ActionSequence.js +31 -0
- package/build/dist/Actions/Action/ActionSequence.js.map +1 -0
- package/build/dist/Actions/Action/Blink.js +54 -0
- package/build/dist/Actions/Action/Blink.js.map +1 -0
- package/build/dist/Actions/Action/CallMethod.js +21 -0
- package/build/dist/Actions/Action/CallMethod.js.map +1 -0
- package/build/dist/Actions/Action/Delay.js +26 -0
- package/build/dist/Actions/Action/Delay.js.map +1 -0
- package/build/dist/Actions/Action/Die.js +22 -0
- package/build/dist/Actions/Action/Die.js.map +1 -0
- package/build/dist/Actions/Action/EaseBy.js +70 -0
- package/build/dist/Actions/Action/EaseBy.js.map +1 -0
- package/build/dist/Actions/Action/EaseTo.js +69 -0
- package/build/dist/Actions/Action/EaseTo.js.map +1 -0
- package/build/dist/Actions/Action/Fade.js +48 -0
- package/build/dist/Actions/Action/Fade.js.map +1 -0
- package/build/dist/Actions/Action/Follow.js +56 -0
- package/build/dist/Actions/Action/Follow.js.map +1 -0
- package/build/dist/Actions/Action/Meet.js +54 -0
- package/build/dist/Actions/Action/Meet.js.map +1 -0
- package/build/dist/Actions/Action/MoveBy.js +48 -0
- package/build/dist/Actions/Action/MoveBy.js.map +1 -0
- package/build/dist/Actions/Action/MoveTo.js +41 -0
- package/build/dist/Actions/Action/MoveTo.js.map +1 -0
- package/build/dist/Actions/Action/ParallelActions.js +23 -0
- package/build/dist/Actions/Action/ParallelActions.js.map +1 -0
- package/build/dist/Actions/Action/Repeat.js +31 -0
- package/build/dist/Actions/Action/Repeat.js.map +1 -0
- package/build/dist/Actions/Action/RepeatForever.js +37 -0
- package/build/dist/Actions/Action/RepeatForever.js.map +1 -0
- package/build/dist/Actions/Action/RotateBy.js +95 -0
- package/build/dist/Actions/Action/RotateBy.js.map +1 -0
- package/build/dist/Actions/Action/RotateTo.js +91 -0
- package/build/dist/Actions/Action/RotateTo.js.map +1 -0
- package/build/dist/Actions/Action/ScaleBy.js +46 -0
- package/build/dist/Actions/Action/ScaleBy.js.map +1 -0
- package/build/dist/Actions/Action/ScaleTo.js +58 -0
- package/build/dist/Actions/Action/ScaleTo.js.map +1 -0
- package/build/dist/Actions/Action.js +2 -0
- package/build/dist/Actions/Action.js.map +1 -0
- package/build/dist/Actions/ActionContext.js +322 -0
- package/build/dist/Actions/ActionContext.js.map +1 -0
- package/build/dist/Actions/ActionQueue.js +87 -0
- package/build/dist/Actions/ActionQueue.js.map +1 -0
- package/build/dist/Actions/Actionable.js +2 -0
- package/build/dist/Actions/Actionable.js.map +1 -0
- package/build/dist/Actions/ActionsComponent.js +195 -0
- package/build/dist/Actions/ActionsComponent.js.map +1 -0
- package/build/dist/Actions/ActionsSystem.js +30 -0
- package/build/dist/Actions/ActionsSystem.js.map +1 -0
- package/build/dist/Actions/Index.js +26 -0
- package/build/dist/Actions/Index.js.map +1 -0
- package/build/dist/Actions/RotationType.js +27 -0
- package/build/dist/Actions/RotationType.js.map +1 -0
- package/build/dist/Actor.js +629 -0
- package/build/dist/Actor.js.map +1 -0
- package/build/dist/Camera.js +660 -0
- package/build/dist/Camera.js.map +1 -0
- package/build/dist/Collision/BoundingBox.js +415 -0
- package/build/dist/Collision/BoundingBox.js.map +1 -0
- package/build/dist/Collision/ColliderComponent.js +202 -0
- package/build/dist/Collision/ColliderComponent.js.map +1 -0
- package/build/dist/Collision/Colliders/CircleCollider.js +226 -0
- package/build/dist/Collision/Colliders/CircleCollider.js.map +1 -0
- package/build/dist/Collision/Colliders/ClosestLineJumpTable.js +211 -0
- package/build/dist/Collision/Colliders/ClosestLineJumpTable.js.map +1 -0
- package/build/dist/Collision/Colliders/Collider.js +32 -0
- package/build/dist/Collision/Colliders/Collider.js.map +1 -0
- package/build/dist/Collision/Colliders/CollisionJumpTable.js +300 -0
- package/build/dist/Collision/Colliders/CollisionJumpTable.js.map +1 -0
- package/build/dist/Collision/Colliders/EdgeCollider.js +229 -0
- package/build/dist/Collision/Colliders/EdgeCollider.js.map +1 -0
- package/build/dist/Collision/Colliders/PolygonCollider.js +556 -0
- package/build/dist/Collision/Colliders/PolygonCollider.js.map +1 -0
- package/build/dist/Collision/Colliders/SeparatingAxis.js +67 -0
- package/build/dist/Collision/Colliders/SeparatingAxis.js.map +1 -0
- package/build/dist/Collision/Colliders/Shape.js +99 -0
- package/build/dist/Collision/Colliders/Shape.js.map +1 -0
- package/build/dist/Collision/CollisionType.js +33 -0
- package/build/dist/Collision/CollisionType.js.map +1 -0
- package/build/dist/Collision/Detection/CollisionContact.js +51 -0
- package/build/dist/Collision/Detection/CollisionContact.js.map +1 -0
- package/build/dist/Collision/Detection/CollisionProcessor.js +2 -0
- package/build/dist/Collision/Detection/CollisionProcessor.js.map +1 -0
- package/build/dist/Collision/Detection/DynamicTree.js +442 -0
- package/build/dist/Collision/Detection/DynamicTree.js.map +1 -0
- package/build/dist/Collision/Detection/Pair.js +92 -0
- package/build/dist/Collision/Detection/Pair.js.map +1 -0
- package/build/dist/Collision/Detection/QuadTree.js +193 -0
- package/build/dist/Collision/Detection/QuadTree.js.map +1 -0
- package/build/dist/Collision/Group/CollisionGroup.js +3 -3
- package/build/dist/Collision/Integrator.js +25 -0
- package/build/dist/Collision/Integrator.js.map +1 -0
- package/build/dist/Collision/MotionSystem.js +35 -0
- package/build/dist/Collision/MotionSystem.js.map +1 -0
- package/build/dist/Collision/Physics.js +163 -0
- package/build/dist/Collision/Physics.js.map +1 -0
- package/build/dist/Collision/PhysicsWorld.js +10 -0
- package/build/dist/Collision/PhysicsWorld.js.map +1 -0
- package/build/dist/Collision/Side.js +51 -0
- package/build/dist/Collision/Side.js.map +1 -0
- package/build/dist/Collision/Solver/ArcadeSolver.js +154 -0
- package/build/dist/Collision/Solver/ArcadeSolver.js.map +1 -0
- package/build/dist/Collision/Solver/ContactConstraintPoint.js +87 -0
- package/build/dist/Collision/Solver/ContactConstraintPoint.js.map +1 -0
- package/build/dist/Collision/Solver/RealisticSolver.js +293 -0
- package/build/dist/Collision/Solver/RealisticSolver.js.map +1 -0
- package/build/dist/Collision/Solver/Solver.js +2 -0
- package/build/dist/Collision/Solver/Solver.js.map +1 -0
- package/build/dist/Color.js +417 -0
- package/build/dist/Color.js.map +1 -0
- package/build/dist/Configurable.js +32 -0
- package/build/dist/Configurable.js.map +1 -0
- package/build/dist/Debug/Debug.d.ts +11 -0
- package/build/dist/Debug/Debug.js +385 -0
- package/build/dist/Debug/Debug.js.map +1 -0
- package/build/dist/Debug/DebugFlags.js +40 -0
- package/build/dist/Debug/DebugFlags.js.map +1 -0
- package/build/dist/Debug/DebugSystem.js +263 -0
- package/build/dist/Debug/DebugSystem.js.map +1 -0
- package/build/dist/Debug/index.js +4 -0
- package/build/dist/Debug/index.js.map +1 -0
- package/build/dist/Deprecated.js +2 -0
- package/build/dist/Deprecated.js.map +1 -0
- package/build/dist/Engine.js +986 -0
- package/build/dist/Engine.js.map +1 -0
- package/build/dist/EntityComponentSystem/Component.js +65 -0
- package/build/dist/EntityComponentSystem/Component.js.map +1 -0
- package/build/dist/EntityComponentSystem/Components/MotionComponent.js +33 -0
- package/build/dist/EntityComponentSystem/Components/MotionComponent.js.map +1 -0
- package/build/dist/EntityComponentSystem/Components/TransformComponent.js +107 -0
- package/build/dist/EntityComponentSystem/Components/TransformComponent.js.map +1 -0
- package/build/dist/EntityComponentSystem/Entity.js +487 -0
- package/build/dist/EntityComponentSystem/Entity.js.map +1 -0
- package/build/dist/EntityComponentSystem/EntityManager.js +137 -0
- package/build/dist/EntityComponentSystem/EntityManager.js.map +1 -0
- package/build/dist/EntityComponentSystem/Query.js +90 -0
- package/build/dist/EntityComponentSystem/Query.js.map +1 -0
- package/build/dist/EntityComponentSystem/QueryManager.js +90 -0
- package/build/dist/EntityComponentSystem/QueryManager.js.map +1 -0
- package/build/dist/EntityComponentSystem/System.js +76 -0
- package/build/dist/EntityComponentSystem/System.js.map +1 -0
- package/build/dist/EntityComponentSystem/SystemManager.js +104 -0
- package/build/dist/EntityComponentSystem/SystemManager.js.map +1 -0
- package/build/dist/EntityComponentSystem/Util.js +5 -0
- package/build/dist/EntityComponentSystem/Util.js.map +1 -0
- package/build/dist/EntityComponentSystem/World.js +55 -0
- package/build/dist/EntityComponentSystem/World.js.map +1 -0
- package/build/dist/EntityComponentSystem/index.js +11 -0
- package/build/dist/EntityComponentSystem/index.js.map +1 -0
- package/build/dist/EventDispatcher.js +122 -0
- package/build/dist/EventDispatcher.js.map +1 -0
- package/build/dist/EventEmitter.js +86 -0
- package/build/dist/EventEmitter.js.map +1 -0
- package/build/dist/Events/ExEvent.js +12 -0
- package/build/dist/Events/ExEvent.js.map +1 -0
- package/build/dist/Events/MediaEvents.js +75 -0
- package/build/dist/Events/MediaEvents.js.map +1 -0
- package/build/dist/Events/PointerEvents.js +52 -0
- package/build/dist/Events/PointerEvents.js.map +1 -0
- package/build/dist/Events.js +473 -0
- package/build/dist/Events.js.map +1 -0
- package/build/dist/Flags.js +67 -0
- package/build/dist/Flags.js.map +1 -0
- package/build/dist/Graphics/Animation.js +344 -0
- package/build/dist/Graphics/Animation.js.map +1 -0
- package/build/dist/Graphics/Canvas.js +38 -0
- package/build/dist/Graphics/Canvas.js.map +1 -0
- package/build/dist/Graphics/Circle.js +48 -0
- package/build/dist/Graphics/Circle.js.map +1 -0
- package/build/dist/Graphics/Context/ExcaliburGraphicsContext.js +2 -0
- package/build/dist/Graphics/Context/ExcaliburGraphicsContext.js.map +1 -0
- package/build/dist/Graphics/Context/ExcaliburGraphicsContext2DCanvas.js +237 -0
- package/build/dist/Graphics/Context/ExcaliburGraphicsContext2DCanvas.js.map +1 -0
- package/build/dist/Graphics/Context/ExcaliburGraphicsContextWebGL.d.ts +1 -0
- package/build/dist/Graphics/Context/ExcaliburGraphicsContextWebGL.js +481 -0
- package/build/dist/Graphics/Context/ExcaliburGraphicsContextWebGL.js.map +1 -0
- package/build/dist/Graphics/Context/circle-renderer/circle-renderer.frag.glsl +52 -52
- package/build/dist/Graphics/Context/circle-renderer/circle-renderer.js +174 -0
- package/build/dist/Graphics/Context/circle-renderer/circle-renderer.js.map +1 -0
- package/build/dist/Graphics/Context/circle-renderer/circle-renderer.vert.glsl +37 -37
- package/build/dist/Graphics/Context/debug-text.js +47 -0
- package/build/dist/Graphics/Context/debug-text.js.map +1 -0
- package/build/dist/Graphics/Context/draw-call.js +16 -0
- package/build/dist/Graphics/Context/draw-call.js.map +1 -0
- package/build/dist/Graphics/Context/image-renderer/image-renderer.frag.glsl +32 -32
- package/build/dist/Graphics/Context/image-renderer/image-renderer.js +246 -0
- package/build/dist/Graphics/Context/image-renderer/image-renderer.js.map +1 -0
- package/build/dist/Graphics/Context/image-renderer/image-renderer.vert.glsl +32 -32
- package/build/dist/Graphics/Context/line-renderer/line-fragment.glsl +10 -10
- package/build/dist/Graphics/Context/line-renderer/line-renderer.js +90 -0
- package/build/dist/Graphics/Context/line-renderer/line-renderer.js.map +1 -0
- package/build/dist/Graphics/Context/line-renderer/line-vertex.glsl +14 -14
- package/build/dist/Graphics/Context/material-renderer/material-renderer.js +23 -2
- package/build/dist/Graphics/Context/material-renderer/material-renderer.js.map +1 -1
- package/build/dist/Graphics/Context/material.d.ts +2 -0
- package/build/dist/Graphics/Context/material.js +72 -0
- package/build/dist/Graphics/Context/material.js.map +1 -0
- package/build/dist/Graphics/Context/point-renderer/point-fragment.glsl +19 -19
- package/build/dist/Graphics/Context/point-renderer/point-renderer.js +91 -0
- package/build/dist/Graphics/Context/point-renderer/point-renderer.js.map +1 -0
- package/build/dist/Graphics/Context/point-renderer/point-vertex.glsl +11 -11
- package/build/dist/Graphics/Context/quad-index-buffer.js +67 -0
- package/build/dist/Graphics/Context/quad-index-buffer.js.map +1 -0
- package/build/dist/Graphics/Context/rectangle-renderer/rectangle-renderer.frag.glsl +85 -85
- package/build/dist/Graphics/Context/rectangle-renderer/rectangle-renderer.js +305 -0
- package/build/dist/Graphics/Context/rectangle-renderer/rectangle-renderer.js.map +1 -0
- package/build/dist/Graphics/Context/rectangle-renderer/rectangle-renderer.vert.glsl +42 -42
- package/build/dist/Graphics/Context/render-source.js +16 -0
- package/build/dist/Graphics/Context/render-source.js.map +1 -0
- package/build/dist/Graphics/Context/render-target.js +65 -0
- package/build/dist/Graphics/Context/render-target.js.map +1 -0
- package/build/dist/Graphics/Context/renderer.js +2 -0
- package/build/dist/Graphics/Context/renderer.js.map +1 -0
- package/build/dist/Graphics/Context/screen-pass-painter/screen-fragment.glsl +13 -13
- package/build/dist/Graphics/Context/screen-pass-painter/screen-pass-painter.js +56 -0
- package/build/dist/Graphics/Context/screen-pass-painter/screen-pass-painter.js.map +1 -0
- package/build/dist/Graphics/Context/screen-pass-painter/screen-vertex.glsl +11 -11
- package/build/dist/Graphics/Context/state-stack.js +37 -0
- package/build/dist/Graphics/Context/state-stack.js.map +1 -0
- package/build/dist/Graphics/Context/texture-loader.js +109 -0
- package/build/dist/Graphics/Context/texture-loader.js.map +1 -0
- package/build/dist/Graphics/Context/transform-stack.js +30 -0
- package/build/dist/Graphics/Context/transform-stack.js.map +1 -0
- package/build/dist/Graphics/Context/vertex-buffer.js +53 -0
- package/build/dist/Graphics/Context/vertex-buffer.js.map +1 -0
- package/build/dist/Graphics/Context/webgl-util.js +79 -0
- package/build/dist/Graphics/Context/webgl-util.js.map +1 -0
- package/build/dist/Graphics/DebugGraphicsComponent.d.ts +3 -2
- package/build/dist/Graphics/DebugGraphicsComponent.js +16 -0
- package/build/dist/Graphics/DebugGraphicsComponent.js.map +1 -0
- package/build/dist/Graphics/Filtering.js +17 -0
- package/build/dist/Graphics/Filtering.js.map +1 -0
- package/build/dist/Graphics/Font.js +148 -0
- package/build/dist/Graphics/Font.js.map +1 -0
- package/build/dist/Graphics/FontCache.d.ts +1 -0
- package/build/dist/Graphics/FontCache.js +80 -0
- package/build/dist/Graphics/FontCache.js.map +1 -0
- package/build/dist/Graphics/FontCommon.js +109 -0
- package/build/dist/Graphics/FontCommon.js.map +1 -0
- package/build/dist/Graphics/FontTextInstance.js +230 -0
- package/build/dist/Graphics/FontTextInstance.js.map +1 -0
- package/build/dist/Graphics/Graphic.js +208 -0
- package/build/dist/Graphics/Graphic.js.map +1 -0
- package/build/dist/Graphics/GraphicsComponent.js +336 -0
- package/build/dist/Graphics/GraphicsComponent.js.map +1 -0
- package/build/dist/Graphics/GraphicsDiagnostics.js +9 -0
- package/build/dist/Graphics/GraphicsDiagnostics.js.map +1 -0
- package/build/dist/Graphics/GraphicsGroup.js +69 -0
- package/build/dist/Graphics/GraphicsGroup.js.map +1 -0
- package/build/dist/Graphics/GraphicsSystem.js +210 -0
- package/build/dist/Graphics/GraphicsSystem.js.map +1 -0
- package/build/dist/Graphics/ImageSource.js +124 -0
- package/build/dist/Graphics/ImageSource.js.map +1 -0
- package/build/dist/Graphics/Line.js +45 -0
- package/build/dist/Graphics/Line.js.map +1 -0
- package/build/dist/Graphics/OffscreenSystem.js +64 -0
- package/build/dist/Graphics/OffscreenSystem.js.map +1 -0
- package/build/dist/Graphics/ParallaxComponent.js +11 -0
- package/build/dist/Graphics/ParallaxComponent.js.map +1 -0
- package/build/dist/Graphics/Polygon.js +59 -0
- package/build/dist/Graphics/Polygon.js.map +1 -0
- package/build/dist/Graphics/PostProcessor/ColorBlindnessMode.js +7 -0
- package/build/dist/Graphics/PostProcessor/ColorBlindnessMode.js.map +1 -0
- package/build/dist/Graphics/PostProcessor/ColorBlindnessPostProcessor.js +52 -0
- package/build/dist/Graphics/PostProcessor/ColorBlindnessPostProcessor.js.map +1 -0
- package/build/dist/Graphics/PostProcessor/PostProcessor.js +2 -0
- package/build/dist/Graphics/PostProcessor/PostProcessor.js.map +1 -0
- package/build/dist/Graphics/PostProcessor/ScreenShader.js +59 -0
- package/build/dist/Graphics/PostProcessor/ScreenShader.js.map +1 -0
- package/build/dist/Graphics/PostProcessor/color-blind-fragment.glsl +64 -64
- package/build/dist/Graphics/Raster.js +215 -0
- package/build/dist/Graphics/Raster.js.map +1 -0
- package/build/dist/Graphics/Rectangle.js +29 -0
- package/build/dist/Graphics/Rectangle.js.map +1 -0
- package/build/dist/Graphics/Sprite.js +82 -0
- package/build/dist/Graphics/Sprite.js.map +1 -0
- package/build/dist/Graphics/SpriteFont.js +139 -0
- package/build/dist/Graphics/SpriteFont.js.map +1 -0
- package/build/dist/Graphics/SpriteSheet.js +116 -0
- package/build/dist/Graphics/SpriteSheet.js.map +1 -0
- package/build/dist/Graphics/Text.js +103 -0
- package/build/dist/Graphics/Text.js.map +1 -0
- package/build/dist/Graphics/index.js +46 -0
- package/build/dist/Graphics/index.js.map +1 -0
- package/build/dist/Id.js +8 -0
- package/build/dist/Id.js.map +1 -0
- package/build/dist/Input/CapturePointerConfig.js +5 -0
- package/build/dist/Input/CapturePointerConfig.js.map +1 -0
- package/build/dist/Input/EngineInput.js +2 -0
- package/build/dist/Input/EngineInput.js.map +1 -0
- package/build/dist/Input/Gamepad.js +422 -0
- package/build/dist/Input/Gamepad.js.map +1 -0
- package/build/dist/Input/Index.js +88 -0
- package/build/dist/Input/Index.js.map +1 -0
- package/build/dist/Input/InputMapper.js +45 -0
- package/build/dist/Input/InputMapper.js.map +1 -0
- package/build/dist/Input/Keyboard.js +348 -0
- package/build/dist/Input/Keyboard.js.map +1 -0
- package/build/dist/Input/NativePointerButton.js +12 -0
- package/build/dist/Input/NativePointerButton.js.map +1 -0
- package/build/dist/Input/PointerAbstraction.js +44 -0
- package/build/dist/Input/PointerAbstraction.js.map +1 -0
- package/build/dist/Input/PointerButton.js +12 -0
- package/build/dist/Input/PointerButton.js.map +1 -0
- package/build/dist/Input/PointerComponent.js +28 -0
- package/build/dist/Input/PointerComponent.js.map +1 -0
- package/build/dist/Input/PointerEvent.js +25 -0
- package/build/dist/Input/PointerEvent.js.map +1 -0
- package/build/dist/Input/PointerEventReceiver.js +456 -0
- package/build/dist/Input/PointerEventReceiver.js.map +1 -0
- package/build/dist/Input/PointerScope.js +16 -0
- package/build/dist/Input/PointerScope.js.map +1 -0
- package/build/dist/Input/PointerSystem.js +249 -0
- package/build/dist/Input/PointerSystem.js.map +1 -0
- package/build/dist/Input/PointerType.js +11 -0
- package/build/dist/Input/PointerType.js.map +1 -0
- package/build/dist/Input/WheelDeltaMode.js +7 -0
- package/build/dist/Input/WheelDeltaMode.js.map +1 -0
- package/build/dist/Input/WheelEvent.js +21 -0
- package/build/dist/Input/WheelEvent.js.map +1 -0
- package/build/dist/Interfaces/Audio.js +2 -0
- package/build/dist/Interfaces/Audio.js.map +1 -0
- package/build/dist/Interfaces/AudioImplementation.js +11 -0
- package/build/dist/Interfaces/AudioImplementation.js.map +1 -0
- package/build/dist/Interfaces/Clonable.js +2 -0
- package/build/dist/Interfaces/Clonable.js.map +1 -0
- package/build/dist/Interfaces/Evented.js +2 -0
- package/build/dist/Interfaces/Evented.js.map +1 -0
- package/build/dist/Interfaces/Index.js +8 -0
- package/build/dist/Interfaces/Index.js.map +1 -0
- package/build/dist/Interfaces/LifecycleEvents.js +51 -0
- package/build/dist/Interfaces/LifecycleEvents.js.map +1 -0
- package/build/dist/Interfaces/Loadable.js +2 -0
- package/build/dist/Interfaces/Loadable.js.map +1 -0
- package/build/dist/Interfaces/PointerEventHandlers.js +2 -0
- package/build/dist/Interfaces/PointerEventHandlers.js.map +1 -0
- package/build/dist/Label.js +81 -0
- package/build/dist/Label.js.map +1 -0
- package/build/dist/Loader.js +416 -0
- package/build/dist/Loader.js.map +1 -0
- package/build/dist/Math/Index.js +13 -0
- package/build/dist/Math/Index.js.map +1 -0
- package/build/dist/Math/Random.js +239 -0
- package/build/dist/Math/Random.js.map +1 -0
- package/build/dist/Math/affine-matrix.js +331 -0
- package/build/dist/Math/affine-matrix.js.map +1 -0
- package/build/dist/Math/coord-plane.js +17 -0
- package/build/dist/Math/coord-plane.js.map +1 -0
- package/build/dist/Math/global-coordinates.js +30 -0
- package/build/dist/Math/global-coordinates.js.map +1 -0
- package/build/dist/Math/line-segment.js +205 -0
- package/build/dist/Math/line-segment.js.map +1 -0
- package/build/dist/Math/matrix.js +457 -0
- package/build/dist/Math/matrix.js.map +1 -0
- package/build/dist/Math/projection.js +24 -0
- package/build/dist/Math/projection.js.map +1 -0
- package/build/dist/Math/ray.js +52 -0
- package/build/dist/Math/ray.js.map +1 -0
- package/build/dist/Math/transform.js +219 -0
- package/build/dist/Math/transform.js.map +1 -0
- package/build/dist/Math/util.js +82 -0
- package/build/dist/Math/util.js.map +1 -0
- package/build/dist/Math/vector-view.js +25 -0
- package/build/dist/Math/vector-view.js.map +1 -0
- package/build/dist/Math/vector.js +340 -0
- package/build/dist/Math/vector.js.map +1 -0
- package/build/dist/Math/watch-vector.js +26 -0
- package/build/dist/Math/watch-vector.js.map +1 -0
- package/build/dist/Particles.js +430 -0
- package/build/dist/Particles.js.map +1 -0
- package/build/dist/Polyfill.js +56 -0
- package/build/dist/Polyfill.js.map +1 -0
- package/build/dist/Resources/Gif.js +464 -0
- package/build/dist/Resources/Gif.js.map +1 -0
- package/build/dist/Resources/Index.js +4 -0
- package/build/dist/Resources/Index.js.map +1 -0
- package/build/dist/Resources/Resource.js +81 -0
- package/build/dist/Resources/Resource.js.map +1 -0
- package/build/dist/Resources/Sound/AudioContext.js +16 -0
- package/build/dist/Resources/Sound/AudioContext.js.map +1 -0
- package/build/dist/Resources/Sound/Index.js +4 -0
- package/build/dist/Resources/Sound/Index.js.map +1 -0
- package/build/dist/Resources/Sound/Sound.js +326 -0
- package/build/dist/Resources/Sound/Sound.js.map +1 -0
- package/build/dist/Resources/Sound/WebAudioInstance.js +190 -0
- package/build/dist/Resources/Sound/WebAudioInstance.js.map +1 -0
- package/build/dist/Scene.js +444 -0
- package/build/dist/Scene.js.map +1 -0
- package/build/dist/Screen.js +782 -0
- package/build/dist/Screen.js.map +1 -0
- package/build/dist/ScreenElement.js +43 -0
- package/build/dist/ScreenElement.js.map +1 -0
- package/build/dist/TileMap/IsometricEntityComponent.js +17 -0
- package/build/dist/TileMap/IsometricEntityComponent.js.map +1 -0
- package/build/dist/TileMap/IsometricEntitySystem.js +23 -0
- package/build/dist/TileMap/IsometricEntitySystem.js.map +1 -0
- package/build/dist/TileMap/IsometricMap.js +311 -0
- package/build/dist/TileMap/IsometricMap.js.map +1 -0
- package/build/dist/TileMap/TileMap.d.ts +2 -1
- package/build/dist/TileMap/TileMap.js +630 -0
- package/build/dist/TileMap/TileMap.js.map +1 -0
- package/build/dist/TileMap/index.js +5 -0
- package/build/dist/TileMap/index.js.map +1 -0
- package/build/dist/Timer.js +202 -0
- package/build/dist/Timer.js.map +1 -0
- package/build/dist/Trigger.js +94 -0
- package/build/dist/Trigger.js.map +1 -0
- package/build/dist/Util/Browser.js +66 -0
- package/build/dist/Util/Browser.js.map +1 -0
- package/build/dist/Util/Clock.js +219 -0
- package/build/dist/Util/Clock.js.map +1 -0
- package/build/dist/Util/Decorators.js +78 -0
- package/build/dist/Util/Decorators.js.map +1 -0
- package/build/dist/Util/Detector.js +167 -0
- package/build/dist/Util/Detector.js.map +1 -0
- package/build/dist/Util/DrawUtil.js +115 -0
- package/build/dist/Util/DrawUtil.js.map +1 -0
- package/build/dist/Util/EasingFunctions.js +102 -0
- package/build/dist/Util/EasingFunctions.js.map +1 -0
- package/build/dist/Util/Fps.js +47 -0
- package/build/dist/Util/Fps.js.map +1 -0
- package/build/dist/Util/Future.js +30 -0
- package/build/dist/Util/Future.js.map +1 -0
- package/build/dist/Util/IFrame.js +23 -0
- package/build/dist/Util/IFrame.js.map +1 -0
- package/build/dist/Util/Index.js +7 -0
- package/build/dist/Util/Index.js.map +1 -0
- package/build/dist/Util/Log.js +195 -0
- package/build/dist/Util/Log.js.map +1 -0
- package/build/dist/Util/Observable.js +66 -0
- package/build/dist/Util/Observable.js.map +1 -0
- package/build/dist/Util/Pool.js +74 -0
- package/build/dist/Util/Pool.js.map +1 -0
- package/build/dist/Util/Semaphore.js +55 -0
- package/build/dist/Util/Semaphore.js.map +1 -0
- package/build/dist/Util/Sound.js +22 -0
- package/build/dist/Util/Sound.js.map +1 -0
- package/build/dist/Util/StateMachine.js +79 -0
- package/build/dist/Util/StateMachine.js.map +1 -0
- package/build/dist/Util/Toaster.css +28 -28
- package/build/dist/Util/Toaster.js +84 -0
- package/build/dist/Util/Toaster.js.map +1 -0
- package/build/dist/Util/Util.d.ts +6 -0
- package/build/dist/Util/Util.js +95 -0
- package/build/dist/Util/Util.js.map +1 -0
- package/build/dist/Util/Watch.js +67 -0
- package/build/dist/Util/Watch.js.map +1 -0
- package/build/dist/Util/WebAudio.js +62 -0
- package/build/dist/Util/WebAudio.js.map +1 -0
- package/build/dist/excalibur.d.ts +2 -2
- package/build/dist/excalibur.js +389 -258
- package/build/dist/excalibur.js.map +1 -1
- package/build/dist/excalibur.min.js +1 -1
- package/build/dist/excalibur.min.js.LICENSE.txt +1 -1
- package/build/dist/excalibur.min.js.map +1 -1
- package/build/dist/index.js +81 -0
- package/build/dist/index.js.map +1 -0
- package/build/esm/Debug/Debug.d.ts +11 -0
- package/build/esm/Graphics/Context/ExcaliburGraphicsContextWebGL.d.ts +1 -0
- package/build/esm/Graphics/Context/material.d.ts +2 -0
- package/build/esm/Graphics/DebugGraphicsComponent.d.ts +3 -2
- package/build/esm/Graphics/FontCache.d.ts +1 -0
- package/build/esm/TileMap/TileMap.d.ts +2 -1
- package/build/esm/Util/Util.d.ts +6 -0
- package/build/esm/excalibur.d.ts +2 -2
- package/build/esm/excalibur.js +389 -258
- package/build/esm/excalibur.js.map +1 -1
- package/build/esm/excalibur.min.js +1 -1
- package/build/esm/excalibur.min.js.LICENSE.txt +1 -1
- package/build/esm/excalibur.min.js.map +1 -1
- package/docker-compose.yml +11 -11
- package/package.json +131 -131
- package/build/dist/Loader.css +0 -122
- package/build/nuget/Excalibur.0.28.3.nupkg +0 -0
- package/build/v0.28.3.zip +0 -0
- package/excalibur-0.28.3.tgz +0 -0
|
@@ -1,43 +1,43 @@
|
|
|
1
|
-
#version 300 es
|
|
2
|
-
in vec2 a_position;
|
|
3
|
-
|
|
4
|
-
// UV coordinate
|
|
5
|
-
in vec2 a_uv;
|
|
6
|
-
out vec2 v_uv;
|
|
7
|
-
|
|
8
|
-
in vec2 a_size;
|
|
9
|
-
out vec2 v_size;
|
|
10
|
-
|
|
11
|
-
// Opacity
|
|
12
|
-
in float a_opacity;
|
|
13
|
-
out float v_opacity;
|
|
14
|
-
|
|
15
|
-
in vec4 a_color;
|
|
16
|
-
out vec4 v_color;
|
|
17
|
-
|
|
18
|
-
in vec4 a_strokeColor;
|
|
19
|
-
out vec4 v_strokeColor;
|
|
20
|
-
|
|
21
|
-
in float a_strokeThickness;
|
|
22
|
-
out float v_strokeThickness;
|
|
23
|
-
|
|
24
|
-
uniform mat4 u_matrix;
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
void main() {
|
|
28
|
-
// Set the vertex position using the ortho transform matrix
|
|
29
|
-
gl_Position = u_matrix * vec4(a_position, 0.0, 1.0);
|
|
30
|
-
|
|
31
|
-
// Pass through UV coords
|
|
32
|
-
v_uv = a_uv;
|
|
33
|
-
// Pass through size
|
|
34
|
-
v_size = a_size;
|
|
35
|
-
// Pass through the Opacity to the fragment shader
|
|
36
|
-
v_opacity = a_opacity;
|
|
37
|
-
// Pass through the color to the fragment shader
|
|
38
|
-
v_color = a_color;
|
|
39
|
-
// Pass through the stroke color to the fragment shader
|
|
40
|
-
v_strokeColor = a_strokeColor;
|
|
41
|
-
// Pass through the stroke thickenss to the fragment shader
|
|
42
|
-
v_strokeThickness = a_strokeThickness;
|
|
1
|
+
#version 300 es
|
|
2
|
+
in vec2 a_position;
|
|
3
|
+
|
|
4
|
+
// UV coordinate
|
|
5
|
+
in vec2 a_uv;
|
|
6
|
+
out vec2 v_uv;
|
|
7
|
+
|
|
8
|
+
in vec2 a_size;
|
|
9
|
+
out vec2 v_size;
|
|
10
|
+
|
|
11
|
+
// Opacity
|
|
12
|
+
in float a_opacity;
|
|
13
|
+
out float v_opacity;
|
|
14
|
+
|
|
15
|
+
in vec4 a_color;
|
|
16
|
+
out vec4 v_color;
|
|
17
|
+
|
|
18
|
+
in vec4 a_strokeColor;
|
|
19
|
+
out vec4 v_strokeColor;
|
|
20
|
+
|
|
21
|
+
in float a_strokeThickness;
|
|
22
|
+
out float v_strokeThickness;
|
|
23
|
+
|
|
24
|
+
uniform mat4 u_matrix;
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
void main() {
|
|
28
|
+
// Set the vertex position using the ortho transform matrix
|
|
29
|
+
gl_Position = u_matrix * vec4(a_position, 0.0, 1.0);
|
|
30
|
+
|
|
31
|
+
// Pass through UV coords
|
|
32
|
+
v_uv = a_uv;
|
|
33
|
+
// Pass through size
|
|
34
|
+
v_size = a_size;
|
|
35
|
+
// Pass through the Opacity to the fragment shader
|
|
36
|
+
v_opacity = a_opacity;
|
|
37
|
+
// Pass through the color to the fragment shader
|
|
38
|
+
v_color = a_color;
|
|
39
|
+
// Pass through the stroke color to the fragment shader
|
|
40
|
+
v_strokeColor = a_strokeColor;
|
|
41
|
+
// Pass through the stroke thickenss to the fragment shader
|
|
42
|
+
v_strokeThickness = a_strokeThickness;
|
|
43
43
|
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export class RenderSource {
|
|
2
|
+
constructor(_gl, _texture) {
|
|
3
|
+
this._gl = _gl;
|
|
4
|
+
this._texture = _texture;
|
|
5
|
+
}
|
|
6
|
+
use() {
|
|
7
|
+
const gl = this._gl;
|
|
8
|
+
gl.activeTexture(gl.TEXTURE0);
|
|
9
|
+
gl.bindTexture(gl.TEXTURE_2D, this._texture);
|
|
10
|
+
}
|
|
11
|
+
disable() {
|
|
12
|
+
const gl = this._gl;
|
|
13
|
+
gl.bindTexture(gl.TEXTURE_2D, null);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=render-source.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"render-source.js","sourceRoot":"","sources":["../../../../src/engine/Graphics/Context/render-source.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,YAAY;IACvB,YACU,GAA0B,EAC1B,QAAsB;QADtB,QAAG,GAAH,GAAG,CAAuB;QAC1B,aAAQ,GAAR,QAAQ,CAAc;IAAG,CAAC;IAE7B,GAAG;QACR,MAAM,EAAE,GAAG,IAAI,CAAC,GAAG,CAAC;QACpB,EAAE,CAAC,aAAa,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC;QAC9B,EAAE,CAAC,WAAW,CAAC,EAAE,CAAC,UAAU,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC;IAC/C,CAAC;IAEM,OAAO;QACZ,MAAM,EAAE,GAAG,IAAI,CAAC,GAAG,CAAC;QACpB,EAAE,CAAC,WAAW,CAAC,EAAE,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC;IACtC,CAAC;CACF"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { RenderSource } from './render-source';
|
|
2
|
+
export class RenderTarget {
|
|
3
|
+
constructor(options) {
|
|
4
|
+
this.width = options.width;
|
|
5
|
+
this.height = options.height;
|
|
6
|
+
this._gl = options.gl;
|
|
7
|
+
this._setupFramebuffer();
|
|
8
|
+
}
|
|
9
|
+
setResolution(width, height) {
|
|
10
|
+
const gl = this._gl;
|
|
11
|
+
this.width = width;
|
|
12
|
+
this.height = height;
|
|
13
|
+
gl.bindTexture(gl.TEXTURE_2D, this._frameTexture);
|
|
14
|
+
gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, this.width, this.height, 0, gl.RGBA, gl.UNSIGNED_BYTE, null);
|
|
15
|
+
}
|
|
16
|
+
get frameBuffer() {
|
|
17
|
+
return this._frameBuffer;
|
|
18
|
+
}
|
|
19
|
+
get frameTexture() {
|
|
20
|
+
return this._frameTexture;
|
|
21
|
+
}
|
|
22
|
+
_setupFramebuffer() {
|
|
23
|
+
// Allocates frame buffer
|
|
24
|
+
const gl = this._gl;
|
|
25
|
+
this._frameTexture = gl.createTexture();
|
|
26
|
+
gl.bindTexture(gl.TEXTURE_2D, this._frameTexture);
|
|
27
|
+
gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, this.width, this.height, 0, gl.RGBA, gl.UNSIGNED_BYTE, null);
|
|
28
|
+
// set the filtering so we don't need mips
|
|
29
|
+
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.NEAREST);
|
|
30
|
+
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.NEAREST);
|
|
31
|
+
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);
|
|
32
|
+
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);
|
|
33
|
+
// attach the texture as the first color attachment
|
|
34
|
+
const attachmentPoint = gl.COLOR_ATTACHMENT0;
|
|
35
|
+
// After this bind all draw calls will draw to this framebuffer texture
|
|
36
|
+
this._frameBuffer = gl.createFramebuffer();
|
|
37
|
+
gl.bindFramebuffer(gl.FRAMEBUFFER, this._frameBuffer);
|
|
38
|
+
gl.framebufferTexture2D(gl.FRAMEBUFFER, attachmentPoint, gl.TEXTURE_2D, this._frameTexture, 0);
|
|
39
|
+
// Reset after initialized
|
|
40
|
+
this.disable();
|
|
41
|
+
}
|
|
42
|
+
toRenderSource() {
|
|
43
|
+
const source = new RenderSource(this._gl, this._frameTexture);
|
|
44
|
+
return source;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* When called, all drawing gets redirected to this render target
|
|
48
|
+
*/
|
|
49
|
+
use() {
|
|
50
|
+
const gl = this._gl;
|
|
51
|
+
gl.bindFramebuffer(gl.FRAMEBUFFER, this._frameBuffer);
|
|
52
|
+
// very important to set the viewport to the size of the framebuffer texture
|
|
53
|
+
gl.viewport(0, 0, this.width, this.height);
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* When called, all drawing is sent back to the canvas
|
|
57
|
+
*/
|
|
58
|
+
disable() {
|
|
59
|
+
const gl = this._gl;
|
|
60
|
+
// passing null switches rendering back to the canvas
|
|
61
|
+
gl.bindFramebuffer(gl.FRAMEBUFFER, null);
|
|
62
|
+
gl.bindTexture(gl.TEXTURE_2D, null);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
//# sourceMappingURL=render-target.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"render-target.js","sourceRoot":"","sources":["../../../../src/engine/Graphics/Context/render-target.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE/C,MAAM,OAAO,YAAY;IAIvB,YAAY,OAAmE;QAC7E,IAAI,CAAC,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC;QAC3B,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;QAC7B,IAAI,CAAC,GAAG,GAAG,OAAO,CAAC,EAAE,CAAC;QACtB,IAAI,CAAC,iBAAiB,EAAE,CAAC;IAC3B,CAAC;IAED,aAAa,CAAC,KAAa,EAAE,MAAc;QACzC,MAAM,EAAE,GAAG,IAAI,CAAC,GAAG,CAAC;QACpB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,EAAE,CAAC,WAAW,CAAC,EAAE,CAAC,UAAU,EAAE,IAAI,CAAC,aAAa,CAAC,CAAC;QAClD,EAAE,CAAC,UAAU,CAAC,EAAE,CAAC,UAAU,EAAE,CAAC,EAAE,EAAE,CAAC,IAAI,EAAE,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,aAAa,EAAE,IAAI,CAAC,CAAC;IACxG,CAAC;IAGD,IAAW,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AAC,CAAC;QACtD,EAAE,CAAC,oBAAoB,CAAC,EAAE,CAAC,WAAW,EAAE,eAAe,EAAE,EAAE,CAAC,UAAU,EAAE,IAAI,CAAC,aAAa,EAAE,CAAC,CAAC,CAAC;QAC/F,0BAA0B;QAC1B,IAAI,CAAC,OAAO,EAAE,CAAC;IACjB,CAAC;IAEM,cAAc;QACnB,MAAM,MAAM,GAAG,IAAI,YAAY,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,aAAa,CAAC,CAAC;QAC9D,OAAO,MAAM,CAAC;IAChB,CAAC;IAED;;OAEG;IACI,GAAG;QACR,MAAM,EAAE,GAAG,IAAI,CAAC,GAAG,CAAC;QACpB,EAAE,CAAC,eAAe,CAAC,EAAE,CAAC,WAAW,EAAE,IAAI,CAAC,YAAY,CAAC,CAAC;QACtD,4EAA4E;QAC5E,EAAE,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC,EAAE,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;IAC7C,CAAC;IAED;;OAEG;IACI,OAAO;QACZ,MAAM,EAAE,GAAG,IAAI,CAAC,GAAG,CAAC;QACpB,qDAAqD;QACrD,EAAE,CAAC,eAAe,CAAC,EAAE,CAAC,WAAW,EAAE,IAAI,CAAC,CAAC;QACzC,EAAE,CAAC,WAAW,CAAC,EAAE,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC;IACtC,CAAC;CACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"renderer.js","sourceRoot":"","sources":["../../../../src/engine/Graphics/Context/renderer.ts"],"names":[],"mappings":""}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
#version 300 es
|
|
2
|
-
precision mediump float;
|
|
3
|
-
|
|
4
|
-
// Passed in from the vertex shader.
|
|
5
|
-
in vec2 v_texcoord;
|
|
6
|
-
|
|
7
|
-
// The texture.
|
|
8
|
-
uniform sampler2D u_texture;
|
|
9
|
-
|
|
10
|
-
out vec4 fragColor;
|
|
11
|
-
|
|
12
|
-
void main() {
|
|
13
|
-
fragColor = texture(u_texture, v_texcoord);
|
|
1
|
+
#version 300 es
|
|
2
|
+
precision mediump float;
|
|
3
|
+
|
|
4
|
+
// Passed in from the vertex shader.
|
|
5
|
+
in vec2 v_texcoord;
|
|
6
|
+
|
|
7
|
+
// The texture.
|
|
8
|
+
uniform sampler2D u_texture;
|
|
9
|
+
|
|
10
|
+
out vec4 fragColor;
|
|
11
|
+
|
|
12
|
+
void main() {
|
|
13
|
+
fragColor = texture(u_texture, v_texcoord);
|
|
14
14
|
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import screenVertex from './screen-vertex.glsl';
|
|
2
|
+
import screenFragment from './screen-fragment.glsl';
|
|
3
|
+
import { Shader } from '../shader';
|
|
4
|
+
import { VertexBuffer } from '../vertex-buffer';
|
|
5
|
+
import { VertexLayout } from '../vertex-layout';
|
|
6
|
+
/**
|
|
7
|
+
* This is responsible for painting the entire screen during the render passes
|
|
8
|
+
*/
|
|
9
|
+
export class ScreenPassPainter {
|
|
10
|
+
constructor(gl) {
|
|
11
|
+
this._gl = gl;
|
|
12
|
+
this._shader = new Shader({
|
|
13
|
+
gl,
|
|
14
|
+
vertexSource: screenVertex,
|
|
15
|
+
fragmentSource: screenFragment
|
|
16
|
+
});
|
|
17
|
+
this._shader.compile();
|
|
18
|
+
// Setup memory layout
|
|
19
|
+
this._buffer = new VertexBuffer({
|
|
20
|
+
gl,
|
|
21
|
+
type: 'static',
|
|
22
|
+
// clip space quad + uv since we don't need a camera
|
|
23
|
+
data: new Float32Array([
|
|
24
|
+
-1, -1, 0, 0,
|
|
25
|
+
-1, 1, 0, 1,
|
|
26
|
+
1, -1, 1, 0,
|
|
27
|
+
1, -1, 1, 0,
|
|
28
|
+
-1, 1, 0, 1,
|
|
29
|
+
1, 1, 1, 1
|
|
30
|
+
])
|
|
31
|
+
});
|
|
32
|
+
this._layout = new VertexLayout({
|
|
33
|
+
gl,
|
|
34
|
+
shader: this._shader,
|
|
35
|
+
vertexBuffer: this._buffer,
|
|
36
|
+
attributes: [
|
|
37
|
+
['a_position', 2],
|
|
38
|
+
['a_texcoord', 2]
|
|
39
|
+
]
|
|
40
|
+
});
|
|
41
|
+
this._buffer.upload();
|
|
42
|
+
}
|
|
43
|
+
renderWithPostProcessor(postprocessor) {
|
|
44
|
+
const gl = this._gl;
|
|
45
|
+
postprocessor.getShader().use();
|
|
46
|
+
postprocessor.getLayout().use();
|
|
47
|
+
gl.drawArrays(gl.TRIANGLES, 0, 6);
|
|
48
|
+
}
|
|
49
|
+
renderToScreen() {
|
|
50
|
+
const gl = this._gl;
|
|
51
|
+
this._shader.use();
|
|
52
|
+
this._layout.use();
|
|
53
|
+
gl.drawArrays(gl.TRIANGLES, 0, 6);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
//# sourceMappingURL=screen-pass-painter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"screen-pass-painter.js","sourceRoot":"","sources":["../../../../../src/engine/Graphics/Context/screen-pass-painter/screen-pass-painter.ts"],"names":[],"mappings":"AACA,OAAO,YAAY,MAAM,sBAAsB,CAAC;AAChD,OAAO,cAAc,MAAM,wBAAwB,CAAC;AACpD,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACnC,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAGhD;;GAEG;AACH,MAAM,OAAO,iBAAiB;IAK5B,YAAY,EAA0B;QACpC,IAAI,CAAC,GAAG,GAAG,EAAE,CAAC;QACd,IAAI,CAAC,OAAO,GAAG,IAAI,MAAM,CAAC;YACxB,EAAE;YACF,YAAY,EAAE,YAAY;YAC1B,cAAc,EAAE,cAAc;SAC/B,CAAC,CAAC;QACH,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC;QACvB,sBAAsB;QACtB,I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B,EAAE,CAAC,UAAU,CAAC,EAAE,CAAC,SAAS,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;IACpC,CAAC;CACF"}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
#version 300 es
|
|
2
|
-
in vec2 a_position;
|
|
3
|
-
|
|
4
|
-
in vec2 a_texcoord;
|
|
5
|
-
out vec2 v_texcoord;
|
|
6
|
-
|
|
7
|
-
void main() {
|
|
8
|
-
gl_Position = vec4(a_position, 0.0, 1.0);
|
|
9
|
-
|
|
10
|
-
// Pass the texcoord to the fragment shader.
|
|
11
|
-
v_texcoord = a_texcoord;
|
|
1
|
+
#version 300 es
|
|
2
|
+
in vec2 a_position;
|
|
3
|
+
|
|
4
|
+
in vec2 a_texcoord;
|
|
5
|
+
out vec2 v_texcoord;
|
|
6
|
+
|
|
7
|
+
void main() {
|
|
8
|
+
gl_Position = vec4(a_position, 0.0, 1.0);
|
|
9
|
+
|
|
10
|
+
// Pass the texcoord to the fragment shader.
|
|
11
|
+
v_texcoord = a_texcoord;
|
|
12
12
|
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { Color } from '../../Color';
|
|
2
|
+
export class StateStack {
|
|
3
|
+
constructor() {
|
|
4
|
+
this._states = [];
|
|
5
|
+
this._currentState = this._getDefaultState();
|
|
6
|
+
}
|
|
7
|
+
_getDefaultState() {
|
|
8
|
+
return {
|
|
9
|
+
opacity: 1,
|
|
10
|
+
z: 0,
|
|
11
|
+
tint: Color.White,
|
|
12
|
+
material: null
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
_cloneState() {
|
|
16
|
+
return {
|
|
17
|
+
opacity: this._currentState.opacity,
|
|
18
|
+
z: this._currentState.z,
|
|
19
|
+
tint: this._currentState.tint.clone(),
|
|
20
|
+
material: this._currentState.material // TODO is this going to cause problems when cloning
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
save() {
|
|
24
|
+
this._states.push(this._currentState);
|
|
25
|
+
this._currentState = this._cloneState();
|
|
26
|
+
}
|
|
27
|
+
restore() {
|
|
28
|
+
this._currentState = this._states.pop();
|
|
29
|
+
}
|
|
30
|
+
get current() {
|
|
31
|
+
return this._currentState;
|
|
32
|
+
}
|
|
33
|
+
set current(val) {
|
|
34
|
+
this._currentState = val;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=state-stack.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"state-stack.js","sourceRoot":"","sources":["../../../../src/engine/Graphics/Context/state-stack.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAIpC,MAAM,OAAO,UAAU;IAAvB;QACU,YAAO,GAAoC,EAAE,CAAC;QAC9C,kBAAa,GAAkC,IAAI,CAAC,gBAAgB,EAAE,CAAC;IAoCjF,CAAC;IAlCS,gBAAgB;QACtB,OAAO;YACL,OAAO,EAAE,CAAC;YACV,CAAC,EAAE,CAAC;YACJ,IAAI,EAAE,KAAK,CAAC,KAAK;YACjB,QAAQ,EAAE,IAAgB;SAC3B,CAAC;IACJ,CAAC;IAEO,WAAW;QACjB,OAAO;YACL,OAAO,EAAE,IAAI,CAAC,aAAa,CAAC,OAAO;YACnC,CAAC,EAAE,IAAI,CAAC,aAAa,CAAC,CAAC;YACvB,IAAI,EAAE,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,KAAK,EAAE;YACrC,QAAQ,EAAE,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,oDAAoD;SAC3F,CAAC;IACJ,CAAC;IAEM,IAAI;QACT,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;QACtC,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC,WAAW,EAAE,CAAC;IAC1C,CAAC;IAEM,OAAO;QACZ,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC;IAC1C,CAAC;IAED,IAAW,OAAO;QAChB,OAAO,IAAI,CAAC,aAAa,CAAC;IAC5B,CAAC;IAED,IAAW,OAAO,CAAC,GAAkC;QACnD,IAAI,CAAC,aAAa,GAAG,GAAG,CAAC;IAC3B,CAAC;CACF"}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { Logger } from '../../Util/Log';
|
|
2
|
+
import { ImageFiltering } from '../Filtering';
|
|
3
|
+
/**
|
|
4
|
+
* Manages loading image sources into webgl textures, a unique id is associated with all sources
|
|
5
|
+
*/
|
|
6
|
+
export class TextureLoader {
|
|
7
|
+
constructor(gl) {
|
|
8
|
+
this._textureMap = new Map();
|
|
9
|
+
this._gl = gl;
|
|
10
|
+
TextureLoader._MAX_TEXTURE_SIZE = gl.getParameter(gl.MAX_TEXTURE_SIZE);
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Get the WebGL Texture from a source image
|
|
14
|
+
* @param image
|
|
15
|
+
*/
|
|
16
|
+
get(image) {
|
|
17
|
+
return this._textureMap.get(image);
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Returns whether a source image has been loaded as a texture
|
|
21
|
+
* @param image
|
|
22
|
+
*/
|
|
23
|
+
has(image) {
|
|
24
|
+
return this._textureMap.has(image);
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Loads a graphic into webgl and returns it's texture info, a webgl context must be previously registered
|
|
28
|
+
* @param image Source graphic
|
|
29
|
+
* @param filtering {ImageFiltering} The ImageFiltering mode to apply to the loaded texture
|
|
30
|
+
* @param forceUpdate Optionally force a texture to be reloaded, useful if the source graphic has changed
|
|
31
|
+
*/
|
|
32
|
+
load(image, filtering, forceUpdate = false) {
|
|
33
|
+
// Ignore loading if webgl is not registered
|
|
34
|
+
const gl = this._gl;
|
|
35
|
+
if (!gl) {
|
|
36
|
+
return null;
|
|
37
|
+
}
|
|
38
|
+
let tex = null;
|
|
39
|
+
// If reuse the texture if it's from the same source
|
|
40
|
+
if (this.has(image)) {
|
|
41
|
+
tex = this.get(image);
|
|
42
|
+
}
|
|
43
|
+
// Update existing webgl texture and return early
|
|
44
|
+
if (tex) {
|
|
45
|
+
if (forceUpdate) {
|
|
46
|
+
gl.bindTexture(gl.TEXTURE_2D, tex);
|
|
47
|
+
gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, image);
|
|
48
|
+
}
|
|
49
|
+
return tex;
|
|
50
|
+
}
|
|
51
|
+
// No texture exists create a new one
|
|
52
|
+
tex = gl.createTexture();
|
|
53
|
+
TextureLoader.checkImageSizeSupportedAndLog(image);
|
|
54
|
+
gl.bindTexture(gl.TEXTURE_2D, tex);
|
|
55
|
+
gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, true);
|
|
56
|
+
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);
|
|
57
|
+
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);
|
|
58
|
+
// NEAREST for pixel art, LINEAR for hi-res
|
|
59
|
+
const filterMode = filtering !== null && filtering !== void 0 ? filtering : TextureLoader.filtering;
|
|
60
|
+
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, filterMode === ImageFiltering.Pixel ? gl.NEAREST : gl.LINEAR);
|
|
61
|
+
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, filterMode === ImageFiltering.Pixel ? gl.NEAREST : gl.LINEAR);
|
|
62
|
+
gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, image);
|
|
63
|
+
this._textureMap.set(image, tex);
|
|
64
|
+
return tex;
|
|
65
|
+
}
|
|
66
|
+
delete(image) {
|
|
67
|
+
// Ignore loading if webgl is not registered
|
|
68
|
+
const gl = this._gl;
|
|
69
|
+
if (!gl) {
|
|
70
|
+
return null;
|
|
71
|
+
}
|
|
72
|
+
let tex = null;
|
|
73
|
+
if (this.has(image)) {
|
|
74
|
+
tex = this.get(image);
|
|
75
|
+
gl.deleteTexture(tex);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Takes an image and returns if it meets size criteria for hardware
|
|
80
|
+
* @param image
|
|
81
|
+
* @returns if the image will be supported at runtime
|
|
82
|
+
*/
|
|
83
|
+
static checkImageSizeSupportedAndLog(image) {
|
|
84
|
+
var _a;
|
|
85
|
+
const originalSrc = (_a = image.dataset.originalSrc) !== null && _a !== void 0 ? _a : 'internal canvas bitmap';
|
|
86
|
+
if (image.width > TextureLoader._MAX_TEXTURE_SIZE || image.height > TextureLoader._MAX_TEXTURE_SIZE) {
|
|
87
|
+
TextureLoader._LOGGER.error(`The image [${originalSrc}] provided to Excalibur is too large for the device's maximum texture size of ` +
|
|
88
|
+
`(${TextureLoader._MAX_TEXTURE_SIZE}x${TextureLoader._MAX_TEXTURE_SIZE}) please resize to an image `
|
|
89
|
+
+ `for excalibur to render properly.\n\nImages will likely render as black rectangles.\n\n` +
|
|
90
|
+
`Read more here: https://developer.mozilla.org/en-US/docs/Web/API/WebGL_API/WebGL_best_practices#understand_system_limits`);
|
|
91
|
+
return false;
|
|
92
|
+
}
|
|
93
|
+
else if (image.width > 4096 || image.height > 4096) {
|
|
94
|
+
// https://developer.mozilla.org/en-US/docs/Web/API/WebGL_API/WebGL_best_practices#understand_system_limits
|
|
95
|
+
TextureLoader._LOGGER.warn(`The image [${originalSrc}] provided to excalibur is too large may not work on all mobile devices, ` +
|
|
96
|
+
`it is recommended you resize images to a maximum (4096x4096).\n\n` +
|
|
97
|
+
`Images will likely render as black rectangles on some mobile platforms.\n\n` +
|
|
98
|
+
`Read more here: https://developer.mozilla.org/en-US/docs/Web/API/WebGL_API/WebGL_best_practices#understand_system_limits`);
|
|
99
|
+
}
|
|
100
|
+
return true;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
TextureLoader._LOGGER = Logger.getInstance();
|
|
104
|
+
/**
|
|
105
|
+
* Sets the default filtering for the Excalibur texture loader, default [[ImageFiltering.Blended]]
|
|
106
|
+
*/
|
|
107
|
+
TextureLoader.filtering = ImageFiltering.Blended;
|
|
108
|
+
TextureLoader._MAX_TEXTURE_SIZE = 4096;
|
|
109
|
+
//# sourceMappingURL=texture-loader.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"texture-loader.js","sourceRoot":"","sources":["../../../../src/engine/Graphics/Context/texture-loader.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AACxC,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAG9C;;GAEG;AACH,MAAM,OAAO,aAAa;IAGxB,YAAY,EAA0B;QAY9B,gBAAW,GAAG,IAAI,GAAG,EAAiC,CAAC;QAX7D,IAAI,CAAC,GAAG,GAAG,EAAE,CAAC;QACd,aAAa,CAAC,iBAAiB,GAAG,EAAE,CAAC,YAAY,CAAC,EAAE,CAAC,gBAAgB,CAAC,CAAC;IACzE,CAAC;IAaD;;;OAGG;IACI,GAAG,CAAC,KAAsB;QAC/B,OAAO,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IACrC,CAAC;IAED;;;OAGG;IACI,GAAG,CAAC,KAAsB;QAC/B,OAAO,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IACrC,CAAC;IAED;;;;;OAKG;IACI,IAAI,CAAC,KAAsB,EAAE,SAA0B,EAAE,WAAW,GAAG,KAAK;QACjF,4CAA4C;QAC5C,MAAM,EAAE,GAAG,IAAI,CAAC,GAAG,CAAC;QACpB,IAAI,CAAC,EAAE,EAAE,CAAC;YACR,OAAO,IAAI,CAAC;QACd,CAAC;QAED,IAAI,GAAG,GAAiB,IAAI,CAAC;QAC7B,oDAAoD;QACpD,IAAI,IAAI,CAA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A8B;kBACnG,yFAAyF;gBAC1F,0HAA0H,CAAC,CAAC;YAC9H,OAAO,KAAK,CAAC;QACf,CAAC;aAAM,IAAI,KAAK,CAAC,KAAK,GAAG,IAAI,IAAI,KAAK,CAAC,MAAM,GAAG,IAAI,EAAE,CAAC;YACrD,2GAA2G;YAC3G,aAAa,CAAC,OAAO,CAAC,IAAI,CACxB,cAAc,WAAW,2EAA2E;gBACpG,mEAAmE;gBACnE,6EAA6E;gBAC7E,0HAA0H,CAAC,CAAC;QAChI,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC;;AAzHc,qBAAO,GAAG,MAAM,CAAC,WAAW,EAAE,AAAvB,CAAwB;AAO9C;;GAEG;AACW,uBAAS,GAAmB,cAAc,CAAC,OAAO,AAAzC,CAA0C;AAMlD,+BAAiB,GAAW,IAAI,AAAf,CAAgB"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { AffineMatrix } from '../../Math/affine-matrix';
|
|
2
|
+
export class TransformStack {
|
|
3
|
+
constructor() {
|
|
4
|
+
this._transforms = [];
|
|
5
|
+
this._currentTransform = AffineMatrix.identity();
|
|
6
|
+
}
|
|
7
|
+
save() {
|
|
8
|
+
this._transforms.push(this._currentTransform);
|
|
9
|
+
this._currentTransform = this._currentTransform.clone();
|
|
10
|
+
}
|
|
11
|
+
restore() {
|
|
12
|
+
this._currentTransform = this._transforms.pop();
|
|
13
|
+
}
|
|
14
|
+
translate(x, y) {
|
|
15
|
+
return this._currentTransform.translate(x, y);
|
|
16
|
+
}
|
|
17
|
+
rotate(angle) {
|
|
18
|
+
return this._currentTransform.rotate(angle);
|
|
19
|
+
}
|
|
20
|
+
scale(x, y) {
|
|
21
|
+
return this._currentTransform.scale(x, y);
|
|
22
|
+
}
|
|
23
|
+
set current(matrix) {
|
|
24
|
+
this._currentTransform = matrix;
|
|
25
|
+
}
|
|
26
|
+
get current() {
|
|
27
|
+
return this._currentTransform;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=transform-stack.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transform-stack.js","sourceRoot":"","sources":["../../../../src/engine/Graphics/Context/transform-stack.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAExD,MAAM,OAAO,cAAc;IAA3B;QACU,gBAAW,GAAmB,EAAE,CAAC;QACjC,sBAAiB,GAAiB,YAAY,CAAC,QAAQ,EAAE,CAAC;IA8BpE,CAAC;IA5BQ,IAAI;QACT,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC;QAC9C,IAAI,CAAC,iBAAiB,GAAG,IAAI,CAAC,iBAAiB,CAAC,KAAK,EAAE,CAAC;IAC1D,CAAC;IAEM,OAAO;QACZ,IAAI,CAAC,iBAAiB,GAAG,IAAI,CAAC,WAAW,CAAC,GAAG,EAAE,CAAC;IAClD,CAAC;IAEM,SAAS,CAAC,CAAS,EAAE,CAAS;QACnC,OAAO,IAAI,CAAC,iBAAiB,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IAChD,CAAC;IAEM,MAAM,CAAC,KAAa;QACzB,OAAO,IAAI,CAAC,iBAAiB,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IAC9C,CAAC;IAEM,KAAK,CAAC,CAAS,EAAE,CAAS;QAC/B,OAAO,IAAI,CAAC,iBAAiB,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IAC5C,CAAC;IAED,IAAW,OAAO,CAAC,MAAoB;QACrC,IAAI,CAAC,iBAAiB,GAAG,MAAM,CAAC;IAClC,CAAC;IAED,IAAW,OAAO;QAChB,OAAO,IAAI,CAAC,iBAAiB,CAAC;IAChC,CAAC;CACF"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Helper around vertex buffer to simplify creating and uploading geometry
|
|
3
|
+
*
|
|
4
|
+
* Under the hood uses Float32Array
|
|
5
|
+
*/
|
|
6
|
+
export class VertexBuffer {
|
|
7
|
+
constructor(options) {
|
|
8
|
+
/**
|
|
9
|
+
* If the vertices never change switching 'static' can be more efficient on the gpu
|
|
10
|
+
*
|
|
11
|
+
* Default is 'dynamic'
|
|
12
|
+
*/
|
|
13
|
+
this.type = 'dynamic';
|
|
14
|
+
const { gl, size, type, data } = options;
|
|
15
|
+
this._gl = gl;
|
|
16
|
+
this.buffer = this._gl.createBuffer();
|
|
17
|
+
if (!data && !size) {
|
|
18
|
+
throw Error('Must either provide data or a size to the VertexBuffer');
|
|
19
|
+
}
|
|
20
|
+
if (!data) {
|
|
21
|
+
this.bufferData = new Float32Array(size);
|
|
22
|
+
}
|
|
23
|
+
else {
|
|
24
|
+
this.bufferData = data;
|
|
25
|
+
}
|
|
26
|
+
this.type = type !== null && type !== void 0 ? type : this.type;
|
|
27
|
+
// Allocate buffer
|
|
28
|
+
gl.bindBuffer(gl.ARRAY_BUFFER, this.buffer);
|
|
29
|
+
gl.bufferData(gl.ARRAY_BUFFER, this.bufferData, this.type === 'static' ? gl.STATIC_DRAW : gl.DYNAMIC_DRAW);
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Bind this vertex buffer
|
|
33
|
+
*/
|
|
34
|
+
bind() {
|
|
35
|
+
const gl = this._gl;
|
|
36
|
+
gl.bindBuffer(gl.ARRAY_BUFFER, this.buffer);
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Upload vertex buffer geometry to the GPU
|
|
40
|
+
*/
|
|
41
|
+
upload(count) {
|
|
42
|
+
const gl = this._gl;
|
|
43
|
+
gl.bindBuffer(gl.ARRAY_BUFFER, this.buffer);
|
|
44
|
+
if (count) {
|
|
45
|
+
gl.bufferSubData(gl.ARRAY_BUFFER, 0, this.bufferData, 0, count);
|
|
46
|
+
}
|
|
47
|
+
else {
|
|
48
|
+
// TODO always use bufferSubData? need to perf test it
|
|
49
|
+
gl.bufferData(gl.ARRAY_BUFFER, this.bufferData, this.type === 'static' ? gl.STATIC_DRAW : gl.DYNAMIC_DRAW);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
//# sourceMappingURL=vertex-buffer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vertex-buffer.js","sourceRoot":"","sources":["../../../../src/engine/Graphics/Context/vertex-buffer.ts"],"names":[],"mappings":"AAwBA;;;;GAIG;AACH,MAAM,OAAO,YAAY;IAmBvB,YAAY,OAA4B;QAPxC;;;;WAIG;QACI,SAAI,GAAyB,SAAS,CAAC;QAG5C,MAAM,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,OAAO,CAAC;QACzC,IAAI,CAAC,GAAG,GAAG,EAAE,CAAC;QACd,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC,YAAY,EAAE,CAAC;QACtC,IAAI,CAAC,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC;YACnB,MAAM,KAAK,CAAC,wDAAwD,CAAC,CAAC;QACxE,CAAC;QAED,IAAI,CAAC,IAAI,EAAE,CAAC;YACV,IAAI,CAAC,UAAU,GAAG,IAAI,YAAY,CAAC,IAAI,CAAC,CAAC;QAC3C,CAAC;aAAM,CAAC;YACN,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC;QACzB,CAAC;QACD,IAAI,CAAC,IAAI,GAAG,IAAI,aAAJ,IAAI,cAAJ,IAAI,GAAI,IAAI,CAAC,IAAI,CAAC;QAC9B,kBAAkB;QAClB,EAAE,CAAC,UAAU,CAAC,EAAE,CAAC,YAAY,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;QAC5C,EAAE,CAAC,UAAU,CAAC,EAAE,CAAC,YAAY,EAAE,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,CAAC,YAAY,CAAC,CAAC;IAC7G,CAAC;IAED;;OAEG;IACH,IAAI;QACF,MAAM,EAAE,GAAG,IAAI,CAAC,GAAG,CAAC;QACpB,EAAE,CAAC,UAAU,CAAC,EAAE,CAAC,YAAY,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;IAE9C,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,KAAc;QACnB,MAAM,EAAE,GAAG,IAAI,CAAC,GAAG,CAAC;QACpB,EAAE,CAAC,UAAU,CAAC,EAAE,CAAC,YAAY,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;QAC5C,IAAI,KAAK,EAAE,CAAC;YACV,EAAE,CAAC,aAAa,CAAC,EAAE,CAAC,YAAY,EAAE,CAAC,EAAE,IAAI,CAAC,UAAU,EAAE,CAAC,EAAE,KAAK,CAAC,CAAC;QAClE,CAAC;aAAM,CAAC;YACN,sDAAsD;YACtD,EAAE,CAAC,UAAU,CAAC,EAAE,CAAC,YAAY,EAAE,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,CAAC,YAAY,CAAC,CAAC;QAC7G,CAAC;IACH,CAAC;CACF"}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Return the size of the GlType in bytes
|
|
3
|
+
* @param gl
|
|
4
|
+
* @param type
|
|
5
|
+
*/
|
|
6
|
+
export function getGlTypeSizeBytes(gl, type) {
|
|
7
|
+
switch (type) {
|
|
8
|
+
case gl.FLOAT:
|
|
9
|
+
return 4;
|
|
10
|
+
case gl.SHORT:
|
|
11
|
+
return 2;
|
|
12
|
+
case gl.UNSIGNED_SHORT:
|
|
13
|
+
return 2;
|
|
14
|
+
case gl.BYTE:
|
|
15
|
+
return 1;
|
|
16
|
+
case gl.UNSIGNED_BYTE:
|
|
17
|
+
return 1;
|
|
18
|
+
default:
|
|
19
|
+
return 1;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Based on the type return the number of attribute components
|
|
24
|
+
*
|
|
25
|
+
* https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/vertexAttribPointer
|
|
26
|
+
* @param gl
|
|
27
|
+
* @param type
|
|
28
|
+
*/
|
|
29
|
+
export function getAttributeComponentSize(gl, type) {
|
|
30
|
+
switch (type) {
|
|
31
|
+
case gl.LOW_FLOAT:
|
|
32
|
+
case gl.HIGH_FLOAT:
|
|
33
|
+
case gl.FLOAT:
|
|
34
|
+
return 1;
|
|
35
|
+
case gl.FLOAT_VEC2:
|
|
36
|
+
return 2;
|
|
37
|
+
case gl.FLOAT_VEC3:
|
|
38
|
+
return 3;
|
|
39
|
+
case gl.FLOAT_VEC4:
|
|
40
|
+
return 4;
|
|
41
|
+
case gl.BYTE:
|
|
42
|
+
return 1;
|
|
43
|
+
case gl.UNSIGNED_BYTE:
|
|
44
|
+
return 1;
|
|
45
|
+
case gl.UNSIGNED_SHORT:
|
|
46
|
+
case gl.SHORT:
|
|
47
|
+
return 1;
|
|
48
|
+
default:
|
|
49
|
+
return 1;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Based on the attribute return the corresponding supported attrib pointer type
|
|
54
|
+
* https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/vertexAttribPointer
|
|
55
|
+
* @param gl
|
|
56
|
+
* @param type
|
|
57
|
+
*/
|
|
58
|
+
export function getAttributePointerType(gl, type) {
|
|
59
|
+
switch (type) {
|
|
60
|
+
case gl.LOW_FLOAT:
|
|
61
|
+
case gl.HIGH_FLOAT:
|
|
62
|
+
case gl.FLOAT:
|
|
63
|
+
case gl.FLOAT_VEC2:
|
|
64
|
+
case gl.FLOAT_VEC3:
|
|
65
|
+
case gl.FLOAT_VEC4:
|
|
66
|
+
return gl.FLOAT;
|
|
67
|
+
case gl.BYTE:
|
|
68
|
+
return gl.BYTE;
|
|
69
|
+
case gl.UNSIGNED_BYTE:
|
|
70
|
+
return gl.UNSIGNED_BYTE;
|
|
71
|
+
case gl.SHORT:
|
|
72
|
+
return gl.SHORT;
|
|
73
|
+
case gl.UNSIGNED_SHORT:
|
|
74
|
+
return gl.UNSIGNED_SHORT;
|
|
75
|
+
default:
|
|
76
|
+
return gl.FLOAT;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
//# sourceMappingURL=webgl-util.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"webgl-util.js","sourceRoot":"","sources":["../../../../src/engine/Graphics/Context/webgl-util.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,UAAU,kBAAkB,CAAC,EAAyB,EAAE,IAAY;IACxE,QAAQ,IAAI,EAAE,CAAC;QACb,KAAK,EAAE,CAAC,KAAK;YACX,OAAO,CAAC,CAAC;QACX,KAAK,EAAE,CAAC,KAAK;YACX,OAAO,CAAC,CAAC;QACX,KAAK,EAAE,CAAC,cAAc;YACpB,OAAO,CAAC,CAAC;QACX,KAAK,EAAE,CAAC,IAAI;YACV,OAAO,CAAC,CAAC;QACX,KAAK,EAAE,CAAC,aAAa;YACnB,OAAO,CAAC,CAAC;QACX;YACE,OAAO,CAAC,CAAC;IACb,CAAC;AACH,CAAC;AAGD;;;;;;GAMG;AACH,MAAM,UAAU,yBAAyB,CAAC,EAAyB,EAAE,IAAY;IAC/E,QAAQ,IAAI,EAAE,CAAC;QACb,KAAK,EAAE,CAAC,SAAS,CAAC;QAClB,KAAK,EAAE,CAAC,UAAU,CAAC;QACnB,KAAK,EAAE,CAAC,KAAK;YACX,OAAO,CAAC,CAAC;QACX,KAAK,EAAE,CAAC,UAAU;YAChB,OAAO,CAAC,CAAC;QACX,KAAK,EAAE,CAAC,UAAU;YAChB,OAAO,CAAC,CAAC;QACX,KAAK,EAAE,CAAC,UAAU;YAChB,OAAO,CAAC,CAAC;QACX,KAAK,EAAE,CAAC,IAAI;YACV,OAAO,CAAC,CAAC;QACX,KAAK,EAAE,CAAC,aAAa;YACnB,OAAO,CAAC,CAAC;QACX,KAAK,EAAE,CAAC,cAAc,CAAC;QACvB,KAAK,EAAE,CAAC,KAAK;YACX,OAAO,CAAC,CAAC;QACX;YACE,OAAO,CAAC,CAAC;IACb,CAAC;AACH,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,uBAAuB,CAAC,EAAyB,EAAE,IAAY;IAC7E,QAAQ,IAAI,EAAE,CAAC;QACb,KAAK,EAAE,CAAC,SAAS,CAAC;QAClB,KAAK,EAAE,CAAC,UAAU,CAAC;QACnB,KAAK,EAAE,CAAC,KAAK,CAAC;QACd,KAAK,EAAE,CAAC,UAAU,CAAC;QACnB,KAAK,EAAE,CAAC,UAAU,CAAC;QACnB,KAAK,EAAE,CAAC,UAAU;YAChB,OAAO,EAAE,CAAC,KAAK,CAAC;QAClB,KAAK,EAAE,CAAC,IAAI;YACV,OAAO,EAAE,CAAC,IAAI,CAAC;QACjB,KAAK,EAAE,CAAC,aAAa;YACnB,OAAO,EAAE,CAAC,aAAa,CAAC;QAC1B,KAAK,EAAE,CAAC,KAAK;YACX,OAAO,EAAE,CAAC,KAAK,CAAC;QAClB,KAAK,EAAE,CAAC,cAAc;YACpB,OAAO,EAAE,CAAC,cAAc,CAAC;QAC3B;YACE,OAAO,EAAE,CAAC,KAAK,CAAC;IACpB,CAAC;AACH,CAAC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ExcaliburGraphicsContext } from '.';
|
|
2
|
+
import { Debug } from '../Debug';
|
|
2
3
|
import { Component } from '../EntityComponentSystem/Component';
|
|
3
4
|
/**
|
|
4
5
|
* Provide arbitrary drawing for the purposes of debugging your game
|
|
@@ -7,8 +8,8 @@ import { Component } from '../EntityComponentSystem/Component';
|
|
|
7
8
|
*
|
|
8
9
|
*/
|
|
9
10
|
export declare class DebugGraphicsComponent extends Component<'ex.debuggraphics'> {
|
|
10
|
-
draw: (ctx: ExcaliburGraphicsContext) => void;
|
|
11
|
+
draw: (ctx: ExcaliburGraphicsContext, debugFlags: Debug) => void;
|
|
11
12
|
useTransform: boolean;
|
|
12
13
|
readonly type = "ex.debuggraphics";
|
|
13
|
-
constructor(draw: (ctx: ExcaliburGraphicsContext) => void, useTransform?: boolean);
|
|
14
|
+
constructor(draw: (ctx: ExcaliburGraphicsContext, debugFlags: Debug) => void, useTransform?: boolean);
|
|
14
15
|
}
|