@driftengine/core 4.8.7 → 4.10.0

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 (263) hide show
  1. package/CHANGELOG.json +123 -11
  2. package/README.md +43 -38
  3. package/dist/index.d.ts +8 -1
  4. package/dist/index.js +11 -3
  5. package/dist/render/ambientHarmonics.d.ts +1 -1
  6. package/dist/render/ambientHarmonics.js +1 -1
  7. package/dist/render/areaLights.d.ts +4 -4
  8. package/dist/render/areaLights.js +1 -1
  9. package/dist/render/atmosphere.d.ts +13 -0
  10. package/dist/render/atmosphere.js +9 -1
  11. package/dist/render/backend/api.d.ts +19 -4
  12. package/dist/render/backend/createRenderer.d.ts +6 -0
  13. package/dist/render/backend/createRenderer.js +4 -1
  14. package/dist/render/backend/select.js +11 -5
  15. package/dist/render/backend/webgl2/boneAnimations.d.ts +29 -0
  16. package/dist/render/backend/webgl2/boneAnimations.js +80 -0
  17. package/dist/render/backend/webgl2/instanced.d.ts +5 -1
  18. package/dist/render/backend/webgl2/instanced.js +13 -1
  19. package/dist/render/backend/webgl2/renderer.d.ts +180 -4
  20. package/dist/render/backend/webgl2/renderer.js +550 -40
  21. package/dist/render/backend/webgl2/skinPaletteTexture.d.ts +5 -3
  22. package/dist/render/backend/webgl2/skinPaletteTexture.js +6 -4
  23. package/dist/render/backend/webgpu/boneAnimations.d.ts +34 -0
  24. package/dist/render/backend/webgpu/boneAnimations.js +76 -0
  25. package/dist/render/backend/webgpu/buffers.d.ts +19 -4
  26. package/dist/render/backend/webgpu/buffers.js +18 -11
  27. package/dist/render/backend/webgpu/compressedUpload.d.ts +0 -1
  28. package/dist/render/backend/webgpu/compressedUpload.js +53 -8
  29. package/dist/render/backend/webgpu/depthPass.d.ts +59 -3
  30. package/dist/render/backend/webgpu/depthPass.js +49 -14
  31. package/dist/render/backend/webgpu/device.d.ts +7 -1
  32. package/dist/render/backend/webgpu/device.js +31 -3
  33. package/dist/render/backend/webgpu/drawCommand.d.ts +18 -4
  34. package/dist/render/backend/webgpu/drawCommand.js +10 -3
  35. package/dist/render/backend/webgpu/flatPass.d.ts +100 -42
  36. package/dist/render/backend/webgpu/flatPass.js +191 -43
  37. package/dist/render/backend/webgpu/instanced.d.ts +14 -1
  38. package/dist/render/backend/webgpu/instanced.js +24 -1
  39. package/dist/render/backend/webgpu/materialStore.d.ts +101 -0
  40. package/dist/render/backend/webgpu/materialStore.js +265 -0
  41. package/dist/render/backend/webgpu/pipelineCache.d.ts +6 -0
  42. package/dist/render/backend/webgpu/pipelineCache.js +7 -0
  43. package/dist/render/backend/webgpu/postPass.d.ts +51 -9
  44. package/dist/render/backend/webgpu/postPass.js +16 -2
  45. package/dist/render/backend/webgpu/reflectionSurfacePass.d.ts +30 -0
  46. package/dist/render/backend/webgpu/reflectionSurfacePass.js +100 -0
  47. package/dist/render/backend/webgpu/renderer.d.ts +283 -37
  48. package/dist/render/backend/webgpu/renderer.js +1363 -202
  49. package/dist/render/backend/webgpu/skinPaletteRing.d.ts +7 -3
  50. package/dist/render/backend/webgpu/skinPaletteRing.js +13 -7
  51. package/dist/render/backend/webgpu/skinPaletteTexture.d.ts +6 -0
  52. package/dist/render/backend/webgpu/skinPaletteTexture.js +7 -1
  53. package/dist/render/backend/webgpu/staticBundles.d.ts +125 -0
  54. package/dist/render/backend/webgpu/staticBundles.js +241 -0
  55. package/dist/render/backend/webgpu/surfaceTexturePass.d.ts +10 -3
  56. package/dist/render/backend/webgpu/surfaceTexturePass.js +20 -2
  57. package/dist/render/backend/webgpu/uniformRing.d.ts +21 -0
  58. package/dist/render/backend/webgpu/uniformRing.js +9 -1
  59. package/dist/render/bloomChain.d.ts +3 -3
  60. package/dist/render/boneAnimation.d.ts +92 -0
  61. package/dist/render/boneAnimation.js +133 -0
  62. package/dist/render/compressedSource.d.ts +33 -13
  63. package/dist/render/compressedSource.js +70 -25
  64. package/dist/render/displayRange.d.ts +31 -0
  65. package/dist/render/displayRange.js +47 -0
  66. package/dist/render/filmicCurve.d.ts +74 -0
  67. package/dist/render/filmicCurve.js +203 -0
  68. package/dist/render/fog.d.ts +4 -1
  69. package/dist/render/fog.js +12 -2
  70. package/dist/render/frame/resources.d.ts +2 -2
  71. package/dist/render/frame/resources.js +6 -0
  72. package/dist/render/frameReflections.d.ts +40 -0
  73. package/dist/render/frameReflections.js +48 -0
  74. package/dist/render/glCompressed.js +83 -0
  75. package/dist/render/instances.d.ts +26 -0
  76. package/dist/render/lightBudget.d.ts +10 -0
  77. package/dist/render/lightBudget.js +10 -0
  78. package/dist/render/lightmap.d.ts +1 -1
  79. package/dist/render/mesh.d.ts +5 -0
  80. package/dist/render/mesh.js +6 -0
  81. package/dist/render/pass.d.ts +49 -0
  82. package/dist/render/pointLightSelection.d.ts +4 -4
  83. package/dist/render/reflectionSurfaceTargets.d.ts +28 -0
  84. package/dist/render/reflectionSurfaceTargets.js +99 -0
  85. package/dist/render/renderQuality.d.ts +39 -8
  86. package/dist/render/renderQuality.js +4 -0
  87. package/dist/render/sceneTarget.d.ts +5 -0
  88. package/dist/render/sceneTarget.js +24 -1
  89. package/dist/render/screenSpaceReflection.d.ts +7 -1
  90. package/dist/render/screenSpaceReflection.js +5 -0
  91. package/dist/render/shaders/arcane.d.ts +1 -1
  92. package/dist/render/shaders/bolt.d.ts +1 -1
  93. package/dist/render/shaders/boneAnimation.d.ts +19 -0
  94. package/dist/render/shaders/boneAnimation.js +63 -0
  95. package/dist/render/shaders/caustics.d.ts +1 -1
  96. package/dist/render/shaders/depth.d.ts +7 -0
  97. package/dist/render/shaders/depth.js +35 -10
  98. package/dist/render/shaders/film.d.ts +1 -1
  99. package/dist/render/shaders/filmLook.js +2 -1
  100. package/dist/render/shaders/fire.d.ts +1 -1
  101. package/dist/render/shaders/flat/glassTint.d.ts +1 -1
  102. package/dist/render/shaders/flat/glassTint.js +2 -0
  103. package/dist/render/shaders/flat/index.d.ts +16 -0
  104. package/dist/render/shaders/flat/index.js +33 -5
  105. package/dist/render/shaders/flat/main.d.ts +1 -1
  106. package/dist/render/shaders/flat/main.js +43 -5
  107. package/dist/render/shaders/flat/models.js +1 -1
  108. package/dist/render/shaders/flat/overlay.d.ts +16 -0
  109. package/dist/render/shaders/flat/overlay.js +117 -0
  110. package/dist/render/shaders/flat/pointShadow.js +3 -3
  111. package/dist/render/shaders/flat/preamble.js +38 -24
  112. package/dist/render/shaders/flat/reflectionSurface.d.ts +21 -0
  113. package/dist/render/shaders/flat/reflectionSurface.js +61 -0
  114. package/dist/render/shaders/fog.d.ts +1 -1
  115. package/dist/render/shaders/fog.js +9 -2
  116. package/dist/render/shaders/fringe.d.ts +29 -0
  117. package/dist/render/shaders/fringe.js +55 -0
  118. package/dist/render/shaders/generated/arcane.wgsl.d.ts +1 -1
  119. package/dist/render/shaders/generated/arcane.wgsl.js +1 -1
  120. package/dist/render/shaders/generated/bolt.wgsl.d.ts +1 -1
  121. package/dist/render/shaders/generated/bolt.wgsl.js +1 -1
  122. package/dist/render/shaders/generated/caustics.wgsl.d.ts +1 -1
  123. package/dist/render/shaders/generated/caustics.wgsl.js +1 -1
  124. package/dist/render/shaders/generated/depth.wgsl.d.ts +93 -0
  125. package/dist/render/shaders/generated/depth.wgsl.js +93 -0
  126. package/dist/render/shaders/generated/film.wgsl.d.ts +1 -1
  127. package/dist/render/shaders/generated/film.wgsl.js +1 -1
  128. package/dist/render/shaders/generated/fire.wgsl.d.ts +1 -1
  129. package/dist/render/shaders/generated/fire.wgsl.js +1 -1
  130. package/dist/render/shaders/generated/flat.wgsl.d.ts +3254 -2920
  131. package/dist/render/shaders/generated/flat.wgsl.js +3292 -2957
  132. package/dist/render/shaders/generated/line.wgsl.d.ts +1 -1
  133. package/dist/render/shaders/generated/line.wgsl.js +1 -1
  134. package/dist/render/shaders/generated/particle.wgsl.d.ts +4 -4
  135. package/dist/render/shaders/generated/particle.wgsl.js +4 -4
  136. package/dist/render/shaders/generated/rush.wgsl.d.ts +56 -26
  137. package/dist/render/shaders/generated/rush.wgsl.js +56 -26
  138. package/dist/render/shaders/generated/scatter.wgsl.d.ts +1 -1
  139. package/dist/render/shaders/generated/scatter.wgsl.js +1 -1
  140. package/dist/render/shaders/generated/smoke.wgsl.d.ts +1 -1
  141. package/dist/render/shaders/generated/smoke.wgsl.js +1 -1
  142. package/dist/render/shaders/generated/ssrResolve.wgsl.d.ts +29 -0
  143. package/dist/render/shaders/generated/ssrResolve.wgsl.js +29 -0
  144. package/dist/render/shaders/generated/ssrTrace.wgsl.d.ts +22 -2
  145. package/dist/render/shaders/generated/ssrTrace.wgsl.js +22 -2
  146. package/dist/render/shaders/generated/water.wgsl.d.ts +1 -1
  147. package/dist/render/shaders/generated/water.wgsl.js +1 -1
  148. package/dist/render/shaders/gpudriven/fog.wgsl.d.ts +2 -2
  149. package/dist/render/shaders/gpudriven/fog.wgsl.js +11 -3
  150. package/dist/render/shaders/line.d.ts +1 -1
  151. package/dist/render/shaders/outputTransform.d.ts +7 -0
  152. package/dist/render/shaders/outputTransform.js +28 -14
  153. package/dist/render/shaders/particle.d.ts +3 -3
  154. package/dist/render/shaders/rush.js +54 -11
  155. package/dist/render/shaders/scatter.d.ts +1 -1
  156. package/dist/render/shaders/smoke.d.ts +1 -1
  157. package/dist/render/shaders/ssrResolve.d.ts +17 -0
  158. package/dist/render/shaders/ssrResolve.js +51 -0
  159. package/dist/render/shaders/ssrTrace.js +26 -0
  160. package/dist/render/shaders/vertexChannel.d.ts +7 -0
  161. package/dist/render/shaders/vertexChannel.js +26 -0
  162. package/dist/render/shaders/water.d.ts +1 -1
  163. package/dist/render/ssrPass.d.ts +16 -0
  164. package/dist/render/ssrPass.js +106 -1
  165. package/dist/render/staticDraws.d.ts +47 -0
  166. package/dist/render/staticDraws.js +43 -0
  167. package/dist/render/surfaceOverlay.d.ts +132 -0
  168. package/dist/render/surfaceOverlay.js +85 -0
  169. package/dist/render/surfaceTexture.d.ts +57 -7
  170. package/dist/render/surfaceTexture.js +125 -17
  171. package/dist/render/temporalAa.d.ts +14 -0
  172. package/dist/render/temporalAa.js +20 -0
  173. package/dist/render/vertexDefaults.d.ts +17 -0
  174. package/dist/render/vertexDefaults.js +24 -0
  175. package/package.json +6 -6
  176. package/src/index.ts +24 -2
  177. package/src/render/ambientHarmonics.ts +1 -1
  178. package/src/render/areaLights.ts +4 -4
  179. package/src/render/atmosphere.ts +22 -1
  180. package/src/render/backend/api.ts +22 -3
  181. package/src/render/backend/createRenderer.ts +18 -1
  182. package/src/render/backend/select.ts +10 -5
  183. package/src/render/backend/webgl2/boneAnimations.ts +105 -0
  184. package/src/render/backend/webgl2/instanced.ts +20 -1
  185. package/src/render/backend/webgl2/renderer.ts +672 -37
  186. package/src/render/backend/webgl2/skinPaletteTexture.ts +6 -4
  187. package/src/render/backend/webgpu/boneAnimations.ts +97 -0
  188. package/src/render/backend/webgpu/buffers.ts +42 -16
  189. package/src/render/backend/webgpu/compressedUpload.ts +59 -9
  190. package/src/render/backend/webgpu/depthPass.ts +51 -10
  191. package/src/render/backend/webgpu/device.ts +42 -3
  192. package/src/render/backend/webgpu/drawCommand.ts +22 -4
  193. package/src/render/backend/webgpu/flatPass.ts +250 -40
  194. package/src/render/backend/webgpu/instanced.ts +32 -1
  195. package/src/render/backend/webgpu/materialStore.ts +276 -0
  196. package/src/render/backend/webgpu/pipelineCache.ts +7 -0
  197. package/src/render/backend/webgpu/postPass.ts +18 -0
  198. package/src/render/backend/webgpu/reflectionSurfacePass.ts +114 -0
  199. package/src/render/backend/webgpu/renderer.ts +1655 -230
  200. package/src/render/backend/webgpu/skinPaletteRing.ts +13 -7
  201. package/src/render/backend/webgpu/skinPaletteTexture.ts +7 -1
  202. package/src/render/backend/webgpu/staticBundles.ts +363 -0
  203. package/src/render/backend/webgpu/surfaceTexturePass.ts +29 -3
  204. package/src/render/backend/webgpu/uniformRing.ts +10 -1
  205. package/src/render/bloomChain.ts +3 -3
  206. package/src/render/boneAnimation.ts +223 -0
  207. package/src/render/compressedSource.ts +121 -29
  208. package/src/render/displayRange.ts +61 -0
  209. package/src/render/filmicCurve.ts +229 -0
  210. package/src/render/fog.ts +19 -3
  211. package/src/render/frame/resources.ts +6 -0
  212. package/src/render/frameReflections.ts +72 -0
  213. package/src/render/glCompressed.ts +83 -0
  214. package/src/render/instances.ts +27 -0
  215. package/src/render/lightBudget.ts +11 -0
  216. package/src/render/lightmap.ts +1 -1
  217. package/src/render/mesh.ts +6 -0
  218. package/src/render/pass.ts +53 -1
  219. package/src/render/pointLightSelection.ts +4 -4
  220. package/src/render/reflectionSurfaceTargets.ts +105 -0
  221. package/src/render/renderQuality.ts +44 -8
  222. package/src/render/sceneTarget.ts +30 -2
  223. package/src/render/screenSpaceReflection.ts +7 -1
  224. package/src/render/shaders/boneAnimation.ts +63 -0
  225. package/src/render/shaders/depth.ts +45 -10
  226. package/src/render/shaders/filmLook.ts +2 -1
  227. package/src/render/shaders/flat/glassTint.ts +5 -1
  228. package/src/render/shaders/flat/index.ts +49 -5
  229. package/src/render/shaders/flat/main.ts +43 -5
  230. package/src/render/shaders/flat/models.ts +1 -1
  231. package/src/render/shaders/flat/overlay.ts +117 -0
  232. package/src/render/shaders/flat/pointShadow.ts +3 -3
  233. package/src/render/shaders/flat/preamble.ts +38 -24
  234. package/src/render/shaders/flat/reflectionSurface.ts +61 -0
  235. package/src/render/shaders/fog.ts +9 -2
  236. package/src/render/shaders/fringe.ts +59 -0
  237. package/src/render/shaders/generated/arcane.wgsl.ts +1 -1
  238. package/src/render/shaders/generated/bolt.wgsl.ts +1 -1
  239. package/src/render/shaders/generated/caustics.wgsl.ts +1 -1
  240. package/src/render/shaders/generated/depth.wgsl.ts +95 -0
  241. package/src/render/shaders/generated/film.wgsl.ts +1 -1
  242. package/src/render/shaders/generated/fire.wgsl.ts +1 -1
  243. package/src/render/shaders/generated/flat.wgsl.ts +3292 -2957
  244. package/src/render/shaders/generated/line.wgsl.ts +1 -1
  245. package/src/render/shaders/generated/particle.wgsl.ts +4 -4
  246. package/src/render/shaders/generated/rush.wgsl.ts +56 -26
  247. package/src/render/shaders/generated/scatter.wgsl.ts +1 -1
  248. package/src/render/shaders/generated/smoke.wgsl.ts +1 -1
  249. package/src/render/shaders/generated/ssrResolve.wgsl.ts +30 -0
  250. package/src/render/shaders/generated/ssrTrace.wgsl.ts +22 -2
  251. package/src/render/shaders/generated/water.wgsl.ts +1 -1
  252. package/src/render/shaders/gpudriven/fog.wgsl.ts +11 -3
  253. package/src/render/shaders/outputTransform.ts +30 -14
  254. package/src/render/shaders/rush.ts +54 -11
  255. package/src/render/shaders/ssrResolve.ts +52 -0
  256. package/src/render/shaders/ssrTrace.ts +26 -0
  257. package/src/render/shaders/vertexChannel.ts +27 -0
  258. package/src/render/ssrPass.ts +138 -1
  259. package/src/render/staticDraws.ts +95 -0
  260. package/src/render/surfaceOverlay.ts +195 -0
  261. package/src/render/surfaceTexture.ts +161 -27
  262. package/src/render/temporalAa.ts +20 -0
  263. package/src/render/vertexDefaults.ts +28 -0
