@woosh/meep-engine 3.17.1 → 3.18.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 (265) hide show
  1. package/editor/actions/concrete/ComponentAddAction.d.ts +1 -0
  2. package/editor/actions/concrete/ComponentAddAction.d.ts.map +1 -1
  3. package/editor/actions/concrete/ComponentAddAction.js +4 -0
  4. package/editor/actions/concrete/ComponentRemoveAction.d.ts +1 -0
  5. package/editor/actions/concrete/ComponentRemoveAction.d.ts.map +1 -1
  6. package/editor/actions/concrete/ComponentRemoveAction.js +4 -0
  7. package/editor/actions/concrete/EntityCreateAction.d.ts +1 -0
  8. package/editor/actions/concrete/EntityCreateAction.d.ts.map +1 -1
  9. package/editor/actions/concrete/EntityCreateAction.js +7 -0
  10. package/editor/actions/concrete/EntityRemoveAction.d.ts +1 -0
  11. package/editor/actions/concrete/EntityRemoveAction.d.ts.map +1 -1
  12. package/editor/actions/concrete/EntityRemoveAction.js +4 -0
  13. package/editor/actions/concrete/PatchTerrainHeightAction.d.ts +10 -0
  14. package/editor/actions/concrete/PatchTerrainHeightAction.d.ts.map +1 -1
  15. package/editor/actions/concrete/PatchTerrainHeightAction.js +107 -85
  16. package/editor/actions/concrete/TransformModifyAction.d.ts +1 -0
  17. package/editor/actions/concrete/TransformModifyAction.d.ts.map +1 -1
  18. package/editor/actions/concrete/TransformModifyAction.js +4 -0
  19. package/editor/particles/effect/ParticleEffectDocument.d.ts.map +1 -1
  20. package/editor/particles/effect/ParticleEffectDocument.js +10 -6
  21. package/editor/particles/effect/ParticleReferenceSimulation.d.ts.map +1 -1
  22. package/editor/particles/effect/ParticleReferenceSimulation.js +98 -4
  23. package/editor/particles/effect/make_starter_particle_effect.d.ts.map +1 -1
  24. package/editor/particles/effect/make_starter_particle_effect.js +0 -2
  25. package/editor/tools/engine/ToolEngine.d.ts +30 -0
  26. package/editor/tools/engine/ToolEngine.d.ts.map +1 -1
  27. package/editor/tools/engine/ToolEngine.js +257 -188
  28. package/editor/view/ecs/EntityList.d.ts.map +1 -1
  29. package/editor/view/ecs/EntityList.js +6 -5
  30. package/editor/view/particles/effect/ParticleEmitterInspectorView.d.ts.map +1 -1
  31. package/editor/view/particles/effect/ParticleEmitterInspectorView.js +17 -9
  32. package/package.json +1 -1
  33. package/src/CODEC_LAYOUT_VERIFICATION.md +1 -2
  34. package/src/core/binary/meshopt/MESHOPT_VERTEX_BLOCK.d.ts +56 -0
  35. package/src/core/binary/meshopt/MESHOPT_VERTEX_BLOCK.d.ts.map +1 -0
  36. package/src/core/binary/meshopt/MESHOPT_VERTEX_BLOCK.js +73 -0
  37. package/src/core/binary/meshopt/meshopt_decode_vertex_buffer.d.ts.map +1 -1
  38. package/src/core/binary/meshopt/meshopt_decode_vertex_buffer.js +18 -63
  39. package/src/core/binary/meshopt/meshopt_encode_byte_group.d.ts +53 -0
  40. package/src/core/binary/meshopt/meshopt_encode_byte_group.d.ts.map +1 -0
  41. package/src/core/binary/meshopt/meshopt_encode_byte_group.js +140 -0
  42. package/src/core/binary/meshopt/meshopt_encode_data_block.d.ts +32 -0
  43. package/src/core/binary/meshopt/meshopt_encode_data_block.d.ts.map +1 -0
  44. package/src/core/binary/meshopt/meshopt_encode_data_block.js +77 -0
  45. package/src/core/binary/meshopt/meshopt_encode_index_sequence.d.ts +46 -0
  46. package/src/core/binary/meshopt/meshopt_encode_index_sequence.d.ts.map +1 -0
  47. package/src/core/binary/meshopt/meshopt_encode_index_sequence.js +146 -0
  48. package/src/core/binary/meshopt/meshopt_encode_vertex_buffer.d.ts +40 -0
  49. package/src/core/binary/meshopt/meshopt_encode_vertex_buffer.d.ts.map +1 -0
  50. package/src/core/binary/meshopt/meshopt_encode_vertex_buffer.js +700 -0
  51. package/src/core/binary/meshopt/meshopt_write_uint_var.d.ts +24 -0
  52. package/src/core/binary/meshopt/meshopt_write_uint_var.d.ts.map +1 -0
  53. package/src/core/binary/meshopt/meshopt_write_uint_var.js +39 -0
  54. package/src/core/math/random/seededRandom_Mulberry32.d.ts.map +1 -1
  55. package/src/core/math/random/seededRandom_Mulberry32.js +4 -2
  56. package/src/core/process/undo/Action.d.ts +19 -0
  57. package/src/core/process/undo/Action.d.ts.map +1 -1
  58. package/src/core/process/undo/Action.js +17 -0
  59. package/src/engine/graphics3/GPUParticleEmitterSystem.d.ts +78 -0
  60. package/src/engine/graphics3/GPUParticleEmitterSystem.d.ts.map +1 -0
  61. package/src/engine/graphics3/GPUParticleEmitterSystem.js +310 -0
  62. package/src/engine/graphics3/GraphicsEngine.d.ts +17 -0
  63. package/src/engine/graphics3/GraphicsEngine.d.ts.map +1 -1
  64. package/src/engine/graphics3/GraphicsEngine.js +30 -10
  65. package/src/engine/graphics3/particles/particle_gpu_records.d.ts.map +1 -1
  66. package/src/engine/graphics3/particles/particle_gpu_records.js +0 -2
  67. package/src/engine/interpolation/InterpolationSystem.d.ts +7 -0
  68. package/src/engine/interpolation/InterpolationSystem.d.ts.map +1 -1
  69. package/src/engine/interpolation/InterpolationSystem.js +10 -0
  70. package/src/engine/network/NetworkSession.d.ts.map +1 -1
  71. package/src/engine/network/NetworkSession.js +14 -34
  72. package/src/engine/network/time/RenderPlayout.d.ts +76 -0
  73. package/src/engine/network/time/RenderPlayout.d.ts.map +1 -0
  74. package/src/engine/network/time/RenderPlayout.js +163 -0
  75. package/src/engine/network/transport/adapters/WebSocketTransport.d.ts.map +1 -1
  76. package/src/engine/network/transport/adapters/WebSocketTransport.js +11 -4
  77. package/src/engine/physics/ecs/PhysicsSystem.d.ts +4 -12
  78. package/src/engine/physics/ecs/PhysicsSystem.d.ts.map +1 -1
  79. package/src/engine/physics/ecs/PhysicsSystem.js +39 -13
  80. package/src/engine/physics/fluid/ecs/FluidObstacleSystem.d.ts +4 -4
  81. package/src/engine/sound/simulation/core/VolumeField.d.ts.map +1 -1
  82. package/src/engine/sound/simulation/core/VolumeField.js +4 -1
  83. package/src/format/scene/gltf/MESHOPT_COMPRESSION_PLAN.md +23 -2
  84. package/src/shade/playground/particle_system/README.md +139 -139
  85. package/src/shade/playground/particle_system/particle_prototype.d.ts.map +1 -1
  86. package/src/shade/playground/particle_system/particle_prototype.js +0 -2
  87. package/src/shade/playground/particle_system/particle_scene.d.ts +6 -9
  88. package/src/shade/playground/particle_system/particle_scene.d.ts.map +1 -1
  89. package/src/shade/playground/particle_system/particle_scene.js +6 -13
  90. package/src/shade/playground/ssr_reprojection/README.md +103 -0
  91. package/src/shade/playground/ssr_reprojection/SpatialFilterProbe.d.ts +17 -0
  92. package/src/shade/playground/ssr_reprojection/SpatialFilterProbe.d.ts.map +1 -0
  93. package/src/shade/playground/ssr_reprojection/SpatialFilterProbe.js +68 -0
  94. package/src/shade/playground/ssr_reprojection/index.html +79 -0
  95. package/src/shade/playground/ssr_reprojection/main.d.ts +2 -0
  96. package/src/shade/playground/ssr_reprojection/main.d.ts.map +1 -0
  97. package/src/shade/playground/ssr_reprojection/main.js +245 -0
  98. package/src/shade/playground/ssr_reprojection/scene.d.ts +18 -0
  99. package/src/shade/playground/ssr_reprojection/scene.d.ts.map +1 -0
  100. package/src/shade/playground/ssr_reprojection/scene.js +51 -0
  101. package/src/shade/renderer/Renderer.d.ts +2 -23
  102. package/src/shade/renderer/Renderer.d.ts.map +1 -1
  103. package/src/shade/renderer/Renderer.js +185 -218
  104. package/src/shade/renderer/animation/GPUAnimationManager.d.ts +5 -8
  105. package/src/shade/renderer/animation/GPUAnimationManager.d.ts.map +1 -1
  106. package/src/shade/renderer/animation/GPUAnimationManager.js +12 -12
  107. package/src/shade/renderer/buffer/table/GPUTypedTable.d.ts.map +1 -1
  108. package/src/shade/renderer/buffer/table/GPUTypedTable.js +6 -0
  109. package/src/shade/renderer/buffer/table/single/GPUSingleTypeTable.d.ts.map +1 -1
  110. package/src/shade/renderer/buffer/table/single/GPUSingleTypeTable.js +7 -0
  111. package/src/shade/renderer/global_illumination/brick4/gpu/draw/chunk_brick4_sample_specular.d.ts +4 -0
  112. package/src/shade/renderer/global_illumination/brick4/gpu/draw/chunk_brick4_sample_specular.d.ts.map +1 -0
  113. package/src/shade/renderer/global_illumination/brick4/gpu/draw/chunk_brick4_sample_specular.js +51 -0
  114. package/src/shade/renderer/global_illumination/brick4/gpu/draw/shader_brick4_specular.d.ts.map +1 -1
  115. package/src/shade/renderer/global_illumination/brick4/gpu/draw/shader_brick4_specular.js +5 -35
  116. package/src/shade/renderer/particles/DESIGN.md +703 -514
  117. package/src/shade/renderer/particles/GPUParticleSystem.d.ts +16 -4
  118. package/src/shade/renderer/particles/GPUParticleSystem.d.ts.map +1 -1
  119. package/src/shade/renderer/particles/GPUParticleSystem.js +1189 -991
  120. package/src/shade/renderer/particles/ParticleConstants.d.ts +64 -0
  121. package/src/shade/renderer/particles/ParticleConstants.d.ts.map +1 -1
  122. package/src/shade/renderer/particles/ParticleConstants.js +71 -0
  123. package/src/shade/renderer/particles/bounds/chunk_particle_bounds.d.ts +57 -0
  124. package/src/shade/renderer/particles/bounds/chunk_particle_bounds.d.ts.map +1 -0
  125. package/src/shade/renderer/particles/bounds/chunk_particle_bounds.js +181 -0
  126. package/src/shade/renderer/particles/bounds/chunk_particle_bounds_unknown.d.ts +7 -0
  127. package/src/shade/renderer/particles/bounds/chunk_particle_bounds_unknown.d.ts.map +1 -0
  128. package/src/shade/renderer/particles/bounds/chunk_particle_bounds_unknown.js +12 -0
  129. package/src/shade/renderer/particles/bounds/graph_particle_bounds.d.ts +33 -0
  130. package/src/shade/renderer/particles/bounds/graph_particle_bounds.d.ts.map +1 -0
  131. package/src/shade/renderer/particles/bounds/graph_particle_bounds.js +67 -0
  132. package/src/shade/renderer/particles/bounds/shader_particle_bounds.d.ts +40 -0
  133. package/src/shade/renderer/particles/bounds/shader_particle_bounds.d.ts.map +1 -0
  134. package/src/shade/renderer/particles/bounds/shader_particle_bounds.js +187 -0
  135. package/src/shade/renderer/particles/coherence/graph_particle_bucket.d.ts +15 -2
  136. package/src/shade/renderer/particles/coherence/graph_particle_bucket.d.ts.map +1 -1
  137. package/src/shade/renderer/particles/coherence/graph_particle_bucket.js +14 -8
  138. package/src/shade/renderer/particles/data/PARTICLE_COUNTERS.d.ts +58 -4
  139. package/src/shade/renderer/particles/data/PARTICLE_COUNTERS.d.ts.map +1 -1
  140. package/src/shade/renderer/particles/data/PARTICLE_COUNTERS.js +79 -4
  141. package/src/shade/renderer/particles/data/PARTICLE_EMITTER_STATE.d.ts +23 -1
  142. package/src/shade/renderer/particles/data/PARTICLE_EMITTER_STATE.d.ts.map +1 -1
  143. package/src/shade/renderer/particles/data/PARTICLE_EMITTER_STATE.js +35 -2
  144. package/src/shade/renderer/particles/data/PARTICLE_EMITTER_STRUCT.d.ts +4 -2
  145. package/src/shade/renderer/particles/data/PARTICLE_EMITTER_STRUCT.d.ts.map +1 -1
  146. package/src/shade/renderer/particles/data/PARTICLE_EMITTER_STRUCT.js +5 -8
  147. package/src/shade/renderer/particles/data/particle_emitter_record.d.ts.map +1 -1
  148. package/src/shade/renderer/particles/data/particle_emitter_record.js +0 -6
  149. package/src/shade/renderer/particles/graph_particles.d.ts +25 -3
  150. package/src/shade/renderer/particles/graph_particles.d.ts.map +1 -1
  151. package/src/shade/renderer/particles/graph_particles.js +108 -31
  152. package/src/shade/renderer/particles/graph_particles_avboit.d.ts +6 -4
  153. package/src/shade/renderer/particles/graph_particles_avboit.d.ts.map +1 -1
  154. package/src/shade/renderer/particles/graph_particles_avboit.js +5 -5
  155. package/src/shade/renderer/particles/runtime/EmitterRegistry.d.ts +5 -0
  156. package/src/shade/renderer/particles/runtime/EmitterRegistry.d.ts.map +1 -1
  157. package/src/shade/renderer/particles/runtime/EmitterRegistry.js +27 -6
  158. package/src/shade/renderer/particles/runtime/GPUParticleEmitterContext.d.ts +4 -0
  159. package/src/shade/renderer/particles/runtime/GPUParticleEmitterContext.d.ts.map +1 -1
  160. package/src/shade/renderer/particles/runtime/GPUParticleEmitterContext.js +6 -1
  161. package/src/shade/renderer/particles/runtime/ParticleEmitter.d.ts +35 -27
  162. package/src/shade/renderer/particles/runtime/ParticleEmitter.d.ts.map +1 -1
  163. package/src/shade/renderer/particles/runtime/ParticleEmitter.js +424 -425
  164. package/src/shade/renderer/particles/shaders/chunk_particle_emitter_warmup.d.ts +20 -0
  165. package/src/shade/renderer/particles/shaders/chunk_particle_emitter_warmup.d.ts.map +1 -0
  166. package/src/shade/renderer/particles/shaders/chunk_particle_render_math.d.ts +4 -0
  167. package/src/shade/renderer/particles/shaders/chunk_particle_render_math.d.ts.map +1 -1
  168. package/src/shade/renderer/particles/shaders/chunk_particle_render_math.js +38 -2
  169. package/src/shade/renderer/particles/shaders/chunk_particle_spawn_budget.d.ts +22 -0
  170. package/src/shade/renderer/particles/shaders/chunk_particle_spawn_budget.d.ts.map +1 -0
  171. package/src/shade/renderer/particles/shaders/chunk_particle_spawn_budget.js +42 -0
  172. package/src/shade/renderer/particles/shaders/shader_particle_avboit_draw.js +1 -1
  173. package/src/shade/renderer/particles/shaders/shader_particle_avboit_occupancy.d.ts.map +1 -1
  174. package/src/shade/renderer/particles/shaders/shader_particle_avboit_occupancy.js +53 -22
  175. package/src/shade/renderer/particles/shaders/shader_particle_emitter_tick.d.ts.map +1 -1
  176. package/src/shade/renderer/particles/shaders/shader_particle_emitter_tick.js +213 -216
  177. package/src/shade/renderer/particles/shaders/shader_particle_reclaim.d.ts +50 -0
  178. package/src/shade/renderer/particles/shaders/shader_particle_reclaim.d.ts.map +1 -0
  179. package/src/shade/renderer/particles/shaders/shader_particle_render.js +1 -1
  180. package/src/shade/renderer/particles/warmup/chunk_particle_warmup_step.d.ts +36 -0
  181. package/src/shade/renderer/particles/warmup/chunk_particle_warmup_step.d.ts.map +1 -0
  182. package/src/shade/renderer/particles/warmup/chunk_particle_warmup_step.js +102 -0
  183. package/src/shade/renderer/particles/warmup/graph_particle_warmup.d.ts +102 -0
  184. package/src/shade/renderer/particles/warmup/graph_particle_warmup.d.ts.map +1 -0
  185. package/src/shade/renderer/particles/warmup/graph_particle_warmup.js +329 -0
  186. package/src/shade/renderer/particles/warmup/shader_particle_warmup.d.ts +112 -0
  187. package/src/shade/renderer/particles/warmup/shader_particle_warmup.d.ts.map +1 -0
  188. package/src/shade/renderer/particles/warmup/shader_particle_warmup.js +318 -0
  189. package/src/shade/renderer/particles/warmup/shader_particle_warmup_advance.d.ts +35 -0
  190. package/src/shade/renderer/particles/warmup/shader_particle_warmup_advance.d.ts.map +1 -0
  191. package/src/shade/renderer/particles/warmup/shader_particle_warmup_advance.js +108 -0
  192. package/src/shade/renderer/particles/warmup/shader_particle_warmup_advance_wide.d.ts +3 -0
  193. package/src/shade/renderer/particles/warmup/shader_particle_warmup_advance_wide.d.ts.map +1 -0
  194. package/src/shade/renderer/particles/warmup/shader_particle_warmup_advance_wide.js +70 -0
  195. package/src/shade/renderer/particles/warmup/warmup_schedule.d.ts +62 -0
  196. package/src/shade/renderer/particles/warmup/warmup_schedule.d.ts.map +1 -0
  197. package/src/shade/renderer/particles/warmup/warmup_schedule.js +55 -0
  198. package/src/shade/renderer/postprocess/PostProcess.d.ts.map +1 -1
  199. package/src/shade/renderer/postprocess/PostProcess.js +2 -1
  200. package/src/shade/renderer/postprocess/ssr/REPROJECTION_PROPOSAL.md +286 -0
  201. package/src/shade/renderer/postprocess/ssr/SSR.d.ts +57 -21
  202. package/src/shade/renderer/postprocess/ssr/SSR.d.ts.map +1 -1
  203. package/src/shade/renderer/postprocess/ssr/SSR.js +230 -129
  204. package/src/shade/renderer/postprocess/ssr/SSRReprojectionMode.d.ts +11 -0
  205. package/src/shade/renderer/postprocess/ssr/SSRReprojectionMode.d.ts.map +1 -0
  206. package/src/shade/renderer/postprocess/ssr/SSRReprojectionMode.js +6 -0
  207. package/src/shade/renderer/postprocess/ssr/chunk_ssr_metadata.d.ts +4 -0
  208. package/src/shade/renderer/postprocess/ssr/chunk_ssr_metadata.d.ts.map +1 -0
  209. package/src/shade/renderer/postprocess/ssr/chunk_ssr_metadata.js +32 -0
  210. package/src/shade/renderer/postprocess/ssr/chunk_ssr_spatial_variance.d.ts +4 -0
  211. package/src/shade/renderer/postprocess/ssr/chunk_ssr_spatial_variance.d.ts.map +1 -0
  212. package/src/shade/renderer/postprocess/ssr/chunk_ssr_spatial_variance.js +41 -0
  213. package/src/shade/renderer/postprocess/ssr/reproject/chunk_ssr_reprojection.d.ts +3 -0
  214. package/src/shade/renderer/postprocess/ssr/reproject/chunk_ssr_reprojection.d.ts.map +1 -0
  215. package/src/shade/renderer/postprocess/ssr/reproject/chunk_ssr_reprojection.js +30 -0
  216. package/src/shade/renderer/postprocess/ssr/reproject/chunk_ssr_sample_history.d.ts +4 -0
  217. package/src/shade/renderer/postprocess/ssr/reproject/chunk_ssr_sample_history.d.ts.map +1 -0
  218. package/src/shade/renderer/postprocess/ssr/reproject/chunk_ssr_sample_history.js +70 -0
  219. package/src/shade/renderer/postprocess/ssr/resolve/build_ssr_resolve_shader.d.ts +21 -0
  220. package/src/shade/renderer/postprocess/ssr/resolve/build_ssr_resolve_shader.d.ts.map +1 -0
  221. package/src/shade/renderer/postprocess/ssr/resolve/build_ssr_resolve_shader.js +363 -0
  222. package/src/shade/renderer/postprocess/ssr/resolve/chunk_get_neighbour_weight.js +1 -1
  223. package/src/shade/renderer/postprocess/ssr/resolve/ssr_resolve_shader_Brick4.d.ts +2 -0
  224. package/src/shade/renderer/postprocess/ssr/resolve/ssr_resolve_shader_Brick4.d.ts.map +1 -0
  225. package/src/shade/renderer/postprocess/ssr/resolve/ssr_resolve_shader_Brick4.js +24 -0
  226. package/src/shade/renderer/postprocess/ssr/resolve/ssr_resolve_shader_IBL.d.ts +1 -6
  227. package/src/shade/renderer/postprocess/ssr/resolve/ssr_resolve_shader_IBL.d.ts.map +1 -1
  228. package/src/shade/renderer/postprocess/ssr/resolve/ssr_resolve_shader_IBL.js +16 -332
  229. package/src/shade/renderer/postprocess/ssr/resolve/ssr_resolve_shader_LPV.d.ts +1 -6
  230. package/src/shade/renderer/postprocess/ssr/resolve/ssr_resolve_shader_LPV.d.ts.map +1 -1
  231. package/src/shade/renderer/postprocess/ssr/resolve/ssr_resolve_shader_LPV.js +25 -358
  232. package/src/shade/renderer/postprocess/ssr/ssr_reproject_shader.d.ts +0 -5
  233. package/src/shade/renderer/postprocess/ssr/ssr_reproject_shader.d.ts.map +1 -1
  234. package/src/shade/renderer/postprocess/ssr/ssr_reproject_shader.js +201 -276
  235. package/src/shade/renderer/postprocess/ssr/ssr_spatial_denoise_shader.d.ts +1 -0
  236. package/src/shade/renderer/postprocess/ssr/ssr_spatial_denoise_shader.d.ts.map +1 -1
  237. package/src/shade/renderer/postprocess/ssr/ssr_spatial_denoise_shader.js +167 -143
  238. package/src/shade/renderer/shader/graph/graph_create_buffer.d.ts +15 -0
  239. package/src/shade/renderer/shader/graph/graph_create_buffer.d.ts.map +1 -0
  240. package/src/shade/renderer/shader/graph/graph_create_buffer.js +20 -0
  241. package/src/shade/renderer/view/GPUViewContext.d.ts +3 -4
  242. package/src/shade/renderer/view/GPUViewContext.d.ts.map +1 -1
  243. package/src/shade/renderer/view/GPUViewContext.js +5 -5
  244. package/src/core/binary/meshopt/__meshopt_test_streams.d.ts +0 -24
  245. package/src/core/binary/meshopt/__meshopt_test_streams.d.ts.map +0 -1
  246. package/src/core/binary/meshopt/__meshopt_test_streams.js +0 -237
  247. package/src/core/geom/3d/atlas/atlas_test_fixtures.d.ts +0 -84
  248. package/src/core/geom/3d/atlas/atlas_test_fixtures.d.ts.map +0 -1
  249. package/src/core/geom/3d/atlas/atlas_test_fixtures.js +0 -266
  250. package/src/engine/asset/loaders/gltf_test_fixtures.d.ts +0 -97
  251. package/src/engine/asset/loaders/gltf_test_fixtures.d.ts.map +0 -1
  252. package/src/engine/asset/loaders/gltf_test_fixtures.js +0 -359
  253. package/src/engine/sound/simulation/core/OcclusionSolver.d.ts +0 -29
  254. package/src/engine/sound/simulation/core/OcclusionSolver.d.ts.map +0 -1
  255. package/src/shade/renderer/animation/skin_test_fixtures.d.ts +0 -86
  256. package/src/shade/renderer/animation/skin_test_fixtures.d.ts.map +0 -1
  257. package/src/shade/renderer/animation/skin_test_fixtures.js +0 -250
  258. package/src/shade/renderer/geometry/virtual/format/attribute/vgeo_layers_test_fixtures.d.ts +0 -16
  259. package/src/shade/renderer/geometry/virtual/format/attribute/vgeo_layers_test_fixtures.d.ts.map +0 -1
  260. package/src/shade/renderer/geometry/virtual/format/attribute/vgeo_layers_test_fixtures.js +0 -27
  261. package/src/shade/renderer/particles/particle_test_fixtures.d.ts +0 -151
  262. package/src/shade/renderer/particles/particle_test_fixtures.d.ts.map +0 -1
  263. package/src/shade/renderer/particles/particle_test_fixtures.js +0 -229
  264. package/src/shade/renderer/particles/shaders/chunk_particle_emitter_world_sphere.js +0 -23
  265. package/src/shade/renderer/postprocess/ssr/reproject/shader_ffx_denoiser_reflections_reproject.js +0 -457
