@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.
Files changed (304) hide show
  1. package/dist/Engine.js +7 -2
  2. package/dist/animation/sequenceResetTypes.d.ts +6 -0
  3. package/dist/animation/types.d.ts +6 -0
  4. package/dist/assetBundle.d.ts +2 -0
  5. package/dist/assetGroupTypes.d.ts +2 -0
  6. package/dist/audioCues.d.ts +4 -0
  7. package/dist/audioTypes.d.ts +13 -0
  8. package/dist/bitmapButtonTypes.d.ts +2 -0
  9. package/dist/bitmapFontTypes.d.ts +3 -0
  10. package/dist/bitmapResourceSlot.d.ts +1 -0
  11. package/dist/camera2d.js +10 -2
  12. package/dist/cameraTypes.d.ts +12 -0
  13. package/dist/contentTypes.d.ts +2 -0
  14. package/dist/createEngineForProfile.js +8 -5
  15. package/dist/fontContentTypes.d.ts +5 -0
  16. package/dist/gameClockTypes.d.ts +6 -0
  17. package/dist/gameRun.d.ts +3 -0
  18. package/dist/gamepadTypes.d.ts +8 -0
  19. package/dist/hoverInputTypes.d.ts +10 -0
  20. package/dist/index.d.ts +5 -2
  21. package/dist/index.js +2 -1
  22. package/dist/inputActions.d.ts +5 -0
  23. package/dist/internal/uiFactoryState.d.ts +4 -0
  24. package/dist/internal/uiFactoryState.js +18 -2
  25. package/dist/keyboardInput.d.ts +1 -0
  26. package/dist/keyboardInput.js +1 -0
  27. package/dist/keyboardInputTypes.d.ts +12 -0
  28. package/dist/kit.d.ts +3 -1
  29. package/dist/kit.js +2 -1
  30. package/dist/manifestResourceState.d.ts +1 -0
  31. package/dist/manifestResourceState.js +1 -0
  32. package/dist/manifestResourceTypes.d.ts +1 -0
  33. package/dist/motion.d.ts +2 -0
  34. package/dist/mouseInputTypes.d.ts +4 -0
  35. package/dist/particleEmitter.js +8 -0
  36. package/dist/particleTypes.d.ts +8 -0
  37. package/dist/physics2d.d.ts +2 -2
  38. package/dist/physics2d.js +1 -1
  39. package/dist/physics2dTypes.d.ts +55 -1
  40. package/dist/physics2dWorld.js +209 -9
  41. package/dist/pointerInput.d.ts +1 -0
  42. package/dist/pointerInput.js +1 -0
  43. package/dist/pointerInputTypes.d.ts +3 -0
  44. package/dist/random.d.ts +1 -0
  45. package/dist/rendering/packSharedDraws2D.js +53 -5
  46. package/dist/rendering/prepareSharedDraws2D.d.ts +2 -0
  47. package/dist/rendering/prepareSharedDraws2D.js +17 -6
  48. package/dist/rendering/sharedColor2D.d.ts +35 -1
  49. package/dist/rendering/sharedColor2D.js +131 -8
  50. package/dist/rendering/sharedEffects2D.js +16 -8
  51. package/dist/rendering/world3d/Animation3D.d.ts +9 -0
  52. package/dist/rendering/world3d/Animation3D.js +4 -0
  53. package/dist/rendering/world3d/AnimationTexture3D.d.ts +6 -0
  54. package/dist/rendering/world3d/AnimationTexture3D.js +2 -0
  55. package/dist/rendering/world3d/Batch3D.d.ts +4 -0
  56. package/dist/rendering/world3d/Batch3D.js +3 -0
  57. package/dist/rendering/world3d/Camera3D.d.ts +5 -0
  58. package/dist/rendering/world3d/Camera3D.js +3 -0
  59. package/dist/rendering/world3d/Character3D.d.ts +4 -0
  60. package/dist/rendering/world3d/Character3D.js +2 -0
  61. package/dist/rendering/world3d/Cloth3D.d.ts +18 -3
  62. package/dist/rendering/world3d/Cloth3D.js +6 -1
  63. package/dist/rendering/world3d/Compression3D.d.ts +1 -0
  64. package/dist/rendering/world3d/Compression3D.js +1 -0
  65. package/dist/rendering/world3d/Curves3D.d.ts +8 -0
  66. package/dist/rendering/world3d/Curves3D.js +5 -0
  67. package/dist/rendering/world3d/Decal3D.d.ts +2 -0
  68. package/dist/rendering/world3d/Decal3D.js +1 -0
  69. package/dist/rendering/world3d/Export3D.d.ts +13 -0
  70. package/dist/rendering/world3d/Export3D.js +263 -0
  71. package/dist/rendering/world3d/Geometry3D.d.ts +11 -1
  72. package/dist/rendering/world3d/Geometry3D.js +10 -1
  73. package/dist/rendering/world3d/GeometryBuilder3D.d.ts +2 -0
  74. package/dist/rendering/world3d/Gizmo3D.d.ts +5 -0
  75. package/dist/rendering/world3d/Gizmo3D.js +2 -0
  76. package/dist/rendering/world3d/Gltf3D.d.ts +6 -0
  77. package/dist/rendering/world3d/Gltf3D.js +25 -5
  78. package/dist/rendering/world3d/GpuParticles3D.d.ts +2 -0
  79. package/dist/rendering/world3d/GpuParticles3D.js +1 -0
  80. package/dist/rendering/world3d/Hdr3D.d.ts +2 -0
  81. package/dist/rendering/world3d/Hdr3D.js +1 -0
  82. package/dist/rendering/world3d/Jelly3D.d.ts +2 -0
  83. package/dist/rendering/world3d/Jelly3D.js +1 -0
  84. package/dist/rendering/world3d/Ktx23D.d.ts +3 -0
  85. package/dist/rendering/world3d/Light3D.d.ts +9 -0
  86. package/dist/rendering/world3d/Light3D.js +4 -0
  87. package/dist/rendering/world3d/Material3D.d.ts +10 -0
  88. package/dist/rendering/world3d/Material3D.js +2 -0
  89. package/dist/rendering/world3d/Mesh3D.d.ts +4 -0
  90. package/dist/rendering/world3d/Mesh3D.js +16 -2
  91. package/dist/rendering/world3d/Meshopt3D.d.ts +3 -0
  92. package/dist/rendering/world3d/Meshopt3D.js +1 -0
  93. package/dist/rendering/world3d/Navigation3D.d.ts +41 -1
  94. package/dist/rendering/world3d/Navigation3D.js +74 -2
  95. package/dist/rendering/world3d/Object3D.d.ts +11 -0
  96. package/dist/rendering/world3d/Object3D.js +10 -0
  97. package/dist/rendering/world3d/Particles3D.d.ts +5 -0
  98. package/dist/rendering/world3d/Particles3D.js +3 -0
  99. package/dist/rendering/world3d/Physics3D.d.ts +14 -0
  100. package/dist/rendering/world3d/Physics3D.js +5 -0
  101. package/dist/rendering/world3d/PhysicsHull3D.d.ts +2 -0
  102. package/dist/rendering/world3d/PhysicsHull3D.js +2 -0
  103. package/dist/rendering/world3d/PhysicsMesh3D.d.ts +2 -0
  104. package/dist/rendering/world3d/PhysicsMesh3D.js +2 -0
  105. package/dist/rendering/world3d/PhysicsRemote3D.d.ts +5 -0
  106. package/dist/rendering/world3d/PhysicsRemote3D.js +2 -0
  107. package/dist/rendering/world3d/Ragdoll3D.d.ts +5 -0
  108. package/dist/rendering/world3d/Ragdoll3D.js +2 -0
  109. package/dist/rendering/world3d/Raycast3D.d.ts +3 -0
  110. package/dist/rendering/world3d/Raycast3D.js +1 -0
  111. package/dist/rendering/world3d/RenderList3D.d.ts +3 -0
  112. package/dist/rendering/world3d/RenderList3D.js +12 -0
  113. package/dist/rendering/world3d/Retarget3D.d.ts +1 -0
  114. package/dist/rendering/world3d/Rig3D.d.ts +57 -0
  115. package/dist/rendering/world3d/Rig3D.js +219 -0
  116. package/dist/rendering/world3d/Sdf3D.d.ts +181 -0
  117. package/dist/rendering/world3d/Sdf3D.js +1136 -0
  118. package/dist/rendering/world3d/SdfLod3D.d.ts +17 -0
  119. package/dist/rendering/world3d/SdfLod3D.js +56 -0
  120. package/dist/rendering/world3d/Serialize3D.d.ts +17 -0
  121. package/dist/rendering/world3d/Serialize3D.js +22 -0
  122. package/dist/rendering/world3d/Simplify3D.d.ts +29 -0
  123. package/dist/rendering/world3d/Simplify3D.js +426 -0
  124. package/dist/rendering/world3d/StateMachine3D.d.ts +9 -0
  125. package/dist/rendering/world3d/StateMachine3D.js +3 -0
  126. package/dist/rendering/world3d/SurfaceMaterial3D.d.ts +26 -0
  127. package/dist/rendering/world3d/SurfaceMaterial3D.js +138 -0
  128. package/dist/rendering/world3d/Terrain3D.d.ts +21 -0
  129. package/dist/rendering/world3d/Terrain3D.js +25 -1
  130. package/dist/rendering/world3d/Text3D.d.ts +5 -0
  131. package/dist/rendering/world3d/Text3D.js +2 -0
  132. package/dist/rendering/world3d/Texture3D.d.ts +16 -1
  133. package/dist/rendering/world3d/Texture3D.js +19 -1
  134. package/dist/rendering/world3d/Trail3D.d.ts +3 -0
  135. package/dist/rendering/world3d/Trail3D.js +2 -0
  136. package/dist/rendering/world3d/Vehicle3D.d.ts +5 -0
  137. package/dist/rendering/world3d/Vehicle3D.js +2 -0
  138. package/dist/rendering/world3d/VolumetricFog3D.d.ts +2 -0
  139. package/dist/rendering/world3d/VolumetricFog3D.js +1 -0
  140. package/dist/rendering/world3d/Water3D.d.ts +2 -0
  141. package/dist/rendering/world3d/Water3D.js +1 -0
  142. package/dist/rendering/world3d/core3D.d.ts +2 -0
  143. package/dist/rendering/world3d/debug3D.d.ts +5 -0
  144. package/dist/rendering/world3d/debug3D.js +5 -0
  145. package/dist/rendering/world3d/geometries3D.d.ts +12 -0
  146. package/dist/rendering/world3d/geometries3D.js +5 -0
  147. package/dist/rendering/world3d/helpers3D.d.ts +2 -0
  148. package/dist/rendering/world3d/helpers3D.js +1 -0
  149. package/dist/rendering/world3d/index.d.ts +12 -0
  150. package/dist/rendering/world3d/index.js +6 -0
  151. package/dist/rendering/world3d/math3D.d.ts +36 -0
  152. package/dist/rendering/world3d/math3D.js +35 -0
  153. package/dist/rendering/world3d/primitives3D.d.ts +7 -0
  154. package/dist/rendering/world3d/primitives3D.js +1 -0
  155. package/dist/saveStore.d.ts +18 -3
  156. package/dist/saveStore.js +23 -4
  157. package/dist/semanticList.d.ts +4 -0
  158. package/dist/semanticList.js +1 -0
  159. package/dist/semanticTree.js +11 -4
  160. package/dist/semanticTypes.d.ts +8 -0
  161. package/dist/sequencePlaybackTypes.d.ts +3 -0
  162. package/dist/text.d.ts +1 -0
  163. package/dist/textTable.d.ts +41 -0
  164. package/dist/textTable.js +114 -0
  165. package/dist/tilemapTypes.d.ts +13 -0
  166. package/dist/timer.d.ts +34 -0
  167. package/dist/timer.js +119 -0
  168. package/dist/tweenTypes.d.ts +4 -0
  169. package/dist/ui/controlKeys.d.ts +4 -0
  170. package/dist/ui/controlKeys.js +1 -0
  171. package/dist/ui/controls.d.ts +6 -0
  172. package/dist/ui/controls.js +2 -0
  173. package/dist/ui/layerTypes.d.ts +7 -0
  174. package/dist/ui/rangeControl.d.ts +3 -0
  175. package/dist/ui/rangeControl.js +1 -0
  176. package/dist/ui/scrollControl.d.ts +12 -0
  177. package/dist/ui/scrollControl.js +5 -1
  178. package/dist/ui/stateControls.d.ts +8 -0
  179. package/dist/ui/stateControls.js +3 -0
  180. package/dist/ui/textEditor.d.ts +1 -0
  181. package/dist/ui/textEditor.js +1 -0
  182. package/dist/ui/textEditorTypes.d.ts +7 -0
  183. package/dist/ui/textFieldControl.d.ts +4 -0
  184. package/dist/ui/textFieldControl.js +1 -0
  185. package/dist/ui/theme.d.ts +5 -0
  186. package/dist/ui/theme.js +1 -0
  187. package/dist/ui/types.d.ts +20 -0
  188. package/dist/ui/uiRoot.js +38 -9
  189. package/dist/ui/uiRootModel.d.ts +3 -1
  190. package/dist/ui/uiRootModel.js +8 -2
  191. package/dist/videoTypes.d.ts +3 -0
  192. package/dist/web/BrowserAssetBundle.d.ts +2 -0
  193. package/dist/web/BrowserAudio.d.ts +34 -1
  194. package/dist/web/BrowserAudio.js +69 -39
  195. package/dist/web/BrowserFrameLoop.d.ts +4 -0
  196. package/dist/web/BrowserGame.d.ts +64 -2
  197. package/dist/web/BrowserGame.js +129 -8
  198. package/dist/web/BrowserGamepadInput.d.ts +3 -0
  199. package/dist/web/BrowserHoverInput.d.ts +1 -0
  200. package/dist/web/BrowserImageTextures.d.ts +6 -0
  201. package/dist/web/BrowserInputActions.d.ts +10 -0
  202. package/dist/web/BrowserInputActions.js +4 -1
  203. package/dist/web/BrowserPlay.d.ts +130 -2
  204. package/dist/web/BrowserPlay.js +366 -19
  205. package/dist/web/BrowserPreferences.d.ts +10 -0
  206. package/dist/web/BrowserPreferences.js +39 -0
  207. package/dist/web/BrowserSemantics.d.ts +2 -0
  208. package/dist/web/BrowserStatsPanel.d.ts +10 -0
  209. package/dist/web/BrowserStatsPanel.js +9 -3
  210. package/dist/web/BrowserStorage.d.ts +2 -0
  211. package/dist/web/BrowserTextEditor.d.ts +3 -0
  212. package/dist/web/BrowserTextInput.d.ts +6 -0
  213. package/dist/web/BrowserTextureProvider.d.ts +6 -0
  214. package/dist/web/BrowserVideo.d.ts +13 -1
  215. package/dist/web/BrowserVideo.js +28 -2
  216. package/dist/web/CanvasKitFontSetProvider.d.ts +3 -0
  217. package/dist/web/CanvasKitParagraphProvider.d.ts +4 -0
  218. package/dist/web/CanvasKitParagraphProvider.js +1 -0
  219. package/dist/web/ManifestByteSource.d.ts +4 -0
  220. package/dist/web/ManifestByteSource.js +1 -0
  221. package/dist/web/ManifestFontContentLoader.d.ts +1 -0
  222. package/dist/web/WebGL2Host.js +64 -25
  223. package/dist/web/WebGPUHost.d.ts +13 -0
  224. package/dist/web/WebGPUHost.js +117 -36
  225. package/dist/web/audio.d.ts +2 -2
  226. package/dist/web/audio.js +1 -1
  227. package/dist/web/editorFonts.d.ts +4 -0
  228. package/dist/web/game.d.ts +1 -1
  229. package/dist/web/imageProjections2D.d.ts +2 -0
  230. package/dist/web/kit.d.ts +1 -0
  231. package/dist/web/kit.js +1 -0
  232. package/dist/web/play.d.ts +6 -1
  233. package/dist/web/play.js +4 -1
  234. package/dist/web/playMusic.d.ts +33 -0
  235. package/dist/web/playMusic.js +194 -0
  236. package/dist/web/playTouch.d.ts +45 -0
  237. package/dist/web/playTouch.js +141 -0
  238. package/dist/web/playWidgets.d.ts +71 -0
  239. package/dist/web/playWidgets.js +431 -0
  240. package/dist/web/prepareSharedSubmission2D.js +9 -3
  241. package/dist/web/resources.d.ts +2 -0
  242. package/dist/web/sharedEffectShaders.d.ts +6 -2
  243. package/dist/web/sharedEffectShaders.js +23 -7
  244. package/dist/web/sharedSubmissionStorage2D.js +1 -1
  245. package/dist/web/sharedWebGL2Options.d.ts +3 -0
  246. package/dist/web/sharedWebGL2Options.js +8 -2
  247. package/dist/web/sharedWebGL2Shaders.d.ts +15 -2
  248. package/dist/web/sharedWebGL2Shaders.js +108 -14
  249. package/dist/web/sharedWebGPUOptions.d.ts +5 -1
  250. package/dist/web/sharedWebGPUOptions.js +6 -2
  251. package/dist/web/video.d.ts +1 -1
  252. package/dist/web/webgl2Native.d.ts +3 -1
  253. package/dist/web/webgl2Native.js +9 -5
  254. package/dist/web/webgl2Types.d.ts +18 -0
  255. package/dist/web/webgpuImageResidency.d.ts +5 -2
  256. package/dist/web/webgpuImageResidency.js +7 -3
  257. package/dist/web/webgpuRetentionPool.d.ts +2 -2
  258. package/dist/web/webgpuRetentionPool.js +2 -1
  259. package/dist/web/webgpuSharedPass.d.ts +1 -1
  260. package/dist/web/webgpuSharedPass.js +87 -5
  261. package/dist/web/webgpuSharedResolvePass.d.ts +1 -1
  262. package/dist/web/webgpuSharedResolvePass.js +9 -4
  263. package/dist/web/world3d/Audio3D.d.ts +18 -1
  264. package/dist/web/world3d/Audio3D.js +62 -3
  265. package/dist/web/world3d/BrowserPlay3D.d.ts +115 -2
  266. package/dist/web/world3d/BrowserPlay3D.js +448 -43
  267. package/dist/web/world3d/FlyControls3D.d.ts +4 -0
  268. package/dist/web/world3d/FlyControls3D.js +2 -0
  269. package/dist/web/world3d/FollowControls3D.d.ts +3 -0
  270. package/dist/web/world3d/FollowControls3D.js +2 -0
  271. package/dist/web/world3d/OrbitControls3D.d.ts +3 -0
  272. package/dist/web/world3d/OrbitControls3D.js +2 -0
  273. package/dist/web/world3d/TransformControls3D.d.ts +5 -2
  274. package/dist/web/world3d/TransformControls3D.js +7 -4
  275. package/dist/web/world3d/WebGL2Renderer3D.d.ts +3 -0
  276. package/dist/web/world3d/WebGL2Renderer3D.js +2 -0
  277. package/dist/web/world3d/WebGPURenderer3D.d.ts +2 -0
  278. package/dist/web/world3d/WebGPURenderer3D.js +1 -0
  279. package/dist/web/world3d/World3DView.d.ts +3 -0
  280. package/dist/web/world3d/World3DView.js +2 -0
  281. package/dist/web/world3d/app3D.d.ts +7 -0
  282. package/dist/web/world3d/app3D.js +1 -0
  283. package/dist/web/world3d/assets3D.d.ts +1 -0
  284. package/dist/web/world3d/atmosphere3D.d.ts +9 -0
  285. package/dist/web/world3d/atmosphere3D.js +19 -4
  286. package/dist/web/world3d/canvasFont3D.d.ts +21 -0
  287. package/dist/web/world3d/canvasFont3D.js +165 -0
  288. package/dist/web/world3d/frame3D.d.ts +2 -0
  289. package/dist/web/world3d/host3D.d.ts +1 -0
  290. package/dist/web/world3d/index.d.ts +4 -2
  291. package/dist/web/world3d/index.js +2 -1
  292. package/dist/web/world3d/loaders3D.d.ts +1 -0
  293. package/dist/web/world3d/markers3D.d.ts +4 -0
  294. package/dist/web/world3d/overlay3D.d.ts +19 -0
  295. package/dist/web/world3d/overlay3D.js +21 -4
  296. package/dist/web/world3d/post3D.d.ts +4 -0
  297. package/dist/web/world3d/post3D.js +3 -0
  298. package/dist/web/world3d/probe3D.d.ts +1 -0
  299. package/dist/web/world3d/stats3D.d.ts +3 -0
  300. package/dist/web/world3d/stats3D.js +1 -0
  301. package/dist/web/world3d/webGL2FrameMetrics3D.d.ts +5 -0
  302. package/dist/web/world3d/webgpu.d.ts +2 -0
  303. package/dist/web/world3d/webgpu.js +1 -0
  304. package/package.json +3 -3