@@ -7,7 +7,8 @@ import type { ProbeBakeOptions } from '../reflectionProbe.ts';
7
7
  import type { Renderer, TranslucentMeshOptions } from './webgl2/renderer.ts';
8
8
  import type { InstancedOptions, MeshInstances } from '../instances.ts';
9
9
  import type { SurfaceMaterial } from '../surfaceTexture.ts';
10
- import type { SurfaceSource } from '../compressedSource.ts';
10
+ import type { SurfaceOverlay } from '../surfaceOverlay.ts';
11
+ import type { CompressedTextureSource, SurfaceSource } from '../compressedSource.ts';
11
12
  import type { LightmapPage } from '../lightmap.ts';
12
13
  import type { DeviceParticles } from '../particlePool.ts';
13
14
  import type { ClothBindingData } from '../clothBindingData.ts';
@@ -189,7 +190,7 @@ export interface MeshOptions {
189
190
  }
190
191
  export type RendererApi = Omit<{
191
192
  [K in keyof Renderer]: Renderer[K];
192
- }, 'gpuTimer' | 'createMesh' | 'createMeshIncremental' | 'updateMesh' | 'drawMesh' | 'disposeMesh' | 'drawTranslucentMesh' | 'drawLightVolume' | 'drawFilm' | 'createScatter' | 'drawScatter' | 'uploadScatter' | 'disposeScatter' | 'createInstanced' | 'uploadInstanced' | 'drawInstanced' | 'drawTranslucentInstanced' | 'disposeInstanced' | 'createWater' | 'drawWater' | 'disposeWater' | 'createPlumes' | 'drawPlumes' | 'disposePlumes' | 'setPlumeScale' | 'createCaustics' | 'drawCaustics' | 'disposeCaustics' | 'createParticles' | 'drawParticles' | 'drawDeviceParticles' | 'disposeParticles' | 'createWindStreaks' | 'drawWindStreaks' | 'disposeWindStreaks' | 'createFlock' | 'drawFlock' | 'disposeFlock' | 'createBolts' | 'drawBolts' | 'disposeBolts' | 'createLines' | 'drawLines' | 'disposeLines' | 'createText' | 'setText' | 'setPlate' | 'drawText' | 'textWidth' | 'disposeText' | 'createSdfText' | 'setSdfText' | 'drawSdfText' | 'disposeSdfText' | 'createSurfaceTexture' | 'createSurfaceTextureArray' | 'createLightmap' | 'createSceneCapture' | 'captureScene' | 'updateSurfaceTexture' | 'disposeSurfaceTexture' | 'setSurfaceTexture' | 'setMaterial' | 'createClothBinding' | 'createClothParticles' | 'updateClothParticles' | 'setCloth' | 'disposeClothBinding' | 'disposeClothParticles'> & {
193
+ }, 'gpuTimer' | 'createMesh' | 'createMeshIncremental' | 'updateMesh' | 'drawMesh' | 'disposeMesh' | 'drawTranslucentMesh' | 'drawLightVolume' | 'drawFilm' | 'createScatter' | 'drawScatter' | 'uploadScatter' | 'disposeScatter' | 'createInstanced' | 'uploadInstanced' | 'drawInstanced' | 'drawTranslucentInstanced' | 'disposeInstanced' | 'createWater' | 'drawWater' | 'disposeWater' | 'createPlumes' | 'drawPlumes' | 'disposePlumes' | 'setPlumeScale' | 'createCaustics' | 'drawCaustics' | 'disposeCaustics' | 'createParticles' | 'drawParticles' | 'drawDeviceParticles' | 'disposeParticles' | 'createWindStreaks' | 'drawWindStreaks' | 'disposeWindStreaks' | 'createFlock' | 'drawFlock' | 'disposeFlock' | 'createBolts' | 'drawBolts' | 'disposeBolts' | 'createLines' | 'drawLines' | 'disposeLines' | 'createText' | 'setText' | 'setPlate' | 'drawText' | 'textWidth' | 'disposeText' | 'createSdfText' | 'setSdfText' | 'drawSdfText' | 'disposeSdfText' | 'createSurfaceTexture' | 'createSurfaceTextureArray' | 'createLightmap' | 'createSceneCapture' | 'captureScene' | 'updateSurfaceTexture' | 'disposeSurfaceTexture' | 'setSurfaceTexture' | 'setMaterial' | 'setSurfaceOverlay' | 'createClothBinding' | 'createClothParticles' | 'updateClothParticles' | 'setCloth' | 'disposeClothBinding' | 'disposeClothParticles'> & {
193
194
  /**
194
195
  * A mesh's cloth binding: which simulation triangle each of its vertices follows, where on it and
195
196
  * by how much (`ClothBindingData`). The mesh must be skinned — a binding blends each vertex
@@ -213,6 +214,13 @@ export type RendererApi = Omit<{
213
214
  setCloth(binding: ClothBindingHandle | null, particles?: ClothParticlesHandle | null): void;
214
215
  disposeClothBinding(binding: ClothBindingHandle): void;
215
216
  disposeClothParticles(particles: ClothParticlesHandle): void;
217
+ /**
218
+ * What the following draws lay over their surfaces beyond their materials — a rim of light, a
219
+ * dissolve with a glowing edge, wrinkle normals by region — or null for none, which every pass
220
+ * starts with. Per draw, so one character's whole set of materials changes together. Its images
221
+ * are regions of one atlas (`SurfaceOverlay.maps`). See `surfaceOverlay.ts`.
222
+ */
223
+ setSurfaceOverlay(overlay: SurfaceOverlay | null): void;
216
224
  /**
217
225
  * Upload a caller's image, or a BC image's blocks with their stored chain where
218
226
  * `compressedFormats` has the format. See `SurfaceTextureHandle` for the boundary this guards.
@@ -262,12 +270,19 @@ export type RendererApi = Omit<{
262
270
  */
263
271
  captureScene(capture: SurfaceTextureHandle, camera: Camera, clearColor: Vec3, draw: (camera: Camera) => void): boolean;
264
272
  /**
265
- * Replace a texture's pixels, keeping the GPU object and its sampler state.
273
+ * Replace a texture's pixels, keeping the handle and its sampler state.
266
274
  *
267
275
  * The binding a draw loop already holds stays valid, so the swap is a swap rather than a
268
276
  * rebuild. Not a hot path: it re-uploads the whole image and rebuilds the mip chain.
277
+ *
278
+ * **Blocks may replace an image**, at the format's own size and with the chain they carry: the
279
+ * same picture at a fraction of the memory, which is how a loader that first showed a decoded
280
+ * image hands the device the blocks it encoded afterwards. Read in the colour space the texture
281
+ * was made with, and refused as `createSurfaceTexture` refuses them where the device does not take
282
+ * that format (`compressedFormats`). **The way back is refused**: a texture holding blocks takes
283
+ * no image, since nothing could say what its chain should become.
269
284
  */
270
- updateSurfaceTexture(texture: SurfaceTextureHandle, source: TexImageSource): void;
285
+ updateSurfaceTexture(texture: SurfaceTextureHandle, source: TexImageSource | CompressedTextureSource): void;
271
286
  disposeSurfaceTexture(texture: SurfaceTextureHandle): void;
272
287
  /**
273
288
  * Choose the texture the following `drawMesh` calls sample, or null for none.
@@ -132,6 +132,12 @@ export interface CreateRendererOptions {
132
132
  * badge is looked at on a deployed build.
133
133
  */
134
134
  readonly splash?: boolean | SplashOptions;
135
+ /**
136
+ * Whether the display shows a high dynamic range, asked only where `highDynamicRange` was. The
137
+ * browser's `(dynamic-range: high)` query by default; a host with no DOM, or one that knows
138
+ * better about its own display, answers instead. See `displayRange.ts`.
139
+ */
140
+ readonly highDynamicRangeDisplay?: () => boolean;
135
141
  }