@@ -0,0 +1,56 @@
1
+ /**
2
+ * How many elements one block holds at a given stride — the same arithmetic on both sides, because
3
+ * a block boundary is not stored anywhere and both sides have to arrive at it alone.
4
+ *
5
+ * @param {number} byte_stride
6
+ * @returns {number}
7
+ */
8
+ export function meshopt_max_block_elements(byte_stride: number): number;
9
+ /**
10
+ * The shape of an attribute stream's blocks, shared by the two sides of the codec. A decoder that
11
+ * disagreed with an encoder about any of this would not fail — it would produce different bytes.
12
+ *
13
+ * @see https://github.com/KhronosGroup/glTF/tree/main/extensions/2.0/Khronos/KHR_meshopt_compression
14
+ */
15
+ /**
16
+ * Header nibble every attribute stream starts with; the low nibble is the codec version.
17
+ * @type {number}
18
+ */
19
+ export const MESHOPT_VERTEX_HEADER: number;
20
+ /**
21
+ * An attribute block never holds more than this many bytes of element data, which is what keeps a
22
+ * block's deltas inside one scratch buffer and inside a cache level while they are transposed.
23
+ * @type {number}
24
+ */
25
+ export const MESHOPT_MAX_BLOCK_BYTES: number;
26
+ /**
27
+ * ...nor more than this many elements, whatever the stride.
28
+ * @type {number}
29
+ */
30
+ export const MESHOPT_MAX_BLOCK_ELEMENTS: number;
31
+ /**
32
+ * Largest element the format admits, and so the largest baseline there can be.
33
+ * @type {number}
34
+ */
35
+ export const MESHOPT_MAX_BYTE_STRIDE: number;
36
+ /**
37
+ * How much of the stream sits behind the last attribute block, at the least. The tail block itself
38
+ * may be longer than this — a wide element's baseline is — and then there is no padding at all.
39
+ * @type {number[]}
40
+ */
41
+ export const MESHOPT_TAIL_MIN_BY_VERSION: number[];
42
+ /**
43
+ * What the two bits stored per group mean, by the control mode that selected the table. Version 0
44
+ * has no control header and always reads {@link MESHOPT_BITS_VERSION_0}.
45
+ *
46
+ * Control mode 2 (nothing stored) and control mode 3 (literal, no header bits) have no table
47
+ * because they have no header bits to index one with.
48
+ *
49
+ * @type {number[][]}
50
+ */
51
+ export const MESHOPT_BITS_BY_CONTROL: number[][];
52
+ /**
53
+ * @type {number[]}
54
+ */
55
+ export const MESHOPT_BITS_VERSION_0: number[];
56
+ //# sourceMappingURL=MESHOPT_VERTEX_BLOCK.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MESHOPT_VERTEX_BLOCK.d.ts","sourceRoot":"","sources":["../../../../../src/core/binary/meshopt/MESHOPT_VERTEX_BLOCK.js"],"names":[],"mappings":"AA4DA;;;;;;GAMG;AACH,wDAHW,MAAM,GACJ,MAAM,CAOlB;AAtED;;;;;GAKG;AAEH;;;GAGG;AACH,oCAFU,MAAM,CAE0B;AAE1C;;;;GAIG;AACH,sCAFU,MAAM,CAE4B;AAE5C;;;GAGG;AACH,yCAFU,MAAM,CAE8B;AAE9C;;;GAGG;AACH,sCAFU,MAAM,CAE2B;AAE3C;;;;GAIG;AACH,0CAFU,MAAM,EAAE,CAEkC;AAEpD;;;;;;;;GAQG;AACH,sCAFU,MAAM,EAAE,EAAE,CAKlB;AAEF;;GAEG;AACH,qCAFU,MAAM,EAAE,CAEiC"}
@@ -0,0 +1,73 @@
1
+ import { MESHOPT_GROUP_SIZE } from "./MESHOPT_GROUP_SIZE.js";
2
+
3
+ /**
4
+ * The shape of an attribute stream's blocks, shared by the two sides of the codec. A decoder that
5
+ * disagreed with an encoder about any of this would not fail — it would produce different bytes.
6
+ *
7
+ * @see https://github.com/KhronosGroup/glTF/tree/main/extensions/2.0/Khronos/KHR_meshopt_compression
8
+ */
9
+
10
+ /**
11
+ * Header nibble every attribute stream starts with; the low nibble is the codec version.
12
+ * @type {number}
13
+ */
14
+ export const MESHOPT_VERTEX_HEADER = 0xa0;
15
+
16
+ /**
17
+ * An attribute block never holds more than this many bytes of element data, which is what keeps a
18
+ * block's deltas inside one scratch buffer and inside a cache level while they are transposed.
19
+ * @type {number}
20
+ */
21
+ export const MESHOPT_MAX_BLOCK_BYTES = 8192;
22
+
23
+ /**
24
+ * ...nor more than this many elements, whatever the stride.
25
+ * @type {number}
26
+ */
27
+ export const MESHOPT_MAX_BLOCK_ELEMENTS = 256;
28
+
29
+ /**
30
+ * Largest element the format admits, and so the largest baseline there can be.
31
+ * @type {number}
32
+ */
33
+ export const MESHOPT_MAX_BYTE_STRIDE = 256;
34
+
35
+ /**
36
+ * How much of the stream sits behind the last attribute block, at the least. The tail block itself
37
+ * may be longer than this — a wide element's baseline is — and then there is no padding at all.
38
+ * @type {number[]}
39
+ */
40
+ export const MESHOPT_TAIL_MIN_BY_VERSION = [32, 24];
41
+
42
+ /**
43
+ * What the two bits stored per group mean, by the control mode that selected the table. Version 0
44
+ * has no control header and always reads {@link MESHOPT_BITS_VERSION_0}.
45
+ *
46
+ * Control mode 2 (nothing stored) and control mode 3 (literal, no header bits) have no table
47
+ * because they have no header bits to index one with.
48
+ *
49
+ * @type {number[][]}
50
+ */
51
+ export const MESHOPT_BITS_BY_CONTROL = [
52
+ [0, 1, 2, 4],
53
+ [1, 2, 4, 8]
54
+ ];
55
+
56
+ /**
57
+ * @type {number[]}
58
+ */
59
+ export const MESHOPT_BITS_VERSION_0 = [0, 2, 4, 8];
60
+
61
+ /**
62
+ * How many elements one block holds at a given stride — the same arithmetic on both sides, because
63
+ * a block boundary is not stored anywhere and both sides have to arrive at it alone.
64
+ *
65
+ * @param {number} byte_stride
66
+ * @returns {number}
67
+ */
68
+ export function meshopt_max_block_elements(byte_stride) {
69
+ return Math.min(
70
+ Math.floor(MESHOPT_MAX_BLOCK_BYTES / byte_stride) & ~(MESHOPT_GROUP_SIZE - 1),
71
+ MESHOPT_MAX_BLOCK_ELEMENTS
72
+ );
73
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"meshopt_decode_vertex_buffer.d.ts","sourceRoot":"","sources":["../../../../../src/core/binary/meshopt/meshopt_decode_vertex_buffer.js"],"names":[],"mappings":"AAiFA;;;;;;;;;;;;;;;;;;GAkBG;AACH,0DAPW,UAAU,SACV,MAAM,eACN,MAAM,UACN,UAAU,GACR,MAAM,CAyGlB"}
1
+ {"version":3,"file":"meshopt_decode_vertex_buffer.d.ts","sourceRoot":"","sources":["../../../../../src/core/binary/meshopt/meshopt_decode_vertex_buffer.js"],"names":[],"mappings":"AAuCA;;;;;;;;;;;;;;;;;;GAkBG;AACH,0DAPW,UAAU,SACV,MAAM,eACN,MAAM,UACN,UAAU,GACR,MAAM,CAsGlB"}
@@ -1,58 +1,16 @@
1
1
  import { assert } from "../../assert.js";
