@pmndrs/vdb 0.0.0-stage → 0.1.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 (390) hide show
  1. package/CHANGELOG.md +137 -0
  2. package/LICENSE +21 -0
  3. package/README.md +448 -2
  4. package/THIRD_PARTY_NOTICES.md +147 -0
  5. package/dist/core/compute/atlas.d.ts +94 -0
  6. package/dist/core/compute/atlas.js +98 -0
  7. package/dist/core/compute/atlas.js.map +1 -0
  8. package/dist/core/compute/index.d.ts +13 -0
  9. package/dist/core/compute/index.js +9 -0
  10. package/dist/core/compute/index.js.map +1 -0
  11. package/dist/core/compute/pyramid.d.ts +105 -0
  12. package/dist/core/compute/pyramid.js +455 -0
  13. package/dist/core/compute/pyramid.js.map +1 -0
  14. package/dist/core/compute/shared.d.ts +115 -0
  15. package/dist/core/compute/shared.js +211 -0
  16. package/dist/core/compute/shared.js.map +1 -0
  17. package/dist/core/compute/stats.d.ts +71 -0
  18. package/dist/core/compute/stats.js +188 -0
  19. package/dist/core/compute/stats.js.map +1 -0
  20. package/dist/core/compute/value-transform.d.ts +23 -0
  21. package/dist/core/compute/value-transform.js +58 -0
  22. package/dist/core/compute/value-transform.js.map +1 -0
  23. package/dist/core/errors.d.ts +11 -0
  24. package/dist/core/errors.js +9 -0
  25. package/dist/core/errors.js.map +1 -0
  26. package/dist/core/index.d.ts +30 -0
  27. package/dist/core/index.js +27 -0
  28. package/dist/core/index.js.map +1 -0
  29. package/dist/core/internal.d.ts +15 -0
  30. package/dist/core/internal.js +15 -0
  31. package/dist/core/internal.js.map +1 -0
  32. package/dist/core/pool/affine.d.ts +34 -0
  33. package/dist/core/pool/affine.js +100 -0
  34. package/dist/core/pool/affine.js.map +1 -0
  35. package/dist/core/pool/allocator.d.ts +32 -0
  36. package/dist/core/pool/allocator.js +81 -0
  37. package/dist/core/pool/allocator.js.map +1 -0
  38. package/dist/core/pool/image-header.d.ts +82 -0
  39. package/dist/core/pool/image-header.js +175 -0
  40. package/dist/core/pool/image-header.js.map +1 -0
  41. package/dist/core/pool/layout.d.ts +164 -0
  42. package/dist/core/pool/layout.js +267 -0
  43. package/dist/core/pool/layout.js.map +1 -0
  44. package/dist/core/pool/limits.d.ts +40 -0
  45. package/dist/core/pool/limits.js +79 -0
  46. package/dist/core/pool/limits.js.map +1 -0
  47. package/dist/core/pool/pool.d.ts +279 -0
  48. package/dist/core/pool/pool.js +953 -0
  49. package/dist/core/pool/pool.js.map +1 -0
  50. package/dist/core/source/dense.d.ts +19 -0
  51. package/dist/core/source/dense.js +287 -0
  52. package/dist/core/source/dense.js.map +1 -0
  53. package/dist/core/source/types.d.ts +63 -0
  54. package/dist/core/source/types.js +9 -0
  55. package/dist/core/source/types.js.map +1 -0
  56. package/dist/core/types.d.ts +28 -0
  57. package/dist/core/types.js +28 -0
  58. package/dist/core/types.js.map +1 -0
  59. package/dist/core/wgsl/api.d.ts +41 -0
  60. package/dist/core/wgsl/api.js +463 -0
  61. package/dist/core/wgsl/api.js.map +1 -0
  62. package/dist/core/wgsl/generate.d.ts +82 -0
  63. package/dist/core/wgsl/generate.js +505 -0
  64. package/dist/core/wgsl/generate.js.map +1 -0
  65. package/dist/core/wgsl/level-set.d.ts +54 -0
  66. package/dist/core/wgsl/level-set.js +194 -0
  67. package/dist/core/wgsl/level-set.js.map +1 -0
  68. package/dist/core/wgsl/pnanovdb.chunks.generated.d.ts +14 -0
  69. package/dist/core/wgsl/pnanovdb.chunks.generated.js +330 -0
  70. package/dist/core/wgsl/pnanovdb.chunks.generated.js.map +1 -0
  71. package/dist/core/wgsl/reserved.d.ts +9 -0
  72. package/dist/core/wgsl/reserved.js +26 -0
  73. package/dist/core/wgsl/reserved.js.map +1 -0
  74. package/dist/core/wgsl/types.d.ts +104 -0
  75. package/dist/core/wgsl/types.js +2 -0
  76. package/dist/core/wgsl/types.js.map +1 -0
  77. package/dist/three/coarse-first.d.ts +162 -0
  78. package/dist/three/coarse-first.js +187 -0
  79. package/dist/three/coarse-first.js.map +1 -0
  80. package/dist/three/compute.d.ts +63 -0
  81. package/dist/three/compute.js +56 -0
  82. package/dist/three/compute.js.map +1 -0
  83. package/dist/three/device.d.ts +59 -0
  84. package/dist/three/device.js +59 -0
  85. package/dist/three/device.js.map +1 -0
  86. package/dist/three/frame/blackbody.d.ts +42 -0
  87. package/dist/three/frame/blackbody.js +74 -0
  88. package/dist/three/frame/blackbody.js.map +1 -0
  89. package/dist/three/frame/chunks.d.ts +157 -0
  90. package/dist/three/frame/chunks.js +559 -0
  91. package/dist/three/frame/chunks.js.map +1 -0
  92. package/dist/three/frame/density-material.d.ts +53 -0
  93. package/dist/three/frame/density-material.js +353 -0
  94. package/dist/three/frame/density-material.js.map +1 -0
  95. package/dist/three/frame/emission-light.d.ts +167 -0
  96. package/dist/three/frame/emission-light.js +655 -0
  97. package/dist/three/frame/emission-light.js.map +1 -0
  98. package/dist/three/frame/environment-grid-material.d.ts +21 -0
  99. package/dist/three/frame/environment-grid-material.js +184 -0
  100. package/dist/three/frame/environment-grid-material.js.map +1 -0
  101. package/dist/three/frame/environment-material.d.ts +22 -0
  102. package/dist/three/frame/environment-material.js +87 -0
  103. package/dist/three/frame/environment-material.js.map +1 -0
  104. package/dist/three/frame/grid-mip-material.d.ts +12 -0
  105. package/dist/three/frame/grid-mip-material.js +61 -0
  106. package/dist/three/frame/grid-mip-material.js.map +1 -0
  107. package/dist/three/frame/index.d.ts +39 -0
  108. package/dist/three/frame/index.js +35 -0
  109. package/dist/three/frame/index.js.map +1 -0
  110. package/dist/three/frame/inject-material.d.ts +56 -0
  111. package/dist/three/frame/inject-material.js +424 -0
  112. package/dist/three/frame/inject-material.js.map +1 -0
  113. package/dist/three/frame/integrate-material.d.ts +26 -0
  114. package/dist/three/frame/integrate-material.js +198 -0
  115. package/dist/three/frame/integrate-material.js.map +1 -0
  116. package/dist/three/frame/layout.d.ts +34 -0
  117. package/dist/three/frame/layout.js +48 -0
  118. package/dist/three/frame/layout.js.map +1 -0
  119. package/dist/three/frame/lighting-material.d.ts +41 -0
  120. package/dist/three/frame/lighting-material.js +257 -0
  121. package/dist/three/frame/lighting-material.js.map +1 -0
  122. package/dist/three/frame/lights.d.ts +11 -0
  123. package/dist/three/frame/lights.js +16 -0
  124. package/dist/three/frame/lights.js.map +1 -0
  125. package/dist/three/frame/medium.d.ts +21 -0
  126. package/dist/three/frame/medium.js +29 -0
  127. package/dist/three/frame/medium.js.map +1 -0
  128. package/dist/three/frame/neural.d.ts +14 -0
  129. package/dist/three/frame/neural.js +105 -0
  130. package/dist/three/frame/neural.js.map +1 -0
  131. package/dist/three/frame/phase.d.ts +44 -0
  132. package/dist/three/frame/phase.js +80 -0
  133. package/dist/three/frame/phase.js.map +1 -0
  134. package/dist/three/frame/renderer.d.ts +493 -0
  135. package/dist/three/frame/renderer.js +1498 -0
  136. package/dist/three/frame/renderer.js.map +1 -0
  137. package/dist/three/frame/shadow-density-material.d.ts +30 -0
  138. package/dist/three/frame/shadow-density-material.js +123 -0
  139. package/dist/three/frame/shadow-density-material.js.map +1 -0
  140. package/dist/three/frame/spectrum.d.ts +18 -0
  141. package/dist/three/frame/spectrum.js +36 -0
  142. package/dist/three/frame/spectrum.js.map +1 -0
  143. package/dist/three/frame/temporal-material.d.ts +29 -0
  144. package/dist/three/frame/temporal-material.js +152 -0
  145. package/dist/three/frame/temporal-material.js.map +1 -0
  146. package/dist/three/frame/three-internals.d.ts +65 -0
  147. package/dist/three/frame/three-internals.js +150 -0
  148. package/dist/three/frame/three-internals.js.map +1 -0
  149. package/dist/three/frame/transmittance-material.d.ts +31 -0
  150. package/dist/three/frame/transmittance-material.js +315 -0
  151. package/dist/three/frame/transmittance-material.js.map +1 -0
  152. package/dist/three/frame/view.d.ts +103 -0
  153. package/dist/three/frame/view.js +296 -0
  154. package/dist/three/frame/view.js.map +1 -0
  155. package/dist/three/frame/volume-shadow-material.d.ts +36 -0
  156. package/dist/three/frame/volume-shadow-material.js +128 -0
  157. package/dist/three/frame/volume-shadow-material.js.map +1 -0
  158. package/dist/three/frame/volume-shadows.d.ts +153 -0
  159. package/dist/three/frame/volume-shadows.js +756 -0
  160. package/dist/three/frame/volume-shadows.js.map +1 -0
  161. package/dist/three/frame/volume.d.ts +172 -0
  162. package/dist/three/frame/volume.js +256 -0
  163. package/dist/three/frame/volume.js.map +1 -0
  164. package/dist/three/grid-node.d.ts +196 -0
  165. package/dist/three/grid-node.js +510 -0
  166. package/dist/three/grid-node.js.map +1 -0
  167. package/dist/three/index.d.ts +43 -0
  168. package/dist/three/index.js +49 -0
  169. package/dist/three/index.js.map +1 -0
  170. package/dist/three/internal.d.ts +14 -0
  171. package/dist/three/internal.js +14 -0
  172. package/dist/three/internal.js.map +1 -0
  173. package/dist/three/level-set-material.d.ts +112 -0
  174. package/dist/three/level-set-material.js +204 -0
  175. package/dist/three/level-set-material.js.map +1 -0
  176. package/dist/three/material.d.ts +194 -0
  177. package/dist/three/material.js +359 -0
  178. package/dist/three/material.js.map +1 -0
  179. package/dist/three/points.d.ts +84 -0
  180. package/dist/three/points.js +130 -0
  181. package/dist/three/points.js.map +1 -0
  182. package/dist/three/sequence.d.ts +317 -0
  183. package/dist/three/sequence.js +526 -0
  184. package/dist/three/sequence.js.map +1 -0
  185. package/dist/three/sparse-source.d.ts +233 -0
  186. package/dist/three/sparse-source.js +876 -0
  187. package/dist/three/sparse-source.js.map +1 -0
  188. package/dist/three/volume-source.d.ts +167 -0
  189. package/dist/three/volume-source.js +353 -0
  190. package/dist/three/volume-source.js.map +1 -0
  191. package/dist/tools/cpu/compute.d.ts +97 -0
  192. package/dist/tools/cpu/compute.js +218 -0
  193. package/dist/tools/cpu/compute.js.map +1 -0
  194. package/dist/tools/cpu/level-set.d.ts +72 -0
  195. package/dist/tools/cpu/level-set.js +261 -0
  196. package/dist/tools/cpu/level-set.js.map +1 -0
  197. package/dist/tools/cpu/march.d.ts +206 -0
  198. package/dist/tools/cpu/march.js +575 -0
  199. package/dist/tools/cpu/march.js.map +1 -0
  200. package/dist/tools/cpu/probe-coords.d.ts +70 -0
  201. package/dist/tools/cpu/probe-coords.js +116 -0
  202. package/dist/tools/cpu/probe-coords.js.map +1 -0
  203. package/dist/tools/cpu/read-value.d.ts +31 -0
  204. package/dist/tools/cpu/read-value.js +336 -0
  205. package/dist/tools/cpu/read-value.js.map +1 -0
  206. package/dist/tools/cpu/sample-trilinear.d.ts +30 -0
  207. package/dist/tools/cpu/sample-trilinear.js +156 -0
  208. package/dist/tools/cpu/sample-trilinear.js.map +1 -0
  209. package/dist/tools/cpu/stride-tables.d.ts +56 -0
  210. package/dist/tools/cpu/stride-tables.generated.d.ts +1058 -0
  211. package/dist/tools/cpu/stride-tables.generated.js +1266 -0
  212. package/dist/tools/cpu/stride-tables.generated.js.map +1 -0
  213. package/dist/tools/cpu/stride-tables.js +78 -0
  214. package/dist/tools/cpu/stride-tables.js.map +1 -0
  215. package/dist/tools/errors.d.ts +57 -0
  216. package/dist/tools/errors.js +58 -0
  217. package/dist/tools/errors.js.map +1 -0
  218. package/dist/tools/frame/blackbody.d.ts +42 -0
  219. package/dist/tools/frame/blackbody.js +116 -0
  220. package/dist/tools/frame/blackbody.js.map +1 -0
  221. package/dist/tools/frame/emission.d.ts +128 -0
  222. package/dist/tools/frame/emission.js +282 -0
  223. package/dist/tools/frame/emission.js.map +1 -0
  224. package/dist/tools/frame/environment.d.ts +105 -0
  225. package/dist/tools/frame/environment.js +268 -0
  226. package/dist/tools/frame/environment.js.map +1 -0
  227. package/dist/tools/frame/grid.d.ts +302 -0
  228. package/dist/tools/frame/grid.js +703 -0
  229. package/dist/tools/frame/grid.js.map +1 -0
  230. package/dist/tools/frame/index.d.ts +136 -0
  231. package/dist/tools/frame/index.js +348 -0
  232. package/dist/tools/frame/index.js.map +1 -0
  233. package/dist/tools/frame/medium.d.ts +61 -0
  234. package/dist/tools/frame/medium.js +99 -0
  235. package/dist/tools/frame/medium.js.map +1 -0
  236. package/dist/tools/frame/mie-table.d.ts +6 -0
  237. package/dist/tools/frame/mie-table.js +16 -0
  238. package/dist/tools/frame/mie-table.js.map +1 -0
  239. package/dist/tools/frame/mie.d.ts +54 -0
  240. package/dist/tools/frame/mie.js +176 -0
  241. package/dist/tools/frame/mie.js.map +1 -0
  242. package/dist/tools/frame/neural-weights.d.ts +9 -0
  243. package/dist/tools/frame/neural-weights.js +245 -0
  244. package/dist/tools/frame/neural-weights.js.map +1 -0
  245. package/dist/tools/frame/neural.d.ts +80 -0
  246. package/dist/tools/frame/neural.js +150 -0
  247. package/dist/tools/frame/neural.js.map +1 -0
  248. package/dist/tools/frame/pyramid-layout.d.ts +38 -0
  249. package/dist/tools/frame/pyramid-layout.js +53 -0
  250. package/dist/tools/frame/pyramid-layout.js.map +1 -0
  251. package/dist/tools/frame/shadows.d.ts +80 -0
  252. package/dist/tools/frame/shadows.js +182 -0
  253. package/dist/tools/frame/shadows.js.map +1 -0
  254. package/dist/tools/frame/sparse.d.ts +65 -0
  255. package/dist/tools/frame/sparse.js +191 -0
  256. package/dist/tools/frame/sparse.js.map +1 -0
  257. package/dist/tools/frame/spectral.d.ts +203 -0
  258. package/dist/tools/frame/spectral.js +550 -0
  259. package/dist/tools/frame/spectral.js.map +1 -0
  260. package/dist/tools/index.d.ts +106 -0
  261. package/dist/tools/index.js +88 -0
  262. package/dist/tools/index.js.map +1 -0
  263. package/dist/tools/internal.d.ts +46 -0
  264. package/dist/tools/internal.js +31 -0
  265. package/dist/tools/internal.js.map +1 -0
  266. package/dist/tools/nanovdb/build-from-vdb.d.ts +50 -0
  267. package/dist/tools/nanovdb/build-from-vdb.js +92 -0
  268. package/dist/tools/nanovdb/build-from-vdb.js.map +1 -0
  269. package/dist/tools/nanovdb/bytes.d.ts +220 -0
  270. package/dist/tools/nanovdb/bytes.js +345 -0
  271. package/dist/tools/nanovdb/bytes.js.map +1 -0
  272. package/dist/tools/nanovdb/coarse-first.d.ts +62 -0
  273. package/dist/tools/nanovdb/coarse-first.js +86 -0
  274. package/dist/tools/nanovdb/coarse-first.js.map +1 -0
  275. package/dist/tools/nanovdb/index.d.ts +32 -0
  276. package/dist/tools/nanovdb/index.js +24 -0
  277. package/dist/tools/nanovdb/index.js.map +1 -0
  278. package/dist/tools/nanovdb/inspect.d.ts +24 -0
  279. package/dist/tools/nanovdb/inspect.js +63 -0
  280. package/dist/tools/nanovdb/inspect.js.map +1 -0
  281. package/dist/tools/nanovdb/leaf-codec.d.ts +85 -0
  282. package/dist/tools/nanovdb/leaf-codec.js +320 -0
  283. package/dist/tools/nanovdb/leaf-codec.js.map +1 -0
  284. package/dist/tools/nanovdb/quantize.d.ts +43 -0
  285. package/dist/tools/nanovdb/quantize.js +277 -0
  286. package/dist/tools/nanovdb/quantize.js.map +1 -0
  287. package/dist/tools/nanovdb/resample.d.ts +160 -0
  288. package/dist/tools/nanovdb/resample.js +679 -0
  289. package/dist/tools/nanovdb/resample.js.map +1 -0
  290. package/dist/tools/nanovdb/serialize.d.ts +145 -0
  291. package/dist/tools/nanovdb/serialize.js +395 -0
  292. package/dist/tools/nanovdb/serialize.js.map +1 -0
  293. package/dist/tools/nanovdb/stats.d.ts +58 -0
  294. package/dist/tools/nanovdb/stats.js +149 -0
  295. package/dist/tools/nanovdb/stats.js.map +1 -0
  296. package/dist/tools/nanovdb/transform.d.ts +26 -0
  297. package/dist/tools/nanovdb/transform.js +91 -0
  298. package/dist/tools/nanovdb/transform.js.map +1 -0
  299. package/dist/tools/nanovdb/tree.d.ts +175 -0
  300. package/dist/tools/nanovdb/tree.js +518 -0
  301. package/dist/tools/nanovdb/tree.js.map +1 -0
  302. package/dist/tools/nanovdb/write-nvdb.d.ts +39 -0
  303. package/dist/tools/nanovdb/write-nvdb.js +210 -0
  304. package/dist/tools/nanovdb/write-nvdb.js.map +1 -0
  305. package/dist/tools/nvdb-file.d.ts +195 -0
  306. package/dist/tools/nvdb-file.js +606 -0
  307. package/dist/tools/nvdb-file.js.map +1 -0
  308. package/dist/tools/nvdb-stream.d.ts +138 -0
  309. package/dist/tools/nvdb-stream.js +365 -0
  310. package/dist/tools/nvdb-stream.js.map +1 -0
  311. package/dist/tools/vdb/bit-utils.d.ts +20 -0
  312. package/dist/tools/vdb/bit-utils.js +42 -0
  313. package/dist/tools/vdb/bit-utils.js.map +1 -0
  314. package/dist/tools/vdb/blosc.d.ts +56 -0
  315. package/dist/tools/vdb/blosc.js +231 -0
  316. package/dist/tools/vdb/blosc.js.map +1 -0
  317. package/dist/tools/vdb/byte-reader.d.ts +40 -0
  318. package/dist/tools/vdb/byte-reader.js +139 -0
  319. package/dist/tools/vdb/byte-reader.js.map +1 -0
  320. package/dist/tools/vdb/compression.d.ts +73 -0
  321. package/dist/tools/vdb/compression.js +249 -0
  322. package/dist/tools/vdb/compression.js.map +1 -0
  323. package/dist/tools/vdb/errors.d.ts +10 -0
  324. package/dist/tools/vdb/errors.js +11 -0
  325. package/dist/tools/vdb/errors.js.map +1 -0
  326. package/dist/tools/vdb/grid.d.ts +37 -0
  327. package/dist/tools/vdb/grid.js +147 -0
  328. package/dist/tools/vdb/grid.js.map +1 -0
  329. package/dist/tools/vdb/half-float.d.ts +9 -0
  330. package/dist/tools/vdb/half-float.js +24 -0
  331. package/dist/tools/vdb/half-float.js.map +1 -0
  332. package/dist/tools/vdb/index.d.ts +3 -0
  333. package/dist/tools/vdb/index.js +3 -0
  334. package/dist/tools/vdb/index.js.map +1 -0
  335. package/dist/tools/vdb/inflate.d.ts +24 -0
  336. package/dist/tools/vdb/inflate.js +334 -0
  337. package/dist/tools/vdb/inflate.js.map +1 -0
  338. package/dist/tools/vdb/metadata.d.ts +17 -0
  339. package/dist/tools/vdb/metadata.js +72 -0
  340. package/dist/tools/vdb/metadata.js.map +1 -0
  341. package/dist/tools/vdb/parse.d.ts +25 -0
  342. package/dist/tools/vdb/parse.js +171 -0
  343. package/dist/tools/vdb/parse.js.map +1 -0
  344. package/dist/tools/vdb/point-render-data.d.ts +31 -0
  345. package/dist/tools/vdb/point-render-data.js +57 -0
  346. package/dist/tools/vdb/point-render-data.js.map +1 -0
  347. package/dist/tools/vdb/points.d.ts +160 -0
  348. package/dist/tools/vdb/points.js +794 -0
  349. package/dist/tools/vdb/points.js.map +1 -0
  350. package/dist/tools/vdb/transform.d.ts +23 -0
  351. package/dist/tools/vdb/transform.js +54 -0
  352. package/dist/tools/vdb/transform.js.map +1 -0
  353. package/dist/tools/vdb/tree.d.ts +111 -0
  354. package/dist/tools/vdb/tree.js +228 -0
  355. package/dist/tools/vdb/tree.js.map +1 -0
  356. package/dist/tools/vdb/types.d.ts +138 -0
  357. package/dist/tools/vdb/types.js +3 -0
  358. package/dist/tools/vdb/types.js.map +1 -0
  359. package/dist/tools/wvdb/bake.d.ts +116 -0
  360. package/dist/tools/wvdb/bake.js +311 -0
  361. package/dist/tools/wvdb/bake.js.map +1 -0
  362. package/dist/tools/wvdb/dense.d.ts +112 -0
  363. package/dist/tools/wvdb/dense.js +309 -0
  364. package/dist/tools/wvdb/dense.js.map +1 -0
  365. package/dist/tools/wvdb/format.d.ts +161 -0
  366. package/dist/tools/wvdb/format.js +303 -0
  367. package/dist/tools/wvdb/format.js.map +1 -0
  368. package/dist/tools/wvdb/index.d.ts +13 -0
  369. package/dist/tools/wvdb/index.js +14 -0
  370. package/dist/tools/wvdb/index.js.map +1 -0
  371. package/dist/tools/wvdb/level-set.d.ts +48 -0
  372. package/dist/tools/wvdb/level-set.js +153 -0
  373. package/dist/tools/wvdb/level-set.js.map +1 -0
  374. package/dist/tools/wvdb/nanovdb.d.ts +54 -0
  375. package/dist/tools/wvdb/nanovdb.js +60 -0
  376. package/dist/tools/wvdb/nanovdb.js.map +1 -0
  377. package/dist/tools/wvdb/read.d.ts +260 -0
  378. package/dist/tools/wvdb/read.js +743 -0
  379. package/dist/tools/wvdb/read.js.map +1 -0
  380. package/dist/tools/wvdb/sha256.d.ts +7 -0
  381. package/dist/tools/wvdb/sha256.js +76 -0
  382. package/dist/tools/wvdb/sha256.js.map +1 -0
  383. package/dist/tools/wvdb/write.d.ts +127 -0
  384. package/dist/tools/wvdb/write.js +396 -0
  385. package/dist/tools/wvdb/write.js.map +1 -0
  386. package/package.json +82 -4
  387. package/vendor/LICENSE +201 -0
  388. package/vendor/NOTICE +19 -0
  389. package/vendor/VENDOR.md +85 -0
  390. package/vendor/pnanovdb.wgsl +1539 -0
