@codexo/exojs 0.7.11 → 0.7.12
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/CHANGELOG.md +108 -0
- package/dist/esm/animation/Tween.d.ts +60 -1
- package/dist/esm/animation/Tween.js +60 -1
- package/dist/esm/animation/Tween.js.map +1 -1
- package/dist/esm/animation/TweenManager.d.ts +10 -0
- package/dist/esm/animation/TweenManager.js +10 -0
- package/dist/esm/animation/TweenManager.js.map +1 -1
- package/dist/esm/animation/types.d.ts +15 -0
- package/dist/esm/animation/types.js +6 -0
- package/dist/esm/animation/types.js.map +1 -1
- package/dist/esm/audio/AbstractMedia.d.ts +11 -0
- package/dist/esm/audio/AbstractMedia.js +10 -0
- package/dist/esm/audio/AbstractMedia.js.map +1 -1
- package/dist/esm/audio/AudioAnalyser.d.ts +21 -0
- package/dist/esm/audio/AudioAnalyser.js +16 -0
- package/dist/esm/audio/AudioAnalyser.js.map +1 -1
- package/dist/esm/audio/AudioBus.d.ts +37 -0
- package/dist/esm/audio/AudioBus.js +36 -0
- package/dist/esm/audio/AudioBus.js.map +1 -1
- package/dist/esm/audio/AudioFilter.d.ts +7 -0
- package/dist/esm/audio/AudioFilter.js +6 -0
- package/dist/esm/audio/AudioFilter.js.map +1 -1
- package/dist/esm/audio/AudioListener.d.ts +19 -0
- package/dist/esm/audio/AudioListener.js +11 -0
- package/dist/esm/audio/AudioListener.js.map +1 -1
- package/dist/esm/audio/AudioManager.d.ts +37 -0
- package/dist/esm/audio/AudioManager.js +37 -0
- package/dist/esm/audio/AudioManager.js.map +1 -1
- package/dist/esm/audio/BeatDetector.d.ts +21 -0
- package/dist/esm/audio/BeatDetector.js +21 -0
- package/dist/esm/audio/BeatDetector.js.map +1 -1
- package/dist/esm/audio/Media.d.ts +11 -0
- package/dist/esm/audio/Music.d.ts +12 -0
- package/dist/esm/audio/Music.js +12 -0
- package/dist/esm/audio/Music.js.map +1 -1
- package/dist/esm/audio/Sound.d.ts +25 -0
- package/dist/esm/audio/Sound.js +18 -0
- package/dist/esm/audio/Sound.js.map +1 -1
- package/dist/esm/audio/audio-context.d.ts +48 -0
- package/dist/esm/audio/audio-context.js +48 -5
- package/dist/esm/audio/audio-context.js.map +1 -1
- package/dist/esm/audio/filters/ChorusFilter.d.ts +5 -0
- package/dist/esm/audio/filters/ChorusFilter.js +4 -0
- package/dist/esm/audio/filters/ChorusFilter.js.map +1 -1
- package/dist/esm/audio/filters/CompressorFilter.d.ts +12 -0
- package/dist/esm/audio/filters/CompressorFilter.js +11 -0
- package/dist/esm/audio/filters/CompressorFilter.js.map +1 -1
- package/dist/esm/audio/filters/DelayFilter.d.ts +11 -0
- package/dist/esm/audio/filters/DelayFilter.js +10 -0
- package/dist/esm/audio/filters/DelayFilter.js.map +1 -1
- package/dist/esm/audio/filters/DuckingFilter.d.ts +13 -0
- package/dist/esm/audio/filters/DuckingFilter.js +12 -0
- package/dist/esm/audio/filters/DuckingFilter.js.map +1 -1
- package/dist/esm/audio/filters/EqualizerFilter.d.ts +20 -0
- package/dist/esm/audio/filters/EqualizerFilter.js +40 -0
- package/dist/esm/audio/filters/EqualizerFilter.js.map +1 -1
- package/dist/esm/audio/filters/GranularFilter.d.ts +6 -0
- package/dist/esm/audio/filters/GranularFilter.js +6 -0
- package/dist/esm/audio/filters/GranularFilter.js.map +1 -1
- package/dist/esm/audio/filters/HighpassFilter.d.ts +10 -0
- package/dist/esm/audio/filters/HighpassFilter.js +9 -0
- package/dist/esm/audio/filters/HighpassFilter.js.map +1 -1
- package/dist/esm/audio/filters/LowpassFilter.d.ts +10 -0
- package/dist/esm/audio/filters/LowpassFilter.js +9 -0
- package/dist/esm/audio/filters/LowpassFilter.js.map +1 -1
- package/dist/esm/audio/filters/PitchShiftFilter.d.ts +2 -0
- package/dist/esm/audio/filters/PitchShiftFilter.js +2 -0
- package/dist/esm/audio/filters/PitchShiftFilter.js.map +1 -1
- package/dist/esm/audio/filters/ReverbFilter.d.ts +12 -0
- package/dist/esm/audio/filters/ReverbFilter.js +11 -0
- package/dist/esm/audio/filters/ReverbFilter.js.map +1 -1
- package/dist/esm/audio/filters/VocoderFilter.d.ts +11 -0
- package/dist/esm/audio/filters/VocoderFilter.js +11 -0
- package/dist/esm/audio/filters/VocoderFilter.js.map +1 -1
- package/dist/esm/audio/filters/WorkletFilter.d.ts +6 -1
- package/dist/esm/audio/filters/WorkletFilter.js +6 -1
- package/dist/esm/audio/filters/WorkletFilter.js.map +1 -1
- package/dist/esm/core/Application.d.ts +63 -0
- package/dist/esm/core/Application.js +61 -0
- package/dist/esm/core/Application.js.map +1 -1
- package/dist/esm/core/Bounds.d.ts +23 -0
- package/dist/esm/core/Bounds.js +23 -0
- package/dist/esm/core/Bounds.js.map +1 -1
- package/dist/esm/core/Clock.d.ts +21 -0
- package/dist/esm/core/Clock.js +21 -0
- package/dist/esm/core/Clock.js.map +1 -1
- package/dist/esm/core/Color.d.ts +35 -0
- package/dist/esm/core/Color.js +35 -0
- package/dist/esm/core/Color.js.map +1 -1
- package/dist/esm/core/Scene.d.ts +46 -0
- package/dist/esm/core/Scene.js +27 -0
- package/dist/esm/core/Scene.js.map +1 -1
- package/dist/esm/core/SceneManager.d.ts +62 -0
- package/dist/esm/core/SceneManager.js +49 -0
- package/dist/esm/core/SceneManager.js.map +1 -1
- package/dist/esm/core/SceneNode.d.ts +31 -0
- package/dist/esm/core/SceneNode.js +31 -0
- package/dist/esm/core/SceneNode.js.map +1 -1
- package/dist/esm/core/Signal.d.ts +44 -0
- package/dist/esm/core/Signal.js +39 -0
- package/dist/esm/core/Signal.js.map +1 -1
- package/dist/esm/core/Time.d.ts +21 -0
- package/dist/esm/core/Time.js +21 -0
- package/dist/esm/core/Time.js.map +1 -1
- package/dist/esm/core/Timer.d.ts +7 -0
- package/dist/esm/core/Timer.js +7 -0
- package/dist/esm/core/Timer.js.map +1 -1
- package/dist/esm/core/capabilities.d.ts +12 -0
- package/dist/esm/core/capabilities.js +12 -0
- package/dist/esm/core/capabilities.js.map +1 -1
- package/dist/esm/core/types.d.ts +37 -0
- package/dist/esm/core/utils.d.ts +48 -0
- package/dist/esm/core/utils.js +48 -0
- package/dist/esm/core/utils.js.map +1 -1
- package/dist/esm/debug/BoundingBoxesLayer.d.ts +8 -0
- package/dist/esm/debug/BoundingBoxesLayer.js +8 -0
- package/dist/esm/debug/BoundingBoxesLayer.js.map +1 -1
- package/dist/esm/debug/DebugLayer.d.ts +16 -3
- package/dist/esm/debug/DebugLayer.js +11 -3
- package/dist/esm/debug/DebugLayer.js.map +1 -1
- package/dist/esm/debug/DebugOverlay.d.ts +11 -0
- package/dist/esm/debug/DebugOverlay.js +6 -0
- package/dist/esm/debug/DebugOverlay.js.map +1 -1
- package/dist/esm/debug/HitTestLayer.d.ts +9 -0
- package/dist/esm/debug/HitTestLayer.js +9 -0
- package/dist/esm/debug/HitTestLayer.js.map +1 -1
- package/dist/esm/debug/PerformanceLayer.d.ts +17 -1
- package/dist/esm/debug/PerformanceLayer.js +18 -0
- package/dist/esm/debug/PerformanceLayer.js.map +1 -1
- package/dist/esm/debug/PointerStackLayer.d.ts +8 -0
- package/dist/esm/debug/PointerStackLayer.js +10 -2
- package/dist/esm/debug/PointerStackLayer.js.map +1 -1
- package/dist/esm/index.js +2 -2
- package/dist/esm/input/ArcadeStickGamepadMapping.d.ts +7 -0
- package/dist/esm/input/ArcadeStickGamepadMapping.js +7 -0
- package/dist/esm/input/ArcadeStickGamepadMapping.js.map +1 -1
- package/dist/esm/input/GameCubeGamepadMapping.d.ts +9 -0
- package/dist/esm/input/GameCubeGamepadMapping.js +9 -0
- package/dist/esm/input/GameCubeGamepadMapping.js.map +1 -1
- package/dist/esm/input/Gamepad.d.ts +48 -0
- package/dist/esm/input/Gamepad.js +43 -0
- package/dist/esm/input/Gamepad.js.map +1 -1
- package/dist/esm/input/GamepadChannels.d.ts +8 -0
- package/dist/esm/input/GamepadChannels.js +8 -0
- package/dist/esm/input/GamepadChannels.js.map +1 -1
- package/dist/esm/input/GamepadControl.d.ts +18 -0
- package/dist/esm/input/GamepadControl.js +13 -0
- package/dist/esm/input/GamepadControl.js.map +1 -1
- package/dist/esm/input/GamepadDefinitions.d.ts +64 -1
- package/dist/esm/input/GamepadDefinitions.js +40 -1
- package/dist/esm/input/GamepadDefinitions.js.map +1 -1
- package/dist/esm/input/GamepadMapping.d.ts +32 -2
- package/dist/esm/input/GamepadMapping.js +24 -0
- package/dist/esm/input/GamepadMapping.js.map +1 -1
- package/dist/esm/input/GamepadPromptLayouts.d.ts +32 -1
- package/dist/esm/input/GamepadPromptLayouts.js +25 -1
- package/dist/esm/input/GamepadPromptLayouts.js.map +1 -1
- package/dist/esm/input/GenericDualAnalogGamepadMapping.d.ts +10 -0
- package/dist/esm/input/GenericDualAnalogGamepadMapping.js +10 -0
- package/dist/esm/input/GenericDualAnalogGamepadMapping.js.map +1 -1
- package/dist/esm/input/GestureRecognizer.d.ts +11 -2
- package/dist/esm/input/GestureRecognizer.js +11 -2
- package/dist/esm/input/GestureRecognizer.js.map +1 -1
- package/dist/esm/input/Input.d.ts +24 -0
- package/dist/esm/input/Input.js +22 -0
- package/dist/esm/input/Input.js.map +1 -1
- package/dist/esm/input/InputManager.d.ts +33 -0
- package/dist/esm/input/InputManager.js +33 -0
- package/dist/esm/input/InputManager.js.map +1 -1
- package/dist/esm/input/InteractionEvent.d.ts +13 -0
- package/dist/esm/input/InteractionEvent.js +8 -0
- package/dist/esm/input/InteractionEvent.js.map +1 -1
- package/dist/esm/input/InteractionManager.d.ts +33 -4
- package/dist/esm/input/InteractionManager.js +33 -4
- package/dist/esm/input/InteractionManager.js.map +1 -1
- package/dist/esm/input/JoyConLeftGamepadMapping.d.ts +9 -0
- package/dist/esm/input/JoyConLeftGamepadMapping.js +9 -0
- package/dist/esm/input/JoyConLeftGamepadMapping.js.map +1 -1
- package/dist/esm/input/JoyConRightGamepadMapping.d.ts +9 -0
- package/dist/esm/input/JoyConRightGamepadMapping.js +9 -0
- package/dist/esm/input/JoyConRightGamepadMapping.js.map +1 -1
- package/dist/esm/input/PlayStationGamepadMapping.d.ts +8 -0
- package/dist/esm/input/PlayStationGamepadMapping.js +8 -0
- package/dist/esm/input/PlayStationGamepadMapping.js.map +1 -1
- package/dist/esm/input/Pointer.d.ts +22 -0
- package/dist/esm/input/Pointer.js +22 -0
- package/dist/esm/input/Pointer.js.map +1 -1
- package/dist/esm/input/SteamControllerGamepadMapping.d.ts +8 -0
- package/dist/esm/input/SteamControllerGamepadMapping.js +8 -0
- package/dist/esm/input/SteamControllerGamepadMapping.js.map +1 -1
- package/dist/esm/input/SwitchProGamepadMapping.d.ts +9 -0
- package/dist/esm/input/SwitchProGamepadMapping.js +9 -0
- package/dist/esm/input/SwitchProGamepadMapping.js.map +1 -1
- package/dist/esm/input/XboxGamepadMapping.d.ts +8 -0
- package/dist/esm/input/XboxGamepadMapping.js +8 -0
- package/dist/esm/input/XboxGamepadMapping.js.map +1 -1
- package/dist/esm/input/types.d.ts +20 -0
- package/dist/esm/input/types.js +20 -0
- package/dist/esm/input/types.js.map +1 -1
- package/dist/esm/math/AbstractVector.d.ts +83 -0
- package/dist/esm/math/AbstractVector.js +83 -0
- package/dist/esm/math/AbstractVector.js.map +1 -1
- package/dist/esm/math/Circle.d.ts +32 -0
- package/dist/esm/math/Circle.js +34 -2
- package/dist/esm/math/Circle.js.map +1 -1
- package/dist/esm/math/CircleLike.d.ts +1 -0
- package/dist/esm/math/Collision.d.ts +39 -0
- package/dist/esm/math/Collision.js +5 -0
- package/dist/esm/math/Collision.js.map +1 -1
- package/dist/esm/math/Ellipse.d.ts +11 -0
- package/dist/esm/math/Ellipse.js +18 -2
- package/dist/esm/math/Ellipse.js.map +1 -1
- package/dist/esm/math/EllipseLike.d.ts +3 -0
- package/dist/esm/math/Flags.d.ts +31 -0
- package/dist/esm/math/Flags.js +31 -0
- package/dist/esm/math/Flags.js.map +1 -1
- package/dist/esm/math/Interval.d.ts +15 -0
- package/dist/esm/math/Interval.js +15 -0
- package/dist/esm/math/Interval.js.map +1 -1
- package/dist/esm/math/Line.d.ts +17 -1
- package/dist/esm/math/Line.js +17 -1
- package/dist/esm/math/Line.js.map +1 -1
- package/dist/esm/math/LineLike.d.ts +1 -0
- package/dist/esm/math/Matrix.d.ts +44 -3
- package/dist/esm/math/Matrix.js +44 -3
- package/dist/esm/math/Matrix.js.map +1 -1
- package/dist/esm/math/ObservableSize.d.ts +7 -0
- package/dist/esm/math/ObservableSize.js +7 -0
- package/dist/esm/math/ObservableSize.js.map +1 -1
- package/dist/esm/math/ObservableVector.d.ts +9 -0
- package/dist/esm/math/ObservableVector.js +9 -0
- package/dist/esm/math/ObservableVector.js.map +1 -1
- package/dist/esm/math/PointLike.d.ts +1 -0
- package/dist/esm/math/PolarVector.d.ts +15 -0
- package/dist/esm/math/PolarVector.js +16 -1
- package/dist/esm/math/PolarVector.js.map +1 -1
- package/dist/esm/math/Polygon.d.ts +20 -0
- package/dist/esm/math/Polygon.js +20 -0
- package/dist/esm/math/Polygon.js.map +1 -1
- package/dist/esm/math/PolygonLike.d.ts +4 -0
- package/dist/esm/math/Quadtree.d.ts +40 -3
- package/dist/esm/math/Quadtree.js +39 -3
- package/dist/esm/math/Quadtree.js.map +1 -1
- package/dist/esm/math/Random.d.ts +25 -0
- package/dist/esm/math/Random.js +25 -0
- package/dist/esm/math/Random.js.map +1 -1
- package/dist/esm/math/Rectangle.d.ts +15 -0
- package/dist/esm/math/Rectangle.js +17 -2
- package/dist/esm/math/Rectangle.js.map +1 -1
- package/dist/esm/math/RectangleLike.d.ts +1 -0
- package/dist/esm/math/Segment.d.ts +7 -0
- package/dist/esm/math/Segment.js +7 -0
- package/dist/esm/math/Segment.js.map +1 -1
- package/dist/esm/math/ShapeLike.d.ts +6 -0
- package/dist/esm/math/Size.d.ts +9 -0
- package/dist/esm/math/Size.js +9 -0
- package/dist/esm/math/Size.js.map +1 -1
- package/dist/esm/math/Vector.d.ts +16 -0
- package/dist/esm/math/Vector.js +16 -0
- package/dist/esm/math/Vector.js.map +1 -1
- package/dist/esm/math/collision-detection.d.ts +47 -1
- package/dist/esm/math/collision-detection.js +228 -17
- package/dist/esm/math/collision-detection.js.map +1 -1
- package/dist/esm/math/collision-primitives.d.ts +23 -0
- package/dist/esm/math/collision-primitives.js +23 -0
- package/dist/esm/math/collision-primitives.js.map +1 -1
- package/dist/esm/math/geometry.d.ts +42 -0
- package/dist/esm/math/geometry.js +37 -0
- package/dist/esm/math/geometry.js.map +1 -1
- package/dist/esm/math/utils.d.ts +41 -0
- package/dist/esm/math/utils.js +41 -0
- package/dist/esm/math/utils.js.map +1 -1
- package/dist/esm/particles/Particle.d.ts +37 -0
- package/dist/esm/particles/Particle.js +37 -0
- package/dist/esm/particles/Particle.js.map +1 -1
- package/dist/esm/particles/ParticleProperties.d.ts +15 -0
- package/dist/esm/particles/ParticleSystem.d.ts +69 -0
- package/dist/esm/particles/ParticleSystem.js +69 -0
- package/dist/esm/particles/ParticleSystem.js.map +1 -1
- package/dist/esm/particles/affectors/ColorAffector.d.ts +13 -0
- package/dist/esm/particles/affectors/ColorAffector.js +13 -0
- package/dist/esm/particles/affectors/ColorAffector.js.map +1 -1
- package/dist/esm/particles/affectors/ForceAffector.d.ts +11 -0
- package/dist/esm/particles/affectors/ForceAffector.js +11 -0
- package/dist/esm/particles/affectors/ForceAffector.js.map +1 -1
- package/dist/esm/particles/affectors/ParticleAffector.d.ts +13 -0
- package/dist/esm/particles/affectors/ScaleAffector.d.ts +10 -0
- package/dist/esm/particles/affectors/ScaleAffector.js +10 -0
- package/dist/esm/particles/affectors/ScaleAffector.js.map +1 -1
- package/dist/esm/particles/affectors/TorqueAffector.d.ts +11 -0
- package/dist/esm/particles/affectors/TorqueAffector.js +11 -0
- package/dist/esm/particles/affectors/TorqueAffector.js.map +1 -1
- package/dist/esm/particles/emitters/ParticleEmitter.d.ts +13 -0
- package/dist/esm/particles/emitters/ParticleOptions.d.ts +16 -0
- package/dist/esm/particles/emitters/ParticleOptions.js +16 -0
- package/dist/esm/particles/emitters/ParticleOptions.js.map +1 -1
- package/dist/esm/particles/emitters/UniversalEmitter.d.ts +23 -0
- package/dist/esm/particles/emitters/UniversalEmitter.js +23 -0
- package/dist/esm/particles/emitters/UniversalEmitter.js.map +1 -1
- package/dist/esm/rendering/CallbackRenderPass.d.ts +12 -0
- package/dist/esm/rendering/CallbackRenderPass.js +12 -0
- package/dist/esm/rendering/CallbackRenderPass.js.map +1 -1
- package/dist/esm/rendering/Container.d.ts +43 -0
- package/dist/esm/rendering/Container.js +43 -0
- package/dist/esm/rendering/Container.js.map +1 -1
- package/dist/esm/rendering/Drawable.d.ts +22 -0
- package/dist/esm/rendering/Drawable.js +22 -0
- package/dist/esm/rendering/Drawable.js.map +1 -1
- package/dist/esm/rendering/RenderBackend.d.ts +13 -0
- package/dist/esm/rendering/RenderBackendType.d.ts +4 -0
- package/dist/esm/rendering/RenderBackendType.js +4 -0
- package/dist/esm/rendering/RenderBackendType.js.map +1 -1
- package/dist/esm/rendering/RenderNode.d.ts +18 -0
- package/dist/esm/rendering/RenderNode.js +18 -0
- package/dist/esm/rendering/RenderNode.js.map +1 -1
- package/dist/esm/rendering/RenderPass.d.ts +8 -0
- package/dist/esm/rendering/RenderStats.d.ts +19 -0
- package/dist/esm/rendering/RenderStats.js +7 -0
- package/dist/esm/rendering/RenderStats.js.map +1 -1
- package/dist/esm/rendering/RenderTarget.d.ts +17 -0
- package/dist/esm/rendering/RenderTarget.js +17 -0
- package/dist/esm/rendering/RenderTarget.js.map +1 -1
- package/dist/esm/rendering/RenderTargetPass.d.ts +11 -0
- package/dist/esm/rendering/RenderTargetPass.js +7 -0
- package/dist/esm/rendering/RenderTargetPass.js.map +1 -1
- package/dist/esm/rendering/Renderer.d.ts +15 -0
- package/dist/esm/rendering/RendererRegistry.d.ts +7 -0
- package/dist/esm/rendering/RendererRegistry.js +7 -0
- package/dist/esm/rendering/RendererRegistry.js.map +1 -1
- package/dist/esm/rendering/View.d.ts +67 -2
- package/dist/esm/rendering/View.js +57 -0
- package/dist/esm/rendering/View.js.map +1 -1
- package/dist/esm/rendering/filters/BlurFilter.d.ts +9 -0
- package/dist/esm/rendering/filters/BlurFilter.js +8 -0
- package/dist/esm/rendering/filters/BlurFilter.js.map +1 -1
- package/dist/esm/rendering/filters/ColorFilter.d.ts +7 -0
- package/dist/esm/rendering/filters/ColorFilter.js +7 -0
- package/dist/esm/rendering/filters/ColorFilter.js.map +1 -1
- package/dist/esm/rendering/filters/Filter.d.ts +23 -0
- package/dist/esm/rendering/filters/Filter.js +20 -0
- package/dist/esm/rendering/filters/Filter.js.map +1 -1
- package/dist/esm/rendering/filters/WebGl2ShaderFilter.d.ts +5 -0
- package/dist/esm/rendering/filters/WebGl2ShaderFilter.js +5 -0
- package/dist/esm/rendering/filters/WebGl2ShaderFilter.js.map +1 -1
- package/dist/esm/rendering/filters/WebGpuShaderFilter.d.ts +5 -0
- package/dist/esm/rendering/filters/WebGpuShaderFilter.js +5 -0
- package/dist/esm/rendering/filters/WebGpuShaderFilter.js.map +1 -1
- package/dist/esm/rendering/mesh/Mesh.d.ts +2 -0
- package/dist/esm/rendering/mesh/Mesh.js +2 -0
- package/dist/esm/rendering/mesh/Mesh.js.map +1 -1
- package/dist/esm/rendering/primitives/Graphics.d.ts +34 -0
- package/dist/esm/rendering/primitives/Graphics.js +34 -0
- package/dist/esm/rendering/primitives/Graphics.js.map +1 -1
- package/dist/esm/rendering/shader/Shader.d.ts +36 -0
- package/dist/esm/rendering/shader/Shader.js +26 -0
- package/dist/esm/rendering/shader/Shader.js.map +1 -1
- package/dist/esm/rendering/shader/ShaderAttribute.d.ts +13 -0
- package/dist/esm/rendering/shader/ShaderAttribute.js +13 -0
- package/dist/esm/rendering/shader/ShaderAttribute.js.map +1 -1
- package/dist/esm/rendering/shader/ShaderUniform.d.ts +27 -0
- package/dist/esm/rendering/shader/ShaderUniform.js +28 -1
- package/dist/esm/rendering/shader/ShaderUniform.js.map +1 -1
- package/dist/esm/rendering/sprite/AnimatedSprite.d.ts +38 -0
- package/dist/esm/rendering/sprite/AnimatedSprite.js +36 -0
- package/dist/esm/rendering/sprite/AnimatedSprite.js.map +1 -1
- package/dist/esm/rendering/sprite/Sprite.d.ts +56 -0
- package/dist/esm/rendering/sprite/Sprite.js +56 -0
- package/dist/esm/rendering/sprite/Sprite.js.map +1 -1
- package/dist/esm/rendering/sprite/Spritesheet.d.ts +25 -0
- package/dist/esm/rendering/sprite/Spritesheet.js +20 -0
- package/dist/esm/rendering/sprite/Spritesheet.js.map +1 -1
- package/dist/esm/rendering/text/Text.d.ts +2 -0
- package/dist/esm/rendering/text/Text.js +2 -0
- package/dist/esm/rendering/text/Text.js.map +1 -1
- package/dist/esm/rendering/text/TextStyle.d.ts +29 -0
- package/dist/esm/rendering/text/TextStyle.js +24 -0
- package/dist/esm/rendering/text/TextStyle.js.map +1 -1
- package/dist/esm/rendering/text/types.d.ts +1 -0
- package/dist/esm/rendering/texture/RenderTexture.d.ts +16 -0
- package/dist/esm/rendering/texture/RenderTexture.js +16 -0
- package/dist/esm/rendering/texture/RenderTexture.js.map +1 -1
- package/dist/esm/rendering/texture/Sampler.d.ts +23 -0
- package/dist/esm/rendering/texture/Sampler.js +13 -0
- package/dist/esm/rendering/texture/Sampler.js.map +1 -1
- package/dist/esm/rendering/texture/Texture.d.ts +30 -0
- package/dist/esm/rendering/texture/Texture.js +30 -0
- package/dist/esm/rendering/texture/Texture.js.map +1 -1
- package/dist/esm/rendering/types.d.ts +29 -0
- package/dist/esm/rendering/types.js +29 -0
- package/dist/esm/rendering/types.js.map +1 -1
- package/dist/esm/rendering/utils.d.ts +20 -0
- package/dist/esm/rendering/utils.js +10 -0
- package/dist/esm/rendering/utils.js.map +1 -1
- package/dist/esm/rendering/video/Video.d.ts +35 -1
- package/dist/esm/rendering/video/Video.js +36 -2
- package/dist/esm/rendering/video/Video.js.map +1 -1
- package/dist/esm/rendering/webgl2/AbstractWebGl2BatchedRenderer.d.ts +7 -0
- package/dist/esm/rendering/webgl2/AbstractWebGl2BatchedRenderer.js +7 -0
- package/dist/esm/rendering/webgl2/AbstractWebGl2BatchedRenderer.js.map +1 -1
- package/dist/esm/rendering/webgl2/WebGl2Backend.d.ts +13 -0
- package/dist/esm/rendering/webgl2/WebGl2Backend.js +13 -0
- package/dist/esm/rendering/webgl2/WebGl2Backend.js.map +1 -1
- package/dist/esm/rendering/webgl2/WebGl2RenderBuffer.d.ts +8 -0
- package/dist/esm/rendering/webgl2/WebGl2RenderBuffer.js +8 -0
- package/dist/esm/rendering/webgl2/WebGl2RenderBuffer.js.map +1 -1
- package/dist/esm/rendering/webgpu/WebGpuBackend.d.ts +35 -0
- package/dist/esm/rendering/webgpu/WebGpuBackend.js +135 -5
- package/dist/esm/rendering/webgpu/WebGpuBackend.js.map +1 -1
- package/dist/esm/resources/AbstractAssetFactory.d.ts +20 -0
- package/dist/esm/resources/AbstractAssetFactory.js +20 -0
- package/dist/esm/resources/AbstractAssetFactory.js.map +1 -1
- package/dist/esm/resources/AssetFactory.d.ts +26 -0
- package/dist/esm/resources/AssetManifest.d.ts +45 -0
- package/dist/esm/resources/AssetManifest.js +25 -0
- package/dist/esm/resources/AssetManifest.js.map +1 -1
- package/dist/esm/resources/CacheFirstStrategy.d.ts +12 -0
- package/dist/esm/resources/CacheFirstStrategy.js +12 -0
- package/dist/esm/resources/CacheFirstStrategy.js.map +1 -1
- package/dist/esm/resources/CacheStore.d.ts +23 -0
- package/dist/esm/resources/CacheStrategy.d.ts +20 -0
- package/dist/esm/resources/Database.d.ts +45 -0
- package/dist/esm/resources/FactoryRegistry.d.ts +28 -0
- package/dist/esm/resources/FactoryRegistry.js +24 -0
- package/dist/esm/resources/FactoryRegistry.js.map +1 -1
- package/dist/esm/resources/IndexedDbDatabase.d.ts +22 -1
- package/dist/esm/resources/IndexedDbDatabase.js +21 -0
- package/dist/esm/resources/IndexedDbDatabase.js.map +1 -1
- package/dist/esm/resources/IndexedDbStore.d.ts +20 -0
- package/dist/esm/resources/IndexedDbStore.js +12 -0
- package/dist/esm/resources/IndexedDbStore.js.map +1 -1
- package/dist/esm/resources/Loader.d.ts +167 -0
- package/dist/esm/resources/Loader.js +110 -0
- package/dist/esm/resources/Loader.js.map +1 -1
- package/dist/esm/resources/NetworkOnlyStrategy.d.ts +8 -0
- package/dist/esm/resources/NetworkOnlyStrategy.js +8 -0
- package/dist/esm/resources/NetworkOnlyStrategy.js.map +1 -1
- package/dist/esm/resources/factories/BinaryFactory.d.ts +13 -0
- package/dist/esm/resources/factories/BinaryFactory.js +13 -0
- package/dist/esm/resources/factories/BinaryFactory.js.map +1 -1
- package/dist/esm/resources/factories/FontFactory.d.ts +37 -0
- package/dist/esm/resources/factories/FontFactory.js +26 -0
- package/dist/esm/resources/factories/FontFactory.js.map +1 -1
- package/dist/esm/resources/factories/ImageFactory.d.ts +24 -0
- package/dist/esm/resources/factories/ImageFactory.js +19 -0
- package/dist/esm/resources/factories/ImageFactory.js.map +1 -1
- package/dist/esm/resources/factories/JsonFactory.d.ts +13 -0
- package/dist/esm/resources/factories/JsonFactory.js +13 -0
- package/dist/esm/resources/factories/JsonFactory.js.map +1 -1
- package/dist/esm/resources/factories/MusicFactory.d.ts +36 -0
- package/dist/esm/resources/factories/MusicFactory.js +44 -4
- package/dist/esm/resources/factories/MusicFactory.js.map +1 -1
- package/dist/esm/resources/factories/SoundFactory.d.ts +29 -0
- package/dist/esm/resources/factories/SoundFactory.js +18 -0
- package/dist/esm/resources/factories/SoundFactory.js.map +1 -1
- package/dist/esm/resources/factories/SvgFactory.d.ts +19 -0
- package/dist/esm/resources/factories/SvgFactory.js +19 -0
- package/dist/esm/resources/factories/SvgFactory.js.map +1 -1
- package/dist/esm/resources/factories/TextFactory.d.ts +11 -0
- package/dist/esm/resources/factories/TextFactory.js +11 -0
- package/dist/esm/resources/factories/TextFactory.js.map +1 -1
- package/dist/esm/resources/factories/TextureFactory.d.ts +25 -0
- package/dist/esm/resources/factories/TextureFactory.js +20 -0
- package/dist/esm/resources/factories/TextureFactory.js.map +1 -1
- package/dist/esm/resources/factories/VideoFactory.d.ts +37 -0
- package/dist/esm/resources/factories/VideoFactory.js +48 -5
- package/dist/esm/resources/factories/VideoFactory.js.map +1 -1
- package/dist/esm/resources/factories/VttFactory.d.ts +18 -0
- package/dist/esm/resources/factories/VttFactory.js +24 -0
- package/dist/esm/resources/factories/VttFactory.js.map +1 -1
- package/dist/esm/resources/factories/WasmFactory.d.ts +16 -0
- package/dist/esm/resources/factories/WasmFactory.js +16 -0
- package/dist/esm/resources/factories/WasmFactory.js.map +1 -1
- package/dist/esm/resources/utils.d.ts +10 -0
- package/dist/esm/resources/utils.js +10 -0
- package/dist/esm/resources/utils.js.map +1 -1
- package/dist/exo.esm.js +3392 -59
- package/dist/exo.esm.js.map +1 -1
- package/package.json +7 -8
|
@@ -1,5 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Backend-agnostic shader program descriptor.
|
|
3
|
+
*
|
|
4
|
+
* Holds raw GLSL source strings and, after {@link connect} is called, a live
|
|
5
|
+
* {@link ShaderProgram} with populated {@link attributes} and {@link uniforms} maps.
|
|
6
|
+
* Call {@link bind} before draw calls and {@link sync} after updating uniform values.
|
|
7
|
+
* Both maps are cleared on {@link disconnect} and {@link destroy}.
|
|
8
|
+
*/
|
|
1
9
|
class Shader {
|
|
10
|
+
/** Vertex attribute metadata populated by the backend after {@link connect}. */
|
|
2
11
|
attributes = new Map();
|
|
12
|
+
/** Uniform metadata populated by the backend after {@link connect}. */
|
|
3
13
|
uniforms = new Map();
|
|
4
14
|
_vertexSource;
|
|
5
15
|
_fragmentSource;
|
|
@@ -14,6 +24,10 @@ class Shader {
|
|
|
14
24
|
get fragmentSource() {
|
|
15
25
|
return this._fragmentSource;
|
|
16
26
|
}
|
|
27
|
+
/**
|
|
28
|
+
* Attach a backend GPU program, compile/link it, and populate the attribute and uniform maps.
|
|
29
|
+
* Must be called before {@link bind}, {@link sync}, or accessing {@link attributes}/{@link uniforms}.
|
|
30
|
+
*/
|
|
17
31
|
connect(program) {
|
|
18
32
|
this._program = program;
|
|
19
33
|
program.initialize(this);
|
|
@@ -33,10 +47,18 @@ class Shader {
|
|
|
33
47
|
this._program?.unbind(this);
|
|
34
48
|
return this;
|
|
35
49
|
}
|
|
50
|
+
/**
|
|
51
|
+
* Upload all dirty {@link ShaderUniform} values to the GPU.
|
|
52
|
+
* Call once per draw call after modifying uniform data.
|
|
53
|
+
*/
|
|
36
54
|
sync() {
|
|
37
55
|
this._program?.sync(this);
|
|
38
56
|
return this;
|
|
39
57
|
}
|
|
58
|
+
/**
|
|
59
|
+
* Retrieve a named vertex attribute from the map populated by the backend.
|
|
60
|
+
* @throws Error if no attribute with `name` exists.
|
|
61
|
+
*/
|
|
40
62
|
getAttribute(name) {
|
|
41
63
|
const attribute = this.attributes.get(name);
|
|
42
64
|
if (!attribute) {
|
|
@@ -44,6 +66,10 @@ class Shader {
|
|
|
44
66
|
}
|
|
45
67
|
return attribute;
|
|
46
68
|
}
|
|
69
|
+
/**
|
|
70
|
+
* Retrieve a named uniform from the map populated by the backend.
|
|
71
|
+
* @throws Error if no uniform with `name` exists.
|
|
72
|
+
*/
|
|
47
73
|
getUniform(name) {
|
|
48
74
|
const uniform = this.uniforms.get(name);
|
|
49
75
|
if (!uniform) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Shader.js","sources":["../../../../../src/rendering/shader/Shader.ts"],"sourcesContent":[null],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Shader.js","sources":["../../../../../src/rendering/shader/Shader.ts"],"sourcesContent":[null],"names":[],"mappings":"AAqBA;;;;;;;AAOG;MACU,MAAM,CAAA;;AAGC,IAAA,UAAU,GAAiC,IAAI,GAAG,EAA2B;;AAE7E,IAAA,QAAQ,GAA+B,IAAI,GAAG,EAAyB;AAEtE,IAAA,aAAa;AACb,IAAA,eAAe;IACxB,QAAQ,GAAyB,IAAI;IAE7C,WAAA,CAAmB,YAAoB,E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AAU,CAAC,IAAY,EAAA;QAC1B,MAAM,OAAO,GAAG,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC;QAEvC,IAAI,CAAC,OAAO,EAAE;AACV,YAAA,MAAM,IAAI,KAAK,CAAC,YAAY,IAAI,CAAA,mBAAA,CAAqB,CAAC;QAC1D;AAEA,QAAA,OAAO,OAAO;IAClB;IAEO,OAAO,GAAA;AACV,QAAA,IAAI,CAAC,QAAQ,EAAE,OAAO,CAAC,IAAI,CAAC;AAC5B,QAAA,IAAI,CAAC,QAAQ,GAAG,IAAI;AACpB,QAAA,IAAI,CAAC,UAAU,CAAC,KAAK,EAAE;AACvB,QAAA,IAAI,CAAC,QAAQ,CAAC,KAAK,EAAE;IACzB;AACH;;;;"}
|
|
@@ -1,8 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Metadata for a single vertex attribute declared in a GLSL vertex shader.
|
|
3
|
+
*
|
|
4
|
+
* Populated by the backend during {@link Shader.connect} using the values
|
|
5
|
+
* returned by `gl.getActiveAttrib`. The `size` field is derived from `type`
|
|
6
|
+
* via the backend's primitive-byte-size mapping and is used to stride vertex
|
|
7
|
+
* buffer layouts.
|
|
8
|
+
*/
|
|
1
9
|
export declare class ShaderAttribute {
|
|
10
|
+
/** Zero-based index of this attribute within the shader program. */
|
|
2
11
|
readonly index: number;
|
|
12
|
+
/** GLSL attribute name as declared in the vertex shader source. */
|
|
3
13
|
readonly name: string;
|
|
14
|
+
/** WebGL2 GLenum type token (e.g. `gl.FLOAT_VEC2`). */
|
|
4
15
|
readonly type: number;
|
|
16
|
+
/** Byte size of one element of this attribute's type. */
|
|
5
17
|
readonly size: number;
|
|
18
|
+
/** WebGL attribute location assigned by the driver. `-1` until the backend sets it. */
|
|
6
19
|
location: number;
|
|
7
20
|
constructor(index: number, name: string, type: number);
|
|
8
21
|
destroy(): void;
|
|
@@ -1,10 +1,23 @@
|
|
|
1
1
|
import { webGl2PrimitiveByteSizeMapping } from '../webgl2/WebGl2ShaderMappings.js';
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* Metadata for a single vertex attribute declared in a GLSL vertex shader.
|
|
5
|
+
*
|
|
6
|
+
* Populated by the backend during {@link Shader.connect} using the values
|
|
7
|
+
* returned by `gl.getActiveAttrib`. The `size` field is derived from `type`
|
|
8
|
+
* via the backend's primitive-byte-size mapping and is used to stride vertex
|
|
9
|
+
* buffer layouts.
|
|
10
|
+
*/
|
|
3
11
|
class ShaderAttribute {
|
|
12
|
+
/** Zero-based index of this attribute within the shader program. */
|
|
4
13
|
index;
|
|
14
|
+
/** GLSL attribute name as declared in the vertex shader source. */
|
|
5
15
|
name;
|
|
16
|
+
/** WebGL2 GLenum type token (e.g. `gl.FLOAT_VEC2`). */
|
|
6
17
|
type;
|
|
18
|
+
/** Byte size of one element of this attribute's type. */
|
|
7
19
|
size;
|
|
20
|
+
/** WebGL attribute location assigned by the driver. `-1` until the backend sets it. */
|
|
8
21
|
location = -1;
|
|
9
22
|
constructor(index, name, type) {
|
|
10
23
|
this.index = index;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ShaderAttribute.js","sources":["../../../../../src/rendering/shader/ShaderAttribute.ts"],"sourcesContent":[null],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"ShaderAttribute.js","sources":["../../../../../src/rendering/shader/ShaderAttribute.ts"],"sourcesContent":[null],"names":[],"mappings":";;AAEA;;;;;;;AAOG;MACU,eAAe,CAAA;;AAGR,IAAA,KAAK;;AAEL,IAAA,IAAI;;AAEJ,IAAA,IAAI;;AAEJ,IAAA,IAAI;;IAEb,QAAQ,GAAG,EAAE;AAEpB,IAAA,WAAA,CAAmB,KAAa,EAAE,IAAY,EAAE,IAAY,EAAA;AACxD,QAAA,IAAI,CAAC,KAAK,GAAG,KAAK;AAClB,QAAA,IAAI,CAAC,IAAI,GAAG,IAAI;AAChB,QAAA,IAAI,CAAC,IAAI,GAAG,IAAI;AAChB,QAAA,IAAI,CAAC,IAAI,GAAG,8BAA8B,CAAC,IAAI,CAAC;IACpD;IAEO,OAAO,GAAA;;IAEd;AACH;;;;"}
|
|
@@ -1,16 +1,43 @@
|
|
|
1
1
|
import type { TypedArray } from '@/core/types';
|
|
2
|
+
/**
|
|
3
|
+
* Metadata and current value for a single GLSL uniform variable.
|
|
4
|
+
*
|
|
5
|
+
* Populated by the backend during {@link Shader.connect}. The `dirty` flag is
|
|
6
|
+
* set to `true` on construction and on every {@link setValue} call; the backend
|
|
7
|
+
* clears it via {@link markClean} after uploading the value to the GPU.
|
|
8
|
+
* Array-type uniform names have their index suffix stripped (e.g. `uColors[0]`
|
|
9
|
+
* becomes `uColors`).
|
|
10
|
+
*/
|
|
2
11
|
export declare class ShaderUniform {
|
|
12
|
+
/** Zero-based index of this uniform within the shader program. */
|
|
3
13
|
readonly index: number;
|
|
14
|
+
/** WebGL2 GLenum type token (e.g. `gl.FLOAT_MAT4`). */
|
|
4
15
|
readonly type: number;
|
|
16
|
+
/** Number of elements for array uniforms; `1` for scalar uniforms. */
|
|
5
17
|
readonly size: number;
|
|
18
|
+
/** GLSL uniform name with array suffixes stripped. */
|
|
6
19
|
readonly name: string;
|
|
7
20
|
private readonly _value;
|
|
8
21
|
private _dirty;
|
|
9
22
|
constructor(index: number, type: number, size: number, name: string, data: TypedArray);
|
|
23
|
+
/**
|
|
24
|
+
* The leaf segment of a dot-separated uniform name.
|
|
25
|
+
* For top-level uniforms this equals `name`; for struct members (e.g. `uLight.color`)
|
|
26
|
+
* it returns only the field name (`color`).
|
|
27
|
+
*/
|
|
10
28
|
get propName(): string;
|
|
11
29
|
get value(): TypedArray;
|
|
30
|
+
/** Whether the value has changed since the last {@link markClean} call. */
|
|
12
31
|
get dirty(): boolean;
|
|
32
|
+
/**
|
|
33
|
+
* Copy `value` into the internal typed-array buffer and mark the uniform dirty.
|
|
34
|
+
* The backend will upload the new value to the GPU on the next {@link Shader.sync} call.
|
|
35
|
+
*/
|
|
13
36
|
setValue(value: TypedArray): this;
|
|
37
|
+
/**
|
|
38
|
+
* Clear the dirty flag after the backend has successfully uploaded the uniform value.
|
|
39
|
+
* @internal
|
|
40
|
+
*/
|
|
14
41
|
markClean(): void;
|
|
15
42
|
destroy(): void;
|
|
16
43
|
}
|
|
@@ -1,7 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Metadata and current value for a single GLSL uniform variable.
|
|
3
|
+
*
|
|
4
|
+
* Populated by the backend during {@link Shader.connect}. The `dirty` flag is
|
|
5
|
+
* set to `true` on construction and on every {@link setValue} call; the backend
|
|
6
|
+
* clears it via {@link markClean} after uploading the value to the GPU.
|
|
7
|
+
* Array-type uniform names have their index suffix stripped (e.g. `uColors[0]`
|
|
8
|
+
* becomes `uColors`).
|
|
9
|
+
*/
|
|
1
10
|
class ShaderUniform {
|
|
11
|
+
/** Zero-based index of this uniform within the shader program. */
|
|
2
12
|
index;
|
|
13
|
+
/** WebGL2 GLenum type token (e.g. `gl.FLOAT_MAT4`). */
|
|
3
14
|
type;
|
|
15
|
+
/** Number of elements for array uniforms; `1` for scalar uniforms. */
|
|
4
16
|
size;
|
|
17
|
+
/** GLSL uniform name with array suffixes stripped. */
|
|
5
18
|
name;
|
|
6
19
|
_value;
|
|
7
20
|
_dirty = true;
|
|
@@ -12,20 +25,34 @@ class ShaderUniform {
|
|
|
12
25
|
this.size = size;
|
|
13
26
|
this._value = data;
|
|
14
27
|
}
|
|
28
|
+
/**
|
|
29
|
+
* The leaf segment of a dot-separated uniform name.
|
|
30
|
+
* For top-level uniforms this equals `name`; for struct members (e.g. `uLight.color`)
|
|
31
|
+
* it returns only the field name (`color`).
|
|
32
|
+
*/
|
|
15
33
|
get propName() {
|
|
16
|
-
return this.name.
|
|
34
|
+
return this.name.substring(this.name.lastIndexOf('.') + 1);
|
|
17
35
|
}
|
|
18
36
|
get value() {
|
|
19
37
|
return this._value;
|
|
20
38
|
}
|
|
39
|
+
/** Whether the value has changed since the last {@link markClean} call. */
|
|
21
40
|
get dirty() {
|
|
22
41
|
return this._dirty;
|
|
23
42
|
}
|
|
43
|
+
/**
|
|
44
|
+
* Copy `value` into the internal typed-array buffer and mark the uniform dirty.
|
|
45
|
+
* The backend will upload the new value to the GPU on the next {@link Shader.sync} call.
|
|
46
|
+
*/
|
|
24
47
|
setValue(value) {
|
|
25
48
|
this._value.set(value);
|
|
26
49
|
this._dirty = true;
|
|
27
50
|
return this;
|
|
28
51
|
}
|
|
52
|
+
/**
|
|
53
|
+
* Clear the dirty flag after the backend has successfully uploaded the uniform value.
|
|
54
|
+
* @internal
|
|
55
|
+
*/
|
|
29
56
|
markClean() {
|
|
30
57
|
this._dirty = false;
|
|
31
58
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ShaderUniform.js","sources":["../../../../../src/rendering/shader/ShaderUniform.ts"],"sourcesContent":[null],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ShaderUniform.js","sources":["../../../../../src/rendering/shader/ShaderUniform.ts"],"sourcesContent":[null],"names":[],"mappings":"AAEA;;;;;;;;AAQG;MACU,aAAa,CAAA;;AAGN,IAAA,KAAK;;AAEL,IAAA,IAAI;;AAEJ,IAAA,IAAI;;AAEJ,IAAA,IAAI;AAEH,IAAA,MAAM;IACf,MAAM,GAAG,IAAI;IAErB,WAAA,CAAmB,KAAa,EAAE,IAAY,EAAE,IAAY,EAAE,IAAY,EAAE,IAAgB,EAAA;QACxF,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAC;AACtC,QAAA,IAAI,CAAC,KAAK,GAAG,KAAK;AAClB,QAAA,IAAI,CAAC,IAAI,GAAG,IAAI;AAChB,QAAA,IAAI,CAAC,IAAI,GAAG,IAAI;AAChB,QAAA,IAAI,CAAC,MAAM,GAAG,IAAI;IACtB;AAEA;;;;AAIG;AACH,IAAA,IAAW,QAAQ,GAAA;AACf,QAAA,OAAO,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IAC9D;AAEA,IAAA,IAAW,KAAK,GAAA;QACZ,OAAO,IAAI,CAAC,MAAM;IACtB;;AAGA,IAAA,IAAW,KAAK,GAAA;QACZ,OAAO,IAAI,CAAC,MAAM;IACtB;AAEA;;;AAGG;AACI,IAAA,QAAQ,CAAC,KAAiB,EAAA;AAC7B,QAAA,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC;AACtB,QAAA,IAAI,CAAC,MAAM,GAAG,IAAI;AAElB,QAAA,OAAO,IAAI;IACf;AAEA;;;AAGG;IACI,SAAS,GAAA;AACZ,QAAA,IAAI,CAAC,MAAM,GAAG,KAAK;IACvB;IAEO,OAAO,GAAA;;IAEd;AACH;;;;"}
|
|
@@ -5,15 +5,30 @@ import { Sprite } from './Sprite';
|
|
|
5
5
|
import type { Spritesheet } from './Spritesheet';
|
|
6
6
|
import type { Texture } from '@/rendering/texture/Texture';
|
|
7
7
|
import type { RenderTexture } from '@/rendering/texture/RenderTexture';
|
|
8
|
+
/** Definition for a single animation clip registered on an {@link AnimatedSprite}. */
|
|
8
9
|
export interface AnimatedSpriteClipDefinition {
|
|
9
10
|
readonly frames: ReadonlyArray<Rectangle>;
|
|
10
11
|
readonly fps?: number;
|
|
11
12
|
readonly loop?: boolean;
|
|
12
13
|
}
|
|
14
|
+
/** Per-call options passed to {@link AnimatedSprite.play}. */
|
|
13
15
|
export interface AnimatedSpritePlayOptions {
|
|
14
16
|
loop?: boolean;
|
|
15
17
|
restart?: boolean;
|
|
16
18
|
}
|
|
19
|
+
/**
|
|
20
|
+
* A {@link Sprite} that advances through a sequence of texture-frame
|
|
21
|
+
* {@link Rectangle}s over time to produce frame-based animation.
|
|
22
|
+
*
|
|
23
|
+
* Multiple named clips can be registered via {@link defineClip} or the
|
|
24
|
+
* constructor. Call {@link play} to start a clip; call {@link update} each
|
|
25
|
+
* frame with the elapsed delta (seconds or a `Time` object) to advance
|
|
26
|
+
* playback. The `onFrame` signal fires on every frame advance and
|
|
27
|
+
* `onComplete` fires when a non-looping clip reaches its last frame.
|
|
28
|
+
*
|
|
29
|
+
* Use {@link AnimatedSprite.fromSpritesheet} to create an instance directly
|
|
30
|
+
* from a {@link Spritesheet}'s named animations.
|
|
31
|
+
*/
|
|
17
32
|
export declare class AnimatedSprite extends Sprite {
|
|
18
33
|
private readonly _clips;
|
|
19
34
|
private _currentClipName;
|
|
@@ -27,17 +42,40 @@ export declare class AnimatedSprite extends Sprite {
|
|
|
27
42
|
get currentClip(): string | null;
|
|
28
43
|
get currentFrame(): number;
|
|
29
44
|
get playing(): boolean;
|
|
45
|
+
/**
|
|
46
|
+
* Whether the current clip loops. Returns the per-call loop override if set,
|
|
47
|
+
* otherwise the clip's own `loop` flag.
|
|
48
|
+
*/
|
|
30
49
|
get loop(): boolean;
|
|
31
50
|
set loop(loop: boolean);
|
|
51
|
+
/** Replace all registered clips with the provided map. Clears any previously registered clips first. */
|
|
32
52
|
setClips(clips: Readonly<Record<string, AnimatedSpriteClipDefinition>>): this;
|
|
53
|
+
/** Register a named clip. Frame rectangles are cloned so the caller may mutate the originals. */
|
|
33
54
|
defineClip(name: string, clip: AnimatedSpriteClipDefinition): this;
|
|
55
|
+
/** Remove a registered clip by name. Stops playback first if the clip is currently active. */
|
|
34
56
|
removeClip(name: string): this;
|
|
57
|
+
/**
|
|
58
|
+
* Start playing the named clip. By default restarts from frame 0; pass
|
|
59
|
+
* `{ restart: false }` to resume from the current frame if the same clip
|
|
60
|
+
* is already active. Optionally overrides the clip's loop setting.
|
|
61
|
+
*/
|
|
35
62
|
play(name: string, options?: AnimatedSpritePlayOptions): this;
|
|
63
|
+
/** Stop playback and rewind the active clip to frame 0. */
|
|
36
64
|
stop(): this;
|
|
37
65
|
pause(): this;
|
|
38
66
|
resume(): this;
|
|
67
|
+
/**
|
|
68
|
+
* Advance playback by `delta` milliseconds (or a `Time` object). Call once
|
|
69
|
+
* per frame from the game loop. Dispatches `onFrame` for each frame
|
|
70
|
+
* boundary crossed and `onComplete` when a non-looping clip ends.
|
|
71
|
+
*/
|
|
39
72
|
update(delta: Time | number): this;
|
|
40
73
|
destroy(): void;
|
|
74
|
+
/**
|
|
75
|
+
* Construct an {@link AnimatedSprite} from the named animations defined on
|
|
76
|
+
* a {@link Spritesheet}. Each animation becomes a looping clip whose frames
|
|
77
|
+
* are the spritesheet frame rectangles in declaration order.
|
|
78
|
+
*/
|
|
41
79
|
static fromSpritesheet(spritesheet: Spritesheet): AnimatedSprite;
|
|
42
80
|
private _applyFrame;
|
|
43
81
|
}
|
|
@@ -2,6 +2,19 @@ import { Signal } from '../../core/Signal.js';
|
|
|
2
2
|
import { Sprite } from './Sprite.js';
|
|
3
3
|
|
|
4
4
|
const defaultClipFps = 12;
|
|
5
|
+
/**
|
|
6
|
+
* A {@link Sprite} that advances through a sequence of texture-frame
|
|
7
|
+
* {@link Rectangle}s over time to produce frame-based animation.
|
|
8
|
+
*
|
|
9
|
+
* Multiple named clips can be registered via {@link defineClip} or the
|
|
10
|
+
* constructor. Call {@link play} to start a clip; call {@link update} each
|
|
11
|
+
* frame with the elapsed delta (seconds or a `Time` object) to advance
|
|
12
|
+
* playback. The `onFrame` signal fires on every frame advance and
|
|
13
|
+
* `onComplete` fires when a non-looping clip reaches its last frame.
|
|
14
|
+
*
|
|
15
|
+
* Use {@link AnimatedSprite.fromSpritesheet} to create an instance directly
|
|
16
|
+
* from a {@link Spritesheet}'s named animations.
|
|
17
|
+
*/
|
|
5
18
|
class AnimatedSprite extends Sprite {
|
|
6
19
|
_clips = new Map();
|
|
7
20
|
_currentClipName = null;
|
|
@@ -26,6 +39,10 @@ class AnimatedSprite extends Sprite {
|
|
|
26
39
|
get playing() {
|
|
27
40
|
return this._playing;
|
|
28
41
|
}
|
|
42
|
+
/**
|
|
43
|
+
* Whether the current clip loops. Returns the per-call loop override if set,
|
|
44
|
+
* otherwise the clip's own `loop` flag.
|
|
45
|
+
*/
|
|
29
46
|
get loop() {
|
|
30
47
|
if (this._loopOverride !== null) {
|
|
31
48
|
return this._loopOverride;
|
|
@@ -38,6 +55,7 @@ class AnimatedSprite extends Sprite {
|
|
|
38
55
|
set loop(loop) {
|
|
39
56
|
this._loopOverride = loop;
|
|
40
57
|
}
|
|
58
|
+
/** Replace all registered clips with the provided map. Clears any previously registered clips first. */
|
|
41
59
|
setClips(clips) {
|
|
42
60
|
this._clips.clear();
|
|
43
61
|
for (const [name, clip] of Object.entries(clips)) {
|
|
@@ -45,6 +63,7 @@ class AnimatedSprite extends Sprite {
|
|
|
45
63
|
}
|
|
46
64
|
return this;
|
|
47
65
|
}
|
|
66
|
+
/** Register a named clip. Frame rectangles are cloned so the caller may mutate the originals. */
|
|
48
67
|
defineClip(name, clip) {
|
|
49
68
|
if (name.trim().length === 0) {
|
|
50
69
|
throw new Error('AnimatedSprite clip names must be non-empty strings.');
|
|
@@ -63,6 +82,7 @@ class AnimatedSprite extends Sprite {
|
|
|
63
82
|
});
|
|
64
83
|
return this;
|
|
65
84
|
}
|
|
85
|
+
/** Remove a registered clip by name. Stops playback first if the clip is currently active. */
|
|
66
86
|
removeClip(name) {
|
|
67
87
|
if (this._currentClipName === name) {
|
|
68
88
|
this.stop();
|
|
@@ -70,6 +90,11 @@ class AnimatedSprite extends Sprite {
|
|
|
70
90
|
this._clips.delete(name);
|
|
71
91
|
return this;
|
|
72
92
|
}
|
|
93
|
+
/**
|
|
94
|
+
* Start playing the named clip. By default restarts from frame 0; pass
|
|
95
|
+
* `{ restart: false }` to resume from the current frame if the same clip
|
|
96
|
+
* is already active. Optionally overrides the clip's loop setting.
|
|
97
|
+
*/
|
|
73
98
|
play(name, options = {}) {
|
|
74
99
|
const clip = this._clips.get(name);
|
|
75
100
|
if (!clip) {
|
|
@@ -88,6 +113,7 @@ class AnimatedSprite extends Sprite {
|
|
|
88
113
|
this._playing = true;
|
|
89
114
|
return this;
|
|
90
115
|
}
|
|
116
|
+
/** Stop playback and rewind the active clip to frame 0. */
|
|
91
117
|
stop() {
|
|
92
118
|
this._playing = false;
|
|
93
119
|
this._elapsedFrameTimeMs = 0;
|
|
@@ -112,6 +138,11 @@ class AnimatedSprite extends Sprite {
|
|
|
112
138
|
}
|
|
113
139
|
return this;
|
|
114
140
|
}
|
|
141
|
+
/**
|
|
142
|
+
* Advance playback by `delta` milliseconds (or a `Time` object). Call once
|
|
143
|
+
* per frame from the game loop. Dispatches `onFrame` for each frame
|
|
144
|
+
* boundary crossed and `onComplete` when a non-looping clip ends.
|
|
145
|
+
*/
|
|
115
146
|
update(delta) {
|
|
116
147
|
if (!this._playing || this._currentClipName === null) {
|
|
117
148
|
return this;
|
|
@@ -158,6 +189,11 @@ class AnimatedSprite extends Sprite {
|
|
|
158
189
|
}
|
|
159
190
|
this._clips.clear();
|
|
160
191
|
}
|
|
192
|
+
/**
|
|
193
|
+
* Construct an {@link AnimatedSprite} from the named animations defined on
|
|
194
|
+
* a {@link Spritesheet}. Each animation becomes a looping clip whose frames
|
|
195
|
+
* are the spritesheet frame rectangles in declaration order.
|
|
196
|
+
*/
|
|
161
197
|
static fromSpritesheet(spritesheet) {
|
|
162
198
|
const clips = {};
|
|
163
199
|
for (const [clipName, frameNames] of spritesheet.animations) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AnimatedSprite.js","sources":["../../../../../src/rendering/sprite/AnimatedSprite.ts"],"sourcesContent":[null],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"AnimatedSprite.js","sources":["../../../../../src/rendering/sprite/AnimatedSprite.ts"],"sourcesContent":[null],"names":[],"mappings":";;;AA2BA,MAAM,cAAc,GAAG,EAAE;AAEzB;;;;;;;;;;;;AAYG;AACG,MAAO,cAAe,SAAQ,MAAM,CAAA;AAErB,IAAA,MAAM,GAAG,IAAI,GAAG,EAAwC;IACjE,gBAAgB,GAAkB,IAAI;IACtC,kBAAkB,GAAG,CAAC;IACtB,QAAQ,GAAG,K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AAK,GAAiD,EAAE;QAE9D,KAAK,MAAM,CAAC,QAAQ,EAAE,UAAU,CAAC,IAAI,WAAW,CAAC,UAAU,EAAE;YACzD,KAAK,CAAC,QAAQ,CAAC,GAAG;AACd,gBAAA,MAAM,EAAE,UAAU,CAAC,GAAG,CAAC,SAAS,IAAI,WAAW,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;AACpE,gBAAA,IAAI,EAAE,IAAI;aACb;QACL;QAEA,OAAO,IAAI,cAAc,CAAC,WAAW,CAAC,OAAO,EAAE,KAAK,CAAC;IACzD;AAEQ,IAAA,WAAW,CAAC,KAAgB,EAAA;AAChC,QAAA,IAAI,CAAC,eAAe,CAAC,KAAK,EAAE,KAAK,CAAC;IACtC;AACH;;;;"}
|
|
@@ -4,6 +4,11 @@ import { Vector } from '@/math/Vector';
|
|
|
4
4
|
import { Interval } from '@/math/Interval';
|
|
5
5
|
import type { Texture } from '@/rendering/texture/Texture';
|
|
6
6
|
import type { RenderTexture } from '@/rendering/texture/RenderTexture';
|
|
7
|
+
/**
|
|
8
|
+
* Internal dirty-flag bitmask used by {@link Sprite} to lazily recompute
|
|
9
|
+
* derived data (vertices, normals, texture coordinates, bounding boxes).
|
|
10
|
+
* @internal
|
|
11
|
+
*/
|
|
7
12
|
export declare enum SpriteFlags {
|
|
8
13
|
None = 0,
|
|
9
14
|
Translation = 1,
|
|
@@ -18,6 +23,21 @@ export declare enum SpriteFlags {
|
|
|
18
23
|
Vertices = 1024,
|
|
19
24
|
Normals = 2048
|
|
20
25
|
}
|
|
26
|
+
/**
|
|
27
|
+
* The primary 2D drawable for textured quads and the foundation of the
|
|
28
|
+
* rendering hierarchy.
|
|
29
|
+
*
|
|
30
|
+
* A Sprite wraps a {@link Texture} (or {@link RenderTexture}) and exposes
|
|
31
|
+
* full transform control (position, rotation, scale, origin) inherited from
|
|
32
|
+
* {@link Drawable}. The rendered quad is derived from `textureFrame`, which
|
|
33
|
+
* defaults to the full texture dimensions but can be narrowed to a sub-region
|
|
34
|
+
* (e.g. a frame from a {@link Spritesheet}).
|
|
35
|
+
*
|
|
36
|
+
* Vertex and normal data are computed lazily and cached until the transform
|
|
37
|
+
* or frame changes, making repeated read access free after the first evaluation.
|
|
38
|
+
* Collision helpers — `contains`, `getNormals`, `project` — are overridden to
|
|
39
|
+
* operate on the exact rotated quad rather than the AABB.
|
|
40
|
+
*/
|
|
21
41
|
export declare class Sprite extends Drawable {
|
|
22
42
|
private _texture;
|
|
23
43
|
private _textureFrame;
|
|
@@ -33,16 +53,52 @@ export declare class Sprite extends Drawable {
|
|
|
33
53
|
set width(value: number);
|
|
34
54
|
get height(): number;
|
|
35
55
|
set height(value: number);
|
|
56
|
+
/**
|
|
57
|
+
* World-space corner positions of the sprite quad, computed lazily from the
|
|
58
|
+
* current transform and texture frame. Layout: [x0,y0, x1,y1, x2,y2, x3,y3]
|
|
59
|
+
* (TL, TR, BR, BL). Cached until the transform is invalidated.
|
|
60
|
+
*/
|
|
36
61
|
get vertices(): Float32Array;
|
|
62
|
+
/**
|
|
63
|
+
* Packed UV coordinates for the four quad corners, encoded as two
|
|
64
|
+
* 16-bit fixed-point values per element (low 16 bits = U, high 16 bits = V,
|
|
65
|
+
* each in the range 0–65535). Accounts for `Texture.flipY`. Throws if no
|
|
66
|
+
* texture is assigned.
|
|
67
|
+
*/
|
|
37
68
|
get texCoords(): Uint32Array;
|
|
69
|
+
/** Assign a new texture, refreshing the texture frame to the full texture dimensions. */
|
|
38
70
|
setTexture(texture: Texture | RenderTexture | null): this;
|
|
71
|
+
/** Signal the GPU backend that the underlying texture source has changed and reset the frame to full dimensions. */
|
|
39
72
|
updateTexture(): this;
|
|
73
|
+
/**
|
|
74
|
+
* Set a sub-region of the texture to render.
|
|
75
|
+
* When `resetSize` is `true` (default) the sprite's logical size snaps to
|
|
76
|
+
* the new frame dimensions; pass `false` to keep the current pixel size
|
|
77
|
+
* (useful for animation playback where the frame changes but the display
|
|
78
|
+
* size should stay constant).
|
|
79
|
+
*/
|
|
40
80
|
setTextureFrame(frame: Rectangle, resetSize?: boolean): this;
|
|
81
|
+
/** Reset the texture frame to the full dimensions of the current texture. Throws if no texture is set. */
|
|
41
82
|
resetTextureFrame(): this;
|
|
83
|
+
/**
|
|
84
|
+
* Return the four outward-facing edge normals of the rotated quad, lazily
|
|
85
|
+
* computed from `vertices`. Used by the SAT collision system.
|
|
86
|
+
*/
|
|
42
87
|
getNormals(): Array<Vector>;
|
|
88
|
+
/**
|
|
89
|
+
* Project all four quad vertices onto `axis` and return the resulting
|
|
90
|
+
* scalar interval. Used by the SAT collision system.
|
|
91
|
+
*/
|
|
43
92
|
project(axis: Vector, result?: Interval): Interval;
|
|
93
|
+
/**
|
|
94
|
+
* Return `true` if the world-space point (`x`, `y`) lies inside the quad.
|
|
95
|
+
* Uses a fast AABB check when the rotation is a multiple of 90°, and the
|
|
96
|
+
* exact dot-product test for arbitrary angles.
|
|
97
|
+
*/
|
|
44
98
|
contains(x: number, y: number): boolean;
|
|
99
|
+
/** @internal */
|
|
45
100
|
_invalidateSubtreeTransform(): void;
|
|
101
|
+
/** @internal */
|
|
46
102
|
_invalidateBoundsCascade(): void;
|
|
47
103
|
destroy(): void;
|
|
48
104
|
}
|
|
@@ -4,6 +4,11 @@ import { Vector } from '../../math/Vector.js';
|
|
|
4
4
|
import { Interval } from '../../math/Interval.js';
|
|
5
5
|
import { RenderNode } from '../RenderNode.js';
|
|
6
6
|
|
|
7
|
+
/**
|
|
8
|
+
* Internal dirty-flag bitmask used by {@link Sprite} to lazily recompute
|
|
9
|
+
* derived data (vertices, normals, texture coordinates, bounding boxes).
|
|
10
|
+
* @internal
|
|
11
|
+
*/
|
|
7
12
|
var SpriteFlags;
|
|
8
13
|
(function (SpriteFlags) {
|
|
9
14
|
SpriteFlags[SpriteFlags["None"] = 0] = "None";
|
|
@@ -19,6 +24,21 @@ var SpriteFlags;
|
|
|
19
24
|
SpriteFlags[SpriteFlags["Vertices"] = 1024] = "Vertices";
|
|
20
25
|
SpriteFlags[SpriteFlags["Normals"] = 2048] = "Normals";
|
|
21
26
|
})(SpriteFlags || (SpriteFlags = {}));
|
|
27
|
+
/**
|
|
28
|
+
* The primary 2D drawable for textured quads and the foundation of the
|
|
29
|
+
* rendering hierarchy.
|
|
30
|
+
*
|
|
31
|
+
* A Sprite wraps a {@link Texture} (or {@link RenderTexture}) and exposes
|
|
32
|
+
* full transform control (position, rotation, scale, origin) inherited from
|
|
33
|
+
* {@link Drawable}. The rendered quad is derived from `textureFrame`, which
|
|
34
|
+
* defaults to the full texture dimensions but can be narrowed to a sub-region
|
|
35
|
+
* (e.g. a frame from a {@link Spritesheet}).
|
|
36
|
+
*
|
|
37
|
+
* Vertex and normal data are computed lazily and cached until the transform
|
|
38
|
+
* or frame changes, making repeated read access free after the first evaluation.
|
|
39
|
+
* Collision helpers — `contains`, `getNormals`, `project` — are overridden to
|
|
40
|
+
* operate on the exact rotated quad rather than the AABB.
|
|
41
|
+
*/
|
|
22
42
|
class Sprite extends Drawable {
|
|
23
43
|
_texture = null;
|
|
24
44
|
_textureFrame = new Rectangle();
|
|
@@ -59,6 +79,11 @@ class Sprite extends Drawable {
|
|
|
59
79
|
set height(value) {
|
|
60
80
|
this.scale.y = (value / this._textureFrame.height);
|
|
61
81
|
}
|
|
82
|
+
/**
|
|
83
|
+
* World-space corner positions of the sprite quad, computed lazily from the
|
|
84
|
+
* current transform and texture frame. Layout: [x0,y0, x1,y1, x2,y2, x3,y3]
|
|
85
|
+
* (TL, TR, BR, BL). Cached until the transform is invalidated.
|
|
86
|
+
*/
|
|
62
87
|
get vertices() {
|
|
63
88
|
if (this.flags.has(SpriteFlags.Vertices)) {
|
|
64
89
|
const { left, top, right, bottom } = this.getLocalBounds();
|
|
@@ -75,6 +100,12 @@ class Sprite extends Drawable {
|
|
|
75
100
|
}
|
|
76
101
|
return this._vertices;
|
|
77
102
|
}
|
|
103
|
+
/**
|
|
104
|
+
* Packed UV coordinates for the four quad corners, encoded as two
|
|
105
|
+
* 16-bit fixed-point values per element (low 16 bits = U, high 16 bits = V,
|
|
106
|
+
* each in the range 0–65535). Accounts for `Texture.flipY`. Throws if no
|
|
107
|
+
* texture is assigned.
|
|
108
|
+
*/
|
|
78
109
|
get texCoords() {
|
|
79
110
|
if (this._texture === null) {
|
|
80
111
|
throw new Error('texCoords can only be calculated when the sprite has a texture');
|
|
@@ -101,6 +132,7 @@ class Sprite extends Drawable {
|
|
|
101
132
|
}
|
|
102
133
|
return this._texCoords;
|
|
103
134
|
}
|
|
135
|
+
/** Assign a new texture, refreshing the texture frame to the full texture dimensions. */
|
|
104
136
|
setTexture(texture) {
|
|
105
137
|
if (this._texture !== texture) {
|
|
106
138
|
this._texture = texture;
|
|
@@ -109,6 +141,7 @@ class Sprite extends Drawable {
|
|
|
109
141
|
}
|
|
110
142
|
return this;
|
|
111
143
|
}
|
|
144
|
+
/** Signal the GPU backend that the underlying texture source has changed and reset the frame to full dimensions. */
|
|
112
145
|
updateTexture() {
|
|
113
146
|
if (this._texture) {
|
|
114
147
|
this._texture.updateSource();
|
|
@@ -117,6 +150,13 @@ class Sprite extends Drawable {
|
|
|
117
150
|
}
|
|
118
151
|
return this;
|
|
119
152
|
}
|
|
153
|
+
/**
|
|
154
|
+
* Set a sub-region of the texture to render.
|
|
155
|
+
* When `resetSize` is `true` (default) the sprite's logical size snaps to
|
|
156
|
+
* the new frame dimensions; pass `false` to keep the current pixel size
|
|
157
|
+
* (useful for animation playback where the frame changes but the display
|
|
158
|
+
* size should stay constant).
|
|
159
|
+
*/
|
|
120
160
|
setTextureFrame(frame, resetSize = true) {
|
|
121
161
|
const width = this.width;
|
|
122
162
|
const height = this.height;
|
|
@@ -135,12 +175,17 @@ class Sprite extends Drawable {
|
|
|
135
175
|
this.invalidateCache();
|
|
136
176
|
return this;
|
|
137
177
|
}
|
|
178
|
+
/** Reset the texture frame to the full dimensions of the current texture. Throws if no texture is set. */
|
|
138
179
|
resetTextureFrame() {
|
|
139
180
|
if (!this._texture) {
|
|
140
181
|
throw new Error('Cannot reset texture frame when no texture was set');
|
|
141
182
|
}
|
|
142
183
|
return this.setTextureFrame(Rectangle.temp.set(0, 0, this._texture.width, this._texture.height));
|
|
143
184
|
}
|
|
185
|
+
/**
|
|
186
|
+
* Return the four outward-facing edge normals of the rotated quad, lazily
|
|
187
|
+
* computed from `vertices`. Used by the SAT collision system.
|
|
188
|
+
*/
|
|
144
189
|
getNormals() {
|
|
145
190
|
if (this.flags.has(SpriteFlags.Normals)) {
|
|
146
191
|
const [x1, y1, x2, y2, x3, y3, x4, y4] = this.vertices;
|
|
@@ -152,6 +197,10 @@ class Sprite extends Drawable {
|
|
|
152
197
|
}
|
|
153
198
|
return this._normals;
|
|
154
199
|
}
|
|
200
|
+
/**
|
|
201
|
+
* Project all four quad vertices onto `axis` and return the resulting
|
|
202
|
+
* scalar interval. Used by the SAT collision system.
|
|
203
|
+
*/
|
|
155
204
|
project(axis, result = new Interval()) {
|
|
156
205
|
const [x1, y1, x2, y2, x3, y3, x4, y4] = this.vertices;
|
|
157
206
|
const proj1 = axis.dot(x1, y1);
|
|
@@ -160,6 +209,11 @@ class Sprite extends Drawable {
|
|
|
160
209
|
const proj4 = axis.dot(x4, y4);
|
|
161
210
|
return result.set(Math.min(proj1, proj2, proj3, proj4), Math.max(proj1, proj2, proj3, proj4));
|
|
162
211
|
}
|
|
212
|
+
/**
|
|
213
|
+
* Return `true` if the world-space point (`x`, `y`) lies inside the quad.
|
|
214
|
+
* Uses a fast AABB check when the rotation is a multiple of 90°, and the
|
|
215
|
+
* exact dot-product test for arbitrary angles.
|
|
216
|
+
*/
|
|
163
217
|
contains(x, y) {
|
|
164
218
|
if ((this.rotation % 90 === 0)) {
|
|
165
219
|
return this.getBounds().contains(x, y);
|
|
@@ -168,10 +222,12 @@ class Sprite extends Drawable {
|
|
|
168
222
|
return (dotA > 0) && (dotA <= lenA)
|
|
169
223
|
&& (dotB > 0) && (dotB <= lenB);
|
|
170
224
|
}
|
|
225
|
+
/** @internal */
|
|
171
226
|
_invalidateSubtreeTransform() {
|
|
172
227
|
super._invalidateSubtreeTransform();
|
|
173
228
|
this.flags.push(SpriteFlags.Vertices | SpriteFlags.Normals);
|
|
174
229
|
}
|
|
230
|
+
/** @internal */
|
|
175
231
|
_invalidateBoundsCascade() {
|
|
176
232
|
super._invalidateBoundsCascade();
|
|
177
233
|
this.flags.push(SpriteFlags.Vertices | SpriteFlags.Normals);
|