2
2
  import { MESHOPT_GROUP_SIZE } from "./MESHOPT_GROUP_SIZE.js";
3
+ import {
4
+ MESHOPT_BITS_BY_CONTROL,
5
+ MESHOPT_BITS_VERSION_0,
6
+ MESHOPT_MAX_BLOCK_BYTES,
7
+ MESHOPT_MAX_BYTE_STRIDE,
8
+ MESHOPT_TAIL_MIN_BY_VERSION,
9
+ MESHOPT_VERTEX_HEADER,
10
+ meshopt_max_block_elements
11
+ } from "./MESHOPT_VERTEX_BLOCK.js";
3
12
  import { meshopt_decode_data_block } from "./meshopt_decode_data_block.js";
4
13
 
5
- /**
6
- * Header nibble every attribute stream starts with; the low nibble is the codec version.
7
- * @type {number}
8
- */
9
- const HEADER = 0xa0;
10
-
11
- /**
12
- * An attribute block never holds more than this many bytes of element data, which is what keeps a
13
- * block's deltas inside {@link delta_scratch} and inside a cache level while they are transposed.
14
- * @type {number}
15
- */
16
- const MAX_BLOCK_BYTES = 8192;
17
-
18
- /**
19
- * ...nor more than this many elements, whatever the stride.
20
- * @type {number}
21
- */
22
- const MAX_BLOCK_ELEMENTS = 256;
23
-
24
- /**
25
- * Largest element the format admits, and so the largest baseline there can be.
26
- * @type {number}
27
- */
28
- const MAX_BYTE_STRIDE = 256;
29
-
30
- /**
31
- * How much of the stream sits behind the last attribute block, at the least. The tail block itself
32
- * may be longer than this - a wide element's baseline is - and then there is no padding at all.
33
- * @type {number[]}
34
- */
35
- const TAIL_MIN_BY_VERSION = [32, 24];
36
-
37
- /**
38
- * What the two bits stored per group mean, by the control mode that selected the table. Version 0
39
- * has no control header and always reads {@link BITS_VERSION_0}.
40
- *
41
- * Control mode 2 (nothing stored) and control mode 3 (literal, no header bits) have no table
42
- * because they have no header bits to index one with.
43
- *
44
- * @type {number[][]}
45
- */
46
- const BITS_BY_CONTROL = [
47
- [0, 1, 2, 4],
48
- [1, 2, 4, 8]
49
- ];
50
-
51
- /**
52
- * @type {number[]}
53
- */
54
- const BITS_VERSION_0 = [0, 2, 4, 8];
55
-
56
14
  /**
57
15
  * One attribute block's delta bytes, laid out per byte position: position `k`'s deltas are
58
16
  * `group_count * 16` bytes at `k * aligned_count`.
@@ -62,14 +20,14 @@ const BITS_VERSION_0 = [0, 2, 4, 8];
62
20
  *
63
21
  * @type {Uint8Array}
64
22
  */
