@woosh/meep-engine 3.43.0 → 3.45.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 (466) hide show
  1. package/build/bundle-worker-terrain.js +1 -1
  2. package/editor/prototypeEditorShell.d.ts.map +1 -1
  3. package/editor/prototypeEditorShell.js +4 -2
  4. package/package.json +1 -1
  5. package/src/core/collection/array/array_sort_insertion_ascending.d.ts +19 -0
  6. package/src/core/collection/array/array_sort_insertion_ascending.d.ts.map +1 -0
  7. package/src/core/collection/array/array_sort_insertion_ascending.js +31 -0
  8. package/src/core/geom/3d/aabb/aabb3_array_round_outward_f32.d.ts +27 -0
  9. package/src/core/geom/3d/aabb/aabb3_array_round_outward_f32.d.ts.map +1 -0
  10. package/src/core/geom/3d/aabb/aabb3_array_round_outward_f32.js +39 -0
  11. package/src/core/geom/3d/aabb/aabb3_from_v3_array.d.ts.map +1 -1
  12. package/src/core/geom/3d/aabb/aabb3_from_v3_array.js +4 -1
  13. package/src/core/geom/3d/aabb/aabb3_transform_oriented.d.ts +2 -2
  14. package/src/core/geom/3d/aabb/aabb3_transform_oriented.d.ts.map +1 -1
  15. package/src/core/geom/3d/aabb/aabb3_transform_oriented.js +1 -1
  16. package/src/core/geom/3d/pose/pose3_apply_inverse_point_array.d.ts +21 -0
  17. package/src/core/geom/3d/pose/pose3_apply_inverse_point_array.d.ts.map +1 -0
  18. package/src/core/geom/3d/pose/pose3_apply_inverse_point_array.js +36 -0
  19. package/src/core/geom/3d/pose/pose3_apply_point_array.d.ts +25 -0
  20. package/src/core/geom/3d/pose/pose3_apply_point_array.d.ts.map +1 -0
  21. package/src/core/geom/3d/pose/pose3_apply_point_array.js +40 -0
  22. package/src/core/geom/3d/pose/pose3_compose_array.d.ts +28 -0
  23. package/src/core/geom/3d/pose/pose3_compose_array.d.ts.map +1 -0
  24. package/src/core/geom/3d/pose/pose3_compose_array.js +41 -0
  25. package/src/core/geom/3d/pose/pose3_to_local_array.d.ts +29 -0
  26. package/src/core/geom/3d/pose/pose3_to_local_array.d.ts.map +1 -0
  27. package/src/core/geom/3d/pose/pose3_to_local_array.js +42 -0
  28. package/src/core/geom/3d/quaternion/quat3_clamp_angle_array.d.ts +28 -0
  29. package/src/core/geom/3d/quaternion/quat3_clamp_angle_array.d.ts.map +1 -0
  30. package/src/core/geom/3d/quaternion/quat3_clamp_angle_array.js +66 -0
  31. package/src/core/geom/3d/quaternion/quat3_multiply_conjugate_left_array.d.ts +22 -0
  32. package/src/core/geom/3d/quaternion/quat3_multiply_conjugate_left_array.d.ts.map +1 -0
  33. package/src/core/geom/3d/quaternion/quat3_multiply_conjugate_left_array.js +30 -0
  34. package/src/core/geom/3d/quaternion/quat3_multiply_conjugate_right_array.d.ts +23 -0
  35. package/src/core/geom/3d/quaternion/quat3_multiply_conjugate_right_array.d.ts.map +1 -0
  36. package/src/core/geom/3d/quaternion/quat3_multiply_conjugate_right_array.js +31 -0
  37. package/src/core/geom/3d/triangle/tri3_compute_normal_area_weighted_array.d.ts +26 -0
  38. package/src/core/geom/3d/triangle/tri3_compute_normal_area_weighted_array.d.ts.map +1 -0
  39. package/src/core/geom/3d/triangle/tri3_compute_normal_area_weighted_array.js +46 -0
  40. package/src/core/geom/vec3/v3_distance_array.d.ts +11 -0
  41. package/src/core/geom/vec3/v3_distance_array.d.ts.map +1 -0
  42. package/src/core/geom/vec3/v3_distance_array.js +19 -0
  43. package/src/core/geom/vec3/v3_normalize_array_checked.d.ts +23 -0
  44. package/src/core/geom/vec3/v3_normalize_array_checked.d.ts.map +1 -0
  45. package/src/core/geom/vec3/v3_normalize_array_checked.js +49 -0
  46. package/src/core/geom/vec3/v3_reject_array.d.ts +15 -0
  47. package/src/core/geom/vec3/v3_reject_array.d.ts.map +1 -0
  48. package/src/core/geom/vec3/v3_reject_array.js +32 -0
  49. package/src/core/graph/csr/csr_build_incidence.d.ts +26 -0
  50. package/src/core/graph/csr/csr_build_incidence.d.ts.map +1 -0
  51. package/src/core/graph/csr/csr_build_incidence.js +71 -0
  52. package/src/core/graph/csr/csr_graph_color_greedy.d.ts +25 -0
  53. package/src/core/graph/csr/csr_graph_color_greedy.d.ts.map +1 -0
  54. package/src/core/graph/csr/csr_graph_color_greedy.js +83 -0
  55. package/src/core/graph/csr/csr_graph_validate_coloring.d.ts +15 -0
  56. package/src/core/graph/csr/csr_graph_validate_coloring.d.ts.map +1 -0
  57. package/src/core/graph/csr/csr_graph_validate_coloring.js +33 -0
  58. package/src/core/math/linalg/matrix_symmetric_3x3_solve_ldlt.d.ts +26 -0
  59. package/src/core/math/linalg/matrix_symmetric_3x3_solve_ldlt.d.ts.map +1 -0
  60. package/src/core/math/linalg/matrix_symmetric_3x3_solve_ldlt.js +71 -0
  61. package/src/core/math/max2_exact.d.ts +15 -0
  62. package/src/core/math/max2_exact.d.ts.map +1 -0
  63. package/src/core/math/max2_exact.js +30 -0
  64. package/src/core/math/min2_exact.d.ts +20 -0
  65. package/src/core/math/min2_exact.d.ts.map +1 -0
  66. package/src/core/math/min2_exact.js +35 -0
  67. package/src/engine/Clock.d.ts +15 -0
  68. package/src/engine/Clock.d.ts.map +1 -1
  69. package/src/engine/Clock.js +29 -5
  70. package/src/engine/Engine.d.ts.map +1 -1
  71. package/src/engine/Engine.js +11 -19
  72. package/src/engine/ecs/ik/IKGoalSystem.d.ts.map +1 -1
  73. package/src/engine/ecs/ik/IKGoalSystem.js +3 -19
  74. package/src/engine/ecs/parent/parent_entity_model_of.d.ts +17 -0
  75. package/src/engine/ecs/parent/parent_entity_model_of.d.ts.map +1 -0
  76. package/src/engine/ecs/parent/parent_entity_model_of.js +26 -0
  77. package/src/engine/ecs/transform/t64_read_pose_array.d.ts +15 -0
  78. package/src/engine/ecs/transform/t64_read_pose_array.d.ts.map +1 -0
  79. package/src/engine/ecs/transform/t64_read_pose_array.js +24 -0
  80. package/src/engine/graphics/ecs/mesh-v2/MeshSkin.d.ts +57 -0
  81. package/src/engine/graphics/ecs/mesh-v2/MeshSkin.d.ts.map +1 -0
  82. package/src/engine/graphics/ecs/mesh-v2/MeshSkin.js +84 -0
  83. package/src/engine/graphics/geometry/geometry_construct_triangle_normal_area_weighted.d.ts +2 -0
  84. package/src/engine/graphics/geometry/geometry_construct_triangle_normal_area_weighted.d.ts.map +1 -1
  85. package/src/engine/graphics/geometry/geometry_construct_triangle_normal_area_weighted.js +10 -21
  86. package/src/engine/graphics3/AnimationGraphSystem.d.ts +28 -13
  87. package/src/engine/graphics3/AnimationGraphSystem.d.ts.map +1 -1
  88. package/src/engine/graphics3/AnimationGraphSystem.js +107 -64
  89. package/src/engine/graphics3/AnimationSystem.d.ts +29 -15
  90. package/src/engine/graphics3/AnimationSystem.d.ts.map +1 -1
  91. package/src/engine/graphics3/AnimationSystem.js +112 -61
  92. package/src/engine/graphics3/MeshSkinSystem.d.ts +56 -0
  93. package/src/engine/graphics3/MeshSkinSystem.d.ts.map +1 -0
  94. package/src/engine/graphics3/MeshSkinSystem.js +317 -0
  95. package/src/engine/graphics3/MeshSystem.d.ts +15 -35
  96. package/src/engine/graphics3/MeshSystem.d.ts.map +1 -1
  97. package/src/engine/graphics3/MeshSystem.js +21 -298
  98. package/src/engine/graphics3/RowChains.d.ts +76 -0
  99. package/src/engine/graphics3/RowChains.d.ts.map +1 -0
  100. package/src/engine/graphics3/RowChains.js +347 -0
  101. package/src/engine/graphics3/ShadedGeometrySystem.d.ts +6 -0
  102. package/src/engine/graphics3/ShadedGeometrySystem.d.ts.map +1 -1
  103. package/src/engine/graphics3/ShadedGeometrySystem.js +329 -309
  104. package/src/engine/graphics3/animation/AnimationClips.d.ts +56 -0
  105. package/src/engine/graphics3/animation/AnimationClips.d.ts.map +1 -0
  106. package/src/engine/graphics3/animation/AnimationClips.js +79 -0
  107. package/src/engine/graphics3/animation/ClipListPlayer.d.ts +13 -14
  108. package/src/engine/graphics3/animation/ClipListPlayer.d.ts.map +1 -1
  109. package/src/engine/graphics3/animation/ClipListPlayer.js +262 -263
  110. package/src/engine/graphics3/animation/write_clip_playback.d.ts +3 -3
  111. package/src/engine/graphics3/animation/write_clip_playback.js +4 -4
  112. package/src/engine/graphics3/pose/query_entity_node_world_pose.d.ts +5 -0
  113. package/src/engine/graphics3/pose/query_entity_node_world_pose.d.ts.map +1 -1
  114. package/src/engine/graphics3/pose/query_entity_node_world_pose.js +80 -75
  115. package/src/engine/graphics3/prefab/PrefabInstance.d.ts +4 -24
  116. package/src/engine/graphics3/prefab/PrefabInstance.d.ts.map +1 -1
  117. package/src/engine/graphics3/prefab/PrefabInstance.js +60 -80
  118. package/src/engine/graphics3/prefab/prefab_instantiate.d.ts +16 -3
  119. package/src/engine/graphics3/prefab/prefab_instantiate.d.ts.map +1 -1
  120. package/src/engine/graphics3/prefab/prefab_instantiate.js +49 -12
  121. package/src/engine/graphics3/prefab/prefab_place.d.ts +31 -17
  122. package/src/engine/graphics3/prefab/prefab_place.d.ts.map +1 -1
  123. package/src/engine/graphics3/prefab/prefab_place.js +175 -130
  124. package/src/engine/graphics3/register_clips.d.ts +93 -0
  125. package/src/engine/graphics3/register_clips.d.ts.map +1 -0
  126. package/src/engine/graphics3/register_clips.js +166 -0
  127. package/src/engine/physics/broadphase/compute_fat_world_aabb.d.ts +9 -0
  128. package/src/engine/physics/broadphase/compute_fat_world_aabb.d.ts.map +1 -1
  129. package/src/engine/physics/broadphase/compute_fat_world_aabb.js +3 -1
  130. package/src/engine/physics/cloth/MEASUREMENTS.md +795 -0
  131. package/src/engine/physics/cloth/PLAN.md +349 -17
  132. package/src/engine/physics/cloth/build/ClothProxy.d.ts +113 -61
  133. package/src/engine/physics/cloth/build/ClothProxy.d.ts.map +1 -1
  134. package/src/engine/physics/cloth/build/ClothProxy.js +142 -77
  135. package/src/engine/physics/cloth/build/cloth_bind_in_frame.d.ts +44 -0
  136. package/src/engine/physics/cloth/build/cloth_bind_in_frame.d.ts.map +1 -0
  137. package/src/engine/physics/cloth/build/cloth_bind_in_frame.js +107 -0
  138. package/src/engine/physics/cloth/build/cloth_proxy_from_joints.d.ts +43 -30
  139. package/src/engine/physics/cloth/build/cloth_proxy_from_joints.d.ts.map +1 -1
  140. package/src/engine/physics/cloth/build/cloth_proxy_from_joints.js +371 -284
  141. package/src/engine/physics/cloth/build/cloth_proxy_from_mesh.d.ts +62 -0
  142. package/src/engine/physics/cloth/build/cloth_proxy_from_mesh.d.ts.map +1 -0
  143. package/src/engine/physics/cloth/build/cloth_proxy_from_mesh.js +275 -0
  144. package/src/engine/physics/cloth/collider/ClothColliderIndex.d.ts +7 -0
  145. package/src/engine/physics/cloth/collider/ClothColliderIndex.d.ts.map +1 -1
  146. package/src/engine/physics/cloth/collider/ClothColliderIndex.js +85 -67
  147. package/src/engine/physics/cloth/collider/cloth_collider_bounds.d.ts.map +1 -1
  148. package/src/engine/physics/cloth/collider/cloth_collider_bounds.js +19 -101
  149. package/src/engine/physics/cloth/collider/cloth_collider_pack.d.ts +2 -5
  150. package/src/engine/physics/cloth/collider/cloth_collider_pack.d.ts.map +1 -1
  151. package/src/engine/physics/cloth/collider/cloth_collider_pack.js +7 -15
  152. package/src/engine/physics/cloth/collider/cloth_collider_sdf.d.ts +1 -1
  153. package/src/engine/physics/cloth/collider/cloth_collider_sdf.d.ts.map +1 -1
  154. package/src/engine/physics/cloth/collider/cloth_collider_sdf.js +17 -62
  155. package/src/engine/physics/cloth/ecs/Cloth.d.ts +17 -9
  156. package/src/engine/physics/cloth/ecs/Cloth.d.ts.map +1 -1
  157. package/src/engine/physics/cloth/ecs/Cloth.js +220 -212
  158. package/src/engine/physics/cloth/ecs/ClothColliderFlags.d.ts +0 -1
  159. package/src/engine/physics/cloth/ecs/ClothColliderFlags.js +6 -19
  160. package/src/engine/physics/cloth/ecs/ClothColliderSystem.d.ts +1 -2
  161. package/src/engine/physics/cloth/ecs/ClothColliderSystem.d.ts.map +1 -1
  162. package/src/engine/physics/cloth/ecs/ClothColliderSystem.js +3 -12
  163. package/src/engine/physics/cloth/ecs/ClothDynamicsFlags.js +6 -0
  164. package/src/engine/physics/cloth/ecs/ClothHold.d.ts +91 -0
  165. package/src/engine/physics/cloth/ecs/ClothHold.d.ts.map +1 -0
  166. package/src/engine/physics/cloth/ecs/ClothHold.js +103 -0
  167. package/src/engine/physics/cloth/ecs/ClothInstance.d.ts +254 -48
  168. package/src/engine/physics/cloth/ecs/ClothInstance.d.ts.map +1 -1
  169. package/src/engine/physics/cloth/ecs/ClothInstance.js +277 -47
  170. package/src/engine/physics/cloth/ecs/ClothPin.d.ts +73 -0
  171. package/src/engine/physics/cloth/ecs/ClothPin.d.ts.map +1 -0
  172. package/src/engine/physics/cloth/ecs/ClothPin.js +92 -0
  173. package/src/engine/physics/cloth/ecs/ClothPinSerializationAdapter.d.ts +36 -0
  174. package/src/engine/physics/cloth/ecs/ClothPinSerializationAdapter.d.ts.map +1 -0
  175. package/src/engine/physics/cloth/ecs/ClothPinSerializationAdapter.js +61 -0
  176. package/src/engine/physics/cloth/ecs/ClothRig.d.ts +23 -17
  177. package/src/engine/physics/cloth/ecs/ClothRig.d.ts.map +1 -1
  178. package/src/engine/physics/cloth/ecs/ClothRig.js +29 -27
  179. package/src/engine/physics/cloth/ecs/ClothSystem.d.ts +12 -14
  180. package/src/engine/physics/cloth/ecs/ClothSystem.d.ts.map +1 -1
  181. package/src/engine/physics/cloth/ecs/ClothSystem.js +20 -15
  182. package/src/engine/physics/cloth/ecs/ClothWorld.d.ts +57 -36
  183. package/src/engine/physics/cloth/ecs/ClothWorld.d.ts.map +1 -1
  184. package/src/engine/physics/cloth/ecs/ClothWorld.js +754 -207
  185. package/src/engine/physics/cloth/ecs/WorkerClothSystem.d.ts +12 -13
  186. package/src/engine/physics/cloth/ecs/WorkerClothSystem.d.ts.map +1 -1
  187. package/src/engine/physics/cloth/ecs/WorkerClothSystem.js +20 -14
  188. package/src/engine/physics/cloth/ecs/cloth_build_rows.d.ts +63 -11
  189. package/src/engine/physics/cloth/ecs/cloth_build_rows.d.ts.map +1 -1
  190. package/src/engine/physics/cloth/ecs/cloth_build_rows.js +297 -101
  191. package/src/engine/physics/cloth/ecs/cloth_dynamics_map.d.ts +9 -7
  192. package/src/engine/physics/cloth/ecs/cloth_dynamics_map.d.ts.map +1 -1
  193. package/src/engine/physics/cloth/ecs/cloth_dynamics_map.js +12 -10
  194. package/src/engine/physics/cloth/ecs/cloth_gather_colliders.d.ts +3 -3
  195. package/src/engine/physics/cloth/ecs/cloth_gather_colliders.d.ts.map +1 -1
  196. package/src/engine/physics/cloth/ecs/cloth_gather_colliders.js +60 -120
  197. package/src/engine/physics/cloth/ecs/cloth_geodesic.d.ts +37 -0
  198. package/src/engine/physics/cloth/ecs/cloth_geodesic.d.ts.map +1 -0
  199. package/src/engine/physics/cloth/ecs/cloth_geodesic.js +135 -0
  200. package/src/engine/physics/cloth/ecs/cloth_holds.d.ts +97 -0
  201. package/src/engine/physics/cloth/ecs/cloth_holds.d.ts.map +1 -0
  202. package/src/engine/physics/cloth/ecs/cloth_holds.js +583 -0
  203. package/src/engine/physics/cloth/ecs/cloth_reconstruct_pose.d.ts +2 -2
  204. package/src/engine/physics/cloth/ecs/cloth_reconstruct_pose.d.ts.map +1 -1
  205. package/src/engine/physics/cloth/ecs/cloth_reconstruct_pose.js +168 -51
  206. package/src/engine/physics/cloth/ecs/cloth_seed_rig.d.ts +17 -22
  207. package/src/engine/physics/cloth/ecs/cloth_seed_rig.d.ts.map +1 -1
  208. package/src/engine/physics/cloth/ecs/cloth_seed_rig.js +55 -117
  209. package/src/engine/physics/cloth/ecs/cloth_seed_subtree.d.ts +21 -6
  210. package/src/engine/physics/cloth/ecs/cloth_seed_subtree.d.ts.map +1 -1
  211. package/src/engine/physics/cloth/ecs/cloth_seed_subtree.js +51 -42
  212. package/src/engine/physics/cloth/ecs/cloth_write_back.d.ts +5 -0
  213. package/src/engine/physics/cloth/ecs/cloth_write_back.d.ts.map +1 -1
  214. package/src/engine/physics/cloth/ecs/cloth_write_back.js +62 -50
  215. package/src/engine/physics/cloth/ecs/cloth_write_back_rig.d.ts.map +1 -1
  216. package/src/engine/physics/cloth/ecs/cloth_write_back_rig.js +65 -58
  217. package/src/engine/physics/cloth/playground/cloth_playground_build.d.ts.map +1 -1
  218. package/src/engine/physics/cloth/playground/cloth_playground_build.js +2 -3
  219. package/src/engine/physics/cloth/playground/collide_main.js +3 -29
  220. package/src/engine/physics/cloth/playground/garment_build.d.ts.map +1 -1
  221. package/src/engine/physics/cloth/playground/garment_build.js +17 -5
  222. package/src/engine/physics/cloth/playground/garment_main.js +5 -20
  223. package/src/engine/physics/cloth/playground/main.js +6 -48
  224. package/src/engine/physics/cloth/playground/rig_build.d.ts.map +1 -1
  225. package/src/engine/physics/cloth/playground/rig_build.js +302 -296
  226. package/src/engine/physics/cloth/playground/rig_main.js +947 -955
  227. package/src/engine/physics/cloth/playground/wind_main.js +8 -7
  228. package/src/engine/physics/cloth/solver/ClothState.d.ts +45 -7
  229. package/src/engine/physics/cloth/solver/ClothState.d.ts.map +1 -1
  230. package/src/engine/physics/cloth/solver/ClothState.js +79 -83
  231. package/src/engine/physics/cloth/solver/cloth_color_particles.d.ts +10 -8
  232. package/src/engine/physics/cloth/solver/cloth_color_particles.d.ts.map +1 -1
  233. package/src/engine/physics/cloth/solver/cloth_color_particles.js +30 -102
  234. package/src/engine/physics/cloth/solver/cloth_contact_find.d.ts +6 -1
  235. package/src/engine/physics/cloth/solver/cloth_contact_find.d.ts.map +1 -1
  236. package/src/engine/physics/cloth/solver/cloth_contact_find.js +9 -3
  237. package/src/engine/physics/cloth/solver/cloth_hold_line.d.ts +114 -0
  238. package/src/engine/physics/cloth/solver/cloth_hold_line.d.ts.map +1 -0
  239. package/src/engine/physics/cloth/solver/cloth_hold_line.js +350 -0
  240. package/src/engine/physics/cloth/solver/cloth_kinetic_energy.d.ts +21 -0
  241. package/src/engine/physics/cloth/solver/cloth_kinetic_energy.d.ts.map +1 -0
  242. package/src/engine/physics/cloth/solver/cloth_kinetic_energy.js +45 -0
  243. package/src/engine/physics/cloth/solver/cloth_particle_coupling.d.ts +32 -0
  244. package/src/engine/physics/cloth/solver/cloth_particle_coupling.d.ts.map +1 -0
  245. package/src/engine/physics/cloth/solver/cloth_particle_coupling.js +133 -0
  246. package/src/engine/physics/cloth/solver/cloth_particle_of_source.d.ts +16 -0
  247. package/src/engine/physics/cloth/solver/cloth_particle_of_source.d.ts.map +1 -0
  248. package/src/engine/physics/cloth/solver/cloth_particle_of_source.js +19 -0
  249. package/src/engine/physics/cloth/solver/cloth_self_find.d.ts +6 -2
  250. package/src/engine/physics/cloth/solver/cloth_self_find.d.ts.map +1 -1
  251. package/src/engine/physics/cloth/solver/cloth_self_find.js +19 -68
  252. package/src/engine/physics/cloth/solver/cloth_solve_vertex.d.ts.map +1 -1
  253. package/src/engine/physics/cloth/solver/cloth_solve_vertex.js +30 -65
  254. package/src/engine/physics/cloth/solver/cloth_solver_constants.d.ts +24 -12
  255. package/src/engine/physics/cloth/solver/cloth_solver_constants.d.ts.map +1 -1
  256. package/src/engine/physics/cloth/solver/cloth_solver_constants.js +24 -12
  257. package/src/engine/physics/cloth/solver/cloth_step.d.ts +16 -0
  258. package/src/engine/physics/cloth/solver/cloth_step.d.ts.map +1 -1
  259. package/src/engine/physics/cloth/solver/cloth_step.js +189 -48
  260. package/src/engine/physics/cloth/solver/cloth_step_instance.d.ts +1 -0
  261. package/src/engine/physics/cloth/solver/cloth_step_instance.d.ts.map +1 -1
  262. package/src/engine/physics/cloth/solver/cloth_step_instance.js +12 -6
  263. package/src/engine/physics/cloth/solver/cloth_stretch_residual.d.ts +21 -0
  264. package/src/engine/physics/cloth/solver/cloth_stretch_residual.d.ts.map +1 -0
  265. package/src/engine/physics/cloth/solver/cloth_stretch_residual.js +54 -0
  266. package/src/engine/physics/cloth/solver/cloth_vertex_accumulator.d.ts +15 -0
  267. package/src/engine/physics/cloth/solver/cloth_vertex_accumulator.d.ts.map +1 -1
  268. package/src/engine/physics/cloth/solver/cloth_vertex_accumulator.js +28 -0
  269. package/src/engine/physics/cloth/solver/cloth_worst_tether_ratio.d.ts +30 -0
  270. package/src/engine/physics/cloth/solver/cloth_worst_tether_ratio.d.ts.map +1 -0
  271. package/src/engine/physics/cloth/solver/cloth_worst_tether_ratio.js +56 -0
  272. package/src/engine/physics/cloth/solver/constraint/cloth_contact_row.d.ts.map +1 -1
  273. package/src/engine/physics/cloth/solver/constraint/cloth_contact_row.js +3 -17
  274. package/src/engine/physics/cloth/solver/constraint/cloth_leash_row.d.ts +1 -1
  275. package/src/engine/physics/cloth/solver/constraint/cloth_leash_row.d.ts.map +1 -1
  276. package/src/engine/physics/cloth/solver/constraint/cloth_leash_row.js +353 -346
  277. package/src/engine/physics/cloth/solver/constraint/cloth_self_row.d.ts +7 -5
  278. package/src/engine/physics/cloth/solver/constraint/cloth_self_row.d.ts.map +1 -1
  279. package/src/engine/physics/cloth/solver/constraint/cloth_self_row.js +7 -5
  280. package/src/engine/physics/cloth/wind/ClothFluidWind.d.ts +2 -1
  281. package/src/engine/physics/cloth/wind/ClothFluidWind.d.ts.map +1 -1
  282. package/src/engine/physics/cloth/wind/ClothFluidWind.js +7 -25
  283. package/src/engine/physics/cloth/wind/cloth_sample_air.d.ts +12 -10
  284. package/src/engine/physics/cloth/wind/cloth_sample_air.d.ts.map +1 -1
  285. package/src/engine/physics/cloth/wind/cloth_sample_air.js +60 -82
  286. package/src/engine/physics/ecs/ContactProbeSystem.d.ts.map +1 -1
  287. package/src/engine/physics/ecs/ContactProbeSystem.js +2 -18
  288. package/src/engine/physics/ecs/PhysicsSystem.d.ts.map +1 -1
  289. package/src/engine/physics/ecs/PhysicsSystem.js +9 -50
  290. package/src/engine/physics/fluid/ecs/FluidObstacleSystem.d.ts +4 -4
  291. package/src/engine/physics/fluid/ecs/fluid_sample_domain_bounds.d.ts +24 -0
  292. package/src/engine/physics/fluid/ecs/fluid_sample_domain_bounds.d.ts.map +1 -0
  293. package/src/engine/physics/fluid/ecs/fluid_sample_domain_bounds.js +42 -0
  294. package/src/engine/physics/fluid/ecs/fluid_sample_velocity_world_mps.d.ts +25 -0
  295. package/src/engine/physics/fluid/ecs/fluid_sample_velocity_world_mps.d.ts.map +1 -0
  296. package/src/engine/physics/fluid/ecs/fluid_sample_velocity_world_mps.js +40 -0
  297. package/src/engine/physics/inverse_kinematics/frame_fabrik/frame_fabrik_solve.d.ts.map +1 -1
  298. package/src/engine/physics/inverse_kinematics/frame_fabrik/frame_fabrik_solve.js +40 -90
  299. package/src/engine/physics/narrowphase/capsule_contacts.d.ts.map +1 -1
  300. package/src/engine/physics/narrowphase/capsule_contacts.js +3 -5
  301. package/src/engine/physics/narrowphase/decomposition/mesh_enumerate_triangles.d.ts.map +1 -1
  302. package/src/engine/physics/narrowphase/decomposition/mesh_enumerate_triangles.js +2 -14
  303. package/src/engine/physics/narrowphase/hull_sphere_contact.d.ts.map +1 -1
  304. package/src/engine/physics/narrowphase/hull_sphere_contact.js +2 -5
  305. package/src/engine/physics/narrowphase/narrowphase_step.d.ts.map +1 -1
  306. package/src/engine/physics/narrowphase/narrowphase_step.js +13 -32
  307. package/src/engine/physics/narrowphase/sphere_box_contact.d.ts.map +1 -1
  308. package/src/engine/physics/narrowphase/sphere_box_contact.js +2 -5
  309. package/src/engine/simulation/Ticker.d.ts +13 -0
  310. package/src/engine/simulation/Ticker.d.ts.map +1 -1
  311. package/src/engine/simulation/Ticker.js +43 -8
  312. package/src/format/texture/basis/transcode/etc1s_to_astc.d.ts.map +1 -1
  313. package/src/format/texture/basis/transcode/etc1s_to_astc.js +2 -1
  314. package/src/shade/RENDERER_CONTRACT.md +8 -2
  315. package/src/shade/playground/image_decode_bench/main.js +2 -1
  316. package/src/shade/playground/mesh_row_ceiling/main.js +2 -1
  317. package/src/shade/playground/skinned_blas_refit/diff_traced_against_rasterized.d.ts.map +1 -1
  318. package/src/shade/playground/skinned_blas_refit/diff_traced_against_rasterized.js +2 -1
  319. package/src/shade/playground/skinned_blas_refit/main.d.ts.map +1 -1
  320. package/src/shade/playground/skinned_blas_refit/main.js +11 -19
  321. package/src/shade/playground/skinned_blas_refit/place_character.d.ts +6 -3
  322. package/src/shade/playground/skinned_blas_refit/place_character.d.ts.map +1 -1
  323. package/src/shade/playground/skinned_blas_refit/place_character.js +90 -90
  324. package/src/shade/playground/skinned_mesh_soup/main.d.ts.map +1 -1
  325. package/src/shade/playground/skinned_mesh_soup/main.js +502 -509
  326. package/src/shade/playground/skinned_mesh_soup/verify_clone_vertices.d.ts.map +1 -1
  327. package/src/shade/playground/skinned_mesh_soup/verify_clone_vertices.js +2 -1
  328. package/src/shade/playground/ssr_variance/statistics.d.ts.map +1 -1
  329. package/src/shade/playground/ssr_variance/statistics.js +2 -1
  330. package/src/shade/playground/texture_encode/README.md +129 -109
  331. package/src/shade/playground/texture_encode/main.d.ts.map +1 -1
  332. package/src/shade/playground/texture_encode/main.js +1431 -1430
  333. package/src/shade/playground/volumetrics_froxel/measure.d.ts.map +1 -1
  334. package/src/shade/playground/volumetrics_froxel/measure.js +2 -1
  335. package/src/shade/renderer/animation/GPUAnimationManager.d.ts +45 -14
  336. package/src/shade/renderer/animation/GPUAnimationManager.d.ts.map +1 -1
  337. package/src/shade/renderer/animation/GPUAnimationManager.js +316 -64
  338. package/src/shade/renderer/animation/skinning/GPUMeshSkinningContext.d.ts +5 -0
  339. package/src/shade/renderer/animation/skinning/GPUMeshSkinningContext.d.ts.map +1 -1
  340. package/src/shade/renderer/animation/skinning/GPUMeshSkinningContext.js +11 -1
  341. package/src/shade/renderer/buffer/table/gpu_database_check_links.d.ts.map +1 -1
  342. package/src/shade/renderer/buffer/table/gpu_database_check_links.js +2 -1
  343. package/src/shade/renderer/geometry/BoxGeometry.d.ts +1 -11
  344. package/src/shade/renderer/geometry/BoxGeometry.d.ts.map +1 -1
  345. package/src/shade/renderer/geometry/BoxGeometry.js +6 -13
  346. package/src/shade/renderer/geometry/CapsuleGeometry.d.ts +19 -0
  347. package/src/shade/renderer/geometry/CapsuleGeometry.d.ts.map +1 -0
  348. package/src/shade/renderer/geometry/CapsuleGeometry.js +24 -0
  349. package/src/shade/renderer/geometry/ConeGeometry.d.ts +20 -0
  350. package/src/shade/renderer/geometry/ConeGeometry.d.ts.map +1 -0
  351. package/src/shade/renderer/geometry/ConeGeometry.js +33 -0
  352. package/src/shade/renderer/geometry/CylinderGeometry.d.ts +21 -0
  353. package/src/shade/renderer/geometry/CylinderGeometry.d.ts.map +1 -0
  354. package/src/shade/renderer/geometry/CylinderGeometry.js +35 -0
  355. package/src/shade/renderer/geometry/PlaneGeometry.d.ts +17 -0
  356. package/src/shade/renderer/geometry/PlaneGeometry.d.ts.map +1 -0
  357. package/src/shade/renderer/geometry/PlaneGeometry.js +22 -0
  358. package/src/shade/renderer/geometry/TorusGeometry.d.ts +18 -0
  359. package/src/shade/renderer/geometry/TorusGeometry.d.ts.map +1 -0
  360. package/src/shade/renderer/geometry/TorusGeometry.js +23 -0
  361. package/src/shade/renderer/geometry/UVSphereGeometry.d.ts +21 -0
  362. package/src/shade/renderer/geometry/UVSphereGeometry.d.ts.map +1 -0
  363. package/src/shade/renderer/geometry/UVSphereGeometry.js +34 -0
  364. package/src/shade/renderer/geometry/primitives/make_capsule_geometry.d.ts +19 -0
  365. package/src/shade/renderer/geometry/primitives/make_capsule_geometry.d.ts.map +1 -0
  366. package/src/shade/renderer/geometry/primitives/make_capsule_geometry.js +205 -0
  367. package/src/shade/renderer/geometry/primitives/make_cone_geometry.d.ts +21 -0
  368. package/src/shade/renderer/geometry/primitives/make_cone_geometry.d.ts.map +1 -0
  369. package/src/shade/renderer/geometry/primitives/make_cone_geometry.js +36 -0
  370. package/src/shade/renderer/geometry/primitives/make_cylinder_geometry.d.ts +1 -1
  371. package/src/shade/renderer/geometry/primitives/make_cylinder_geometry.d.ts.map +1 -1
  372. package/src/shade/renderer/geometry/primitives/make_cylinder_geometry.js +44 -9
  373. package/src/shade/renderer/geometry/primitives/make_uv_sphere_geometry.d.ts +20 -0
  374. package/src/shade/renderer/geometry/primitives/make_uv_sphere_geometry.d.ts.map +1 -0
  375. package/src/shade/renderer/geometry/primitives/make_uv_sphere_geometry.js +190 -0
  376. package/src/shade/renderer/geometry/virtual/build/level/vgeo_build_group_step.d.ts.map +1 -1
  377. package/src/shade/renderer/geometry/virtual/build/level/vgeo_build_group_step.js +3 -2
  378. package/src/shade/renderer/geometry/virtual/build/level/vgeo_build_leaf_frontier.d.ts.map +1 -1
  379. package/src/shade/renderer/geometry/virtual/build/level/vgeo_build_leaf_frontier.js +2 -1
  380. package/src/shade/renderer/geometry/virtual/build/level/vgeo_partition_into_groups.d.ts.map +1 -1
  381. package/src/shade/renderer/geometry/virtual/build/level/vgeo_partition_into_groups.js +2 -1
  382. package/src/shade/renderer/geometry/virtual/build/level/vgeo_run_round.d.ts.map +1 -1
  383. package/src/shade/renderer/geometry/virtual/build/level/vgeo_run_round.js +2 -1
  384. package/src/shade/renderer/geometry/virtual/build/level/vgeo_try_repack.d.ts.map +1 -1
  385. package/src/shade/renderer/geometry/virtual/build/level/vgeo_try_repack.js +3 -2
  386. package/src/shade/renderer/geometry/virtual/build/partition/vgeo_graph_components.d.ts.map +1 -1
  387. package/src/shade/renderer/geometry/virtual/build/partition/vgeo_graph_components.js +2 -1
  388. package/src/shade/renderer/geometry/virtual/build/partition/vgeo_split_face_set_packed.d.ts.map +1 -1
  389. package/src/shade/renderer/geometry/virtual/build/partition/vgeo_split_face_set_packed.js +2 -1
  390. package/src/shade/renderer/geometry/virtual/format/vgeo_write_container.d.ts.map +1 -1
  391. package/src/shade/renderer/geometry/virtual/format/vgeo_write_container.js +3 -2
  392. package/src/shade/renderer/geometry/virtual/runtime/graph_vgeo_expand_instances_to_meshlets.d.ts.map +1 -1
  393. package/src/shade/renderer/geometry/virtual/runtime/graph_vgeo_expand_instances_to_meshlets.js +7 -2
  394. package/src/shade/renderer/gpu_primitive/prefix_sum/v1/graph_prefix_scan_csdldf.d.ts +26 -8
  395. package/src/shade/renderer/gpu_primitive/prefix_sum/v1/graph_prefix_scan_csdldf.d.ts.map +1 -1
  396. package/src/shade/renderer/gpu_primitive/prefix_sum/v1/graph_prefix_scan_csdldf.js +56 -39
  397. package/src/shade/renderer/gpu_primitive/prefix_sum/v1/shader_prefix_scan_csdldf.d.ts +7 -0
  398. package/src/shade/renderer/gpu_primitive/prefix_sum/v1/shader_prefix_scan_csdldf.d.ts.map +1 -1
  399. package/src/shade/renderer/gpu_primitive/prefix_sum/v1/shader_prefix_scan_csdldf.js +46 -4
  400. package/src/shade/renderer/gpu_primitive/prefix_sum/v1/test_prefix_sum.d.ts.map +1 -1
  401. package/src/shade/renderer/gpu_primitive/prefix_sum/v1/test_prefix_sum.js +4 -2
  402. package/src/shade/renderer/gpu_primitive/sort/defs.d.ts +2 -2
  403. package/src/shade/renderer/gpu_primitive/sort/defs.js +79 -79
  404. package/src/shade/renderer/gpu_primitive/sort/graph_radix_sort.d.ts +1 -1
  405. package/src/shade/renderer/gpu_primitive/sort/graph_radix_sort.d.ts.map +1 -1
  406. package/src/shade/renderer/gpu_primitive/sort/graph_radix_sort.js +7 -3
  407. package/src/shade/renderer/particles/GPUParticleSystem.js +1 -1
  408. package/src/shade/renderer/particles/coherence/graph_particle_bucket.d.ts +4 -3
  409. package/src/shade/renderer/particles/coherence/graph_particle_bucket.d.ts.map +1 -1
  410. package/src/shade/renderer/particles/coherence/graph_particle_bucket.js +200 -194
  411. package/src/shade/renderer/particles/graph_particles.d.ts.map +1 -1
  412. package/src/shade/renderer/particles/graph_particles.js +6 -2
  413. package/src/shade/renderer/particles/optimizer/dag/particle_vector_extract.d.ts.map +1 -1
  414. package/src/shade/renderer/particles/optimizer/dag/particle_vector_extract.js +3 -2
  415. package/src/shade/renderer/particles/warmup/graph_particle_warmup.d.ts.map +1 -1
  416. package/src/shade/renderer/particles/warmup/graph_particle_warmup.js +334 -329
  417. package/src/shade/renderer/rasterize/bucket/prepare_meshlet_draw_commands_by_material.d.ts.map +1 -1
  418. package/src/shade/renderer/rasterize/bucket/prepare_meshlet_draw_commands_by_material.js +7 -2
  419. package/src/shade/renderer/rasterize/expand/mesh/graph_expand_meshes_to_meshlets.d.ts.map +1 -1
  420. package/src/shade/renderer/rasterize/expand/mesh/graph_expand_meshes_to_meshlets.js +16 -4
  421. package/src/shade/renderer/texture/COMPRESSED_TEXTURE_PLAN_2026_09_01.md +2444 -2345
  422. package/src/shade/renderer/texture/encode/chunk_astc_encode_block_4x4_rgb.d.ts.map +1 -1
  423. package/src/shade/renderer/texture/encode/chunk_astc_encode_block_4x4_rgb.js +312 -310
  424. package/src/shade/renderer/texture/encode/chunk_bc1_encode_block.d.ts +3 -3
  425. package/src/shade/renderer/texture/encode/chunk_bc1_encode_block.d.ts.map +1 -1
  426. package/src/shade/renderer/texture/encode/chunk_bc1_encode_block.js +383 -375
  427. package/src/shade/renderer/texture/encode/chunk_bc6h_encode_block_mode11.d.ts.map +1 -1
  428. package/src/shade/renderer/texture/encode/chunk_bc6h_encode_block_mode11.js +349 -346
  429. package/src/shade/renderer/texture/encode/chunk_bc7_encode_block.d.ts +58 -0
  430. package/src/shade/renderer/texture/encode/chunk_bc7_encode_block.d.ts.map +1 -0
  431. package/src/shade/renderer/texture/encode/chunk_bc7_encode_block.js +536 -0
  432. package/src/shade/renderer/texture/encode/chunk_bc7_encode_block_mode6.d.ts +21 -7
  433. package/src/shade/renderer/texture/encode/chunk_bc7_encode_block_mode6.d.ts.map +1 -1
  434. package/src/shade/renderer/texture/encode/chunk_bc7_encode_block_mode6.js +291 -327
  435. package/src/shade/renderer/texture/encode/chunk_bc7_pack_mode1.d.ts +25 -0
  436. package/src/shade/renderer/texture/encode/chunk_bc7_pack_mode1.d.ts.map +1 -0
  437. package/src/shade/renderer/texture/encode/chunk_bc7_pack_mode1.js +99 -0
  438. package/src/shade/renderer/texture/encode/chunk_bc7_pack_mode6.d.ts +5 -3
  439. package/src/shade/renderer/texture/encode/chunk_bc7_pack_mode6.d.ts.map +1 -1
  440. package/src/shade/renderer/texture/encode/chunk_bc7_pack_mode6.js +47 -71
  441. package/src/shade/renderer/texture/encode/chunk_bc7_partition_2.d.ts +10 -0
  442. package/src/shade/renderer/texture/encode/chunk_bc7_partition_2.d.ts.map +1 -0
  443. package/src/shade/renderer/texture/encode/chunk_bc7_partition_2.js +50 -0
  444. package/src/shade/renderer/texture/encode/shader_texture_encode_bc7.d.ts +4 -5
  445. package/src/shade/renderer/texture/encode/shader_texture_encode_bc7.d.ts.map +1 -1
  446. package/src/shade/renderer/texture/encode/shader_texture_encode_bc7.js +7 -8
  447. package/src/shade/renderer/water/chunk_water_transport.d.ts.map +1 -1
  448. package/src/shade/renderer/water/chunk_water_transport.js +7 -5
  449. package/src/shade/renderer/water/medium/GPUWaterBodies.d.ts.map +1 -1
  450. package/src/shade/renderer/water/medium/GPUWaterBodies.js +8 -2
  451. package/src/shade/renderer/water/optics/chunk_water_receiver_downwelling.d.ts +3 -2
  452. package/src/shade/renderer/water/optics/chunk_water_receiver_downwelling.d.ts.map +1 -1
  453. package/src/shade/renderer/water/optics/chunk_water_receiver_downwelling.js +3 -2
  454. package/src/shade/renderer/water/shader_water.d.ts.map +1 -1
  455. package/src/shade/renderer/water/shader_water.js +3 -1
  456. package/src/shade/renderer/water/surface/GPUWaterSurface.d.ts.map +1 -1
  457. package/src/shade/renderer/water/surface/GPUWaterSurface.js +3 -1
  458. package/src/shade/renderer/water/surface/graph_water_tessellation.d.ts.map +1 -1
  459. package/src/shade/renderer/water/surface/graph_water_tessellation.js +11 -4
  460. package/src/shade/renderer/water/surface/particles/GPUWaterParticles.d.ts.map +1 -1
  461. package/src/shade/renderer/water/surface/particles/GPUWaterParticles.js +37 -20
  462. package/src/shade/wgsl/validate_wgsl_source.d.ts.map +1 -1
  463. package/src/shade/wgsl/validate_wgsl_source.js +74 -3
  464. package/src/engine/graphics3/register_instance_animation.d.ts +0 -114
  465. package/src/engine/graphics3/register_instance_animation.d.ts.map +0 -1
  466. package/src/engine/graphics3/register_instance_animation.js +0 -201
