@egret/engine 0.0.0-stage → 7.0.2
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 +469 -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 +48 -0
- package/dist/animation/sequenceResetTypes.js +2 -0
- package/dist/animation/types.d.ts +75 -0
- package/dist/animation/types.js +2 -0
- package/dist/assetBundle.d.ts +54 -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 +17 -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 +47 -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 +246 -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 +31 -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 +112 -0
- package/dist/bitmapFontTypes.js +2 -0
- package/dist/bitmapResourceSlot.d.ts +26 -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 +419 -0
- package/dist/cameraTypes.d.ts +126 -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 +35 -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 +45 -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 +39 -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 +37 -0
- package/dist/gameClockTypes.js +2 -0
- package/dist/gameRun.d.ts +53 -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 +142 -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 +129 -0
- package/dist/hoverInputTypes.js +2 -0
- package/dist/index.d.ts +52 -0
- package/dist/index.js +21 -0
- package/dist/input.d.ts +6 -0
- package/dist/input.js +5 -0
- package/dist/inputActions.d.ts +86 -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 +68 -0
- package/dist/internal/uiFactoryState.js +173 -0
- package/dist/internal/uiRootState.d.ts +67 -0
- package/dist/internal/uiRootState.js +103 -0
- package/dist/keyboardInput.d.ts +13 -0
- package/dist/keyboardInput.js +579 -0
- package/dist/keyboardInputTypes.d.ts +93 -0
- package/dist/keyboardInputTypes.js +2 -0
- package/dist/kit.d.ts +16 -0
- package/dist/kit.js +10 -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 +17 -0
- package/dist/manifestResourceState.js +58 -0
- package/dist/manifestResourceTypes.d.ts +26 -0
- package/dist/manifestResourceTypes.js +2 -0
- package/dist/motion.d.ts +35 -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 +41 -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 +300 -0
- package/dist/particleTypes.d.ts +115 -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 +221 -0
- package/dist/physics2dTypes.js +2 -0
- package/dist/physics2dWorld.d.ts +4 -0
- package/dist/physics2dWorld.js +823 -0
- package/dist/pointerInput.d.ts +12 -0
- package/dist/pointerInput.js +300 -0
- package/dist/pointerInputTypes.d.ts +41 -0
- package/dist/pointerInputTypes.js +2 -0
- package/dist/random.d.ts +30 -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 +379 -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 +90 -0
- package/dist/rendering/prepareSharedDraws2D.js +663 -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 +52 -0
- package/dist/rendering/sharedColor2D.js +191 -0
- package/dist/rendering/sharedEffects2D.d.ts +23 -0
- package/dist/rendering/sharedEffects2D.js +126 -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 +104 -0
- package/dist/rendering/world3d/Animation3D.js +384 -0
- package/dist/rendering/world3d/AnimationTexture3D.d.ts +163 -0
- package/dist/rendering/world3d/AnimationTexture3D.js +603 -0
- package/dist/rendering/world3d/Batch3D.d.ts +75 -0
- package/dist/rendering/world3d/Batch3D.js +332 -0
- package/dist/rendering/world3d/Camera3D.d.ts +62 -0
- package/dist/rendering/world3d/Camera3D.js +132 -0
- package/dist/rendering/world3d/Character3D.d.ts +127 -0
- package/dist/rendering/world3d/Character3D.js +305 -0
- package/dist/rendering/world3d/Cloth3D.d.ts +130 -0
- package/dist/rendering/world3d/Cloth3D.js +503 -0
- package/dist/rendering/world3d/Compression3D.d.ts +22 -0
- package/dist/rendering/world3d/Compression3D.js +703 -0
- package/dist/rendering/world3d/Curves3D.d.ts +119 -0
- package/dist/rendering/world3d/Curves3D.js +460 -0
- package/dist/rendering/world3d/Decal3D.d.ts +43 -0
- package/dist/rendering/world3d/Decal3D.js +242 -0
- package/dist/rendering/world3d/Export3D.d.ts +13 -0
- package/dist/rendering/world3d/Export3D.js +263 -0
- package/dist/rendering/world3d/Geometry3D.d.ts +95 -0
- package/dist/rendering/world3d/Geometry3D.js +335 -0
- package/dist/rendering/world3d/GeometryBuilder3D.d.ts +53 -0
- package/dist/rendering/world3d/GeometryBuilder3D.js +196 -0
- package/dist/rendering/world3d/Gizmo3D.d.ts +80 -0
- package/dist/rendering/world3d/Gizmo3D.js +514 -0
- package/dist/rendering/world3d/Gltf3D.d.ts +73 -0
- package/dist/rendering/world3d/Gltf3D.js +996 -0
- package/dist/rendering/world3d/GpuParticles3D.d.ts +109 -0
- package/dist/rendering/world3d/GpuParticles3D.js +401 -0
- package/dist/rendering/world3d/Hdr3D.d.ts +35 -0
- package/dist/rendering/world3d/Hdr3D.js +191 -0
- package/dist/rendering/world3d/Jelly3D.d.ts +77 -0
- package/dist/rendering/world3d/Jelly3D.js +267 -0
- package/dist/rendering/world3d/Ktx23D.d.ts +30 -0
- package/dist/rendering/world3d/Ktx23D.js +112 -0
- package/dist/rendering/world3d/Light3D.d.ts +84 -0
- package/dist/rendering/world3d/Light3D.js +97 -0
- package/dist/rendering/world3d/Material3D.d.ts +253 -0
- package/dist/rendering/world3d/Material3D.js +269 -0
- package/dist/rendering/world3d/Mesh3D.d.ts +112 -0
- package/dist/rendering/world3d/Mesh3D.js +337 -0
- package/dist/rendering/world3d/Meshopt3D.d.ts +15 -0
- package/dist/rendering/world3d/Meshopt3D.js +276 -0
- package/dist/rendering/world3d/Navigation3D.d.ts +213 -0
- package/dist/rendering/world3d/Navigation3D.js +1043 -0
- package/dist/rendering/world3d/Object3D.d.ts +118 -0
- package/dist/rendering/world3d/Object3D.js +315 -0
- package/dist/rendering/world3d/Particles3D.d.ts +90 -0
- package/dist/rendering/world3d/Particles3D.js +277 -0
- package/dist/rendering/world3d/Physics3D.d.ts +430 -0
- package/dist/rendering/world3d/Physics3D.js +2840 -0
- package/dist/rendering/world3d/PhysicsHull3D.d.ts +37 -0
- package/dist/rendering/world3d/PhysicsHull3D.js +229 -0
- package/dist/rendering/world3d/PhysicsMesh3D.d.ts +41 -0
- package/dist/rendering/world3d/PhysicsMesh3D.js +340 -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 +179 -0
- package/dist/rendering/world3d/PhysicsRemote3D.js +536 -0
- package/dist/rendering/world3d/Ragdoll3D.d.ts +74 -0
- package/dist/rendering/world3d/Ragdoll3D.js +202 -0
- package/dist/rendering/world3d/Raycast3D.d.ts +40 -0
- package/dist/rendering/world3d/Raycast3D.js +247 -0
- package/dist/rendering/world3d/RenderList3D.d.ts +91 -0
- package/dist/rendering/world3d/RenderList3D.js +502 -0
- package/dist/rendering/world3d/Retarget3D.d.ts +21 -0
- package/dist/rendering/world3d/Retarget3D.js +185 -0
- package/dist/rendering/world3d/Rig3D.d.ts +57 -0
- package/dist/rendering/world3d/Rig3D.js +219 -0
- package/dist/rendering/world3d/Sdf3D.d.ts +181 -0
- package/dist/rendering/world3d/Sdf3D.js +1136 -0
- package/dist/rendering/world3d/SdfLod3D.d.ts +17 -0
- package/dist/rendering/world3d/SdfLod3D.js +56 -0
- package/dist/rendering/world3d/Serialize3D.d.ts +66 -0
- package/dist/rendering/world3d/Serialize3D.js +629 -0
- package/dist/rendering/world3d/Simplify3D.d.ts +29 -0
- package/dist/rendering/world3d/Simplify3D.js +426 -0
- package/dist/rendering/world3d/StateMachine3D.d.ts +87 -0
- package/dist/rendering/world3d/StateMachine3D.js +280 -0
- package/dist/rendering/world3d/SurfaceMaterial3D.d.ts +26 -0
- package/dist/rendering/world3d/SurfaceMaterial3D.js +138 -0
- package/dist/rendering/world3d/Terrain3D.d.ts +248 -0
- package/dist/rendering/world3d/Terrain3D.js +827 -0
- package/dist/rendering/world3d/Text3D.d.ts +95 -0
- package/dist/rendering/world3d/Text3D.js +560 -0
- package/dist/rendering/world3d/Texture3D.d.ts +148 -0
- package/dist/rendering/world3d/Texture3D.js +270 -0
- package/dist/rendering/world3d/Trail3D.d.ts +62 -0
- package/dist/rendering/world3d/Trail3D.js +195 -0
- package/dist/rendering/world3d/Vehicle3D.d.ts +102 -0
- package/dist/rendering/world3d/Vehicle3D.js +228 -0
- package/dist/rendering/world3d/VolumetricFog3D.d.ts +57 -0
- package/dist/rendering/world3d/VolumetricFog3D.js +230 -0
- package/dist/rendering/world3d/Water3D.d.ts +165 -0
- package/dist/rendering/world3d/Water3D.js +607 -0
- package/dist/rendering/world3d/core3D.d.ts +36 -0
- package/dist/rendering/world3d/core3D.js +99 -0
- package/dist/rendering/world3d/debug3D.d.ts +69 -0
- package/dist/rendering/world3d/debug3D.js +262 -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 +111 -0
- package/dist/rendering/world3d/geometries3D.js +610 -0
- package/dist/rendering/world3d/helpers3D.d.ts +67 -0
- package/dist/rendering/world3d/helpers3D.js +178 -0
- package/dist/rendering/world3d/index.d.ts +103 -0
- package/dist/rendering/world3d/index.js +62 -0
- package/dist/rendering/world3d/math3D.d.ts +114 -0
- package/dist/rendering/world3d/math3D.js +675 -0
- package/dist/rendering/world3d/primitives3D.d.ts +67 -0
- package/dist/rendering/world3d/primitives3D.js +197 -0
- package/dist/resources.d.ts +8 -0
- package/dist/resources.js +6 -0
- package/dist/saveStore.d.ts +71 -0
- package/dist/saveStore.js +182 -0
- package/dist/semanticList.d.ts +126 -0
- package/dist/semanticList.js +175 -0
- package/dist/semanticTree.d.ts +10 -0
- package/dist/semanticTree.js +539 -0
- package/dist/semanticTypes.d.ts +175 -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 +24 -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 +24 -0
- package/dist/text.js +4 -0
- package/dist/textField.d.ts +6 -0
- package/dist/textField.js +6 -0
- package/dist/textTable.d.ts +41 -0
- package/dist/textTable.js +114 -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 +182 -0
- package/dist/tilemapTypes.js +2 -0
- package/dist/timer.d.ts +34 -0
- package/dist/timer.js +119 -0
- package/dist/tween.d.ts +15 -0
- package/dist/tween.js +329 -0
- package/dist/tweenTypes.d.ts +31 -0
- package/dist/tweenTypes.js +2 -0
- package/dist/ui/controlKeys.d.ts +113 -0
- package/dist/ui/controlKeys.js +250 -0
- package/dist/ui/controls.d.ts +58 -0
- package/dist/ui/controls.js +290 -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 +98 -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 +53 -0
- package/dist/ui/rangeControl.js +168 -0
- package/dist/ui/scrollControl.d.ts +84 -0
- package/dist/ui/scrollControl.js +222 -0
- package/dist/ui/stateControls.d.ts +90 -0
- package/dist/ui/stateControls.js +331 -0
- package/dist/ui/textEditor.d.ts +54 -0
- package/dist/ui/textEditor.js +371 -0
- package/dist/ui/textEditorTypes.d.ts +85 -0
- package/dist/ui/textEditorTypes.js +2 -0
- package/dist/ui/textFieldControl.d.ts +100 -0
- package/dist/ui/textFieldControl.js +260 -0
- package/dist/ui/theme.d.ts +64 -0
- package/dist/ui/theme.js +166 -0
- package/dist/ui/types.d.ts +285 -0
- package/dist/ui/types.js +2 -0
- package/dist/ui/uiRoot.d.ts +4 -0
- package/dist/ui/uiRoot.js +1526 -0
- package/dist/ui/uiRootDisplay.d.ts +46 -0
- package/dist/ui/uiRootDisplay.js +148 -0
- package/dist/ui/uiRootModel.d.ts +114 -0
- package/dist/ui/uiRootModel.js +66 -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 +77 -0
- package/dist/videoTypes.js +2 -0
- package/dist/web/BrowserAssetBundle.d.ts +41 -0
- package/dist/web/BrowserAssetBundle.js +136 -0
- package/dist/web/BrowserAudio.d.ts +74 -0
- package/dist/web/BrowserAudio.js +503 -0
- package/dist/web/BrowserFrameLoop.d.ts +69 -0
- package/dist/web/BrowserFrameLoop.js +125 -0
- package/dist/web/BrowserGame.d.ts +174 -0
- package/dist/web/BrowserGame.js +473 -0
- package/dist/web/BrowserGamepadInput.d.ts +38 -0
- package/dist/web/BrowserGamepadInput.js +134 -0
- package/dist/web/BrowserHoverInput.d.ts +25 -0
- package/dist/web/BrowserHoverInput.js +266 -0
- package/dist/web/BrowserImageTextures.d.ts +72 -0
- package/dist/web/BrowserImageTextures.js +169 -0
- package/dist/web/BrowserInputActions.d.ts +63 -0
- package/dist/web/BrowserInputActions.js +345 -0
- package/dist/web/BrowserKeyboardInput.d.ts +4 -0
- package/dist/web/BrowserKeyboardInput.js +223 -0
- package/dist/web/BrowserPlay.d.ts +417 -0
- package/dist/web/BrowserPlay.js +1648 -0
- package/dist/web/BrowserPointerInput.d.ts +4 -0
- package/dist/web/BrowserPointerInput.js +511 -0
- package/dist/web/BrowserPreferences.d.ts +10 -0
- package/dist/web/BrowserPreferences.js +39 -0
- package/dist/web/BrowserSemantics.d.ts +36 -0
- package/dist/web/BrowserSemantics.js +418 -0
- package/dist/web/BrowserStatsPanel.d.ts +56 -0
- package/dist/web/BrowserStatsPanel.js +143 -0
- package/dist/web/BrowserStorage.d.ts +35 -0
- package/dist/web/BrowserStorage.js +132 -0
- package/dist/web/BrowserTextEditor.d.ts +52 -0
- package/dist/web/BrowserTextEditor.js +839 -0
- package/dist/web/BrowserTextInput.d.ts +89 -0
- package/dist/web/BrowserTextInput.js +524 -0
- package/dist/web/BrowserTextureProvider.d.ts +58 -0
- package/dist/web/BrowserTextureProvider.js +935 -0
- package/dist/web/BrowserVideo.d.ts +40 -0
- package/dist/web/BrowserVideo.js +237 -0
- package/dist/web/CanvasKitFontSetProvider.d.ts +32 -0
- package/dist/web/CanvasKitFontSetProvider.js +215 -0
- package/dist/web/CanvasKitParagraphProvider.d.ts +173 -0
- package/dist/web/CanvasKitParagraphProvider.js +692 -0
- package/dist/web/CanvasTextRasterProvider.d.ts +4 -0
- package/dist/web/CanvasTextRasterProvider.js +312 -0
- package/dist/web/ManifestByteSource.d.ts +151 -0
- package/dist/web/ManifestByteSource.js +975 -0
- package/dist/web/ManifestFontContentLoader.d.ts +13 -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 +2711 -0
- package/dist/web/WebGPUHost.d.ts +100 -0
- package/dist/web/WebGPUHost.js +3430 -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 +54 -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 +16 -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 +11 -0
- package/dist/web/kit.js +8 -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 +10 -0
- package/dist/web/play.js +9 -0
- package/dist/web/playMusic.d.ts +33 -0
- package/dist/web/playMusic.js +194 -0
- package/dist/web/playSfx.d.ts +36 -0
- package/dist/web/playSfx.js +112 -0
- package/dist/web/playTouch.d.ts +45 -0
- package/dist/web/playTouch.js +141 -0
- package/dist/web/playWidgets.d.ts +71 -0
- package/dist/web/playWidgets.js +431 -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 +63 -0
- package/dist/web/resources.d.ts +29 -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 +13 -0
- package/dist/web/sharedEffectShaders.js +181 -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 +33 -0
- package/dist/web/sharedWebGL2Options.js +102 -0
- package/dist/web/sharedWebGL2Shaders.d.ts +33 -0
- package/dist/web/sharedWebGL2Shaders.js +408 -0
- package/dist/web/sharedWebGPUOptions.d.ts +41 -0
- package/dist/web/sharedWebGPUOptions.js +130 -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 +72 -0
- package/dist/web/webgl2Native.js +572 -0
- package/dist/web/webgl2Types.d.ts +150 -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 +56 -0
- package/dist/web/webgpuImageResidency.js +65 -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 +85 -0
- package/dist/web/webgpuSharedPass.d.ts +7 -0
- package/dist/web/webgpuSharedPass.js +293 -0
- package/dist/web/webgpuSharedResolvePass.d.ts +3 -0
- package/dist/web/webgpuSharedResolvePass.js +34 -0
- package/dist/web/world3d/Audio3D.d.ts +85 -0
- package/dist/web/world3d/Audio3D.js +271 -0
- package/dist/web/world3d/BrowserPlay3D.d.ts +295 -0
- package/dist/web/world3d/BrowserPlay3D.js +1256 -0
- package/dist/web/world3d/FlyControls3D.d.ts +59 -0
- package/dist/web/world3d/FlyControls3D.js +162 -0
- package/dist/web/world3d/FollowControls3D.d.ts +31 -0
- package/dist/web/world3d/FollowControls3D.js +119 -0
- package/dist/web/world3d/OrbitControls3D.d.ts +58 -0
- package/dist/web/world3d/OrbitControls3D.js +189 -0
- package/dist/web/world3d/TransformControls3D.d.ts +37 -0
- package/dist/web/world3d/TransformControls3D.js +128 -0
- package/dist/web/world3d/WebGL2Renderer3D.d.ts +136 -0
- package/dist/web/world3d/WebGL2Renderer3D.js +1175 -0
- package/dist/web/world3d/WebGPURenderer3D.d.ts +112 -0
- package/dist/web/world3d/WebGPURenderer3D.js +1916 -0
- package/dist/web/world3d/World3DView.d.ts +54 -0
- package/dist/web/world3d/World3DView.js +79 -0
- package/dist/web/world3d/app3D.d.ts +143 -0
- package/dist/web/world3d/app3D.js +305 -0
- package/dist/web/world3d/assets3D.d.ts +39 -0
- package/dist/web/world3d/assets3D.js +112 -0
- package/dist/web/world3d/atmosphere3D.d.ts +56 -0
- package/dist/web/world3d/atmosphere3D.js +193 -0
- package/dist/web/world3d/canvasFont3D.d.ts +21 -0
- package/dist/web/world3d/canvasFont3D.js +165 -0
- package/dist/web/world3d/frame3D.d.ts +144 -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 +24 -0
- package/dist/web/world3d/host3D.js +61 -0
- package/dist/web/world3d/index.d.ts +40 -0
- package/dist/web/world3d/index.js +24 -0
- package/dist/web/world3d/loaders3D.d.ts +27 -0
- package/dist/web/world3d/loaders3D.js +138 -0
- package/dist/web/world3d/markers3D.d.ts +53 -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 +47 -0
- package/dist/web/world3d/overlay3D.js +187 -0
- package/dist/web/world3d/post3D.d.ts +116 -0
- package/dist/web/world3d/post3D.js +462 -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 +15 -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 +34 -0
- package/dist/web/world3d/stats3D.js +81 -0
- package/dist/web/world3d/webGL2FrameMetrics3D.d.ts +71 -0
- package/dist/web/world3d/webGL2FrameMetrics3D.js +185 -0
- package/dist/web/world3d/webgpu.d.ts +37 -0
- package/dist/web/world3d/webgpu.js +23 -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,34 @@
|
|
|
1
|
+
import type { Renderer3DInfo } from './frame3D.js';
|
|
2
|
+
/** 3D stats to make: the container they show in, how they smooth, and how often they refresh. */
|
|
3
|
+
export interface World3DStatsOptions {
|
|
4
|
+
/** Where the readout is shown; nothing is shown without it. */
|
|
5
|
+
readonly container?: HTMLElement;
|
|
6
|
+
/** Share of each new sample in the running averages. Defaults to 0.1. */
|
|
7
|
+
readonly smoothing?: number;
|
|
8
|
+
/** How often the text is rewritten, in milliseconds. Defaults to 250. */
|
|
9
|
+
readonly refreshMs?: number;
|
|
10
|
+
}
|
|
11
|
+
/** Frame times, frame rate, draws and triangles of a 3D view, measured each frame. */
|
|
12
|
+
export interface World3DStats {
|
|
13
|
+
/** Smoothed milliseconds: the whole frame, and each part named in `lap`. */
|
|
14
|
+
readonly average: Readonly<Record<string, number>>;
|
|
15
|
+
/** The longest frame lately, decaying slowly. */
|
|
16
|
+
readonly slowest: number;
|
|
17
|
+
readonly fps: number;
|
|
18
|
+
/** What the renderer reported for the last frame drawn. */
|
|
19
|
+
readonly drawCalls: number;
|
|
20
|
+
readonly triangles: number;
|
|
21
|
+
/** Call at the very start of a frame. */
|
|
22
|
+
begin(): void;
|
|
23
|
+
/** Closes the part of the frame since the previous mark, under `name`. */
|
|
24
|
+
lap(name: string): void;
|
|
25
|
+
/** Call after drawing; reads the renderer and rewrites the text when it is due. */
|
|
26
|
+
end(): void;
|
|
27
|
+
/** Removes the readout. */
|
|
28
|
+
dispose(): void;
|
|
29
|
+
}
|
|
30
|
+
/** Makes a panel that shows a 3D view's frame times and draws. */
|
|
31
|
+
export declare function createWorld3DStats(renderer: {
|
|
32
|
+
readonly info: Renderer3DInfo;
|
|
33
|
+
}, options?: World3DStatsOptions): World3DStats;
|
|
34
|
+
//# sourceMappingURL=stats3D.d.ts.map
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
2
|
+
// A small performance readout for a World3D game: frame time, the game's own
|
|
3
|
+
// parts of a frame, and what the renderer drew. It tells a slow device apart
|
|
4
|
+
// from a slow game. The numbers are gathered whether or not they are shown.
|
|
5
|
+
import { World3DError } from '../../rendering/world3d/core3D.js';
|
|
6
|
+
/** Makes a panel that shows a 3D view's frame times and draws. */
|
|
7
|
+
export function createWorld3DStats(renderer, options = {}) {
|
|
8
|
+
if (!renderer?.info)
|
|
9
|
+
throw new World3DError('WORLD3D_INPUT_INVALID', 'renderer');
|
|
10
|
+
const smoothing = options.smoothing ?? 0.1, refreshMs = options.refreshMs ?? 250;
|
|
11
|
+
if (!(smoothing > 0 && smoothing <= 1) || !(refreshMs >= 0))
|
|
12
|
+
throw new World3DError('WORLD3D_INPUT_INVALID', 'stats');
|
|
13
|
+
const now = () => (typeof performance !== 'undefined' ? performance.now() : Date.now());
|
|
14
|
+
const average = { frame: 0 };
|
|
15
|
+
let box, last = 0, mark = 0, shownAt = -Infinity, slowest = 0, drawCalls = 0, triangles = 0;
|
|
16
|
+
if (options.container) {
|
|
17
|
+
box = options.container.ownerDocument.createElement('pre');
|
|
18
|
+
box.className = 'egret-world3d-stats';
|
|
19
|
+
box.style.cssText =
|
|
20
|
+
'position:absolute;left:8px;top:8px;margin:0;padding:4px 6px;font:11px/1.35 ui-monospace,monospace;' +
|
|
21
|
+
'color:#e8f0ff;background:rgba(0,0,0,0.6);pointer-events:none;z-index:10;white-space:pre';
|
|
22
|
+
options.container.appendChild(box);
|
|
23
|
+
}
|
|
24
|
+
const blend = (name, value) => {
|
|
25
|
+
average[name] = (average[name] ?? value) + (value - (average[name] ?? value)) * smoothing;
|
|
26
|
+
};
|
|
27
|
+
const stats = {
|
|
28
|
+
average,
|
|
29
|
+
get slowest() {
|
|
30
|
+
return slowest;
|
|
31
|
+
},
|
|
32
|
+
get fps() {
|
|
33
|
+
return average['frame'] > 0 ? 1000 / average['frame'] : 0;
|
|
34
|
+
},
|
|
35
|
+
get drawCalls() {
|
|
36
|
+
return drawCalls;
|
|
37
|
+
},
|
|
38
|
+
get triangles() {
|
|
39
|
+
return triangles;
|
|
40
|
+
},
|
|
41
|
+
begin() {
|
|
42
|
+
const t = now();
|
|
43
|
+
if (last) {
|
|
44
|
+
const gap = t - last;
|
|
45
|
+
blend('frame', gap);
|
|
46
|
+
slowest = Math.max(slowest * 0.995, gap);
|
|
47
|
+
}
|
|
48
|
+
last = mark = t;
|
|
49
|
+
},
|
|
50
|
+
lap(name) {
|
|
51
|
+
if (typeof name !== 'string' || name === 'frame' || name === '')
|
|
52
|
+
throw new World3DError('WORLD3D_INPUT_INVALID', 'lap');
|
|
53
|
+
const t = now();
|
|
54
|
+
blend(name, t - mark);
|
|
55
|
+
mark = t;
|
|
56
|
+
},
|
|
57
|
+
end() {
|
|
58
|
+
const t = now();
|
|
59
|
+
drawCalls = renderer.info.drawCalls;
|
|
60
|
+
triangles = renderer.info.triangles;
|
|
61
|
+
if (!box || t - shownAt < refreshMs)
|
|
62
|
+
return;
|
|
63
|
+
shownAt = t;
|
|
64
|
+
const parts = Object.keys(average)
|
|
65
|
+
.filter(name => name !== 'frame')
|
|
66
|
+
.map(name => `${name} ${average[name].toFixed(2)} ms`);
|
|
67
|
+
const info = renderer.info;
|
|
68
|
+
box.textContent =
|
|
69
|
+
`${stats.fps.toFixed(0)} fps ${average['frame'].toFixed(1)} ms (slowest ${slowest.toFixed(1)})\n` +
|
|
70
|
+
(parts.length ? parts.join(' ') + '\n' : '') +
|
|
71
|
+
`draws ${info.drawCalls} triangles ${info.triangles} lights dropped ${info.lightsDropped}\n` +
|
|
72
|
+
`programs ${info.programs} geometries ${info.geometries} textures ${info.textures}`;
|
|
73
|
+
},
|
|
74
|
+
dispose() {
|
|
75
|
+
box?.remove();
|
|
76
|
+
box = undefined;
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
return stats;
|
|
80
|
+
}
|
|
81
|
+
//# sourceMappingURL=stats3D.js.map
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/** Which view a pass drew: the main one, a reflection, or offscreen. */
|
|
2
|
+
export type World3DViewKind = 'main' | 'reflection' | 'offscreen';
|
|
3
|
+
/** What a pass drew: color, shadows, a depth prepass, an outline mask or post-processing. */
|
|
4
|
+
export type World3DPassKind = 'color' | 'shadow' | 'depth-prepass' | 'outline-mask' | 'postprocess';
|
|
5
|
+
/** How long a pass took on the GPU, or why that is not known. */
|
|
6
|
+
export type World3DGpuTiming = {
|
|
7
|
+
readonly status: 'ready';
|
|
8
|
+
readonly milliseconds: number;
|
|
9
|
+
} | {
|
|
10
|
+
readonly status: 'disabled' | 'unsupported' | 'pending' | 'unavailable' | 'disjoint' | 'context-lost';
|
|
11
|
+
};
|
|
12
|
+
/** One pass of a frame: its view and kind, its size, its draws and triangles, and its times. */
|
|
13
|
+
export interface World3DFramePass {
|
|
14
|
+
readonly view: World3DViewKind;
|
|
15
|
+
/** Zero-based render() call within this application frame. */
|
|
16
|
+
readonly viewIndex: number;
|
|
17
|
+
readonly kind: World3DPassKind;
|
|
18
|
+
readonly width: number;
|
|
19
|
+
readonly height: number;
|
|
20
|
+
/** Shadow map edge lengths, including each cascade and point-light face. */
|
|
21
|
+
readonly shadowMapSizes?: readonly number[];
|
|
22
|
+
readonly drawCalls: number;
|
|
23
|
+
readonly triangles: number;
|
|
24
|
+
readonly cpuSubmissionMs: number;
|
|
25
|
+
/** Re-read after pollFrameTimings() to observe an asynchronously resolved sample. */
|
|
26
|
+
readonly gpuTime: World3DGpuTiming;
|
|
27
|
+
}
|
|
28
|
+
/** What a frame drew: its draws and triangles, its CPU time, and its passes and reflections. */
|
|
29
|
+
export interface World3DFrameMetrics {
|
|
30
|
+
readonly drawCalls: number;
|
|
31
|
+
readonly triangles: number;
|
|
32
|
+
/** Time in renderer calls, including render list preparation and WebGL submission. */
|
|
33
|
+
readonly cpuSubmissionMs: number;
|
|
34
|
+
readonly passes: readonly World3DFramePass[];
|
|
35
|
+
/** Successful planar reflection draws and scheduled reuse of an existing reflection. */
|
|
36
|
+
readonly reflections: {
|
|
37
|
+
readonly rendered: number;
|
|
38
|
+
readonly reused: number;
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
type MutablePass = {
|
|
42
|
+
-readonly [Key in keyof World3DFramePass]: World3DFramePass[Key];
|
|
43
|
+
};
|
|
44
|
+
interface PendingQuery {
|
|
45
|
+
readonly query: WebGLQuery;
|
|
46
|
+
readonly setResult: (timing: World3DGpuTiming) => void;
|
|
47
|
+
}
|
|
48
|
+
interface ActivePass {
|
|
49
|
+
readonly pass: MutablePass;
|
|
50
|
+
readonly started: number;
|
|
51
|
+
readonly timer?: PendingQuery;
|
|
52
|
+
}
|
|
53
|
+
/** Measures only opt-in WebGL2 application frames. Draw paths never wait for GPU results. */
|
|
54
|
+
export declare class WebGL2FrameMetrics3D {
|
|
55
|
+
#private;
|
|
56
|
+
private readonly gl;
|
|
57
|
+
constructor(gl: WebGL2RenderingContext);
|
|
58
|
+
capture(draw: () => void, gpu: boolean): World3DFrameMetrics;
|
|
59
|
+
recordReflection(kind: 'rendered' | 'reused'): void;
|
|
60
|
+
beginView(): number;
|
|
61
|
+
endView(started: number): void;
|
|
62
|
+
begin(view: World3DViewKind, viewIndex: number, kind: World3DPassKind, width: number, height: number, shadowMapSizes?: readonly number[]): ActivePass | undefined;
|
|
63
|
+
end(active: ActivePass | undefined): void;
|
|
64
|
+
record(drawCalls: number, triangles: number): void;
|
|
65
|
+
private startQuery;
|
|
66
|
+
poll(): void;
|
|
67
|
+
reset(lost: boolean): void;
|
|
68
|
+
private settlePending;
|
|
69
|
+
}
|
|
70
|
+
export {};
|
|
71
|
+
//# sourceMappingURL=webGL2FrameMetrics3D.d.ts.map
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
2
|
+
import { World3DError } from '../../rendering/world3d/core3D.js';
|
|
3
|
+
const MAX_PENDING_QUERIES = 64;
|
|
4
|
+
/** Measures only opt-in WebGL2 application frames. Draw paths never wait for GPU results. */
|
|
5
|
+
export class WebGL2FrameMetrics3D {
|
|
6
|
+
gl;
|
|
7
|
+
#capture;
|
|
8
|
+
#pass;
|
|
9
|
+
#extension;
|
|
10
|
+
#pending = [];
|
|
11
|
+
constructor(gl) {
|
|
12
|
+
this.gl = gl;
|
|
13
|
+
}
|
|
14
|
+
capture(draw, gpu) {
|
|
15
|
+
if (this.#capture)
|
|
16
|
+
throw new World3DError('WORLD3D_INPUT_INVALID', 'nested frame measurement');
|
|
17
|
+
if (gpu || this.#pending.length > 0)
|
|
18
|
+
this.poll();
|
|
19
|
+
const capture = {
|
|
20
|
+
passes: [],
|
|
21
|
+
gpu,
|
|
22
|
+
cpuSubmissionMs: 0,
|
|
23
|
+
viewIndex: 0,
|
|
24
|
+
reflections: { rendered: 0, reused: 0 }
|
|
25
|
+
};
|
|
26
|
+
this.#capture = capture;
|
|
27
|
+
try {
|
|
28
|
+
const result = draw();
|
|
29
|
+
if (result && typeof result.then === 'function') {
|
|
30
|
+
void Promise.resolve(result).catch(() => { });
|
|
31
|
+
throw new World3DError('WORLD3D_INPUT_INVALID', 'frame measurement must be synchronous');
|
|
32
|
+
}
|
|
33
|
+
const passes = Object.freeze(capture.passes);
|
|
34
|
+
let drawCalls = 0, triangles = 0;
|
|
35
|
+
for (const pass of passes) {
|
|
36
|
+
drawCalls += pass.drawCalls;
|
|
37
|
+
triangles += pass.triangles;
|
|
38
|
+
}
|
|
39
|
+
return Object.freeze({
|
|
40
|
+
drawCalls,
|
|
41
|
+
triangles,
|
|
42
|
+
cpuSubmissionMs: capture.cpuSubmissionMs,
|
|
43
|
+
passes,
|
|
44
|
+
reflections: Object.freeze(capture.reflections)
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
finally {
|
|
48
|
+
this.#capture = undefined;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
recordReflection(kind) {
|
|
52
|
+
if (this.#capture)
|
|
53
|
+
this.#capture.reflections[kind]++;
|
|
54
|
+
}
|
|
55
|
+
beginView() {
|
|
56
|
+
return this.#capture ? this.#capture.viewIndex++ : -1;
|
|
57
|
+
}
|
|
58
|
+
endView(started) {
|
|
59
|
+
if (this.#capture)
|
|
60
|
+
this.#capture.cpuSubmissionMs += performance.now() - started;
|
|
61
|
+
}
|
|
62
|
+
begin(view, viewIndex, kind, width, height, shadowMapSizes) {
|
|
63
|
+
const capture = this.#capture;
|
|
64
|
+
if (!capture)
|
|
65
|
+
return undefined;
|
|
66
|
+
let gpuTime = Object.freeze({ status: 'disabled' });
|
|
67
|
+
const pass = {
|
|
68
|
+
view,
|
|
69
|
+
viewIndex,
|
|
70
|
+
kind,
|
|
71
|
+
width,
|
|
72
|
+
height,
|
|
73
|
+
...(shadowMapSizes ? { shadowMapSizes: Object.freeze(shadowMapSizes) } : {}),
|
|
74
|
+
drawCalls: 0,
|
|
75
|
+
triangles: 0,
|
|
76
|
+
cpuSubmissionMs: 0,
|
|
77
|
+
get gpuTime() {
|
|
78
|
+
return gpuTime;
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
const timer = capture.gpu
|
|
82
|
+
? this.startQuery(timing => {
|
|
83
|
+
gpuTime = Object.freeze(timing);
|
|
84
|
+
})
|
|
85
|
+
: undefined;
|
|
86
|
+
this.#pass = pass;
|
|
87
|
+
return { pass, started: performance.now(), ...(timer ? { timer } : {}) };
|
|
88
|
+
}
|
|
89
|
+
end(active) {
|
|
90
|
+
if (!active)
|
|
91
|
+
return;
|
|
92
|
+
const { pass, timer } = active;
|
|
93
|
+
pass.cpuSubmissionMs = performance.now() - active.started;
|
|
94
|
+
this.#pass = undefined;
|
|
95
|
+
this.#capture?.passes.push(Object.freeze(pass));
|
|
96
|
+
if (!timer)
|
|
97
|
+
return;
|
|
98
|
+
if (this.gl.isContextLost()) {
|
|
99
|
+
timer.setResult({ status: 'context-lost' });
|
|
100
|
+
return;
|
|
101
|
+
}
|
|
102
|
+
this.gl.endQuery(this.#extension.TIME_ELAPSED_EXT);
|
|
103
|
+
this.#pending.push(timer);
|
|
104
|
+
}
|
|
105
|
+
record(drawCalls, triangles) {
|
|
106
|
+
const pass = this.#pass;
|
|
107
|
+
if (pass) {
|
|
108
|
+
pass.drawCalls += drawCalls;
|
|
109
|
+
pass.triangles += triangles;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
startQuery(setResult) {
|
|
113
|
+
const gl = this.gl;
|
|
114
|
+
if (gl.isContextLost()) {
|
|
115
|
+
setResult({ status: 'context-lost' });
|
|
116
|
+
return undefined;
|
|
117
|
+
}
|
|
118
|
+
if (this.#extension === undefined) {
|
|
119
|
+
const extension = gl.getExtension('EXT_disjoint_timer_query_webgl2');
|
|
120
|
+
const counterBits = extension && gl.getQuery(extension.TIME_ELAPSED_EXT, extension.QUERY_COUNTER_BITS_EXT);
|
|
121
|
+
this.#extension = typeof counterBits === 'number' && counterBits > 0 ? extension : null;
|
|
122
|
+
}
|
|
123
|
+
const extension = this.#extension;
|
|
124
|
+
if (!extension) {
|
|
125
|
+
setResult({ status: 'unsupported' });
|
|
126
|
+
return undefined;
|
|
127
|
+
}
|
|
128
|
+
// Interop can already own a TIME_ELAPSED query on this context.
|
|
129
|
+
if (this.#pending.length >= MAX_PENDING_QUERIES || gl.getQuery(extension.TIME_ELAPSED_EXT, gl.CURRENT_QUERY)) {
|
|
130
|
+
setResult({ status: 'unavailable' });
|
|
131
|
+
return undefined;
|
|
132
|
+
}
|
|
133
|
+
const query = gl.createQuery();
|
|
134
|
+
if (!query) {
|
|
135
|
+
setResult({ status: 'unavailable' });
|
|
136
|
+
return undefined;
|
|
137
|
+
}
|
|
138
|
+
// Clear a stale disjoint flag before the first query of a new batch.
|
|
139
|
+
if (!this.#pending.length)
|
|
140
|
+
gl.getParameter(extension.GPU_DISJOINT_EXT);
|
|
141
|
+
gl.beginQuery(extension.TIME_ELAPSED_EXT, query);
|
|
142
|
+
setResult({ status: 'pending' });
|
|
143
|
+
return { query, setResult };
|
|
144
|
+
}
|
|
145
|
+
poll() {
|
|
146
|
+
if (!this.#pending.length)
|
|
147
|
+
return;
|
|
148
|
+
const gl = this.gl, extension = this.#extension;
|
|
149
|
+
if (gl.isContextLost()) {
|
|
150
|
+
this.reset(true);
|
|
151
|
+
return;
|
|
152
|
+
}
|
|
153
|
+
// Elapsed query results become available in submission order.
|
|
154
|
+
let ready = 0;
|
|
155
|
+
while (ready < this.#pending.length && gl.getQueryParameter(this.#pending[ready].query, gl.QUERY_RESULT_AVAILABLE))
|
|
156
|
+
ready++;
|
|
157
|
+
if (gl.getParameter(extension.GPU_DISJOINT_EXT)) {
|
|
158
|
+
this.settlePending('disjoint', true);
|
|
159
|
+
return;
|
|
160
|
+
}
|
|
161
|
+
for (let i = 0; i < ready; i++) {
|
|
162
|
+
const { query, setResult } = this.#pending[i];
|
|
163
|
+
const elapsed = gl.getQueryParameter(query, gl.QUERY_RESULT);
|
|
164
|
+
gl.deleteQuery(query);
|
|
165
|
+
setResult(typeof elapsed === 'number' && Number.isFinite(elapsed) && elapsed >= 0
|
|
166
|
+
? { status: 'ready', milliseconds: elapsed / 1e6 }
|
|
167
|
+
: { status: 'unavailable' });
|
|
168
|
+
}
|
|
169
|
+
if (ready > 0)
|
|
170
|
+
this.#pending.splice(0, ready);
|
|
171
|
+
}
|
|
172
|
+
reset(lost) {
|
|
173
|
+
this.settlePending(lost ? 'context-lost' : 'unavailable', !lost);
|
|
174
|
+
this.#extension = undefined;
|
|
175
|
+
}
|
|
176
|
+
settlePending(status, remove) {
|
|
177
|
+
for (const { query, setResult } of this.#pending) {
|
|
178
|
+
if (remove)
|
|
179
|
+
this.gl.deleteQuery(query);
|
|
180
|
+
setResult({ status });
|
|
181
|
+
}
|
|
182
|
+
this.#pending.length = 0;
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
//# sourceMappingURL=webGL2FrameMetrics3D.js.map
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
export { WebGPURenderer3D, createWebGPURenderer3D } from './WebGPURenderer3D.js';
|
|
2
|
+
export type { WebGPURenderer3DOptions } from './WebGPURenderer3D.js';
|
|
3
|
+
export type { Renderer3D, Renderer3DInfo, ToneMapping3D } from './frame3D.js';
|
|
4
|
+
export { OrbitControls3D, createOrbitControls3D } from './OrbitControls3D.js';
|
|
5
|
+
export type { OrbitControlsOptions3D } from './OrbitControls3D.js';
|
|
6
|
+
export { loadTexture3D, loadCubeTexture3D, loadGltfFromUrl3D } from './loaders3D.js';
|
|
7
|
+
export type { LoadOptions3D, TextureLoadOptions3D, GltfUrlLoadOptions3D } from './loaders3D.js';
|
|
8
|
+
export { GLTF_ASSET_3D, TEXTURE_ASSET_3D, CUBE_TEXTURE_ASSET_3D, SCENE_ASSET_3D, registerWorld3DAssets } from './assets3D.js';
|
|
9
|
+
export type { World3DAssetOptions } from './assets3D.js';
|
|
10
|
+
export { World3DView, createWorld3DView } from './World3DView.js';
|
|
11
|
+
export type { World3DClockSource, World3DViewOptions } from './World3DView.js';
|
|
12
|
+
export { createWorld3DHost, startWorld3DLoop } from './host3D.js';
|
|
13
|
+
export type { World3DLoopSource } from './host3D.js';
|
|
14
|
+
export { POST3D_LIMITS, createPostProcessSettings3D, createCustomPost3D } from './post3D.js';
|
|
15
|
+
export type { PostProcessSettings3D, CustomPost3D } from './post3D.js';
|
|
16
|
+
export { FlyControls3D, createFlyControls3D } from './FlyControls3D.js';
|
|
17
|
+
export type { FlyControlsOptions3D, FlyControlsKeys3D } from './FlyControls3D.js';
|
|
18
|
+
export { AudioListener3D, PositionalAudio3D, createAudioListener3D, createPositionalAudio3D } from './Audio3D.js';
|
|
19
|
+
export type { AudioListenerOptions3D, PositionalAudioOptions3D } from './Audio3D.js';
|
|
20
|
+
export { captureCubeTexture3D } from './probe3D.js';
|
|
21
|
+
export type { CubeCaptureOptions3D } from './probe3D.js';
|
|
22
|
+
export { TransformControls3D, createTransformControls3D } from './TransformControls3D.js';
|
|
23
|
+
export { FollowControls3D, createFollowControls3D } from './FollowControls3D.js';
|
|
24
|
+
export type { FollowControlsOptions3D } from './FollowControls3D.js';
|
|
25
|
+
export { Atmosphere3D, createAtmosphere3D } from './atmosphere3D.js';
|
|
26
|
+
export type { AtmosphereOptions3D } from './atmosphere3D.js';
|
|
27
|
+
export { createCanvasFont3D } from './canvasFont3D.js';
|
|
28
|
+
export type { CanvasFontOptions3D } from './canvasFont3D.js';
|
|
29
|
+
export { WORLD3D_QUALITY_PRESETS, createDynamicResolution3D, createWorld3DApp, pickWorld3DBackend, pickWorld3DQuality, isSoftwareRendered3D } from './app3D.js';
|
|
30
|
+
export type { DynamicResolution3D, DynamicResolutionOptions3D, World3DApp, World3DAppOptions, World3DBackend, World3DDeviceHints, World3DQuality, World3DQualityPreset, World3DShowOptions } from './app3D.js';
|
|
31
|
+
export { createScreenMarkers3D } from './markers3D.js';
|
|
32
|
+
export type { ScreenMarker3D, ScreenMarkerOptions3D, ScreenMarkers3D, ScreenMarkersOptions3D } from './markers3D.js';
|
|
33
|
+
export { createWorld3DStats } from './stats3D.js';
|
|
34
|
+
export type { World3DStats, World3DStatsOptions } from './stats3D.js';
|
|
35
|
+
export { createWorld3DOverlay } from './overlay3D.js';
|
|
36
|
+
export type { World3DOverlay, World3DOverlayOptions } from './overlay3D.js';
|
|
37
|
+
//# sourceMappingURL=webgpu.d.ts.map
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
2
|
+
// Explicit WebGPU entry for the world3d scene graph. It shares the orbit
|
|
3
|
+
// controls, browser loaders and Engine clock binding with the WebGL2 entry
|
|
4
|
+
// and loads no WebGL2 module.
|
|
5
|
+
export { WebGPURenderer3D, createWebGPURenderer3D } from './WebGPURenderer3D.js';
|
|
6
|
+
export { OrbitControls3D, createOrbitControls3D } from './OrbitControls3D.js';
|
|
7
|
+
export { loadTexture3D, loadCubeTexture3D, loadGltfFromUrl3D } from './loaders3D.js';
|
|
8
|
+
export { GLTF_ASSET_3D, TEXTURE_ASSET_3D, CUBE_TEXTURE_ASSET_3D, SCENE_ASSET_3D, registerWorld3DAssets } from './assets3D.js';
|
|
9
|
+
export { World3DView, createWorld3DView } from './World3DView.js';
|
|
10
|
+
export { createWorld3DHost, startWorld3DLoop } from './host3D.js';
|
|
11
|
+
export { POST3D_LIMITS, createPostProcessSettings3D, createCustomPost3D } from './post3D.js';
|
|
12
|
+
export { FlyControls3D, createFlyControls3D } from './FlyControls3D.js';
|
|
13
|
+
export { AudioListener3D, PositionalAudio3D, createAudioListener3D, createPositionalAudio3D } from './Audio3D.js';
|
|
14
|
+
export { captureCubeTexture3D } from './probe3D.js';
|
|
15
|
+
export { TransformControls3D, createTransformControls3D } from './TransformControls3D.js';
|
|
16
|
+
export { FollowControls3D, createFollowControls3D } from './FollowControls3D.js';
|
|
17
|
+
export { Atmosphere3D, createAtmosphere3D } from './atmosphere3D.js';
|
|
18
|
+
export { createCanvasFont3D } from './canvasFont3D.js';
|
|
19
|
+
export { WORLD3D_QUALITY_PRESETS, createDynamicResolution3D, createWorld3DApp, pickWorld3DBackend, pickWorld3DQuality, isSoftwareRendered3D } from './app3D.js';
|
|
20
|
+
export { createScreenMarkers3D } from './markers3D.js';
|
|
21
|
+
export { createWorld3DStats } from './stats3D.js';
|
|
22
|
+
export { createWorld3DOverlay } from './overlay3D.js';
|
|
23
|
+
//# sourceMappingURL=webgpu.js.map
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { Attribute3D, Geometry3D, MorphTarget3D } from '../../rendering/world3d/Geometry3D.js';
|
|
2
|
+
import type { Mesh3D } from '../../rendering/world3d/Mesh3D.js';
|
|
3
|
+
export declare function convertVertexAttribute3D(name: string, attribute: Attribute3D): Float32Array | Uint32Array;
|
|
4
|
+
export declare function packMorphStorage3D(targets: readonly MorphTarget3D[], channels: number, vertexCount: number): Float32Array;
|
|
5
|
+
export declare function packWireIndices3D(geometry: Geometry3D): Uint32Array;
|
|
6
|
+
/** The renderer calls this only when its geometry has a morph storage buffer. */
|
|
7
|
+
export declare function writeObjectMorph3D(mesh: Mesh3D, gpu: {
|
|
8
|
+
readonly morph: {
|
|
9
|
+
readonly vertexCount: number;
|
|
10
|
+
readonly channels: number;
|
|
11
|
+
} | undefined;
|
|
12
|
+
}, floats: Float32Array, ints: Int32Array, o: number): void;
|
|
13
|
+
//# sourceMappingURL=webgpuPacking3D.d.ts.map
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { SkinnedInstancedMesh3D } from '../../rendering/world3d/AnimationTexture3D.js';
|
|
2
|
+
import { MAX_MORPH_INFLUENCES_WGSL_3D } from './wgsl3D.js';
|
|
3
|
+
export function convertVertexAttribute3D(name, attribute) {
|
|
4
|
+
const data = attribute.data;
|
|
5
|
+
// Joint indices stay integers; everything else is uploaded as 32-bit floats,
|
|
6
|
+
// which sidesteps the vertex formats WebGPU does not offer.
|
|
7
|
+
if (name === 'joints')
|
|
8
|
+
return data instanceof Uint32Array ? data : Uint32Array.from(data);
|
|
9
|
+
if (data instanceof Float32Array)
|
|
10
|
+
return data;
|
|
11
|
+
const out = new Float32Array(data.length);
|
|
12
|
+
if (!attribute.normalized) {
|
|
13
|
+
out.set(data);
|
|
14
|
+
return out;
|
|
15
|
+
}
|
|
16
|
+
const signed = data instanceof Int8Array || data instanceof Int16Array, max = signed
|
|
17
|
+
? data instanceof Int8Array
|
|
18
|
+
? 127
|
|
19
|
+
: 32767
|
|
20
|
+
: data instanceof Uint8Array
|
|
21
|
+
? 255
|
|
22
|
+
: data instanceof Uint16Array
|
|
23
|
+
? 65535
|
|
24
|
+
: 4294967295;
|
|
25
|
+
for (let i = 0; i < data.length; i++)
|
|
26
|
+
out[i] = signed ? Math.max(data[i] / max, -1) : data[i] / max;
|
|
27
|
+
return out;
|
|
28
|
+
}
|
|
29
|
+
export function packMorphStorage3D(targets, channels, vertexCount) {
|
|
30
|
+
const data = new Float32Array(targets.length * channels * vertexCount * 4);
|
|
31
|
+
targets.forEach((target, t) => {
|
|
32
|
+
[target.position, target.normal].slice(0, channels).forEach((source, k) => {
|
|
33
|
+
if (!source)
|
|
34
|
+
return;
|
|
35
|
+
const base = (t * channels + k) * vertexCount * 4;
|
|
36
|
+
for (let v = 0; v < vertexCount; v++) {
|
|
37
|
+
data[base + v * 4] = source[v * 3];
|
|
38
|
+
data[base + v * 4 + 1] = source[v * 3 + 1];
|
|
39
|
+
data[base + v * 4 + 2] = source[v * 3 + 2];
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
});
|
|
43
|
+
return data;
|
|
44
|
+
}
|
|
45
|
+
export function packWireIndices3D(geometry) {
|
|
46
|
+
const source = geometry.index?.data, triangles = Math.floor(geometry.drawCount / 3), lines = new Uint32Array(triangles * 6);
|
|
47
|
+
for (let t = 0; t < triangles; t++) {
|
|
48
|
+
const a = source ? source[t * 3] : t * 3, b = source ? source[t * 3 + 1] : t * 3 + 1, c = source ? source[t * 3 + 2] : t * 3 + 2;
|
|
49
|
+
lines.set([a, b, b, c, c, a], t * 6);
|
|
50
|
+
}
|
|
51
|
+
return lines;
|
|
52
|
+
}
|
|
53
|
+
/** The renderer calls this only when its geometry has a morph storage buffer. */
|
|
54
|
+
export function writeObjectMorph3D(mesh, gpu, floats, ints, o) {
|
|
55
|
+
// Keep the strongest influences; the shader blends at most a fixed number.
|
|
56
|
+
const weights = mesh.morphWeights, indices = o + 48, values = o + 56;
|
|
57
|
+
let count = 0;
|
|
58
|
+
for (let i = 0; i < weights.length; i++) {
|
|
59
|
+
const weight = weights[i];
|
|
60
|
+
if (weight === 0)
|
|
61
|
+
continue;
|
|
62
|
+
if (count < MAX_MORPH_INFLUENCES_WGSL_3D) {
|
|
63
|
+
ints[indices + count] = i;
|
|
64
|
+
floats[values + count] = weight;
|
|
65
|
+
count++;
|
|
66
|
+
continue;
|
|
67
|
+
}
|
|
68
|
+
let weakest = 0;
|
|
69
|
+
for (let k = 1; k < count; k++)
|
|
70
|
+
if (Math.abs(floats[values + k]) < Math.abs(floats[values + weakest]))
|
|
71
|
+
weakest = k;
|
|
72
|
+
if (Math.abs(weight) > Math.abs(floats[values + weakest])) {
|
|
73
|
+
ints[indices + weakest] = i;
|
|
74
|
+
floats[values + weakest] = weight;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
// Baked instances take their morph weights from the table; the shader only needs to know how many targets to read.
|
|
78
|
+
if (mesh instanceof SkinnedInstancedMesh3D && !mesh.skeleton)
|
|
79
|
+
count = Math.min(MAX_MORPH_INFLUENCES_WGSL_3D, mesh.animations.morphCount, mesh.geometry.morphTargets.length);
|
|
80
|
+
ints[o + 44] = gpu.morph.vertexCount;
|
|
81
|
+
ints[o + 45] = gpu.morph.channels;
|
|
82
|
+
ints[o + 46] = count;
|
|
83
|
+
ints[o + 47] = 0;
|
|
84
|
+
}
|
|
85
|
+
//# sourceMappingURL=webgpuPacking3D.js.map
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
export interface ShaderFeatures3D {
|
|
2
|
+
readonly shading: 'unlit' | 'lambert' | 'phong' | 'standard' | 'toon' | 'matcap';
|
|
3
|
+
readonly depthOnly: boolean;
|
|
4
|
+
readonly normal: boolean;
|
|
5
|
+
readonly uv: boolean;
|
|
6
|
+
readonly tangent: boolean;
|
|
7
|
+
readonly vertexColor: boolean;
|
|
8
|
+
readonly skinning: boolean;
|
|
9
|
+
readonly morph: boolean;
|
|
10
|
+
readonly morphNormals: boolean;
|
|
11
|
+
readonly instancing: boolean;
|
|
12
|
+
readonly instanceColor: boolean;
|
|
13
|
+
readonly billboard: boolean;
|
|
14
|
+
readonly screenSpace: boolean;
|
|
15
|
+
readonly map: boolean;
|
|
16
|
+
readonly mapFromTarget: boolean;
|
|
17
|
+
readonly normalMap: boolean;
|
|
18
|
+
readonly metallicRoughnessMap: boolean;
|
|
19
|
+
readonly occlusionMap: boolean;
|
|
20
|
+
readonly emissiveMap: boolean;
|
|
21
|
+
readonly alphaMask: boolean;
|
|
22
|
+
readonly alphaBlend: boolean;
|
|
23
|
+
readonly premultipliedAlpha: boolean;
|
|
24
|
+
readonly flatShading: boolean;
|
|
25
|
+
readonly doubleSided: boolean;
|
|
26
|
+
readonly receiveShadow: boolean;
|
|
27
|
+
readonly environment: boolean;
|
|
28
|
+
readonly fog: boolean;
|
|
29
|
+
readonly toneMapped: boolean;
|
|
30
|
+
readonly linearOutput: boolean;
|
|
31
|
+
/** The geometry's second coordinate set is bound, for occlusion or emissive maps that ask for it. */
|
|
32
|
+
readonly uv1: boolean;
|
|
33
|
+
readonly lightMap: boolean;
|
|
34
|
+
readonly lightUv1: boolean;
|
|
35
|
+
/** Standard material that lets light through and reads the stored scene behind it. */
|
|
36
|
+
readonly transmission: boolean;
|
|
37
|
+
readonly occlusionUv1: boolean;
|
|
38
|
+
readonly emissiveUv1: boolean;
|
|
39
|
+
/** Key and WGSL source of the material's fragment hook, when it has one. */
|
|
40
|
+
readonly customKey?: string;
|
|
41
|
+
readonly customWgsl?: string;
|
|
42
|
+
readonly customVertexWgsl?: string;
|
|
43
|
+
readonly customNormalWgsl?: string;
|
|
44
|
+
/** Standard material with a mirror image read at the pixel's place on screen. */
|
|
45
|
+
readonly reflectionMap?: boolean;
|
|
46
|
+
/** Instances posed from a table of baked bone matrices. */
|
|
47
|
+
readonly skinInstancing?: boolean;
|
|
48
|
+
/** Instance slots hold particle parameters and the vertex stage moves the particles. */
|
|
49
|
+
readonly gpuParticles?: boolean;
|
|
50
|
+
/** Blended surface that fades where it nears the solid scene. */
|
|
51
|
+
readonly softDepth?: boolean;
|
|
52
|
+
/** Ground layers blended by a weight map; they use the map, emissive, occlusion, metallic-roughness and light map slots. */
|
|
53
|
+
readonly splat?: boolean;
|
|
54
|
+
}
|
|
55
|
+
export declare const MAX_MORPH_INFLUENCES_WGSL_3D = 8;
|
|
56
|
+
/** Bytes of the per-draw Object uniform block; also its dynamic-offset stride. */
|
|
57
|
+
export declare const OBJECT_BLOCK_BYTES_3D = 256;
|
|
58
|
+
/** Bytes of the per-material uniform block. */
|
|
59
|
+
export declare const MATERIAL_BLOCK_BYTES_3D = 256;
|
|
60
|
+
/** Assemble the complete WGSL module for one material variant. */
|
|
61
|
+
export declare function buildMaterialWgsl3D(features: ShaderFeatures3D): string;
|
|
62
|
+
/** Stable cache key for a feature set. */
|
|
63
|
+
export declare function shaderFeatureKey3D(features: ShaderFeatures3D): string;
|
|
64
|
+
/** Full-screen triangle sampling a cube map along the view ray, drawn at the far plane. */
|
|
65
|
+
export declare const SKYBOX_WGSL_3D = "\nstruct Sky {\n inverseViewProjection: mat4x4f,\n output: vec4f, // x: intensity, y: 1 keeps linear output, z: exposure, w: tone mapping\n}\n@group(0) @binding(0) var<uniform> sky: Sky;\n@group(0) @binding(1) var skyMap: texture_cube<f32>;\n@group(0) @binding(2) var skySampler: sampler;\nstruct SkyOutput {\n @builtin(position) clip: vec4f,\n @location(0) direction: vec3f,\n}\n@vertex\nfn vertexMain(@builtin(vertex_index) index: u32) -> SkyOutput {\n let corner = vec2f(f32((index << 1u) & 2u), f32(index & 2u)) * 2.0 - 1.0;\n let far = sky.inverseViewProjection * vec4f(corner, 1.0, 1.0);\n let near = sky.inverseViewProjection * vec4f(corner, -1.0, 1.0);\n var output: SkyOutput;\n output.direction = far.xyz / far.w - near.xyz / near.w;\n output.clip = vec4f(corner, 1.0, 1.0);\n return output;\n}\n@fragment\nfn fragmentMain(input: SkyOutput) -> @location(0) vec4f {\n var color = textureSample(skyMap, skySampler, normalize(input.direction)).rgb * sky.output.x * sky.output.z;\n if (sky.output.w > 1.5) { color = clamp((color * (2.51 * color + 0.03)) / (color * (2.43 * color + 0.59) + 0.14), vec3f(0.0), vec3f(1.0)); }\n else if (sky.output.w > 0.5) { color = color / (1.0 + color); }\n if (sky.output.y < 0.5) { color = clamp(color, vec3f(0.0), vec3f(1.0)); color = mix(color * 12.92, 1.055 * pow(color, vec3f(1.0 / 2.4)) - 0.055, step(vec3f(0.0031308), color)); }\n return vec4f(color, 1.0);\n}\n";
|
|
66
|
+
/** Downsample one mip level into the next with a linear filter. */
|
|
67
|
+
export declare const MIPMAP_WGSL_3D = "\n@group(0) @binding(0) var source: texture_2d<f32>;\n@group(0) @binding(1) var sourceSampler: sampler;\nstruct MipOutput {\n @builtin(position) clip: vec4f,\n @location(0) uv: vec2f,\n}\n@vertex\nfn vertexMain(@builtin(vertex_index) index: u32) -> MipOutput {\n let corner = vec2f(f32((index << 1u) & 2u), f32(index & 2u));\n var output: MipOutput;\n output.uv = vec2f(corner.x, 1.0 - corner.y);\n output.clip = vec4f(corner * 2.0 - 1.0, 0.0, 1.0);\n return output;\n}\n@fragment\nfn fragmentMain(input: MipOutput) -> @location(0) vec4f {\n return textureSample(source, sourceSampler, input.uv);\n}\n";
|
|
68
|
+
//# sourceMappingURL=wgsl3D.d.ts.map
|