65
- const delta_scratch = new Uint8Array(MAX_BLOCK_BYTES);
23
+ const delta_scratch = new Uint8Array(MESHOPT_MAX_BLOCK_BYTES);
66
24
 
67
25
  /**
68
26
  * The element every block's first delta is taken against - the tail block's for the first block,
69
27
  * and the previous block's last element after that.
70
28
  * @type {Uint8Array}
71
29
  */
72
- const baseline = new Uint8Array(MAX_BYTE_STRIDE);
30
+ const baseline = new Uint8Array(MESHOPT_MAX_BYTE_STRIDE);
73
31
 
74
32
  /**
75
33
  * How each aligned group of four byte positions turns its deltas back into values. One byte per
@@ -77,7 +35,7 @@ const baseline = new Uint8Array(MAX_BYTE_STRIDE);
77
35
  * mode 0.
78
36
  * @type {Uint8Array}
79
37
  */
80
- const channel_modes = new Uint8Array(MAX_BYTE_STRIDE / 4);
38
+ const channel_modes = new Uint8Array(MESHOPT_MAX_BYTE_STRIDE / 4);
81
39
 
82
40
  /**
83
41
  * Decode an attribute stream - the `"ATTRIBUTES"` mode of both meshopt extensions, codec version
@@ -102,7 +60,7 @@ export function meshopt_decode_vertex_buffer(destination, count, byte_stride, so
102
60
  assert.isNonNegativeInteger(count, 'count');
103
61
  assert.isPositiveInteger(byte_stride, 'byte_stride');
104
62
  assert.equal(byte_stride % 4, 0, `byte_stride(=${byte_stride}) must be divisible by 4`);
105
- assert.ok(byte_stride <= MAX_BYTE_STRIDE, `byte_stride(=${byte_stride}) must be at most ${MAX_BYTE_STRIDE}`);
63
+ assert.ok(byte_stride <= MESHOPT_MAX_BYTE_STRIDE, `byte_stride(=${byte_stride}) must be at most ${MESHOPT_MAX_BYTE_STRIDE}`);
106
64
  assert.equal(
107
65
  destination.length, count * byte_stride,
108
66
  `destination(=${destination.length} bytes) must hold count(=${count}) * byte_stride(=${byte_stride})`
@@ -116,7 +74,7 @@ export function meshopt_decode_vertex_buffer(destination, count, byte_stride, so
116
74
 
117
75
  const header = source[0];
118
76
 
119
- if ((header & 0xf0) !== HEADER) {
77
+ if ((header & 0xf0) !== MESHOPT_VERTEX_HEADER) {
120
78
  throw new Error(
121
79
  `meshopt attribute stream starts with 0x${header.toString(16)}, expected 0xa0 or 0xa1`
122
80
  );
@@ -137,7 +95,7 @@ export function meshopt_decode_vertex_buffer(destination, count, byte_stride, so
137
95
  EXT's wording invites, and it is wrong for every stride under 32.
138
96
  */