@@ -45,6 +45,8 @@ export function createPhysicsWorld(options = {}) {
45
45
  throw new EgretError('PHYSICS_OPTIONS_INVALID');
46
46
  let gravity = Object.freeze({ x: g0.x, y: g0.y });
47
47
  const bodies = [];
48
+ const joints = [];
49
+ let stepping = false;
48
50
  const listeners = new Set();
49
51
  let touching = new Map(), pending = 0, steps = 0, ids = 0, closed = false;
50
52
  const open = () => {
@@ -107,10 +109,29 @@ export function createPhysicsWorld(options = {}) {
107
109
  });
108
110
  const face = {
109
111
  id: body.id,
110
- kind: body.kind,
112
+ get kind() {
113
+ return body.kind;
114
+ },
111
115
  shape: body.shape,
112
- mass: body.mass,
116
+ get mass() {
117
+ return body.mass;
118
+ },
113
119
  sensor: body.sensor,
120
+ setKind(kind) {
121
+ if (kind !== 'static' && kind !== 'kinematic' && kind !== 'dynamic')
122
+ throw new EgretError('PHYSICS_OPTIONS_INVALID');
123
+ if (body.removed)
124
+ throw new EgretError('PHYSICS_BODY_INVALID');
125
+ body.kind = kind;
126
+ body.mass = kind === 'dynamic' ? body.density * areaOf(body.shape) : Infinity;
127
+ body.inverseMass = kind === 'dynamic' ? 1 / body.mass : 0;
128
+ body.fx = 0;
129
+ body.fy = 0;
130
+ if (kind === 'static') {
131
+ body.vx = 0;
132
+ body.vy = 0;
133
+ }
134
+ },
114
135
  get state() {
115
136
  return body.removed ? 'removed' : 'active';
116
137
  },
@@ -193,6 +214,7 @@ export function createPhysicsWorld(options = {}) {
193
214
  id: ++ids,
194
215
  kind,
195
216
  shape: frozen,
217
+ density,
196
218
  mass,
197
219
  inverseMass: kind === 'dynamic' ? 1 / mass : 0,
198
220
  sensor,
@@ -224,6 +246,153 @@ export function createPhysicsWorld(options = {}) {
224
246
  }
225
247
  return body.face;
226
248
  }
249
+ /** Where a joint holds a body, in the world: its anchor turned by the body's angle. */
250
+ function anchorOf(body, ax, ay) {
251
+ if (ax === 0 && ay === 0)
252
+ return [body.x, body.y];
253
+ const turn = (body.angle * Math.PI) / 180, c = Math.cos(turn), s = Math.sin(turn);
254
+ return [body.x + ax * c - ay * s, body.y + ax * s + ay * c];
255
+ }
256
+ function ends(joint) {
257
+ const [x1, y1] = anchorOf(joint.a, joint.ax, joint.ay), [x2, y2] = joint.b === undefined ? [joint.px, joint.py] : anchorOf(joint.b, joint.bx, joint.by);
258
+ return [x1, y1, x2, y2];
259
+ }
260
+ /** The line from a to b, its length, and how far that is from the joint's own length; undefined when slack. */
261
+ function strain(joint) {
262
+ const [x1, y1, x2, y2] = ends(joint), dx = x2 - x1, dy = y2 - y1, distance = Math.hypot(dx, dy), error = distance - joint.length;
263
+ if (joint.kind === 'rope' && error <= 0)
264
+ return undefined;
265
+ // Two anchors at one place have no line between them: a pin holds them together in place only.
266
+ if (distance < 1e-9)
267
+ return { nx: 0, ny: 0, error: 0 };
268
+ return { nx: dx / distance, ny: dy / distance, error };
269
+ }
270
+ /** Takes out the speed along a joint that would stretch it, or, for a rod, change its length. */
271
+ function holdSpeed(joint, dt) {
272
+ const a = joint.a, b = joint.b, ib = b === undefined ? 0 : b.inverseMass, total = a.inverseMass + ib;
273
+ if (total === 0)
274
+ return;
275
+ const line = strain(joint);
276
+ if (line === undefined)
277
+ return;
278
+ if (line.nx === 0 && line.ny === 0) {
279
+ // A pin: the body moves as what it is pinned to does.
280
+ const vx = b === undefined ? 0 : b.vx, vy = b === undefined ? 0 : b.vy, rx = vx - a.vx, ry = vy - a.vy;
281
+ a.vx += (rx * a.inverseMass) / total;
282
+ a.vy += (ry * a.inverseMass) / total;
283
+ if (b !== undefined) {
284
+ b.vx -= (rx * ib) / total;
285
+ b.vy -= (ry * ib) / total;
286
+ }
287
+ return;
288
+ }
289
+ const along = ((b === undefined ? 0 : b.vx) - a.vx) * line.nx + ((b === undefined ? 0 : b.vy) - a.vy) * line.ny;
290
+ // A rope pulls only against stretching; a rod against both.
291
+ const bias = (line.error * joint.stiffness * 0.2) / dt;
292
+ let j = -(along + bias) / total;
293
+ if (joint.kind === 'rope' && j > 0)
294
+ j = 0;
295
+ j *= joint.stiffness;
296
+ a.vx -= j * line.nx * a.inverseMass;
297
+ a.vy -= j * line.ny * a.inverseMass;
298
+ if (b !== undefined) {
299
+ b.vx += j * line.nx * ib;
300
+ b.vy += j * line.ny * ib;
301
+ }
302
+ }
303
+ /** Moves the bodies of a joint back to its length, shared by their inverse masses. */
304
+ function holdPlace(joint) {
305
+ const a = joint.a, b = joint.b, ib = b === undefined ? 0 : b.inverseMass, total = a.inverseMass + ib;
306
+ if (total === 0)
307
+ return;
308
+ const [x1, y1, x2, y2] = ends(joint), dx = x2 - x1, dy = y2 - y1, distance = Math.hypot(dx, dy);
309
+ let error = distance - joint.length;
310
+ if (joint.kind === 'rope' && error <= 0)
311
+ return;
312
+ if (Math.abs(error) <= SLOP)
313
+ return;
314
+ error *= joint.stiffness * CORRECTION;
315
+ const nx = distance < 1e-9 ? 0 : dx / distance, ny = distance < 1e-9 ? 0 : dy / distance, push = error / total;
316
+ a.x += nx * push * a.inverseMass;
317
+ a.y += ny * push * a.inverseMass;
318
+ moved(a);
319
+ if (b !== undefined && ib > 0) {
320
+ b.x -= nx * push * ib;
321
+ b.y -= ny * push * ib;
322
+ moved(b);
323
+ }
324
+ }
325
+ function jointFace(joint) {
326
+ return Object.freeze(Object.defineProperties({
327
+ kind: joint.kind,
328
+ a: joint.a.face,
329
+ b: joint.b?.face,
330
+ distance() {
331
+ const [x1, y1, x2, y2] = ends(joint);
332
+ return Math.hypot(x2 - x1, y2 - y1);
333
+ }
334
+ }, {
335
+ state: { get: () => (joint.removed ? 'removed' : 'active'), enumerable: true },
336
+ length: {
337
+ get: () => joint.length,
338
+ set: (value) => {
339
+ if (!finite(value) || value < 0)
340
+ throw new EgretError('PHYSICS_OPTIONS_INVALID');
341
+ joint.length = value;
342
+ },
343
+ enumerable: true
344
+ }
345
+ }));
346
+ }
347
+ function addJoint(o) {
348
+ if (!record(o))
349
+ throw new EgretError('PHYSICS_OPTIONS_INVALID');
350
+ const { kind, point, anchorA = { x: 0, y: 0 }, anchorB = { x: 0, y: 0 }, length, stiffness = 1 } = o;
351
+ if ((kind !== 'distance' && kind !== 'rope') ||
352
+ !vector(anchorA) ||
353
+ !vector(anchorB) ||
354
+ (length !== undefined && (!finite(length) || length < 0)) ||
355
+ !finite(stiffness) ||
356
+ stiffness <= 0 ||
357
+ stiffness > 1 ||
358
+ (o.b === undefined) === (point === undefined) ||
359
+ (point !== undefined && !vector(point)))
360
+ throw new EgretError('PHYSICS_OPTIONS_INVALID');
361
+ open();
362
+ const a = own(o.a), b = o.b === undefined ? undefined : own(o.b);
363
+ if (a === b)
364
+ throw new EgretError('PHYSICS_OPTIONS_INVALID');
365
+ const joint = {
366
+ kind,
367
+ a,
368
+ b,
369
+ px: point?.x ?? 0,
370
+ py: point?.y ?? 0,
371
+ ax: anchorA.x,
372
+ ay: anchorA.y,
373
+ bx: anchorB.x,
374
+ by: anchorB.y,
375
+ stiffness,
376
+ length: 0,
377
+ removed: false,
378
+ face: undefined
379
+ };
380
+ if (length === undefined) {
381
+ const [x1, y1, x2, y2] = ends(joint);
382
+ joint.length = Math.hypot(x2 - x1, y2 - y1);
383
+ }
384
+ else
385
+ joint.length = length;
386
+ joint.face = jointFace(joint);
387
+ joints.push(joint);
388
+ return joint.face;
389
+ }
390
+ function dropJoint(joint) {
391
+ const index = joints.indexOf(joint);
392
+ if (index >= 0)
393
+ joints.splice(index, 1);
394
+ joint.removed = true;
395
+ }
227
396
  /** The pairs whose boxes share a cell of the grid, each once, in the order of their ids. */
228
397
  function pairs() {
229
398
  const cells = new Map(), seen = new Set(), out = [];
@@ -283,7 +452,7 @@ export function createPhysicsWorld(options = {}) {
283
452
  solid.push({ a, b, ...meeting });
284
453
  }
285
454
  // Speeds first, in rounds, so that a stack settles; then the places, so that nothing stays inside another.
286
- for (let round = 0; round < iterations; round++)
455
+ for (let round = 0; round < iterations; round++) {
287
456
  for (const c of solid) {
288
457
  const { a, b, nx, ny } = c, total = a.inverseMass + b.inverseMass;
289
458
  if (total === 0)
@@ -308,6 +477,9 @@ export function createPhysicsWorld(options = {}) {
308
477
  b.vy += applied * ty * b.inverseMass;
309
478
  }
310
479
  }
480
+ for (const joint of joints)
481
+ holdSpeed(joint, dt);
482
+ }
311
483
  // A few passes, each measuring again, so that a stack does not sink into what it stands on.
312
484
  for (let pass = 0; pass < 3; pass++)
313
485
  for (const c of solid) {
@@ -329,6 +501,9 @@ export function createPhysicsWorld(options = {}) {
329
501
  moved(b);
330
502
  }
331
503
  }
504
+ for (let pass = 0; pass < 3; pass++)
505
+ for (const joint of joints)
506
+ holdPlace(joint);
332
507
  const told = [];
333
508
  for (const [key, touch] of now)
334
509
  if (!touching.has(key))
@@ -378,6 +553,9 @@ export function createPhysicsWorld(options = {}) {
378
553
  return;
379
554
  bodies.splice(index, 1);
380
555
  body.removed = true;
556
+ for (const joint of [...joints])
557
+ if (joint.a === body || joint.b === body)
558
+ dropJoint(joint);
381
559
  const ended = [];
382
560
  for (const [key, touch] of [...touching])
383
561
  if (touch.a === body || touch.b === body) {
@@ -420,6 +598,16 @@ export function createPhysicsWorld(options = {}) {
420
598
  return Object.freeze(bodies.map(body => body.face));
421
599
  },
422
600
  addBody: add,
601
+ addJoint,
602
+ removeJoint(value) {
603
+ const joint = joints.find(candidate => candidate.face === value);
604
+ if (joint === undefined)
605
+ throw new EgretError('PHYSICS_JOINT_INVALID');
606
+ dropJoint(joint);
607
+ },
608
+ get joints() {
609
+ return Object.freeze(joints.map(joint => joint.face));
610
+ },
423
611
  removeBody(value) {
424
612
  const body = own(value), failures = [];
425
613
  remove(body, failures);
@@ -486,14 +674,23 @@ export function createPhysicsWorld(options = {}) {
486
674
  if (!finite(seconds) || seconds < 0)
487
675
  throw new EgretError('PHYSICS_OPTIONS_INVALID');
488
676
  open();
677
+ // A contact listener that steps would start a step inside the one it is told of.
678
+ if (stepping)
679
+ throw new EgretError('PHYSICS_STEP_REENTRANT');
489
680
  pending += seconds;
490
681
  let taken = 0;
491
- // A tiny remainder of a float is one step, not a step short.
492
- while (pending + 1e-9 >= fixedStep && taken < maxSteps) {
493
- pending = Math.max(0, pending - fixedStep);
494
- once(fixedStep);
495
- taken++;
496
- steps++;
682
+ stepping = true;
683
+ try {
684
+ // A tiny remainder of a float is one step, not a step short.
685
+ while (pending + 1e-9 >= fixedStep && taken < maxSteps && !closed) {
686
+ pending = Math.max(0, pending - fixedStep);
687
+ once(fixedStep);
688
+ taken++;
689
+ steps++;
690
+ }
691
+ }
692
+ finally {
693
+ stepping = false;
497
694
  }
498
695
  // What could not be caught up is let go, so that the next update is not behind before it starts.
499
696
  if (taken === maxSteps)
@@ -615,6 +812,9 @@ export function createPhysicsWorld(options = {}) {
615
812
  for (const body of bodies)
616
813
  body.removed = true;
617
814
  bodies.length = 0;
815
+ for (const joint of joints)
816
+ joint.removed = true;
817
+ joints.length = 0;
618
818
  touching.clear();
619
819
  listeners.clear();
620
820
  }
@@ -7,5 +7,6 @@ interface SurfaceBinding {
7
7
  }
8
8
  /** Private browser assembly authority; never exported by the optional public entry. */
9
9
  export declare function bindPointerSurface(input: PointerInput): SurfaceBinding;
10
+ /** Pointer input for the stage: touches, mouse buttons and pens become contacts delivered to the nodes under them. */
10
11
  export declare function createPointerInput(options: PointerInputOptions): PointerInput;
11
12
  //# sourceMappingURL=pointerInput.d.ts.map
@@ -24,6 +24,7 @@ export function bindPointerSurface(input) {
24
24
  }
25
25
  /** How far, in stage units, a contact may end from where it began and still be a tap. */
26
26
  const TAP_SLOP = 12;
27
+ /** Pointer input for the stage: touches, mouse buttons and pens become contacts delivered to the nodes under them. */
27
28
  export function createPointerInput(options) {
28
29
  if (options === null || typeof options !== 'object' || Array.isArray(options))
29
30
  throw new EgretError('POINTER_INPUT_OPTIONS_INVALID');
@@ -2,6 +2,7 @@ import type { DisplayObject, EventType, Scope } from '@egret/runtime';
2
2
  import type { PointerCancelReason, PointerContact, PointerEventKind, PointerRouter } from '@egret/runtime/input';
3
3
  import type { Engine } from './Engine.js';
4
4
  export type { PointerCancelReason, PointerContact, PointerEventKind, PointerSample, PointerSession, PointerType, PointerUpdate, PointerRouterState } from '@egret/runtime/input';
5
+ /** A pointer contact and the target it went to, and why it was cancelled. */
5
6
  export interface PointerNotification {
6
7
  readonly kind: PointerEventKind;
7
8
  readonly contact: PointerContact;
@@ -10,6 +11,7 @@ export interface PointerNotification {
10
11
  /** Present on a terminal `end`: whether the event was actually dispatched to a target path. */
11
12
  readonly delivered?: boolean;
12
13
  }
14
+ /** Pointer input to make: its engine and scope, the surface's size, its limits, and what is called. */
13
15
  export interface PointerInputOptions {
14
16
  readonly engine: Engine;
15
17
  readonly scope: Scope;
@@ -19,6 +21,7 @@ export interface PointerInputOptions {
19
21
  readonly capacity?: number;
20
22
  readonly onContact?: (notification: PointerNotification) => void;
21
23
  }
24
+ /** The event types pointer input dispatches: begin, move, end, cancel and tap. */
22
25
  export interface PointerInputEvents {
23
26
  readonly begin: EventType<PointerContact>;
24
27
  readonly move: EventType<PointerContact>;
package/dist/random.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ /** Random numbers from a seed, repeatable: numbers, ranges, choices, shuffles and normal values. */
1
2
  export interface Random {
2
3
  /** A number in [0, 1). */
3
4
  next(): number;
@@ -1,5 +1,6 @@
1
1
  import { qualifySharedUVIn, sharedFailure, sharedUVDomain } from './prepareSharedDraws2D.js';
2
2
  import { packedOrientation } from './packedOrientation.js';
3
+ import { sharedPageLevels2D } from './sharedColor2D.js';
3
4
  /**
4
5
  * One vertex is thirteen f32 values: x y u v r g b a dr dg db slot opacity. `slot` is the place of the
5
6
  * draw's region in its window of the region table, and `opacity` the opacity of the draw; both are the
@@ -45,8 +46,45 @@ export function packSharedRegions2D(frame) {
45
46
  }
46
47
  return table;
47
48
  }
49
+ /** How many times a number halves exactly: the trailing zero bits of a whole number, and as many as wanted for 0. */
50
+ const halvings = (value) => (value === 0 ? 32 : 31 - Math.clz32(value & -value));
51
+ /**
52
+ * Which smaller copies of its page a draw that asks for them may read, as words 9 and 10 of its block: the
53
+ * deepest level, and how the draw finds its texels on a level. A draw that samples its whole page, upright
54
+ * and untrimmed, scales its coordinates by the size of each level (mode 1), as a GPU does, and reads every
55
+ * level. A draw of a region of a page shared with other regions reads only the levels on which every edge of
56
+ * the region, of its trim and of its content, falls between two texels (mode 0): there its texels are exactly
57
+ * the means of its own texels, and none of a neighbour's.
58
+ */
59
+ function mipReach(draw, frame) {
60
+ const region = draw.region, page = frame.pages[region.pageIndex].source, deepest = sharedPageLevels2D(page.width, page.height) - 1, p = region.packed;
61
+ if (draw.material.samplingDomain === 'page' ||
62
+ (region.quarterTurn === 0 &&
63
+ p.x === 0 &&
64
+ p.y === 0 &&
65
+ p.width === page.width &&
66
+ p.height === page.height &&
67
+ region.trimX === 0 &&
68
+ region.trimY === 0 &&
69
+ region.logicalWidth === p.width &&
70
+ region.logicalHeight === p.height))
71
+ return [1, deepest];
72
+ let reach = deepest;
73
+ for (const edge of [
74
+ p.x,
75
+ p.y,
76
+ p.width,
77
+ p.height,
78
+ region.trimX,
79
+ region.trimY,
80
+ region.logicalWidth,
81
+ region.logicalHeight
82
+ ])
83
+ reach = Math.min(reach, halvings(edge));
84
+ return [0, reach];
85
+ }
48
86
  /** Writes the block of one draw at float index `f` of a buffer seen as floats and as words. Every word it does not write is zero. */
49
- function writeBlock(floats, words, f, width, height, draw) {
87
+ function writeBlock(floats, words, f, width, height, draw, frame) {
50
88
  // Float and word indices of this draw's block: twelve floats, then twenty words from byte 48.
51
89
  // The block holds what is the same for a whole batch. The third float, once the opacity, stays zero: the
52
90
  // opacity is in each vertex. Of the first eleven words, once the region, the first eight name the pages
@@ -81,6 +119,12 @@ function writeBlock(floats, words, f, width, height, draw) {
81
119
  : material.regionIsolation === 'strict'
82
120
  ? 3
83
121
  : 2;
122
+ if (material.mipmapFilter === 'linear') {
123
+ const [mode, deepest] = mipReach(draw, frame);
124
+ words[w + 8] = 1;
125
+ words[w + 9] = deepest;
126
+ words[w + 10] = mode;
127
+ }
84
128
  words[w + 11] = material.samplingDomain === 'page' ? 1 : 0;
85
129
  words[w + 12] = address(material.addressU);
86
130
  words[w + 13] = address(material.addressV);
@@ -131,7 +175,9 @@ export function packSharedDraws2D(prepared) {
131
175
  if (other !== undefined &&
132
176
  other.material === draw.material &&
133
177
  other.pageIndex === draw.pageIndex &&
134
- other.command.kind === draw.command.kind)
178
+ other.command.kind === draw.command.kind &&
179
+ // The levels a draw with smaller copies may read depend on its region.
180
+ (draw.material.mipmapFilter !== 'linear' || other.region === draw.region))
135
181
  return beside.uniform;
136
182
  if (block === blockEnd) {
137
183
  const blocks = new ArrayBuffer(BLOCKS * BLOCK);
@@ -141,7 +187,7 @@ export function packSharedDraws2D(prepared) {
141
187
  block = 0;
142
188
  blockEnd = BLOCKS * BLOCK;
143
189
  }
144
- writeBlock(blockFloats, blockWords, block >> 2, prepared.width, prepared.height, draw);
190
+ writeBlock(blockFloats, blockWords, block >> 2, prepared.width, prepared.height, draw, prepared.frame);
145
191
  block += BLOCK;
146
192
  return blockBytes.subarray(block - BLOCK, block);
147
193
  };
@@ -151,10 +197,12 @@ export function packSharedDraws2D(prepared) {
151
197
  if (other !== undefined &&
152
198
  other.material === draw.material &&
153
199
  other.pageIndex === draw.pageIndex &&
154
- other.command.kind === draw.command.kind)
200
+ other.command.kind === draw.command.kind &&
201
+ // The levels a draw with smaller copies may read depend on its region.
202
+ (draw.material.mipmapFilter !== 'linear' || other.region === draw.region))
155
203
  return beside.uniform;
156
204
  const own = new ArrayBuffer(BLOCK);
157
- writeBlock(new Float32Array(own), new Uint32Array(own), 0, prepared.width, prepared.height, draw);
205
+ writeBlock(new Float32Array(own), new Uint32Array(own), 0, prepared.width, prepared.height, draw, prepared.frame);
158
206
  return new Uint8Array(own);
159
207
  };
160
208
  let fresh, rested;
@@ -64,6 +64,8 @@ export interface PreparedSharedFrame2D {
64
64
  readonly budget: TexturedPreparationBudget2D;
65
65
  readonly geometryBytes: number;
66
66
  readonly pageBytes: number;
67
+ /** For each page of the frame, how many levels it is uploaded with: 1, or all of them when a draw samples its smaller copies. */
68
+ readonly pageLevels: readonly number[];
67
69
  readonly upload: number;
68
70
  readonly retention?: SharedPreparationRetention2D;
69
71
  readonly retained?: readonly (RetainedSharedDraw2D | undefined)[];
@@ -3,7 +3,7 @@ import { prepareEffects2D } from './sharedEffects2D.js';
3
3
  import { Preparation, coordinate, clipPolygon2D, finishPolygonWinding2D } from './prepareRectangles2D.js';
4
4
  import { TexturedPreparationBudget2D } from './texturedPreparationBudget2D.js';
5
5
  import { noteOwnedPreparationFailure } from './ownedPreparationFailure2D.js';
6
- import { decodeSharedSRGBByte } from './sharedColor2D.js';
6
+ import { decodeSharedSRGBByte, sharedBlendSpace2D, sharedPageChainBytes2D, sharedPageLevels2D } from './sharedColor2D.js';
7
7
  export class SharedPreparationError extends Error {
8
8
  reason;
9
9
  constructor(reason) {
@@ -282,9 +282,7 @@ const NO_CLIPS = [];
282
282
  * The frame's tables, every command's own numbers and every frame-wide charge are checked for every frame.
283
283
  */
284
284
  export function prepareSharedDraws2D(frame, width, height, options, retention) {
285
- if (frame.profile !== 'egret.shared-frame2d/1' ||
286
- frame.colorRecipe !== 'egret.linear-srgb-pma/1' ||
287
- frame.targetRepresentation !== 'egret.srgb-pma8-target/1')
285
+ if (frame.profile !== 'egret.shared-frame2d/1' || sharedBlendSpace2D(frame) === undefined)
288
286
  sharedFailure('profile');
289
287
  if (frame.commands.length > options.maxCommands ||
290
288
  frame.commands.length > 65536 ||
@@ -300,12 +298,24 @@ export function prepareSharedDraws2D(frame, width, height, options, retention) {
300
298
  for (const command of frame.commands)
301
299
  if (command.kind === 'barrier' && command.effect)
302
300
  clipsCount = add(clipsCount, command.effect.clips.length, options.maxClipRectangles);
303
- for (const page of frame.pages) {
301
+ // A page sampled by a draw whose material asks for smaller copies is uploaded with all its levels.
302
+ const pageLevels = frame.pages.map(() => 1);
303
+ for (const command of frame.commands)
304
+ if ((command.kind === 'image' || command.kind === 'mesh') &&
305
+ frame.materials[command.materialIndex]?.mipmapFilter === 'linear') {
306
+ const index = frame.regions[command.regionIndex]?.pageIndex, source = index === undefined ? undefined : frame.pages[index]?.source;
307
+ if (source !== undefined && isImageData2D(source))
308
+ pageLevels[index] = sharedPageLevels2D(source.width, source.height);
309
+ }
310
+ for (let index = 0; index < frame.pages.length; index++) {
311
+ const page = frame.pages[index];
304
312
  if (!isImageData2D(page.source) ||
305
313
  page.sourceRepresentation !== 'egret.srgb-straight-rgba8/1' ||
306
314
  page.canonicalRepresentation !== 'egret.alpha8-capped-srgb-pma8/1')
307
315
  sharedFailure('frame');
308
- pageBytes = add(pageBytes, page.source.byteLength, pageLimit);
316
+ pageBytes = add(pageBytes, pageLevels[index] === 1
317
+ ? page.source.byteLength
318
+ : sharedPageChainBytes2D(page.source.width, page.source.height, pageLevels[index]), pageLimit);
309
319
  }
310
320
  for (const material of frame.materials) {
311
321
  if (!isSharedMaterial2D(material))
@@ -645,6 +655,7 @@ export function prepareSharedDraws2D(frame, width, height, options, retention) {
645
655
  budget,
646
656
  geometryBytes,
647
657
  pageBytes,
658
+ pageLevels,
648
659
  upload: upload + 48 * frame.regions.length + effects.uniformBytes,
649
660
  ...(retention ? { retention, retained: retained } : {})
650
661
  };
@@ -3,7 +3,41 @@ import type { ImageData2D } from '@egret/contracts';
3
3
  export declare function decodeSharedSRGB(value: number): number;
4
4
  /** The linear-light value of an sRGB byte, from the written table: the same number in every JavaScript engine. */
5
5
  export declare function decodeSharedSRGBByte(code: number): number;
6
+ /** The recipe and target a frame records for each blend space. */
7
+ export declare const SHARED_BLEND_RECIPES_2D: Readonly<{
8
+ linear: Readonly<{
9
+ readonly colorRecipe: 'egret.linear-srgb-pma/1';
10
+ readonly targetRepresentation: 'egret.srgb-pma8-target/1';
11
+ }>;
12
+ srgb: Readonly<{
13
+ readonly colorRecipe: 'egret.srgb-pma/1';
14
+ readonly targetRepresentation: 'egret.encoded-srgb-pma8-target/1';
15
+ }>;
16
+ }>;
17
+ /** The blend space of a frame whose recipe and target agree, or undefined. */
18
+ export declare function sharedBlendSpace2D(frame: {
19
+ readonly colorRecipe: string;
20
+ readonly targetRepresentation: string;
21
+ }): 'linear' | 'srgb' | undefined;
22
+ /**
23
+ * The 0-to-1 value a target of the blend space holds for a channel byte of a colour: its linear light, or the
24
+ * byte as it is written in a target that mixes the codes.
25
+ */
26
+ export declare function sharedTargetChannel2D(space: 'linear' | 'srgb', code: number): number;
6
27
  export declare function encodeSharedSRGB(value: number): number;
28
+ /**
29
+ * How many levels a page of this size has when it carries its smaller copies: the page itself, then each copy
30
+ * half as large, rounded down and never below one texel, down to one texel.
31
+ */
32
+ export declare function sharedPageLevels2D(width: number, height: number): number;
33
+ /** The size of each level of a page, and where its bytes start in the page's bytes. */
34
+ export declare function sharedPageLevelLayout2D(width: number, height: number, levels: number): {
35
+ width: number;
36
+ height: number;
37
+ offset: number;
38
+ }[];
39
+ /** The bytes of a page with `levels` levels: the page's own, then those of each smaller copy after it. */
40
+ export declare function sharedPageChainBytes2D(width: number, height: number, levels: number): number;
7
41
  /** Plain Host-owned observation only; no allocator, callback or resource authority. */
8
42
  export interface SharedPageCopyDiagnostics2D {
9
43
  canonicalBytes: number;
@@ -14,5 +48,5 @@ export interface SharedPageCopyDiagnostics2D {
14
48
  saturated: boolean;
15
49
  }
16
50
  /** One actual source copy and one tight canonical output; callers reserve that peak first. */
17
- export declare function copySharedPagePixels(image: ImageData2D, diagnostics?: SharedPageCopyDiagnostics2D): Uint8Array<ArrayBuffer>;
51
+ export declare function copySharedPagePixels(image: ImageData2D, diagnostics?: SharedPageCopyDiagnostics2D, levels?: number): Uint8Array<ArrayBuffer>;
18
52
  //# sourceMappingURL=sharedColor2D.d.ts.map