@woosh/meep-engine 2.109.0 → 2.109.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (311) hide show
  1. package/build/meep.cjs +150 -199
  2. package/build/meep.min.js +1 -1
  3. package/build/meep.module.js +150 -199
  4. package/package.json +1 -1
  5. package/src/core/binary/BitSet.d.ts +6 -0
  6. package/src/core/binary/BitSet.d.ts.map +1 -1
  7. package/src/core/binary/BitSet.js +14 -42
  8. package/src/core/binary/align_32.d.ts +7 -0
  9. package/src/core/binary/align_32.d.ts.map +1 -0
  10. package/src/core/binary/align_32.js +8 -0
  11. package/src/core/binary/align_32.spec.d.ts +2 -0
  12. package/src/core/binary/align_32.spec.d.ts.map +1 -0
  13. package/src/core/binary/align_32.spec.js +11 -0
  14. package/src/core/binary/align_4.js +2 -1
  15. package/src/core/binary/ctz32.d.ts.map +1 -1
  16. package/src/core/binary/ctz32.js +12 -11
  17. package/src/core/binary/lsb_32.d.ts +9 -0
  18. package/src/core/binary/lsb_32.d.ts.map +1 -0
  19. package/src/core/binary/lsb_32.js +12 -0
  20. package/src/core/binary/msb_32.d.ts +2 -0
  21. package/src/core/binary/msb_32.d.ts.map +1 -0
  22. package/src/core/binary/msb_32.js +20 -0
  23. package/src/core/binary/msb_lut_de_bruijn.d.ts +7 -0
  24. package/src/core/binary/msb_lut_de_bruijn.d.ts.map +1 -0
  25. package/src/core/binary/msb_lut_de_bruijn.js +9 -0
  26. package/src/core/binary/reinterpret_int32_as_float32.d.ts +7 -0
  27. package/src/core/binary/reinterpret_int32_as_float32.d.ts.map +1 -0
  28. package/src/core/binary/reinterpret_int32_as_float32.js +14 -0
  29. package/src/core/binary/reverse_bits_uint32.d.ts +8 -0
  30. package/src/core/binary/reverse_bits_uint32.d.ts.map +1 -0
  31. package/src/core/binary/reverse_bits_uint32.js +17 -0
  32. package/src/core/binary/reverse_bits_uint32.spec.d.ts +2 -0
  33. package/src/core/binary/reverse_bits_uint32.spec.d.ts.map +1 -0
  34. package/src/core/binary/reverse_bits_uint32.spec.js +18 -0
  35. package/src/core/bvh2/bvh3/BVH.d.ts.map +1 -1
  36. package/src/core/bvh2/bvh3/BVH.js +13 -18
  37. package/src/core/bvh2/bvh3/ebvh_build_for_geometry_incremental.d.ts.map +1 -1
  38. package/src/core/bvh2/bvh3/ebvh_build_for_geometry_incremental.js +3 -1
  39. package/src/core/bvh2/bvh3/ebvh_build_for_geometry_morton.d.ts.map +1 -1
  40. package/src/core/bvh2/bvh3/ebvh_build_for_geometry_morton.js +6 -7
  41. package/src/core/bvh2/bvh3/ebvh_build_hierarchy.d.ts.map +1 -1
  42. package/src/core/bvh2/bvh3/ebvh_build_hierarchy.js +4 -0
  43. package/src/core/bvh2/bvh3/query/backtracking/bvh_backtracking_query_leaves_ray.d.ts +16 -0
  44. package/src/core/bvh2/bvh3/query/backtracking/bvh_backtracking_query_leaves_ray.d.ts.map +1 -0
  45. package/src/core/bvh2/bvh3/query/backtracking/bvh_backtracking_query_leaves_ray.js +130 -0
  46. package/src/core/bvh2/bvh3/query/cache/BVH_QUERY_CACHE_SIZE.d.ts +2 -0
  47. package/src/core/bvh2/bvh3/query/cache/BVH_QUERY_CACHE_SIZE.d.ts.map +1 -0
  48. package/src/core/bvh2/bvh3/query/cache/BVH_QUERY_CACHE_SIZE.js +1 -0
  49. package/src/core/bvh2/bvh3/query/cache/bvh_query_cache_hash_v3.d.ts +9 -0
  50. package/src/core/bvh2/bvh3/query/cache/bvh_query_cache_hash_v3.d.ts.map +1 -0
  51. package/src/core/bvh2/bvh3/query/cache/bvh_query_cache_hash_v3.js +31 -0
  52. package/src/core/collection/array/array_quick_sort_by_lookup_map.d.ts +9 -0
  53. package/src/core/collection/array/array_quick_sort_by_lookup_map.d.ts.map +1 -0
  54. package/src/core/collection/array/array_quick_sort_by_lookup_map.js +79 -0
  55. package/src/core/collection/array/array_quick_sort_by_lookup_uint.d.ts +8 -0
  56. package/src/core/collection/array/array_quick_sort_by_lookup_uint.d.ts.map +1 -0
  57. package/src/core/collection/array/{array_quick_sort_by_lookup.js → array_quick_sort_by_lookup_uint.js} +1 -1
  58. package/src/core/collection/array/array_shuffle.js +1 -1
  59. package/src/core/collection/array/array_swap_one.d.ts.map +1 -1
  60. package/src/core/collection/array/array_swap_one.js +6 -0
  61. package/src/core/events/signal/Signal.d.ts.map +1 -1
  62. package/src/core/events/signal/Signal.js +10 -10
  63. package/src/core/geom/2d/compute_triangle_area_2d.d.ts.map +1 -1
  64. package/src/core/geom/2d/compute_triangle_area_2d.js +5 -3
  65. package/src/core/geom/3d/Ray3.d.ts +6 -0
  66. package/src/core/geom/3d/Ray3.d.ts.map +1 -1
  67. package/src/core/geom/3d/Ray3.js +24 -0
  68. package/src/core/geom/3d/aabb/aabb3_compute_distance_above_plane_min.d.ts +16 -0
  69. package/src/core/geom/3d/aabb/aabb3_compute_distance_above_plane_min.d.ts.map +1 -0
  70. package/src/core/geom/3d/aabb/aabb3_compute_distance_above_plane_min.js +29 -0
  71. package/src/core/geom/3d/aabb/aabb3_from_v3_array_transformed.d.ts +2 -2
  72. package/src/core/geom/3d/aabb/aabb3_from_v3_array_transformed.d.ts.map +1 -1
  73. package/src/core/geom/3d/aabb/aabb3_from_v3_array_transformed.js +6 -6
  74. package/src/core/geom/3d/aabb/aabb3_overlaps_ray_segment.d.ts +11 -0
  75. package/src/core/geom/3d/aabb/aabb3_overlaps_ray_segment.d.ts.map +1 -0
  76. package/src/core/geom/3d/aabb/aabb3_overlaps_ray_segment.js +61 -0
  77. package/src/core/geom/3d/eulerAnglesFromMatrix.d.ts +2 -2
  78. package/src/core/geom/3d/eulerAnglesFromMatrix.d.ts.map +1 -1
  79. package/src/core/geom/3d/eulerAnglesFromMatrix.js +28 -25
  80. package/src/core/geom/3d/morton/v3_morton_encode_bounded.d.ts +2 -2
  81. package/src/core/geom/3d/morton/v3_morton_encode_bounded.d.ts.map +1 -1
  82. package/src/core/geom/3d/morton/v3_morton_encode_bounded.js +1 -1
  83. package/src/core/geom/3d/normal/octahedron/decode_octahedron_to_unit.d.ts +2 -2
  84. package/src/core/geom/3d/normal/octahedron/decode_octahedron_to_unit.d.ts.map +1 -1
  85. package/src/core/geom/3d/normal/octahedron/decode_octahedron_to_unit.js +1 -1
  86. package/src/core/geom/3d/ray/ray3_shift_origin_along_direction.js +2 -2
  87. package/src/core/geom/3d/sphere/harmonics/sh3_convolve_with_cosine_kernel.js +2 -1
  88. package/src/core/geom/3d/sphere/harmonics/sh3_vector_accumulate.d.ts +12 -0
  89. package/src/core/geom/3d/sphere/harmonics/sh3_vector_accumulate.d.ts.map +1 -0
  90. package/src/core/geom/3d/sphere/harmonics/sh3_vector_accumulate.js +40 -0
  91. package/src/core/geom/3d/sphere/harmonics/sh3_vector_accumulate.spec.d.ts +2 -0
  92. package/src/core/geom/3d/sphere/harmonics/sh3_vector_accumulate.spec.d.ts.map +1 -0
  93. package/src/core/geom/3d/sphere/harmonics/sh3_vector_accumulate.spec.js +27 -0
  94. package/src/core/geom/3d/sphere/sphere_intersects_ray.js +1 -1
  95. package/src/core/geom/3d/tetrahedra/tetrahedron_compute_circumsphere.d.ts.map +1 -1
  96. package/src/core/geom/3d/tetrahedra/tetrahedron_compute_circumsphere.js +24 -188
  97. package/src/core/geom/3d/tetrahedra/triangle/prototype.js +1 -1
  98. package/src/core/geom/3d/tetrahedra/visualize_tetrahedral_mesh.d.ts +11 -0
  99. package/src/core/geom/3d/tetrahedra/visualize_tetrahedral_mesh.d.ts.map +1 -0
  100. package/src/core/geom/3d/tetrahedra/visualize_tetrahedral_mesh.js +42 -0
  101. package/src/core/geom/3d/topology/samples/sampleFloodFill.js +2 -2
  102. package/src/core/geom/3d/topology/tm_face_area.js +2 -2
  103. package/src/core/geom/3d/triangle/{computeTriangleSurfaceArea.d.ts → compute_triangle_area_3d.d.ts} +2 -2
  104. package/src/core/geom/3d/triangle/compute_triangle_area_3d.d.ts.map +1 -0
  105. package/src/core/geom/3d/triangle/{computeTriangleSurfaceArea.js → compute_triangle_area_3d.js} +2 -4
  106. package/src/core/geom/Quaternion.d.ts.map +1 -1
  107. package/src/core/geom/Quaternion.js +13 -102
  108. package/src/core/geom/Quaternion.spec.js +2 -2
  109. package/src/core/geom/Vector1.d.ts.map +1 -1
  110. package/src/core/geom/Vector1.js +14 -6
  111. package/src/core/geom/vec/vector_copy.d.ts +10 -0
  112. package/src/core/geom/vec/vector_copy.d.ts.map +1 -0
  113. package/src/core/geom/vec/vector_copy.js +13 -0
  114. package/src/core/{math/vector_nd_dot.d.ts → geom/vec/vector_dot.d.ts} +2 -2
  115. package/src/core/geom/vec/vector_dot.d.ts.map +1 -0
  116. package/src/core/{math/vector_nd_dot.js → geom/vec/vector_dot.js} +1 -1
  117. package/src/core/{math/vector_nd_normalize.d.ts → geom/vec/vector_normalize.d.ts} +2 -2
  118. package/src/core/geom/vec/vector_normalize.d.ts.map +1 -0
  119. package/src/core/{math/vector_nd_normalize.js → geom/vec/vector_normalize.js} +1 -1
  120. package/src/core/geom/vec/vector_normalize.spec.d.ts +2 -0
  121. package/src/core/geom/vec/vector_normalize.spec.d.ts.map +1 -0
  122. package/src/core/{math/vector_nd_normalize.spec.js → geom/vec/vector_normalize.spec.js} +3 -3
  123. package/src/core/geom/vec/vector_scale_array.d.ts +11 -0
  124. package/src/core/geom/vec/vector_scale_array.d.ts.map +1 -0
  125. package/src/core/geom/vec/vector_scale_array.js +31 -0
  126. package/src/core/geom/vec3/v3_array_displace_in_direction.d.ts +14 -0
  127. package/src/core/geom/vec3/v3_array_displace_in_direction.d.ts.map +1 -0
  128. package/src/core/geom/vec3/{v3_shift_along_direction.js → v3_array_displace_in_direction.js} +1 -1
  129. package/src/core/geom/vec3/v3_displace_in_direction.d.ts +7 -7
  130. package/src/core/geom/vec3/v3_displace_in_direction.d.ts.map +1 -1
  131. package/src/core/geom/vec3/v3_displace_in_direction.js +20 -17
  132. package/src/core/geom/vec3/v3_displace_in_direction.spec.d.ts +2 -0
  133. package/src/core/geom/vec3/v3_displace_in_direction.spec.d.ts.map +1 -0
  134. package/src/core/geom/vec3/v3_displace_in_direction.spec.js +80 -0
  135. package/src/core/geom/vec3/v3_dot_array_array.js +2 -0
  136. package/src/core/geom/vec4/v4_length.d.ts +10 -0
  137. package/src/core/geom/vec4/v4_length.d.ts.map +1 -0
  138. package/src/core/geom/vec4/v4_length.js +13 -0
  139. package/src/core/geom/vec4/v4_length_sqr.js +2 -1
  140. package/src/core/graph/eigen/matrix_eigenvalues_in_place.spec.js +31 -1
  141. package/src/core/math/FLT_EPSILON_64.d.ts +6 -0
  142. package/src/core/math/FLT_EPSILON_64.d.ts.map +1 -0
  143. package/src/core/math/FLT_EPSILON_64.js +5 -0
  144. package/src/core/math/gaussian.d.ts +2 -2
  145. package/src/core/math/gaussian.js +2 -2
  146. package/src/core/math/linalg/README.md +1 -0
  147. package/src/core/math/linalg/lu_factor_linear_system.d.ts +13 -0
  148. package/src/core/math/linalg/lu_factor_linear_system.d.ts.map +1 -0
  149. package/src/core/math/linalg/lu_factor_linear_system.js +112 -0
  150. package/src/core/math/linalg/lu_solve_linear_system.d.ts +14 -0
  151. package/src/core/math/linalg/lu_solve_linear_system.d.ts.map +1 -0
  152. package/src/core/math/linalg/lu_solve_linear_system.js +51 -0
  153. package/src/core/math/linalg/solve_linear_system.d.ts +14 -0
  154. package/src/core/math/linalg/solve_linear_system.d.ts.map +1 -0
  155. package/src/core/math/linalg/solve_linear_system.js +52 -0
  156. package/src/core/math/linalg/solve_linear_system.spec.d.ts +2 -0
  157. package/src/core/math/linalg/solve_linear_system.spec.d.ts.map +1 -0
  158. package/src/core/math/linalg/solve_linear_system.spec.js +70 -0
  159. package/src/core/math/linalg/solve_linear_system_GEPP_2x2.d.ts +10 -0
  160. package/src/core/math/linalg/solve_linear_system_GEPP_2x2.d.ts.map +1 -0
  161. package/src/core/math/linalg/solve_linear_system_GEPP_2x2.js +91 -0
  162. package/src/core/math/solveQuadratic.d.ts.map +1 -1
  163. package/src/core/math/solveQuadratic.js +2 -0
  164. package/src/core/math/statistics/gaussian_amplitude.d.ts +8 -0
  165. package/src/core/math/statistics/gaussian_amplitude.d.ts.map +1 -0
  166. package/src/core/math/statistics/gaussian_amplitude.js +13 -0
  167. package/src/core/math/statistics/halton_sequence.js +3 -3
  168. package/src/core/math/statistics/halton_sequence.spec.js +18 -0
  169. package/src/core/math/statistics/hammersley_sequence.d.ts +9 -0
  170. package/src/core/math/statistics/hammersley_sequence.d.ts.map +1 -0
  171. package/src/core/math/statistics/hammersley_sequence.js +25 -0
  172. package/src/core/math/statistics/hammersley_sequence_2d.d.ts +9 -0
  173. package/src/core/math/statistics/hammersley_sequence_2d.d.ts.map +1 -0
  174. package/src/core/math/statistics/hammersley_sequence_2d.js +17 -0
  175. package/src/core/math/statistics/radical_inverse_VdC_base_2.d.ts +8 -0
  176. package/src/core/math/statistics/radical_inverse_VdC_base_2.d.ts.map +1 -0
  177. package/src/core/math/statistics/radical_inverse_VdC_base_2.js +15 -0
  178. package/src/core/math/statistics/radical_inverse_VdC_base_2.spec.d.ts +2 -0
  179. package/src/core/math/statistics/radical_inverse_VdC_base_2.spec.d.ts.map +1 -0
  180. package/src/core/math/statistics/radical_inverse_VdC_base_2.spec.js +9 -0
  181. package/src/core/model/node-graph/node/NodeInstance.d.ts.map +1 -1
  182. package/src/core/model/node-graph/node/NodeInstance.js +44 -12
  183. package/src/core/model/node-graph/node/NodeInstance.spec.d.ts +2 -0
  184. package/src/core/model/node-graph/node/NodeInstance.spec.d.ts.map +1 -0
  185. package/src/core/model/node-graph/node/NodeInstance.spec.js +82 -0
  186. package/src/core/model/node-graph/node/NodeInstancePortReference.d.ts.map +1 -1
  187. package/src/core/model/node-graph/node/NodeInstancePortReference.js +9 -0
  188. package/src/core/model/node-graph/node/NodeInstancePortReference.spec.js +20 -0
  189. package/src/core/model/node-graph/node/Port.d.ts.map +1 -1
  190. package/src/core/model/node-graph/node/Port.js +5 -12
  191. package/src/core/model/node-graph/node/PortDirection.d.ts.map +1 -1
  192. package/src/core/model/node-graph/node/PortDirection.js +7 -1
  193. package/src/engine/asset/CORS/CrossOriginConfig.d.ts.map +1 -1
  194. package/src/engine/asset/CORS/CrossOriginConfig.js +6 -4
  195. package/src/engine/graphics/geometry/computeMeshSurfaceArea.js +2 -2
  196. package/src/engine/graphics/impostors/octahedral/grid/OctahedralUvEncoder.d.ts.map +1 -1
  197. package/src/engine/graphics/impostors/octahedral/grid/OctahedralUvEncoder.js +33 -3
  198. package/src/engine/graphics/impostors/octahedral/prototypeBaker.js +9 -7
  199. package/src/engine/graphics/particles/particular/engine/parameter/sample/RGB_LUT_INFERNO.d.ts +6 -0
  200. package/src/engine/graphics/particles/particular/engine/parameter/sample/RGB_LUT_INFERNO.d.ts.map +1 -0
  201. package/src/engine/graphics/particles/particular/engine/parameter/sample/RGB_LUT_INFERNO.js +18 -0
  202. package/src/engine/graphics/particles/particular/engine/parameter/sample/RGB_LUT_TURBO.d.ts +6 -0
  203. package/src/engine/graphics/particles/particular/engine/parameter/sample/RGB_LUT_TURBO.d.ts.map +1 -0
  204. package/src/engine/graphics/particles/particular/engine/parameter/sample/RGB_LUT_TURBO.js +266 -0
  205. package/src/engine/graphics/particles/particular/engine/parameter/sample/RGB_LUT_VIRIDIS.d.ts +7 -0
  206. package/src/engine/graphics/particles/particular/engine/parameter/sample/RGB_LUT_VIRIDIS.d.ts.map +1 -0
  207. package/src/engine/graphics/particles/particular/engine/parameter/sample/RGB_LUT_VIRIDIS.js +19 -0
  208. package/src/engine/graphics/sh3/SH3VisualisationMaterial.js +9 -9
  209. package/src/engine/graphics/sh3/fromCubeRenderTarget.d.ts.map +1 -1
  210. package/src/engine/graphics/sh3/fromCubeRenderTarget.js +14 -17
  211. package/src/engine/graphics/sh3/gi/material/MaterialTransformer.d.ts.map +1 -1
  212. package/src/engine/graphics/sh3/gi/material/MaterialTransformer.js +0 -2
  213. package/src/engine/graphics/sh3/lpv/LightProbeVolume.d.ts +7 -29
  214. package/src/engine/graphics/sh3/lpv/LightProbeVolume.d.ts.map +1 -1
  215. package/src/engine/graphics/sh3/lpv/LightProbeVolume.js +52 -164
  216. package/src/engine/graphics/sh3/lpv/LightProbeVolumeBaker.d.ts +13 -0
  217. package/src/engine/graphics/sh3/lpv/LightProbeVolumeBaker.d.ts.map +1 -0
  218. package/src/engine/graphics/sh3/lpv/LightProbeVolumeBaker.js +63 -0
  219. package/src/engine/graphics/sh3/lpv/PathTracerProbeRenderer.d.ts +1 -0
  220. package/src/engine/graphics/sh3/lpv/PathTracerProbeRenderer.d.ts.map +1 -1
  221. package/src/engine/graphics/sh3/lpv/PathTracerProbeRenderer.js +33 -16
  222. package/src/engine/graphics/sh3/lpv/build_probes_for_scene.d.ts.map +1 -1
  223. package/src/engine/graphics/sh3/lpv/build_probes_for_scene.js +4 -29
  224. package/src/engine/graphics/sh3/lpv/{LightProbeVolumeSerializationAdapter.d.ts → serialization/LightProbeVolumeSerializationAdapter.d.ts} +2 -2
  225. package/src/engine/graphics/sh3/lpv/serialization/LightProbeVolumeSerializationAdapter.d.ts.map +1 -0
  226. package/src/engine/graphics/sh3/lpv/{LightProbeVolumeSerializationAdapter.js → serialization/LightProbeVolumeSerializationAdapter.js} +2 -2
  227. package/src/engine/graphics/sh3/lpv/sh3_bake_depth.d.ts +13 -0
  228. package/src/engine/graphics/sh3/lpv/sh3_bake_depth.d.ts.map +1 -0
  229. package/src/engine/graphics/sh3/lpv/sh3_bake_depth.js +71 -0
  230. package/src/engine/graphics/sh3/lpv/worker/lpv_build_worker.d.ts +2 -0
  231. package/src/engine/graphics/sh3/lpv/worker/lpv_build_worker.d.ts.map +1 -0
  232. package/src/engine/graphics/sh3/lpv/worker/lpv_build_worker.js +38 -0
  233. package/src/engine/graphics/sh3/path_tracer/BufferedGeometryBVH.d.ts +1 -7
  234. package/src/engine/graphics/sh3/path_tracer/BufferedGeometryBVH.d.ts.map +1 -1
  235. package/src/engine/graphics/sh3/path_tracer/BufferedGeometryBVH.js +58 -147
  236. package/src/engine/graphics/sh3/path_tracer/PathTracedMesh.d.ts +13 -9
  237. package/src/engine/graphics/sh3/path_tracer/PathTracedMesh.d.ts.map +1 -1
  238. package/src/engine/graphics/sh3/path_tracer/PathTracedMesh.js +74 -54
  239. package/src/engine/graphics/sh3/path_tracer/PathTracedScene.d.ts +23 -5
  240. package/src/engine/graphics/sh3/path_tracer/PathTracedScene.d.ts.map +1 -1
  241. package/src/engine/graphics/sh3/path_tracer/PathTracedScene.js +211 -59
  242. package/src/engine/graphics/sh3/path_tracer/PathTracer.js +1 -1
  243. package/src/engine/graphics/sh3/path_tracer/build_bvh_nodes_distances_along_ray.d.ts +15 -0
  244. package/src/engine/graphics/sh3/path_tracer/build_bvh_nodes_distances_along_ray.d.ts.map +1 -0
  245. package/src/engine/graphics/sh3/path_tracer/build_bvh_nodes_distances_along_ray.js +46 -0
  246. package/src/engine/graphics/sh3/path_tracer/build_bvh_nodes_distances_sqr_to_point.d.ts +14 -0
  247. package/src/engine/graphics/sh3/path_tracer/build_bvh_nodes_distances_sqr_to_point.d.ts.map +1 -0
  248. package/src/engine/graphics/sh3/path_tracer/build_bvh_nodes_distances_sqr_to_point.js +43 -0
  249. package/src/engine/graphics/sh3/path_tracer/geometry/compute_triangle_group_aabb3.d.ts.map +1 -0
  250. package/src/engine/graphics/sh3/path_tracer/{compute_triangle_group_aabb3.js → geometry/compute_triangle_group_aabb3.js} +2 -2
  251. package/src/engine/graphics/sh3/path_tracer/geometry/construct_ray_hit_from_geometry.d.ts +12 -0
  252. package/src/engine/graphics/sh3/path_tracer/geometry/construct_ray_hit_from_geometry.d.ts.map +1 -0
  253. package/src/engine/graphics/sh3/path_tracer/geometry/construct_ray_hit_from_geometry.js +72 -0
  254. package/src/engine/graphics/sh3/path_tracer/geometry/sample_triangle_attribute.d.ts.map +1 -0
  255. package/src/engine/graphics/sh3/path_tracer/geometry/sort_triangles_by_distance_to_point.d.ts +13 -0
  256. package/src/engine/graphics/sh3/path_tracer/geometry/sort_triangles_by_distance_to_point.d.ts.map +1 -0
  257. package/src/engine/graphics/sh3/path_tracer/geometry/sort_triangles_by_distance_to_point.js +48 -0
  258. package/src/engine/graphics/sh3/path_tracer/material/StandardMaterial.d.ts +1 -0
  259. package/src/engine/graphics/sh3/path_tracer/material/StandardMaterial.d.ts.map +1 -1
  260. package/src/engine/graphics/sh3/path_tracer/material/StandardMaterial.js +4 -0
  261. package/src/engine/graphics/sh3/path_tracer/material/StandardTexture.d.ts +1 -0
  262. package/src/engine/graphics/sh3/path_tracer/material/StandardTexture.d.ts.map +1 -1
  263. package/src/engine/graphics/sh3/path_tracer/material/StandardTexture.js +8 -5
  264. package/src/engine/graphics/sh3/path_tracer/prototypePathTracer.js +24 -18
  265. package/src/engine/graphics/sh3/path_tracer/ray_hit_apply_transform.d.ts +2 -2
  266. package/src/engine/graphics/sh3/path_tracer/ray_hit_apply_transform.d.ts.map +1 -1
  267. package/src/engine/graphics/sh3/path_tracer/ray_hit_apply_transform.js +1 -1
  268. package/src/engine/graphics/sh3/path_tracer/sampling/getBiasedNormalSample.d.ts.map +1 -0
  269. package/src/engine/graphics/sh3/path_tracer/{getBiasedNormalSample.js → sampling/getBiasedNormalSample.js} +1 -1
  270. package/src/engine/graphics/sh3/path_tracer/sampling/random_in_hemisphere.d.ts.map +1 -0
  271. package/src/engine/graphics/sh3/path_tracer/{random_in_hemisphere.js → sampling/random_in_hemisphere.js} +1 -1
  272. package/src/engine/graphics/sh3/path_tracer/sort_bvh_nodes_by_distance_to_point.d.ts +12 -0
  273. package/src/engine/graphics/sh3/path_tracer/sort_bvh_nodes_by_distance_to_point.d.ts.map +1 -0
  274. package/src/engine/graphics/sh3/path_tracer/sort_bvh_nodes_by_distance_to_point.js +46 -0
  275. package/src/engine/graphics/sh3/path_tracer/texture/sample_material.js +2 -2
  276. package/src/engine/graphics/sh3/path_tracer/three_object_to_path_traced_scene.d.ts +7 -0
  277. package/src/engine/graphics/sh3/path_tracer/three_object_to_path_traced_scene.d.ts.map +1 -0
  278. package/src/engine/graphics/sh3/path_tracer/three_object_to_path_traced_scene.js +69 -0
  279. package/src/engine/graphics/sh3/prototypeSH3Probe.js +45 -7
  280. package/src/engine/graphics/sh3/visualise_spherical_harmonic_sphere.d.ts +11 -1
  281. package/src/engine/graphics/sh3/visualise_spherical_harmonic_sphere.d.ts.map +1 -1
  282. package/src/engine/graphics/sh3/visualise_spherical_harmonic_sphere.js +33 -16
  283. package/src/engine/graphics/texture/formatToChannelCount.d.ts.map +1 -1
  284. package/src/engine/graphics/texture/formatToChannelCount.js +14 -1
  285. package/src/engine/graphics/three/three_object_replace_materials.d.ts +7 -0
  286. package/src/engine/graphics/three/three_object_replace_materials.d.ts.map +1 -0
  287. package/src/engine/graphics/three/three_object_replace_materials.js +13 -0
  288. package/src/engine/sound/material/detector/terrain/TerrainSoundMaterialSurfaceDetector.d.ts.map +1 -1
  289. package/src/engine/sound/material/detector/terrain/TerrainSoundMaterialSurfaceDetector.js +6 -6
  290. package/src/core/collection/array/array_quick_sort_by_lookup.d.ts +0 -8
  291. package/src/core/collection/array/array_quick_sort_by_lookup.d.ts.map +0 -1
  292. package/src/core/geom/3d/triangle/computeTriangleSurfaceArea.d.ts.map +0 -1
  293. package/src/core/geom/vec3/v3_shift_along_direction.d.ts +0 -14
  294. package/src/core/geom/vec3/v3_shift_along_direction.d.ts.map +0 -1
  295. package/src/core/math/vector_nd_dot.d.ts.map +0 -1
  296. package/src/core/math/vector_nd_normalize.d.ts.map +0 -1
  297. package/src/core/math/vector_nd_normalize.spec.d.ts +0 -2
  298. package/src/core/math/vector_nd_normalize.spec.d.ts.map +0 -1
  299. package/src/engine/graphics/filter/FlipArrayViaCanvas.d.ts +0 -2
  300. package/src/engine/graphics/filter/FlipArrayViaCanvas.d.ts.map +0 -1
  301. package/src/engine/graphics/filter/FlipArrayViaCanvas.js +0 -13
  302. package/src/engine/graphics/sh3/lpv/LightProbeVolumeSerializationAdapter.d.ts.map +0 -1
  303. package/src/engine/graphics/sh3/path_tracer/compute_triangle_group_aabb3.d.ts.map +0 -1
  304. package/src/engine/graphics/sh3/path_tracer/getBiasedNormalSample.d.ts.map +0 -1
  305. package/src/engine/graphics/sh3/path_tracer/random_in_hemisphere.d.ts.map +0 -1
  306. package/src/engine/graphics/sh3/path_tracer/sample_triangle_attribute.d.ts.map +0 -1
  307. /package/src/engine/graphics/sh3/path_tracer/{compute_triangle_group_aabb3.d.ts → geometry/compute_triangle_group_aabb3.d.ts} +0 -0
  308. /package/src/engine/graphics/sh3/path_tracer/{sample_triangle_attribute.d.ts → geometry/sample_triangle_attribute.d.ts} +0 -0
  309. /package/src/engine/graphics/sh3/path_tracer/{sample_triangle_attribute.js → geometry/sample_triangle_attribute.js} +0 -0
  310. /package/src/engine/graphics/sh3/path_tracer/{getBiasedNormalSample.d.ts → sampling/getBiasedNormalSample.d.ts} +0 -0
  311. /package/src/engine/graphics/sh3/path_tracer/{random_in_hemisphere.d.ts → sampling/random_in_hemisphere.d.ts} +0 -0