139
97
  const tail_size = byte_stride + (version === 1 ? channel_count : 0);
140
- const tail_min = TAIL_MIN_BY_VERSION[version];
98
+ const tail_min = MESHOPT_TAIL_MIN_BY_VERSION[version];
141
99
  const tail_size_pad = tail_size < tail_min ? tail_min : tail_size;
142
100
 
143
101
  if (source_end < 1 + tail_size_pad) {
@@ -171,10 +129,7 @@ export function meshopt_decode_vertex_buffer(destination, count, byte_stride, so
171
129
  channel_modes.fill(0, 0, channel_count);
172
130
  }
173
131
 
174
- const max_block_elements = Math.min(
175
- Math.floor(MAX_BLOCK_BYTES / byte_stride) & ~(MESHOPT_GROUP_SIZE - 1),
176
- MAX_BLOCK_ELEMENTS
177
- );
132
+ const max_block_elements = meshopt_max_block_elements(byte_stride);
178
133
 
179
134
  let offset = 1;
180
135
  let element = 0;
@@ -240,7 +195,7 @@ function decode_block(
240
195
  offset = meshopt_decode_data_block(
241
196
  delta_scratch, deltas_offset, group_count,
242
197
  source, offset, source_end,
243
- BITS_VERSION_0
198
+ MESHOPT_BITS_VERSION_0
244
199
  );
245
200
 
246
201
  continue;
@@ -264,7 +219,7 @@ function decode_block(
264
219
  offset = meshopt_decode_data_block(
265
220
  delta_scratch, deltas_offset, group_count,
266
221
  source, offset, source_end,
267
- BITS_BY_CONTROL[control]
222
+ MESHOPT_BITS_BY_CONTROL[control]
268
223
  );
269
224
  }
270
225
  }
@@ -0,0 +1,53 @@
1
+ /**
2
+ * What one group of sixteen deltas costs at a given width, in bytes.
3
+ *
4
+ * The packed codes are fixed-size, so the only thing that varies is how many deltas did not fit and
5
+ * had to be written out whole after them. A delta *equal* to the sentinel does not fit either — the
6
+ * decoder would read it as an escape — which is why the comparison is `>=` and not `>`.
7
+ *
8
+ * Width 0 stores nothing and can therefore only carry a group that is entirely zero; for any other
9
+ * group it is not a choice at all, and this says so with an infinite price rather than a flag the
10
+ * caller has to remember to look at.
11
+ *
12
+ * @param {Uint8Array} deltas
13
+ * @param {number} offset sixteen deltas are read from here
14
+ * @param {number} bits 0, 1, 2, 4 or 8
15
+ * @returns {number} bytes, or `Number.POSITIVE_INFINITY` if the width cannot carry this group
16
+ */
17
+ export function meshopt_byte_group_size(deltas: Uint8Array, offset: number, bits: number): number;
18
+ /**
19
+ * The cheapest width a group can be coded at, out of the four a header value can name.
20
+ *
21
+ * @param {Uint8Array} deltas
22
+ * @param {number} offset
23
+ * @param {number[]} bit_table four entries, each 0, 1, 2, 4 or 8 — what the control mode decided
24
+ * the two stored header bits mean
25
+ * @returns {{header: number, size: number}} the header value to store, and what it costs
26
+ */
27
+ export function meshopt_choose_byte_group_bits(deltas: Uint8Array, offset: number, bit_table: number[]): {
28
+ header: number;
29
+ size: number;
30
+ };
31
+ /**
32
+ * Encode one group of sixteen byte deltas at a chosen width — the inverse of
33
+ * {@link meshopt_decode_byte_group}, and laid out the same way round: the 2-bit and 4-bit packings
34
+ * run from the most significant bit of each byte down, the 1-bit packing the other way.
35
+ *
36
+ * PRECONDITION: `bits` can carry this group, which is what {@link meshopt_choose_byte_group_bits}
37
+ * returns. Passing a width that cannot produces a stream that decodes to different deltas.
38
+ *
39
+ * @param {Uint8Array} destination
40
+ * @param {number} destination_offset
41
+ * @param {Uint8Array} deltas
42
+ * @param {number} deltas_offset sixteen deltas are read from here
43
+ * @param {number} bits 0, 1, 2, 4 or 8
44
+ * @returns {number} the offset just past the group
45
+ */
46
+ export function meshopt_encode_byte_group(destination: Uint8Array, destination_offset: number, deltas: Uint8Array, deltas_offset: number, bits: number): number;
47
+ /**
48
+ * The widths a group can be coded at, cheapest first. {@link meshopt_choose_byte_group_bits} walks
49
+ * this in order, so a tie is settled in favour of the narrower code.
50
+ * @type {number[]}
51
+ */
52
+ export const MESHOPT_GROUP_BITS: number[];
53
+ //# sourceMappingURL=meshopt_encode_byte_group.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"meshopt_encode_byte_group.d.ts","sourceRoot":"","sources":["../../../../../src/core/binary/meshopt/meshopt_encode_byte_group.js"],"names":[],"mappings":"AAUA;;;;;;;;;;;;;;;GAeG;AACH,gDALW,UAAU,UACV,MAAM,QACN,MAAM,GACJ,MAAM,CA8BlB;AAED;;;;;;;;GAQG;AACH,uDANW,UAAU,UACV,MAAM,aACN,MAAM,EAAE,GAEN;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAC,CAmB1C;AAED;;;;;;;;;;;;;;GAcG;AACH,uDAPW,UAAU,sBACV,MAAM,UACN,UAAU,iBACV,MAAM,QACN,MAAM,GACJ,MAAM,CA0ClB;AAxID;;;;GAIG;AACH,iCAFU,MAAM,EAAE,CAEgC"}
@@ -0,0 +1,140 @@
1
+ import { assert } from "../../assert.js";
2
+ import { MESHOPT_GROUP_SIZE } from "./MESHOPT_GROUP_SIZE.js";
3
+
4
+ /**
5
+ * The widths a group can be coded at, cheapest first. {@link meshopt_choose_byte_group_bits} walks
6
+ * this in order, so a tie is settled in favour of the narrower code.
7
+ * @type {number[]}
8
+ */
9
+ export const MESHOPT_GROUP_BITS = [0, 1, 2, 4, 8];
10
+
11
+ /**
12
+ * What one group of sixteen deltas costs at a given width, in bytes.
13
+ *
14
+ * The packed codes are fixed-size, so the only thing that varies is how many deltas did not fit and
15
+ * had to be written out whole after them. A delta *equal* to the sentinel does not fit either — the
16
+ * decoder would read it as an escape — which is why the comparison is `>=` and not `>`.
17
+ *
18
+ * Width 0 stores nothing and can therefore only carry a group that is entirely zero; for any other
19
+ * group it is not a choice at all, and this says so with an infinite price rather than a flag the
20
+ * caller has to remember to look at.
21
+ *
22
+ * @param {Uint8Array} deltas
23
+ * @param {number} offset sixteen deltas are read from here
24
+ * @param {number} bits 0, 1, 2, 4 or 8
25
+ * @returns {number} bytes, or `Number.POSITIVE_INFINITY` if the width cannot carry this group
26
+ */
27
+ export function meshopt_byte_group_size(deltas, offset, bits) {
28
+ assert.isOneOf(bits, MESHOPT_GROUP_BITS, 'bits');
29
+
30
+ if (bits === 8) {
31
+ return MESHOPT_GROUP_SIZE;
32
+ }
33
+
34
+ if (bits === 0) {
35
+ for (let i = 0; i < MESHOPT_GROUP_SIZE; i++) {
36
+ if (deltas[offset + i] !== 0) {
37
+ return Number.POSITIVE_INFINITY;
38
+ }
39
+ }
40
+
41
+ return 0;
42
+ }
43
+
44
+ const sentinel = (1 << bits) - 1;
45
+
46
+ let escapes = 0;
47
+
48
+ for (let i = 0; i < MESHOPT_GROUP_SIZE; i++) {
49
+ if (deltas[offset + i] >= sentinel) {
50
+ escapes++;
51
+ }
52
+ }
53
+
54
+ return MESHOPT_GROUP_SIZE / (8 / bits) + escapes;
55
+ }
56
+
57
+ /**
58
+ * The cheapest width a group can be coded at, out of the four a header value can name.
59
+ *
60
+ * @param {Uint8Array} deltas
61
+ * @param {number} offset
62
+ * @param {number[]} bit_table four entries, each 0, 1, 2, 4 or 8 — what the control mode decided
63
+ * the two stored header bits mean
64
+ * @returns {{header: number, size: number}} the header value to store, and what it costs
65
+ */
66
+ export function meshopt_choose_byte_group_bits(deltas, offset, bit_table) {
67
+ let best_header = 0;
68
+ let best_size = Number.POSITIVE_INFINITY;
69
+
70
+ for (let header = 0; header < 4; header++) {
71
+ const size = meshopt_byte_group_size(deltas, offset, bit_table[header]);
72
+
73
+ if (size < best_size) {
74
+ best_header = header;
75
+ best_size = size;
76
+ }
77
+ }
78
+
79
+ // 8 is in every table that has no 0, and 0 is in every table that has no 8, so one of them fits
80
+ assert.ok(Number.isFinite(best_size), `no width in [${bit_table}] can carry the group at ${offset}`);
81
+
82
+ return { header: best_header, size: best_size };
83
+ }
84
+
85
+ /**
86
+ * Encode one group of sixteen byte deltas at a chosen width — the inverse of
87
+ * {@link meshopt_decode_byte_group}, and laid out the same way round: the 2-bit and 4-bit packings
88
+ * run from the most significant bit of each byte down, the 1-bit packing the other way.
89
+ *
90
+ * PRECONDITION: `bits` can carry this group, which is what {@link meshopt_choose_byte_group_bits}
91
+ * returns. Passing a width that cannot produces a stream that decodes to different deltas.
92
+ *
93
+ * @param {Uint8Array} destination
94
+ * @param {number} destination_offset
95
+ * @param {Uint8Array} deltas
96
+ * @param {number} deltas_offset sixteen deltas are read from here
97
+ * @param {number} bits 0, 1, 2, 4 or 8
98
+ * @returns {number} the offset just past the group
99
+ */
100
+ export function meshopt_encode_byte_group(destination, destination_offset, deltas, deltas_offset, bits) {
101
+ assert.isOneOf(bits, MESHOPT_GROUP_BITS, 'bits');
102
+
103
+ if (bits === 0) {
104
+ return destination_offset;
105
+ }
106
+
107
+ if (bits === 8) {
108
+ for (let i = 0; i < MESHOPT_GROUP_SIZE; i++) {
109
+ destination[destination_offset + i] = deltas[deltas_offset + i];
110
+ }
111
+
112
+ return destination_offset + MESHOPT_GROUP_SIZE;
113
+ }
114
+
115
+ const per_byte = 8 / bits;
116
+ const packed_bytes = MESHOPT_GROUP_SIZE / per_byte;
117
+ const sentinel = (1 << bits) - 1;
118
+
119
+ const ascending = bits === 1;
120
+
121
+ destination.fill(0, destination_offset, destination_offset + packed_bytes);
122
+
123
+ let sentinel_offset = destination_offset + packed_bytes;
124
+
125
+ for (let i = 0; i < MESHOPT_GROUP_SIZE; i++) {
126
+ const delta = deltas[deltas_offset + i];
127
+ const code = delta < sentinel ? delta : sentinel;
128
+
129
+ const lane = i % per_byte;
130
+ const shift = ascending ? (lane * bits) : (8 - bits - lane * bits);
131
+
132
+ destination[destination_offset + ((i / per_byte) | 0)] |= code << shift;
133
+
134
+ if (code === sentinel) {
135
+ destination[sentinel_offset++] = delta;
136
+ }
137
+ }
138
+
139
+ return sentinel_offset;
140
+ }
@@ -0,0 +1,32 @@
1
+ /**
2
+ * Price one "data block" — the delta bytes for a single byte position of the element, across one
3
+ * attribute block's worth of groups — and record the header value each group wants.
4
+ *
5
+ * Every group is priced on its own, because the header spends two bits per group either way: a
6
+ * block of mostly-zero groups with one noisy one pays for the noisy one alone.
7
+ *
8
+ * @param {Uint8Array} deltas
9
+ * @param {number} deltas_offset
10
+ * @param {number} group_count
11
+ * @param {number[]} bit_table four entries, each 0, 1, 2, 4 or 8
12
+ * @param {Uint8Array} choices `group_count` header values are written here
13
+ * @param {number} choices_offset
14
+ * @returns {number} what the block costs in bytes, header included
15
+ */
16
+ export function meshopt_choose_data_block(deltas: Uint8Array, deltas_offset: number, group_count: number, bit_table: number[], choices: Uint8Array, choices_offset: number): number;
17
+ /**
18
+ * Write a data block: `ceil(group_count / 4)` header bytes, two bits per group packed least
19
+ * significant first, then the groups. The inverse of {@link meshopt_decode_data_block}.
20
+ *
21
+ * @param {Uint8Array} destination
22
+ * @param {number} destination_offset
23
+ * @param {Uint8Array} deltas
24
+ * @param {number} deltas_offset
25
+ * @param {number} group_count
26
+ * @param {number[]} bit_table
27
+ * @param {Uint8Array} choices the header values {@link meshopt_choose_data_block} settled on
28
+ * @param {number} choices_offset
29
+ * @returns {number} the offset just past the data block
30
+ */
31
+ export function meshopt_encode_data_block(destination: Uint8Array, destination_offset: number, deltas: Uint8Array, deltas_offset: number, group_count: number, bit_table: number[], choices: Uint8Array, choices_offset: number): number;
32
+ //# sourceMappingURL=meshopt_encode_data_block.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"meshopt_encode_data_block.d.ts","sourceRoot":"","sources":["../../../../../src/core/binary/meshopt/meshopt_encode_data_block.js"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;GAcG;AACH,kDARW,UAAU,iBACV,MAAM,eACN,MAAM,aACN,MAAM,EAAE,WACR,UAAU,kBACV,MAAM,GACJ,MAAM,CAkBlB;AAED;;;;;;;;;;;;;GAaG;AACH,uDAVW,UAAU,sBACV,MAAM,UACN,UAAU,iBACV,MAAM,eACN,MAAM,aACN,MAAM,EAAE,WACR,UAAU,kBACV,MAAM,GACJ,MAAM,CA4BlB"}
@@ -0,0 +1,77 @@
1
+ import { MESHOPT_GROUP_SIZE } from "./MESHOPT_GROUP_SIZE.js";
2
+ import { meshopt_choose_byte_group_bits, meshopt_encode_byte_group } from "./meshopt_encode_byte_group.js";
3
+
4
+ /**
5
+ * Price one "data block" — the delta bytes for a single byte position of the element, across one
6
+ * attribute block's worth of groups — and record the header value each group wants.
7
+ *
8
+ * Every group is priced on its own, because the header spends two bits per group either way: a
9
+ * block of mostly-zero groups with one noisy one pays for the noisy one alone.
10
+ *
11
+ * @param {Uint8Array} deltas
12
+ * @param {number} deltas_offset
13
+ * @param {number} group_count
14
+ * @param {number[]} bit_table four entries, each 0, 1, 2, 4 or 8
15
+ * @param {Uint8Array} choices `group_count` header values are written here
16
+ * @param {number} choices_offset
17
+ * @returns {number} what the block costs in bytes, header included
18
+ */
19
+ export function meshopt_choose_data_block(
20
+ deltas, deltas_offset,
21
+ group_count,
22
+ bit_table,
23
+ choices, choices_offset
24
+ ) {
25
+ let size = (group_count + 3) >> 2;
26
+
27
+ for (let g = 0; g < group_count; g++) {
28
+ const choice = meshopt_choose_byte_group_bits(deltas, deltas_offset + g * MESHOPT_GROUP_SIZE, bit_table);
29
+
30
+ choices[choices_offset + g] = choice.header;
31
+ size += choice.size;
32
+ }
33
+
34
+ return size;
35
+ }
36
+
37
+ /**
38
+ * Write a data block: `ceil(group_count / 4)` header bytes, two bits per group packed least
39
+ * significant first, then the groups. The inverse of {@link meshopt_decode_data_block}.
40
+ *
41
+ * @param {Uint8Array} destination
42
+ * @param {number} destination_offset
43
+ * @param {Uint8Array} deltas
44
+ * @param {number} deltas_offset
45
+ * @param {number} group_count
46
+ * @param {number[]} bit_table
47
+ * @param {Uint8Array} choices the header values {@link meshopt_choose_data_block} settled on
48
+ * @param {number} choices_offset
49
+ * @returns {number} the offset just past the data block
50
+ */
51
+ export function meshopt_encode_data_block(
52
+ destination, destination_offset,
53
+ deltas, deltas_offset,
54
+ group_count,
55
+ bit_table,
56
+ choices, choices_offset
57
+ ) {
58
+ const header_bytes = (group_count + 3) >> 2;
59
+
60
+ destination.fill(0, destination_offset, destination_offset + header_bytes);
61
+
62
+ let offset = destination_offset + header_bytes;
63
+
64
+ for (let g = 0; g < group_count; g++) {
65
+ const header = choices[choices_offset + g];
66
+
67
+ destination[destination_offset + (g >> 2)] |= header << ((g & 3) * 2);
68
+
69
+ offset = meshopt_encode_byte_group(
70
+ destination, offset,
71
+ deltas, deltas_offset + g * MESHOPT_GROUP_SIZE,
72
+ bit_table[header]
73
+ );
74
+ }
75
+
76
+ return offset;
77
+ }
@@ -0,0 +1,46 @@
1
+ /**
2
+ * Encode an index stream of no particular topology — the `"INDICES"` mode of both meshopt
3
+ * extensions, and the inverse of {@link meshopt_decode_index_sequence}.
4
+ *
5
+ * Each index is a zigzag delta against one of *two* running baselines, and which one is the low bit
6
+ * of the stored value. Two rather than one is what lets two independently monotonic runs be spliced
7
+ * together and still pay one small delta per index — a triangle strip's own indices against one, a
8
+ * degenerate seam against the other — so the choice is where the compression is, and it is made per
9
+ * index by pricing both:
10
+ *
11
+ * - the baseline whose delta encodes in fewer bytes wins;
12
+ * - a tie goes to the smaller delta, which leaves both baselines nearer the runs they are tracking;
13
+ * - a tie in that too goes to baseline 0, which keeps baseline 1 free for a run that has not
14
+ * started yet.
15
+ *
16
+ * Greedy, and deliberately so: a baseline that is cheap now is cheap because it is near, and near is
17
+ * what makes it cheap again next time.
18
+ *
19
+ * A baseline both of whose deltas are further away than {@link MESHOPT_INDEX_SEQUENCE_MAX_DELTA} is
20
+ * not a choice at all, and an index that is out of reach of both is refused.
21
+ *
22
+ * @see https://github.com/KhronosGroup/glTF/tree/main/extensions/2.0/Khronos/KHR_meshopt_compression
23
+ *
24
+ * @param {ArrayLike<number>} indices unsigned 32-bit
25
+ * @param {Object} [options]
26
+ * @param {number} [options.version] 0 or 1, defaulting to 1 — the two are the same bitstream, and
27
+ * the nibble is there for a codec change that has not happened
28
+ * @returns {Uint8Array} the whole compressed stream, reserved tail included
29
+ * @throws {Error} on an index further than {@link MESHOPT_INDEX_SEQUENCE_MAX_DELTA} from both
30
+ * baselines, which the format has no way to write down
31
+ */
32
+ export function meshopt_encode_index_sequence(indices: ArrayLike<number>, options?: {
33
+ version?: number;
34
+ }): Uint8Array;
35
+ /**
36
+ * How far one index may sit from the baseline it is coded against.
37
+ *
38
+ * The stored value spends its low bit on which baseline, leaving thirty-one for the zigzag, whose
39
+ * own low bit is the sign — so the delta has thirty bits and a sign, and half of the 32-bit index
40
+ * range is out of reach of any one step. Nothing that indexes a real vertex buffer comes near it,
41
+ * but a stream that crossed it would decode to different indices rather than fail, so it is checked.
42
+ *
43
+ * @type {number}
44
+ */
45
+ export const MESHOPT_INDEX_SEQUENCE_MAX_DELTA: number;
46
+ //# sourceMappingURL=meshopt_encode_index_sequence.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"meshopt_encode_index_sequence.d.ts","sourceRoot":"","sources":["../../../../../src/core/binary/meshopt/meshopt_encode_index_sequence.js"],"names":[],"mappings":"AA2BA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,uDARW,UAAU,MAAM,CAAC;IAEA,OAAO,GAAxB,MAAM;IAEJ,UAAU,CA2DtB;AAlGD;;;;;;;;;GASG;AACH,+CAFU,MAAM,CAEwC"}