136
142
  /** What was built, and which path built it. */
137
143
  export interface CreatedRenderer {
@@ -4,6 +4,7 @@ import { BACKEND_TIMEOUT_MS, forcedBackend, selectBackend } from './select.js';
4
4
  import { TIMED_OUT, withDeadline } from './deadline.js';
5
5
  import { mountSplash } from '../../ui/splash.js';
6
6
  import { gpuDrivenRefusal, gpuDrivenSupported } from '../gpudriven/pipeline.js';
7
+ import { browserHighDynamicRange, chooseDisplayRange } from '../displayRange.js';
7
8
  /**
8
9
  * What a caller who says nothing gets.
9
10
  *
@@ -177,7 +178,9 @@ export async function createRenderer(canvas, quality = {}, options = {}) {
177
178
  const { createGpuSurface } = await import('./webgpu/device.js');
178
179
  const { WebGPURenderer } = await import('./webgpu/renderer.js');
179
180
  stage = 'creating the surface';
180
- const surface = createGpuSurface(canvas, device);
181
+ const profile = resolveRenderQuality(qualityFor('webgpu'));
182
+ const surface = createGpuSurface(canvas, device, chooseDisplayRange(profile.highDynamicRange, profile.screenEffects && profile.hdrScene, profile.highDynamicRange &&
183
+ (options.highDynamicRangeDisplay ?? browserHighDynamicRange)()));
181
184
  stage = 'constructing the renderer';
182
185
  return { surface, WebGPURenderer };
183
186
  })();
@@ -207,12 +207,18 @@ async function acquireWebGpu(gpu, wantsGpuTiming, shaders, stage) {
207
207
  features.push('timestamp-query');
208
208
  }
209
209
  /*
210
- * BC compressed textures, on the same terms: asked for wherever the adapter offers it, because
211
- * a device without it still draws — the loader decodes for it — and one with it samples a BC7
212
- * texture at a byte a texel instead of four. See `compressedUpload.ts`.
210
+ * The three block families, on the same terms: each asked for wherever the adapter offers it,
211
+ * because a device without one still draws — the loader decodes, or encodes ETC2, for it — and
212
+ * one with it samples a texture at a byte a texel or half of one instead of four. Desktops
213
+ * offer BC; phones ETC2 and ASTC. See `compressedUpload.ts`.
213
214
  */
214
- if (adapter.features?.has('texture-compression-bc') === true) {
215
- features.push('texture-compression-bc');
215
+ for (const family of [
216
+ 'texture-compression-bc',
217
+ 'texture-compression-etc2',
218
+ 'texture-compression-astc',
219
+ ]) {
220
+ if (adapter.features?.has(family) === true)
221
+ features.push(family);
216
222
  }
217
223
  const descriptor = {};
218
224
  if (Object.keys(required).length > 0)
@@ -0,0 +1,29 @@
1
+ /**
2
+ * A bone animation's textures on this backend, and a batch's clocks: what
3
+ * `shaders/boneAnimation.ts` reads with `texelFetch`, made once and never filtered. The twin of
4
+ * `webgpu/boneAnimations.ts`, at the same formats for the same reason: a turn in half floats jitters
5
+ * a crowd's hands at the frame's rate.
6
+ */
7
+ import { type BoneAnimationHandle, type BoneAnimationTexels } from '../../boneAnimation.ts';
8
+ /** A clip on the device, from `createBoneAnimation`. */
9
+ export declare class GlBoneAnimation implements BoneAnimationHandle {
10
+ readonly bones: number;
11
+ readonly frames: number;
12
+ readonly framesPerSecond: number;
13
+ readonly boneScale: number;
14
+ readonly places: WebGLTexture;
15
+ readonly turns: WebGLTexture;
16
+ disposed: boolean;
17
+ constructor(gl: WebGL2RenderingContext, texels: BoneAnimationTexels);
18
+ dispose(gl: WebGL2RenderingContext): void;
19
+ }
20
+ /** A batch's clocks: two floats an instance, wrapped onto rows `CLOCK_TEXTURE_WIDTH` wide. */
21
+ export declare class GlInstanceClocks {
22
+ readonly texture: WebGLTexture;
23
+ readonly staging: Float32Array;
24
+ private readonly width;
25
+ constructor(gl: WebGL2RenderingContext, capacity: number);
26
+ /** The rows that hold the first `count` instances, from `staging`. */
27
+ upload(gl: WebGL2RenderingContext, count: number): void;
28
+ dispose(gl: WebGL2RenderingContext): void;
29
+ }
@@ -0,0 +1,80 @@
1
+ /**
2
+ * A bone animation's textures on this backend, and a batch's clocks: what
3
+ * `shaders/boneAnimation.ts` reads with `texelFetch`, made once and never filtered. The twin of
4
+ * `webgpu/boneAnimations.ts`, at the same formats for the same reason: a turn in half floats jitters
5
+ * a crowd's hands at the frame's rate.
6
+ */
7
+ import { CLOCK_TEXTURE_WIDTH, } from '../../boneAnimation.js';
8
+ /**
9
+ * A float texture read by index: one level, nearest, clamped. Bound on unit 0, chosen rather than
10
+ * inherited, for the reason `oitPass.ts` gives: `bindTexture` binds to whatever unit is active, and
11
+ * a frame leaves that wherever its last pass finished.
12
+ */
13
+ function floatTexture(gl, internal, width, height) {
14
+ const texture = gl.createTexture();
15
+ if (texture === null)
16
+ throw new Error('boneAnimations: createTexture failed');
17
+ gl.activeTexture(gl.TEXTURE0);
18
+ gl.bindTexture(gl.TEXTURE_2D, texture);
19
+ gl.texStorage2D(gl.TEXTURE_2D, 1, internal, width, height);
20
+ gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.NEAREST);
21
+ gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.NEAREST);
22
+ gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);
23
+ gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);
24
+ return texture;
25
+ }
26
+ /** A clip on the device, from `createBoneAnimation`. */
27
+ export class GlBoneAnimation {
28
+ bones;
29
+ frames;
30
+ framesPerSecond;
31
+ boneScale;
32
+ places;
33
+ turns;
34
+ disposed = false;
35
+ constructor(gl, texels) {
36
+ this.bones = texels.bones;
37
+ this.frames = texels.frames;
38
+ this.framesPerSecond = texels.framesPerSecond;
39
+ this.boneScale = texels.boneScale;
40
+ const make = (data) => {
41
+ const texture = floatTexture(gl, gl.RGBA32F, texels.bones, texels.frames);
42
+ gl.texSubImage2D(gl.TEXTURE_2D, 0, 0, 0, texels.bones, texels.frames, gl.RGBA, gl.FLOAT, data);
43
+ return texture;
44
+ };
45
+ this.places = make(texels.places);
46
+ this.turns = make(texels.turns);
47
+ gl.bindTexture(gl.TEXTURE_2D, null);
48
+ }
49
+ dispose(gl) {
50
+ this.disposed = true;
51
+ gl.deleteTexture(this.places);
52
+ gl.deleteTexture(this.turns);
53
+ }
54
+ }
55
+ /** A batch's clocks: two floats an instance, wrapped onto rows `CLOCK_TEXTURE_WIDTH` wide. */
56
+ export class GlInstanceClocks {
57
+ texture;
58
+ staging;
59
+ width;
60
+ constructor(gl, capacity) {
61
+ this.width = Math.max(1, Math.min(capacity, CLOCK_TEXTURE_WIDTH));
62
+ const rows = Math.max(1, Math.ceil(capacity / this.width));
63
+ this.staging = new Float32Array(this.width * rows * 2);
64
+ this.texture = floatTexture(gl, gl.RG32F, this.width, rows);
65
+ gl.bindTexture(gl.TEXTURE_2D, null);
66
+ }
67
+ /** The rows that hold the first `count` instances, from `staging`. */
68
+ upload(gl, count) {
69
+ if (count <= 0)
70
+ return;
71
+ const rows = Math.ceil(count / this.width);
72
+ gl.activeTexture(gl.TEXTURE0);
73
+ gl.bindTexture(gl.TEXTURE_2D, this.texture);
74
+ gl.texSubImage2D(gl.TEXTURE_2D, 0, 0, 0, this.width, rows, gl.RG, gl.FLOAT, this.staging);
75
+ gl.bindTexture(gl.TEXTURE_2D, null);
76
+ }
77
+ dispose(gl) {
78
+ gl.deleteTexture(this.texture);
79
+ }
80
+ }
@@ -1,6 +1,7 @@
1
1
  import type { MeshInstances } from '../../instances.ts';
