ris-framework 0.1.0-dev.7 → 0.1.0-dev.9
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 +4 -1
- package/LICENSE +202 -21
- package/NOTICE +2 -0
- package/README.md +29 -47
- package/THIRD_PARTY_NOTICES.md +1 -1
- package/dist/{core/Framework.d.ts → Framework.d.ts} +10 -8
- package/dist/Framework.d.ts.map +1 -0
- package/dist/api/FrameworkConfiguration.d.ts +23 -0
- package/dist/api/FrameworkConfiguration.d.ts.map +1 -0
- package/dist/api/IFramework.d.ts +125 -0
- package/dist/api/IFramework.d.ts.map +1 -0
- package/dist/api/IFrameworkConfiguration.d.ts +25 -0
- package/dist/api/IFrameworkConfiguration.d.ts.map +1 -0
- package/dist/api/_export.d.ts +27 -0
- package/dist/api/_export.d.ts.map +1 -0
- package/dist/api/camera/CameraFactory.d.ts +25 -0
- package/dist/api/camera/CameraFactory.d.ts.map +1 -0
- package/dist/api/camera/ICamera.d.ts +43 -0
- package/dist/api/camera/ICamera.d.ts.map +1 -0
- package/dist/api/camera/ICameraFactory.d.ts +46 -0
- package/dist/api/camera/ICameraFactory.d.ts.map +1 -0
- package/dist/api/camera/IOrthographicCamera.d.ts +31 -0
- package/dist/api/camera/IOrthographicCamera.d.ts.map +1 -0
- package/dist/api/camera/OrbitCamera.d.ts +120 -0
- package/dist/api/camera/OrbitCamera.d.ts.map +1 -0
- package/dist/api/camera/OrthographicCamera.d.ts +96 -0
- package/dist/api/camera/OrthographicCamera.d.ts.map +1 -0
- package/dist/api/camera/PerspectiveCamera.d.ts +108 -0
- package/dist/api/camera/PerspectiveCamera.d.ts.map +1 -0
- package/dist/api/camera/_export.d.ts +8 -0
- package/dist/api/camera/_export.d.ts.map +1 -0
- package/dist/api/content/ContentConfig.d.ts +11 -0
- package/dist/api/content/ContentConfig.d.ts.map +1 -0
- package/dist/{core → api}/content/ContentManager.d.ts +3 -2
- package/dist/api/content/ContentManager.d.ts.map +1 -0
- package/dist/api/content/IContent.d.ts +8 -0
- package/dist/api/content/IContent.d.ts.map +1 -0
- package/dist/api/content/IContentManager.d.ts +37 -0
- package/dist/api/content/IContentManager.d.ts.map +1 -0
- package/dist/api/content/IContentModule.d.ts +58 -0
- package/dist/api/content/IContentModule.d.ts.map +1 -0
- package/dist/api/content/ShaderModuleContent.d.ts.map +1 -0
- package/dist/api/content/_export-content.d.ts +5 -0
- package/dist/api/content/_export-content.d.ts.map +1 -0
- package/dist/api/core/IDisposable.d.ts +10 -0
- package/dist/api/core/IDisposable.d.ts.map +1 -0
- package/dist/api/core/_export-core.d.ts +2 -0
- package/dist/api/core/_export-core.d.ts.map +1 -0
- package/dist/api/data/Color.d.ts +119 -0
- package/dist/api/data/Color.d.ts.map +1 -0
- package/dist/api/data/Rect.d.ts +61 -0
- package/dist/api/data/Rect.d.ts.map +1 -0
- package/dist/api/data/State.d.ts +11 -0
- package/dist/api/data/State.d.ts.map +1 -0
- package/dist/api/data/_export.d.ts +4 -0
- package/dist/api/data/_export.d.ts.map +1 -0
- package/dist/{geometry → api/geometry}/BaseGeometry.d.ts +5 -2
- package/dist/api/geometry/BaseGeometry.d.ts.map +1 -0
- package/dist/{geometry → api/geometry}/GeometryBuilder.d.ts +1 -1
- package/dist/api/geometry/GeometryBuilder.d.ts.map +1 -0
- package/dist/api/geometry/GeometryFormat.d.ts +34 -0
- package/dist/api/geometry/GeometryFormat.d.ts.map +1 -0
- package/dist/api/geometry/IGeometry.d.ts +54 -0
- package/dist/api/geometry/IGeometry.d.ts.map +1 -0
- package/dist/api/geometry/IGeometryBuilder.d.ts +15 -0
- package/dist/api/geometry/IGeometryBuilder.d.ts.map +1 -0
- package/dist/api/geometry/VertexFormat.d.ts.map +1 -0
- package/dist/api/geometry/_export-geometry.d.ts +5 -0
- package/dist/api/geometry/_export-geometry.d.ts.map +1 -0
- package/dist/api/image/CpuImageProcessor.d.ts +16 -0
- package/dist/api/image/CpuImageProcessor.d.ts.map +1 -0
- package/dist/api/image/IImageProcessor.d.ts +26 -0
- package/dist/api/image/IImageProcessor.d.ts.map +1 -0
- package/dist/api/image/RawImageData.d.ts +34 -0
- package/dist/api/image/RawImageData.d.ts.map +1 -0
- package/dist/api/image/_export.d.ts +4 -0
- package/dist/api/image/_export.d.ts.map +1 -0
- package/dist/api/index.d.ts +2 -0
- package/dist/api/index.d.ts.map +1 -0
- package/dist/api/input/IInputManager.d.ts +53 -0
- package/dist/api/input/IInputManager.d.ts.map +1 -0
- package/dist/api/input/InputDeviceType.d.ts +18 -0
- package/dist/api/input/InputDeviceType.d.ts.map +1 -0
- package/dist/api/input/InputManager.d.ts +73 -0
- package/dist/api/input/InputManager.d.ts.map +1 -0
- package/dist/api/input/Key.d.ts +36 -0
- package/dist/api/input/Key.d.ts.map +1 -0
- package/dist/api/input/KeyboardState.d.ts +37 -0
- package/dist/api/input/KeyboardState.d.ts.map +1 -0
- package/dist/api/input/_export.d.ts +14 -0
- package/dist/api/input/_export.d.ts.map +1 -0
- package/dist/api/input/gamepad/Button.d.ts +22 -0
- package/dist/api/input/gamepad/Button.d.ts.map +1 -0
- package/dist/api/input/gamepad/GamePadState.d.ts +48 -0
- package/dist/api/input/gamepad/GamePadState.d.ts.map +1 -0
- package/dist/api/input/gamepad/GamePadThumbSticks.d.ts +17 -0
- package/dist/api/input/gamepad/GamePadThumbSticks.d.ts.map +1 -0
- package/dist/api/input/mouse/MouseButton.d.ts +10 -0
- package/dist/api/input/mouse/MouseButton.d.ts.map +1 -0
- package/dist/api/input/mouse/MouseState.d.ts +52 -0
- package/dist/api/input/mouse/MouseState.d.ts.map +1 -0
- package/dist/api/input/touch/TouchCollection.d.ts +79 -0
- package/dist/api/input/touch/TouchCollection.d.ts.map +1 -0
- package/dist/api/input/touch/TouchLocation.d.ts +80 -0
- package/dist/api/input/touch/TouchLocation.d.ts.map +1 -0
- package/dist/api/input/touch/TouchLocationState.d.ts +16 -0
- package/dist/api/input/touch/TouchLocationState.d.ts.map +1 -0
- package/dist/api/input/touch/TouchPanelCapabilities.d.ts +24 -0
- package/dist/api/input/touch/TouchPanelCapabilities.d.ts.map +1 -0
- package/dist/api/loaders/IImageLoader.d.ts +20 -0
- package/dist/api/loaders/IImageLoader.d.ts.map +1 -0
- package/dist/api/loaders/ImageLoader.d.ts +36 -0
- package/dist/api/loaders/ImageLoader.d.ts.map +1 -0
- package/dist/api/loaders/_export.d.ts +3 -0
- package/dist/api/loaders/_export.d.ts.map +1 -0
- package/dist/api/material/IMaterial.d.ts +35 -0
- package/dist/api/material/IMaterial.d.ts.map +1 -0
- package/dist/api/material/IMaterialFactory.d.ts +19 -0
- package/dist/api/material/IMaterialFactory.d.ts.map +1 -0
- package/dist/api/material/InspectTextureMipsMaterial.d.ts +58 -0
- package/dist/api/material/InspectTextureMipsMaterial.d.ts.map +1 -0
- package/dist/api/material/MaterialFactory.d.ts +20 -0
- package/dist/api/material/MaterialFactory.d.ts.map +1 -0
- package/dist/api/material/UnlitMaterial.d.ts +76 -0
- package/dist/api/material/UnlitMaterial.d.ts.map +1 -0
- package/dist/api/material/_export.d.ts +6 -0
- package/dist/api/material/_export.d.ts.map +1 -0
- package/dist/api/meshes/IMesh.d.ts +17 -0
- package/dist/api/meshes/IMesh.d.ts.map +1 -0
- package/dist/api/meshes/IMeshFactory.d.ts +25 -0
- package/dist/api/meshes/IMeshFactory.d.ts.map +1 -0
- package/dist/api/meshes/Mesh.d.ts +93 -0
- package/dist/api/meshes/Mesh.d.ts.map +1 -0
- package/dist/api/meshes/MeshFactory.d.ts +23 -0
- package/dist/api/meshes/MeshFactory.d.ts.map +1 -0
- package/dist/api/meshes/MeshParameters.d.ts +22 -0
- package/dist/api/meshes/MeshParameters.d.ts.map +1 -0
- package/dist/api/meshes/QuadMesh.d.ts +33 -0
- package/dist/api/meshes/QuadMesh.d.ts.map +1 -0
- package/dist/api/meshes/_export.d.ts +7 -0
- package/dist/api/meshes/_export.d.ts.map +1 -0
- package/dist/api/rendering/IGPUInfo.d.ts +35 -0
- package/dist/api/rendering/IGPUInfo.d.ts.map +1 -0
- package/dist/api/rendering/IGraphicsDevice.d.ts +88 -0
- package/dist/api/rendering/IGraphicsDevice.d.ts.map +1 -0
- package/dist/api/rendering/IGraphicsDeviceFeatures.d.ts +27 -0
- package/dist/api/rendering/IGraphicsDeviceFeatures.d.ts.map +1 -0
- package/dist/api/rendering/IRenderer.d.ts +71 -0
- package/dist/api/rendering/IRenderer.d.ts.map +1 -0
- package/dist/api/rendering/PowerPreference.d.ts +13 -0
- package/dist/api/rendering/PowerPreference.d.ts.map +1 -0
- package/dist/api/rendering/RenderingBackend.d.ts +18 -0
- package/dist/api/rendering/RenderingBackend.d.ts.map +1 -0
- package/dist/api/rendering/_export-rendering.d.ts +7 -0
- package/dist/api/rendering/_export-rendering.d.ts.map +1 -0
- package/dist/api/rendering/blending/IBlendState.d.ts +16 -0
- package/dist/api/rendering/blending/IBlendState.d.ts.map +1 -0
- package/dist/api/rendering/blending/_export.d.ts +2 -0
- package/dist/api/rendering/blending/_export.d.ts.map +1 -0
- package/dist/api/rendering/buffers/BufferUsage.d.ts +57 -0
- package/dist/api/rendering/buffers/BufferUsage.d.ts.map +1 -0
- package/dist/api/rendering/buffers/IBuffer.d.ts +20 -0
- package/dist/api/rendering/buffers/IBuffer.d.ts.map +1 -0
- package/dist/api/rendering/buffers/IBufferFactory.d.ts +34 -0
- package/dist/api/rendering/buffers/IBufferFactory.d.ts.map +1 -0
- package/dist/api/rendering/buffers/IIndexBuffer.d.ts +31 -0
- package/dist/api/rendering/buffers/IIndexBuffer.d.ts.map +1 -0
- package/dist/api/rendering/buffers/IUniformBuffer.d.ts +18 -0
- package/dist/api/rendering/buffers/IUniformBuffer.d.ts.map +1 -0
- package/dist/api/rendering/buffers/IVertexBuffer.d.ts +26 -0
- package/dist/api/rendering/buffers/IVertexBuffer.d.ts.map +1 -0
- package/dist/api/rendering/buffers/IVertexBufferLayout.d.ts +23 -0
- package/dist/api/rendering/buffers/IVertexBufferLayout.d.ts.map +1 -0
- package/dist/api/rendering/buffers/IndexBufferType.d.ts +14 -0
- package/dist/api/rendering/buffers/IndexBufferType.d.ts.map +1 -0
- package/dist/api/rendering/buffers/VertexAttribute.d.ts +22 -0
- package/dist/api/rendering/buffers/VertexAttribute.d.ts.map +1 -0
- package/dist/api/rendering/buffers/VertexStepMode.d.ts +14 -0
- package/dist/api/rendering/buffers/VertexStepMode.d.ts.map +1 -0
- package/dist/api/rendering/buffers/_export-buffers.d.ts +11 -0
- package/dist/api/rendering/buffers/_export-buffers.d.ts.map +1 -0
- package/dist/{core/renderer → api/rendering}/enums.d.ts.map +1 -1
- package/dist/api/rendering/primitive/CullMode.d.ts +18 -0
- package/dist/api/rendering/primitive/CullMode.d.ts.map +1 -0
- package/dist/api/rendering/primitive/FrontFace.d.ts +14 -0
- package/dist/api/rendering/primitive/FrontFace.d.ts.map +1 -0
- package/dist/api/rendering/primitive/IPrimitiveState.d.ts +22 -0
- package/dist/api/rendering/primitive/IPrimitiveState.d.ts.map +1 -0
- package/dist/api/rendering/primitive/PrimitiveStateDescriptor.d.ts +24 -0
- package/dist/api/rendering/primitive/PrimitiveStateDescriptor.d.ts.map +1 -0
- package/dist/api/rendering/primitive/PrimitiveTopology.d.ts +26 -0
- package/dist/api/rendering/primitive/PrimitiveTopology.d.ts.map +1 -0
- package/dist/api/rendering/primitive/_export.d.ts +6 -0
- package/dist/api/rendering/primitive/_export.d.ts.map +1 -0
- package/dist/api/rendering/render-pipelines/IInspectTextureMipsRenderPipeline.d.ts +33 -0
- package/dist/api/rendering/render-pipelines/IInspectTextureMipsRenderPipeline.d.ts.map +1 -0
- package/dist/api/rendering/render-pipelines/IMainRenderTargetRenderPipeline.d.ts +18 -0
- package/dist/api/rendering/render-pipelines/IMainRenderTargetRenderPipeline.d.ts.map +1 -0
- package/dist/api/rendering/render-pipelines/IRenderPipeline.d.ts +39 -0
- package/dist/api/rendering/render-pipelines/IRenderPipeline.d.ts.map +1 -0
- package/dist/api/rendering/render-pipelines/IRenderPipelineFactory.d.ts +42 -0
- package/dist/api/rendering/render-pipelines/IRenderPipelineFactory.d.ts.map +1 -0
- package/dist/api/rendering/render-pipelines/ISpriteRenderPipeline.d.ts +22 -0
- package/dist/api/rendering/render-pipelines/ISpriteRenderPipeline.d.ts.map +1 -0
- package/dist/api/rendering/render-pipelines/IUnlitRenderPipeline.d.ts +33 -0
- package/dist/api/rendering/render-pipelines/IUnlitRenderPipeline.d.ts.map +1 -0
- package/dist/api/rendering/render-pipelines/_export-render-pipelines.d.ts +7 -0
- package/dist/api/rendering/render-pipelines/_export-render-pipelines.d.ts.map +1 -0
- package/dist/{core/renderer → api/rendering}/renderer-interface.d.ts +11 -7
- package/dist/api/rendering/renderer-interface.d.ts.map +1 -0
- package/dist/{core/renderer → api/rendering}/rendering-limits.d.ts.map +1 -1
- package/dist/api/rendering/renderpass/IRenderPass.d.ts +15 -0
- package/dist/api/rendering/renderpass/IRenderPass.d.ts.map +1 -0
- package/dist/api/rendering/renderpass/LoadAction.d.ts +33 -0
- package/dist/api/rendering/renderpass/LoadAction.d.ts.map +1 -0
- package/dist/api/rendering/renderpass/RenderPassColorAttachment.d.ts +53 -0
- package/dist/api/rendering/renderpass/RenderPassColorAttachment.d.ts.map +1 -0
- package/dist/api/rendering/renderpass/RenderPassDepthStencilAttachment.d.ts +56 -0
- package/dist/api/rendering/renderpass/RenderPassDepthStencilAttachment.d.ts.map +1 -0
- package/dist/api/rendering/renderpass/RenderPassDescriptor.d.ts +22 -0
- package/dist/api/rendering/renderpass/RenderPassDescriptor.d.ts.map +1 -0
- package/dist/api/rendering/renderpass/StoreAction.d.ts +24 -0
- package/dist/api/rendering/renderpass/StoreAction.d.ts.map +1 -0
- package/dist/api/rendering/renderpass/_export.d.ts +7 -0
- package/dist/api/rendering/renderpass/_export.d.ts.map +1 -0
- package/dist/api/rendering/sampler/ISampler.d.ts +43 -0
- package/dist/api/rendering/sampler/ISampler.d.ts.map +1 -0
- package/dist/api/rendering/sampler/MipMapSamplerFilter.d.ts +18 -0
- package/dist/api/rendering/sampler/MipMapSamplerFilter.d.ts.map +1 -0
- package/dist/api/rendering/sampler/SamplerAddressMode.d.ts +24 -0
- package/dist/api/rendering/sampler/SamplerAddressMode.d.ts.map +1 -0
- package/dist/api/rendering/sampler/SamplerDescriptor.d.ts +40 -0
- package/dist/api/rendering/sampler/SamplerDescriptor.d.ts.map +1 -0
- package/dist/api/rendering/sampler/SamplerFilter.d.ts +14 -0
- package/dist/api/rendering/sampler/SamplerFilter.d.ts.map +1 -0
- package/dist/api/rendering/sampler/_export.d.ts +6 -0
- package/dist/api/rendering/sampler/_export.d.ts.map +1 -0
- package/dist/api/rendering/sampler/sampler-enums.d.ts +15 -0
- package/dist/api/rendering/sampler/sampler-enums.d.ts.map +1 -0
- package/dist/api/rendering/swapchain/ISwapChain.d.ts +29 -0
- package/dist/api/rendering/swapchain/ISwapChain.d.ts.map +1 -0
- package/dist/api/rendering/swapchain/SurfacePresentMode.d.ts +23 -0
- package/dist/api/rendering/swapchain/SurfacePresentMode.d.ts.map +1 -0
- package/dist/api/rendering/swapchain/SwapChainDescriptor.d.ts +20 -0
- package/dist/api/rendering/swapchain/SwapChainDescriptor.d.ts.map +1 -0
- package/dist/api/rendering/swapchain/_export.d.ts +4 -0
- package/dist/api/rendering/swapchain/_export.d.ts.map +1 -0
- package/dist/api/rendering/texture/ITexture2D.d.ts +83 -0
- package/dist/api/rendering/texture/ITexture2D.d.ts.map +1 -0
- package/dist/api/rendering/texture/ITextureFactory.d.ts +42 -0
- package/dist/api/rendering/texture/ITextureFactory.d.ts.map +1 -0
- package/dist/api/rendering/texture/ITextureView.d.ts +17 -0
- package/dist/api/rendering/texture/ITextureView.d.ts.map +1 -0
- package/dist/api/rendering/texture/TextureDescriptor.d.ts +42 -0
- package/dist/api/rendering/texture/TextureDescriptor.d.ts.map +1 -0
- package/dist/api/rendering/texture/TextureFormat.d.ts +54 -0
- package/dist/api/rendering/texture/TextureFormat.d.ts.map +1 -0
- package/dist/api/rendering/texture/TextureUsage.d.ts +42 -0
- package/dist/api/rendering/texture/TextureUsage.d.ts.map +1 -0
- package/dist/api/rendering/texture/TextureUtilities.d.ts +54 -0
- package/dist/api/rendering/texture/TextureUtilities.d.ts.map +1 -0
- package/dist/api/rendering/texture/TextureViewDescriptor.d.ts +22 -0
- package/dist/api/rendering/texture/TextureViewDescriptor.d.ts.map +1 -0
- package/dist/api/rendering/texture/TextureViewDimension.d.ts +17 -0
- package/dist/api/rendering/texture/TextureViewDimension.d.ts.map +1 -0
- package/dist/api/rendering/texture/_export-texture.d.ts +10 -0
- package/dist/api/rendering/texture/_export-texture.d.ts.map +1 -0
- package/dist/api/shader/IShaderModule.d.ts +21 -0
- package/dist/api/shader/IShaderModule.d.ts.map +1 -0
- package/dist/api/shader/IShaderModuleLoader.d.ts +13 -0
- package/dist/api/shader/IShaderModuleLoader.d.ts.map +1 -0
- package/dist/api/shader/ShaderStage.d.ts +10 -0
- package/dist/api/shader/ShaderStage.d.ts.map +1 -0
- package/dist/api/shader/_export-shader.d.ts +4 -0
- package/dist/api/shader/_export-shader.d.ts.map +1 -0
- package/dist/{core → api}/shader/shader-loader.d.ts +1 -1
- package/dist/api/shader/shader-loader.d.ts.map +1 -0
- package/dist/api/sprites/ISpriteBatch.d.ts +114 -0
- package/dist/api/sprites/ISpriteBatch.d.ts.map +1 -0
- package/dist/{core/sprite-batch → api/sprites}/SpriteBatch.d.ts +1 -1
- package/dist/api/sprites/SpriteBatch.d.ts.map +1 -0
- package/dist/{core/sprite-batch → api/sprites}/SpriteBatchDrawable.d.ts +1 -1
- package/dist/api/sprites/SpriteBatchDrawable.d.ts.map +1 -0
- package/dist/{core/sprite-batch → api/sprites}/SpriteBatchMesh.d.ts +1 -1
- package/dist/api/sprites/SpriteBatchMesh.d.ts.map +1 -0
- package/dist/api/sprites/_export_sprites.d.ts +2 -0
- package/dist/api/sprites/_export_sprites.d.ts.map +1 -0
- package/dist/api/time/GameTime.d.ts +23 -0
- package/dist/api/time/GameTime.d.ts.map +1 -0
- package/dist/api/time/ITimeManager.d.ts +19 -0
- package/dist/api/time/ITimeManager.d.ts.map +1 -0
- package/dist/api/time/TimeManager.d.ts +15 -0
- package/dist/api/time/TimeManager.d.ts.map +1 -0
- package/dist/api/time/_export_time.d.ts +4 -0
- package/dist/api/time/_export_time.d.ts.map +1 -0
- package/dist/api/utilities/AlignUtilities.d.ts +20 -0
- package/dist/api/utilities/AlignUtilities.d.ts.map +1 -0
- package/dist/api/utilities/GeometryUtilities.d.ts +13 -0
- package/dist/api/utilities/GeometryUtilities.d.ts.map +1 -0
- package/dist/api/utilities/MathHelper.d.ts +162 -0
- package/dist/api/utilities/MathHelper.d.ts.map +1 -0
- package/dist/api/utilities/_export.d.ts +4 -0
- package/dist/api/utilities/_export.d.ts.map +1 -0
- package/dist/api/window/IWindowManager.d.ts +64 -0
- package/dist/api/window/IWindowManager.d.ts.map +1 -0
- package/dist/api/window/WindowBounds.d.ts +16 -0
- package/dist/api/window/WindowBounds.d.ts.map +1 -0
- package/dist/{core/window/window-manager.d.ts → api/window/WindowManager.d.ts} +3 -3
- package/dist/api/window/WindowManager.d.ts.map +1 -0
- package/dist/api/window/_export.d.ts +3 -0
- package/dist/api/window/_export.d.ts.map +1 -0
- package/dist/core/rendering/AGraphicsDevice.d.ts +10 -6
- package/dist/core/rendering/AGraphicsDevice.d.ts.map +1 -1
- package/dist/core/rendering/ARenderer.d.ts +4 -5
- package/dist/core/rendering/ARenderer.d.ts.map +1 -1
- package/dist/core/rendering/blending/enums.d.ts +5 -2
- package/dist/core/rendering/blending/enums.d.ts.map +1 -1
- package/dist/core/rendering/sampler/sampler-descriptor.d.ts +1 -1
- package/dist/core/rendering/sampler/sampler-descriptor.d.ts.map +1 -1
- package/dist/core/rendering/texture/texture.d.ts +1 -1
- package/dist/core/rendering/texture/texture.d.ts.map +1 -1
- package/dist/core/rendering/vertex-buffer-layout.d.ts +2 -3
- package/dist/core/rendering/vertex-buffer-layout.d.ts.map +1 -1
- package/dist/index.d.ts +3 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4052 -596
- package/dist/webgl/WebGLGraphicsDeviceFeatures.d.ts +1 -1
- package/dist/webgl/WebGLGraphicsDeviceFeatures.d.ts.map +1 -1
- package/dist/webgl/WebGlGpuInfo.d.ts +1 -1
- package/dist/webgl/WebGlGpuInfo.d.ts.map +1 -1
- package/dist/webgl/WebGlGraphicsDevice.d.ts +7 -5
- package/dist/webgl/WebGlGraphicsDevice.d.ts.map +1 -1
- package/dist/webgl/WebGlRenderer.d.ts +3 -3
- package/dist/webgl/WebGlRenderer.d.ts.map +1 -1
- package/dist/webgl/blending/webgl-blend-state.d.ts +1 -1
- package/dist/webgl/blending/webgl-blend-state.d.ts.map +1 -1
- package/dist/webgl/buffers/WebGlBuffersFactory.d.ts +1 -1
- package/dist/webgl/buffers/WebGlBuffersFactory.d.ts.map +1 -1
- package/dist/webgl/buffers/WebGlUniformBuffer.d.ts +1 -1
- package/dist/webgl/buffers/WebGlUniformBuffer.d.ts.map +1 -1
- package/dist/webgl/buffers/WebGlVertexBuffer.d.ts +6 -6
- package/dist/webgl/buffers/WebGlVertexBuffer.d.ts.map +1 -1
- package/dist/webgl/buffers/webgl-index-buffer.d.ts +2 -2
- package/dist/webgl/buffers/webgl-index-buffer.d.ts.map +1 -1
- package/dist/webgl/cast/cast.d.ts +2 -2
- package/dist/webgl/cast/cast.d.ts.map +1 -1
- package/dist/webgl/primitive/WebGlPrimitiveState.d.ts +1 -3
- package/dist/webgl/primitive/WebGlPrimitiveState.d.ts.map +1 -1
- package/dist/webgl/render-pass/WebGlRenderPass.d.ts +3 -3
- package/dist/webgl/render-pass/WebGlRenderPass.d.ts.map +1 -1
- package/dist/webgl/render-pipelines/AWebGlRenderPipeline.d.ts +1 -1
- package/dist/webgl/render-pipelines/AWebGlRenderPipeline.d.ts.map +1 -1
- package/dist/webgl/render-pipelines/WebGlMainRenderTargetRenderPipeline.d.ts +3 -1
- package/dist/webgl/render-pipelines/WebGlMainRenderTargetRenderPipeline.d.ts.map +1 -1
- package/dist/webgl/render-pipelines/WebGlRenderPipelineFactory.d.ts +1 -1
- package/dist/webgl/render-pipelines/WebGlRenderPipelineFactory.d.ts.map +1 -1
- package/dist/webgl/render-pipelines/inspect/WebGlInspectTextureMipsRenderPipeline.d.ts +3 -3
- package/dist/webgl/render-pipelines/inspect/WebGlInspectTextureMipsRenderPipeline.d.ts.map +1 -1
- package/dist/webgl/render-pipelines/material/WebGlUnlitRenderPipeline.d.ts +2 -2
- package/dist/webgl/render-pipelines/material/WebGlUnlitRenderPipeline.d.ts.map +1 -1
- package/dist/webgl/render-pipelines/sprite/WebGlSpriteRenderPipeline.d.ts +2 -2
- package/dist/webgl/render-pipelines/sprite/WebGlSpriteRenderPipeline.d.ts.map +1 -1
- package/dist/webgl/sampler/webgl-sampler.d.ts +1 -1
- package/dist/webgl/sampler/webgl-sampler.d.ts.map +1 -1
- package/dist/webgl/shader/WebGlShaderModule.d.ts +1 -1
- package/dist/webgl/shader/WebGlShaderModule.d.ts.map +1 -1
- package/dist/webgl/shader/WebGlShaderModuleLoader.d.ts +1 -1
- package/dist/webgl/shader/WebGlShaderModuleLoader.d.ts.map +1 -1
- package/dist/webgl/swap-chain/WebGlSwapChain.d.ts +1 -1
- package/dist/webgl/swap-chain/WebGlSwapChain.d.ts.map +1 -1
- package/dist/webgl/texture/WebGlTexture2D.d.ts +1 -1
- package/dist/webgl/texture/WebGlTexture2D.d.ts.map +1 -1
- package/dist/webgl/texture/WebGlTextureFactory.d.ts +3 -3
- package/dist/webgl/texture/WebGlTextureFactory.d.ts.map +1 -1
- package/dist/webgl/utilities/WebGlBufferUtilities.d.ts +1 -1
- package/dist/webgl/utilities/WebGlBufferUtilities.d.ts.map +1 -1
- package/dist/webgl/utilities/WebGlConverter.d.ts +6 -22
- package/dist/webgl/utilities/WebGlConverter.d.ts.map +1 -1
- package/dist/webgl/utilities/WebGlFrameBufferUtilities.d.ts +1 -1
- package/dist/webgl/utilities/WebGlFrameBufferUtilities.d.ts.map +1 -1
- package/dist/webgl/utilities/WebGlSamplerUtilities.d.ts +3 -3
- package/dist/webgl/utilities/WebGlSamplerUtilities.d.ts.map +1 -1
- package/dist/webgl/utilities/WebGlTextureUtilities.d.ts +5 -5
- package/dist/webgl/utilities/WebGlTextureUtilities.d.ts.map +1 -1
- package/dist/webgl/utilities/webgl-culling-utilities.d.ts +1 -1
- package/dist/webgl/utilities/webgl-culling-utilities.d.ts.map +1 -1
- package/dist/webgl/utilities/webgl-filter-anisotropic-utilities.d.ts +1 -1
- package/dist/webgl/utilities/webgl-renderbuffer-utilities.d.ts +1 -1
- package/dist/webgl/utilities/webgl-renderbuffer-utilities.d.ts.map +1 -1
- package/package.json +7 -6
- package/shaders/glsl/sprite_fs.glsl +1 -1
- package/src/{core/Framework.ts → Framework.ts} +78 -38
- package/src/api/FrameworkConfiguration.ts +29 -0
- package/src/api/IFramework.ts +153 -0
- package/src/api/IFrameworkConfiguration.ts +30 -0
- package/src/api/_export.ts +26 -0
- package/src/api/camera/CameraFactory.ts +56 -0
- package/src/api/camera/ICamera.ts +52 -0
- package/src/api/camera/ICameraFactory.ts +69 -0
- package/src/api/camera/IOrthographicCamera.ts +38 -0
- package/src/api/camera/OrbitCamera.ts +402 -0
- package/src/api/camera/OrthographicCamera.ts +257 -0
- package/src/api/camera/PerspectiveCamera.ts +206 -0
- package/src/api/camera/_export.ts +7 -0
- package/src/api/content/ContentConfig.ts +11 -0
- package/src/{core → api}/content/ContentManager.ts +4 -3
- package/src/api/content/IContent.ts +9 -0
- package/src/api/content/IContentManager.ts +41 -0
- package/src/api/content/IContentModule.ts +67 -0
- package/src/{content → api/content}/ShaderModuleContent.ts +8 -8
- package/src/api/content/_export-content.ts +4 -0
- package/src/api/core/IDisposable.ts +10 -0
- package/src/api/core/_export-core.ts +1 -0
- package/src/api/data/Color.ts +228 -0
- package/src/api/data/Rect.ts +92 -0
- package/src/api/data/State.ts +10 -0
- package/src/api/data/_export.ts +3 -0
- package/src/{geometry → api/geometry}/BaseGeometry.ts +15 -2
- package/src/{geometry → api/geometry}/GeometryBuilder.ts +1 -1
- package/src/api/geometry/GeometryFormat.ts +33 -0
- package/src/api/geometry/IGeometry.ts +66 -0
- package/src/api/geometry/IGeometryBuilder.ts +17 -0
- package/src/{VertexFormat.ts → api/geometry/VertexFormat.ts} +3 -7
- package/src/api/geometry/_export-geometry.ts +4 -0
- package/src/api/image/CpuImageProcessor.ts +125 -0
- package/src/api/image/IImageProcessor.ts +28 -0
- package/src/api/image/RawImageData.ts +47 -0
- package/src/api/image/_export.ts +3 -0
- package/src/api/index.ts +1 -0
- package/src/api/input/IInputManager.ts +62 -0
- package/src/api/input/InputDeviceType.ts +20 -0
- package/src/api/input/InputManager.ts +513 -0
- package/src/api/input/Key.ts +35 -0
- package/src/api/input/KeyboardState.ts +44 -0
- package/src/api/input/_export.ts +13 -0
- package/src/api/input/gamepad/Button.ts +21 -0
- package/src/api/input/gamepad/GamePadState.ts +65 -0
- package/src/api/input/gamepad/GamePadThumbSticks.ts +18 -0
- package/src/api/input/mouse/MouseButton.ts +9 -0
- package/src/api/input/mouse/MouseState.ts +70 -0
- package/src/api/input/touch/TouchCollection.ts +164 -0
- package/src/api/input/touch/TouchLocation.ts +159 -0
- package/src/api/input/touch/TouchLocationState.ts +15 -0
- package/src/api/input/touch/TouchPanelCapabilities.ts +31 -0
- package/src/api/loaders/IImageLoader.ts +22 -0
- package/src/api/loaders/ImageLoader.ts +93 -0
- package/src/api/loaders/_export.ts +2 -0
- package/src/api/material/IMaterial.ts +41 -0
- package/src/api/material/IMaterialFactory.ts +21 -0
- package/src/api/material/InspectTextureMipsMaterial.ts +113 -0
- package/src/api/material/MaterialFactory.ts +27 -0
- package/src/api/material/UnlitMaterial.ts +143 -0
- package/src/api/material/_export.ts +5 -0
- package/src/api/meshes/IMesh.ts +20 -0
- package/src/api/meshes/IMeshFactory.ts +28 -0
- package/src/api/meshes/Mesh.ts +256 -0
- package/src/api/meshes/MeshFactory.ts +36 -0
- package/src/api/meshes/MeshParameters.ts +25 -0
- package/src/api/meshes/QuadMesh.ts +104 -0
- package/src/api/meshes/_export.ts +6 -0
- package/src/api/rendering/IGPUInfo.ts +42 -0
- package/src/api/rendering/IGraphicsDevice.ts +103 -0
- package/src/api/rendering/IGraphicsDeviceFeatures.ts +32 -0
- package/src/api/rendering/IRenderer.ts +84 -0
- package/src/api/rendering/PowerPreference.ts +15 -0
- package/src/api/rendering/RenderingBackend.ts +20 -0
- package/src/api/rendering/_export-rendering.ts +6 -0
- package/src/api/rendering/blending/IBlendState.ts +17 -0
- package/src/api/rendering/blending/_export.ts +1 -0
- package/src/api/rendering/buffers/BufferUsage.ts +56 -0
- package/src/api/rendering/buffers/IBuffer.ts +24 -0
- package/src/api/rendering/buffers/IBufferFactory.ts +38 -0
- package/src/api/rendering/buffers/IIndexBuffer.ts +37 -0
- package/src/api/rendering/buffers/IUniformBuffer.ts +21 -0
- package/src/api/rendering/buffers/IVertexBuffer.ts +32 -0
- package/src/api/rendering/buffers/IVertexBufferLayout.ts +27 -0
- package/src/api/rendering/buffers/IndexBufferType.ts +13 -0
- package/src/api/rendering/buffers/VertexAttribute.ts +26 -0
- package/src/api/rendering/buffers/VertexStepMode.ts +13 -0
- package/src/api/rendering/buffers/_export-buffers.ts +11 -0
- package/src/api/rendering/primitive/CullMode.ts +17 -0
- package/src/api/rendering/primitive/FrontFace.ts +13 -0
- package/src/api/rendering/primitive/IPrimitiveState.ts +25 -0
- package/src/api/rendering/primitive/PrimitiveStateDescriptor.ts +27 -0
- package/src/api/rendering/primitive/PrimitiveTopology.ts +25 -0
- package/src/api/rendering/primitive/_export.ts +5 -0
- package/src/api/rendering/render-pipelines/IInspectTextureMipsRenderPipeline.ts +38 -0
- package/src/api/rendering/render-pipelines/IMainRenderTargetRenderPipeline.ts +21 -0
- package/src/api/rendering/render-pipelines/IRenderPipeline.ts +47 -0
- package/src/api/rendering/render-pipelines/IRenderPipelineFactory.ts +52 -0
- package/src/api/rendering/render-pipelines/ISpriteRenderPipeline.ts +25 -0
- package/src/api/rendering/render-pipelines/IUnlitRenderPipeline.ts +38 -0
- package/src/api/rendering/render-pipelines/_export-render-pipelines.ts +6 -0
- package/src/{core/renderer → api/rendering}/renderer-interface.ts +15 -9
- package/src/api/rendering/renderpass/IRenderPass.ts +18 -0
- package/src/api/rendering/renderpass/LoadAction.ts +32 -0
- package/src/api/rendering/renderpass/RenderPassColorAttachment.ts +61 -0
- package/src/api/rendering/renderpass/RenderPassDepthStencilAttachment.ts +76 -0
- package/src/api/rendering/renderpass/RenderPassDescriptor.ts +26 -0
- package/src/api/rendering/renderpass/StoreAction.ts +23 -0
- package/src/api/rendering/renderpass/_export.ts +6 -0
- package/src/api/rendering/sampler/ISampler.ts +52 -0
- package/src/api/rendering/sampler/MipMapSamplerFilter.ts +17 -0
- package/src/api/rendering/sampler/SamplerAddressMode.ts +23 -0
- package/src/api/rendering/sampler/SamplerDescriptor.ts +46 -0
- package/src/api/rendering/sampler/SamplerFilter.ts +13 -0
- package/src/api/rendering/sampler/_export.ts +5 -0
- package/src/api/rendering/sampler/sampler-enums.ts +20 -0
- package/src/api/rendering/swapchain/ISwapChain.ts +33 -0
- package/src/api/rendering/swapchain/SurfacePresentMode.ts +22 -0
- package/src/api/rendering/swapchain/SwapChainDescriptor.ts +23 -0
- package/src/api/rendering/swapchain/_export.ts +3 -0
- package/src/api/rendering/texture/ITexture2D.ts +100 -0
- package/src/api/rendering/texture/ITextureFactory.ts +56 -0
- package/src/api/rendering/texture/ITextureView.ts +20 -0
- package/src/api/rendering/texture/TextureDescriptor.ts +52 -0
- package/src/api/rendering/texture/TextureFormat.ts +58 -0
- package/src/api/rendering/texture/TextureUsage.ts +41 -0
- package/src/api/rendering/texture/TextureUtilities.ts +149 -0
- package/src/api/rendering/texture/TextureViewDescriptor.ts +25 -0
- package/src/api/rendering/texture/TextureViewDimension.ts +16 -0
- package/src/api/rendering/texture/_export-texture.ts +9 -0
- package/src/api/shader/IShaderModule.ts +23 -0
- package/src/api/shader/IShaderModuleLoader.ts +15 -0
- package/src/api/shader/ShaderStage.ts +9 -0
- package/src/api/shader/_export-shader.ts +3 -0
- package/src/{core → api}/shader/shader-loader.ts +1 -1
- package/src/api/sprites/ISpriteBatch.ts +144 -0
- package/src/{core/sprite-batch → api/sprites}/SpriteBatch.ts +8 -5
- package/src/{core/sprite-batch → api/sprites}/SpriteBatchDrawable.ts +6 -6
- package/src/{core/sprite-batch → api/sprites}/SpriteBatchMesh.ts +8 -4
- package/src/api/sprites/_export_sprites.ts +1 -0
- package/src/api/time/GameTime.ts +30 -0
- package/src/api/time/ITimeManager.ts +22 -0
- package/src/api/time/TimeManager.ts +33 -0
- package/src/api/time/_export_time.ts +3 -0
- package/src/api/utilities/AlignUtilities.ts +39 -0
- package/src/api/utilities/GeometryUtilities.ts +20 -0
- package/src/api/utilities/MathHelper.ts +256 -0
- package/src/api/utilities/_export.ts +3 -0
- package/src/api/window/IWindowManager.ts +78 -0
- package/src/api/window/WindowBounds.ts +17 -0
- package/src/{core/window/window-manager.ts → api/window/WindowManager.ts} +2 -2
- package/src/api/window/_export.ts +2 -0
- package/src/core/rendering/AGraphicsDevice.ts +15 -9
- package/src/core/rendering/ARenderer.ts +7 -7
- package/src/core/rendering/blending/enums.ts +5 -5
- package/src/core/rendering/sampler/sampler-descriptor.ts +1 -1
- package/src/core/rendering/texture/texture.ts +4 -3
- package/src/core/rendering/vertex-buffer-layout.ts +3 -4
- package/src/index.ts +3 -2
- package/src/main.ts +5 -10
- package/src/webgl/WebGLGraphicsDeviceFeatures.ts +1 -1
- package/src/webgl/WebGlGpuInfo.ts +1 -1
- package/src/webgl/WebGlGraphicsDevice.ts +19 -15
- package/src/webgl/WebGlRenderer.ts +7 -5
- package/src/webgl/blending/webgl-blend-state.ts +1 -1
- package/src/webgl/buffers/WebGlBuffersFactory.ts +1 -1
- package/src/webgl/buffers/WebGlUniformBuffer.ts +1 -1
- package/src/webgl/buffers/WebGlVertexBuffer.ts +8 -7
- package/src/webgl/buffers/webgl-index-buffer.ts +2 -2
- package/src/webgl/cast/cast.ts +2 -2
- package/src/webgl/primitive/WebGlPrimitiveState.ts +7 -3
- package/src/webgl/render-pass/WebGlRenderPass.ts +17 -8
- package/src/webgl/render-pipelines/AWebGlRenderPipeline.ts +1 -1
- package/src/webgl/render-pipelines/WebGlMainRenderTargetRenderPipeline.ts +10 -2
- package/src/webgl/render-pipelines/WebGlRenderPipelineFactory.ts +1 -1
- package/src/webgl/render-pipelines/inspect/WebGlInspectTextureMipsRenderPipeline.ts +3 -3
- package/src/webgl/render-pipelines/material/WebGlUnlitRenderPipeline.ts +2 -2
- package/src/webgl/render-pipelines/sprite/WebGlSpriteRenderPipeline.ts +2 -2
- package/src/webgl/sampler/webgl-sampler.ts +2 -2
- package/src/webgl/shader/WebGlShaderModule.ts +2 -2
- package/src/webgl/shader/WebGlShaderModuleLoader.ts +1 -1
- package/src/webgl/swap-chain/WebGlSwapChain.ts +1 -1
- package/src/webgl/texture/WebGlTexture2D.ts +6 -4
- package/src/webgl/texture/WebGlTextureFactory.ts +7 -7
- package/src/webgl/utilities/WebGlBufferUtilities.ts +1 -1
- package/src/webgl/utilities/WebGlConverter.ts +19 -62
- package/src/webgl/utilities/WebGlFrameBufferUtilities.ts +1 -1
- package/src/webgl/utilities/WebGlSamplerUtilities.ts +4 -4
- package/src/webgl/utilities/WebGlTextureUtilities.ts +29 -20
- package/src/webgl/utilities/webgl-culling-utilities.ts +1 -1
- package/src/webgl/utilities/webgl-filter-anisotropic-utilities.ts +1 -1
- package/src/webgl/utilities/webgl-renderbuffer-utilities.ts +1 -1
- package/dist/TextureFormat.d.ts +0 -2
- package/dist/TextureFormat.d.ts.map +0 -1
- package/dist/VertexFormat.d.ts.map +0 -1
- package/dist/_ris-ktx2-node-module-stub-nzBRmiO_.js +0 -10
- package/dist/common/sampler-enums.d.ts +0 -16
- package/dist/common/sampler-enums.d.ts.map +0 -1
- package/dist/common/vertex-step-mode.d.ts +0 -11
- package/dist/common/vertex-step-mode.d.ts.map +0 -1
- package/dist/content/ShaderModuleContent.d.ts.map +0 -1
- package/dist/core/Framework.d.ts.map +0 -1
- package/dist/core/FrameworkConfig.d.ts +0 -26
- package/dist/core/FrameworkConfig.d.ts.map +0 -1
- package/dist/core/buffers/buffers-factory-interface.d.ts +0 -2
- package/dist/core/buffers/buffers-factory-interface.d.ts.map +0 -1
- package/dist/core/buffers/vertex-buffer-interface.d.ts +0 -2
- package/dist/core/buffers/vertex-buffer-interface.d.ts.map +0 -1
- package/dist/core/content/ContentManager.d.ts.map +0 -1
- package/dist/core/dependency-injection/register-services-interface.d.ts +0 -13
- package/dist/core/dependency-injection/register-services-interface.d.ts.map +0 -1
- package/dist/core/framework-interface.d.ts +0 -2
- package/dist/core/framework-interface.d.ts.map +0 -1
- package/dist/core/input/InputManager.d.ts +0 -27
- package/dist/core/input/InputManager.d.ts.map +0 -1
- package/dist/core/renderer/renderer-interface.d.ts.map +0 -1
- package/dist/core/rendering/primitive/PrimitiveStateDescriptor.d.ts +0 -26
- package/dist/core/rendering/primitive/PrimitiveStateDescriptor.d.ts.map +0 -1
- package/dist/core/rendering/primitive/enums.d.ts +0 -56
- package/dist/core/rendering/primitive/enums.d.ts.map +0 -1
- package/dist/core/rendering/render-pass/render-pass-descriptor.d.ts +0 -2
- package/dist/core/rendering/render-pass/render-pass-descriptor.d.ts.map +0 -1
- package/dist/core/rendering/render-pass/render-pass-interface.d.ts +0 -15
- package/dist/core/rendering/render-pass/render-pass-interface.d.ts.map +0 -1
- package/dist/core/rendering/vertex-attribute.d.ts +0 -17
- package/dist/core/rendering/vertex-attribute.d.ts.map +0 -1
- package/dist/core/shader/shader-loader.d.ts.map +0 -1
- package/dist/core/shader/shader-module-interface.d.ts +0 -2
- package/dist/core/shader/shader-module-interface.d.ts.map +0 -1
- package/dist/core/sprite-batch/SpriteBatch.d.ts.map +0 -1
- package/dist/core/sprite-batch/SpriteBatchDrawable.d.ts.map +0 -1
- package/dist/core/sprite-batch/SpriteBatchMesh.d.ts.map +0 -1
- package/dist/core/window/window-manager.d.ts.map +0 -1
- package/dist/geometry/BaseGeometry.d.ts.map +0 -1
- package/dist/geometry/GeometryBuilder.d.ts.map +0 -1
- package/dist/geometry/GeometryFormat.d.ts +0 -34
- package/dist/geometry/GeometryFormat.d.ts.map +0 -1
- package/dist/webgl/utilities/webgl-render-buffer-utilities.d.ts +0 -5
- package/dist/webgl/utilities/webgl-render-buffer-utilities.d.ts.map +0 -1
- package/src/TextureFormat.ts +0 -0
- package/src/common/sampler-enums.ts +0 -21
- package/src/common/vertex-step-mode.ts +0 -12
- package/src/core/FrameworkConfig.ts +0 -31
- package/src/core/buffers/buffers-factory-interface.ts +0 -0
- package/src/core/buffers/vertex-buffer-interface.ts +0 -0
- package/src/core/dependency-injection/register-services-interface.ts +0 -15
- package/src/core/framework-interface.ts +0 -0
- package/src/core/input/InputManager.ts +0 -115
- package/src/core/rendering/primitive/PrimitiveStateDescriptor.ts +0 -32
- package/src/core/rendering/primitive/enums.ts +0 -68
- package/src/core/rendering/render-pass/render-pass-descriptor.ts +0 -0
- package/src/core/rendering/render-pass/render-pass-interface.ts +0 -17
- package/src/core/rendering/vertex-attribute.ts +0 -20
- package/src/core/shader/shader-module-interface.ts +0 -1
- package/src/counter.ts +0 -9
- package/src/geometry/GeometryFormat.ts +0 -37
- package/src/webgl/utilities/webgl-render-buffer-utilities.ts +0 -23
- /package/dist/{content → api/content}/ShaderModuleContent.d.ts +0 -0
- /package/dist/{VertexFormat.d.ts → api/geometry/VertexFormat.d.ts} +0 -0
- /package/dist/{core/renderer → api/rendering}/enums.d.ts +0 -0
- /package/dist/{core/renderer → api/rendering}/rendering-limits.d.ts +0 -0
- /package/src/{core/renderer → api/rendering}/enums.ts +0 -0
- /package/src/{core/renderer → api/rendering}/rendering-limits.ts +0 -0
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import type { IDisposable } from "../core/IDisposable.ts";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* The image data.
|
|
5
|
+
*/
|
|
6
|
+
export class RawImageData implements IDisposable {
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* The image data per mip level.
|
|
10
|
+
*/
|
|
11
|
+
private _data?: Array<number[] | HTMLImageElement | ArrayBufferView>;
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* The constructor.
|
|
15
|
+
* @param data The data.
|
|
16
|
+
* @param baseWidth The image width.
|
|
17
|
+
* @param baseHeight The image height.
|
|
18
|
+
* @param channels The number of channels in the image.
|
|
19
|
+
*/
|
|
20
|
+
public constructor(data: Array<number[] | HTMLImageElement | ArrayBufferView>,
|
|
21
|
+
public readonly baseWidth: number,
|
|
22
|
+
public readonly baseHeight: number,
|
|
23
|
+
public readonly channels: number) {
|
|
24
|
+
|
|
25
|
+
this._data = data;
|
|
26
|
+
this.numLevels = data.length;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* The number of mip levels.
|
|
31
|
+
*/
|
|
32
|
+
public readonly numLevels : number;
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Gets the image data for a specific mip level.
|
|
36
|
+
* @param mipLevel - The mip level.
|
|
37
|
+
* @returns The data.
|
|
38
|
+
*/
|
|
39
|
+
public getData(mipLevel: number): number[] | HTMLImageElement | ArrayBufferView {
|
|
40
|
+
return this._data![mipLevel];
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/** @inheritDoc */
|
|
44
|
+
public dispose(): void {
|
|
45
|
+
this._data = undefined;
|
|
46
|
+
}
|
|
47
|
+
}
|
package/src/api/index.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./_export.ts";
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import {KeyboardState} from "./KeyboardState.ts";
|
|
2
|
+
import {MouseState} from "./mouse/MouseState.ts";
|
|
3
|
+
import {GamePadState} from "./gamepad/GamePadState.ts";
|
|
4
|
+
import {TouchCollection} from "./touch/TouchCollection.ts";
|
|
5
|
+
import {TouchPanelCapabilities} from "./touch/TouchPanelCapabilities.ts";
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* The input manager.
|
|
9
|
+
*/
|
|
10
|
+
export interface IInputManager {
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Gets or sets the thumbstick dead zone.
|
|
14
|
+
* The dead zone is a range of values near the center of the thumbstick that are ignored.
|
|
15
|
+
* By default, it is 0.2.
|
|
16
|
+
*/
|
|
17
|
+
thumbstickDeadZone: number;
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Gets the keyboard state. Can be used to query pressed keys.
|
|
21
|
+
* @returns The keyboard state.
|
|
22
|
+
*/
|
|
23
|
+
getKeyboardState(): KeyboardState;
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Gets the mouse state. Can be used to query pressed buttons and the cursor position.
|
|
27
|
+
* @returns The mouse state.
|
|
28
|
+
*/
|
|
29
|
+
getMouseState(): MouseState;
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Gets the gamepad state. Can be used to query pressed buttons.
|
|
33
|
+
* @param gamePadIndex - The index of a gamepad. By default, it is 0 for first.
|
|
34
|
+
* @returns The gamepad state.
|
|
35
|
+
*/
|
|
36
|
+
getGamePadState(gamePadIndex: number): GamePadState;
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Gets the touch locations for the current frame.
|
|
40
|
+
*/
|
|
41
|
+
getTouchCollection(): TouchCollection;
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Gets the capabilities of the touch panel.
|
|
45
|
+
*/
|
|
46
|
+
getTouchCapabilities(): TouchPanelCapabilities;
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Initialize the input manager.
|
|
50
|
+
*/
|
|
51
|
+
initialize(): void;
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Update the input manager.
|
|
55
|
+
*/
|
|
56
|
+
update(): void;
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Call this after update. Usually at the end of update loop in order to clear.
|
|
60
|
+
*/
|
|
61
|
+
afterUpdate(): void;
|
|
62
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
|
|
2
|
+
/** The type of input device. */
|
|
3
|
+
export enum InputDeviceType {
|
|
4
|
+
|
|
5
|
+
/** No input. */
|
|
6
|
+
NONE = 0,
|
|
7
|
+
/** Keyboard */
|
|
8
|
+
KEYBOARD = 1 << 0,
|
|
9
|
+
/** Mouse */
|
|
10
|
+
MOUSE = 1 << 1,
|
|
11
|
+
/** Gamepad */
|
|
12
|
+
GAMEPAD = 1 << 2,
|
|
13
|
+
/** Touchpad */
|
|
14
|
+
TOUCHPAD = 1 << 3,
|
|
15
|
+
/** Pen */
|
|
16
|
+
PEN = 1 << 4,
|
|
17
|
+
|
|
18
|
+
/** Every input device */
|
|
19
|
+
ALL = 0xFF_FF_FF_FF,
|
|
20
|
+
}
|
|
@@ -0,0 +1,513 @@
|
|
|
1
|
+
import {
|
|
2
|
+
GamePadState,
|
|
3
|
+
type IFramework,
|
|
4
|
+
type IInputManager,
|
|
5
|
+
KeyboardState,
|
|
6
|
+
MouseButton,
|
|
7
|
+
MouseState,
|
|
8
|
+
TouchCollection,
|
|
9
|
+
TouchLocationState,
|
|
10
|
+
TouchPanelCapabilities,
|
|
11
|
+
} from "../index.ts";
|
|
12
|
+
import {vec2} from "gl-matrix";
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* One finger.
|
|
16
|
+
* Allocated with the pool and reset when the finger is gone.
|
|
17
|
+
*/
|
|
18
|
+
class TouchContact {
|
|
19
|
+
|
|
20
|
+
public id = 0;
|
|
21
|
+
public inUse = false;
|
|
22
|
+
public state = TouchLocationState.INVALID;
|
|
23
|
+
public x = 0;
|
|
24
|
+
public y = 0;
|
|
25
|
+
public pressure = 0;
|
|
26
|
+
public hasPrevious = false;
|
|
27
|
+
/** Previous was captured for this frame. Later events must not overwrite it. */
|
|
28
|
+
public hasFramePrevious = false;
|
|
29
|
+
public prevState = TouchLocationState.INVALID;
|
|
30
|
+
public prevX = 0;
|
|
31
|
+
public prevY = 0;
|
|
32
|
+
public prevPressure = 0;
|
|
33
|
+
/** Pressed and released before the press was published. The press is shown first. */
|
|
34
|
+
public sameFrameReleased = false;
|
|
35
|
+
|
|
36
|
+
public releaseSlot(): void {
|
|
37
|
+
this.inUse = false;
|
|
38
|
+
this.state = TouchLocationState.INVALID;
|
|
39
|
+
this.hasPrevious = false;
|
|
40
|
+
this.hasFramePrevious = false;
|
|
41
|
+
this.sameFrameReleased = false;
|
|
42
|
+
this.pressure = 0;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export class InputManager implements IInputManager {
|
|
47
|
+
|
|
48
|
+
private readonly _mouseButtonMap: { [key: number]: MouseButton } = {
|
|
49
|
+
0: MouseButton.LEFT,
|
|
50
|
+
1: MouseButton.MIDDLE,
|
|
51
|
+
2: MouseButton.RIGHT,
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
private readonly _mouseState: MouseState;
|
|
55
|
+
private readonly _mousePosition = vec2.create();
|
|
56
|
+
private readonly _previousMousePosition = vec2.create();
|
|
57
|
+
private readonly _mouseDelta = vec2.create();
|
|
58
|
+
private readonly _scrollWheelPosition = vec2.create();
|
|
59
|
+
private readonly _mouseButtonDown: { [key: number]: boolean } = {};
|
|
60
|
+
private readonly _mouseButtonReleased: { [key: number]: boolean } = {};
|
|
61
|
+
|
|
62
|
+
private readonly _touchCollection: TouchCollection;
|
|
63
|
+
private readonly _touchCapabilities: TouchPanelCapabilities;
|
|
64
|
+
private readonly _contacts: TouchContact[];
|
|
65
|
+
private _touchListening = false;
|
|
66
|
+
/** Set in update, consumed in afterUpdate. Ageing before a publish would hide the press. */
|
|
67
|
+
private _touchPublished = false;
|
|
68
|
+
|
|
69
|
+
private static readonly _PHASE_BEGIN = 0;
|
|
70
|
+
private static readonly _PHASE_MOVE = 1;
|
|
71
|
+
private static readonly _PHASE_END = 2;
|
|
72
|
+
private static readonly _PHASE_CANCEL = 3;
|
|
73
|
+
private static readonly _touchListenerOptions: AddEventListenerOptions = {passive: false};
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* The constructor.
|
|
77
|
+
* @param _framework The framework. Its window manager canvas receives the input listeners in initialize().
|
|
78
|
+
*/
|
|
79
|
+
public constructor(private readonly _framework: IFramework) {
|
|
80
|
+
|
|
81
|
+
this._mouseState = new MouseState(
|
|
82
|
+
this._mouseButtonDown, this._mouseButtonReleased,
|
|
83
|
+
this._mousePosition, this._mouseDelta, this._scrollWheelPosition
|
|
84
|
+
);
|
|
85
|
+
|
|
86
|
+
const capacity = TouchCollection.MAX_TOUCH_COUNT;
|
|
87
|
+
const contacts = new Array<TouchContact>(capacity);
|
|
88
|
+
for (let i = 0; i < capacity; i++) {
|
|
89
|
+
contacts[i] = new TouchContact();
|
|
90
|
+
}
|
|
91
|
+
this._contacts = contacts;
|
|
92
|
+
this._touchCollection = new TouchCollection(capacity);
|
|
93
|
+
this._touchCapabilities = this._createTouchCapabilities();
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
thumbstickDeadZone = 0.2;
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
getGamePadState(_gamePadIndex: number): GamePadState {
|
|
101
|
+
return new GamePadState(false, {}, {}, vec2.create(), vec2.create());
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
getKeyboardState(): KeyboardState {
|
|
105
|
+
return new KeyboardState({}, {});
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
/** @inheritDoc */
|
|
109
|
+
public getMouseState(): MouseState {
|
|
110
|
+
return this._mouseState;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
/** @inheritDoc */
|
|
114
|
+
public getTouchCollection(): TouchCollection {
|
|
115
|
+
return this._touchCollection;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
/** @inheritDoc */
|
|
119
|
+
public getTouchCapabilities(): TouchPanelCapabilities {
|
|
120
|
+
return this._touchCapabilities;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
/** @inheritDoc */
|
|
124
|
+
public initialize(): void {
|
|
125
|
+
|
|
126
|
+
const canvas = this._framework.windowManager.canvas;
|
|
127
|
+
this._handleMouseEvents(canvas);
|
|
128
|
+
this._handleTouchEvents(canvas);
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
private _handleMouseEvents(canvas: HTMLCanvasElement) {
|
|
132
|
+
|
|
133
|
+
canvas.addEventListener("mousemove", (e: MouseEvent) => {
|
|
134
|
+
this._mousePosition[0] = e.clientX;
|
|
135
|
+
this._mousePosition[1] = e.clientY;
|
|
136
|
+
});
|
|
137
|
+
|
|
138
|
+
canvas.addEventListener("mousedown", (e: MouseEvent) => {
|
|
139
|
+
const idx = e.button;
|
|
140
|
+
const btn = this._mouseButtonMap[idx] ?? MouseButton.NONE;
|
|
141
|
+
this._mouseButtonDown[btn] = true;
|
|
142
|
+
})
|
|
143
|
+
|
|
144
|
+
canvas.addEventListener("mouseup", (e: MouseEvent) => {
|
|
145
|
+
const idx = e.button;
|
|
146
|
+
const btn = this._mouseButtonMap[idx] ?? MouseButton.NONE;
|
|
147
|
+
this._mouseButtonDown[btn] = false;
|
|
148
|
+
this._mouseButtonReleased[btn] = true;
|
|
149
|
+
});
|
|
150
|
+
|
|
151
|
+
canvas.addEventListener("wheel", (e: WheelEvent) => {
|
|
152
|
+
|
|
153
|
+
let x = 0;
|
|
154
|
+
let y = 0;
|
|
155
|
+
if (e.deltaX > 0) {
|
|
156
|
+
x = 1;
|
|
157
|
+
} else if (e.deltaX < 0) {
|
|
158
|
+
x = -1;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
if (e.deltaY > 0) {
|
|
162
|
+
y = 1;
|
|
163
|
+
} else if (e.deltaY < 0) {
|
|
164
|
+
y = -1;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
vec2.set(this._scrollWheelPosition, x, y);
|
|
168
|
+
|
|
169
|
+
e.preventDefault();
|
|
170
|
+
})
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
private _handleTouchEvents(canvas: HTMLCanvasElement): void {
|
|
174
|
+
if (this._touchListening) {
|
|
175
|
+
return;
|
|
176
|
+
}
|
|
177
|
+
this._touchListening = true;
|
|
178
|
+
|
|
179
|
+
// Pan and pinch-zoom start on this canvas only. The rest of the page is left alone.
|
|
180
|
+
canvas.style.touchAction = "none";
|
|
181
|
+
|
|
182
|
+
const options = InputManager._touchListenerOptions;
|
|
183
|
+
canvas.addEventListener("touchstart", this._onTouchStart, options);
|
|
184
|
+
canvas.addEventListener("touchmove", this._onTouchMove, options);
|
|
185
|
+
canvas.addEventListener("touchend", this._onTouchEnd, options);
|
|
186
|
+
canvas.addEventListener("touchcancel", this._onTouchCancel, options);
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
private readonly _onTouchStart = (event: TouchEvent): void => {
|
|
190
|
+
this._readTouches(event, InputManager._PHASE_BEGIN);
|
|
191
|
+
this._blockBrowserTouchGesture(event);
|
|
192
|
+
};
|
|
193
|
+
|
|
194
|
+
private readonly _onTouchMove = (event: TouchEvent): void => {
|
|
195
|
+
this._readTouches(event, InputManager._PHASE_MOVE);
|
|
196
|
+
this._blockBrowserTouchGesture(event);
|
|
197
|
+
};
|
|
198
|
+
|
|
199
|
+
private readonly _onTouchEnd = (event: TouchEvent): void => {
|
|
200
|
+
this._readTouches(event, InputManager._PHASE_END);
|
|
201
|
+
};
|
|
202
|
+
|
|
203
|
+
private readonly _onTouchCancel = (event: TouchEvent): void => {
|
|
204
|
+
this._readTouches(event, InputManager._PHASE_CANCEL);
|
|
205
|
+
};
|
|
206
|
+
|
|
207
|
+
private _blockBrowserTouchGesture(event: TouchEvent): void {
|
|
208
|
+
if (event.cancelable) {
|
|
209
|
+
event.preventDefault();
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
private _readTouches(event: TouchEvent, phase: number): void {
|
|
214
|
+
const changed = event.changedTouches;
|
|
215
|
+
const length = changed.length;
|
|
216
|
+
for (let i = 0; i < length; i++) {
|
|
217
|
+
const touch = changed.item(i);
|
|
218
|
+
if (touch === null) {
|
|
219
|
+
continue;
|
|
220
|
+
}
|
|
221
|
+
if (phase === InputManager._PHASE_BEGIN) {
|
|
222
|
+
this._beginTouch(touch);
|
|
223
|
+
} else if (phase === InputManager._PHASE_MOVE) {
|
|
224
|
+
this._moveTouch(touch);
|
|
225
|
+
} else if (phase === InputManager._PHASE_CANCEL) {
|
|
226
|
+
this._cancelTouch(touch);
|
|
227
|
+
} else {
|
|
228
|
+
this._endTouch(touch);
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
this._noteTouchDevice(event);
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
private _beginTouch(touch: Touch): void {
|
|
236
|
+
if (this._findContact(touch.identifier) !== undefined) {
|
|
237
|
+
return;
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
const contact = this._acquireContact(touch.identifier);
|
|
241
|
+
if (contact === undefined) {
|
|
242
|
+
return;
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
contact.state = TouchLocationState.PRESSED;
|
|
246
|
+
contact.x = touch.clientX;
|
|
247
|
+
contact.y = touch.clientY;
|
|
248
|
+
contact.pressure = this._readPressure(touch);
|
|
249
|
+
contact.hasPrevious = false;
|
|
250
|
+
contact.hasFramePrevious = false;
|
|
251
|
+
contact.sameFrameReleased = false;
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
private _moveTouch(touch: Touch): void {
|
|
255
|
+
const contact = this._findContact(touch.identifier);
|
|
256
|
+
if (contact === undefined || this._isTerminal(contact)) {
|
|
257
|
+
return;
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
const x = touch.clientX;
|
|
261
|
+
const y = touch.clientY;
|
|
262
|
+
if (!contact.hasFramePrevious && (x !== contact.x || y !== contact.y)) {
|
|
263
|
+
this._rememberCurrentAsPrevious(contact);
|
|
264
|
+
}
|
|
265
|
+
contact.x = x;
|
|
266
|
+
contact.y = y;
|
|
267
|
+
contact.pressure = this._readPressure(touch);
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
private _endTouch(touch: Touch): void {
|
|
271
|
+
const contact = this._findContact(touch.identifier);
|
|
272
|
+
if (contact === undefined || this._isTerminal(contact)) {
|
|
273
|
+
return;
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
// A press that also ends before update stays pressed for that read, then ages to released.
|
|
277
|
+
const pressedThisFrame = contact.state === TouchLocationState.PRESSED;
|
|
278
|
+
if (!contact.hasFramePrevious) {
|
|
279
|
+
this._rememberCurrentAsPrevious(contact);
|
|
280
|
+
}
|
|
281
|
+
contact.x = touch.clientX;
|
|
282
|
+
contact.y = touch.clientY;
|
|
283
|
+
// touchend usually reports force 0. Keep the last real reading.
|
|
284
|
+
const pressure = this._readPressure(touch);
|
|
285
|
+
if (pressure > 0) {
|
|
286
|
+
contact.pressure = pressure;
|
|
287
|
+
}
|
|
288
|
+
if (pressedThisFrame) {
|
|
289
|
+
contact.sameFrameReleased = true;
|
|
290
|
+
return;
|
|
291
|
+
}
|
|
292
|
+
contact.state = TouchLocationState.RELEASED;
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
private _cancelTouch(touch: Touch): void {
|
|
296
|
+
const contact = this._findContact(touch.identifier);
|
|
297
|
+
if (contact === undefined || contact.state === TouchLocationState.CANCELLED) {
|
|
298
|
+
return;
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
// A system cancel is not a finger lift, including when the press has not been published yet.
|
|
302
|
+
if (!contact.hasFramePrevious) {
|
|
303
|
+
this._rememberCurrentAsPrevious(contact);
|
|
304
|
+
}
|
|
305
|
+
contact.x = touch.clientX;
|
|
306
|
+
contact.y = touch.clientY;
|
|
307
|
+
const pressure = this._readPressure(touch);
|
|
308
|
+
if (pressure > 0) {
|
|
309
|
+
contact.pressure = pressure;
|
|
310
|
+
}
|
|
311
|
+
contact.sameFrameReleased = false;
|
|
312
|
+
contact.state = TouchLocationState.CANCELLED;
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
private _isTerminal(contact: TouchContact): boolean {
|
|
316
|
+
return contact.state === TouchLocationState.RELEASED
|
|
317
|
+
|| contact.state === TouchLocationState.CANCELLED;
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
private _rememberCurrentAsPrevious(contact: TouchContact): void {
|
|
321
|
+
contact.prevState = contact.state;
|
|
322
|
+
contact.prevX = contact.x;
|
|
323
|
+
contact.prevY = contact.y;
|
|
324
|
+
contact.prevPressure = contact.pressure;
|
|
325
|
+
contact.hasPrevious = true;
|
|
326
|
+
contact.hasFramePrevious = true;
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
private _findContact(id: number): TouchContact | undefined {
|
|
330
|
+
const contacts = this._contacts;
|
|
331
|
+
const length = contacts.length;
|
|
332
|
+
for (let i = 0; i < length; i++) {
|
|
333
|
+
const contact = contacts[i];
|
|
334
|
+
if (contact.inUse && contact.id === id) {
|
|
335
|
+
return contact;
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
return undefined;
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
private _acquireContact(id: number): TouchContact | undefined {
|
|
342
|
+
const contacts = this._contacts;
|
|
343
|
+
const length = contacts.length;
|
|
344
|
+
for (let i = 0; i < length; i++) {
|
|
345
|
+
const contact = contacts[i];
|
|
346
|
+
if (!contact.inUse) {
|
|
347
|
+
contact.inUse = true;
|
|
348
|
+
contact.id = id;
|
|
349
|
+
return contact;
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
return undefined;
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
private _readPressure(touch: Touch): number {
|
|
356
|
+
const force = touch.force;
|
|
357
|
+
if (!(force > 0)) {
|
|
358
|
+
return 0;
|
|
359
|
+
}
|
|
360
|
+
if (force > 1) {
|
|
361
|
+
return 1;
|
|
362
|
+
}
|
|
363
|
+
return force;
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
private _createTouchCapabilities(): TouchPanelCapabilities {
|
|
367
|
+
const reported = navigator.maxTouchPoints;
|
|
368
|
+
const maximumTouchCount = reported > 0 ? reported : 0;
|
|
369
|
+
const hasPressure = maximumTouchCount > 0
|
|
370
|
+
&& typeof Touch !== "undefined"
|
|
371
|
+
&& "force" in Touch.prototype;
|
|
372
|
+
return new TouchPanelCapabilities(maximumTouchCount > 0, maximumTouchCount, hasPressure);
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
/**
|
|
376
|
+
* A touch event means a device is connected, even when maxTouchPoints is 0.
|
|
377
|
+
* Writes into the existing capabilities instance.
|
|
378
|
+
*/
|
|
379
|
+
private _noteTouchDevice(event: TouchEvent): void {
|
|
380
|
+
const changed = event.changedTouches;
|
|
381
|
+
const liveCount = event.touches.length;
|
|
382
|
+
if (changed.length === 0 && liveCount === 0) {
|
|
383
|
+
return;
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
const capabilities = this._touchCapabilities;
|
|
387
|
+
let maximumTouchCount = capabilities.maximumTouchCount;
|
|
388
|
+
if (liveCount > maximumTouchCount) {
|
|
389
|
+
maximumTouchCount = liveCount;
|
|
390
|
+
}
|
|
391
|
+
if (maximumTouchCount < 1 && changed.length > maximumTouchCount) {
|
|
392
|
+
maximumTouchCount = changed.length;
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
let hasPressure = capabilities.hasPressure;
|
|
396
|
+
if (!hasPressure) {
|
|
397
|
+
const length = changed.length;
|
|
398
|
+
for (let i = 0; i < length; i++) {
|
|
399
|
+
const touch = changed.item(i);
|
|
400
|
+
if (touch !== null && touch.force > 0) {
|
|
401
|
+
hasPressure = true;
|
|
402
|
+
break;
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
}
|
|
406
|
+
|
|
407
|
+
if (capabilities.isConnected
|
|
408
|
+
&& capabilities.maximumTouchCount === maximumTouchCount
|
|
409
|
+
&& capabilities.hasPressure === hasPressure) {
|
|
410
|
+
return;
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
capabilities.set(true, maximumTouchCount, hasPressure);
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
private _publishTouches(): void {
|
|
417
|
+
const collection = this._touchCollection;
|
|
418
|
+
collection.clear();
|
|
419
|
+
|
|
420
|
+
const contacts = this._contacts;
|
|
421
|
+
const length = contacts.length;
|
|
422
|
+
for (let i = 0; i < length; i++) {
|
|
423
|
+
const contact = contacts[i];
|
|
424
|
+
if (!contact.inUse || contact.state === TouchLocationState.INVALID) {
|
|
425
|
+
continue;
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
if (contact.hasPrevious) {
|
|
429
|
+
collection.tryAdd(
|
|
430
|
+
contact.id,
|
|
431
|
+
contact.state,
|
|
432
|
+
contact.x,
|
|
433
|
+
contact.y,
|
|
434
|
+
contact.pressure,
|
|
435
|
+
contact.prevState,
|
|
436
|
+
contact.prevX,
|
|
437
|
+
contact.prevY,
|
|
438
|
+
contact.prevPressure
|
|
439
|
+
);
|
|
440
|
+
} else {
|
|
441
|
+
collection.tryAdd(
|
|
442
|
+
contact.id,
|
|
443
|
+
contact.state,
|
|
444
|
+
contact.x,
|
|
445
|
+
contact.y,
|
|
446
|
+
contact.pressure
|
|
447
|
+
);
|
|
448
|
+
}
|
|
449
|
+
}
|
|
450
|
+
}
|
|
451
|
+
|
|
452
|
+
/**
|
|
453
|
+
* Pressed becomes moved, and a same-frame release becomes released, after the frame has read them.
|
|
454
|
+
* Released and cancelled contacts leave the pool so the next publish does not report them again.
|
|
455
|
+
*/
|
|
456
|
+
private _ageTouches(): void {
|
|
457
|
+
const contacts = this._contacts;
|
|
458
|
+
const length = contacts.length;
|
|
459
|
+
for (let i = 0; i < length; i++) {
|
|
460
|
+
const contact = contacts[i];
|
|
461
|
+
if (!contact.inUse) {
|
|
462
|
+
continue;
|
|
463
|
+
}
|
|
464
|
+
|
|
465
|
+
if (contact.state === TouchLocationState.RELEASED
|
|
466
|
+
|| contact.state === TouchLocationState.CANCELLED) {
|
|
467
|
+
contact.releaseSlot();
|
|
468
|
+
continue;
|
|
469
|
+
}
|
|
470
|
+
|
|
471
|
+
contact.prevState = contact.state;
|
|
472
|
+
contact.prevX = contact.x;
|
|
473
|
+
contact.prevY = contact.y;
|
|
474
|
+
contact.prevPressure = contact.pressure;
|
|
475
|
+
contact.hasPrevious = true;
|
|
476
|
+
contact.hasFramePrevious = true;
|
|
477
|
+
|
|
478
|
+
if (contact.state === TouchLocationState.PRESSED) {
|
|
479
|
+
contact.state = contact.sameFrameReleased
|
|
480
|
+
? TouchLocationState.RELEASED
|
|
481
|
+
: TouchLocationState.MOVED;
|
|
482
|
+
}
|
|
483
|
+
contact.sameFrameReleased = false;
|
|
484
|
+
}
|
|
485
|
+
}
|
|
486
|
+
|
|
487
|
+
/** @inheritDoc */
|
|
488
|
+
public update(): void {
|
|
489
|
+
vec2.sub(this._mouseDelta, this._mousePosition, this._previousMousePosition);
|
|
490
|
+
vec2.copy(this._previousMousePosition, this._mousePosition);
|
|
491
|
+
this._publishTouches();
|
|
492
|
+
this._touchPublished = true;
|
|
493
|
+
}
|
|
494
|
+
|
|
495
|
+
/** @inheritDoc */
|
|
496
|
+
public afterUpdate(): void {
|
|
497
|
+
vec2.set(this._scrollWheelPosition, 0, 0);
|
|
498
|
+
|
|
499
|
+
// Released is a one-frame state. Without this reset, isButtonReleased stays true forever.
|
|
500
|
+
const released = this._mouseButtonReleased;
|
|
501
|
+
for (const button in released) {
|
|
502
|
+
released[button] = false;
|
|
503
|
+
}
|
|
504
|
+
|
|
505
|
+
if (!this._touchPublished) {
|
|
506
|
+
return;
|
|
507
|
+
}
|
|
508
|
+
this._ageTouches();
|
|
509
|
+
this._touchPublished = false;
|
|
510
|
+
}
|
|
511
|
+
|
|
512
|
+
|
|
513
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The keys on the keyboard.
|
|
3
|
+
*/
|
|
4
|
+
export enum Key {
|
|
5
|
+
NONE = 0,
|
|
6
|
+
A = 1,
|
|
7
|
+
D = 2,
|
|
8
|
+
S = 3,
|
|
9
|
+
W = 4,
|
|
10
|
+
L = 5,
|
|
11
|
+
LEFTARROW = 6,
|
|
12
|
+
RIGHTARROW = 7,
|
|
13
|
+
UPARROW = 8,
|
|
14
|
+
DOWNARROW = 9,
|
|
15
|
+
NUMPAD0 = 10,
|
|
16
|
+
NUMPAD1 = 11,
|
|
17
|
+
NUMPAD2 = 12,
|
|
18
|
+
NUMPAD3 = 13,
|
|
19
|
+
NUMPAD4 = 14,
|
|
20
|
+
NUMPAD5 = 15,
|
|
21
|
+
NUMPAD6 = 16,
|
|
22
|
+
NUMPAD7 = 17,
|
|
23
|
+
NUMPAD8 = 18,
|
|
24
|
+
NUMPAD9 = 19,
|
|
25
|
+
SPACE = 20,
|
|
26
|
+
CONTROLLEFT = 21,
|
|
27
|
+
CONTROLRIGHT = 22,
|
|
28
|
+
SHIFTLEFT = 23,
|
|
29
|
+
SHIFTRIGHT = 24,
|
|
30
|
+
NUMPADSUBTRACT = 25,
|
|
31
|
+
NUMPADADD = 26,
|
|
32
|
+
MINUS = 27,
|
|
33
|
+
EQUAL = 28,
|
|
34
|
+
DELETE = 29
|
|
35
|
+
}
|