@egret/engine 0.0.0-stage → 7.0.1-rc.3
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/LICENSE +201 -0
- package/NOTICE +21 -0
- package/README.md +101 -2
- package/README.zh-CN.md +102 -0
- package/dist/Engine.d.ts +77 -0
- package/dist/Engine.js +464 -0
- package/dist/animation/index.d.ts +6 -0
- package/dist/animation/index.js +5 -0
- package/dist/animation/sequenceController.d.ts +22 -0
- package/dist/animation/sequenceController.js +618 -0
- package/dist/animation/sequenceCoordinator.d.ts +26 -0
- package/dist/animation/sequenceCoordinator.js +161 -0
- package/dist/animation/sequenceInput.d.ts +25 -0
- package/dist/animation/sequenceInput.js +108 -0
- package/dist/animation/sequenceMath.d.ts +35 -0
- package/dist/animation/sequenceMath.js +164 -0
- package/dist/animation/sequenceResetSlot.d.ts +7 -0
- package/dist/animation/sequenceResetSlot.js +367 -0
- package/dist/animation/sequenceResetTypes.d.ts +42 -0
- package/dist/animation/sequenceResetTypes.js +2 -0
- package/dist/animation/types.d.ts +69 -0
- package/dist/animation/types.js +2 -0
- package/dist/assetBundle.d.ts +52 -0
- package/dist/assetBundle.js +173 -0
- package/dist/assetGroup.d.ts +17 -0
- package/dist/assetGroup.js +332 -0
- package/dist/assetGroupTypes.d.ts +15 -0
- package/dist/assetGroupTypes.js +2 -0
- package/dist/audio.d.ts +4 -0
- package/dist/audio.js +4 -0
- package/dist/audioCues.d.ts +43 -0
- package/dist/audioCues.js +127 -0
- package/dist/audioMixer.d.ts +7 -0
- package/dist/audioMixer.js +785 -0
- package/dist/audioTypes.d.ts +233 -0
- package/dist/audioTypes.js +3 -0
- package/dist/bitmapBindingTicket.d.ts +24 -0
- package/dist/bitmapBindingTicket.js +215 -0
- package/dist/bitmapButton.d.ts +4 -0
- package/dist/bitmapButton.js +407 -0
- package/dist/bitmapButtonTypes.d.ts +29 -0
- package/dist/bitmapButtonTypes.js +2 -0
- package/dist/bitmapFontParse.d.ts +10 -0
- package/dist/bitmapFontParse.js +246 -0
- package/dist/bitmapFontTypes.d.ts +109 -0
- package/dist/bitmapFontTypes.js +2 -0
- package/dist/bitmapResourceSlot.d.ts +25 -0
- package/dist/bitmapResourceSlot.js +340 -0
- package/dist/bitmapText.d.ts +6 -0
- package/dist/bitmapText.js +320 -0
- package/dist/bitmapfont.d.ts +5 -0
- package/dist/bitmapfont.js +5 -0
- package/dist/camera.d.ts +4 -0
- package/dist/camera.js +4 -0
- package/dist/camera2d.d.ts +7 -0
- package/dist/camera2d.js +411 -0
- package/dist/cameraTypes.d.ts +114 -0
- package/dist/cameraTypes.js +2 -0
- package/dist/closeHost.d.ts +4 -0
- package/dist/closeHost.js +66 -0
- package/dist/contentArtifacts.d.ts +12 -0
- package/dist/contentArtifacts.js +153 -0
- package/dist/contentAtlasPages.d.ts +13 -0
- package/dist/contentAtlasPages.js +117 -0
- package/dist/contentLoader.d.ts +6 -0
- package/dist/contentLoader.js +327 -0
- package/dist/contentTypes.d.ts +33 -0
- package/dist/contentTypes.js +2 -0
- package/dist/createEngine.d.ts +7 -0
- package/dist/createEngine.js +25 -0
- package/dist/createEngineForProfile.d.ts +5 -0
- package/dist/createEngineForProfile.js +42 -0
- package/dist/displaySubtreeTicket.d.ts +25 -0
- package/dist/displaySubtreeTicket.js +76 -0
- package/dist/fontContentLoader.d.ts +6 -0
- package/dist/fontContentLoader.js +298 -0
- package/dist/fontContentTypes.d.ts +34 -0
- package/dist/fontContentTypes.js +2 -0
- package/dist/gameClock.d.ts +24 -0
- package/dist/gameClock.js +246 -0
- package/dist/gameClockTypes.d.ts +31 -0
- package/dist/gameClockTypes.js +2 -0
- package/dist/gameRun.d.ts +50 -0
- package/dist/gameRun.js +97 -0
- package/dist/gamepad.d.ts +5 -0
- package/dist/gamepad.js +5 -0
- package/dist/gamepadInput.d.ts +4 -0
- package/dist/gamepadInput.js +281 -0
- package/dist/gamepadKeys.d.ts +4 -0
- package/dist/gamepadKeys.js +205 -0
- package/dist/gamepadTypes.d.ts +134 -0
- package/dist/gamepadTypes.js +3 -0
- package/dist/hover.d.ts +4 -0
- package/dist/hover.js +4 -0
- package/dist/hoverInput.d.ts +8 -0
- package/dist/hoverInput.js +503 -0
- package/dist/hoverInputTypes.d.ts +119 -0
- package/dist/hoverInputTypes.js +2 -0
- package/dist/index.d.ts +49 -0
- package/dist/index.js +20 -0
- package/dist/input.d.ts +6 -0
- package/dist/input.js +5 -0
- package/dist/inputActions.d.ts +81 -0
- package/dist/inputActions.js +330 -0
- package/dist/internal/contentFactoryState.d.ts +19 -0
- package/dist/internal/contentFactoryState.js +42 -0
- package/dist/internal/mouseInputFactoryState.d.ts +57 -0
- package/dist/internal/mouseInputFactoryState.js +125 -0
- package/dist/internal/sequenceControllerFactoryState.d.ts +42 -0
- package/dist/internal/sequenceControllerFactoryState.js +98 -0
- package/dist/internal/textFieldFactoryState.d.ts +11 -0
- package/dist/internal/textFieldFactoryState.js +32 -0
- package/dist/internal/texturedFrameState.d.ts +4 -0
- package/dist/internal/texturedFrameState.js +12 -0
- package/dist/internal/uiFactoryState.d.ts +64 -0
- package/dist/internal/uiFactoryState.js +157 -0
- package/dist/internal/uiRootState.d.ts +67 -0
- package/dist/internal/uiRootState.js +103 -0
- package/dist/keyboardInput.d.ts +12 -0
- package/dist/keyboardInput.js +578 -0
- package/dist/keyboardInputTypes.d.ts +81 -0
- package/dist/keyboardInputTypes.js +2 -0
- package/dist/kit.d.ts +14 -0
- package/dist/kit.js +9 -0
- package/dist/layout.d.ts +5 -0
- package/dist/layout.js +132 -0
- package/dist/layoutTypes.d.ts +28 -0
- package/dist/layoutTypes.js +2 -0
- package/dist/manifestAssetGroup.d.ts +10 -0
- package/dist/manifestAssetGroup.js +477 -0
- package/dist/manifestResourceState.d.ts +16 -0
- package/dist/manifestResourceState.js +57 -0
- package/dist/manifestResourceTypes.d.ts +25 -0
- package/dist/manifestResourceTypes.js +2 -0
- package/dist/motion.d.ts +33 -0
- package/dist/motion.js +206 -0
- package/dist/mouseInput.d.ts +102 -0
- package/dist/mouseInput.js +562 -0
- package/dist/mouseInputTypes.d.ts +37 -0
- package/dist/mouseInputTypes.js +2 -0
- package/dist/paragraph.d.ts +8 -0
- package/dist/paragraph.js +7 -0
- package/dist/particleEmitter.d.ts +4 -0
- package/dist/particleEmitter.js +292 -0
- package/dist/particleTypes.d.ts +107 -0
- package/dist/particleTypes.js +2 -0
- package/dist/particles.d.ts +4 -0
- package/dist/particles.js +4 -0
- package/dist/physics2d.d.ts +4 -0
- package/dist/physics2d.js +4 -0
- package/dist/physics2dGeometry.d.ts +39 -0
- package/dist/physics2dGeometry.js +230 -0
- package/dist/physics2dTypes.d.ts +167 -0
- package/dist/physics2dTypes.js +2 -0
- package/dist/physics2dWorld.d.ts +4 -0
- package/dist/physics2dWorld.js +623 -0
- package/dist/pointerInput.d.ts +11 -0
- package/dist/pointerInput.js +299 -0
- package/dist/pointerInputTypes.d.ts +38 -0
- package/dist/pointerInputTypes.js +2 -0
- package/dist/random.d.ts +29 -0
- package/dist/random.js +131 -0
- package/dist/rendering/ownedPreparationFailure2D.d.ts +5 -0
- package/dist/rendering/ownedPreparationFailure2D.js +33 -0
- package/dist/rendering/packSharedDraws2D.d.ts +50 -0
- package/dist/rendering/packSharedDraws2D.js +331 -0
- package/dist/rendering/packedOrientation.d.ts +4 -0
- package/dist/rendering/packedOrientation.js +7 -0
- package/dist/rendering/prepareRectangles2D.d.ts +92 -0
- package/dist/rendering/prepareRectangles2D.js +481 -0
- package/dist/rendering/prepareSharedDraws2D.d.ts +88 -0
- package/dist/rendering/prepareSharedDraws2D.js +652 -0
- package/dist/rendering/preparedBatches2D.d.ts +17 -0
- package/dist/rendering/preparedBatches2D.js +30 -0
- package/dist/rendering/preparedSharedBatches2D.d.ts +44 -0
- package/dist/rendering/preparedSharedBatches2D.js +247 -0
- package/dist/rendering/sharedColor2D.d.ts +18 -0
- package/dist/rendering/sharedColor2D.js +68 -0
- package/dist/rendering/sharedEffects2D.d.ts +23 -0
- package/dist/rendering/sharedEffects2D.js +118 -0
- package/dist/rendering/sharedPreparationRetention2D.d.ts +120 -0
- package/dist/rendering/sharedPreparationRetention2D.js +357 -0
- package/dist/rendering/srgbBytes.d.ts +3 -0
- package/dist/rendering/srgbBytes.js +64 -0
- package/dist/rendering/texturedPreparationBudget2D.d.ts +31 -0
- package/dist/rendering/texturedPreparationBudget2D.js +81 -0
- package/dist/rendering/world3d/Animation3D.d.ts +95 -0
- package/dist/rendering/world3d/Animation3D.js +380 -0
- package/dist/rendering/world3d/AnimationTexture3D.d.ts +157 -0
- package/dist/rendering/world3d/AnimationTexture3D.js +601 -0
- package/dist/rendering/world3d/Batch3D.d.ts +71 -0
- package/dist/rendering/world3d/Batch3D.js +329 -0
- package/dist/rendering/world3d/Camera3D.d.ts +57 -0
- package/dist/rendering/world3d/Camera3D.js +129 -0
- package/dist/rendering/world3d/Character3D.d.ts +123 -0
- package/dist/rendering/world3d/Character3D.js +303 -0
- package/dist/rendering/world3d/Cloth3D.d.ts +115 -0
- package/dist/rendering/world3d/Cloth3D.js +498 -0
- package/dist/rendering/world3d/Compression3D.d.ts +21 -0
- package/dist/rendering/world3d/Compression3D.js +702 -0
- package/dist/rendering/world3d/Curves3D.d.ts +111 -0
- package/dist/rendering/world3d/Curves3D.js +455 -0
- package/dist/rendering/world3d/Decal3D.d.ts +41 -0
- package/dist/rendering/world3d/Decal3D.js +241 -0
- package/dist/rendering/world3d/Geometry3D.d.ts +85 -0
- package/dist/rendering/world3d/Geometry3D.js +326 -0
- package/dist/rendering/world3d/GeometryBuilder3D.d.ts +51 -0
- package/dist/rendering/world3d/GeometryBuilder3D.js +196 -0
- package/dist/rendering/world3d/Gizmo3D.d.ts +75 -0
- package/dist/rendering/world3d/Gizmo3D.js +512 -0
- package/dist/rendering/world3d/Gltf3D.d.ts +67 -0
- package/dist/rendering/world3d/Gltf3D.js +976 -0
- package/dist/rendering/world3d/GpuParticles3D.d.ts +107 -0
- package/dist/rendering/world3d/GpuParticles3D.js +400 -0
- package/dist/rendering/world3d/Hdr3D.d.ts +33 -0
- package/dist/rendering/world3d/Hdr3D.js +190 -0
- package/dist/rendering/world3d/Jelly3D.d.ts +75 -0
- package/dist/rendering/world3d/Jelly3D.js +266 -0
- package/dist/rendering/world3d/Ktx23D.d.ts +27 -0
- package/dist/rendering/world3d/Ktx23D.js +112 -0
- package/dist/rendering/world3d/Light3D.d.ts +75 -0
- package/dist/rendering/world3d/Light3D.js +93 -0
- package/dist/rendering/world3d/Material3D.d.ts +243 -0
- package/dist/rendering/world3d/Material3D.js +267 -0
- package/dist/rendering/world3d/Mesh3D.d.ts +108 -0
- package/dist/rendering/world3d/Mesh3D.js +323 -0
- package/dist/rendering/world3d/Meshopt3D.d.ts +12 -0
- package/dist/rendering/world3d/Meshopt3D.js +275 -0
- package/dist/rendering/world3d/Navigation3D.d.ts +173 -0
- package/dist/rendering/world3d/Navigation3D.js +971 -0
- package/dist/rendering/world3d/Object3D.d.ts +107 -0
- package/dist/rendering/world3d/Object3D.js +305 -0
- package/dist/rendering/world3d/Particles3D.d.ts +85 -0
- package/dist/rendering/world3d/Particles3D.js +274 -0
- package/dist/rendering/world3d/Physics3D.d.ts +416 -0
- package/dist/rendering/world3d/Physics3D.js +2835 -0
- package/dist/rendering/world3d/PhysicsHull3D.d.ts +35 -0
- package/dist/rendering/world3d/PhysicsHull3D.js +227 -0
- package/dist/rendering/world3d/PhysicsMesh3D.d.ts +39 -0
- package/dist/rendering/world3d/PhysicsMesh3D.js +338 -0
- package/dist/rendering/world3d/PhysicsQueries3D.d.ts +24 -0
- package/dist/rendering/world3d/PhysicsQueries3D.js +323 -0
- package/dist/rendering/world3d/PhysicsRemote3D.d.ts +174 -0
- package/dist/rendering/world3d/PhysicsRemote3D.js +534 -0
- package/dist/rendering/world3d/Ragdoll3D.d.ts +69 -0
- package/dist/rendering/world3d/Ragdoll3D.js +200 -0
- package/dist/rendering/world3d/Raycast3D.d.ts +37 -0
- package/dist/rendering/world3d/Raycast3D.js +246 -0
- package/dist/rendering/world3d/RenderList3D.d.ts +88 -0
- package/dist/rendering/world3d/RenderList3D.js +490 -0
- package/dist/rendering/world3d/Retarget3D.d.ts +20 -0
- package/dist/rendering/world3d/Retarget3D.js +185 -0
- package/dist/rendering/world3d/Serialize3D.d.ts +49 -0
- package/dist/rendering/world3d/Serialize3D.js +607 -0
- package/dist/rendering/world3d/StateMachine3D.d.ts +78 -0
- package/dist/rendering/world3d/StateMachine3D.js +277 -0
- package/dist/rendering/world3d/Terrain3D.d.ts +227 -0
- package/dist/rendering/world3d/Terrain3D.js +803 -0
- package/dist/rendering/world3d/Text3D.d.ts +90 -0
- package/dist/rendering/world3d/Text3D.js +558 -0
- package/dist/rendering/world3d/Texture3D.d.ts +133 -0
- package/dist/rendering/world3d/Texture3D.js +252 -0
- package/dist/rendering/world3d/Trail3D.d.ts +59 -0
- package/dist/rendering/world3d/Trail3D.js +193 -0
- package/dist/rendering/world3d/Vehicle3D.d.ts +97 -0
- package/dist/rendering/world3d/Vehicle3D.js +226 -0
- package/dist/rendering/world3d/VolumetricFog3D.d.ts +55 -0
- package/dist/rendering/world3d/VolumetricFog3D.js +229 -0
- package/dist/rendering/world3d/Water3D.d.ts +163 -0
- package/dist/rendering/world3d/Water3D.js +606 -0
- package/dist/rendering/world3d/core3D.d.ts +34 -0
- package/dist/rendering/world3d/core3D.js +99 -0
- package/dist/rendering/world3d/debug3D.d.ts +64 -0
- package/dist/rendering/world3d/debug3D.js +257 -0
- package/dist/rendering/world3d/decoders3D.d.ts +42 -0
- package/dist/rendering/world3d/decoders3D.js +133 -0
- package/dist/rendering/world3d/geometries3D.d.ts +99 -0
- package/dist/rendering/world3d/geometries3D.js +605 -0
- package/dist/rendering/world3d/helpers3D.d.ts +65 -0
- package/dist/rendering/world3d/helpers3D.js +177 -0
- package/dist/rendering/world3d/index.d.ts +91 -0
- package/dist/rendering/world3d/index.js +56 -0
- package/dist/rendering/world3d/math3D.d.ts +78 -0
- package/dist/rendering/world3d/math3D.js +640 -0
- package/dist/rendering/world3d/primitives3D.d.ts +60 -0
- package/dist/rendering/world3d/primitives3D.js +196 -0
- package/dist/resources.d.ts +8 -0
- package/dist/resources.js +6 -0
- package/dist/saveStore.d.ts +56 -0
- package/dist/saveStore.js +163 -0
- package/dist/semanticList.d.ts +122 -0
- package/dist/semanticList.js +174 -0
- package/dist/semanticTree.d.ts +10 -0
- package/dist/semanticTree.js +532 -0
- package/dist/semanticTypes.d.ts +167 -0
- package/dist/semanticTypes.js +2 -0
- package/dist/semantics.d.ts +6 -0
- package/dist/semantics.js +5 -0
- package/dist/sequencePlayback.d.ts +19 -0
- package/dist/sequencePlayback.js +391 -0
- package/dist/sequencePlaybackTypes.d.ts +21 -0
- package/dist/sequencePlaybackTypes.js +2 -0
- package/dist/sequenceTargetClaims.d.ts +10 -0
- package/dist/sequenceTargetClaims.js +31 -0
- package/dist/srgbBytes.d.ts +3 -0
- package/dist/srgbBytes.js +64 -0
- package/dist/startEngine.d.ts +5 -0
- package/dist/startEngine.js +31 -0
- package/dist/surfaceOwnership.d.ts +3 -0
- package/dist/surfaceOwnership.js +15 -0
- package/dist/text.d.ts +23 -0
- package/dist/text.js +4 -0
- package/dist/textField.d.ts +6 -0
- package/dist/textField.js +6 -0
- package/dist/tileMapDraw.d.ts +7 -0
- package/dist/tileMapDraw.js +310 -0
- package/dist/tiledImport.d.ts +9 -0
- package/dist/tiledImport.js +357 -0
- package/dist/tilemap.d.ts +5 -0
- package/dist/tilemap.js +5 -0
- package/dist/tilemapTypes.d.ts +169 -0
- package/dist/tilemapTypes.js +2 -0
- package/dist/tween.d.ts +15 -0
- package/dist/tween.js +329 -0
- package/dist/tweenTypes.d.ts +27 -0
- package/dist/tweenTypes.js +2 -0
- package/dist/ui/controlKeys.d.ts +109 -0
- package/dist/ui/controlKeys.js +249 -0
- package/dist/ui/controls.d.ts +52 -0
- package/dist/ui/controls.js +288 -0
- package/dist/ui/editing.d.ts +3 -0
- package/dist/ui/editing.js +3 -0
- package/dist/ui/index.d.ts +19 -0
- package/dist/ui/index.js +11 -0
- package/dist/ui/keyboardFocus.d.ts +32 -0
- package/dist/ui/keyboardFocus.js +146 -0
- package/dist/ui/layerTypes.d.ts +91 -0
- package/dist/ui/layerTypes.js +2 -0
- package/dist/ui/layers.d.ts +4 -0
- package/dist/ui/layers.js +586 -0
- package/dist/ui/leafContent.d.ts +21 -0
- package/dist/ui/leafContent.js +136 -0
- package/dist/ui/rangeControl.d.ts +50 -0
- package/dist/ui/rangeControl.js +167 -0
- package/dist/ui/scrollControl.d.ts +72 -0
- package/dist/ui/scrollControl.js +218 -0
- package/dist/ui/stateControls.d.ts +82 -0
- package/dist/ui/stateControls.js +328 -0
- package/dist/ui/textEditor.d.ts +53 -0
- package/dist/ui/textEditor.js +370 -0
- package/dist/ui/textEditorTypes.d.ts +78 -0
- package/dist/ui/textEditorTypes.js +2 -0
- package/dist/ui/textFieldControl.d.ts +96 -0
- package/dist/ui/textFieldControl.js +259 -0
- package/dist/ui/theme.d.ts +59 -0
- package/dist/ui/theme.js +165 -0
- package/dist/ui/types.d.ts +265 -0
- package/dist/ui/types.js +2 -0
- package/dist/ui/uiRoot.d.ts +4 -0
- package/dist/ui/uiRoot.js +1497 -0
- package/dist/ui/uiRootDisplay.d.ts +46 -0
- package/dist/ui/uiRootDisplay.js +148 -0
- package/dist/ui/uiRootModel.d.ts +112 -0
- package/dist/ui/uiRootModel.js +60 -0
- package/dist/ui/virtualList.d.ts +20 -0
- package/dist/ui/virtualList.js +105 -0
- package/dist/video.d.ts +4 -0
- package/dist/video.js +4 -0
- package/dist/videoPlayer.d.ts +4 -0
- package/dist/videoPlayer.js +215 -0
- package/dist/videoTypes.d.ts +74 -0
- package/dist/videoTypes.js +2 -0
- package/dist/web/BrowserAssetBundle.d.ts +39 -0
- package/dist/web/BrowserAssetBundle.js +136 -0
- package/dist/web/BrowserAudio.d.ts +41 -0
- package/dist/web/BrowserAudio.js +473 -0
- package/dist/web/BrowserFrameLoop.d.ts +65 -0
- package/dist/web/BrowserFrameLoop.js +125 -0
- package/dist/web/BrowserGame.d.ts +112 -0
- package/dist/web/BrowserGame.js +352 -0
- package/dist/web/BrowserGamepadInput.d.ts +35 -0
- package/dist/web/BrowserGamepadInput.js +134 -0
- package/dist/web/BrowserHoverInput.d.ts +24 -0
- package/dist/web/BrowserHoverInput.js +266 -0
- package/dist/web/BrowserImageTextures.d.ts +66 -0
- package/dist/web/BrowserImageTextures.js +169 -0
- package/dist/web/BrowserInputActions.d.ts +53 -0
- package/dist/web/BrowserInputActions.js +342 -0
- package/dist/web/BrowserKeyboardInput.d.ts +4 -0
- package/dist/web/BrowserKeyboardInput.js +223 -0
- package/dist/web/BrowserPlay.d.ts +289 -0
- package/dist/web/BrowserPlay.js +1301 -0
- package/dist/web/BrowserPointerInput.d.ts +4 -0
- package/dist/web/BrowserPointerInput.js +511 -0
- package/dist/web/BrowserSemantics.d.ts +34 -0
- package/dist/web/BrowserSemantics.js +418 -0
- package/dist/web/BrowserStatsPanel.d.ts +46 -0
- package/dist/web/BrowserStatsPanel.js +137 -0
- package/dist/web/BrowserStorage.d.ts +33 -0
- package/dist/web/BrowserStorage.js +132 -0
- package/dist/web/BrowserTextEditor.d.ts +49 -0
- package/dist/web/BrowserTextEditor.js +839 -0
- package/dist/web/BrowserTextInput.d.ts +83 -0
- package/dist/web/BrowserTextInput.js +524 -0
- package/dist/web/BrowserTextureProvider.d.ts +52 -0
- package/dist/web/BrowserTextureProvider.js +935 -0
- package/dist/web/BrowserVideo.d.ts +28 -0
- package/dist/web/BrowserVideo.js +211 -0
- package/dist/web/CanvasKitFontSetProvider.d.ts +29 -0
- package/dist/web/CanvasKitFontSetProvider.js +215 -0
- package/dist/web/CanvasKitParagraphProvider.d.ts +169 -0
- package/dist/web/CanvasKitParagraphProvider.js +691 -0
- package/dist/web/CanvasTextRasterProvider.d.ts +4 -0
- package/dist/web/CanvasTextRasterProvider.js +312 -0
- package/dist/web/ManifestByteSource.d.ts +147 -0
- package/dist/web/ManifestByteSource.js +974 -0
- package/dist/web/ManifestFontContentLoader.d.ts +12 -0
- package/dist/web/ManifestFontContentLoader.js +30 -0
- package/dist/web/MouseInput.d.ts +4 -0
- package/dist/web/MouseInput.js +218 -0
- package/dist/web/WebGL2Host.d.ts +5 -0
- package/dist/web/WebGL2Host.js +2672 -0
- package/dist/web/WebGPUHost.d.ts +87 -0
- package/dist/web/WebGPUHost.js +3349 -0
- package/dist/web/audio.d.ts +3 -0
- package/dist/web/audio.js +4 -0
- package/dist/web/canvasKitParagraphGeometry.d.ts +27 -0
- package/dist/web/canvasKitParagraphGeometry.js +83 -0
- package/dist/web/editing.d.ts +5 -0
- package/dist/web/editing.js +4 -0
- package/dist/web/editorFonts.d.ts +50 -0
- package/dist/web/editorFonts.js +297 -0
- package/dist/web/game.d.ts +5 -0
- package/dist/web/game.js +6 -0
- package/dist/web/gamepad.d.ts +3 -0
- package/dist/web/gamepad.js +4 -0
- package/dist/web/hover.d.ts +3 -0
- package/dist/web/hover.js +4 -0
- package/dist/web/image.d.ts +4 -0
- package/dist/web/image.js +4 -0
- package/dist/web/imageProjections2D.d.ts +14 -0
- package/dist/web/imageProjections2D.js +2 -0
- package/dist/web/input.d.ts +6 -0
- package/dist/web/input.js +4 -0
- package/dist/web/keyboard.d.ts +3 -0
- package/dist/web/keyboard.js +3 -0
- package/dist/web/kit.d.ts +10 -0
- package/dist/web/kit.js +7 -0
- package/dist/web/loop.d.ts +3 -0
- package/dist/web/loop.js +4 -0
- package/dist/web/paragraph.d.ts +6 -0
- package/dist/web/paragraph.js +4 -0
- package/dist/web/play.d.ts +5 -0
- package/dist/web/play.js +6 -0
- package/dist/web/playSfx.d.ts +36 -0
- package/dist/web/playSfx.js +112 -0
- package/dist/web/pointer.d.ts +3 -0
- package/dist/web/pointer.js +3 -0
- package/dist/web/prepareSharedSubmission2D.d.ts +27 -0
- package/dist/web/prepareSharedSubmission2D.js +57 -0
- package/dist/web/resources.d.ts +27 -0
- package/dist/web/resources.js +96 -0
- package/dist/web/semantics.d.ts +3 -0
- package/dist/web/semantics.js +4 -0
- package/dist/web/sharedDeviceSession.d.ts +64 -0
- package/dist/web/sharedDeviceSession.js +2 -0
- package/dist/web/sharedEffectShaders.d.ts +9 -0
- package/dist/web/sharedEffectShaders.js +165 -0
- package/dist/web/sharedFrameUpload.d.ts +25 -0
- package/dist/web/sharedFrameUpload.js +2 -0
- package/dist/web/sharedHostDeferred.d.ts +7 -0
- package/dist/web/sharedHostDeferred.js +12 -0
- package/dist/web/sharedRetentionLedger.d.ts +85 -0
- package/dist/web/sharedRetentionLedger.js +391 -0
- package/dist/web/sharedSubmissionStorage2D.d.ts +56 -0
- package/dist/web/sharedSubmissionStorage2D.js +73 -0
- package/dist/web/sharedWebGL2Arena.d.ts +40 -0
- package/dist/web/sharedWebGL2Arena.js +77 -0
- package/dist/web/sharedWebGL2Options.d.ts +30 -0
- package/dist/web/sharedWebGL2Options.js +96 -0
- package/dist/web/sharedWebGL2Shaders.d.ts +20 -0
- package/dist/web/sharedWebGL2Shaders.js +314 -0
- package/dist/web/sharedWebGPUOptions.d.ts +37 -0
- package/dist/web/sharedWebGPUOptions.js +126 -0
- package/dist/web/text.d.ts +3 -0
- package/dist/web/text.js +3 -0
- package/dist/web/textInput.d.ts +3 -0
- package/dist/web/textInput.js +3 -0
- package/dist/web/video.d.ts +3 -0
- package/dist/web/video.js +4 -0
- package/dist/web/webgl2.d.ts +7 -0
- package/dist/web/webgl2.js +4 -0
- package/dist/web/webgl2LayerState.d.ts +50 -0
- package/dist/web/webgl2LayerState.js +102 -0
- package/dist/web/webgl2Native.d.ts +70 -0
- package/dist/web/webgl2Native.js +568 -0
- package/dist/web/webgl2Types.d.ts +132 -0
- package/dist/web/webgl2Types.js +2 -0
- package/dist/web/webgpu.d.ts +6 -0
- package/dist/web/webgpu.js +2 -0
- package/dist/web/webgpuBindingCache.d.ts +26 -0
- package/dist/web/webgpuBindingCache.js +223 -0
- package/dist/web/webgpuBufferPool.d.ts +51 -0
- package/dist/web/webgpuBufferPool.js +58 -0
- package/dist/web/webgpuImageResidency.d.ts +53 -0
- package/dist/web/webgpuImageResidency.js +61 -0
- package/dist/web/webgpuLifetime.d.ts +45 -0
- package/dist/web/webgpuLifetime.js +64 -0
- package/dist/web/webgpuRetentionPool.d.ts +66 -0
- package/dist/web/webgpuRetentionPool.js +84 -0
- package/dist/web/webgpuSharedPass.d.ts +7 -0
- package/dist/web/webgpuSharedPass.js +211 -0
- package/dist/web/webgpuSharedResolvePass.d.ts +3 -0
- package/dist/web/webgpuSharedResolvePass.js +29 -0
- package/dist/web/world3d/Audio3D.d.ts +68 -0
- package/dist/web/world3d/Audio3D.js +212 -0
- package/dist/web/world3d/BrowserPlay3D.d.ts +182 -0
- package/dist/web/world3d/BrowserPlay3D.js +851 -0
- package/dist/web/world3d/FlyControls3D.d.ts +55 -0
- package/dist/web/world3d/FlyControls3D.js +160 -0
- package/dist/web/world3d/FollowControls3D.d.ts +28 -0
- package/dist/web/world3d/FollowControls3D.js +117 -0
- package/dist/web/world3d/OrbitControls3D.d.ts +55 -0
- package/dist/web/world3d/OrbitControls3D.js +187 -0
- package/dist/web/world3d/TransformControls3D.d.ts +34 -0
- package/dist/web/world3d/TransformControls3D.js +125 -0
- package/dist/web/world3d/WebGL2Renderer3D.d.ts +133 -0
- package/dist/web/world3d/WebGL2Renderer3D.js +1173 -0
- package/dist/web/world3d/WebGPURenderer3D.d.ts +110 -0
- package/dist/web/world3d/WebGPURenderer3D.js +1915 -0
- package/dist/web/world3d/World3DView.d.ts +51 -0
- package/dist/web/world3d/World3DView.js +77 -0
- package/dist/web/world3d/app3D.d.ts +136 -0
- package/dist/web/world3d/app3D.js +304 -0
- package/dist/web/world3d/assets3D.d.ts +38 -0
- package/dist/web/world3d/assets3D.js +112 -0
- package/dist/web/world3d/atmosphere3D.d.ts +47 -0
- package/dist/web/world3d/atmosphere3D.js +178 -0
- package/dist/web/world3d/frame3D.d.ts +142 -0
- package/dist/web/world3d/frame3D.js +388 -0
- package/dist/web/world3d/gpuResources3D.d.ts +98 -0
- package/dist/web/world3d/gpuResources3D.js +901 -0
- package/dist/web/world3d/host3D.d.ts +23 -0
- package/dist/web/world3d/host3D.js +61 -0
- package/dist/web/world3d/index.d.ts +38 -0
- package/dist/web/world3d/index.js +23 -0
- package/dist/web/world3d/loaders3D.d.ts +26 -0
- package/dist/web/world3d/loaders3D.js +138 -0
- package/dist/web/world3d/markers3D.d.ts +49 -0
- package/dist/web/world3d/markers3D.js +130 -0
- package/dist/web/world3d/materialWebGL23D.d.ts +34 -0
- package/dist/web/world3d/materialWebGL23D.js +218 -0
- package/dist/web/world3d/overlay3D.d.ts +28 -0
- package/dist/web/world3d/overlay3D.js +170 -0
- package/dist/web/world3d/post3D.d.ts +112 -0
- package/dist/web/world3d/post3D.js +459 -0
- package/dist/web/world3d/postWebGL23D.d.ts +24 -0
- package/dist/web/world3d/postWebGL23D.js +237 -0
- package/dist/web/world3d/postWebGPU3D.d.ts +23 -0
- package/dist/web/world3d/postWebGPU3D.js +255 -0
- package/dist/web/world3d/probe3D.d.ts +14 -0
- package/dist/web/world3d/probe3D.js +66 -0
- package/dist/web/world3d/shaders3D.d.ts +43 -0
- package/dist/web/world3d/shaders3D.js +851 -0
- package/dist/web/world3d/stats3D.d.ts +31 -0
- package/dist/web/world3d/stats3D.js +80 -0
- package/dist/web/world3d/webGL2FrameMetrics3D.d.ts +66 -0
- package/dist/web/world3d/webGL2FrameMetrics3D.js +185 -0
- package/dist/web/world3d/webgpu.d.ts +35 -0
- package/dist/web/world3d/webgpu.js +22 -0
- package/dist/web/world3d/webgpuPacking3D.d.ts +13 -0
- package/dist/web/world3d/webgpuPacking3D.js +85 -0
- package/dist/web/world3d/wgsl3D.d.ts +68 -0
- package/dist/web/world3d/wgsl3D.js +781 -0
- package/package.json +220 -4
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
2
|
+
// The sRGB transfer of each byte, decoded to linear light: the value of
|
|
3
|
+
// c <= 0.04045 ? c / 12.92 : ((c + 0.055) / 1.055) ** 2.4 for c = byte / 255,
|
|
4
|
+
// written out as numbers. The power is not computed when a game runs, because JavaScript engines differ in its last
|
|
5
|
+
// bit, and a frame prepared from the same scene must hold the same numbers in every one of them.
|
|
6
|
+
// packages/engine/rendering/srgbBytes.ts and packages/runtime/src/srgbBytes.ts hold the same table: the three sources may
|
|
7
|
+
// not import each other, and tests/srgb-byte-table.test.mjs requires them to be equal.
|
|
8
|
+
const TABLE = Object.freeze([
|
|
9
|
+
0, 0.0003035269835488375, 0.000607053967097675, 0.0009105809506465125, 0.00121410793419535, 0.0015176349177441874,
|
|
10
|
+
0.001821161901293025, 0.0021246888848418626, 0.0024282158683907, 0.0027317428519395373, 0.003035269835488375,
|
|
11
|
+
0.003346535763899161, 0.003676507324047436, 0.004024717018496307, 0.004391442037410293, 0.004776953480693729,
|
|
12
|
+
0.005181516702338386, 0.005605391624202723, 0.006048833022857054, 0.006512090792594475, 0.006995410187265387,
|
|
13
|
+
0.007499032043226175, 0.008023192985384994, 0.008568125618069307, 0.009134058702220787, 0.00972121732023785,
|
|
14
|
+
0.010329823029626936, 0.010960094006488246, 0.011612245179743885, 0.012286488356915872, 0.012983032342173012,
|
|
15
|
+
0.013702083047289686, 0.014443843596092545, 0.01520851442291271, 0.01599629336550963, 0.016807375752887384,
|
|
16
|
+
0.017641954488384078, 0.018500220128379697, 0.019382360956935723, 0.0202885630566524, 0.021219010376003555,
|
|
17
|
+
0.02217388479338738, 0.02315336617811041, 0.024157632448504756, 0.02518685962736163, 0.026241221894849898,
|
|
18
|
+
0.027320891639074894, 0.028426039504420793, 0.0295568344378088, 0.030713443732993635, 0.03189603307301153,
|
|
19
|
+
0.033104766570885055, 0.03433980680868217, 0.03560131487502034, 0.03688945040110004, 0.0382043715953465,
|
|
20
|
+
0.03954623527673284, 0.04091519690685319, 0.042311410620809675, 0.043735029256973465, 0.04518620438567554,
|
|
21
|
+
0.046665086336880095, 0.04817182422688942, 0.04970656598412723, 0.05126945837404324, 0.052860647023180246,
|
|
22
|
+
0.05448027644244237, 0.05612849004960009, 0.05780543019106723, 0.0595112381629812, 0.06124605423161761,
|
|
23
|
+
0.06301001765316767, 0.06480326669290577, 0.06662593864377289, 0.06847816984440017, 0.07036009569659588,
|
|
24
|
+
0.07227185068231748, 0.07421356838014963, 0.07618538148130785, 0.07818742180518633, 0.08021982031446832,
|
|
25
|
+
0.0822827071298148, 0.08437621154414882, 0.08650046203654976, 0.08865558628577294, 0.09084171118340768,
|
|
26
|
+
0.09305896284668745, 0.0953074666309647, 0.09758734714186246, 0.09989872824711389, 0.10224173308810132,
|
|
27
|
+
0.10461648409110419, 0.10702310297826761, 0.10946171077829933, 0.1119324278369056, 0.11443537382697373,
|
|
28
|
+
0.11697066775851084, 0.11953842798834562, 0.12213877222960187, 0.12477181756095049, 0.12743768043564743,
|
|
29
|
+
0.1301364766903643, 0.13286832155381798, 0.13563332965520566, 0.13843161503245183, 0.14126329114027164,
|
|
30
|
+
0.14412847085805777, 0.14702726649759498, 0.14995978981060856, 0.15292615199615017, 0.1559264637078274,
|
|
31
|
+
0.1589608350608804, 0.162029375639111, 0.1651321945016676, 0.16826940018969075, 0.1714411007328226,
|
|
32
|
+
0.17464740365558504, 0.17788841598362912, 0.18116424424986022, 0.184474994500441, 0.18782077230067787,
|
|
33
|
+
0.19120168274079138, 0.1946178304415758, 0.19806931955994886, 0.20155625379439707, 0.20507873639031693,
|
|
34
|
+
0.20863687014525575, 0.21223075741405523, 0.21586050011389926, 0.2195261997292692, 0.2232279573168085,
|
|
35
|
+
0.22696587351009836, 0.23074004852434915, 0.23455058216100522, 0.238397573812271, 0.24228112246555486,
|
|
36
|
+
0.24620132670783548, 0.25015828472995344, 0.25415209433082675, 0.2581828529215958, 0.26225065752969623,
|
|
37
|
+
0.26635560480286247, 0.2704977910130658, 0.27467731206038465, 0.2788942634768104, 0.2831487404299921,
|
|
38
|
+
0.2874408377269175, 0.29177064981753587, 0.2961382707983211, 0.3005437944157765, 0.3049873140698863,
|
|
39
|
+
0.30946892281750854, 0.31398871337571754, 0.31854677812509186, 0.32314320911295075, 0.3277780980565422,
|
|
40
|
+
0.33245153634617935, 0.33716361504833037, 0.3419144249086609, 0.3467040563550296, 0.35153259950043936,
|
|
41
|
+
0.3564001441459435, 0.3613067797835095, 0.3662525955988395, 0.3712376804741491, 0.3762621229909065,
|
|
42
|
+
0.38132601143253014, 0.386429433787049, 0.39157247774972326, 0.39675523072562685, 0.4019777798321958,
|
|
43
|
+
0.4072402119017367, 0.41254261348390375, 0.4178850708481375, 0.4232676699860717, 0.4286904966139066,
|
|
44
|
+
0.43415363617474895, 0.4396571738409188, 0.44520119451622786, 0.45078578283822346, 0.45641102318040466,
|
|
45
|
+
0.4620769996544071, 0.467783796112159, 0.47353149614800955, 0.4793201831008268, 0.4851499400560704,
|
|
46
|
+
0.4910208498478356, 0.4969329950608704, 0.5028864580325687, 0.5088813208549338, 0.5149176653765214,
|
|
47
|
+
0.5209955732043543, 0.5271151257058131, 0.5332764040105052, 0.5394794890121072, 0.5457244613701866,
|
|
48
|
+
0.5520114015120001, 0.5583403896342679, 0.5647115057049292, 0.5711248294648731, 0.5775804404296506,
|
|
49
|
+
0.5840784178911641, 0.5906188409193369, 0.5972017883637634, 0.6038273388553378, 0.6104955708078648,
|
|
50
|
+
0.6172065624196511, 0.6239603916750761, 0.6307571363461468, 0.6375968739940326, 0.6444796819705821,
|
|
51
|
+
0.6514056374198242, 0.6583748172794485, 0.665387298282272, 0.6724431569576875, 0.6795424696330938, 0.6866853124353135,
|
|
52
|
+
0.6938717612919899, 0.7011018919329731, 0.7083757798916868, 0.7156935005064807, 0.7230551289219693,
|
|
53
|
+
0.7304607400903537, 0.7379104087727308, 0.7454042095403874, 0.7529422167760779, 0.7605245046752924, 0.768151147247507,
|
|
54
|
+
0.7758222183174236, 0.7835377915261935, 0.7912979403326302, 0.799102738014409, 0.8069522576692516, 0.8148465722161012,
|
|
55
|
+
0.8227857543962835, 0.8307698767746546, 0.83879901174074, 0.846873231509858, 0.8549926081242338, 0.8631572134541023,
|
|
56
|
+
0.8713671191987972, 0.8796223968878317, 0.8879231178819663, 0.8962693533742664, 0.9046611743911496,
|
|
57
|
+
0.9130986517934192, 0.9215818562772946, 0.9301108583754237, 0.938685728457888, 0.9473065367331999, 0.9559733532492861,
|
|
58
|
+
0.9646862478944651, 0.9734452903984125, 0.9822505503331171, 0.9911020971138298, 1
|
|
59
|
+
]);
|
|
60
|
+
/** The linear-light value of an sRGB byte; only the low eight bits of `code` are read. */
|
|
61
|
+
export function decodeSRGBByte(code) {
|
|
62
|
+
return TABLE[code & 255];
|
|
63
|
+
}
|
|
64
|
+
//# sourceMappingURL=srgbBytes.js.map
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { CapturedEngineFramePorts, Engine, EngineOptions } from './Engine.js';
|
|
2
|
+
import type { AdmittedGameClockOptions } from './gameClock.js';
|
|
3
|
+
/** Admission supplies stable internal options; both factories share one owner. */
|
|
4
|
+
export declare function startEngine(options: EngineOptions, timeoutMs: number, ports: CapturedEngineFramePorts, clockOptions: AdmittedGameClockOptions): Promise<Engine>;
|
|
5
|
+
//# sourceMappingURL=startEngine.d.ts.map
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { EgretError } from '@egret/runtime';
|
|
2
|
+
import { constructEngine } from './Engine.js';
|
|
3
|
+
import { reserveSurface } from './surfaceOwnership.js';
|
|
4
|
+
import { markMouseInputEngineStarted } from './internal/mouseInputFactoryState.js';
|
|
5
|
+
/** Admission supplies stable internal options; both factories share one owner. */
|
|
6
|
+
export async function startEngine(options, timeoutMs, ports, clockOptions) {
|
|
7
|
+
const host = options.host;
|
|
8
|
+
const surface = host.surface;
|
|
9
|
+
const releaseSurface = reserveSurface(surface);
|
|
10
|
+
const engine = constructEngine(options, timeoutMs, surface, releaseSurface, ports, clockOptions);
|
|
11
|
+
try {
|
|
12
|
+
await host.start?.();
|
|
13
|
+
markMouseInputEngineStarted(engine);
|
|
14
|
+
return engine;
|
|
15
|
+
}
|
|
16
|
+
catch (cause) {
|
|
17
|
+
const cleanupErrors = [];
|
|
18
|
+
try {
|
|
19
|
+
await engine.dispose();
|
|
20
|
+
}
|
|
21
|
+
catch (cleanupError) {
|
|
22
|
+
if (cleanupError instanceof EgretError && cleanupError.code === 'ENGINE_CLOSE_FAILED') {
|
|
23
|
+
cleanupErrors.push(cleanupError.cause, ...cleanupError.cleanupErrors);
|
|
24
|
+
}
|
|
25
|
+
else
|
|
26
|
+
cleanupErrors.push(cleanupError);
|
|
27
|
+
}
|
|
28
|
+
throw new EgretError('ENGINE_START_FAILED', { cause, cleanupErrors });
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=startEngine.js.map
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { EgretError } from "@egret/runtime";
|
|
2
|
+
const reservations = new WeakMap();
|
|
3
|
+
/** Reserve before startup; release only after host.close successfully resolves. */
|
|
4
|
+
export function reserveSurface(surface) {
|
|
5
|
+
if (reservations.has(surface))
|
|
6
|
+
throw new EgretError("SURFACE_IN_USE");
|
|
7
|
+
// Token identity prevents an old release closure clearing a later reservation.
|
|
8
|
+
const reservation = {};
|
|
9
|
+
reservations.set(surface, reservation);
|
|
10
|
+
return () => {
|
|
11
|
+
if (reservations.get(surface) === reservation)
|
|
12
|
+
reservations.delete(surface);
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=surfaceOwnership.js.map
|
package/dist/text.d.ts
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/** Share the explicit runtime entry's factory and owned public type identities. */
|
|
2
|
+
export { createTextRasterCache } from '@egret/runtime/text';
|
|
3
|
+
export type * from '@egret/runtime/text';
|
|
4
|
+
import type { DisplayObject } from '@egret/runtime';
|
|
5
|
+
import type { TextRasterMetrics, TextRasterRequestInput } from '@egret/runtime/text';
|
|
6
|
+
export { createTextField } from './textField.js';
|
|
7
|
+
declare const textFieldBrand: unique symbol;
|
|
8
|
+
export interface TextFieldStatus {
|
|
9
|
+
readonly state: 'unprepared' | 'ready' | 'disposed';
|
|
10
|
+
readonly desiredRevision: number;
|
|
11
|
+
readonly committedRevision: number | undefined;
|
|
12
|
+
readonly pending: boolean;
|
|
13
|
+
readonly metrics: TextRasterMetrics | undefined;
|
|
14
|
+
}
|
|
15
|
+
/** Factory-produced noneditable leaf; the brand has no runtime value. */
|
|
16
|
+
export interface TextField extends DisplayObject {
|
|
17
|
+
readonly [textFieldBrand]: true;
|
|
18
|
+
setRequest(input: TextRasterRequestInput): void;
|
|
19
|
+
prepare(): Promise<TextRasterMetrics>;
|
|
20
|
+
getStatus(): TextFieldStatus;
|
|
21
|
+
dispose(): void;
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=text.d.ts.map
|
package/dist/text.js
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { Scope } from '@egret/runtime';
|
|
2
|
+
import type { Engine } from './Engine.js';
|
|
3
|
+
import type { TextField, TextRasterCache } from './text.js';
|
|
4
|
+
/** Public explicit entry; shape, proxies and borrowed identities grant no authority. */
|
|
5
|
+
export declare function createTextField(engine: Engine, scope: Scope, cache: TextRasterCache): TextField;
|
|
6
|
+
//# sourceMappingURL=textField.d.ts.map
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { requireTextFieldEngine } from './internal/textFieldFactoryState.js';
|
|
2
|
+
/** Public explicit entry; shape, proxies and borrowed identities grant no authority. */
|
|
3
|
+
export function createTextField(engine, scope, cache) {
|
|
4
|
+
return requireTextFieldEngine(engine).construct(scope, cache);
|
|
5
|
+
}
|
|
6
|
+
//# sourceMappingURL=textField.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { TileMap, TileMapOptions } from './tilemapTypes.js';
|
|
2
|
+
/**
|
|
3
|
+
* A map drawn from its tilesets. Each tile layer is a container of chunks, and each chunk one mesh
|
|
4
|
+
* for each tileset it draws from, so that a large map is a few hundred meshes, not a node per tile.
|
|
5
|
+
*/
|
|
6
|
+
export declare function createTileMap(options: TileMapOptions): TileMap;
|
|
7
|
+
//# sourceMappingURL=tileMapDraw.d.ts.map
|
|
@@ -0,0 +1,310 @@
|
|
|
1
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
2
|
+
import { DisplayObjectContainer, EgretError, Mesh2D } from '@egret/runtime';
|
|
3
|
+
import { createTexturedGeometry2D } from '@egret/contracts';
|
|
4
|
+
import { TILE_FLIP_MASK } from './tiledImport.js';
|
|
5
|
+
const FLIP_H = 0x80000000, FLIP_V = 0x40000000, FLIP_D = 0x20000000;
|
|
6
|
+
const NONE = Object.freeze({});
|
|
7
|
+
const record = (value) => value !== null && typeof value === 'object' && !Array.isArray(value);
|
|
8
|
+
const finite = (value) => typeof value === 'number' && Number.isFinite(value);
|
|
9
|
+
/**
|
|
10
|
+
* A map drawn from its tilesets. Each tile layer is a container of chunks, and each chunk one mesh
|
|
11
|
+
* for each tileset it draws from, so that a large map is a few hundred meshes, not a node per tile.
|
|
12
|
+
*/
|
|
13
|
+
export function createTileMap(options) {
|
|
14
|
+
if (!record(options))
|
|
15
|
+
throw new EgretError('TILEMAP_OPTIONS_INVALID');
|
|
16
|
+
const { map, textures, chunkSize = 32 } = options;
|
|
17
|
+
if (!record(map) ||
|
|
18
|
+
map.orientation !== 'orthogonal' ||
|
|
19
|
+
!Array.isArray(map.layers) ||
|
|
20
|
+
!Array.isArray(map.tilesets) ||
|
|
21
|
+
!record(textures) ||
|
|
22
|
+
!Number.isSafeInteger(chunkSize) ||
|
|
23
|
+
chunkSize < 4 ||
|
|
24
|
+
chunkSize > 128)
|
|
25
|
+
throw new EgretError('TILEMAP_OPTIONS_INVALID');
|
|
26
|
+
const sets = map.tilesets;
|
|
27
|
+
const setOf = (gid) => {
|
|
28
|
+
for (let i = sets.length - 1; i >= 0; i--) {
|
|
29
|
+
const set = sets[i];
|
|
30
|
+
if (gid >= set.firstGid)
|
|
31
|
+
return gid < set.firstGid + set.tileCount ? set : undefined;
|
|
32
|
+
}
|
|
33
|
+
return undefined;
|
|
34
|
+
};
|
|
35
|
+
const display = new DisplayObjectContainer();
|
|
36
|
+
const layers = [];
|
|
37
|
+
let closed = false;
|
|
38
|
+
/** The quads of the tiles of one tileset in one chunk, as one geometry. */
|
|
39
|
+
function geometryOf(layer, chunk, set) {
|
|
40
|
+
const { width, height } = layer.data, endColumn = Math.min(chunk.column + chunkSize, width), endRow = Math.min(chunk.row + chunkSize, height);
|
|
41
|
+
const found = [];
|
|
42
|
+
for (let row = chunk.row; row < endRow; row++)
|
|
43
|
+
for (let column = chunk.column; column < endColumn; column++) {
|
|
44
|
+
const raw = layer.cells[row * width + column], gid = (raw & ~TILE_FLIP_MASK) >>> 0;
|
|
45
|
+
if (gid !== 0 && setOf(gid) === set)
|
|
46
|
+
found.push(row * width + column);
|
|
47
|
+
}
|
|
48
|
+
if (found.length === 0)
|
|
49
|
+
return undefined;
|
|
50
|
+
const n = found.length, positions = new Float64Array(n * 8), uvs = new Float64Array(n * 8), indices = new Uint32Array(n * 6);
|
|
51
|
+
const lightColors = new Float64Array(n * 16).fill(1);
|
|
52
|
+
found.forEach((cell, k) => {
|
|
53
|
+
const raw = layer.cells[cell], id = ((raw & ~TILE_FLIP_MASK) >>> 0) - set.firstGid, column = cell % width, row = (cell - column) / width;
|
|
54
|
+
// A tile taller than a cell stands on the bottom of its cell, as Tiled draws it.
|
|
55
|
+
const x = (column + layer.data.startX) * map.tileWidth, y = (row + layer.data.startY + 1) * map.tileHeight - set.tileHeight;
|
|
56
|
+
positions.set([x, y, x + set.tileWidth, y, x + set.tileWidth, y + set.tileHeight, x, y + set.tileHeight], k * 8);
|
|
57
|
+
const sx = set.margin + (id % set.columns) * (set.tileWidth + set.spacing), sy = set.margin + Math.floor(id / set.columns) * (set.tileHeight + set.spacing);
|
|
58
|
+
const u0 = sx / set.imageWidth, v0 = sy / set.imageHeight, u1 = (sx + set.tileWidth) / set.imageWidth, v1 = (sy + set.tileHeight) / set.imageHeight;
|
|
59
|
+
// The corners top left, top right, bottom right, bottom left, then turned as the flags say.
|
|
60
|
+
let corners = [
|
|
61
|
+
[u0, v0],
|
|
62
|
+
[u1, v0],
|
|
63
|
+
[u1, v1],
|
|
64
|
+
[u0, v1]
|
|
65
|
+
];
|
|
66
|
+
if (raw & FLIP_D)
|
|
67
|
+
corners = [corners[0], corners[3], corners[2], corners[1]];
|
|
68
|
+
if (raw & FLIP_H)
|
|
69
|
+
corners = [corners[1], corners[0], corners[3], corners[2]];
|
|
70
|
+
if (raw & FLIP_V)
|
|
71
|
+
corners = [corners[3], corners[2], corners[1], corners[0]];
|
|
72
|
+
uvs.set(corners.flat(), k * 8);
|
|
73
|
+
indices.set([k * 4, k * 4 + 1, k * 4 + 2, k * 4, k * 4 + 2, k * 4 + 3], k * 6);
|
|
74
|
+
});
|
|
75
|
+
return { geometry: createTexturedGeometry2D({ positions, uvs, lightColors, indices }), tiles: n };
|
|
76
|
+
}
|
|
77
|
+
function faceOf(chunk) {
|
|
78
|
+
return Object.freeze({
|
|
79
|
+
column: chunk.column,
|
|
80
|
+
row: chunk.row,
|
|
81
|
+
get visible() {
|
|
82
|
+
return chunk.visible;
|
|
83
|
+
},
|
|
84
|
+
meshes: Object.freeze(chunk.pieces.map(piece => Object.freeze({ tileset: piece.tileset, mesh: piece.mesh, geometry: piece.geometry, tiles: piece.tiles })))
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
/** Draws a chunk again: a mesh is kept and given its new geometry where it can be, made where a set appears, and let go where one disappears. */
|
|
88
|
+
function draw(layer, chunk) {
|
|
89
|
+
const before = new Map(chunk.pieces.map(piece => [piece.tileset, piece])), next = [];
|
|
90
|
+
for (const set of sets) {
|
|
91
|
+
const lease = Object.hasOwn(textures, set.name)
|
|
92
|
+
? textures[set.name]
|
|
93
|
+
: undefined;
|
|
94
|
+
const built = geometryOf(layer, chunk, set), old = before.get(set.name);
|
|
95
|
+
if (built === undefined)
|
|
96
|
+
continue;
|
|
97
|
+
if (lease === undefined)
|
|
98
|
+
throw new EgretError('TILEMAP_TEXTURE_MISSING', { cause: new Error(set.name) });
|
|
99
|
+
if (old !== undefined) {
|
|
100
|
+
old.mesh.setContent(lease, built.geometry);
|
|
101
|
+
old.geometry = built.geometry;
|
|
102
|
+
old.tiles = built.tiles;
|
|
103
|
+
before.delete(set.name);
|
|
104
|
+
next.push(old);
|
|
105
|
+
continue;
|
|
106
|
+
}
|
|
107
|
+
const mesh = new Mesh2D(lease, built.geometry);
|
|
108
|
+
chunk.display.addChild(mesh);
|
|
109
|
+
next.push({ tileset: set.name, mesh, geometry: built.geometry, tiles: built.tiles });
|
|
110
|
+
}
|
|
111
|
+
for (const gone of before.values()) {
|
|
112
|
+
chunk.display.removeChild(gone.mesh);
|
|
113
|
+
gone.mesh.dispose();
|
|
114
|
+
}
|
|
115
|
+
// Back to front in the order of the tilesets, as they are drawn.
|
|
116
|
+
next.forEach((piece, index) => {
|
|
117
|
+
if (chunk.display.getChildIndex(piece.mesh) !== index)
|
|
118
|
+
chunk.display.setChildIndex(piece.mesh, index);
|
|
119
|
+
});
|
|
120
|
+
chunk.pieces = next;
|
|
121
|
+
chunk.face = faceOf(chunk);
|
|
122
|
+
}
|
|
123
|
+
function release() {
|
|
124
|
+
const failures = [];
|
|
125
|
+
for (const layer of layers)
|
|
126
|
+
for (const chunk of layer.chunks)
|
|
127
|
+
for (const piece of chunk.pieces)
|
|
128
|
+
try {
|
|
129
|
+
piece.mesh.dispose();
|
|
130
|
+
}
|
|
131
|
+
catch (cause) {
|
|
132
|
+
failures.push(cause);
|
|
133
|
+
}
|
|
134
|
+
try {
|
|
135
|
+
display.dispose();
|
|
136
|
+
}
|
|
137
|
+
catch (cause) {
|
|
138
|
+
failures.push(cause);
|
|
139
|
+
}
|
|
140
|
+
return failures;
|
|
141
|
+
}
|
|
142
|
+
try {
|
|
143
|
+
for (const data of map.layers) {
|
|
144
|
+
if (data.type !== 'tile')
|
|
145
|
+
continue;
|
|
146
|
+
const container = display.addChild(new DisplayObjectContainer());
|
|
147
|
+
container.x = data.offsetX;
|
|
148
|
+
container.y = data.offsetY;
|
|
149
|
+
container.alpha = data.opacity;
|
|
150
|
+
container.visible = data.visible;
|
|
151
|
+
const layer = {
|
|
152
|
+
data,
|
|
153
|
+
cells: new Uint32Array(data.data),
|
|
154
|
+
display: container,
|
|
155
|
+
chunks: [],
|
|
156
|
+
across: Math.ceil(data.width / chunkSize),
|
|
157
|
+
face: undefined
|
|
158
|
+
};
|
|
159
|
+
for (let row = 0; row < data.height; row += chunkSize)
|
|
160
|
+
for (let column = 0; column < data.width; column += chunkSize) {
|
|
161
|
+
const chunk = {
|
|
162
|
+
column,
|
|
163
|
+
row,
|
|
164
|
+
visible: true,
|
|
165
|
+
pieces: [],
|
|
166
|
+
display: container.addChild(new DisplayObjectContainer()),
|
|
167
|
+
face: undefined
|
|
168
|
+
};
|
|
169
|
+
draw(layer, chunk);
|
|
170
|
+
layer.chunks.push(chunk);
|
|
171
|
+
}
|
|
172
|
+
layer.face = Object.freeze({
|
|
173
|
+
name: data.name,
|
|
174
|
+
data,
|
|
175
|
+
display: container,
|
|
176
|
+
get chunks() {
|
|
177
|
+
return Object.freeze(layer.chunks.map(chunk => chunk.face));
|
|
178
|
+
}
|
|
179
|
+
});
|
|
180
|
+
layers.push(layer);
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
catch (cause) {
|
|
184
|
+
const cleanupErrors = release();
|
|
185
|
+
if (cause instanceof EgretError)
|
|
186
|
+
throw new EgretError(cause.code, { cause: cause.cause, cleanupErrors });
|
|
187
|
+
throw new EgretError('TILEMAP_DRAW_FAILED', { cause, cleanupErrors });
|
|
188
|
+
}
|
|
189
|
+
function layerOf(name) {
|
|
190
|
+
const layer = layers.find(candidate => candidate.data.name === name);
|
|
191
|
+
if (layer === undefined)
|
|
192
|
+
throw new EgretError('TILEMAP_LAYER_UNKNOWN');
|
|
193
|
+
return layer;
|
|
194
|
+
}
|
|
195
|
+
function info(raw) {
|
|
196
|
+
const gid = (raw & ~TILE_FLIP_MASK) >>> 0, set = gid === 0 ? undefined : setOf(gid);
|
|
197
|
+
if (set === undefined)
|
|
198
|
+
return undefined;
|
|
199
|
+
const id = gid - set.firstGid;
|
|
200
|
+
return Object.freeze({
|
|
201
|
+
gid,
|
|
202
|
+
tileset: set,
|
|
203
|
+
id,
|
|
204
|
+
flippedHorizontally: (raw & FLIP_H) !== 0,
|
|
205
|
+
flippedVertically: (raw & FLIP_V) !== 0,
|
|
206
|
+
flippedDiagonally: (raw & FLIP_D) !== 0,
|
|
207
|
+
properties: set.tiles.get(id)?.properties ?? NONE
|
|
208
|
+
});
|
|
209
|
+
}
|
|
210
|
+
const cellIndex = (layer, column, row) => {
|
|
211
|
+
if (!Number.isSafeInteger(column) || !Number.isSafeInteger(row))
|
|
212
|
+
throw new EgretError('TILEMAP_CELL_INVALID');
|
|
213
|
+
const c = column - layer.data.startX, r = row - layer.data.startY;
|
|
214
|
+
return c < 0 || r < 0 || c >= layer.data.width || r >= layer.data.height ? -1 : r * layer.data.width + c;
|
|
215
|
+
};
|
|
216
|
+
const open = () => {
|
|
217
|
+
if (closed)
|
|
218
|
+
throw new EgretError('TILEMAP_CLOSED');
|
|
219
|
+
};
|
|
220
|
+
return Object.freeze({
|
|
221
|
+
get state() {
|
|
222
|
+
return closed ? 'closed' : 'active';
|
|
223
|
+
},
|
|
224
|
+
data: map,
|
|
225
|
+
display,
|
|
226
|
+
get layers() {
|
|
227
|
+
return Object.freeze(layers.map(layer => layer.face));
|
|
228
|
+
},
|
|
229
|
+
layer: (name) => layerOf(name).face,
|
|
230
|
+
tileAt(name, column, row) {
|
|
231
|
+
const layer = layerOf(name), index = cellIndex(layer, column, row);
|
|
232
|
+
return index < 0 ? undefined : info(layer.cells[index]);
|
|
233
|
+
},
|
|
234
|
+
setTile(name, column, row, gid) {
|
|
235
|
+
open();
|
|
236
|
+
const layer = layerOf(name), index = cellIndex(layer, column, row);
|
|
237
|
+
if (index < 0)
|
|
238
|
+
throw new EgretError('TILEMAP_CELL_INVALID');
|
|
239
|
+
if (!Number.isSafeInteger(gid) || gid < 0 || gid > 0xffffffff)
|
|
240
|
+
throw new EgretError('TILEMAP_TILE_INVALID');
|
|
241
|
+
const id = (gid & ~TILE_FLIP_MASK) >>> 0;
|
|
242
|
+
if (id !== 0 && setOf(id) === undefined)
|
|
243
|
+
throw new EgretError('TILEMAP_TILE_INVALID');
|
|
244
|
+
if (layer.cells[index] === gid >>> 0)
|
|
245
|
+
return;
|
|
246
|
+
const before = layer.cells[index];
|
|
247
|
+
layer.cells[index] = gid >>> 0;
|
|
248
|
+
const c = index % layer.data.width, r = (index - c) / layer.data.width;
|
|
249
|
+
const chunk = layer.chunks[Math.floor(r / chunkSize) * layer.across + Math.floor(c / chunkSize)];
|
|
250
|
+
try {
|
|
251
|
+
draw(layer, chunk);
|
|
252
|
+
}
|
|
253
|
+
catch (cause) {
|
|
254
|
+
layer.cells[index] = before;
|
|
255
|
+
throw cause;
|
|
256
|
+
}
|
|
257
|
+
},
|
|
258
|
+
propertiesOf(gid) {
|
|
259
|
+
if (!Number.isSafeInteger(gid) || gid < 0)
|
|
260
|
+
throw new EgretError('TILEMAP_TILE_INVALID');
|
|
261
|
+
return info(gid >>> 0)?.properties ?? NONE;
|
|
262
|
+
},
|
|
263
|
+
cellAt(x, y) {
|
|
264
|
+
if (!finite(x) || !finite(y))
|
|
265
|
+
throw new EgretError('TILEMAP_CELL_INVALID');
|
|
266
|
+
return Object.freeze({ column: Math.floor(x / map.tileWidth), row: Math.floor(y / map.tileHeight) });
|
|
267
|
+
},
|
|
268
|
+
cellOrigin(column, row) {
|
|
269
|
+
if (!Number.isSafeInteger(column) || !Number.isSafeInteger(row))
|
|
270
|
+
throw new EgretError('TILEMAP_CELL_INVALID');
|
|
271
|
+
return Object.freeze({ x: column * map.tileWidth, y: row * map.tileHeight });
|
|
272
|
+
},
|
|
273
|
+
cull(view) {
|
|
274
|
+
if (!record(view) ||
|
|
275
|
+
!finite(view.x) ||
|
|
276
|
+
!finite(view.y) ||
|
|
277
|
+
!finite(view.width) ||
|
|
278
|
+
!finite(view.height) ||
|
|
279
|
+
view.width < 0 ||
|
|
280
|
+
view.height < 0)
|
|
281
|
+
throw new EgretError('TILEMAP_OPTIONS_INVALID');
|
|
282
|
+
open();
|
|
283
|
+
let shown = 0;
|
|
284
|
+
// A tile taller than a cell reaches above its chunk: the margin is the tallest tile.
|
|
285
|
+
const reach = Math.max(0, ...sets.map(set => set.tileHeight - map.tileHeight)), wide = Math.max(0, ...sets.map(set => set.tileWidth - map.tileWidth));
|
|
286
|
+
for (const layer of layers)
|
|
287
|
+
for (const chunk of layer.chunks) {
|
|
288
|
+
const left = (chunk.column + layer.data.startX) * map.tileWidth + layer.data.offsetX, top = (chunk.row + layer.data.startY) * map.tileHeight + layer.data.offsetY - reach;
|
|
289
|
+
const right = left + chunkSize * map.tileWidth + wide, bottom = top + reach + chunkSize * map.tileHeight;
|
|
290
|
+
const visible = left <= view.x + view.width && right >= view.x && top <= view.y + view.height && bottom >= view.y;
|
|
291
|
+
if (visible !== chunk.visible) {
|
|
292
|
+
chunk.visible = visible;
|
|
293
|
+
chunk.display.visible = visible;
|
|
294
|
+
}
|
|
295
|
+
if (visible)
|
|
296
|
+
shown++;
|
|
297
|
+
}
|
|
298
|
+
return shown;
|
|
299
|
+
},
|
|
300
|
+
dispose() {
|
|
301
|
+
if (closed)
|
|
302
|
+
return;
|
|
303
|
+
closed = true;
|
|
304
|
+
const failures = release();
|
|
305
|
+
if (failures.length > 0)
|
|
306
|
+
throw new EgretError('TILEMAP_CLEANUP_FAILED', { cause: failures[0], cleanupErrors: failures.slice(1) });
|
|
307
|
+
}
|
|
308
|
+
});
|
|
309
|
+
}
|
|
310
|
+
//# sourceMappingURL=tileMapDraw.js.map
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { TiledImportOptions, TileMapData } from './tilemapTypes.js';
|
|
2
|
+
/** The top three bits of a global id say how the tile is turned; the rest is the id. */
|
|
3
|
+
export declare const TILE_FLIP_MASK = 3758096384;
|
|
4
|
+
/**
|
|
5
|
+
* Reads a map saved by Tiled as JSON (`.tmj`, or `.json`), orthogonal, with tile layers as arrays or as
|
|
6
|
+
* base64 without compression, finite or infinite, object layers and groups. What it cannot read it refuses.
|
|
7
|
+
*/
|
|
8
|
+
export declare function importTiledMap(json: unknown, options?: TiledImportOptions): TileMapData;
|
|
9
|
+
//# sourceMappingURL=tiledImport.d.ts.map
|