2
2
  import type { Mesh } from '../../mesh.ts';
3
3
  import type { FrustumPlanes } from '../../../math/frustum.ts';
4
+ import { GlInstanceClocks, type GlBoneAnimation } from './boneAnimations.ts';
4
5
  /**
5
6
  * One batch of a mesh: its per-instance buffer and a vertex array of its own.
6
7
  *
@@ -29,7 +30,10 @@ export declare class InstancedBatch {
29
30
  /** The survivors of a lightmapped batch's cull, made the first time one is culled. */
30
31
  private keptRegioned;
31
32
  private readonly kept;
32
- constructor(gl: WebGL2RenderingContext, mesh: Mesh, capacity: number, cull?: boolean);
33
+ /** The bone animation every instance plays, and its clocks; null for a batch that plays none. */
34
+ readonly animation: GlBoneAnimation | null;
35
+ readonly clocks: GlInstanceClocks | null;
36
+ constructor(gl: WebGL2RenderingContext, mesh: Mesh, capacity: number, cull?: boolean, animation?: GlBoneAnimation | null);
33
37
  upload(gl: WebGL2RenderingContext, data: MeshInstances): void;
34
38
  /** Draw the first `count` uploaded instances: every draw but a culling camera draw. */
35
39
  draw(gl: WebGL2RenderingContext, count: number): void;