@@ -0,0 +1,25 @@
1
+ /**
2
+ * One BC7 mode 1 block from its partition, four endpoints and sixteen indices, as four
3
+ * little-endian words.
4
+ *
5
+ * The layout `bc7_write_block` states for mode 1: two mode bits — a zero and a one — then six bits
6
+ * of partition, then the colour endpoints by channel, red for both ends of the first subset and then
7
+ * both ends of the second, then green, then blue, six bits each; one parity bit per *subset*, shared
8
+ * by its two ends; then the indices, three bits each except the two anchors', texel 0 and the
9
+ * partition's second anchor, whose top bit is implied zero. Honouring that is the encoder's, by
10
+ * swapping a subset's ends; this drops the top bit, as the JavaScript writer drops it. Mode 1 has no
11
+ * alpha: it decodes opaque.
12
+ *
13
+ * Endpoints are given as the eight-bit values they decode to — six stored bits, the subset's parity
14
+ * bit below them, the top bit replicated below that — so the stored bits are read off them. The
15
+ * parity is read off each subset's first end; the encoder gives both ends the same one.
16
+ *
17
+ * Each word is composed by shifts at the fields' fixed positions, except the indices: the second
18
+ * anchor moves with the partition, so the three-bit fields are laid out as if none were short and
19
+ * the anchor's top bit is then cut out of the run.
20
+ *
21
+ * @type {CodeChunk}
22
+ */
23
+ export const chunk_bc7_pack_mode1: CodeChunk;
24
+ import { CodeChunk } from "../../shader/compiler/CodeChunk.js";
25
+ //# sourceMappingURL=chunk_bc7_pack_mode1.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chunk_bc7_pack_mode1.d.ts","sourceRoot":"","sources":["../../../../../../src/shade/renderer/texture/encode/chunk_bc7_pack_mode1.js"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,mCAFU,SAAS,CA2EZ;0BAlGmB,oCAAoC"}
@@ -0,0 +1,99 @@
1
+ import { CodeChunk } from "../../shader/compiler/CodeChunk.js";
2
+ import { chunk_bc7_partition_2 } from "./chunk_bc7_partition_2.js";
3
+
4
+ /**
5
+ * One BC7 mode 1 block from its partition, four endpoints and sixteen indices, as four
6
+ * little-endian words.
7
+ *
8
+ * The layout `bc7_write_block` states for mode 1: two mode bits — a zero and a one — then six bits
9
+ * of partition, then the colour endpoints by channel, red for both ends of the first subset and then
10
+ * both ends of the second, then green, then blue, six bits each; one parity bit per *subset*, shared
11
+ * by its two ends; then the indices, three bits each except the two anchors', texel 0 and the
12
+ * partition's second anchor, whose top bit is implied zero. Honouring that is the encoder's, by
13
+ * swapping a subset's ends; this drops the top bit, as the JavaScript writer drops it. Mode 1 has no
14
+ * alpha: it decodes opaque.
15
+ *
16
+ * Endpoints are given as the eight-bit values they decode to — six stored bits, the subset's parity
17
+ * bit below them, the top bit replicated below that — so the stored bits are read off them. The
18
+ * parity is read off each subset's first end; the encoder gives both ends the same one.
19
+ *
20
+ * Each word is composed by shifts at the fields' fixed positions, except the indices: the second
21
+ * anchor moves with the partition, so the three-bit fields are laid out as if none were short and
22
+ * the anchor's top bit is then cut out of the run.
23
+ *
24
+ * @type {CodeChunk}
25
+ */
26
+ export const chunk_bc7_pack_mode1 = CodeChunk.from(
27
+ //language=WGSL
28
+ `
29
+ fn bc7_pack_mode1(
30
+ pattern: u32,
31
+ a0: vec3<u32>, a1: vec3<u32>,
32
+ b0: vec3<u32>, b1: vec3<u32>,
33
+ indices: array<u32, 16>
34
+ ) -> vec4<u32> {
35
+ // the six stored bits of each end's channels, and each subset's parity
36
+ let sa0 = a0 >> vec3<u32>(2u);
37
+ let sa1 = a1 >> vec3<u32>(2u);
38
+ let sb0 = b0 >> vec3<u32>(2u);
39
+ let sb1 = b1 >> vec3<u32>(2u);
40
+
41
+ let parity_a = (a0.x >> 1u) & 1u;
42
+ let parity_b = (b0.x >> 1u) & 1u;
43
+
44
+ // texels 1 to 15 at three bits each, as if no anchor were short: forty-five bits over two words
45
+ var low = 0u;
46
+ var high = 0u;
47
+
48
+ for (var i = 1u; i < 16u; i++) {
49
+ let shift = 3u * (i - 1u);
50
+ let index = indices[i] & 7u;
51
+
52
+ if (shift < 32u) {
53
+ low |= index << shift;
54
+ }
55
+
56
+ // texel 11's field straddles the two words, bits 30 to 32
57
+ if (shift == 30u) {
58
+ high |= index >> 2u;
59
+ }
60
+
61
+ if (shift > 32u) {
62
+ high |= index << (shift - 32u);
63
+ }
64
+ }
65
+
66
+ // cut the second anchor's top bit out of the run: the bits below it stay, the bits above it
67
+ // move down by one
68
+ let cut = 3u * (bc7_partition_2_anchor(pattern) - 1u) + 2u;
69
+
70
+ let keep_low = select(0xFFFFFFFFu, (1u << cut) - 1u, cut < 32u);
71
+ let keep_high = select((1u << (cut - 32u)) - 1u, 0u, cut < 32u);
72
+
73
+ let shifted_low = (low >> 1u) | (high << 31u);
74
+ let shifted_high = high >> 1u;
75
+
76
+ let run_low = (low & keep_low) | (shifted_low & ~keep_low);
77
+ let run_high = (high & keep_high) | (shifted_high & ~keep_high);
78
+
79
+ // the forty-six index bits: texel 0's two, then the run
80
+ let stream_low = (indices[0] & 3u) | (run_low << 2u);
81
+ let stream_high = (run_low >> 30u) | (run_high << 2u);
82
+
83
+ // mode 1 is signalled by a zero bit and then a one, bits 0 and 1; the partition from bit 2,
84
+ // red from bit 8
85
+ let w0 = 2u | (pattern << 2u) | (sa0.x << 8u) | (sa1.x << 14u) | (sb0.x << 20u) | (sb1.x << 26u);
86
+
87
+ // the first subset's second blue straddles bits 62 to 67
88
+ let w1 = sa0.y | (sa1.y << 6u) | (sb0.y << 12u) | (sb1.y << 18u) | (sa0.z << 24u) | (sa1.z << 30u);
89
+
90
+ // the parity bits at 80 and 81, the indices from 82
91
+ let w2 = (sa1.z >> 2u) | (sb0.z << 4u) | (sb1.z << 10u) | (parity_a << 16u) | (parity_b << 17u) | (stream_low << 18u);
92
+
93
+ let w3 = (stream_low >> 14u) | (stream_high << 18u);
94
+
95
+ return vec4<u32>(w0, w1, w2, w3);
96
+ }
97
+ `, [
98
+ chunk_bc7_partition_2,
99
+ ]);
@@ -6,14 +6,16 @@
6
6
  * then blue, seven bits each; alpha likewise; one parity bit per endpoint; then the indices, four
