@egret/engine 7.0.1-rc.3 → 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/dist/Engine.js +7 -2
- package/dist/animation/sequenceResetTypes.d.ts +6 -0
- package/dist/animation/types.d.ts +6 -0
- package/dist/assetBundle.d.ts +2 -0
- package/dist/assetGroupTypes.d.ts +2 -0
- package/dist/audioCues.d.ts +4 -0
- package/dist/audioTypes.d.ts +13 -0
- package/dist/bitmapButtonTypes.d.ts +2 -0
- package/dist/bitmapFontTypes.d.ts +3 -0
- package/dist/bitmapResourceSlot.d.ts +1 -0
- package/dist/camera2d.js +10 -2
- package/dist/cameraTypes.d.ts +12 -0
- package/dist/contentTypes.d.ts +2 -0
- package/dist/createEngineForProfile.js +8 -5
- package/dist/fontContentTypes.d.ts +5 -0
- package/dist/gameClockTypes.d.ts +6 -0
- package/dist/gameRun.d.ts +3 -0
- package/dist/gamepadTypes.d.ts +8 -0
- package/dist/hoverInputTypes.d.ts +10 -0
- package/dist/index.d.ts +5 -2
- package/dist/index.js +2 -1
- package/dist/inputActions.d.ts +5 -0
- package/dist/internal/uiFactoryState.d.ts +4 -0
- package/dist/internal/uiFactoryState.js +18 -2
- package/dist/keyboardInput.d.ts +1 -0
- package/dist/keyboardInput.js +1 -0
- package/dist/keyboardInputTypes.d.ts +12 -0
- package/dist/kit.d.ts +3 -1
- package/dist/kit.js +2 -1
- package/dist/manifestResourceState.d.ts +1 -0
- package/dist/manifestResourceState.js +1 -0
- package/dist/manifestResourceTypes.d.ts +1 -0
- package/dist/motion.d.ts +2 -0
- package/dist/mouseInputTypes.d.ts +4 -0
- package/dist/particleEmitter.js +8 -0
- package/dist/particleTypes.d.ts +8 -0
- package/dist/physics2d.d.ts +2 -2
- package/dist/physics2d.js +1 -1
- package/dist/physics2dTypes.d.ts +55 -1
- package/dist/physics2dWorld.js +209 -9
- package/dist/pointerInput.d.ts +1 -0
- package/dist/pointerInput.js +1 -0
- package/dist/pointerInputTypes.d.ts +3 -0
- package/dist/random.d.ts +1 -0
- package/dist/rendering/packSharedDraws2D.js +53 -5
- package/dist/rendering/prepareSharedDraws2D.d.ts +2 -0
- package/dist/rendering/prepareSharedDraws2D.js +17 -6
- package/dist/rendering/sharedColor2D.d.ts +35 -1
- package/dist/rendering/sharedColor2D.js +131 -8
- package/dist/rendering/sharedEffects2D.js +16 -8
- package/dist/rendering/world3d/Animation3D.d.ts +9 -0
- package/dist/rendering/world3d/Animation3D.js +4 -0
- package/dist/rendering/world3d/AnimationTexture3D.d.ts +6 -0
- package/dist/rendering/world3d/AnimationTexture3D.js +2 -0
- package/dist/rendering/world3d/Batch3D.d.ts +4 -0
- package/dist/rendering/world3d/Batch3D.js +3 -0
- package/dist/rendering/world3d/Camera3D.d.ts +5 -0
- package/dist/rendering/world3d/Camera3D.js +3 -0
- package/dist/rendering/world3d/Character3D.d.ts +4 -0
- package/dist/rendering/world3d/Character3D.js +2 -0
- package/dist/rendering/world3d/Cloth3D.d.ts +18 -3
- package/dist/rendering/world3d/Cloth3D.js +6 -1
- package/dist/rendering/world3d/Compression3D.d.ts +1 -0
- package/dist/rendering/world3d/Compression3D.js +1 -0
- package/dist/rendering/world3d/Curves3D.d.ts +8 -0
- package/dist/rendering/world3d/Curves3D.js +5 -0
- package/dist/rendering/world3d/Decal3D.d.ts +2 -0
- package/dist/rendering/world3d/Decal3D.js +1 -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 +11 -1
- package/dist/rendering/world3d/Geometry3D.js +10 -1
- package/dist/rendering/world3d/GeometryBuilder3D.d.ts +2 -0
- package/dist/rendering/world3d/Gizmo3D.d.ts +5 -0
- package/dist/rendering/world3d/Gizmo3D.js +2 -0
- package/dist/rendering/world3d/Gltf3D.d.ts +6 -0
- package/dist/rendering/world3d/Gltf3D.js +25 -5
- package/dist/rendering/world3d/GpuParticles3D.d.ts +2 -0
- package/dist/rendering/world3d/GpuParticles3D.js +1 -0
- package/dist/rendering/world3d/Hdr3D.d.ts +2 -0
- package/dist/rendering/world3d/Hdr3D.js +1 -0
- package/dist/rendering/world3d/Jelly3D.d.ts +2 -0
- package/dist/rendering/world3d/Jelly3D.js +1 -0
- package/dist/rendering/world3d/Ktx23D.d.ts +3 -0
- package/dist/rendering/world3d/Light3D.d.ts +9 -0
- package/dist/rendering/world3d/Light3D.js +4 -0
- package/dist/rendering/world3d/Material3D.d.ts +10 -0
- package/dist/rendering/world3d/Material3D.js +2 -0
- package/dist/rendering/world3d/Mesh3D.d.ts +4 -0
- package/dist/rendering/world3d/Mesh3D.js +16 -2
- package/dist/rendering/world3d/Meshopt3D.d.ts +3 -0
- package/dist/rendering/world3d/Meshopt3D.js +1 -0
- package/dist/rendering/world3d/Navigation3D.d.ts +41 -1
- package/dist/rendering/world3d/Navigation3D.js +74 -2
- package/dist/rendering/world3d/Object3D.d.ts +11 -0
- package/dist/rendering/world3d/Object3D.js +10 -0
- package/dist/rendering/world3d/Particles3D.d.ts +5 -0
- package/dist/rendering/world3d/Particles3D.js +3 -0
- package/dist/rendering/world3d/Physics3D.d.ts +14 -0
- package/dist/rendering/world3d/Physics3D.js +5 -0
- package/dist/rendering/world3d/PhysicsHull3D.d.ts +2 -0
- package/dist/rendering/world3d/PhysicsHull3D.js +2 -0
- package/dist/rendering/world3d/PhysicsMesh3D.d.ts +2 -0
- package/dist/rendering/world3d/PhysicsMesh3D.js +2 -0
- package/dist/rendering/world3d/PhysicsRemote3D.d.ts +5 -0
- package/dist/rendering/world3d/PhysicsRemote3D.js +2 -0
- package/dist/rendering/world3d/Ragdoll3D.d.ts +5 -0
- package/dist/rendering/world3d/Ragdoll3D.js +2 -0
- package/dist/rendering/world3d/Raycast3D.d.ts +3 -0
- package/dist/rendering/world3d/Raycast3D.js +1 -0
- package/dist/rendering/world3d/RenderList3D.d.ts +3 -0
- package/dist/rendering/world3d/RenderList3D.js +12 -0
- package/dist/rendering/world3d/Retarget3D.d.ts +1 -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 +17 -0
- package/dist/rendering/world3d/Serialize3D.js +22 -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 +9 -0
- package/dist/rendering/world3d/StateMachine3D.js +3 -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 +21 -0
- package/dist/rendering/world3d/Terrain3D.js +25 -1
- package/dist/rendering/world3d/Text3D.d.ts +5 -0
- package/dist/rendering/world3d/Text3D.js +2 -0
- package/dist/rendering/world3d/Texture3D.d.ts +16 -1
- package/dist/rendering/world3d/Texture3D.js +19 -1
- package/dist/rendering/world3d/Trail3D.d.ts +3 -0
- package/dist/rendering/world3d/Trail3D.js +2 -0
- package/dist/rendering/world3d/Vehicle3D.d.ts +5 -0
- package/dist/rendering/world3d/Vehicle3D.js +2 -0
- package/dist/rendering/world3d/VolumetricFog3D.d.ts +2 -0
- package/dist/rendering/world3d/VolumetricFog3D.js +1 -0
- package/dist/rendering/world3d/Water3D.d.ts +2 -0
- package/dist/rendering/world3d/Water3D.js +1 -0
- package/dist/rendering/world3d/core3D.d.ts +2 -0
- package/dist/rendering/world3d/debug3D.d.ts +5 -0
- package/dist/rendering/world3d/debug3D.js +5 -0
- package/dist/rendering/world3d/geometries3D.d.ts +12 -0
- package/dist/rendering/world3d/geometries3D.js +5 -0
- package/dist/rendering/world3d/helpers3D.d.ts +2 -0
- package/dist/rendering/world3d/helpers3D.js +1 -0
- package/dist/rendering/world3d/index.d.ts +12 -0
- package/dist/rendering/world3d/index.js +6 -0
- package/dist/rendering/world3d/math3D.d.ts +36 -0
- package/dist/rendering/world3d/math3D.js +35 -0
- package/dist/rendering/world3d/primitives3D.d.ts +7 -0
- package/dist/rendering/world3d/primitives3D.js +1 -0
- package/dist/saveStore.d.ts +18 -3
- package/dist/saveStore.js +23 -4
- package/dist/semanticList.d.ts +4 -0
- package/dist/semanticList.js +1 -0
- package/dist/semanticTree.js +11 -4
- package/dist/semanticTypes.d.ts +8 -0
- package/dist/sequencePlaybackTypes.d.ts +3 -0
- package/dist/text.d.ts +1 -0
- package/dist/textTable.d.ts +41 -0
- package/dist/textTable.js +114 -0
- package/dist/tilemapTypes.d.ts +13 -0
- package/dist/timer.d.ts +34 -0
- package/dist/timer.js +119 -0
- package/dist/tweenTypes.d.ts +4 -0
- package/dist/ui/controlKeys.d.ts +4 -0
- package/dist/ui/controlKeys.js +1 -0
- package/dist/ui/controls.d.ts +6 -0
- package/dist/ui/controls.js +2 -0
- package/dist/ui/layerTypes.d.ts +7 -0
- package/dist/ui/rangeControl.d.ts +3 -0
- package/dist/ui/rangeControl.js +1 -0
- package/dist/ui/scrollControl.d.ts +12 -0
- package/dist/ui/scrollControl.js +5 -1
- package/dist/ui/stateControls.d.ts +8 -0
- package/dist/ui/stateControls.js +3 -0
- package/dist/ui/textEditor.d.ts +1 -0
- package/dist/ui/textEditor.js +1 -0
- package/dist/ui/textEditorTypes.d.ts +7 -0
- package/dist/ui/textFieldControl.d.ts +4 -0
- package/dist/ui/textFieldControl.js +1 -0
- package/dist/ui/theme.d.ts +5 -0
- package/dist/ui/theme.js +1 -0
- package/dist/ui/types.d.ts +20 -0
- package/dist/ui/uiRoot.js +38 -9
- package/dist/ui/uiRootModel.d.ts +3 -1
- package/dist/ui/uiRootModel.js +8 -2
- package/dist/videoTypes.d.ts +3 -0
- package/dist/web/BrowserAssetBundle.d.ts +2 -0
- package/dist/web/BrowserAudio.d.ts +34 -1
- package/dist/web/BrowserAudio.js +69 -39
- package/dist/web/BrowserFrameLoop.d.ts +4 -0
- package/dist/web/BrowserGame.d.ts +64 -2
- package/dist/web/BrowserGame.js +129 -8
- package/dist/web/BrowserGamepadInput.d.ts +3 -0
- package/dist/web/BrowserHoverInput.d.ts +1 -0
- package/dist/web/BrowserImageTextures.d.ts +6 -0
- package/dist/web/BrowserInputActions.d.ts +10 -0
- package/dist/web/BrowserInputActions.js +4 -1
- package/dist/web/BrowserPlay.d.ts +130 -2
- package/dist/web/BrowserPlay.js +366 -19
- package/dist/web/BrowserPreferences.d.ts +10 -0
- package/dist/web/BrowserPreferences.js +39 -0
- package/dist/web/BrowserSemantics.d.ts +2 -0
- package/dist/web/BrowserStatsPanel.d.ts +10 -0
- package/dist/web/BrowserStatsPanel.js +9 -3
- package/dist/web/BrowserStorage.d.ts +2 -0
- package/dist/web/BrowserTextEditor.d.ts +3 -0
- package/dist/web/BrowserTextInput.d.ts +6 -0
- package/dist/web/BrowserTextureProvider.d.ts +6 -0
- package/dist/web/BrowserVideo.d.ts +13 -1
- package/dist/web/BrowserVideo.js +28 -2
- package/dist/web/CanvasKitFontSetProvider.d.ts +3 -0
- package/dist/web/CanvasKitParagraphProvider.d.ts +4 -0
- package/dist/web/CanvasKitParagraphProvider.js +1 -0
- package/dist/web/ManifestByteSource.d.ts +4 -0
- package/dist/web/ManifestByteSource.js +1 -0
- package/dist/web/ManifestFontContentLoader.d.ts +1 -0
- package/dist/web/WebGL2Host.js +64 -25
- package/dist/web/WebGPUHost.d.ts +13 -0
- package/dist/web/WebGPUHost.js +117 -36
- package/dist/web/audio.d.ts +2 -2
- package/dist/web/audio.js +1 -1
- package/dist/web/editorFonts.d.ts +4 -0
- package/dist/web/game.d.ts +1 -1
- package/dist/web/imageProjections2D.d.ts +2 -0
- package/dist/web/kit.d.ts +1 -0
- package/dist/web/kit.js +1 -0
- package/dist/web/play.d.ts +6 -1
- package/dist/web/play.js +4 -1
- package/dist/web/playMusic.d.ts +33 -0
- package/dist/web/playMusic.js +194 -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/prepareSharedSubmission2D.js +9 -3
- package/dist/web/resources.d.ts +2 -0
- package/dist/web/sharedEffectShaders.d.ts +6 -2
- package/dist/web/sharedEffectShaders.js +23 -7
- package/dist/web/sharedSubmissionStorage2D.js +1 -1
- package/dist/web/sharedWebGL2Options.d.ts +3 -0
- package/dist/web/sharedWebGL2Options.js +8 -2
- package/dist/web/sharedWebGL2Shaders.d.ts +15 -2
- package/dist/web/sharedWebGL2Shaders.js +108 -14
- package/dist/web/sharedWebGPUOptions.d.ts +5 -1
- package/dist/web/sharedWebGPUOptions.js +6 -2
- package/dist/web/video.d.ts +1 -1
- package/dist/web/webgl2Native.d.ts +3 -1
- package/dist/web/webgl2Native.js +9 -5
- package/dist/web/webgl2Types.d.ts +18 -0
- package/dist/web/webgpuImageResidency.d.ts +5 -2
- package/dist/web/webgpuImageResidency.js +7 -3
- package/dist/web/webgpuRetentionPool.d.ts +2 -2
- package/dist/web/webgpuRetentionPool.js +2 -1
- package/dist/web/webgpuSharedPass.d.ts +1 -1
- package/dist/web/webgpuSharedPass.js +87 -5
- package/dist/web/webgpuSharedResolvePass.d.ts +1 -1
- package/dist/web/webgpuSharedResolvePass.js +9 -4
- package/dist/web/world3d/Audio3D.d.ts +18 -1
- package/dist/web/world3d/Audio3D.js +62 -3
- package/dist/web/world3d/BrowserPlay3D.d.ts +115 -2
- package/dist/web/world3d/BrowserPlay3D.js +448 -43
- package/dist/web/world3d/FlyControls3D.d.ts +4 -0
- package/dist/web/world3d/FlyControls3D.js +2 -0
- package/dist/web/world3d/FollowControls3D.d.ts +3 -0
- package/dist/web/world3d/FollowControls3D.js +2 -0
- package/dist/web/world3d/OrbitControls3D.d.ts +3 -0
- package/dist/web/world3d/OrbitControls3D.js +2 -0
- package/dist/web/world3d/TransformControls3D.d.ts +5 -2
- package/dist/web/world3d/TransformControls3D.js +7 -4
- package/dist/web/world3d/WebGL2Renderer3D.d.ts +3 -0
- package/dist/web/world3d/WebGL2Renderer3D.js +2 -0
- package/dist/web/world3d/WebGPURenderer3D.d.ts +2 -0
- package/dist/web/world3d/WebGPURenderer3D.js +1 -0
- package/dist/web/world3d/World3DView.d.ts +3 -0
- package/dist/web/world3d/World3DView.js +2 -0
- package/dist/web/world3d/app3D.d.ts +7 -0
- package/dist/web/world3d/app3D.js +1 -0
- package/dist/web/world3d/assets3D.d.ts +1 -0
- package/dist/web/world3d/atmosphere3D.d.ts +9 -0
- package/dist/web/world3d/atmosphere3D.js +19 -4
- package/dist/web/world3d/canvasFont3D.d.ts +21 -0
- package/dist/web/world3d/canvasFont3D.js +165 -0
- package/dist/web/world3d/frame3D.d.ts +2 -0
- package/dist/web/world3d/host3D.d.ts +1 -0
- package/dist/web/world3d/index.d.ts +4 -2
- package/dist/web/world3d/index.js +2 -1
- package/dist/web/world3d/loaders3D.d.ts +1 -0
- package/dist/web/world3d/markers3D.d.ts +4 -0
- package/dist/web/world3d/overlay3D.d.ts +19 -0
- package/dist/web/world3d/overlay3D.js +21 -4
- package/dist/web/world3d/post3D.d.ts +4 -0
- package/dist/web/world3d/post3D.js +3 -0
- package/dist/web/world3d/probe3D.d.ts +1 -0
- package/dist/web/world3d/stats3D.d.ts +3 -0
- package/dist/web/world3d/stats3D.js +1 -0
- package/dist/web/world3d/webGL2FrameMetrics3D.d.ts +5 -0
- package/dist/web/world3d/webgpu.d.ts +2 -0
- package/dist/web/world3d/webgpu.js +1 -0
- package/package.json +3 -3
|
@@ -10,6 +10,11 @@ export interface BrowserStatsSample {
|
|
|
10
10
|
/** Frames drawn and frames skipped so far, as a frame loop's `snapshot()` gives them. */
|
|
11
11
|
readonly frames?: number;
|
|
12
12
|
readonly skipped?: number;
|
|
13
|
+
/**
|
|
14
|
+
* The draw calls the Host made for its last frame, `host.getFrameDrawCalls()`: fewer than the
|
|
15
|
+
* frame's commands when they are batched, more when effects need passes of their own.
|
|
16
|
+
*/
|
|
17
|
+
readonly drawCalls?: number;
|
|
13
18
|
}
|
|
14
19
|
/** The numbers the panel shows, as of its last refresh. */
|
|
15
20
|
export interface BrowserStatsSnapshot {
|
|
@@ -24,7 +29,10 @@ export interface BrowserStatsSnapshot {
|
|
|
24
29
|
readonly pendingFrames: number;
|
|
25
30
|
readonly frames: number;
|
|
26
31
|
readonly skipped: number;
|
|
32
|
+
/** The draw calls the Host made for the last frame, or 0 when they were not given. */
|
|
33
|
+
readonly drawCalls: number;
|
|
27
34
|
}
|
|
35
|
+
/** A stats panel to make: the canvas it sits over, its label, and how often it updates. */
|
|
28
36
|
export interface BrowserStatsPanelOptions {
|
|
29
37
|
/** The canvas the panel lies over: it is placed at the canvas's top left corner. */
|
|
30
38
|
readonly canvas: HTMLCanvasElement;
|
|
@@ -33,6 +41,7 @@ export interface BrowserStatsPanelOptions {
|
|
|
33
41
|
/** How often the text changes, in milliseconds. 500 unless given; at least 100. */
|
|
34
42
|
readonly intervalMs?: number;
|
|
35
43
|
}
|
|
44
|
+
/** A panel over the canvas showing frame rate and frame times: sample each frame. */
|
|
36
45
|
export interface BrowserStatsPanel {
|
|
37
46
|
/** The panel's element, a child of the page's body. */
|
|
38
47
|
readonly element: HTMLElement;
|
|
@@ -42,5 +51,6 @@ export interface BrowserStatsPanel {
|
|
|
42
51
|
/** Removes the panel from the page. */
|
|
43
52
|
dispose(): void;
|
|
44
53
|
}
|
|
54
|
+
/** Puts a panel over the canvas that shows frame rate and frame times. */
|
|
45
55
|
export declare function createBrowserStatsPanel(options: BrowserStatsPanelOptions): BrowserStatsPanel;
|
|
46
56
|
//# sourceMappingURL=BrowserStatsPanel.d.ts.map
|
|
@@ -15,6 +15,7 @@ function trianglesOf(frame) {
|
|
|
15
15
|
}
|
|
16
16
|
return triangles;
|
|
17
17
|
}
|
|
18
|
+
/** Puts a panel over the canvas that shows frame rate and frame times. */
|
|
18
19
|
export function createBrowserStatsPanel(options) {
|
|
19
20
|
if (options === null || typeof options !== 'object')
|
|
20
21
|
throw invalid();
|
|
@@ -38,7 +39,7 @@ export function createBrowserStatsPanel(options) {
|
|
|
38
39
|
element.setAttribute('aria-hidden', 'true');
|
|
39
40
|
page.body.appendChild(element);
|
|
40
41
|
let closed = false, last, since, seen = 0, longest = 0, shown = false;
|
|
41
|
-
let commands = -1, triangles = -1, geometries = -1, pages = -1, pending = -1, frames = -1, skipped = -1;
|
|
42
|
+
let commands = -1, triangles = -1, geometries = -1, pages = -1, pending = -1, frames = -1, skipped = -1, drawCalls = -1;
|
|
42
43
|
let current = Object.freeze({
|
|
43
44
|
fps: 0,
|
|
44
45
|
longestFrameMs: 0,
|
|
@@ -48,7 +49,8 @@ export function createBrowserStatsPanel(options) {
|
|
|
48
49
|
pages: 0,
|
|
49
50
|
pendingFrames: 0,
|
|
50
51
|
frames: 0,
|
|
51
|
-
skipped: 0
|
|
52
|
+
skipped: 0,
|
|
53
|
+
drawCalls: 0
|
|
52
54
|
});
|
|
53
55
|
const text = (value) => (value < 0 ? '-' : String(value));
|
|
54
56
|
function refresh(now) {
|
|
@@ -62,7 +64,8 @@ export function createBrowserStatsPanel(options) {
|
|
|
62
64
|
pages: Math.max(0, pages),
|
|
63
65
|
pendingFrames: Math.max(0, pending),
|
|
64
66
|
frames: Math.max(0, frames),
|
|
65
|
-
skipped: Math.max(0, skipped)
|
|
67
|
+
skipped: Math.max(0, skipped),
|
|
68
|
+
drawCalls: Math.max(0, drawCalls)
|
|
66
69
|
});
|
|
67
70
|
const box = canvas.getBoundingClientRect();
|
|
68
71
|
element.style.left = box.left + 'px';
|
|
@@ -76,6 +79,8 @@ export function createBrowserStatsPanel(options) {
|
|
|
76
79
|
' ms\n' +
|
|
77
80
|
'commands ' +
|
|
78
81
|
text(commands) +
|
|
82
|
+
' draws ' +
|
|
83
|
+
text(drawCalls) +
|
|
79
84
|
' triangles ' +
|
|
80
85
|
text(triangles) +
|
|
81
86
|
'\n' +
|
|
@@ -115,6 +120,7 @@ export function createBrowserStatsPanel(options) {
|
|
|
115
120
|
pending = count(sample.pendingFrames, pending);
|
|
116
121
|
frames = count(sample.frames, frames);
|
|
117
122
|
skipped = count(sample.skipped, skipped);
|
|
123
|
+
drawCalls = count(sample.drawCalls, drawCalls);
|
|
118
124
|
if (last !== undefined && now > last) {
|
|
119
125
|
seen++;
|
|
120
126
|
longest = Math.max(longest, now - last);
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import type { SaveStorage } from '@egret/engine/kit';
|
|
2
|
+
/** Save storage kept in IndexedDB: flush pending writes, and close it. */
|
|
2
3
|
export interface IndexedDBSaveStorage extends SaveStorage {
|
|
3
4
|
/** Resolves when every write so far has reached the database; rejects with the first that failed. */
|
|
4
5
|
flush(): Promise<void>;
|
|
5
6
|
/** Closes the database; later writes are refused. */
|
|
6
7
|
close(): void;
|
|
7
8
|
}
|
|
9
|
+
/** IndexedDB save storage to open: its database name, the IndexedDB to use, and what is called on an error. */
|
|
8
10
|
export interface IndexedDBSaveStorageOptions {
|
|
9
11
|
/** The database name; one per game. */
|
|
10
12
|
readonly database: string;
|
|
@@ -2,6 +2,7 @@ import type { KeyboardInput } from '@egret/engine/web/keyboard';
|
|
|
2
2
|
import type { UiRoot } from '@egret/engine/ui';
|
|
3
3
|
import type { UiTextEditor, UiTextEditorTarget } from '@egret/engine/ui/editing';
|
|
4
4
|
import type { BrowserEditorFontSet } from './editorFonts.js';
|
|
5
|
+
/** A browser text editor to make: its editor, root and target, its canvas, fonts and size, its label and keyboard, and what it calls. */
|
|
5
6
|
export interface BrowserTextEditorOptions {
|
|
6
7
|
readonly editor: UiTextEditor;
|
|
7
8
|
readonly root: UiRoot;
|
|
@@ -17,6 +18,7 @@ export interface BrowserTextEditorOptions {
|
|
|
17
18
|
/** Schedule the application's existing frame path when native/canvas visibility changes. */
|
|
18
19
|
readonly onInvalidate?: () => void;
|
|
19
20
|
}
|
|
21
|
+
/** A browser text editor as it is now: its state, revisions, native element and font. */
|
|
20
22
|
export interface BrowserTextEditorSnapshot {
|
|
21
23
|
readonly state: 'inactive' | 'editing' | 'composing' | 'settling' | 'closed';
|
|
22
24
|
readonly interactive: boolean;
|
|
@@ -25,6 +27,7 @@ export interface BrowserTextEditorSnapshot {
|
|
|
25
27
|
readonly nativeElement: boolean;
|
|
26
28
|
readonly fontKey: string;
|
|
27
29
|
}
|
|
30
|
+
/** A UI text editor edited through a native element over the canvas: activate, finish or cancel editing. */
|
|
28
31
|
export interface BrowserTextEditor {
|
|
29
32
|
/** Logical scene point uses the committed paragraph hit result, not character widths. */
|
|
30
33
|
activate(point?: Readonly<{
|
|
@@ -5,8 +5,11 @@ export interface BrowserTextInputRectangle {
|
|
|
5
5
|
readonly width: number;
|
|
6
6
|
readonly height: number;
|
|
7
7
|
}
|
|
8
|
+
/** Which on-screen keyboard to ask for. */
|
|
8
9
|
export type BrowserTextInputMode = 'text' | 'numeric' | 'decimal' | 'tel' | 'email' | 'url' | 'search' | 'none';
|
|
10
|
+
/** What the Enter key of an on-screen keyboard says. */
|
|
9
11
|
export type BrowserTextInputEnterHint = 'enter' | 'done' | 'go' | 'next' | 'previous' | 'search' | 'send';
|
|
12
|
+
/** The value after a change, and whether a composition is under way. */
|
|
10
13
|
export interface BrowserTextInputChange {
|
|
11
14
|
readonly value: string;
|
|
12
15
|
/** True while the input method still holds provisional text, such as pinyin before a candidate is chosen. */
|
|
@@ -43,6 +46,7 @@ export interface BrowserTextInputRequest extends BrowserTextInputRectangle {
|
|
|
43
46
|
readonly onCommit?: (value: string) => void;
|
|
44
47
|
readonly onCancel?: () => void;
|
|
45
48
|
}
|
|
49
|
+
/** Browser text input to make: its canvas and size, the element it goes into, and whether keys are kept from the game. */
|
|
46
50
|
export interface BrowserTextInputOptions {
|
|
47
51
|
readonly canvas: HTMLCanvasElement;
|
|
48
52
|
readonly logicalWidth: number;
|
|
@@ -54,11 +58,13 @@ export interface BrowserTextInputOptions {
|
|
|
54
58
|
readonly isolateKeys?: boolean;
|
|
55
59
|
readonly onError?: (error: unknown) => void;
|
|
56
60
|
}
|
|
61
|
+
/** Browser text input as it is now: its state, value and composition. */
|
|
57
62
|
export interface BrowserTextInputSnapshot {
|
|
58
63
|
readonly state: 'idle' | 'open' | 'disposed';
|
|
59
64
|
readonly value: string;
|
|
60
65
|
readonly composing: boolean;
|
|
61
66
|
}
|
|
67
|
+
/** A native text field over the canvas, for typing with the platform's keyboard and input methods. */
|
|
62
68
|
export interface BrowserTextInput {
|
|
63
69
|
/** Opens a field and focuses it. A session that is still open is cancelled first. */
|
|
64
70
|
open(request: BrowserTextInputRequest): void;
|
|
@@ -1,19 +1,23 @@
|
|
|
1
1
|
import { Texture } from '@egret/runtime';
|
|
2
2
|
import type { AssetProvider, AssetRef, AssetLoadContext } from '@egret/runtime';
|
|
3
3
|
import type { ManifestPngOwner } from './ManifestByteSource.js';
|
|
4
|
+
/** How the browser decodes a PNG: its orientation, alpha and color space conversion. */
|
|
4
5
|
export interface BrowserPngDecodeOptions {
|
|
5
6
|
readonly imageOrientation: 'from-image';
|
|
6
7
|
readonly premultiplyAlpha: 'none';
|
|
7
8
|
readonly colorSpaceConversion: 'none';
|
|
8
9
|
}
|
|
10
|
+
/** How the browser decodes a PNG and makes a canvas, for PNG textures. */
|
|
9
11
|
export interface BrowserPngPorts {
|
|
10
12
|
readonly decode: (blob: Blob, options: BrowserPngDecodeOptions) => Promise<ImageBitmap>;
|
|
11
13
|
readonly createCanvas: () => HTMLCanvasElement;
|
|
12
14
|
}
|
|
15
|
+
/** A PNG texture provider to make: where it reads bytes from, and the ports it decodes with. */
|
|
13
16
|
export interface BrowserTextureProviderOptions {
|
|
14
17
|
readonly readBytes: (ref: AssetRef<Texture>, context: AssetLoadContext) => Promise<Uint8Array<ArrayBuffer>>;
|
|
15
18
|
readonly ports?: BrowserPngPorts;
|
|
16
19
|
}
|
|
20
|
+
/** Loads PNG textures in the browser; close it when done. */
|
|
17
21
|
export interface BrowserTextureProvider extends AssetProvider<Texture> {
|
|
18
22
|
readonly profile: 'png-rgb-rgba8-browser-normalized-v1';
|
|
19
23
|
readonly isClosed: boolean;
|
|
@@ -32,11 +36,13 @@ interface ManifestTextureProviderCounters {
|
|
|
32
36
|
readonly quarantinedJobs: number;
|
|
33
37
|
readonly unknownNativeObjects: number;
|
|
34
38
|
}
|
|
39
|
+
/** How many textures a manifest texture provider holds now and at most, and whether it was full. */
|
|
35
40
|
export interface ManifestTextureProviderStatus {
|
|
36
41
|
readonly current: ManifestTextureProviderCounters;
|
|
37
42
|
readonly highWater: ManifestTextureProviderCounters;
|
|
38
43
|
readonly saturated: boolean;
|
|
39
44
|
}
|
|
45
|
+
/** A texture provider for a manifest's images, with its status. */
|
|
40
46
|
export interface ManifestTextureProvider extends BrowserTextureProvider {
|
|
41
47
|
getStatus(): ManifestTextureProviderStatus;
|
|
42
48
|
}
|
|
@@ -1,10 +1,21 @@
|
|
|
1
1
|
import type { Video } from '@egret/engine/video';
|
|
2
2
|
import type { AssetManager } from '@egret/runtime';
|
|
3
|
+
/** One file of a film offered in several: its address and, when known, its media type. */
|
|
4
|
+
export interface BrowserVideoSource {
|
|
5
|
+
readonly src: string;
|
|
6
|
+
readonly type?: string;
|
|
7
|
+
}
|
|
8
|
+
/** A browser video to make: its assets, its source or stream or element, and whether it loops, is muted and how loud. */
|
|
3
9
|
export interface BrowserVideoOptions {
|
|
4
10
|
/** The Engine's assets, which lease each picture as a texture. */
|
|
5
11
|
readonly assets: AssetManager;
|
|
6
12
|
/** A file to play, or a stream such as a canvas's or a camera's, or a video element of the page's own. One of the three. */
|
|
7
|
-
|
|
13
|
+
/**
|
|
14
|
+
* One address, or the same film in several files to choose from, as `<source>` elements give them: the first the
|
|
15
|
+
* browser can play is played, and one that fails to load gives way to the next. A file's `type` (`video/webm`, say)
|
|
16
|
+
* lets the browser pass over what it cannot play without loading it.
|
|
17
|
+
*/
|
|
18
|
+
readonly src?: string | readonly (string | BrowserVideoSource)[];
|
|
8
19
|
readonly stream?: MediaStream;
|
|
9
20
|
readonly element?: HTMLVideoElement;
|
|
10
21
|
readonly loop?: boolean;
|
|
@@ -16,6 +27,7 @@ export interface BrowserVideoOptions {
|
|
|
16
27
|
/** For a file from another origin that allows it. */
|
|
17
28
|
readonly crossOrigin?: 'anonymous' | 'use-credentials';
|
|
18
29
|
}
|
|
30
|
+
/** A video played by a video element, its pictures leased as textures. */
|
|
19
31
|
export interface BrowserVideo extends Video {
|
|
20
32
|
/** The page's video element the pictures are read from. */
|
|
21
33
|
readonly element: HTMLVideoElement;
|
package/dist/web/BrowserVideo.js
CHANGED
|
@@ -3,6 +3,19 @@ import { EgretError } from '@egret/runtime';
|
|
|
3
3
|
import { createImageData2D } from '@egret/contracts';
|
|
4
4
|
import { createVideo } from '@egret/engine/video';
|
|
5
5
|
const invalid = () => new EgretError('VIDEO_OPTIONS_INVALID');
|
|
6
|
+
/** A list of files: not empty, no more than 16, each an address or an address and a type that are not empty. */
|
|
7
|
+
function choices(list) {
|
|
8
|
+
return (Array.isArray(list) &&
|
|
9
|
+
list.length > 0 &&
|
|
10
|
+
list.length <= 16 &&
|
|
11
|
+
list.every(item => typeof item === 'string'
|
|
12
|
+
? item.length > 0
|
|
13
|
+
: item !== null &&
|
|
14
|
+
typeof item === 'object' &&
|
|
15
|
+
typeof item.src === 'string' &&
|
|
16
|
+
item.src.length > 0 &&
|
|
17
|
+
(item.type === undefined || (typeof item.type === 'string' && item.type.length > 0))));
|
|
18
|
+
}
|
|
6
19
|
/**
|
|
7
20
|
* A video played by a page's video element and shown as a display object. Each picture the element presents is drawn
|
|
8
21
|
* into a canvas of the size it is shown at, read back, and leased as a texture; a picture not yet changed is not read.
|
|
@@ -13,7 +26,7 @@ export function createBrowserVideo(options) {
|
|
|
13
26
|
const { assets, src, stream, element: given, loop = false, muted = true, volume = 1, maxWidth = 1280, crossOrigin } = options;
|
|
14
27
|
const kinds = [src, stream, given].filter(value => value !== undefined).length;
|
|
15
28
|
if (kinds !== 1 ||
|
|
16
|
-
(src !== undefined && (typeof src
|
|
29
|
+
(src !== undefined && !(typeof src === 'string' ? src.length > 0 : choices(src))) ||
|
|
17
30
|
(stream !== undefined && (typeof MediaStream === 'undefined' || !(stream instanceof MediaStream))) ||
|
|
18
31
|
(given !== undefined && !(given instanceof HTMLVideoElement)) ||
|
|
19
32
|
typeof loop !== 'boolean' ||
|
|
@@ -109,8 +122,20 @@ export function createBrowserVideo(options) {
|
|
|
109
122
|
];
|
|
110
123
|
for (const [name, listener] of events)
|
|
111
124
|
element.addEventListener(name, listener);
|
|
112
|
-
if (src
|
|
125
|
+
if (typeof src === 'string')
|
|
113
126
|
element.src = src;
|
|
127
|
+
else if (src !== undefined)
|
|
128
|
+
for (const item of src) {
|
|
129
|
+
const child = document.createElement('source');
|
|
130
|
+
if (typeof item === 'string')
|
|
131
|
+
child.src = item;
|
|
132
|
+
else {
|
|
133
|
+
child.src = item.src;
|
|
134
|
+
if (item.type !== undefined)
|
|
135
|
+
child.type = item.type;
|
|
136
|
+
}
|
|
137
|
+
element.appendChild(child);
|
|
138
|
+
}
|
|
114
139
|
else if (stream !== undefined)
|
|
115
140
|
element.srcObject = stream;
|
|
116
141
|
if (element.readyState >= 2) {
|
|
@@ -198,6 +223,7 @@ export function createBrowserVideo(options) {
|
|
|
198
223
|
// A page's own element is left as it was given; one made here lets go of what it was playing.
|
|
199
224
|
if (given === undefined) {
|
|
200
225
|
element.removeAttribute('src');
|
|
226
|
+
element.replaceChildren();
|
|
201
227
|
element.srcObject = null;
|
|
202
228
|
element.load();
|
|
203
229
|
}
|
|
@@ -2,6 +2,7 @@ import type { Scope } from '@egret/runtime';
|
|
|
2
2
|
import type { FontContentLoader } from '@egret/engine/resources';
|
|
3
3
|
import type { ParagraphProvider } from '@egret/engine/paragraph';
|
|
4
4
|
import type { CanvasKitParagraphModule } from './CanvasKitParagraphProvider.js';
|
|
5
|
+
/** A set of fonts loaded for paragraphs: its key and families; dispose of it when done. */
|
|
5
6
|
export interface ParagraphFontSet {
|
|
6
7
|
readonly key: string;
|
|
7
8
|
readonly fontFamilies: readonly string[];
|
|
@@ -10,6 +11,7 @@ export interface ParagraphFontSet {
|
|
|
10
11
|
dispose(): void;
|
|
11
12
|
readonly closed: Promise<void>;
|
|
12
13
|
}
|
|
14
|
+
/** Loads font sets for CanvasKit paragraphs. */
|
|
13
15
|
export interface CanvasKitFontSetProvider extends ParagraphProvider {
|
|
14
16
|
load(scope: Scope, loader: FontContentLoader, roots: readonly string[]): Promise<ParagraphFontSet>;
|
|
15
17
|
getStatus(): Readonly<{
|
|
@@ -20,6 +22,7 @@ export interface CanvasKitFontSetProvider extends ParagraphProvider {
|
|
|
20
22
|
}>;
|
|
21
23
|
close(): Promise<void>;
|
|
22
24
|
}
|
|
25
|
+
/** A CanvasKit font set provider to make: its CanvasKit and build identity. */
|
|
23
26
|
export interface CanvasKitFontSetProviderOptions {
|
|
24
27
|
readonly canvasKit: CanvasKitParagraphModule;
|
|
25
28
|
readonly buildIdentity?: string;
|
|
@@ -128,18 +128,21 @@ export interface CanvasKitParagraphModule {
|
|
|
128
128
|
_malloc(bytes: number): number;
|
|
129
129
|
_free(pointer: number): void;
|
|
130
130
|
}
|
|
131
|
+
/** One font for CanvasKit paragraphs: its family, bytes and identity. */
|
|
131
132
|
export interface CanvasKitParagraphFont {
|
|
132
133
|
readonly family: string;
|
|
133
134
|
readonly data: Uint8Array;
|
|
134
135
|
/** Caller-declared immutable font identity, preferably the original byte SHA-256. */
|
|
135
136
|
readonly identity: string;
|
|
136
137
|
}
|
|
138
|
+
/** A CanvasKit paragraph provider to make: its CanvasKit, build identity and fonts. */
|
|
137
139
|
export interface CanvasKitParagraphProviderOptions {
|
|
138
140
|
readonly canvasKit: CanvasKitParagraphModule;
|
|
139
141
|
/** Host-declared build identity; omission identifies only this module instance. */
|
|
140
142
|
readonly buildIdentity?: string;
|
|
141
143
|
readonly fonts: readonly CanvasKitParagraphFont[];
|
|
142
144
|
}
|
|
145
|
+
/** Lays out and draws paragraphs with CanvasKit; dispose of it when done. */
|
|
143
146
|
export interface CanvasKitParagraphProvider extends ParagraphProvider {
|
|
144
147
|
/** Explicitly retires this provider's font wrappers; caches borrow the provider. */
|
|
145
148
|
dispose(): void;
|
|
@@ -156,6 +159,7 @@ export declare function canvasKitParagraphCapabilities(ck: CanvasKitParagraphMod
|
|
|
156
159
|
textAlign: boolean;
|
|
157
160
|
maxLines: boolean;
|
|
158
161
|
}>;
|
|
162
|
+
/** Lays out and draws paragraphs with CanvasKit and the fonts it is given. */
|
|
159
163
|
export declare function createCanvasKitParagraphProvider(options: CanvasKitParagraphProviderOptions): CanvasKitParagraphProvider;
|
|
160
164
|
/** Internal native ownership port; the public fixed-font API is unchanged. */
|
|
161
165
|
export interface NativeFontBorrow {
|
|
@@ -182,6 +182,7 @@ export function canvasKitParagraphCapabilities(ck) {
|
|
|
182
182
|
typeof ck.Paragraph?.prototype?.hasLineEllipsis === 'function'
|
|
183
183
|
});
|
|
184
184
|
}
|
|
185
|
+
/** Lays out and draws paragraphs with CanvasKit and the fonts it is given. */
|
|
185
186
|
export function createCanvasKitParagraphProvider(options) {
|
|
186
187
|
return createCanvasKitParagraphProviderOwned(options);
|
|
187
188
|
}
|
|
@@ -4,6 +4,7 @@ import { CancellationController, EgretError } from '@egret/runtime';
|
|
|
4
4
|
import type { AssetLoadContext, AssetRef } from '@egret/runtime';
|
|
5
5
|
import type { ManifestBinding } from '#egret-manifest-resources';
|
|
6
6
|
declare const MANIFEST_BYTE_SOURCE: unique symbol;
|
|
7
|
+
/** A manifest byte source to make: its profile, the URL it fetches from, its deadline and retries. */
|
|
7
8
|
export interface ManifestByteSourceOptions {
|
|
8
9
|
/** Explicit SFNT-only admission; the original image/metadata limits stay unchanged. */
|
|
9
10
|
readonly profile?: 'font-sfnt/1';
|
|
@@ -23,11 +24,13 @@ interface ManifestByteSourceCounters {
|
|
|
23
24
|
readonly borrowedChunkBytes: number;
|
|
24
25
|
readonly quarantinedJobs: number;
|
|
25
26
|
}
|
|
27
|
+
/** How many reads a byte source has now and at most, and whether it was full. */
|
|
26
28
|
export interface ManifestByteSourceStatus {
|
|
27
29
|
readonly current: ManifestByteSourceCounters;
|
|
28
30
|
readonly highWater: ManifestByteSourceCounters;
|
|
29
31
|
readonly saturated: boolean;
|
|
30
32
|
}
|
|
33
|
+
/** Reads a manifest's files over the network and checks their digests. */
|
|
31
34
|
export interface ManifestByteSource {
|
|
32
35
|
readonly profile: 'manifest-sha256-browser-v1';
|
|
33
36
|
readonly isClosed: boolean;
|
|
@@ -142,6 +145,7 @@ export declare class ManifestPngOwner {
|
|
|
142
145
|
close(): Promise<void>;
|
|
143
146
|
}
|
|
144
147
|
export declare function requireManifestByteSource(source: unknown): ManifestPngOwner;
|
|
148
|
+
/** Reads a manifest's files from a base URL, checking each one's length and SHA-256. */
|
|
145
149
|
export declare function createManifestByteSource(manifest: AdmittedResourceManifest, bindings: readonly ManifestBinding[], options: ManifestByteSourceOptions): ManifestByteSource;
|
|
146
150
|
export {};
|
|
147
151
|
//# sourceMappingURL=ManifestByteSource.d.ts.map
|
|
@@ -929,6 +929,7 @@ export function requireManifestByteSource(source) {
|
|
|
929
929
|
throw fault('SOURCE_INVALID');
|
|
930
930
|
return owner;
|
|
931
931
|
}
|
|
932
|
+
/** Reads a manifest's files from a base URL, checking each one's length and SHA-256. */
|
|
932
933
|
export function createManifestByteSource(manifest, bindings, options) {
|
|
933
934
|
const owner = new ManifestPngOwner(manifest, bindings, options);
|
|
934
935
|
const source = freeze({
|
|
@@ -2,6 +2,7 @@ import type { Engine } from '@egret/engine';
|
|
|
2
2
|
import type { FontContentLoader } from '@egret/engine/resources';
|
|
3
3
|
import type { AdmittedResourceManifest } from '@egret/contracts/resources';
|
|
4
4
|
import type { ManifestByteSource, ManifestByteSourceOptions } from './ManifestByteSource.js';
|
|
5
|
+
/** A font content loader for a manifest, with the byte source it reads from. */
|
|
5
6
|
export interface ManifestFontContentLoader {
|
|
6
7
|
readonly loader: FontContentLoader;
|
|
7
8
|
readonly source: ManifestByteSource;
|