@@ -1,5 +1,7 @@
1
1
  import { cullInstances, instancesBox } from '../../instanceCull.js';
2
2
  import { INSTANCE_FLOATS, INSTANCE_STRIDE, createMeshInstances, packInstances, } from '../../instances.js';
3
+ import { packInstanceClocks } from '../../boneAnimation.js';
4
+ import { GlInstanceClocks } from './boneAnimations.js';
3
5
  /**
4
6
  * One batch of a mesh: its per-instance buffer and a vertex array of its own.
5
7
  *
@@ -28,10 +30,15 @@ export class InstancedBatch {
28
30
  /** The survivors of a lightmapped batch's cull, made the first time one is culled. */
29
31
  keptRegioned = null;
30
32
  kept;
31
- constructor(gl, mesh, capacity, cull = false) {
33
+ /** The bone animation every instance plays, and its clocks; null for a batch that plays none. */
34
+ animation;
35
+ clocks;
36
+ constructor(gl, mesh, capacity, cull = false, animation = null) {
32
37
  this.mesh = mesh;
33
38
  this.capacity = capacity;
34
39
  this.cull = cull;
40
+ this.animation = animation;
41
+ this.clocks = animation === null ? null : new GlInstanceClocks(gl, capacity);
35
42
  this.staging = new Float32Array(capacity * INSTANCE_FLOATS);
36
43
  this.buffer = allocate(gl, capacity);
37
44
  this.vao = mesh.createInstanceArray(gl, this.buffer, INSTANCE_STRIDE);
@@ -56,6 +63,10 @@ export class InstancedBatch {
56
63
  packInstances(data, this.staging);
57
64
  gl.bindBuffer(gl.ARRAY_BUFFER, this.buffer);
58
65
  gl.bufferSubData(gl.ARRAY_BUFFER, 0, this.staging, 0, count * INSTANCE_FLOATS);
66
+ if (this.clocks !== null) {
67
+ packInstanceClocks(data, this.clocks.staging);
68
+ this.clocks.upload(gl, count);
69
+ }
59
70
  }
60
71
  /** Draw the first `count` uploaded instances: every draw but a culling camera draw. */
61
72
  draw(gl, count) {
@@ -88,6 +99,7 @@ export class InstancedBatch {
88
99
  dispose(gl) {
89
100
  gl.deleteVertexArray(this.vao);
90
101
  gl.deleteBuffer(this.buffer);
102
+ this.clocks?.dispose(gl);
91
103
  if (this.kept !== null) {
92
104
  gl.deleteVertexArray(this.kept.vao);
93
105
  gl.deleteBuffer(this.kept.buffer);
@@ -12,6 +12,7 @@ import type { ComputeDefinition, ComputeHandle } from '../../compute.ts';
12
12
  import type { PassDefinition, PassHandle } from '../../pass.ts';
13
13
  import type { Vec3 } from '../../../math/color.ts';
14
14
  import { GpuTimer } from '../../gpuTimer.ts';
15
+ import { type SurfaceOverlay } from '../../surfaceOverlay.ts';
15
16
  import type { ColourGradeLut } from '../../colourGrade.ts';
16
17
  import { type BloomResponse } from '../../bloomChain.ts';
17
18
  import { LightField } from '../../driftLight/lightField.ts';
@@ -43,13 +44,14 @@ import type { AreaLightBuffer, AreaLightSource } from '../../areaLights.ts';
43
44
  import type { PhotometricProfile } from '../../iesProfile.ts';
44
45
  import type { ShadowLight } from '../../pointShadowSystem.ts';
45
46
  import type { ShadowCasters } from '../../shadowCasters.ts';
47
+ import type { StaticDrawsHandle } from '../../staticDraws.ts';
46
48
  import type { RenderQuality, RenderQualityOptions } from '../../renderQuality.ts';
47
49
  import { Mesh } from '../../mesh.ts';
48
50
  import type { IncrementalMesh } from '../../mesh.ts';
49
51
  import type { MeshData } from '../../mesh.ts';
50
52
  import type { MeshOptions } from '../api.ts';
51
53
  import { SurfaceTexture } from '../../surfaceTexture.ts';
52
- import type { CompressedTextureFormat, SurfaceSource } from '../../compressedSource.ts';
54
+ import type { CompressedTextureFormat, CompressedTextureSource, SurfaceSource } from '../../compressedSource.ts';
53
55
  import type { SurfaceMaterial, SurfaceTextureOptions } from '../../surfaceTexture.ts';
54
56
  import { PlumeRenderer } from '../../plumeRenderer.ts';
55
57
  import type { PlumeOptions, PlumePlacement } from '../../plumeRenderer.ts';
@@ -72,6 +74,8 @@ import { TextRenderer } from '../../textRenderer.ts';
72
74
  import { SdfTextRenderer } from '../../sdfTextRenderer.ts';
73
75
  import type { SdfFont } from '../../sdfFont.ts';
74
76
  import type { SdfTextStyle } from '../../sdfTextLayout.ts';
77
+ import type { DisplayRange } from '../../displayRange.ts';
78
+ import { type FilmicCurve } from '../../filmicCurve.ts';
75
79
  import type { RenderBackend } from '../api.ts';
76
80
  import type { TextStyle } from '../../textLayout.ts';
77
81
  import { WindStreakRenderer } from '../../windStreakRenderer.ts';
@@ -79,6 +83,7 @@ import type { WindStreakOptions } from '../../windStreakRenderer.ts';
79
83
  import type { WindField } from '../../windField.ts';
80
84
  import type { FlockParams } from '../../flockRenderer.ts';
81
85
  import { InstancedBatch } from './instanced.ts';
86
+ import type { BoneAnimationClip, BoneAnimationHandle } from '../../boneAnimation.ts';
82
87
  import type { InstancedOptions, MeshInstances } from '../../instances.ts';
83
88
  /** Reused each frame: which shader light slot each bound cubemap serves. */
84
89
  export type { ShadowCasterSink, ShadowCasters } from '../../shadowCasters.ts';
@@ -974,6 +979,10 @@ export declare class WebGL2Renderer implements RendererApi {
974
979
  private readonly reflectionQueue;
975
980
  /** Built on the first frame that submits a surface, and never for a scene with none. */
976
981
  private ssr;
982
+ /** The frame's materials' reflections, resolved; null where off. See `frameReflections.ts`. */
983
+ private readonly frameReflections;
984
+ /** Their two maps on the scene's framebuffer, null where they cannot be drawn. */
985
+ private readonly reflectionTargets;
977
986
  /** Said once where a reflection cannot be traced at all. */
978
987
  private reflectionsRefused;
979
988
  /** Where the frame's camera stands, which is what gives a reconstructed normal its sign. */
@@ -1033,6 +1042,8 @@ export declare class WebGL2Renderer implements RendererApi {
1033
1042
  * exactly as it asked to be and nothing about it changes.
1034
1043
  */
1035
1044
  private exposure;
1045
+ /** The `filmic` curve's eight constants, held until `setFilmicCurve` is called again. */
1046
+ private readonly filmConstants;
1036
1047
  /**
1037
1048
  * This frame's veil colour, and how much of it to composite. See `setFrameVeil`.
1038
1049
  *
@@ -1147,6 +1158,11 @@ export declare class WebGL2Renderer implements RendererApi {
1147
1158
  private readonly depthCutoutUniforms;
1148
1159
  private readonly depthInstancedCutoutProgram;
1149
1160
  private readonly depthInstancedCutoutUniforms;
1161
+ /** A crowd's casters: the instanced depth programs that play a bone animation. */
1162
+ private readonly depthAnimatedProgram;
1163
+ private readonly depthAnimatedUniforms;
1164
+ private readonly depthAnimatedCutoutProgram;
1165
+ private readonly depthAnimatedCutoutUniforms;
1150
1166
  private readonly scatterDepthProgram;
1151
1167
  private readonly scatterDepthUniforms;
1152
1168
  /** The sun's static, moving and peeled maps, as layers of one array. See `shadowMap.ts`. */
@@ -1234,6 +1250,15 @@ export declare class WebGL2Renderer implements RendererApi {
1234
1250
  private warnedNoPointShadowArray;
1235
1251
  /** Said once, for the retired ambient dial. */
1236
1252
  private warnedEnvironmentAmbient;
1253
+ /** The overlay the draws wear, `uOverlay`: see `setSurfaceOverlay`. */
1254
+ private readonly overlayFloats;
1255
+ /** Its atlas, and the 2D copy of it bound where the refraction copy goes. */
1256
+ private overlayMaps;
1257
+ private overlayTexture;
1258
+ /** Whether this device's lit stage has room for the overlay's vectors: asked once. */
1259
+ private overlayRoom;
1260
+ private warnedOverlayRoom;
1261
+ private warnedOverlayBlocks;
1237
1262
  /** Whether a probe is being baked, so the passes that would recurse into one can tell. */
1238
1263
  private probePassActive;
1239
1264
  /**
@@ -1558,6 +1583,8 @@ export declare class WebGL2Renderer implements RendererApi {
1558
1583
  * call. `init` runs now rather than at the first frame, because building a pipeline in the
1559
1584
  * frame loop is the allocation the house rules are about.
1560
1585
  */
1586
+ /** Each registered pass's declared reads, as a mask, resolved once at registration. */
1587
+ private readonly passReads;
1561
1588
  registerPass(definition: PassDefinition): PassHandle;
1562
1589
  /**
1563
1590
  * How many registered passes declare `prepare`, so a frame with none walks nothing.
@@ -1874,7 +1901,7 @@ export declare class WebGL2Renderer implements RendererApi {
1874
1901
  *
1875
1902
  * Not a hot path — it re-uploads the whole image and regenerates the mip chain.
1876
1903
  */
1877
- updateSurfaceTexture(texture: SurfaceTexture, source: TexImageSource): void;
1904
+ updateSurfaceTexture(texture: SurfaceTexture, source: TexImageSource | CompressedTextureSource): void;
1878
1905
  disposeSurfaceTexture(texture: SurfaceTexture): void;
1879
1906
  /**
1880
1907
  * Choose the surface texture the following `drawMesh` calls sample, or `null` for none.
@@ -2015,6 +2042,37 @@ export declare class WebGL2Renderer implements RendererApi {
2015
2042
  * exactly as it did.
2016
2043
  */
2017
2044
  setSurfaceReflectivity(amount: number): void;
2045
+ /**
2046
+ * The reflectivity and environment gain the setters gave the pass, and the ones the material
2047
+ * set now states, or null where it states none (`SurfaceMaterial.reflectivity`). A draw wears the
2048
+ * material's where it has one and the pass's otherwise.
2049
+ */
2050
+ private passReflectivity;
2051
+ private passEnvironmentGain;
2052
+ private materialReflectivity;
2053
+ private materialEnvironmentGain;
2054
+ private writeEnvironmentDials;
2055
+ /**
2056
+ * The overlay the following draws wear — a rim of light, a dissolve, wrinkles by region — or null
2057
+ * for none. Pass state, as the material is: `bindMeshPass` puts it back to none. See
2058
+ * `surfaceOverlay.ts` for what it lays and `shaders/flat/overlay.ts` for how.
2059
+ *
2060
+ * **Refused, said once, where the lit stage has no room for it.** Fifteen vectors more than the
2061
+ * program this device fits: counted from the source as `fitFlatProgram` counts, and on a device
2062
+ * whose limit is the 256 an Adreno 740 reports, the eight-light build at 254 has none. The draws
2063
+ * then wear nothing, which is the picture a game without the feature draws. Its atlas is bound as
2064
+ * a 2D copy of its first layer, in the refraction copy's unit (`SurfaceTexture.flatLayer`); a
2065
+ * compressed atlas has no copy and is read as none, also said once.
2066
+ */
2067
+ setSurfaceOverlay(overlay: SurfaceOverlay | null): void;
2068
+ /** The overlay's atlas into the refraction copy's unit, as a 2D copy, or the empty texture. */
2069
+ private bindOverlayMaps;
2070
+ /** The most fragment uniform vectors this GPU offers a stage. */
2071
+ private fragmentVectorLimit;
2072
+ /** What the lit shader at this renderer's budget leaves of the limit, with no overlay. */
2073
+ private overlayRoomLeft;
2074
+ /** Whether the lit shader with the overlay compiled in fits this GPU: counted once. */
2075
+ private overlayFits;
2018
2076
  /**
2019
2077
  * How bright the environment the surfaces drawn next reflect is. 1 is the default and identity.
2020
2078
  *
@@ -2190,6 +2248,40 @@ export declare class WebGL2Renderer implements RendererApi {
2190
2248
  * one. `Mesh.attachInstances` is what refuses a second, and says why.
2191
2249
  */
2192
2250
  createInstanced(mesh: Mesh, capacity: number, options?: InstancedOptions): InstancedBatch;
2251
+ /**
2252
+ * A bone animation an instanced batch can play (`InstancedOptions.animation`): per frame, a turn
2253
+ * and a place for each bone, which every vertex of the batch's mesh follows — the bone its second
2254
+ * coordinates' u names, times `boneScale` — at each instance's own moment of the clip. What a
2255
+ * crowd is made of: every instance moves at the frame's rate on its own clock, in the colour pass
2256
+ * and in every shadow, with nothing on the processor after this. See `boneAnimation.ts` for the
2257
+ * clip's layout and the arithmetic, which both backends run.
2258
+ *
2259
+ * What it gives up against skinning is the blend: a vertex follows one bone. Refused, with what
2260
+ * was wrong, for a clip whose numbers are not its size, or past 2,048 bones or frames.
2261
+ */
2262
+ createBoneAnimation(clip: BoneAnimationClip): BoneAnimationHandle;
2263
+ /** Release a clip. A batch still playing it draws nothing, and casts nothing, after. */
2264
+ disposeBoneAnimation(animation: BoneAnimationHandle): void;
2265
+ /**
2266
+ * The clock a bone animation plays by this frame, in seconds on the caller's clock: an instance's
2267
+ * moment is this times its rate plus its phase (`MeshInstances.clocks`). **Set it before the
2268
+ * shadows are drawn**, once a frame, as the wind is set: a shadow drawn under one clock and its
2269
+ * caster under another come apart at the frame's rate. 0 until set, which holds every crowd at
2270
+ * the moment its phases name.
2271
+ */
2272
+ setAnimationTime(seconds: number): void;
2273
+ /** The clock `setAnimationTime` set. */
2274
+ private animationTime;
2275
+ /**
2276
+ * An animated batch's clip, clocks and numbers into whichever program is bound: the three vertex
2277
+ * textures on units of their own (`lightBudget.ts`), the clip's speed and bone scale, the clock.
2278
+ */
2279
+ private bindAnimation;
2280
+ /** The animated instanced program, compiled on first use. See `ensureInstancedProgram`. */
2281
+ private flatAnimatedProgram;
2282
+ private flatAnimatedUniforms;
2283
+ /** Compile the animated variant, once, and feed it this frame's pass state. */
2284
+ private ensureAnimatedProgram;
2193
2285
  /** Push placement and colour. Only the live prefix. */
2194
2286
  uploadInstanced(batch: InstancedBatch, data: MeshInstances): void;
2195
2287
  /** Draw every live instance, opaque. */
@@ -2724,6 +2816,43 @@ export declare class WebGL2Renderer implements RendererApi {
2724
2816
  */
2725
2817
  drawSceneCasters(casters: ShadowCasters): void;
2726
2818
  drawShadowCasters(casters: ShadowCasters): void;
2819
+ /**
2820
+ * Draws that do not change between frames, enumerated once and kept: what a stage, a set or any
2821
+ * world that stands still draws, recorded so a frame replays it rather than issuing it.
2822
+ *
2823
+ * **The same enumeration `drawSceneCasters` takes**, called once, here: rigid meshes and instanced
2824
+ * batches, each with its material. A skinned mesh or a scatter batch is refused by name, since
2825
+ * both change every frame. What it captures is what the enumeration said at the time — the
2826
+ * matrices and the instance counts are copied, so a caller's scratch is free to move on — while
2827
+ * the meshes, batches, textures and materials stay the caller's: a list must be disposed, or made
2828
+ * again, before anything it holds is, and made again when a material it holds is changed.
2829
+ *
2830
+ * **What it is for is the frame's processor time.** WebGPU records the list into a render bundle
2831
+ * per view and replays it with one call, where a draw issued a frame at a time costs its encoding
2832
+ * every frame and again for every view that draws it. This backend has no bundles and replays the
2833
+ * entries through the scene-caster path every frame, at the cost a frame drawing them itself pays;
2834
+ * the picture is the same.
2835
+ *
2836
+ * What a list gives up against drawing each frame is culling: every entry is drawn in every view,
2837
+ * because a bundle cannot leave one out. A world split into lists by region culls by list.
2838
+ */
2839
+ createStaticDraws(casters: ShadowCasters): StaticDrawsHandle;
2840
+ /**
2841
+ * Draw a list into the open mesh pass, under the camera, the lights and the fog `bindMeshPass`
2842
+ * set — the frame's, a mirror's, a capture's. Opaque draws, through each entry's material.
2843
+ *
2844
+ * **Its draws are rigid and wear no overlay**, so a skin palette, morph weights, cloth or a surface
2845
+ * overlay set before it is put back to none, as `bindMeshPass` puts an overlay back; and no
2846
+ * material is left set after it, which is what `setMaterial(null)` leaves. The state a pass set —
2847
+ * the grain, the relief, the fog, the grade — is the list's to draw with, as it is any draw's, and
2848
+ * a list drawn under a different one is recorded again for it on WebGPU.
2849
+ */
2850
+ drawStaticDraws(draws: StaticDrawsHandle): void;
2851
+ /** Release a list. Its meshes, batches and materials are the caller's and are not released. */
2852
+ disposeStaticDraws(draws: StaticDrawsHandle): void;
2853
+ /** A disposed list drawn, said once: the frame loop does not throw. */
2854
+ private warnStaticDisposed;
2855
+ private warnedStaticDisposed;
2727
2856
  /**
2728
2857
  * Draw the pass's glass twice: where the nearest pane is, and what the panes let through.
2729
2858
  *
@@ -3015,8 +3144,17 @@ export declare class WebGL2Renderer implements RendererApi {
3015
3144
  * Set before `beginFrame` and held until changed, like `setSpeedRush`, which it sits
3016
3145
  * beside for the same reason: both describe how the finished image is presented rather
3017
3146
  * than anything in the world.
3147
+ *
3148
+ * `maxShare` is the longest smear, as a share of the frame (0.03 unless given, at most half): a
3149
+ * fast turn softens the frame rather than erasing it. **Each drawn object's own motion is
3150
+ * followed only under a reconstruction on WebGPU**, which draws the motion target it reads; here,
3151
+ * and on WebGPU without one, the camera's motion alone smears the frame, and a draw that names
3152
+ * where it was last frame is told so once.
3018
3153
  */
3019
- setCameraMotionBlur(scale: number): void;
3154
+ setCameraMotionBlur(scale: number, maxShare?: number): void;
3155
+ /** The longest smear, as a share of the frame. See `setCameraMotionBlur`. */
3156
+ private motionBlurMax;
3157
+ private warnedObjectBlur;
3020
3158
  /**
3021
3159
  * The camera has cut: this frame is a new shot, not the next moment of the last one.
3022
3160
  *
@@ -3178,6 +3316,30 @@ export declare class WebGL2Renderer implements RendererApi {
3178
3316
  * black frame with a sign error in it.
3179
3317
  */
3180
3318
  setOutputExposure(exposure: number): void;
3319
+ /**
3320
+ * The `filmic` curve this and every later frame is graded through, until it is set again: a
3321
+ * grading volume's five numbers, solved once here into the constants the resolve reads. Ignored
3322
+ * unless `outputTransform` is `filmic`. A number out of range is clamped into it and said once,
3323
+ * since a frame loop must not throw. See `filmicCurve.ts`.
3324
+ */
3325
+ setFilmicCurve(curve: FilmicCurve): void;
3326
+ private warnedFilmClamped;
3327
+ /**
3328
+ * The range the frame goes out in: `'high'` where the profile asked for `highDynamicRange`, the
3329
+ * frame holds light past white and the display shows it — on WebGPU — and `'standard'` otherwise.
3330
+ * **Always standard here**: this backend draws into a canvas of eight bits a channel, which has
3331
+ * nothing above white to show. Typed as the question rather than this backend's answer, because
3332
+ * the shared surface is derived from this class.
3333
+ */
3334
+ readonly displayRange: DisplayRange;
3335
+ /** Why it is that range, in words, for a game choosing its look and for a bug report. */
3336
+ get displayRangeReason(): string;
3337
+ /**
3338
+ * How bright paper white and the display's peak are, in one unit, held until changed: their
3339
+ * ratio is how far above white the highlights may run where `displayRange` is `'high'`, and
3340
+ * nothing changes where it is standard, which is always here.
3341
+ */
3342
+ setDisplayLuminance(paperWhite: number, peak: number): void;
3181
3343
  /**
3182
3344
  * Composite a flat colour over the finished frame — for a cut dipping to white or to black.
3183
3345
  *
@@ -3242,6 +3404,14 @@ export declare class WebGL2Renderer implements RendererApi {
3242
3404
  * see `filmLook.ts`. Needs `screenEffects`, and says so once rather than doing nothing.
3243
3405
  */
3244
3406
  setVignette(strength: number): void;
3407
+ /**
3408
+ * The lens's colour fringe, held until changed: `intensity` is a percentage, 0 is none, and red
3409
+ * and green are pulled toward the centre by their wavelength's distance from blue, growing from
3410
+ * `start` — a share of the half-frame, 0 the centre — to the whole of it at the edge. Applied to
3411
+ * scene light at the composite's first read. Needs `screenEffects`, and says so once rather than
3412
+ * doing nothing. See `shaders/fringe.ts`.
3413
+ */
3414
+ setChromaticAberration(intensity: number, start?: number): void;
3245
3415
  /**
3246
3416
  * Film grain, held until changed: an amplitude in display values (0 is none, 0.03 is a fine
3247
3417
  * grain) and this frame's seed. **The seed is the caller's**, because the engine takes time from
@@ -3517,12 +3687,18 @@ export declare class WebGL2Renderer implements RendererApi {
3517
3687
  * here, so there is no motion target for this to be written into, and a mover passed here is
3518
3688
  * neither read nor advanced.
3519
3689
  */
3520
- _previousModel?: ReadonlyMat4 | Mover | null): void;
3690
+ previousModel?: ReadonlyMat4 | Mover | null): void;
3521
3691
  /**
3522
3692
  * Whether a skin draw now draws its two halves: the profile asked, the frame has not spread its
3523
3693
  * skin yet, this is the frame's own picture — not a mirror's or a probe's, nor an overlay after
3524
3694
  * the frame — and the blur's target can be had.
3525
3695
  */
3696
+ /**
3697
+ * Whether a draw now is the frame's own, opaque and lit, and so writes the two maps beside its
3698
+ * colour: not a mirror's, a probe's or a capture's, whose framebuffers have no maps, and not after
3699
+ * the frame. See `reflectionSurfaceTargets.ts`.
3700
+ */
3701
+ private reflectionKeeps;
3526
3702
  private skinSplits;
3527
3703
  /**
3528
3704
  * Spread the frame's skin and add it back: once, at the first blended draw or at the frame's end.