7
7
  * bits each except texel 0's three, because its top bit is implied zero. That last rule is the
8
8
  * encoder's to honour, by swapping the ends when texel 0 lands in the upper half, and this does not
9
- * check it.
9
+ * check it: the top bit is dropped, as the JavaScript writer drops it.
10
10
  *
11
11
  * Endpoints are given as the eight-bit values they decode to — seven stored bits over the parity
12
12
  * bit — so the parity is read off them rather than passed beside them, and a caller cannot hand in
13
13
  * a pair that disagrees with itself.
14
14
  *
15
- * Bit by bit, as the JavaScript writer is, because the fields straddle word boundaries and a
16
- * hundred and twenty-eight iterations are nothing.
15
+ * Each word is composed by shifts at the fields' fixed positions, the two that straddle a word
16
+ * boundary — the second end's green, bits 28 to 34, and the second parity bit, bit 64 — split
17
+ * across them. The JavaScript writer goes bit by bit; here a hundred and twenty-eight iterations
18
+ * over two function-local arrays were 13% of a 4096² encode on a 4090.
17
19
  *
18
20
  * @type {CodeChunk}
19
21
  */
@@ -1 +1 @@
1
- {"version":3,"file":"chunk_bc7_pack_mode6.d.ts","sourceRoot":"","sources":["../../../../../../src/shade/renderer/texture/encode/chunk_bc7_pack_mode6.js"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;GAkBG;AACH,mCAFU,SAAS,CAmDhB;0BAtEuB,oCAAoC"}
1
+ {"version":3,"file":"chunk_bc7_pack_mode6.d.ts","sourceRoot":"","sources":["../../../../../../src/shade/renderer/texture/encode/chunk_bc7_pack_mode6.js"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,mCAFU,SAAS,CAyBhB;0BA9CuB,oCAAoC"}
@@ -1,71 +1,47 @@
1
- import { CodeChunk } from "../../shader/compiler/CodeChunk.js";
2
-
3
- /**
4
- * One BC7 mode 6 block from its two endpoints and sixteen indices, as four little-endian words.
5
- *
6
- * The layout `bc7_write_block` states for mode 6, in the same order for every field: seven mode
7
- * bits — six zeros and a one — then the colour endpoints by channel, red for both ends, then green,
8
- * then blue, seven bits each; alpha likewise; one parity bit per endpoint; then the indices, four
9
- * bits each except texel 0's three, because its top bit is implied zero. That last rule is the
10
- * encoder's to honour, by swapping the ends when texel 0 lands in the upper half, and this does not
11
- * check it.
12
- *
13
- * Endpoints are given as the eight-bit values they decode to — seven stored bits over the parity
14
- * bit — so the parity is read off them rather than passed beside them, and a caller cannot hand in
15
- * a pair that disagrees with itself.
16
- *
17
- * Bit by bit, as the JavaScript writer is, because the fields straddle word boundaries and a
18
- * hundred and twenty-eight iterations are nothing.
19
- *
20
- * @type {CodeChunk}
21
- */
22
- export const chunk_bc7_pack_mode6 = CodeChunk.from(
23
- //language=WGSL
24
- `
25
- fn bc7_pack_mode6(e0: vec4<u32>, e1: vec4<u32>, indices: array<u32, 16>) -> vec4<u32> {
26
- var values: array<u32, 27>;
27
- var counts: array<u32, 27>;
28
-
29
- // mode 6 is signalled by six zero bits and then a one
30
- values[0] = 64u;
31
- counts[0] = 7u;
32
-
33
- for (var channel = 0u; channel < 4u; channel++) {
34
- values[1u + channel * 2u] = e0[channel] >> 1u;
35
- values[2u + channel * 2u] = e1[channel] >> 1u;
36
- counts[1u + channel * 2u] = 7u;
37
- counts[2u + channel * 2u] = 7u;
38
- }
39
-
40
- values[9] = e0.x & 1u;
41
- values[10] = e1.x & 1u;
42
- counts[9] = 1u;
43
- counts[10] = 1u;
44
-
45
- for (var texel = 0u; texel < 16u; texel++) {
46
- values[11u + texel] = indices[texel];
47
- counts[11u + texel] = select(4u, 3u, texel == 0u);
48
- }
49
-
50
- var words = array<u32, 4>(0u, 0u, 0u, 0u);
51
-
52
- var bit = 0u;
53
-
54
- for (var field = 0u; field < 27u; field++) {
55
- let value = values[field];
56
- let count = counts[field];
57
-
58
- for (var k = 0u; k < count; k++) {
59
- if (((value >> k) & 1u) != 0u) {
60
- let at = bit + k;
61
-
62
- words[at >> 5u] |= 1u << (at & 31u);
63
- }
64
- }
65
-
66
- bit += count;
67
- }
68
-
69
- return vec4<u32>(words[0], words[1], words[2], words[3]);
70
- }
71
- `);
1
+ import { CodeChunk } from "../../shader/compiler/CodeChunk.js";
2
+
3
+ /**
4
+ * One BC7 mode 6 block from its two endpoints and sixteen indices, as four little-endian words.
5
+ *
6
+ * The layout `bc7_write_block` states for mode 6, in the same order for every field: seven mode
7
+ * bits — six zeros and a one — then the colour endpoints by channel, red for both ends, then green,
8
+ * then blue, seven bits each; alpha likewise; one parity bit per endpoint; then the indices, four
9
+ * bits each except texel 0's three, because its top bit is implied zero. That last rule is the
10
+ * encoder's to honour, by swapping the ends when texel 0 lands in the upper half, and this does not
11
+ * check it: the top bit is dropped, as the JavaScript writer drops it.
12
+ *
13
+ * Endpoints are given as the eight-bit values they decode to — seven stored bits over the parity
14
+ * bit — so the parity is read off them rather than passed beside them, and a caller cannot hand in
15
+ * a pair that disagrees with itself.
16
+ *
17
+ * Each word is composed by shifts at the fields' fixed positions, the two that straddle a word
18
+ * boundary — the second end's green, bits 28 to 34, and the second parity bit, bit 64 — split
19
+ * across them. The JavaScript writer goes bit by bit; here a hundred and twenty-eight iterations
20
+ * over two function-local arrays were 13% of a 4096² encode on a 4090.
21
+ *
22
+ * @type {CodeChunk}
23
+ */
24
+ export const chunk_bc7_pack_mode6 = CodeChunk.from(
25
+ //language=WGSL
26
+ `
27
+ fn bc7_pack_mode6(e0: vec4<u32>, e1: vec4<u32>, indices: array<u32, 16>) -> vec4<u32> {
28
+ // the seven stored bits of each end's channels
29
+ let s0 = e0 >> vec4<u32>(1u);
30
+ let s1 = e1 >> vec4<u32>(1u);
31
+
32
+ // mode 6 is signalled by six zero bits and then a one, bits 0 to 6; red from bit 7
33
+ let w0 = 64u | (s0.x << 7u) | (s1.x << 14u) | (s0.y << 21u) | (s1.y << 28u);
34
+
35
+ // the parity bits are the ends' low bits, the first at bit 63 and the second at bit 64
36
+ let w1 = (s1.y >> 4u) | (s0.z << 3u) | (s1.z << 10u) | (s0.w << 17u) | (s1.w << 24u) | ((e0.x & 1u) << 31u);
37
+
38
+ let w2 = (e1.x & 1u) | ((indices[0] & 7u) << 1u)
39
+ | (indices[1] << 4u) | (indices[2] << 8u) | (indices[3] << 12u) | (indices[4] << 16u)
40
+ | (indices[5] << 20u) | (indices[6] << 24u) | (indices[7] << 28u);
41
+
42
+ let w3 = indices[8] | (indices[9] << 4u) | (indices[10] << 8u) | (indices[11] << 12u)
43
+ | (indices[12] << 16u) | (indices[13] << 20u) | (indices[14] << 24u) | (indices[15] << 28u);
44
+
45
+ return vec4<u32>(w0, w1, w2, w3);
46
+ }
47
+ `);
@@ -0,0 +1,10 @@
1
+ /**
2
+ * BC7's two-subset partitions as a shader reads them: which texels a pattern puts in the second
3
+ * subset, and that subset's anchor — the texel whose index is stored a bit short. The first
4
+ * subset's anchor is always texel 0, which every pattern puts in the first subset.
5
+ *
6
+ * @type {CodeChunk}
7
+ */
8
+ export const chunk_bc7_partition_2: CodeChunk;
9
+ import { CodeChunk } from "../../shader/compiler/CodeChunk.js";
10
+ //# sourceMappingURL=chunk_bc7_partition_2.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chunk_bc7_partition_2.d.ts","sourceRoot":"","sources":["../../../../../../src/shade/renderer/texture/encode/chunk_bc7_partition_2.js"],"names":[],"mappings":"AA4BA;;;;;;GAMG;AACH,oCAFU,SAAS,CAgBhB;0BAhDuB,oCAAoC"}
@@ -0,0 +1,50 @@
1
+ import { BC7_ANCHOR_2, BC7_PARTITIONS_2 } from "../../../../format/texture/basis/uastc/bc7_tables.js";
2
+ import { CodeChunk } from "../../shader/compiler/CodeChunk.js";
3
+
4
+ /**
5
+ * BC7's sixty-four two-subset partitions, one word each: bit `i` set where texel `i` is in the
6
+ * second subset, and the second subset's anchor texel from bit 16.
7
+ *
8
+ * Built from the tables the UASTC transcoder uses rather than transcribed again, so the encoder and
9
+ * the transcoders cannot disagree about a shape.
10
+ *
11
+ * @returns {string} sixty-four WGSL `u32` literals
12
+ */
13
+ function partition_words() {
14
+ const words = [];
15
+
16
+ for (let partition = 0; partition < 64; partition++) {
17
+ let mask = 0;
18
+
19
+ for (let texel = 0; texel < 16; texel++) {
20
+ mask |= BC7_PARTITIONS_2[partition * 16 + texel] << texel;
21
+ }
22
+
23
+ words.push(`${(mask | (BC7_ANCHOR_2[partition] << 16)) >>> 0}u`);
24
+ }
25
+
26
+ return words.join(', ');
27
+ }
28
+
29
+ /**
30
+ * BC7's two-subset partitions as a shader reads them: which texels a pattern puts in the second
31
+ * subset, and that subset's anchor — the texel whose index is stored a bit short. The first
32
+ * subset's anchor is always texel 0, which every pattern puts in the first subset.
33
+ *
34
+ * @type {CodeChunk}
35
+ */
36
+ export const chunk_bc7_partition_2 = CodeChunk.from(
37
+ //language=WGSL
38
+ `
39
+ const BC7_PARTITION_2 = array<u32, 64>(${partition_words()});
40
+
41
+ // the texels a two-subset partition puts in its second subset, bit i for texel i
42
+ fn bc7_partition_2_mask(pattern: u32) -> u32 {
43
+ return BC7_PARTITION_2[pattern] & 0xFFFFu;
44
+ }
45
+
46
+ // the second subset's anchor texel
47
+ fn bc7_partition_2_anchor(pattern: u32) -> u32 {
48
+ return BC7_PARTITION_2[pattern] >> 16u;
49
+ }
50
+ `);
@@ -1,11 +1,10 @@
1
1
  /**
2
2
  * Every level of a texture to `bc7-rgba-unorm` or its sRGB twin, one invocation per block.
3
3
  *
4
- * **Mode 6 only**, today: the single-subset mode with the finest indices, fitted by
5
- * {@link chunk_bc7_encode_block_mode6} over all four channels. A mode search across the
6
- * partitioned modes is a later quality step, and a separate chunk — this shader would call it
7
- * instead, and nothing about the format or the bytes it produces changes. The dispatch shape is
8
- * {@link shader_texture_encode_bc4}'s; a block is four words.
4
+ * Each block in mode 6 or mode 1, whichever {@link chunk_bc7_encode_block} estimates loses less:
5
+ * one line through all four channels with sixteen levels, or two lines through the colour over one
6
+ * of the sixty-four partitions. The dispatch shape is {@link shader_texture_encode_bc4}'s; a block is
7
+ * four words.
9
8
  *
10
9
  * @type {ComputeShader}
11
10
  */
@@ -1 +1 @@
1
- {"version":3,"file":"shader_texture_encode_bc7.d.ts","sourceRoot":"","sources":["../../../../../../src/shade/renderer/texture/encode/shader_texture_encode_bc7.js"],"names":[],"mappings":"AAQA;;;;;;;;;;GAUG;AACH,wCAFU,aAAa,CA2CpB;8BA1D2B,+BAA+B"}
1
+ {"version":3,"file":"shader_texture_encode_bc7.d.ts","sourceRoot":"","sources":["../../../../../../src/shade/renderer/texture/encode/shader_texture_encode_bc7.js"],"names":[],"mappings":"AAQA;;;;;;;;;GASG;AACH,wCAFU,aAAa,CA2CpB;8BAzD2B,+BAA+B"}
@@ -1,7 +1,7 @@
1
1
  import { chunk_grid3d_to_index } from "../../shader/chunk/grid/chunk_grid3d_to_index.js";
2
2
  import { CodeChunk } from "../../shader/compiler/CodeChunk.js";
3
3
  import { ComputeShader } from "../../shader/ComputeShader.js";
4
- import { chunk_bc7_encode_block_mode6 } from "./chunk_bc7_encode_block_mode6.js";
4
+ import { chunk_bc7_encode_block } from "./chunk_bc7_encode_block.js";
5
5
  import { chunk_texture_encode_load_block } from "./chunk_texture_encode_load_block.js";
6
6
  import { TEXTURE_ENCODE_WORKGROUP_SIZE } from "./shader_texture_encode_bc4.js";
7
7
  import { texture_encode_resources } from "./texture_encode_resources.js";
@@ -9,11 +9,10 @@ import { texture_encode_resources } from "./texture_encode_resources.js";
9
9
  /**
10
10
  * Every level of a texture to `bc7-rgba-unorm` or its sRGB twin, one invocation per block.
11
11
  *
12
- * **Mode 6 only**, today: the single-subset mode with the finest indices, fitted by
13
- * {@link chunk_bc7_encode_block_mode6} over all four channels. A mode search across the
14
- * partitioned modes is a later quality step, and a separate chunk — this shader would call it
15
- * instead, and nothing about the format or the bytes it produces changes. The dispatch shape is
16
- * {@link shader_texture_encode_bc4}'s; a block is four words.
12
+ * Each block in mode 6 or mode 1, whichever {@link chunk_bc7_encode_block} estimates loses less:
13
+ * one line through all four channels with sixteen levels, or two lines through the colour over one
14
+ * of the sixty-four partitions. The dispatch shape is {@link shader_texture_encode_bc4}'s; a block is
15
+ * four words.
17
16
  *
18
17
  * @type {ComputeShader}
19
18
  */
@@ -44,7 +43,7 @@ fn main(
44
43
 
45
44
  let texels = texture_encode_load_block(level, block_x, block_y);
46
45
 
47
- let packed = bc7_encode_block_mode6(texels);
46
+ let packed = bc7_encode_block(texels);
48
47
 
49
48
  let word = level.word_offset + block_y * level.row_stride_words + block_x * 4u;
50
49
 
@@ -56,6 +55,6 @@ fn main(
56
55
  `, [
57
56
  chunk_grid3d_to_index,
58
57
  chunk_texture_encode_load_block,
59
- chunk_bc7_encode_block_mode6,
58
+ chunk_bc7_encode_block,
60
59
  ]),
61
60
  });
@@ -1 +1 @@
1
- {"version":3,"file":"chunk_water_transport.d.ts","sourceRoot":"","sources":["../../../../../src/shade/renderer/water/chunk_water_transport.js"],"names":[],"mappings":"AAUA,0DAEG;AAEH,0DAeG;AAEH,8CAsBG;AAGH,mDAS6F;AAI7F,sDAmCoE;0BAxG1C,iCAAiC"}
1
+ {"version":3,"file":"chunk_water_transport.d.ts","sourceRoot":"","sources":["../../../../../src/shade/renderer/water/chunk_water_transport.js"],"names":[],"mappings":"AAUA,0DAEG;AAEH,0DAeG;AAEH,8CAsBG;AAIH,mDAU6F;AAI7F,sDAmCoE;0BA1G1C,iCAAiC"}
@@ -53,15 +53,17 @@ fn water_transport(event: WaterEvent, original: vec3f, receiver: vec3f,
53
53
  }
54
54
  `);
55
55
 
56
- // One G-buffer texel in world space: its stored depth, texel-center position and face normal.
56
+ // One G-buffer texel in world space: its stored depth, texel-center position, its triangle's face normal, which
57
+ // is where the surface is, and the normal it was shaded with, which is what lit it.
57
58
  export const chunk_water_receiver_texel = CodeChunk.from(/* language=WGSL */ `
58
- struct WaterReceiverTexel { depth: f32, position: vec3f, normal: vec3f }
59
+ struct WaterReceiverTexel { depth: f32, position: vec3f, face_normal: vec3f, shading_normal: vec3f }
59
60
  fn water_receiver_texel(depth: texture_2d<f32>, normals: texture_2d<u32>, coord: vec2i,
60
61
  inverse_projection: mat4x4f, inverse_view: mat4x4f) -> WaterReceiverTexel {
61
62
  let d = textureLoad(depth, coord, 0).r;
62
63
  let center = texel_coordinate_to_uv(vec2f(coord), textureDimensions(depth, 0));
63
64
  let position = inverse_view * vec4f(inv_project_position(vec3f(center, d), inverse_projection), 1.0);
64
- return WaterReceiverTexel(d, position.xyz, decode_g_buffer_normal(textureLoad(normals, coord, 0).zw));
65
+ let encoded = textureLoad(normals, coord, 0);
66
+ return WaterReceiverTexel(d, position.xyz, decode_g_buffer_normal(encoded.zw), decode_g_buffer_normal(encoded.xy));
65
67
  }
66
68
  `, [chunk_decode_g_buffer_normal, chunk_inv_project_position, chunk_texel_coordinate_to_uv]);
67
69
 
@@ -92,8 +94,8 @@ fn water_receiver_radiance(scene: texture_2d<f32>, depth: texture_2d<f32>, norma
92
94
  let coord = clamp(base + vec2i(x,y), vec2i(0), size-1);
93
95
  let tap = water_receiver_texel(depth, normals, coord, inverse_projection, inverse_view);
94
96
  if (is_background(tap.depth) || (below_interface && dot(tap.position - surface, surface_normal) > WATER_LEVEL_TOLERANCE)
95
- || dot(center.normal, tap.normal) < 0.95
96
- || abs(dot(tap.position - center.position, center.normal)) > 0.02) { continue; }
97
+ || dot(center.face_normal, tap.face_normal) < 0.95
98
+ || abs(dot(tap.position - center.position, center.face_normal)) > 0.02) { continue; }
97
99
  let w = select(1.0-f.x, f.x, x == 1) * select(1.0-f.y, f.y, y == 1);
98
100
  color += w * textureLoad(scene, coord, 0).rgb;
99
101
  weight += w;
@@ -1 +1 @@
1
- {"version":3,"file":"GPUWaterBodies.d.ts","sourceRoot":"","sources":["../../../../../../src/shade/renderer/water/medium/GPUWaterBodies.js"],"names":[],"mappings":"AAcA,4FAA4F;AAC5F;IACI;;;;;;OAMG;IACH;;;;;;;;QAFa;QAAC,QAAQ,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,MAAM,CAAA;KAAC,CA8ClD;CACJ"}
1
+ {"version":3,"file":"GPUWaterBodies.d.ts","sourceRoot":"","sources":["../../../../../../src/shade/renderer/water/medium/GPUWaterBodies.js"],"names":[],"mappings":"AAkBA,4FAA4F;AAC5F;IACI;;;;;;OAMG;IACH;;;;;;;;QAFa;QAAC,QAAQ,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,MAAM,CAAA;KAAC,CAgDlD;CACJ"}
@@ -1,6 +1,10 @@
1
1
  import { BufferResourceDescriptor } from "../../../device/graph/BufferResourceDescriptor.js";
2
2
  import { round_up } from "../../../../core/math/round_up.js";
3
- import { graph_prefix_scan_csdldf } from "../../gpu_primitive/prefix_sum/v1/graph_prefix_scan_csdldf.js";
3
+ import {
4
+ graph_prefix_scan_csdldf,
5
+ prefix_scan_csdldf_output_descriptor
6
+ } from "../../gpu_primitive/prefix_sum/v1/graph_prefix_scan_csdldf.js";
7
+ import { graph_create_buffer } from "../../shader/graph/graph_create_buffer.js";
4
8
  import {
5
9
  build_indirect_compute_dispatch_command,
6
10
  INDIRECT_COMPUTE_COMMAND_DESCRIPTOR
@@ -42,7 +46,9 @@ export class GPUWaterBodies {
42
46
  data.command = pass.create('Water lod bodies command', INDIRECT_COMPUTE_COMMAND_DESCRIPTOR);
43
47
  data.lod_bodies = pass.create('Water lod bodies', BufferResourceDescriptor.from(capacity * WATER_LOD_BODY_STRUCT.size,
44
48
  GPUBufferUsage.STORAGE));
45
- const sums = graph_prefix_scan_csdldf({ graph, data: data.counts, element_max_count: capacity });
49
+ const sums = graph_prefix_scan_csdldf({ graph, input: data.counts,
50
+ output: graph_create_buffer(graph, 'Water lod body meshlet sums', prefix_scan_csdldf_output_descriptor(capacity)),
51
+ element_max_count: capacity });
46
52
  const command_data = {};
47
53
  const command_pass = graph.add('Water / expand command', command_data, (d, resources, { encoder }) => {
48
54
  shader_prefix_sum_to_command.dispatch({ encoder, bindings: {
@@ -5,8 +5,9 @@
5
5
  * light that receiver was shaded with survives the water above it.
6
6
  *
7
7
  * The ratio is of the receiver's irradiance under the water to its irradiance dry, from what the
8
- * water pass can rebuild at the receiver — its position, G-buffer normal and depth below the
9
- * surface, the shadow map and the GI mode:
8
+ * water pass can rebuild at the receiver — its position, the normal it was shaded with (the G-buffer's
9
+ * shading normal, as deferred lighting takes n·l, the shadow lookup and GI on it; never its triangle's,
10
+ * which turns at every edge) and depth below the surface, the shadow map and the GI mode:
10
11
  *
11
12
  * - dry: each directional light × its shadow × n·l, plus the GI mode's irradiance on n;
12
13
  * - wet: each light refracted at the surface, so steeper, with the Fresnel transmittance, the beam's
@@ -1 +1 @@
1
- {"version":3,"file":"chunk_water_receiver_downwelling.d.ts","sourceRoot":"","sources":["../../../../../../src/shade/renderer/water/optics/chunk_water_receiver_downwelling.js"],"names":[],"mappings":"AAWA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,+CAFU,SAAS,CAyCmE;0BApE5D,oCAAoC"}
1
+ {"version":3,"file":"chunk_water_receiver_downwelling.d.ts","sourceRoot":"","sources":["../../../../../../src/shade/renderer/water/optics/chunk_water_receiver_downwelling.js"],"names":[],"mappings":"AAWA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,+CAFU,SAAS,CAyCmE;0BArE5D,oCAAoC"}
@@ -16,8 +16,9 @@ import { chunk_water_optics } from "./chunk_water_optics.js";
16
16
  * light that receiver was shaded with survives the water above it.
17
17
  *
18
18
  * The ratio is of the receiver's irradiance under the water to its irradiance dry, from what the
19
- * water pass can rebuild at the receiver — its position, G-buffer normal and depth below the
20
- * surface, the shadow map and the GI mode:
19
+ * water pass can rebuild at the receiver — its position, the normal it was shaded with (the G-buffer's
20
+ * shading normal, as deferred lighting takes n·l, the shadow lookup and GI on it; never its triangle's,
21
+ * which turns at every edge) and depth below the surface, the shadow map and the GI mode:
21
22
  *
22
23
  * - dry: each directional light × its shadow × n·l, plus the GI mode's irradiance on n;
23
24
  * - wet: each light refracted at the surface, so steeper, with the Fresnel transmittance, the beam's
@@ -1 +1 @@
1
- {"version":3,"file":"shader_water.d.ts","sourceRoot":"","sources":["../../../../../src/shade/renderer/water/shader_water.js"],"names":[],"mappings":"AAwmBA,kEAAuH;AACvH,+EAA+J;AAC/J,kFAAqK;AA/jBrK,8CAKwB;AAiCxB,oGAAoG;AACpG,uEAAkE;AAGlE,gGAAgG;AAChG,0EAAqE;AAqOrE,+CA+EmB;AA6LnB,4CAAmG;AACnG,kFAAkF;AAClF,yDAC8G;AAC9G,oCAAoC;AACpC,4DACoH;AACpH,0DAAyC;yCA5kBA,8DAA8D;6BAmB1E,gCAAgC;4CAJjB,mDAAmD;0BADrE,iCAAiC;iCAE1B,+BAA+B"}
1
+ {"version":3,"file":"shader_water.d.ts","sourceRoot":"","sources":["../../../../../src/shade/renderer/water/shader_water.js"],"names":[],"mappings":"AA0mBA,kEAAuH;AACvH,+EAA+J;AAC/J,kFAAqK;AAjkBrK,8CAKwB;AAiCxB,oGAAoG;AACpG,uEAAkE;AAGlE,gGAAgG;AAChG,0EAAqE;AAqOrE,+CA+EmB;AA+LnB,4CAAmG;AACnG,kFAAkF;AAClF,yDAC8G;AAC9G,oCAAoC;AACpC,4DACoH;AACpH,0DAAyC;yCA9kBA,8DAA8D;6BAmB1E,gCAAgC;4CAJjB,mDAAmD;0BADrE,iCAAiC;iCAE1B,+BAA+B"}
@@ -550,12 +550,14 @@ fn fs_main(in: WaterVertexOut, @builtin(front_facing) above: bool) -> WaterOptic
550
550
  } else { confidence = 0.0; }
551
551
  // The opaque scene was shaded dry: what reaches the receiver is what survives the water above it
552
552
  // (WATER_OPTICS_PLAN_2026_10_02.md §4.3). Seen from under the surface, the receiver is above it.
553
+ // Its light is rebuilt on the normal it was shaded with: its triangle's turns at every edge of a
554
+ // tessellated floor, and every edge would show through the water.
553
555
  let receiver_texel = water_receiver_texel(tDepth, tNormal, receiver_coord, camera.projection_matrix_inverse,
554
556
  camera.view_matrix_inverse);
555
557
  if (above && !is_background(receiver_texel.depth)) {
556
558
  let camera_ws = camera.view_matrix_inverse[3].xyz;
557
559
  let up = normalize(in.rest_normal);
558
- color *= water_receiver_downwelling(body, receiver_texel.position, receiver_texel.normal, up,
560
+ color *= water_receiver_downwelling(body, receiver_texel.position, receiver_texel.shading_normal, up,
559
561
  max(dot(in.world - receiver_texel.position, up), 0.0), normalize(camera_ws - receiver_texel.position));
560
562
  }
561
563
  // Light in the water body (WATER_OPTICS_PLAN_2026_10_02.md §4.4): the receiver attenuated along
@@ -1 +1 @@
1
- {"version":3,"file":"GPUWaterSurface.d.ts","sourceRoot":"","sources":["../../../../../../src/shade/renderer/water/surface/GPUWaterSurface.js"],"names":[],"mappings":"AAmBA,uHAAuH;AACvH,2CAA4C;AAE5C,4EAA4E;AAC5E,6DAKI;AAEJ;;;;;;GAMG;AACH;IACI,4FAA4F;IAC5F,yBAAgC;IAChC,oEAAoE;IACpE,0BAA0B;IAC1B,6EAA6E;IAC7E,eAAc;IACd;;;OAGG;IACH,kBAAiB;IAejB,mCAA0D;IAC1D,kCAAwD;IACxD,kCAA0D;IAC1D,kCAA0D;IAC1D,kHAAkH;IAClH,uBAAmC;IACnC,qGAAqG;IACrG,0BAAyC;IACzC,gHAAgH;IAChH,8BAA2D;IAC3D,mCAA2C;IAE3C;;;OAGG;IACH,YAFW,MAAM,QAKhB;IAED,gBAWC;IAsBD;;;;;;;;;;;OAWG;IACH;QAVsG,KAAK,EAAhG,OAAO,8DAA8D,EAAE,UAAU;QAC9D,MAAM;QACT,KAAK,EAArB,MAAM;QACU,IAAI,EAApB,MAAM;QACU,IAAI;YACI,MAAM;YACE,UAAU,EAA1C,UAAU,MAAM,CAAC;YACI,MAAM,EAA3B,MAAM;;QACU,MAAM,EAAtB,MAAM;aAsEhB;;CACJ;kCApMiC,kDAAkD;mBAFjE,0CAA0C;kCAI3B,kCAAkC"}
1
+ {"version":3,"file":"GPUWaterSurface.d.ts","sourceRoot":"","sources":["../../../../../../src/shade/renderer/water/surface/GPUWaterSurface.js"],"names":[],"mappings":"AAoBA,uHAAuH;AACvH,2CAA4C;AAE5C,4EAA4E;AAC5E,6DAKI;AAEJ;;;;;;GAMG;AACH;IACI,4FAA4F;IAC5F,yBAAgC;IAChC,oEAAoE;IACpE,0BAA0B;IAC1B,6EAA6E;IAC7E,eAAc;IACd;;;OAGG;IACH,kBAAiB;IAejB,mCAA0D;IAC1D,kCAAwD;IACxD,kCAA0D;IAC1D,kCAA0D;IAC1D,kHAAkH;IAClH,uBAAmC;IACnC,qGAAqG;IACrG,0BAAyC;IACzC,gHAAgH;IAChH,8BAA2D;IAC3D,mCAA2C;IAE3C;;;OAGG;IACH,YAFW,MAAM,QAKhB;IAED,gBAWC;IAuBD;;;;;;;;;;;OAWG;IACH;QAVsG,KAAK,EAAhG,OAAO,8DAA8D,EAAE,UAAU;QAC9D,MAAM;QACT,KAAK,EAArB,MAAM;QACU,IAAI,EAApB,MAAM;QACU,IAAI;YACI,MAAM;YACE,UAAU,EAA1C,UAAU,MAAM,CAAC;YACI,MAAM,EAA3B,MAAM;;QACU,MAAM,EAAtB,MAAM;aAsEhB;;CACJ;kCArMiC,kDAAkD;mBAHjE,0CAA0C;kCAK3B,kCAAkC"}
@@ -1,5 +1,6 @@
1
1
  import Signal from "../../../../core/events/signal/Signal.js";
2
2
  import { assert } from "../../../../core/assert.js";
3
+ import { round_up } from "../../../../core/math/round_up.js";
3
4
  import { SamplerDescriptor } from "../../../descriptor/texture/SamplerDescriptor.js";
4
5
  import { GPUWaterSpectrum } from "./spectrum/GPUWaterSpectrum.js";
5
6
  import { GPUWaterParticles } from "./particles/GPUWaterParticles.js";
@@ -104,7 +105,8 @@ export class GPUWaterSurface {
104
105
  usage: GPUBufferUsage.STORAGE | GPUBufferUsage.COPY_DST | GPUBufferUsage.COPY_SRC | usage });
105
106
  this.#steep = buffer('steep bodies', rows * 4);
106
107
  this.#activity = buffer('activity', rows * 4);
107
- const list = label => buffer(label, WATER_LIST_HEADER_BYTES + rows * 4);
108
+ // rows are aligned to 16, so WGSL rounds a list up to whole blocks of 4: one row binds 32 bytes, not 20
109
+ const list = label => buffer(label, WATER_LIST_HEADER_BYTES + round_up(rows, 4) * 4);
108
110
  this.#lists = { visible: list('visible rows'), active: list('active rows'), emit: list('emit rows') };
109
111
  this.#commands ??= buffer('surface commands', WATER_SURFACE_COMMAND_COUNT * WATER_SURFACE_COMMAND_STRIDE, GPUBufferUsage.INDIRECT);
110
112
  this.#rows = rows;
@@ -1 +1 @@
1
- {"version":3,"file":"graph_water_tessellation.d.ts","sourceRoot":"","sources":["../../../../../../src/shade/renderer/water/surface/graph_water_tessellation.js"],"names":[],"mappings":"AAiCA;;;;;;;GAOG;AACH,8CAHW;IAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAC,GACtE;IAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAC,CAQrH;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH;IAXsG,KAAK,EAAhG,OAAO,8DAA8D,EAAE,UAAU;IACjE,KAAK,EAArB,MAAM;IACU,MAAM,EAAtB,MAAM;IACU,QAAQ,EAAxB,MAAM;IACU,UAAU,EAA1B,MAAM;IACU,gBAAgB,EAAhC,MAAM;IAC2E,GAAG,EAApF;QAAC,MAAM,EAAE,MAAM,CAAC;QAAC,YAAY,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAC;IAC+B,MAAM,EAA5G;QAAC,UAAU,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAC;IACzE,KAAK;IACtB;IAAC,UAAU,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,CAAA;CAAC,CAsGrF"}
1
+ {"version":3,"file":"graph_water_tessellation.d.ts","sourceRoot":"","sources":["../../../../../../src/shade/renderer/water/surface/graph_water_tessellation.js"],"names":[],"mappings":"AAqCA;;;;;;;GAOG;AACH,8CAHW;IAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAC,GACtE;IAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAC,CAQrH;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH;IAXsG,KAAK,EAAhG,OAAO,8DAA8D,EAAE,UAAU;IACjE,KAAK,EAArB,MAAM;IACU,MAAM,EAAtB,MAAM;IACU,QAAQ,EAAxB,MAAM;IACU,UAAU,EAA1B,MAAM;IACU,gBAAgB,EAAhC,MAAM;IAC2E,GAAG,EAApF;QAAC,MAAM,EAAE,MAAM,CAAC;QAAC,YAAY,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAC;IAC+B,MAAM,EAA5G;QAAC,UAAU,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAC;IACzE,KAAK;IACtB;IAAC,UAAU,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,CAAA;CAAC,CAyGrF"}
@@ -1,11 +1,15 @@
1
1
  import { assert } from "../../../../core/assert.js";
2
2
  import { BufferResourceDescriptor } from "../../../device/graph/BufferResourceDescriptor.js";
3
3
  import { GEOMETRY_MESHLET_TRIANGLE_LIMIT } from "../../geometry/meshlet/GEOMETRY_MESHLET_TRIANGLE_LIMIT.js";
4
- import { graph_prefix_scan_csdldf } from "../../gpu_primitive/prefix_sum/v1/graph_prefix_scan_csdldf.js";
4
+ import {
5
+ graph_prefix_scan_csdldf,
6
+ prefix_scan_csdldf_output_descriptor
7
+ } from "../../gpu_primitive/prefix_sum/v1/graph_prefix_scan_csdldf.js";
5
8
  import {
6
9
  build_indirect_compute_dispatch_command,
7
10
  INDIRECT_COMPUTE_COMMAND_DESCRIPTOR
8
11
  } from "../../gpu_primitive/indirect/IndirectComputeCommandBuildPass.js";
12
+ import { graph_create_buffer } from "../../shader/graph/graph_create_buffer.js";
9
13
  import { WATER_LOD_VIEW_STRUCT } from "./lod/WATER_LOD.js";
10
14
  import {
11
15
  shader_water_lod_candidate_command,
@@ -73,6 +77,9 @@ export function graph_water_tessellation({ graph, scene, camera, meshlets, lod_b
73
77
  const geometry_bindings = { scene_database: scene.scene_database_buffer,
74
78
  meshlet_metadata: scene.geometries.meshlets.buffer_metadata, meshlet_data: scene.geometries.meshlets.buffer_data };
75
79
  const limits_value = { ...limits };
80
+ // a counts collection's inclusive sums, into a collection of their own
81
+ const sums_of = (counts, label, elements) => graph_prefix_scan_csdldf({ graph, input: counts,
82
+ output: graph_create_buffer(graph, label, prefix_scan_csdldf_output_descriptor(elements)), element_max_count: elements });
76
83
 
77
84
  // per triangle slot of the drawn meshlets: drawn as itself, or its candidates
78
85
  const triangles_data = {};
@@ -88,8 +95,8 @@ export function graph_water_tessellation({ graph, scene, camera, meshlets, lod_b
88
95
  triangles_data.command = triangles.create('Water lod triangles command', INDIRECT_COMPUTE_COMMAND_DESCRIPTOR);
89
96
  triangles_data.counts = triangles.create('Water lod triangle counts', counts_descriptor(slots));
90
97
  triangles_data.flats = triangles.create('Water lod flat counts', counts_descriptor(slots));
91
- const triangle_sums = graph_prefix_scan_csdldf({ graph, data: triangles_data.counts, element_max_count: slots });
92
- const flat_sums = graph_prefix_scan_csdldf({ graph, data: triangles_data.flats, element_max_count: slots });
98
+ const triangle_sums = sums_of(triangles_data.counts, 'Water lod triangle sums', slots);
99
+ const flat_sums = sums_of(triangles_data.flats, 'Water lod flat sums', slots);
93
100
 
94
101
  // the candidates' dispatch; the flat triangles' records and draw
95
102
  const command_data = {};
@@ -133,7 +140,7 @@ export function graph_water_tessellation({ graph, scene, camera, meshlets, lod_b
133
140
  budget * WATER_LOD_CANDIDATE_ROW_WORDS * 4, GPUBufferUsage.STORAGE));
134
141
  // the interior, boundary and patch counts of every candidate, one region after another, scanned once
135
142
  candidates_data.counts = candidates.create('Water lod cell counts', counts_descriptor(3 * budget));
136
- const list_sums = graph_prefix_scan_csdldf({ graph, data: candidates_data.counts, element_max_count: 3 * budget });
143
+ const list_sums = sums_of(candidates_data.counts, 'Water lod cell sums', 3 * budget);
137
144
 
138
145
  // each list's records; the boundary cells' polygons
139
146
  const lists = [
@@ -1 +1 @@
1
- {"version":3,"file":"GPUWaterParticles.d.ts","sourceRoot":"","sources":["../../../../../../../src/shade/renderer/water/surface/particles/GPUWaterParticles.js"],"names":[],"mappings":"AA+BA,kHAAkH;AAClH,+CAAgD;AAUhD;;;;GAIG;AACH;IAuBI,uFAAuF;IACvF,yBAAuC;IACvC,kGAAkG;IAClG,yBAAuC;IACvC,uGAAuG;IACvG,6BAA+C;IAC/C,mEAAmE;IACnE,2BAAyD;IACzD,uBAAyC;IAEzC;;;;;;;;;;;OAWG;IACH,qCALW,MAAM,QACN,MAAM,UACK,OAAO,8CAA8C,EAAE,sBAAsB,KAAE,IAAI,GAAC,IAAI,CAuD7G;IAED,gBAcC;IAED;;;;;;;;;;;;;;;OAeG;IACH;QATyG,KAAK,EAAnG,OAAO,iEAAiE,EAAE,UAAU;QACpE,KAAK,EAArB,MAAM;QACa,KAAK;QACL,QAAQ;QACR,SAAS;QACT,QAAQ;QACX,YAAY,EAA5B,MAAM;QACU,EAAE,EAAlB,MAAM;aAgGhB;;CACJ"}
1
+ {"version":3,"file":"GPUWaterParticles.d.ts","sourceRoot":"","sources":["../../../../../../../src/shade/renderer/water/surface/particles/GPUWaterParticles.js"],"names":[],"mappings":"AAkCA,kHAAkH;AAClH,+CAAgD;AAUhD;;;;GAIG;AACH;IA0BI,uFAAuF;IACvF,yBAAuC;IACvC,kGAAkG;IAClG,yBAAuC;IACvC,uGAAuG;IACvG,6BAA+C;IAC/C,mEAAmE;IACnE,2BAAyD;IACzD,uBAAyC;IAEzC;;;;;;;;;;;OAWG;IACH,qCALW,MAAM,QACN,MAAM,UACK,OAAO,8CAA8C,EAAE,sBAAsB,KAAE,IAAI,GAAC,IAAI,CA6D7G;IAED,gBAgBC;IAED;;;;;;;;;;;;;;;OAeG;IACH;QATyG,KAAK,EAAnG,OAAO,iEAAiE,EAAE,UAAU;QACpE,KAAK,EAArB,MAAM;QACa,KAAK;QACL,QAAQ;QACR,SAAS;QACT,QAAQ;QACX,YAAY,EAA5B,MAAM;QACU,EAAE,EAAlB,MAAM;aAmGhB;;CACJ"}