@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,218 @@
|
|
|
1
|
+
import { TEXTURE_UNITS_3D } from './shaders3D.js';
|
|
2
|
+
// Program variant bits contributed by geometry, mesh and frame state.
|
|
3
|
+
export const MATERIAL_VARIANT_WEBGL2_3D = Object.freeze({
|
|
4
|
+
normal: 1,
|
|
5
|
+
tangent: 2,
|
|
6
|
+
uv: 4,
|
|
7
|
+
color: 8,
|
|
8
|
+
skin: 16,
|
|
9
|
+
morph: 32,
|
|
10
|
+
morphNormals: 64,
|
|
11
|
+
instancing: 128,
|
|
12
|
+
instanceColor: 256,
|
|
13
|
+
receiveShadow: 512,
|
|
14
|
+
fog: 1024,
|
|
15
|
+
toneMapped: 2048,
|
|
16
|
+
environment: 4096,
|
|
17
|
+
points: 8192,
|
|
18
|
+
depthOnly: 16384,
|
|
19
|
+
linearOutput: 32768,
|
|
20
|
+
mapFromTarget: 65536,
|
|
21
|
+
uv1: 131072,
|
|
22
|
+
occlusionSecond: 262144,
|
|
23
|
+
emissiveSecond: 524288,
|
|
24
|
+
lightSecond: 1048576,
|
|
25
|
+
transmission: 2097152,
|
|
26
|
+
skinInstancing: 4194304,
|
|
27
|
+
gpuParticles: 8388608,
|
|
28
|
+
softDepth: 16777216
|
|
29
|
+
});
|
|
30
|
+
const IDENTITY3 = new Float32Array([1, 0, 0, 0, 1, 0, 0, 0, 1]);
|
|
31
|
+
/** Preserve define order because the renderer uses it as part of the linked-program key. */
|
|
32
|
+
export function buildMaterialDefinesWebGL23D(material, variant, depthOnly) {
|
|
33
|
+
const has = (bit) => (variant & bit) !== 0;
|
|
34
|
+
const uv = has(MATERIAL_VARIANT_WEBGL2_3D.uv), defines = [];
|
|
35
|
+
if (depthOnly)
|
|
36
|
+
defines.push('DEPTH_ONLY');
|
|
37
|
+
else
|
|
38
|
+
defines.push(material.shading === 'unlit'
|
|
39
|
+
? 'SHADING_UNLIT'
|
|
40
|
+
: material.shading === 'lambert'
|
|
41
|
+
? 'SHADING_LAMBERT'
|
|
42
|
+
: material.shading === 'phong'
|
|
43
|
+
? 'SHADING_PHONG'
|
|
44
|
+
: material.shading === 'toon'
|
|
45
|
+
? 'SHADING_TOON'
|
|
46
|
+
: material.shading === 'matcap'
|
|
47
|
+
? 'SHADING_MATCAP'
|
|
48
|
+
: 'SHADING_STANDARD');
|
|
49
|
+
if (has(MATERIAL_VARIANT_WEBGL2_3D.normal))
|
|
50
|
+
defines.push('USE_NORMAL');
|
|
51
|
+
if (has(MATERIAL_VARIANT_WEBGL2_3D.skin))
|
|
52
|
+
defines.push('USE_SKINNING');
|
|
53
|
+
if (has(MATERIAL_VARIANT_WEBGL2_3D.morph))
|
|
54
|
+
defines.push('USE_MORPH');
|
|
55
|
+
if (has(MATERIAL_VARIANT_WEBGL2_3D.morphNormals) && (!depthOnly || material.shader?.glslVertex !== undefined))
|
|
56
|
+
defines.push('USE_MORPH_NORMALS');
|
|
57
|
+
if (has(MATERIAL_VARIANT_WEBGL2_3D.instancing))
|
|
58
|
+
defines.push('USE_INSTANCING');
|
|
59
|
+
if (has(MATERIAL_VARIANT_WEBGL2_3D.skinInstancing))
|
|
60
|
+
defines.push('USE_SKIN_INSTANCING');
|
|
61
|
+
if (has(MATERIAL_VARIANT_WEBGL2_3D.gpuParticles) && !depthOnly)
|
|
62
|
+
defines.push('GPU_PARTICLES');
|
|
63
|
+
if (has(MATERIAL_VARIANT_WEBGL2_3D.softDepth))
|
|
64
|
+
defines.push('USE_SOFT_DEPTH');
|
|
65
|
+
if (has(MATERIAL_VARIANT_WEBGL2_3D.points))
|
|
66
|
+
defines.push('POINTS');
|
|
67
|
+
if (material.screenSpace)
|
|
68
|
+
defines.push('SCREEN_SPACE');
|
|
69
|
+
else if (material.billboard)
|
|
70
|
+
defines.push('BILLBOARD');
|
|
71
|
+
if (uv && material.map) {
|
|
72
|
+
defines.push('USE_MAP');
|
|
73
|
+
if (has(MATERIAL_VARIANT_WEBGL2_3D.mapFromTarget))
|
|
74
|
+
defines.push('MAP_FROM_TARGET');
|
|
75
|
+
}
|
|
76
|
+
if (uv && material.splat && !depthOnly)
|
|
77
|
+
defines.push('USE_SPLAT');
|
|
78
|
+
if (material.alphaMode === 'mask')
|
|
79
|
+
defines.push('ALPHA_MASK');
|
|
80
|
+
if (material.alphaMode === 'blend') {
|
|
81
|
+
defines.push('ALPHA_BLEND');
|
|
82
|
+
if (!depthOnly && material.blending === 'premultiplied')
|
|
83
|
+
defines.push('PREMULTIPLIED_ALPHA');
|
|
84
|
+
}
|
|
85
|
+
if (has(MATERIAL_VARIANT_WEBGL2_3D.color))
|
|
86
|
+
defines.push('USE_VERTEX_COLOR');
|
|
87
|
+
if (!depthOnly) {
|
|
88
|
+
const lit = material.shading !== 'unlit' && material.shading !== 'matcap';
|
|
89
|
+
if (has(MATERIAL_VARIANT_WEBGL2_3D.instanceColor))
|
|
90
|
+
defines.push('USE_INSTANCE_COLOR');
|
|
91
|
+
if (lit && uv && material.normalMap) {
|
|
92
|
+
defines.push('USE_NORMAL_MAP');
|
|
93
|
+
if (has(MATERIAL_VARIANT_WEBGL2_3D.tangent))
|
|
94
|
+
defines.push('USE_TANGENT');
|
|
95
|
+
}
|
|
96
|
+
if (lit && uv && material.metallicRoughnessMap && material.shading === 'standard')
|
|
97
|
+
defines.push('USE_MR_MAP');
|
|
98
|
+
// A map on the second coordinate set needs only that set; it falls back to the first when the geometry lacks it.
|
|
99
|
+
const aoSecond = has(MATERIAL_VARIANT_WEBGL2_3D.occlusionSecond), emissiveSecond = has(MATERIAL_VARIANT_WEBGL2_3D.emissiveSecond);
|
|
100
|
+
if (lit && (uv || aoSecond) && material.occlusionMap) {
|
|
101
|
+
defines.push('USE_AO_MAP');
|
|
102
|
+
if (aoSecond)
|
|
103
|
+
defines.push('AO_UV1');
|
|
104
|
+
}
|
|
105
|
+
if ((uv || emissiveSecond) && material.emissiveMap && material.shading !== 'matcap') {
|
|
106
|
+
defines.push('USE_EMISSIVE_MAP');
|
|
107
|
+
if (emissiveSecond)
|
|
108
|
+
defines.push('EMISSIVE_UV1');
|
|
109
|
+
}
|
|
110
|
+
if (lit && material.lightMap && (uv || has(MATERIAL_VARIANT_WEBGL2_3D.lightSecond))) {
|
|
111
|
+
defines.push('USE_LIGHT_MAP');
|
|
112
|
+
if (has(MATERIAL_VARIANT_WEBGL2_3D.lightSecond))
|
|
113
|
+
defines.push('LIGHT_UV1');
|
|
114
|
+
}
|
|
115
|
+
if (material.flatShading)
|
|
116
|
+
defines.push('FLAT_SHADED');
|
|
117
|
+
if (material.side === 'double')
|
|
118
|
+
defines.push('DOUBLE_SIDED');
|
|
119
|
+
if (lit && has(MATERIAL_VARIANT_WEBGL2_3D.receiveShadow))
|
|
120
|
+
defines.push('RECEIVE_SHADOW');
|
|
121
|
+
if (lit && has(MATERIAL_VARIANT_WEBGL2_3D.environment))
|
|
122
|
+
defines.push('USE_ENVIRONMENT');
|
|
123
|
+
if (has(MATERIAL_VARIANT_WEBGL2_3D.fog) && material.fog)
|
|
124
|
+
defines.push('USE_FOG');
|
|
125
|
+
if (has(MATERIAL_VARIANT_WEBGL2_3D.toneMapped) && material.toneMapped)
|
|
126
|
+
defines.push('TONE_MAPPED');
|
|
127
|
+
if (has(MATERIAL_VARIANT_WEBGL2_3D.linearOutput))
|
|
128
|
+
defines.push('LINEAR_OUTPUT');
|
|
129
|
+
if (has(MATERIAL_VARIANT_WEBGL2_3D.transmission) && material.shading === 'standard')
|
|
130
|
+
defines.push('USE_TRANSMISSION');
|
|
131
|
+
if (material.reflectionMap && material.shading === 'standard')
|
|
132
|
+
defines.push('USE_REFLECTION_MAP');
|
|
133
|
+
}
|
|
134
|
+
return defines;
|
|
135
|
+
}
|
|
136
|
+
/** Apply uniforms and textures in draw order using the renderer's existing scratch matrix. */
|
|
137
|
+
export function applyMaterialWebGL23D(gl, u, resources, scratch9, material, depthOnly) {
|
|
138
|
+
if (u['uColor'])
|
|
139
|
+
gl.uniform4f(u['uColor'], material.color[0], material.color[1], material.color[2], material.opacity);
|
|
140
|
+
if (u['uAlphaCutoff'])
|
|
141
|
+
gl.uniform1f(u['uAlphaCutoff'], material.alphaCutoff);
|
|
142
|
+
const customLocation = u['uCustom[0]'] ?? u['uCustom'];
|
|
143
|
+
if (customLocation && material.shader)
|
|
144
|
+
gl.uniform4fv(customLocation, material.shader.uniforms);
|
|
145
|
+
if (u['uMap'] && material.map)
|
|
146
|
+
resources.bindTexture(TEXTURE_UNITS_3D.map, material.map);
|
|
147
|
+
if (u['uUvTransform']) {
|
|
148
|
+
const map = material.map;
|
|
149
|
+
if (map?.hasTransform) {
|
|
150
|
+
const c = Math.cos(map.rotation), s = Math.sin(map.rotation), m = scratch9;
|
|
151
|
+
m[0] = c * map.repeat[0];
|
|
152
|
+
m[1] = s * map.repeat[0];
|
|
153
|
+
m[2] = 0;
|
|
154
|
+
m[3] = -s * map.repeat[1];
|
|
155
|
+
m[4] = c * map.repeat[1];
|
|
156
|
+
m[5] = 0;
|
|
157
|
+
m[6] = map.offset[0];
|
|
158
|
+
m[7] = map.offset[1];
|
|
159
|
+
m[8] = 1;
|
|
160
|
+
gl.uniformMatrix3fv(u['uUvTransform'], false, m);
|
|
161
|
+
}
|
|
162
|
+
else
|
|
163
|
+
gl.uniformMatrix3fv(u['uUvTransform'], false, IDENTITY3);
|
|
164
|
+
}
|
|
165
|
+
if (u['uSprite'])
|
|
166
|
+
gl.uniform4f(u['uSprite'], material.rotation, material.sizeAttenuation ? 1 : 0, 0, 0);
|
|
167
|
+
if (u['uPointSize'])
|
|
168
|
+
gl.uniform2f(u['uPointSize'], material.pointSize, material.sizeAttenuation ? 1 : 0);
|
|
169
|
+
if (depthOnly)
|
|
170
|
+
return;
|
|
171
|
+
const e = material.emissiveIntensity;
|
|
172
|
+
if (u['uEmissive'])
|
|
173
|
+
gl.uniform3f(u['uEmissive'], material.emissive[0] * e, material.emissive[1] * e, material.emissive[2] * e);
|
|
174
|
+
if (u['uClearcoat'])
|
|
175
|
+
gl.uniform2f(u['uClearcoat'], material.clearcoat, material.clearcoatRoughness);
|
|
176
|
+
if (u['uSurface'])
|
|
177
|
+
gl.uniform4f(u['uSurface'], material.metallic, material.roughness, material.normalScale, material.occlusionStrength);
|
|
178
|
+
if (u['uSpecular'])
|
|
179
|
+
gl.uniform4f(u['uSpecular'], material.specular[0], material.specular[1], material.specular[2], material.shading === 'toon' ? material.toonSteps : material.shininess);
|
|
180
|
+
if (u['uEnvironmentScale'])
|
|
181
|
+
gl.uniform1f(u['uEnvironmentScale'], material.environmentIntensity);
|
|
182
|
+
if (u['uNormalMap'] && material.normalMap)
|
|
183
|
+
resources.bindTexture(TEXTURE_UNITS_3D.normalMap, material.normalMap);
|
|
184
|
+
if (u['uMetallicRoughnessMap'] && material.metallicRoughnessMap)
|
|
185
|
+
resources.bindTexture(TEXTURE_UNITS_3D.metallicRoughnessMap, material.metallicRoughnessMap);
|
|
186
|
+
if (u['uOcclusionMap'] && material.occlusionMap)
|
|
187
|
+
resources.bindTexture(TEXTURE_UNITS_3D.occlusionMap, material.occlusionMap);
|
|
188
|
+
if (u['uEmissiveMap'] && material.emissiveMap)
|
|
189
|
+
resources.bindTexture(TEXTURE_UNITS_3D.emissiveMap, material.emissiveMap);
|
|
190
|
+
if (u['uLightMap'] && material.lightMap)
|
|
191
|
+
resources.bindTexture(TEXTURE_UNITS_3D.lightMap, material.lightMap);
|
|
192
|
+
if (u['uReflectionMap'] && material.reflectionMap)
|
|
193
|
+
resources.bindTexture(TEXTURE_UNITS_3D.reflectionMap, material.reflectionMap);
|
|
194
|
+
const splat = material.splat;
|
|
195
|
+
if (u['uSplatRepeat'] && splat) {
|
|
196
|
+
// Layers borrow the units of the maps they stand in for; a missing layer reads the first.
|
|
197
|
+
const layer = (i) => splat.layers[i] ?? splat.layers[0];
|
|
198
|
+
resources.bindTexture(TEXTURE_UNITS_3D.map, layer(0));
|
|
199
|
+
resources.bindTexture(TEXTURE_UNITS_3D.emissiveMap, layer(1));
|
|
200
|
+
resources.bindTexture(TEXTURE_UNITS_3D.occlusionMap, layer(2));
|
|
201
|
+
resources.bindTexture(TEXTURE_UNITS_3D.metallicRoughnessMap, layer(3));
|
|
202
|
+
resources.bindTexture(TEXTURE_UNITS_3D.lightMap, splat.weights);
|
|
203
|
+
gl.uniform4f(u['uSplatRepeat'], splat.repeat[0] ?? 1, splat.repeat[1] ?? 1, splat.repeat[2] ?? 1, splat.repeat[3] ?? 1);
|
|
204
|
+
}
|
|
205
|
+
if (u['uSoftness'])
|
|
206
|
+
gl.uniform1f(u['uSoftness'], material.softness);
|
|
207
|
+
if (u['uReflection'])
|
|
208
|
+
gl.uniform2f(u['uReflection'], material.reflectionStrength, material.reflectionDistortion);
|
|
209
|
+
if (u['uSheen'])
|
|
210
|
+
gl.uniform4f(u['uSheen'], material.sheenColor[0] * material.sheen, material.sheenColor[1] * material.sheen, material.sheenColor[2] * material.sheen, material.sheenRoughness);
|
|
211
|
+
if (u['uExtra'])
|
|
212
|
+
gl.uniform2f(u['uExtra'], material.lightMapIntensity, material.transmission);
|
|
213
|
+
if (u['uRefraction'])
|
|
214
|
+
gl.uniform4f(u['uRefraction'], material.ior, material.thickness, Number.isFinite(material.attenuationDistance) ? material.attenuationDistance : 0, 0);
|
|
215
|
+
if (u['uAttenuation'])
|
|
216
|
+
gl.uniform3f(u['uAttenuation'], material.attenuationColor[0], material.attenuationColor[1], material.attenuationColor[2]);
|
|
217
|
+
}
|
|
218
|
+
//# sourceMappingURL=materialWebGL23D.js.map
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { BrowserGame, BrowserGameBackend } from '../game.js';
|
|
2
|
+
export interface World3DOverlayOptions {
|
|
3
|
+
/** The stage size, in the interface's own units. */
|
|
4
|
+
readonly width: number;
|
|
5
|
+
readonly height: number;
|
|
6
|
+
/** The 2D backend; WebGL2 by default, so the 3D renderer keeps WebGPU for itself where it uses it. */
|
|
7
|
+
readonly backend?: 'auto' | BrowserGameBackend;
|
|
8
|
+
/** Canvas pixels per unit of the canvas width; the device's ratio, at most 2, by default. */
|
|
9
|
+
readonly pixelRatio?: number;
|
|
10
|
+
/** One step of the interface, called before each 2D frame. */
|
|
11
|
+
readonly update?: (deltaSeconds: number) => void;
|
|
12
|
+
readonly onError?: (error: unknown) => void;
|
|
13
|
+
/** Send presses on empty parts of the interface to the 3D canvas. On by default. */
|
|
14
|
+
readonly passThrough?: boolean;
|
|
15
|
+
}
|
|
16
|
+
export interface World3DOverlay {
|
|
17
|
+
/** The 2D game on the overlay: its stage, scope, pointer, keyboard, loop and textures. */
|
|
18
|
+
readonly game: BrowserGame;
|
|
19
|
+
readonly canvas: HTMLCanvasElement;
|
|
20
|
+
/** Ends the 2D game and takes the overlay canvas away. The 3D canvas is left as it was. */
|
|
21
|
+
dispose(): Promise<void>;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Lays a transparent 2D stage over `canvas` (the 3D canvas, which must sit in a positioned parent) and starts it.
|
|
25
|
+
* Give interface nodes hit areas as usual; presses elsewhere fall through to the 3D canvas.
|
|
26
|
+
*/
|
|
27
|
+
export declare function createWorld3DOverlay(canvas: HTMLCanvasElement, options: World3DOverlayOptions): Promise<World3DOverlay>;
|
|
28
|
+
//# sourceMappingURL=overlay3D.d.ts.map
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
2
|
+
// The engine's own 2D interface over a World3D scene: menus, bars, buttons,
|
|
3
|
+
// text and dialogs drawn by the 2D stage on a transparent canvas laid exactly
|
|
4
|
+
// over the 3D one. A touch or click that lands on 2D content goes to the 2D
|
|
5
|
+
// stage; one that lands where the interface is empty goes on to the 3D canvas
|
|
6
|
+
// below, so the scene can still be orbited, aimed at and picked.
|
|
7
|
+
import { EgretError } from '@egret/runtime';
|
|
8
|
+
import { createBrowserGame } from '../game.js';
|
|
9
|
+
const FORWARDED = [
|
|
10
|
+
'pointerdown',
|
|
11
|
+
'pointermove',
|
|
12
|
+
'pointerup',
|
|
13
|
+
'pointercancel',
|
|
14
|
+
'click',
|
|
15
|
+
'wheel',
|
|
16
|
+
'contextmenu',
|
|
17
|
+
'dblclick'
|
|
18
|
+
];
|
|
19
|
+
/**
|
|
20
|
+
* Lays a transparent 2D stage over `canvas` (the 3D canvas, which must sit in a positioned parent) and starts it.
|
|
21
|
+
* Give interface nodes hit areas as usual; presses elsewhere fall through to the 3D canvas.
|
|
22
|
+
*/
|
|
23
|
+
export async function createWorld3DOverlay(canvas, options) {
|
|
24
|
+
if (!canvas || typeof canvas.getBoundingClientRect !== 'function' || !canvas.parentElement)
|
|
25
|
+
throw new EgretError('WORLD3D_OVERLAY_OPTIONS_INVALID');
|
|
26
|
+
if (!options || !(options.width > 0) || !(options.height > 0))
|
|
27
|
+
throw new EgretError('WORLD3D_OVERLAY_OPTIONS_INVALID');
|
|
28
|
+
const doc = canvas.ownerDocument;
|
|
29
|
+
const overlay = doc.createElement('canvas');
|
|
30
|
+
overlay.className = 'egret-world3d-overlay';
|
|
31
|
+
overlay.style.cssText = 'position:absolute;left:0;top:0;width:0;height:0;touch-action:none;background:transparent';
|
|
32
|
+
canvas.parentElement.appendChild(overlay);
|
|
33
|
+
// The overlay follows the 3D canvas's box, wherever the page lays it out.
|
|
34
|
+
const place = () => {
|
|
35
|
+
const parent = canvas.parentElement.getBoundingClientRect(), box = canvas.getBoundingClientRect();
|
|
36
|
+
overlay.style.left = `${box.left - parent.left + canvas.parentElement.scrollLeft}px`;
|
|
37
|
+
overlay.style.top = `${box.top - parent.top + canvas.parentElement.scrollTop}px`;
|
|
38
|
+
overlay.style.width = `${box.width}px`;
|
|
39
|
+
overlay.style.height = `${box.height}px`;
|
|
40
|
+
};
|
|
41
|
+
place();
|
|
42
|
+
const Resize = globalThis.ResizeObserver;
|
|
43
|
+
const observer = Resize ? new Resize(place) : undefined;
|
|
44
|
+
observer?.observe(canvas);
|
|
45
|
+
const win = doc.defaultView ?? globalThis;
|
|
46
|
+
win.addEventListener('resize', place);
|
|
47
|
+
let game;
|
|
48
|
+
try {
|
|
49
|
+
game = await createBrowserGame({
|
|
50
|
+
canvas: overlay,
|
|
51
|
+
width: options.width,
|
|
52
|
+
height: options.height,
|
|
53
|
+
backend: options.backend ?? 'webgl2',
|
|
54
|
+
clearColor: 0,
|
|
55
|
+
clearAlpha: 0,
|
|
56
|
+
...(options.pixelRatio === undefined ? {} : { pixelRatio: options.pixelRatio }),
|
|
57
|
+
...(options.update ? { update: options.update } : {}),
|
|
58
|
+
...(options.onError ? { onError: options.onError } : {})
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
catch (cause) {
|
|
62
|
+
observer?.disconnect();
|
|
63
|
+
win.removeEventListener('resize', place);
|
|
64
|
+
overlay.remove();
|
|
65
|
+
throw cause;
|
|
66
|
+
}
|
|
67
|
+
// Pointers that started on an empty part of the interface belong to the 3D canvas until they lift.
|
|
68
|
+
const passing = new Set();
|
|
69
|
+
let pendingClick;
|
|
70
|
+
const empty = (event) => {
|
|
71
|
+
const box = overlay.getBoundingClientRect();
|
|
72
|
+
if (!(box.width > 0 && box.height > 0))
|
|
73
|
+
return true;
|
|
74
|
+
const x = ((event.clientX - box.left) / box.width) * options.width, y = ((event.clientY - box.top) / box.height) * options.height;
|
|
75
|
+
try {
|
|
76
|
+
return game.stage.hitTest(x, y) === undefined;
|
|
77
|
+
}
|
|
78
|
+
catch {
|
|
79
|
+
return true;
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
const forward = (event) => {
|
|
83
|
+
if (options.passThrough === false || event.target !== overlay)
|
|
84
|
+
return;
|
|
85
|
+
const pointer = event;
|
|
86
|
+
const id = typeof pointer.pointerId === 'number' ? pointer.pointerId : -1;
|
|
87
|
+
let send;
|
|
88
|
+
if (event.type === 'pointerdown') {
|
|
89
|
+
if (pointer.isPrimary)
|
|
90
|
+
pendingClick = undefined;
|
|
91
|
+
send = empty(pointer);
|
|
92
|
+
if (send)
|
|
93
|
+
passing.add(id);
|
|
94
|
+
}
|
|
95
|
+
else if (event.type === 'pointerup' || event.type === 'pointercancel') {
|
|
96
|
+
send = passing.delete(id);
|
|
97
|
+
if (pointer.isPrimary) {
|
|
98
|
+
// Native click is separate from the pointer pair. A drag out of UI cannot acquire scene click ownership.
|
|
99
|
+
pendingClick =
|
|
100
|
+
send && event.isTrusted && event.type === 'pointerup' && pointer.button === 0 && empty(pointer)
|
|
101
|
+
? { id, x: pointer.clientX, y: pointer.clientY }
|
|
102
|
+
: undefined;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
else if (event.type === 'click') {
|
|
106
|
+
const claimed = pendingClick;
|
|
107
|
+
if (event.isTrusted)
|
|
108
|
+
pendingClick = undefined;
|
|
109
|
+
// Older browsers can report a trusted click as MouseEvent without an identifier.
|
|
110
|
+
send =
|
|
111
|
+
event.isTrusted &&
|
|
112
|
+
pointer.detail > 0 &&
|
|
113
|
+
claimed !== undefined &&
|
|
114
|
+
(id === claimed.id ||
|
|
115
|
+
(id === -1 && Math.abs(pointer.clientX - claimed.x) <= 1 && Math.abs(pointer.clientY - claimed.y) <= 1));
|
|
116
|
+
}
|
|
117
|
+
else if (event.type === 'pointermove') {
|
|
118
|
+
// A drag that began on the scene stays with it; a hover goes where the interface is empty.
|
|
119
|
+
send = passing.has(id) || (pointer.buttons === 0 && empty(pointer));
|
|
120
|
+
}
|
|
121
|
+
else
|
|
122
|
+
send = empty(pointer);
|
|
123
|
+
if (!send)
|
|
124
|
+
return;
|
|
125
|
+
event.stopImmediatePropagation();
|
|
126
|
+
if (event.type !== 'pointermove' || passing.has(id))
|
|
127
|
+
event.preventDefault();
|
|
128
|
+
const Kind = event.constructor ?? Event;
|
|
129
|
+
const copy = new Kind(event.type, {
|
|
130
|
+
bubbles: true,
|
|
131
|
+
cancelable: true,
|
|
132
|
+
composed: true,
|
|
133
|
+
detail: pointer.detail,
|
|
134
|
+
clientX: pointer.clientX,
|
|
135
|
+
clientY: pointer.clientY,
|
|
136
|
+
screenX: pointer.screenX,
|
|
137
|
+
screenY: pointer.screenY,
|
|
138
|
+
button: pointer.button,
|
|
139
|
+
buttons: pointer.buttons,
|
|
140
|
+
pointerId: pointer.pointerId,
|
|
141
|
+
pointerType: pointer.pointerType,
|
|
142
|
+
isPrimary: pointer.isPrimary,
|
|
143
|
+
pressure: pointer.pressure,
|
|
144
|
+
ctrlKey: pointer.ctrlKey,
|
|
145
|
+
shiftKey: pointer.shiftKey,
|
|
146
|
+
altKey: pointer.altKey,
|
|
147
|
+
metaKey: pointer.metaKey,
|
|
148
|
+
deltaX: event.deltaX,
|
|
149
|
+
deltaY: event.deltaY,
|
|
150
|
+
deltaMode: event.deltaMode
|
|
151
|
+
});
|
|
152
|
+
canvas.dispatchEvent(copy);
|
|
153
|
+
};
|
|
154
|
+
// Capturing on the window runs before the 2D game's own listeners on the overlay.
|
|
155
|
+
for (const type of FORWARDED)
|
|
156
|
+
win.addEventListener(type, forward, { capture: true, passive: false });
|
|
157
|
+
return {
|
|
158
|
+
game,
|
|
159
|
+
canvas: overlay,
|
|
160
|
+
async dispose() {
|
|
161
|
+
for (const type of FORWARDED)
|
|
162
|
+
win.removeEventListener(type, forward, { capture: true });
|
|
163
|
+
observer?.disconnect();
|
|
164
|
+
win.removeEventListener('resize', place);
|
|
165
|
+
await game.dispose();
|
|
166
|
+
overlay.remove();
|
|
167
|
+
}
|
|
168
|
+
};
|
|
169
|
+
}
|
|
170
|
+
//# sourceMappingURL=overlay3D.js.map
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import type { Camera3D } from '../../rendering/world3d/Camera3D.js';
|
|
2
|
+
import type { ToneMapping3D } from './frame3D.js';
|
|
3
|
+
/**
|
|
4
|
+
* A full-screen hook that runs after ambient occlusion and bloom and before
|
|
5
|
+
* tone mapping. Supply the function in each shading language you target:
|
|
6
|
+
* GLSL: vec3 customPost(vec3 color, vec2 uv) reading uPostCustom[0..3]
|
|
7
|
+
* WGSL: fn customPost(color: vec3f, uv: vec2f) -> vec3f reading params.custom[0..3]
|
|
8
|
+
* Both may call sceneColor(uv) for the lit scene and sceneDepth(uv) for the
|
|
9
|
+
* distance from the camera plane in world units, which is enough for fog
|
|
10
|
+
* volumes, outlines, contact shadows and similar screen-space effects.
|
|
11
|
+
*/
|
|
12
|
+
export interface CustomPost3D {
|
|
13
|
+
/** Identifies the source; equal keys share one compiled program. */
|
|
14
|
+
readonly key: string;
|
|
15
|
+
readonly glsl?: string;
|
|
16
|
+
readonly wgsl?: string;
|
|
17
|
+
/** Four vec4 parameters written by the application. */
|
|
18
|
+
readonly uniforms: Float32Array;
|
|
19
|
+
}
|
|
20
|
+
export declare function createCustomPost3D(input: {
|
|
21
|
+
readonly key: string;
|
|
22
|
+
readonly glsl?: string;
|
|
23
|
+
readonly wgsl?: string;
|
|
24
|
+
readonly uniforms?: ArrayLike<number>;
|
|
25
|
+
}): CustomPost3D;
|
|
26
|
+
export interface PostProcessSettings3D {
|
|
27
|
+
/** Master switch. While false the renderer draws directly and nothing here costs anything. */
|
|
28
|
+
enabled: boolean;
|
|
29
|
+
bloom: boolean;
|
|
30
|
+
/** Linear brightness above which pixels start to glow. */
|
|
31
|
+
bloomThreshold: number;
|
|
32
|
+
/** Width of the soft transition below the threshold, in [0, 1]. */
|
|
33
|
+
bloomKnee: number;
|
|
34
|
+
bloomIntensity: number;
|
|
35
|
+
/** Pyramid depth, 1 to 8; more levels give a wider glow. */
|
|
36
|
+
bloomLevels: number;
|
|
37
|
+
/** Fast approximate anti-aliasing on the final image. Canvas multisampling does not apply while post-processing is on. */
|
|
38
|
+
fxaa: boolean;
|
|
39
|
+
/** 0 is grayscale, 1 unchanged. */
|
|
40
|
+
saturation: number;
|
|
41
|
+
/** Contrast around middle gray; 1 unchanged. */
|
|
42
|
+
contrast: number;
|
|
43
|
+
/** Linear multiplier applied before tone mapping; 1 unchanged. */
|
|
44
|
+
brightness: number;
|
|
45
|
+
/** Darkening toward the corners, in [0, 1]; 0 disables it. */
|
|
46
|
+
vignette: number;
|
|
47
|
+
/** Screen-space ambient occlusion: darkens creases and contact areas using scene depth. */
|
|
48
|
+
ssao: boolean;
|
|
49
|
+
/** World-space reach of the occlusion search. */
|
|
50
|
+
ssaoRadius: number;
|
|
51
|
+
ssaoIntensity: number;
|
|
52
|
+
/** Ignores occluders this close to the surface plane, against self-shadowing on flat faces. */
|
|
53
|
+
ssaoBias: number;
|
|
54
|
+
/** Depth of field: blur what lies nearer or farther than the focused range. */
|
|
55
|
+
dof: boolean;
|
|
56
|
+
/** Distance from the camera, in world units, that is perfectly sharp. */
|
|
57
|
+
dofFocus: number;
|
|
58
|
+
/** Half-depth of the sharp zone around the focus distance, in world units. */
|
|
59
|
+
dofRange: number;
|
|
60
|
+
/** Largest blur radius in pixels. */
|
|
61
|
+
dofRadius: number;
|
|
62
|
+
/** Optional application pass; see CustomPost3D. */
|
|
63
|
+
custom: CustomPost3D | undefined;
|
|
64
|
+
/**
|
|
65
|
+
* Layer bits of the objects to outline; 0 turns outlines off. Give the
|
|
66
|
+
* objects one of these bits in `layers` and they are traced on screen, even
|
|
67
|
+
* where something stands in front of them.
|
|
68
|
+
*/
|
|
69
|
+
outlineLayers: number;
|
|
70
|
+
/** Linear RGB of the outline. */
|
|
71
|
+
outlineColor: [number, number, number];
|
|
72
|
+
/** Outline width in pixels. */
|
|
73
|
+
outlineThickness: number;
|
|
74
|
+
}
|
|
75
|
+
/** Camera values the depth-reading passes need. */
|
|
76
|
+
export interface PostView3D {
|
|
77
|
+
readonly inverseProjection: Float32Array;
|
|
78
|
+
}
|
|
79
|
+
export declare function postViewFromCamera3D(camera: Camera3D): PostView3D;
|
|
80
|
+
/** True when the settings ask for outlines. */
|
|
81
|
+
export declare function outlineActive3D(settings: PostProcessSettings3D): boolean;
|
|
82
|
+
/** Post uniform layout: a, b, flags, custom[4], outline and inverse projection. */
|
|
83
|
+
export declare const POST_PARAMS_FLOATS_3D = 48;
|
|
84
|
+
export declare function writePostParams3D(out: Float32Array, a: ArrayLike<number>, b: ArrayLike<number>, view: PostView3D, aoEnabled: boolean, width: number, height: number, custom?: CustomPost3D, outline?: PostProcessSettings3D): void;
|
|
85
|
+
export declare const POST3D_LIMITS: Readonly<{
|
|
86
|
+
readonly maxBloomLevels: 8;
|
|
87
|
+
}>;
|
|
88
|
+
export declare function createPostProcessSettings3D(): PostProcessSettings3D;
|
|
89
|
+
/** Number of bloom levels that fit the output size. */
|
|
90
|
+
export declare function bloomLevelCount3D(settings: PostProcessSettings3D, width: number, height: number): number;
|
|
91
|
+
/** Composite parameters in the order both shader languages read them: two vec4. */
|
|
92
|
+
export declare function writeCompositeParams3D(out: Float32Array, settings: PostProcessSettings3D, levels: number, toneMapping: ToneMapping3D, encode: boolean): void;
|
|
93
|
+
export declare const POST_VERTEX_GLSL_3D = "#version 300 es\nout vec2 vUv;\nvoid main() {\n vec2 p = vec2(float((gl_VertexID << 1) & 2), float(gl_VertexID & 2));\n vUv = p;\n gl_Position = vec4(p * 2.0 - 1.0, 0.0, 1.0);\n}";
|
|
94
|
+
/** uA: radius, intensity, bias. Writes occlusion (1 = open) to every channel. */
|
|
95
|
+
export declare const POST_SSAO_GLSL_3D: string;
|
|
96
|
+
/** uA: xy source texel, z threshold, w knee. uB.x: 1 applies the brightness prefilter. */
|
|
97
|
+
export declare const POST_DOWN_GLSL_3D: string;
|
|
98
|
+
/** uA.xy: source texel. Drawn with additive blending onto the next larger level. */
|
|
99
|
+
export declare const POST_UP_GLSL_3D: string;
|
|
100
|
+
/** uA: focus distance, sharp half-range, largest radius in pixels. Blurs by distance from the focused zone. */
|
|
101
|
+
export declare const POST_DOF_GLSL_3D: string;
|
|
102
|
+
/** uA: bloom scale, tone mapping, sRGB encode, vignette. uB: saturation, contrast, brightness. */
|
|
103
|
+
export declare function postCompositeGlsl3D(customPost?: string): string;
|
|
104
|
+
/** uA.xy: source texel; uA.z: 1 converts the sRGB-encoded result back to linear for an encoding target. */
|
|
105
|
+
export declare const POST_FXAA_GLSL_3D: string;
|
|
106
|
+
export declare const POST_SSAO_WGSL_3D: string;
|
|
107
|
+
export declare const POST_DOWN_WGSL_3D: string;
|
|
108
|
+
export declare const POST_UP_WGSL_3D: string;
|
|
109
|
+
export declare const POST_DOF_WGSL_3D: string;
|
|
110
|
+
export declare function postCompositeWgsl3D(customPost?: string): string;
|
|
111
|
+
export declare const POST_FXAA_WGSL_3D: string;
|
|
112
|
+
//# sourceMappingURL=post3D.d.ts.map
|