package/build/meep.cjs CHANGED
@@ -977,13 +977,6 @@ class SignalHandler {
977
977
  */
978
978
  SignalHandler.prototype.isSignalHandler = true;
979
979
 
980
- /**
981
- *
982
- * @author Alex Goldring
983
- * @copyright Alex Goldring 2014
984
- */
985
-
986
-
987
980
  /**
988
981
  * Common dispatch stack
989
982
  * @readonly
@@ -1600,11 +1593,12 @@ function findSignalHandlerIndexByHandleAndContext(handlers, f, ctx) {
1600
1593
  const l = handlers.length;
1601
1594
 
1602
1595
  for (let i = 0; i < l; i++) {
1603
- const signalHandler = handlers[i];
1596
+ const handler = handlers[i];
1604
1597
 
1605
- if (signalHandler.handle === f && signalHandler.context === ctx) {
1598
+ if (handler.handle === f && handler.context === ctx) {
1606
1599
  return i;
1607
1600
  }
1601
+
1608
1602
  }
1609
1603
 
1610
1604
  return -1;
@@ -1637,7 +1631,7 @@ function removeHandlerByHandler(signal, h) {
1637
1631
  */
1638
1632
  function removeHandlerByHandlerAndContext(signal, h, ctx) {
1639
1633
  const handlers = signal.handlers;
1640
- let i = findSignalHandlerIndexByHandleAndContext(handlers, h, ctx);
1634
+ const i = findSignalHandlerIndexByHandleAndContext(handlers, h, ctx);
1641
1635
 
1642
1636
  if (i >= 0) {
1643
1637
  handlers.splice(i, 1);
@@ -1647,6 +1641,12 @@ function removeHandlerByHandlerAndContext(signal, h, ctx) {
1647
1641
  return false;
1648
1642
  }
1649
1643
 
1644
+ /**
1645
+ *
1646
+ * @param {function} f
1647
+ * @param {*} context
1648
+ * @param {Array} args
1649
+ */
1650
1650
  function dispatchCallback(f, context, args) {
1651
1651
 
1652
1652
  try {
@@ -1938,6 +1938,30 @@ function v3_dot(x0, y0, z0, x1, y1, z1) {
1938
1938
  return (x0 * x1 + y0 * y1 + z0 * z1);
1939
1939
  }
1940
1940
 
1941
+ /**
1942
+ *
1943
+ * @param {number} x
1944
+ * @param {number} y
1945
+ * @param {number} z
1946
+ * @param {number} w
1947
+ * @returns {number}
1948
+ */
1949
+ function v4_length_sqr(x, y, z, w) {
1950
+ return x * x + y * y + z * z + w * w;
1951
+ }
1952
+
1953
+ /**
1954
+ *
1955
+ * @param {number} x
1956
+ * @param {number} y
1957
+ * @param {number} z
1958
+ * @param {number} w
1959
+ * @returns {number}
1960
+ */
1961
+ function v4_length(x, y, z, w) {
1962
+ return Math.sqrt(v4_length_sqr(x, y, z, w));
1963
+ }
1964
+
1941
1965
  /**
1942
1966
  *
1943
1967
  * @param {number} v
@@ -3602,7 +3626,7 @@ let Quaternion$1 = class Quaternion {
3602
3626
  const z = this.z;
3603
3627
  const w = this.w;
3604
3628
 
3605
- return Math.sqrt(x * x + y * y + z * z + w * w);
3629
+ return v4_length(x, y, z, w);
3606
3630
  }
3607
3631
 
3608
3632
  /**
@@ -3614,48 +3638,20 @@ let Quaternion$1 = class Quaternion {
3614
3638
  Quaternion.rotateTowards(this, this, other, max_delta);
3615
3639
  }
3616
3640
 
3617
- /**
3618
- *
3619
- * @param {Vector3} direction
3620
- * @param {Vector3} [up]
3621
- * @param {Vector3} [forward]
3622
- */
3623
- alignToDirection(direction, up = Vector3$1.up, forward = Vector3$1.forward) {
3624
-
3625
- const dot = up.dot(direction);
3626
-
3627
-
3628
- if (Math.abs(dot + 1) < 0.000001) {
3629
- // vector a and b point exactly in the opposite direction,
3630
- // so it is a 180 degrees turn around the up-axis
3631
- this.set(forward.x, forward.y, forward.z, Math.PI);
3632
- } else if (Math.abs(dot - 1) < 0.000001) {
3633
- // vector a and b point exactly in the same direction
3634
- // so we return the identity quaternion
3635
- this.set(0, 0, 0, 1);
3636
- }
3637
-
3638
- const angle = Math.acos(dot);
3639
-
3640
- axis.crossVectors(up, direction);
3641
- axis.normalize();
3642
-
3643
- this.fromAxisAngle(axis, angle);
3644
- }
3645
-
3646
3641
  /**
3647
3642
  *
3648
3643
  * @param {Vector3} source
3649
3644
  * @param {Vector3} target
3645
+ * @param {Vector3} [up]
3650
3646
  */
3651
- lookAt(source, target) {
3647
+ lookAt(source, target, up = Vector3$1.up) {
3652
3648
  const forward = new Vector3$1();
3653
3649
 
3654
3650
  forward.subVectors(target, source);
3655
3651
 
3656
3652
  forward.normalize();
3657
3653
 
3658
- this.alignToDirection(forward);
3654
+ this.lookRotation(forward, up);
3659
3655
  }
3660
3656
 
3661
3657
  /**
@@ -4038,22 +4034,23 @@ let Quaternion$1 = class Quaternion {
4038
4034
  const qW_1 = qW + l0;
4039
4035
 
4040
4036
  //normalize result
4041
- const l1 = Math.sqrt(p0 + qW_1 * qW_1);
4037
+ const l1 = 1 / Math.sqrt(p0 + qW_1 * qW_1);
4042
4038
 
4043
- const x = qX / l1;
4044
- const y = qY / l1;
4045
- const z = qZ / l1;
4046
- const w = qW / l1;
4039
+ const x = qX * l1;
4040
+ const y = qY * l1;
4041
+ const z = qZ * l1;
4042
+ const w = qW * l1;
4047
4043
 
4048
4044
  this.set(x, y, z, w);
4049
4045
  }
4050
4046
 
4051
4047
  /**
4048
+ * NOTE: Vectors need to be normalized
4052
4049
  * Based on blog post: http://lolengine.net/blog/2013/09/18/beautiful-maths-quaternion-from-vectors
4053
4050
  * @param {Vector3} from
4054
4051
  * @param {Vector3} to
4055
4052
  */
4056
- fromUnitVectors2(from, to) {
4053
+ fromUnitVectors(from, to) {
4057
4054
 
4058
4055
  //quat quat::fromtwovectors(vec3 u, vec3 v)
4059
4056
  // {
@@ -4072,7 +4069,7 @@ let Quaternion$1 = class Quaternion {
4072
4069
 
4073
4070
  const uv_dot = v3_dot(ax, ay, az, bx, by, bz);
4074
4071
 
4075
- if (uv_dot === -1) {
4072
+ if (uv_dot < -0.9999999) {
4076
4073
  //to vector is opposite, produce a reversal quaternion
4077
4074
 
4078
4075
  tempvec3.crossVectors(Vector3$1.left, from);
@@ -4116,49 +4113,6 @@ let Quaternion$1 = class Quaternion {
4116
4113
  );
4117
4114
  }
4118
4115
 
4119
- /**
4120
- * Input vectors must be normalized
4121
- * @param {Vector3} from
4122
- * @param {Vector3} to
4123
- */
4124
- fromUnitVectors(from, to) {
4125
-
4126
- const dot = from.dot(to);
4127
-
4128
- let x, y, z, w;
4129
-
4130
- if (dot < -0.9999999) {
4131
- const tempvec3 = new Vector3$1();
4132
-
4133
- tempvec3.crossVectors(Vector3$1.left, from);
4134
-
4135
- if (tempvec3.lengthSqr() < 0.00001) {
4136
- tempvec3.crossVectors(Vector3$1.up, from);
4137
- }
4138
-
4139
- tempvec3.normalize();
4140
-
4141
- this.fromAxisAngle(tempvec3, Math.PI);
4142
- } else if (dot > 0.9999999) {
4143
- x = 0;
4144
- y = 0;
4145
- z = 0;
4146
- w = 1;
4147
-
4148
- this.set(x, y, z, w);
4149
- } else {
4150
- //cross product from x to
4151
-
4152
- x = from.y * to.z - from.z * to.y;
4153
- y = from.z * to.x - from.x * to.z;
4154
- z = from.x * to.y - from.y * to.x;
4155
- w = 1 + dot;
4156
-
4157
- this.set(x, y, z, w);
4158
- this.normalize();
4159
- }
4160
- }
4161
-
4162
4116
  /**
4163
4117
  * @deprecated
4164
4118
  * @param {Matrix4} m
@@ -4345,17 +4299,6 @@ let Quaternion$1 = class Quaternion {
4345
4299
  this.slerpQuaternions(this, other, t);
4346
4300
  }
4347
4301
 
4348
- /**
4349
- * @see https://github.com/gareth-cross/quat/blob/master/include/quaternion.hpp
4350
- * TODO implement
4351
- * @param {Quaternion} a
4352
- * @param {Quaternion} b
4353
- * @param {number} t
4354
- */
4355
- quaternionsInterpolateRungeKutta4(a, b, t) {
4356
- throw new Error('Not Implemented');
4357
- }
4358
-
4359
4302
  /**
4360
4303
  *
4361
4304
  * @param {function} handler
@@ -4675,13 +4618,6 @@ Quaternion$1.prototype.toArray = Quaternion$1.prototype.writeToArray;
4675
4618
  Quaternion$1.identity = Object.freeze(new Quaternion$1(0, 0, 0, 1));
4676
4619
 
4677
4620
 
4678
- /**
4679
- *
4680
- * @type {Vector3}
4681
- */
4682
- const axis = new Vector3$1();
4683
-
4684
-
4685
4621
  const tempvec3 = new Vector3$1();
4686
4622
 
4687
4623
  /**
@@ -50507,6 +50443,14 @@ class Vector1 extends Number {
50507
50443
  return this.set(clamp$1(this.x, low, high));
50508
50444
  }
50509
50445
 
50446
+ /**
50447
+ * Negate sign of the value, if value is 7, it will become -7 and vice versa
50448
+ * Zero is unaffected
50449
+ */
50450
+ negate() {
50451
+ this.set(-this.x);
50452
+ }
50453
+
50510
50454
  /**
50511
50455
  *
50512
50456
  * @param {Vector1|Vector2|Vector3|Vector4} other
@@ -50561,7 +50505,7 @@ class Vector1 extends Number {
50561
50505
  * @param {number[]} array
50562
50506
  * @param {number} offset
50563
50507
  */
50564
- readFromArray(array, offset=0) {
50508
+ readFromArray(array, offset = 0) {
50565
50509
  this.set(array[offset]);
50566
50510
  }
50567
50511
 
@@ -50570,11 +50514,11 @@ class Vector1 extends Number {
50570
50514
  * @param {number[]} array
50571
50515
  * @param {number} offset
50572
50516
  */
50573
- writeToArray(array, offset=0) {
50517
+ writeToArray(array, offset = 0) {
50574
50518
  array[offset] = this.x;
50575
50519
  }
50576
50520
 
50577
- asArray(){
50521
+ asArray() {
50578
50522
  return [this.x];
50579
50523
  }
50580
50524
 
@@ -52484,7 +52428,7 @@ class BVH {
52484
52428
  /**
52485
52429
  *
52486
52430
  * @param {number} id
52487
- * @param {number[]|ArrayLike<number>} aabb
52431
+ * @param {number[]|ArrayLike<number>|AABB3} aabb
52488
52432
  */
52489
52433
  node_set_aabb(id, aabb) {
52490
52434
 
@@ -52625,27 +52569,24 @@ class BVH {
52625
52569
  const float32 = this.__data_float32;
52626
52570
 
52627
52571
  const a_x0 = float32[address_a];
52628
- const b_x0 = float32[address_b];
52629
- const x0 = min2(a_x0, b_x0);
52630
-
52631
52572
  const a_y0 = float32[address_a + 1];
52632
- const b_y0 = float32[address_b + 1];
52633
- const y0 = min2(a_y0, b_y0);
52634
-
52635
52573
  const a_z0 = float32[address_a + 2];
52636
- const b_z0 = float32[address_b + 2];
52637
- const z0 = min2(a_z0, b_z0);
52638
-
52639
52574
  const a_x1 = float32[address_a + 3];
52640
- const b_x1 = float32[address_b + 3];
52641
- const x1 = max2(a_x1, b_x1);
52642
-
52643
52575
  const a_y1 = float32[address_a + 4];
52644
- const b_y1 = float32[address_b + 4];
52645
- const y1 = max2(a_y1, b_y1);
52646
-
52647
52576
  const a_z1 = float32[address_a + 5];
52577
+
52578
+ const b_x0 = float32[address_b];
52579
+ const b_y0 = float32[address_b + 1];
52580
+ const b_z0 = float32[address_b + 2];
52581
+ const b_x1 = float32[address_b + 3];
52582
+ const b_y1 = float32[address_b + 4];
52648
52583
  const b_z1 = float32[address_b + 5];
52584
+
52585
+ const x0 = min2(a_x0, b_x0);
52586
+ const y0 = min2(a_y0, b_y0);
52587
+ const z0 = min2(a_z0, b_z0);
52588
+ const x1 = max2(a_x1, b_x1);
52589
+ const y1 = max2(a_y1, b_y1);
52649
52590
  const z1 = max2(a_z1, b_z1);
52650
52591
 
52651
52592
 
@@ -52778,8 +52719,6 @@ class BVH {
52778
52719
  const uint32 = this.__data_uint32;
52779
52720
 
52780
52721
  do {
52781
- index = this.balance(index);
52782
-
52783
52722
  const address = index * ELEMENT_WORD_COUNT;
52784
52723
 
52785
52724
  const child1 = uint32[address + COLUMN_CHILD_1];
@@ -55143,7 +55082,7 @@ function mortonEncode_magicbits(x, y, z) {
55143
55082
  * @param {number} x
55144
55083
  * @param {number} y
55145
55084
  * @param {number} z
55146
- * @param {number[]} bounds
55085
+ * @param {number[]|AABB3} bounds
55147
55086
  * @returns {number}
55148
55087
  */
55149
55088
  function v3_morton_encode_bounded(x, y, z, bounds) {
@@ -59801,34 +59740,35 @@ function collectIteratorValueToArray(result, iterator) {
59801
59740
  * @return {number}
59802
59741
  */
59803
59742
  function ctz32(x) {
59743
+ let _x = x;
59804
59744
  let n = 0;
59805
59745
 
59806
- if ((x & 0xffff) === 0) {
59807
- x >>= 16;
59746
+ if ((_x & 0xffff) === 0) {
59747
+ _x >>= 16;
59808
59748
  n += 16;
59809
59749
  }
59810
59750
 
59811
- if ((x & 0xff) === 0) {
59812
- x >>= 8;
59751
+ if ((_x & 0xff) === 0) {
59752
+ _x >>= 8;
59813
59753
  n += 8;
59814
59754
  }
59815
59755
 
59816
- if ((x & 0xf) === 0) {
59817
- x >>= 4;
59756
+ if ((_x & 0xf) === 0) {
59757
+ _x >>= 4;
59818
59758
  n += 4;
59819
59759
  }
59820
59760
 
59821
- if ((x & 0x3) === 0) {
59822
- x >>= 2;
59761
+ if ((_x & 0x3) === 0) {
59762
+ _x >>= 2;
59823
59763
  n += 2;
59824
59764
  }
59825
59765
 
59826
- if ((x & 0x1) === 0) {
59827
- x >>= 1;
59766
+ if ((_x & 0x1) === 0) {
59767
+ _x >>= 1;
59828
59768
  n += 1;
59829
59769
  }
59830
59770
 
59831
- if (x === 0) {
59771
+ if (_x === 0) {
59832
59772
  n += 1;
59833
59773
  }
59834
59774
 
@@ -59862,6 +59802,7 @@ function invokeObjectHash(object) {
59862
59802
  * @param {number} index1
59863
59803
  */
59864
59804
  function array_swap_one(array, index0, index1) {
59805
+
59865
59806
  const t = array[index0];
59866
59807
 
59867
59808
  array[index0] = array[index1];
@@ -59955,7 +59896,7 @@ const DEFAULT_INITIAL_CAPACITY_POWER = 4;
59955
59896
  * @readonly
59956
59897
  * @type {number}
59957
59898
  */
59958
- const DEFAULT_INITIAL_CAPACITY = 2 ** DEFAULT_INITIAL_CAPACITY_POWER;
59899
+ const DEFAULT_INITIAL_CAPACITY$1 = 2 ** DEFAULT_INITIAL_CAPACITY_POWER;
59959
59900
 
59960
59901
  /**
59961
59902
  * @readonly
@@ -60084,7 +60025,7 @@ class HashMap {
60084
60025
  constructor({
60085
60026
  keyHashFunction = invokeObjectHash,
60086
60027
  keyEqualityFunction = invokeObjectEquals,
60087
- capacity = DEFAULT_INITIAL_CAPACITY,
60028
+ capacity = DEFAULT_INITIAL_CAPACITY$1,
60088
60029
  loadFactor = DEFAULT_LOAD_FACTOR
60089
60030
  } = {}) {
60090
60031
 
@@ -67567,8 +67508,12 @@ function formatToChannelCount(format) {
67567
67508
  case RGFormat:
67568
67509
  return 2;
67569
67510
  case RGBFormat:
67511
+ case RGB_S3TC_DXT1_Format:
67570
67512
  return 3;
67571
67513
  case RGBAFormat:
67514
+ case RGBA_S3TC_DXT1_Format:
67515
+ case RGBA_S3TC_DXT3_Format:
67516
+ case RGBA_S3TC_DXT5_Format:
67572
67517
  return 4;
67573
67518
  default:
67574
67519
  throw new Error(`Unsupported format '${format}'`);
@@ -67966,13 +67911,15 @@ const CrossOriginKind = {
67966
67911
  };
67967
67912
 
67968
67913
  class CrossOriginConfig {
67969
- constructor() {
67970
- this.kind = CrossOriginKind.Anonymous;
67971
- }
67972
-
67914
+ kind = CrossOriginKind.Anonymous;
67973
67915
  }
67974
67916
 
67975
67917
  const default_coc = new CrossOriginConfig();
67918
+
67919
+ /**
67920
+ * @readonly
67921
+ * @type {Readonly<CrossOriginConfig>}
67922
+ */
67976
67923
  CrossOriginConfig.default = Object.freeze(default_coc);
67977
67924
 
67978
67925
  /**
@@ -70777,16 +70724,25 @@ const EntityFlags = {
70777
70724
  WatchDestruction: 4
70778
70725
  };
70779
70726
 
70727
+ /**
70728
+ * Align to the nearest number divisible by 32, rounding up
70729
+ * @param {number} n
70730
+ * @returns {number}
70731
+ */
70732
+ function align_32(n) {
70733
+ return ((n + 31) >>> 5) << 5
70734
+ }
70735
+
70780
70736
  /**
70781
70737
  * de Bruijn sequence
70782
70738
  * @see https://graphics.stanford.edu/~seander/bithacks.html
70783
70739
  * @type {Uint8Array}
70784
70740
  */
70785
- const msb_lut = new Uint8Array([
70741
+ const msb_lut_de_bruijn = new Uint8Array([
70786
70742
  0, 1, 28, 2, 29, 14, 24, 3, 30, 22, 20, 15, 25, 17, 4, 8,
70787
70743
  31, 27, 13, 23, 21, 19, 16, 7, 26, 12, 18, 6, 11, 5, 10, 9
70788
- ]);
70789
-
70744
+ ]);
70745
+
70790
70746
  /**
70791
70747
  * Get index of the least significant set bit
70792
70748
  * Also known as ctz32 or "count trailing zeroes"
@@ -70795,9 +70751,9 @@ const msb_lut = new Uint8Array([
70795
70751
  * @returns {number}
70796
70752
  */
70797
70753
  function lsb_32(v) {
70798
- return msb_lut[((v & -v) * 0x077CB531) >>> 27];
70799
- }
70800
-
70754
+ return msb_lut_de_bruijn[((v & -v) * 0x077CB531) >>> 27];
70755
+ }
70756
+
70801
70757
  /**
70802
70758
  * Used for overallocating space when bit set needs to grow
70803
70759
  * @constant
@@ -70818,12 +70774,20 @@ const SHRINK_FACTOR$1 = 0.5;
70818
70774
  */
70819
70775
  const RESIZE_COUNT_THRESHOLD = 128;
70820
70776
 
70777
+ /**
70778
+ * @readonly
70779
+ * @type {number}
70780
+ */
70781
+ const DEFAULT_INITIAL_CAPACITY = 64;
70782
+
70821
70783
  class BitSet {
70822
70784
  /**
70823
70785
  * Dynamically sized bit field
70824
70786
  * @constructor
70787
+ * @param {number} [initial_capacity]
70825
70788
  */
70826
- constructor() {
70789
+ constructor(initial_capacity = DEFAULT_INITIAL_CAPACITY) {
70790
+
70827
70791
  /**
70828
70792
  * Number of bits currently in use
70829
70793
  * @private
@@ -70836,7 +70800,7 @@ class BitSet {
70836
70800
  * @private
70837
70801
  * @type {number}
70838
70802
  */
70839
- this.__capacity = 64;
70803
+ this.__capacity = align_32(initial_capacity);
70840
70804
 
70841
70805
  /**
70842
70806
  * Uint32-backed storage
@@ -71362,9 +71326,7 @@ class BitSet {
71362
71326
  * @returns {BitSet}
71363
71327
  */
71364
71328
  static fixedSize(x) {
71365
- const r = new BitSet();
71366
-
71367
- r.setCapacity(x);
71329
+ const r = new BitSet(x);
71368
71330
 
71369
71331
  //prevent resizing
71370
71332
  r.__shrinkFactor = 0;
@@ -105088,13 +105050,6 @@ class EngineConfiguration {
105088
105050
  }
105089
105051
  }
105090
105052
 
105091
- //
105092
-
105093
-
105094
- function atan2(a, b) {
105095
- return Math.atan2(a, b);
105096
- }
105097
-
105098
105053
  /**
105099
105054
  *
105100
105055
  * @param {number[]} mat4
@@ -105106,15 +105061,9 @@ function coeff(mat4, row_index, column_index) {
105106
105061
  return mat4[row_index + column_index * 4];
105107
105062
  }
105108
105063
 
105109
- function sin(a) {
105110
- return Math.sin(a);
105111
- }
105112
-
105113
- function cos(a) {
105114
- return Math.cos(a);
105115
- }
105116
-
105117
- const EIGEN_PI = Math.PI;
105064
+ const sin = Math.sin;
105065
+ const cos = Math.cos;
105066
+ const atan2 = Math.atan2;
105118
105067
 
105119
105068
  /**
105120
105069
  *
@@ -105139,10 +105088,14 @@ const EIGEN_PI = Math.PI;
105139
105088
  * @param {number[]} res
105140
105089
  * @param {number[]|Float32Array|mat4} m4
105141
105090
  * @param {number} a0 axis index
105142
- * @param {number} a1
105143
- * @param {number} a2
105091
+ * @param {number} a1 axis index
105092
+ * @param {number} a2 axis index
105144
105093
  */
105145
- function eulerAnglesFromMatrix(res, m4, a0, a1, a2) {
105094
+ function eulerAnglesFromMatrix(
105095
+ res, m4,
105096
+ a0, a1, a2
105097
+ ) {
105098
+
105146
105099
  const odd = ((a0 + 1) % 3 === a1) ? 0 : 1;
105147
105100
 
105148
105101
  const i = a0;
@@ -105151,11 +105104,12 @@ function eulerAnglesFromMatrix(res, m4, a0, a1, a2) {
105151
105104
 
105152
105105
  if (a0 === a2) {
105153
105106
  res[0] = atan2(coeff(m4, j, i), coeff(m4, k, i));
105154
- if ((odd && res[0] < 0) || ((!odd) && res[0] > 0)) {
105107
+
105108
+ if ((odd && res[0] < 0) || ((~odd) && res[0] > 0)) {
105155
105109
  if (res[0] > 0) {
105156
- res[0] -= EIGEN_PI;
105110
+ res[0] -= Math.PI;
105157
105111
  } else {
105158
- res[0] += EIGEN_PI;
105112
+ res[0] += Math.PI;
105159
105113
  }
105160
105114
  const s2 = v2_magnitude(coeff(m4, j, i), coeff(m4, k, i));
105161
105115
  res[1] = -atan2(s2, coeff(m4, i, i));
@@ -105176,25 +105130,34 @@ function eulerAnglesFromMatrix(res, m4, a0, a1, a2) {
105176
105130
 
105177
105131
  const s1 = sin(res[0]);
105178
105132
  const c1 = cos(res[0]);
105133
+
105179
105134
  res[2] = atan2(c1 * coeff(m4, j, k) - s1 * coeff(m4, k, k), c1 * coeff(m4, j, j) - s1 * coeff(m4, k, j));
105135
+
105180
105136
  } else {
105137
+
105181
105138
  res[0] = atan2(coeff(m4, j, k), coeff(m4, k, k));
105139
+
105182
105140
  const c2 = v2_magnitude(coeff(m4, i, i), coeff(m4, i, j));
105183
- if ((odd && res[0] < 0) || ((!odd) && res[0] > 0)) {
105141
+
105142
+ if ((odd && res[0] < 0) || ((~odd) && res[0] > 0)) {
105184
105143
  if (res[0] > 0) {
105185
- res[0] -= EIGEN_PI;
105144
+ res[0] -= Math.PI;
105186
105145
  } else {
105187
- res[0] += EIGEN_PI;
105146
+ res[0] += Math.PI;
105188
105147
  }
105189
105148
  res[1] = atan2(-coeff(m4, i, k), -c2);
105190
- } else
105149
+ } else {
105191
105150
  res[1] = atan2(-coeff(m4, i, k), c2);
105151
+ }
105152
+
105192
105153
  const s1 = sin(res[0]);
105193
105154
  const c1 = cos(res[0]);
105155
+
105194
105156
  res[2] = atan2(s1 * coeff(m4, k, i) - c1 * coeff(m4, j, i), c1 * coeff(m4, j, j) - s1 * coeff(m4, k, j));
105157
+
105195
105158
  }
105196
105159
 
105197
- if (!odd) {
105160
+ if (odd === 0) {
105198
105161
  // invert result
105199
105162
  res[0] = -res[0];
105200
105163
  res[1] = -res[1];
@@ -118039,18 +118002,6 @@ function v4_dot(
118039
118002
  return (x0 * x1 + y0 * y1 + z0 * z1 + w0 * w1);
118040
118003
  }
118041
118004
 
118042
- /**
118043
- *
118044
- * @param {number} x
118045
- * @param {number} y
118046
- * @param {number} z
118047
- * @param {number} w
118048
- * @returns {number}
118049
- */
118050
- function v4_length_sqr(x, y, z, w) {
118051
- return x * x + y * y + z * z + w * w;
118052
- }
118053
-
118054
118005
  /**
118055
118006
  *
118056
118007
  * @param {number} x0