@@ -0,0 +1,84 @@
1
+ /**
2
+ * `VDBPoints`: the points of a parsed point data grid as round, instanced
3
+ * sprites (K3.7, R1 §6 Step 7), three r187 `PointsNodeMaterial`.
4
+ *
5
+ * const grid = parseVdb(bytes).grids.find((g) => g.valueType === 'ptdataidx32');
6
+ * const points = new VDBPoints(vdbPointRenderData(grid), { color: 0xffffff });
7
+ * scene.add(points);
8
+ *
9
+ * Portions derived from mjurczyk/openvdb (MIT), commit 75e7345
10
+ * (`src/three-openvdb/points/webgpu/VDBPoints.js`, `points/pointsCore.js`):
11
+ * a `Sprite` with one instance per point (WebGPU point primitives are 1 pixel),
12
+ * the round alpha-tested disc, the attenuated size in pixels with a 1-pixel
13
+ * minimum, `Cd` colours times the material colour, the default diameter of half
14
+ * the mean spacing. Copyright (c) mjurczyk/openvdb contributors, MIT (see
15
+ * THIRD_PARTY_NOTICES.md). Changes: takes the engine-free `vdbPointRenderData` (tools)
16
+ * instead of decoding the grid itself; the pixel scale reads the render
17
+ * target's height when one is set (DIVERGES.md).
18
+ *
19
+ * Positions are world space of the grid (the point list's own transform);
20
+ * place them with the object's transform as any three object. The sprite sits
21
+ * at the origin with the points in local space, so frustum culling is off.
22
+ */
23
+ import * as THREE from "three";
24
+ import { InstancedBufferAttribute, PointsNodeMaterial, Sprite } from "three/webgpu";
25
+ import * as TSL from "three/tsl";
26
+ /** What `VDBPoints` draws (tools `vdbPointRenderData` returns one). */
27
+ export interface VDBPointsData {
28
+ /** World positions of the grid, xyz per point. */
29
+ positions: Float32Array;
30
+ /** Linear RGB per point (multiplied by the material colour), or null. */
31
+ colors?: Float32Array | null;
32
+ /** Points to draw (default `positions.length / 3`). */
33
+ count?: number;
34
+ /** Mean point spacing in world units: the default diameter is half of it. Default 1. */
35
+ spacing?: number;
36
+ }
37
+ /** Options of {@link VDBPoints}: `PointsNodeMaterial` parameters plus the point diameter. */
38
+ export interface VDBPointsOptions extends THREE.SpriteMaterialParameters {
39
+ /** World diameter of a point. Default `spacing * 0.5` (a gap between neighbours). */
40
+ size?: number | null;
41
+ }
42
+ type ScalarUniform = ReturnType<typeof TSL.uniform> & {
43
+ value: number;
44
+ };
45
+ /** The 64x64 round alpha map every `VDBPoints` shares (alpha-tested at 0.5). */
46
+ export declare function vdbPointDiscTexture(): THREE.DataTexture;
47
+ /**
48
+ * Sprite size (pixels at view depth 1, before the half-height factor) for a world diameter: his
49
+ * `getAttenuatedPointSize`, `diameter * maxScale * zoom / tan(fov / 2)` (fov 50 for non-perspective cameras).
50
+ */
51
+ export declare function vdbAttenuatedPointSize(object: THREE.Object3D, camera: THREE.Camera, diameter: number): number;
52
+ interface RendererSizeLike {
53
+ getSize(target: THREE.Vector2): THREE.Vector2;
54
+ getRenderTarget?(): {
55
+ height: number;
56
+ } | null;
57
+ }
58
+ /**
59
+ * Round points of a point list as one instanced sprite (see the file comment).
60
+ * `count` instances; the material is a `PointsNodeMaterial` (`color`, `opacity`
61
+ * and the other sprite parameters apply; `Cd` multiplies the colour).
62
+ */
63
+ export declare class VDBPoints extends Sprite {
64
+ readonly isVDBPoints = true;
65
+ material: PointsNodeMaterial;
66
+ /** Points drawn. */
67
+ pointCount: number;
68
+ /** Mean spacing of the points (world units). */
69
+ spacing: number;
70
+ /** World diameter of a point, or null for `spacing * 0.5`. */
71
+ size: number | null;
72
+ /** Point diameter in pixels at view depth 1 (set before each render). */
73
+ readonly pixelScale: ScalarUniform;
74
+ readonly positionAttribute: InstancedBufferAttribute;
75
+ readonly colorAttribute: InstancedBufferAttribute | null;
76
+ constructor(data: VDBPointsData, options?: VDBPointsOptions);
77
+ /** The world diameter in use: `size`, or half the spacing. */
78
+ get diameter(): number;
79
+ /** Sets {@link pixelScale} for a camera and the renderer's current target (called before each render). */
80
+ updatePixelScale(renderer: RendererSizeLike, camera: THREE.Camera): void;
81
+ /** Frees the material (the shared disc texture stays). */
82
+ dispose(): void;
83
+ }
84
+ export {};
@@ -0,0 +1,130 @@
1
+ /**
2
+ * `VDBPoints`: the points of a parsed point data grid as round, instanced
3
+ * sprites (K3.7, R1 §6 Step 7), three r187 `PointsNodeMaterial`.
4
+ *
5
+ * const grid = parseVdb(bytes).grids.find((g) => g.valueType === 'ptdataidx32');
6
+ * const points = new VDBPoints(vdbPointRenderData(grid), { color: 0xffffff });
7
+ * scene.add(points);
8
+ *
9
+ * Portions derived from mjurczyk/openvdb (MIT), commit 75e7345
10
+ * (`src/three-openvdb/points/webgpu/VDBPoints.js`, `points/pointsCore.js`):
11
+ * a `Sprite` with one instance per point (WebGPU point primitives are 1 pixel),
12
+ * the round alpha-tested disc, the attenuated size in pixels with a 1-pixel
13
+ * minimum, `Cd` colours times the material colour, the default diameter of half
14
+ * the mean spacing. Copyright (c) mjurczyk/openvdb contributors, MIT (see
15
+ * THIRD_PARTY_NOTICES.md). Changes: takes the engine-free `vdbPointRenderData` (tools)
16
+ * instead of decoding the grid itself; the pixel scale reads the render
17
+ * target's height when one is set (DIVERGES.md).
18
+ *
19
+ * Positions are world space of the grid (the point list's own transform);
20
+ * place them with the object's transform as any three object. The sprite sits
21
+ * at the origin with the points in local space, so frustum culling is off.
22
+ */
23
+ import * as THREE from "three";
24
+ import { InstancedBufferAttribute, PointsNodeMaterial, Sprite } from "three/webgpu";
25
+ import * as TSL from "three/tsl";
26
+ import { VDBError } from "../core/errors.js";
27
+ const { instancedBufferAttribute, materialColor, max, modelViewMatrix, uniform, vec4 } = TSL;
28
+ let discTexture = null;
29
+ /** The 64x64 round alpha map every `VDBPoints` shares (alpha-tested at 0.5). */
30
+ export function vdbPointDiscTexture() {
31
+ if (!discTexture) {
32
+ const size = 64;
33
+ const data = new Uint8Array(size * size * 4);
34
+ for (let y = 0; y < size; y++) {
35
+ for (let x = 0; x < size; x++) {
36
+ const dx = (x + 0.5) / size - 0.5;
37
+ const dy = (y + 0.5) / size - 0.5;
38
+ const v = Math.sqrt(dx * dx + dy * dy) <= 0.5 ? 255 : 0;
39
+ data.set([v, v, v, 255], (y * size + x) * 4);
40
+ }
41
+ }
42
+ discTexture = new THREE.DataTexture(data, size, size);
43
+ discTexture.needsUpdate = true;
44
+ }
45
+ return discTexture;
46
+ }
47
+ const worldPosition = new THREE.Vector3();
48
+ const worldQuaternion = new THREE.Quaternion();
49
+ const worldScale = new THREE.Vector3();
50
+ const canvasSize = new THREE.Vector2();
51
+ /**
52
+ * Sprite size (pixels at view depth 1, before the half-height factor) for a world diameter: his
53
+ * `getAttenuatedPointSize`, `diameter * maxScale * zoom / tan(fov / 2)` (fov 50 for non-perspective cameras).
54
+ */
55
+ export function vdbAttenuatedPointSize(object, camera, diameter) {
56
+ const perspective = camera;
57
+ const fov = perspective.isPerspectiveCamera ? perspective.fov : 50;
58
+ const zoom = camera.zoom ?? 1;
59
+ object.matrixWorld.decompose(worldPosition, worldQuaternion, worldScale);
60
+ return (diameter * Math.max(worldScale.x, worldScale.y, worldScale.z) * zoom) / Math.tan(THREE.MathUtils.degToRad(fov) * 0.5);
61
+ }
62
+ /**
63
+ * Round points of a point list as one instanced sprite (see the file comment).
64
+ * `count` instances; the material is a `PointsNodeMaterial` (`color`, `opacity`
65
+ * and the other sprite parameters apply; `Cd` multiplies the colour).
66
+ */
67
+ export class VDBPoints extends Sprite {
68
+ isVDBPoints = true;
69
+ /** Points drawn. */
70
+ pointCount;
71
+ /** Mean spacing of the points (world units). */
72
+ spacing;
73
+ /** World diameter of a point, or null for `spacing * 0.5`. */
74
+ size;
75
+ /** Point diameter in pixels at view depth 1 (set before each render). */
76
+ pixelScale;
77
+ positionAttribute;
78
+ colorAttribute;
79
+ constructor(data, options = {}) {
80
+ if (!data || !(data.positions instanceof Float32Array) || data.positions.length % 3 !== 0) {
81
+ throw new VDBError("VDB_BAD_OPTION", "VDBPoints: data.positions must be a Float32Array of xyz triples (tools vdbPointRenderData).");
82
+ }
83
+ const count = data.count ?? data.positions.length / 3;
84
+ if (!Number.isInteger(count) || count < 0 || count * 3 > data.positions.length) {
85
+ throw new VDBError("VDB_BAD_OPTION", `VDBPoints: count ${count} does not fit ${data.positions.length / 3} positions.`);
86
+ }
87
+ if (data.colors && data.colors.length < count * 3) {
88
+ throw new VDBError("VDB_BAD_OPTION", "VDBPoints: colors must hold count * 3 values.");
89
+ }
90
+ const { size = null, ...materialProps } = options;
91
+ super(new PointsNodeMaterial({
92
+ alphaMap: vdbPointDiscTexture(),
93
+ alphaTest: 0.5,
94
+ ...materialProps,
95
+ // sizeNode attenuates (with a 1-pixel minimum): sprites under a pixel are not drawn.
96
+ sizeAttenuation: false,
97
+ }));
98
+ this.pointCount = count;
99
+ this.spacing = data.spacing ?? 1;
100
+ this.size = size;
101
+ this.pixelScale = uniform(1);
102
+ this.positionAttribute = new InstancedBufferAttribute(data.positions, 3);
103
+ this.colorAttribute = data.colors ? new InstancedBufferAttribute(data.colors, 3) : null;
104
+ const position = instancedBufferAttribute(this.positionAttribute);
105
+ const viewDepth = modelViewMatrix.mul(vec4(position, 1.0)).z.negate();
106
+ const m = this.material;
107
+ m.positionNode = position;
108
+ m.sizeNode = max(this.pixelScale.div(viewDepth), 1.0);
109
+ m.colorNode = this.colorAttribute ? vec4(instancedBufferAttribute(this.colorAttribute), 1.0).mul(materialColor) : null;
110
+ m.needsUpdate = true;
111
+ this.count = count;
112
+ this.frustumCulled = false;
113
+ this.onBeforeRender = (renderer, _scene, camera) => this.updatePixelScale(renderer, camera);
114
+ }
115
+ /** The world diameter in use: `size`, or half the spacing. */
116
+ get diameter() {
117
+ return this.size ?? this.spacing * 0.5;
118
+ }
119
+ /** Sets {@link pixelScale} for a camera and the renderer's current target (called before each render). */
120
+ updatePixelScale(renderer, camera) {
121
+ const target = renderer.getRenderTarget?.() ?? null;
122
+ const height = target ? target.height : renderer.getSize(canvasSize).y;
123
+ this.pixelScale.value = vdbAttenuatedPointSize(this, camera, this.diameter) * height * 0.5;
124
+ }
125
+ /** Frees the material (the shared disc texture stays). */
126
+ dispose() {
127
+ this.material.dispose();
128
+ }
129
+ }
130
+ //# sourceMappingURL=points.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"points.js","sourceRoot":"","sources":["../../src/three/points.ts"],"names":[],"mappings":"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","sourcesContent":["/**\n * `VDBPoints`: the points of a parsed point data grid as round, instanced\n * sprites (K3.7, R1 §6 Step 7), three r187 `PointsNodeMaterial`.\n *\n * const grid = parseVdb(bytes).grids.find((g) => g.valueType === 'ptdataidx32');\n * const points = new VDBPoints(vdbPointRenderData(grid), { color: 0xffffff });\n * scene.add(points);\n *\n * Portions derived from mjurczyk/openvdb (MIT), commit 75e7345\n * (`src/three-openvdb/points/webgpu/VDBPoints.js`, `points/pointsCore.js`):\n * a `Sprite` with one instance per point (WebGPU point primitives are 1 pixel),\n * the round alpha-tested disc, the attenuated size in pixels with a 1-pixel\n * minimum, `Cd` colours times the material colour, the default diameter of half\n * the mean spacing. Copyright (c) mjurczyk/openvdb contributors, MIT (see\n * THIRD_PARTY_NOTICES.md). Changes: takes the engine-free `vdbPointRenderData` (tools)\n * instead of decoding the grid itself; the pixel scale reads the render\n * target's height when one is set (DIVERGES.md).\n *\n * Positions are world space of the grid (the point list's own transform);\n * place them with the object's transform as any three object. The sprite sits\n * at the origin with the points in local space, so frustum culling is off.\n */\n\nimport * as THREE from \"three\";\nimport { InstancedBufferAttribute, PointsNodeMaterial, Sprite } from \"three/webgpu\";\nimport * as TSL from \"three/tsl\";\nimport { VDBError } from \"../core/errors.js\";\nimport type { VDBTslNode } from \"./grid-node.js\";\n\nconst { instancedBufferAttribute, materialColor, max, modelViewMatrix, uniform, vec4 } = TSL as unknown as Record<string, VDBTslNode>;\n\n/** What `VDBPoints` draws (tools `vdbPointRenderData` returns one). */\nexport interface VDBPointsData {\n /** World positions of the grid, xyz per point. */\n positions: Float32Array;\n /** Linear RGB per point (multiplied by the material colour), or null. */\n colors?: Float32Array | null;\n /** Points to draw (default `positions.length / 3`). */\n count?: number;\n /** Mean point spacing in world units: the default diameter is half of it. Default 1. */\n spacing?: number;\n}\n\n/** Options of {@link VDBPoints}: `PointsNodeMaterial` parameters plus the point diameter. */\nexport interface VDBPointsOptions extends THREE.SpriteMaterialParameters {\n /** World diameter of a point. Default `spacing * 0.5` (a gap between neighbours). */\n size?: number | null;\n}\n\ntype ScalarUniform = ReturnType<typeof TSL.uniform> & { value: number };\n\nlet discTexture: THREE.DataTexture | null = null;\n\n/** The 64x64 round alpha map every `VDBPoints` shares (alpha-tested at 0.5). */\nexport function vdbPointDiscTexture(): THREE.DataTexture {\n if (!discTexture) {\n const size = 64;\n const data = new Uint8Array(size * size * 4);\n for (let y = 0; y < size; y++) {\n for (let x = 0; x < size; x++) {\n const dx = (x + 0.5) / size - 0.5;\n const dy = (y + 0.5) / size - 0.5;\n const v = Math.sqrt(dx * dx + dy * dy) <= 0.5 ? 255 : 0;\n data.set([v, v, v, 255], (y * size + x) * 4);\n }\n }\n discTexture = new THREE.DataTexture(data, size, size);\n discTexture.needsUpdate = true;\n }\n return discTexture;\n}\n\nconst worldPosition = new THREE.Vector3();\nconst worldQuaternion = new THREE.Quaternion();\nconst worldScale = new THREE.Vector3();\nconst canvasSize = new THREE.Vector2();\n\n/**\n * Sprite size (pixels at view depth 1, before the half-height factor) for a world diameter: his\n * `getAttenuatedPointSize`, `diameter * maxScale * zoom / tan(fov / 2)` (fov 50 for non-perspective cameras).\n */\nexport function vdbAttenuatedPointSize(object: THREE.Object3D, camera: THREE.Camera, diameter: number): number {\n const perspective = camera as THREE.PerspectiveCamera;\n const fov = perspective.isPerspectiveCamera ? perspective.fov : 50;\n const zoom = (camera as { zoom?: number }).zoom ?? 1;\n object.matrixWorld.decompose(worldPosition, worldQuaternion, worldScale);\n return (diameter * Math.max(worldScale.x, worldScale.y, worldScale.z) * zoom) / Math.tan(THREE.MathUtils.degToRad(fov) * 0.5);\n}\n\ninterface RendererSizeLike {\n getSize(target: THREE.Vector2): THREE.Vector2;\n getRenderTarget?(): { height: number } | null;\n}\n\n/**\n * Round points of a point list as one instanced sprite (see the file comment).\n * `count` instances; the material is a `PointsNodeMaterial` (`color`, `opacity`\n * and the other sprite parameters apply; `Cd` multiplies the colour).\n */\nexport class VDBPoints extends Sprite {\n readonly isVDBPoints = true;\n declare material: PointsNodeMaterial;\n /** Points drawn. */\n pointCount: number;\n /** Mean spacing of the points (world units). */\n spacing: number;\n /** World diameter of a point, or null for `spacing * 0.5`. */\n size: number | null;\n /** Point diameter in pixels at view depth 1 (set before each render). */\n readonly pixelScale: ScalarUniform;\n readonly positionAttribute: InstancedBufferAttribute;\n readonly colorAttribute: InstancedBufferAttribute | null;\n\n constructor(data: VDBPointsData, options: VDBPointsOptions = {}) {\n if (!data || !(data.positions instanceof Float32Array) || data.positions.length % 3 !== 0) {\n throw new VDBError(\"VDB_BAD_OPTION\", \"VDBPoints: data.positions must be a Float32Array of xyz triples (tools vdbPointRenderData).\");\n }\n const count = data.count ?? data.positions.length / 3;\n if (!Number.isInteger(count) || count < 0 || count * 3 > data.positions.length) {\n throw new VDBError(\"VDB_BAD_OPTION\", `VDBPoints: count ${count} does not fit ${data.positions.length / 3} positions.`);\n }\n if (data.colors && data.colors.length < count * 3) {\n throw new VDBError(\"VDB_BAD_OPTION\", \"VDBPoints: colors must hold count * 3 values.\");\n }\n const { size = null, ...materialProps } = options;\n super(\n new PointsNodeMaterial({\n alphaMap: vdbPointDiscTexture(),\n alphaTest: 0.5,\n ...materialProps,\n // sizeNode attenuates (with a 1-pixel minimum): sprites under a pixel are not drawn.\n sizeAttenuation: false,\n } as never) as never,\n );\n this.pointCount = count;\n this.spacing = data.spacing ?? 1;\n this.size = size;\n this.pixelScale = uniform(1) as ScalarUniform;\n this.positionAttribute = new InstancedBufferAttribute(data.positions, 3);\n this.colorAttribute = data.colors ? new InstancedBufferAttribute(data.colors, 3) : null;\n const position = instancedBufferAttribute(this.positionAttribute);\n const viewDepth = modelViewMatrix.mul(vec4(position, 1.0)).z.negate();\n const m = this.material as PointsNodeMaterial & Record<string, VDBTslNode>;\n m.positionNode = position;\n m.sizeNode = max((this.pixelScale as VDBTslNode).div(viewDepth), 1.0);\n m.colorNode = this.colorAttribute ? vec4(instancedBufferAttribute(this.colorAttribute), 1.0).mul(materialColor) : null;\n m.needsUpdate = true;\n (this as unknown as { count: number }).count = count;\n this.frustumCulled = false;\n this.onBeforeRender = (renderer, _scene, camera) => this.updatePixelScale(renderer as unknown as RendererSizeLike, camera);\n }\n\n /** The world diameter in use: `size`, or half the spacing. */\n get diameter(): number {\n return this.size ?? this.spacing * 0.5;\n }\n\n /** Sets {@link pixelScale} for a camera and the renderer's current target (called before each render). */\n updatePixelScale(renderer: RendererSizeLike, camera: THREE.Camera): void {\n const target = renderer.getRenderTarget?.() ?? null;\n const height = target ? target.height : renderer.getSize(canvasSize).y;\n this.pixelScale.value = vdbAttenuatedPointSize(this, camera, this.diameter) * height * 0.5;\n }\n\n /** Frees the material (the shared disc texture stays). */\n dispose(): void {\n this.material.dispose();\n }\n}\n"]}
@@ -0,0 +1,317 @@
1
+ /**
2
+ * `VDBSequence`: manifest-driven animated-volume playback on a `VDBGridPool`
3
+ * (task K2.3; v1's `NanoVDBSequence`, docs/archive/v1/SPEC.md §3.5). Decodes per-frame grid
4
+ * images ahead of time into a bounded prefetch ring and swaps the shown one
5
+ * into ONE pool id with `pool.replace(id, image)`.
6
+ *
7
+ * ## The pool contract
8
+ *
9
+ * const id = pool.add(firstFrame, { capacity: largestFrameBytes });
10
+ * sequence.start({ pool, id });
11
+ * // every frame:
12
+ * sequence.update(performance.now()); // may call pool.replace(id, frame)
13
+ * pool.update(encoder) / pool.flush(); // writes the frame in place
14
+ * grids.update(); // VDBGridNode: rebinds only after a growth
15
+ * renderer.render(scene, camera);
16
+ *
17
+ * Reserve `capacity` for the largest frame: every `replace` then writes in
18
+ * place (no move, no `pool.version` change, no rebind, no new bind group). A
19
+ * frame larger than the capacity still works, but it moves the image, and the
20
+ * next `update` may grow the pool (a `version` bump), so keep calling
21
+ * `grids.update()` after the pool's update either way.
22
+ *
23
+ * **Frame arrays are held by reference.** `replace` keeps the image until the
24
+ * `update` that writes it, and until `pool.settled()` resolves while a growth
25
+ * is unconfirmed (the pool may have to stage it again after a rollback). The
26
+ * player never writes into a frame array, and its ring only drops references.
27
+ * A custom `loader` that recycles frame buffers must not reuse an array it
28
+ * returned before `await pool.settled()` after the update that wrote it.
29
+ *
30
+ * ## Design for testability (the scheduler is a pure clock consumer)
31
+ *
32
+ * The player never owns the animation loop or reads the wall clock itself.
33
+ * `update(now)` takes the current time in ms; the consumer calls it from its
34
+ * own `requestAnimationFrame` loop with `performance.now()`, and tests call it
35
+ * with a fake, hand-advanced clock. The pool is reached only through
36
+ * `replace(id, image)`, so tests pass a stub.
37
+ *
38
+ * ## Stall policy: never block the render loop
39
+ *
40
+ * If the frame that is due hasn't finished decoding, `update()` does not wait:
41
+ * it holds the last-shown frame, counts a stall, and returns. Decoding
42
+ * continues in the background; the next `update()` that finds the frame ready
43
+ * advances to wherever the clock now points (intermediate frames are dropped:
44
+ * real-time catch-up, not slow motion).
45
+ *
46
+ * ## Frame range and loop mode
47
+ *
48
+ * `range: [start, end]` (inclusive frame indices) limits playback to those frames; the default is all of them.
49
+ * `loopMode: 'repeat'` (default) wraps from `end` to `start`; `'pingpong'` plays forward then backward
50
+ * (`start .. end .. start`), with each end frame shown once per turn (no doubled frame at the ends); `'once'` plays
51
+ * to `end` and holds there. `start()` shows `range[0]`. `seek(i)` wraps `i` into the clip, then clamps it into the
52
+ * range. `setRange()` and `setLoopMode()` change them while playing (playback continues from the shown frame,
53
+ * clamped into the new range). The prefetch ring follows the playback order, so a swap is always a `pool.replace`
54
+ * of a frame the ring already holds.
55
+ *
56
+ * **Direction.** A ping-pong keeps its direction across `stop()` / `resume()`, `seek()` and `setRange()`: paused on
57
+ * the way back, it resumes on the way back. `start()` goes forward; `setLoopMode()` keeps the direction only when the
58
+ * new mode is `'pingpong'` (`'repeat'` and `'once'` only go forward).
59
+ *
60
+ * ## Failed frames: no retry until `seek` / `start`
61
+ *
62
+ * A frame whose loader rejects goes into a failed set: `onError` fires once,
63
+ * and the player does not ask the loader for it again (no retry storm from
64
+ * the per-frame prefetch). While the clock points at it, `update()` holds the
65
+ * last frame and counts stalls; playback moves on when the clock reaches the
66
+ * next decodable frame. `seek()` and `start()` clear the set, so they retry
67
+ * every failed frame (call `seek(stats.frame)` to retry in place).
68
+ * `stats.failed` counts the frames in the set.
69
+ *
70
+ * ## Disposal
71
+ *
72
+ * `dispose()` drops the ring and the in-flight tracking and bumps a
73
+ * generation token: decodes that finish later are dropped (no ring entry, no
74
+ * `onError`). `start`, `seek`, `resume` and `preload` after `dispose()` throw
75
+ * (or reject with) `VDB_DISPOSED`; `update` returns the last frame.
76
+ */
77
+ /** The part of a `VDBGridPool` the player uses. */
78
+ export interface VDBSequencePoolLike<TFrame = Uint32Array> {
79
+ replace(id: number, image: TFrame): void;
80
+ }
81
+ /**
82
+ * Where frames go: grid `id` of `pool` (added with `capacity` for the largest frame), or (K5.9) a `source` with
83
+ * `replace(frame)`: a dense `.wvdb` source (`vdbDenseTextures`) playing `WvdbDenseVolume` frames, which a
84
+ * `VDBFrameVolume` over it follows by itself.
85
+ */
86
+ export type VDBSequenceTarget<TFrame = Uint32Array> = {
87
+ readonly pool: VDBSequencePoolLike<TFrame>;
88
+ readonly id: number;
89
+ } | {
90
+ readonly source: {
91
+ replace(frame: TFrame): void;
92
+ };
93
+ };
94
+ /** Decodes one frame's URL (or index) into a frame: a NanoVDB grid image by default. */
95
+ export type VDBFrameLoader<TFrame = Uint32Array> = (url: string, index: number) => Promise<TFrame>;
96
+ /**
97
+ * What playback does at the end of its range: wrap to the start (`'repeat'`), turn around (`'pingpong'`), or hold
98
+ * the end frame (`'once'`).
99
+ */
100
+ export type VDBSequenceLoopMode = "once" | "repeat" | "pingpong";
101
+ /** An inclusive `[start, end]` frame range. */
102
+ export type VDBSequenceRange = readonly [start: number, end: number];
103
+ export interface VDBSequenceOptions<TFrame = Uint32Array> {
104
+ /** Per-frame source URLs: an array, or `(i) => url`. Length/`frameCount` gate playback. */
105
+ urls: string[] | ((index: number) => string);
106
+ /** Total frame count. Defaults to `urls.length` when `urls` is an array (required otherwise). */
107
+ frameCount?: number;
108
+ /** Playback rate. Default 24. */
109
+ fps?: number;
110
+ /** How many frames to decode ahead of the current one. Default 3. */
111
+ prefetch?: number;
112
+ /**
113
+ * Inclusive `[start, end]` frames to play. Default `[0, frameCount - 1]` (all frames).
114
+ * @throws VDBError `VDB_BAD_OPTION` unless both are integers with `0 <= start <= end < frameCount`.
115
+ */
116
+ range?: VDBSequenceRange;
117
+ /**
118
+ * What playback does at the range end: `'repeat'` (default) wraps to the start; `'pingpong'` plays back to the
119
+ * start and forward again; `'once'` holds the end frame. Change it while playing with `setLoopMode()`.
120
+ * @throws VDBError `VDB_BAD_OPTION` for any other value.
121
+ */
122
+ loopMode?: VDBSequenceLoopMode;
123
+ /**
124
+ * Decode override. Default: `NvdbFile.fromURL(url)` -> `gridImage(0)`.
125
+ * The demo passes an in-memory loader (build frames on the fly, no fetch);
126
+ * the URL/fetch path is exercised via a Blob-URL manifest + this default.
127
+ */
128
+ loader?: VDBFrameLoader<TFrame>;
129
+ /** Clock source. Default `performance.now`. Injected as a fake in tests. */
130
+ now?: () => number;
131
+ /** Fired whenever a NEW frame is shown (after its `pool.replace`). */
132
+ onFrame?: (stats: Readonly<VDBSequenceStats>) => void;
133
+ /**
134
+ * Fired once when a frame fails to decode. The frame is not retried until
135
+ * `seek` or `start`; playback skips it (a stall while the clock points at it).
136
+ */
137
+ onError?: (error: unknown, index: number) => void;
138
+ }
139
+ export interface VDBSequenceStats {
140
+ /** Frame index currently shown. -1 before the first frame binds. */
141
+ frame: number;
142
+ /** Decoded-and-ready frames sitting in the ring ahead of `frame`. */
143
+ decodedAhead: number;
144
+ /** Cumulative count of updates that found the due frame not yet decoded. */
145
+ stalls: number;
146
+ /** CPU time (ms) of the last `pool.replace` (staging only; the GPU write lands in the next pool update). */
147
+ replaceMs: number;
148
+ /** `pool.replace` calls since `start` (the initial frame 0 included). */
149
+ swaps: number;
150
+ /** Frames whose decode failed and that wait for a `seek` / `start` to be retried. */
151
+ failed: number;
152
+ }
153
+ /**
154
+ * Plays a frame sequence into ONE pool grid: decodes frames ahead into a
155
+ * bounded ring and `pool.replace`s the due one, driven by your clock. See the
156
+ * file comment for the pool contract, the stall policy, failed frames and
157
+ * disposal.
158
+ *
159
+ * const id = pool.add(firstFrame, { capacity: largestFrameBytes });
160
+ * const sequence = new VDBSequence({ urls, fps: 24 });
161
+ * sequence.start({ pool, id });
162
+ * // per frame: sequence.update(performance.now()); pool.update(encoder); grids.update(); render
163
+ */
164
+ export declare class VDBSequence<TFrame = Uint32Array> {
165
+ readonly frameCount: number;
166
+ readonly fps: number;
167
+ readonly prefetch: number;
168
+ private _rangeStart;
169
+ private _rangeEnd;
170
+ private _loopMode;
171
+ /** Playback direction at the shown frame: +1, or -1 on the way back of a ping-pong. */
172
+ private _dir;
173
+ /** Direction at the clock anchor (`startFrame`): -1 when it was anchored on the way back of a ping-pong. */
174
+ private startDir;
175
+ private readonly urlFor;
176
+ private readonly loader;
177
+ private readonly hasLoader;
178
+ private readonly now;
179
+ private readonly onFrame;
180
+ private readonly onError;
181
+ private readonly frameDurationMs;
182
+ /** Decoded frame images by frame index. */
183
+ private readonly ring;
184
+ /** In-flight decode promises by frame index (dedupe + stall detection). */
185
+ private readonly inflight;
186
+ /** Frames whose decode failed: not retried until `seek` / `start`. */
187
+ private readonly failed;
188
+ /** Bumped by `dispose()`: a decode that finishes under an older generation is dropped. */
189
+ private generation;
190
+ private disposed;
191
+ private replaceFrame;
192
+ /** K5.9: a frame shown by `seek` while stopped once its decode lands. */
193
+ private pendingFrame;
194
+ /** The playback direction at `pendingFrame`. */
195
+ private pendingDir;
196
+ /** `pendingFrame` was asked for (start / seek / a range or mode change), not made due by the clock: it survives `stop()`. */
197
+ private pendingExplicit;
198
+ private playing;
199
+ private startNow;
200
+ private startFrame;
201
+ private _frame;
202
+ private _stalls;
203
+ private _replaceMs;
204
+ private _swaps;
205
+ constructor(opts: VDBSequenceOptions<TFrame>);
206
+ get stats(): Readonly<VDBSequenceStats>;
207
+ get isPlaying(): boolean;
208
+ /** Wrap a raw (possibly negative or >= frameCount) index into [0, frameCount). */
209
+ private wrap;
210
+ /** The playback range, inclusive: `[0, frameCount - 1]` unless set. */
211
+ get range(): VDBSequenceRange;
212
+ /** What playback does at the range end (`'repeat'` unless set). */
213
+ get loopMode(): VDBSequenceLoopMode;
214
+ private checkRange;
215
+ private checkLoopMode;
216
+ /**
217
+ * Change the playback range (inclusive). While playing, playback continues from the shown frame, clamped into the
218
+ * new range (the clock re-anchors there; a ping-pong keeps its direction); the prefetch ring is refilled in the
219
+ * new order.
220
+ *
221
+ * @throws VDBError `VDB_BAD_OPTION` for a bad range; `VDB_DISPOSED` after `dispose()`.
222
+ */
223
+ setRange(range: VDBSequenceRange, now?: number): void;
224
+ /**
225
+ * Change what playback does at the range end. Playback continues from the shown frame: going forward, or, when
226
+ * both the old and the new mode are `'pingpong'`, in its current direction. Switching to `'once'` at the range end
227
+ * holds there; switching from `'once'` held at the end to `'repeat'` or `'pingpong'` plays on.
228
+ *
229
+ * @throws VDBError `VDB_BAD_OPTION` for an unknown mode; `VDB_DISPOSED` after `dispose()`.
230
+ */
231
+ setLoopMode(mode: VDBSequenceLoopMode, now?: number): void;
232
+ /** Re-anchor the clock at the shown frame (clamped into the range) after a range or mode change. */
233
+ private reanchor;
234
+ /** Anchor the clock at `frame` (clamped into the range) heading `dir` (forward unless ping-ponging) at `now`. */
235
+ private anchor;
236
+ private clampToRange;
237
+ /** The frame `steps` after `from` (absolute index) heading `dir`, with the direction there. */
238
+ private stepFrom;
239
+ /**
240
+ * The frame the clock points at `advanced` frames after the anchor, and the direction there.
241
+ *
242
+ * A ping-pong over `len` frames is a cycle of `period = 2 (len - 1)` steps: phase `q` in `[0, len - 1]` is frame
243
+ * `rs + q` on the way out, phase `q` in `(len - 1, period)` is frame `rs + period - q` on the way back. An anchor
244
+ * at offset `o = startFrame - rs` heading forward sits at phase `o`, heading back at phase `period - o` (the two
245
+ * agree at the ends: `o = len - 1` gives `len - 1` either way, `o = 0` gives 0 or `period`, the same phase).
246
+ */
247
+ private frameAt;
248
+ /**
249
+ * Ensure the frames `[from .. from+prefetch]` in playback order (wrapping or turning around in the range when
250
+ * looping) are decoding or decoded, and evict frames outside that window to bound memory.
251
+ */
252
+ private ensurePrefetch;
253
+ /**
254
+ * Start (or return) the decode of one frame; resolves into the ring. A
255
+ * failed frame is not retried (see the file comment); a decode that settles
256
+ * after `dispose()` is dropped.
257
+ */
258
+ private decodeFrame;
259
+ private assertLive;
260
+ private decodedAhead;
261
+ /**
262
+ * Decode the first `count` frames of the range (in playback order) and resolve once all are ready. Useful for
263
+ * a deterministic warm start (the demo's `?test=1` awaits this so playback has
264
+ * zero stalls). Does not start playback.
265
+ */
266
+ preload(count?: number): Promise<void>;
267
+ /**
268
+ * Begin playback into grid `target.id` of `target.pool`. Replaces it with
269
+ * the first frame of the range (frame 0 by default) at once if that is decoded (else the first `update` that finds it
270
+ * ready does), kicks off prefetch, and anchors the clock at `now` (defaults
271
+ * to the injected clock). Call `update(now)` every animation frame thereafter.
272
+ * Clears the failed set (failed frames are retried).
273
+ *
274
+ * @throws VDBError `VDB_DISPOSED` after `dispose()`; `VDB_BAD_OPTION` for a bad target.
275
+ */
276
+ start(target: VDBSequenceTarget<TFrame>, now?: number): void;
277
+ /**
278
+ * Stop playback. The ring is preserved so `start`/`resume`/`seek` can resume cheaply. A frame the clock made due
279
+ * that is still decoding does not land after `stop()`; a frame asked for by `start`, `seek`, `setRange` or
280
+ * `setLoopMode` (before or after the stop) is shown when its decode lands.
281
+ */
282
+ stop(): void;
283
+ /**
284
+ * Resume after `stop()` WITHOUT resetting to frame 0 or clearing stats:
285
+ * re-anchors the clock at `now` from the currently-shown frame so playback
286
+ * continues from where it paused (a ping-pong in the direction it was going).
287
+ * No-op if `start()` was never called.
288
+ *
289
+ * @throws VDBError `VDB_DISPOSED` after `dispose()`.
290
+ */
291
+ resume(now?: number): void;
292
+ /**
293
+ * Jump to `index` (wrapped into the clip, then clamped into the range), re-anchoring the clock there so playback
294
+ * continues from it (a ping-pong keeps its direction). Clears the failed set (failed frames are retried).
295
+ *
296
+ * @throws VDBError `VDB_DISPOSED` after `dispose()`.
297
+ */
298
+ seek(index: number, now?: number): void;
299
+ /**
300
+ * Advance the scheduler to time `now`. Replaces the grid with the frame the
301
+ * clock points at if it is decoded; otherwise holds the last frame and counts
302
+ * a stall. Never blocks. Returns the frame index currently shown.
303
+ */
304
+ update(now: number): number;
305
+ /**
306
+ * Show `index` (playback heading `dir` there) if decoded (`pool.replace`, counts a swap, fires `onFrame`,
307
+ * advances prefetch); otherwise count a stall and hold. Shared by start/seek/update.
308
+ */
309
+ private showFrame;
310
+ /**
311
+ * Stops playback and drops all decoded frames and in-flight tracking; later
312
+ * decodes are dropped when they settle. The pool keeps the grid (and the
313
+ * frame it shows). Further `start` / `seek` / `resume` / `preload` throw
314
+ * `VDB_DISPOSED`. Idempotent.
315
+ */
316
+ dispose(): void;
317
+ }