@woosh/meep-engine 2.168.0 → 2.169.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 (295) hide show
  1. package/README.md +2 -2
  2. package/build/bundle-worker-image-decoder.js +1 -1
  3. package/package.json +1 -1
  4. package/src/REVIEW_2026_08_06/adv-core.md +511 -0
  5. package/src/REVIEW_2026_08_06/adv-gfx.md +480 -0
  6. package/src/REVIEW_2026_08_06/adv-view.md +446 -0
  7. package/src/REVIEW_2026_08_06/api-core.md +296 -0
  8. package/src/REVIEW_2026_08_06/api-engine.md +195 -0
  9. package/src/REVIEW_2026_08_06/bvh-phys-sound-net.md +507 -0
  10. package/src/REVIEW_2026_08_06/core-binary.md +348 -0
  11. package/src/REVIEW_2026_08_06/core-collection.md +376 -0
  12. package/src/REVIEW_2026_08_06/core-math.md +221 -0
  13. package/src/REVIEW_2026_08_06/core-process.md +266 -0
  14. package/src/REVIEW_2026_08_06/core-science.md +223 -0
  15. package/src/REVIEW_2026_08_06/engine-ai-nav.md +279 -0
  16. package/src/REVIEW_2026_08_06/engine-animation.md +167 -0
  17. package/src/REVIEW_2026_08_06/engine-asset.md +166 -0
  18. package/src/REVIEW_2026_08_06/engine-ecs.md +920 -0
  19. package/src/REVIEW_2026_08_06/engine-input.md +197 -0
  20. package/src/REVIEW_2026_08_06/engine-misc.md +248 -0
  21. package/src/REVIEW_2026_08_06/engine-terrain.md +52 -0
  22. package/src/REVIEW_2026_08_06/generation.md +176 -0
  23. package/src/REVIEW_2026_08_06/geom-2d.md +434 -0
  24. package/src/REVIEW_2026_08_06/geom-3d.md +117 -0
  25. package/src/REVIEW_2026_08_06/gfx-gi.md +143 -0
  26. package/src/REVIEW_2026_08_06/gfx-render.md +740 -0
  27. package/src/REVIEW_2026_08_06/gfx-texture.md +690 -0
  28. package/src/REVIEW_2026_08_06/prior-criticals.md +49 -0
  29. package/src/REVIEW_2026_08_06/prior-highs.md +138 -0
  30. package/src/REVIEW_2026_08_06/test-gaps.md +364 -0
  31. package/src/REVIEW_2026_08_06/view.md +667 -0
  32. package/src/REVIEW_2026_08_06.md +571 -0
  33. package/src/core/binary/BinaryBuffer.d.ts.map +1 -1
  34. package/src/core/binary/BinaryBuffer.js +12 -1
  35. package/src/core/binary/BitImage2.d.ts +5 -1
  36. package/src/core/binary/BitImage2.d.ts.map +1 -1
  37. package/src/core/binary/BitImage2.js +5 -1
  38. package/src/core/bvh8/build/NodeProxy.d.ts.map +1 -1
  39. package/src/core/bvh8/build/NodeProxy.js +314 -308
  40. package/src/core/collection/list/List.d.ts +15 -0
  41. package/src/core/collection/list/List.d.ts.map +1 -1
  42. package/src/core/collection/list/List.js +34 -0
  43. package/src/core/collection/list/SortedListProjection.d.ts.map +1 -1
  44. package/src/core/collection/list/SortedListProjection.js +4 -1
  45. package/src/core/collection/map/BiMap.d.ts +25 -2
  46. package/src/core/collection/map/BiMap.d.ts.map +1 -1
  47. package/src/core/collection/map/BiMap.js +57 -3
  48. package/src/core/debug/matchers/IsAnything.d.ts.map +1 -1
  49. package/src/core/debug/matchers/IsAnything.js +5 -1
  50. package/src/core/events/signal/Signal.d.ts.map +1 -1
  51. package/src/core/events/signal/Signal.js +3 -1
  52. package/src/core/geom/2d/polygon/TRIANGULATION_DESIGN.md +433 -0
  53. package/src/core/geom/2d/polygon/polygon2_is_counter_clockwise.d.ts +31 -0
  54. package/src/core/geom/2d/polygon/polygon2_is_counter_clockwise.d.ts.map +1 -0
  55. package/src/core/geom/2d/polygon/polygon2_is_counter_clockwise.js +84 -0
  56. package/src/core/geom/2d/polygon/polygon2_signed_area.d.ts +24 -2
  57. package/src/core/geom/2d/polygon/polygon2_signed_area.d.ts.map +1 -1
  58. package/src/core/geom/2d/polygon/polygon2_signed_area.js +52 -34
  59. package/src/core/geom/2d/polygon/polygon2_triangulate.corpus.d.ts +28 -0
  60. package/src/core/geom/2d/polygon/polygon2_triangulate.corpus.d.ts.map +1 -0
  61. package/src/core/geom/2d/polygon/polygon2_triangulate.corpus.js +86 -0
  62. package/src/core/geom/2d/polygon/polygon2_triangulate.d.ts +40 -0
  63. package/src/core/geom/2d/polygon/polygon2_triangulate.d.ts.map +1 -0
  64. package/src/core/geom/2d/polygon/polygon2_triangulate.js +1280 -0
  65. package/src/core/geom/2d/polygon/polygon2_triangulation_deviation.d.ts +28 -0
  66. package/src/core/geom/2d/polygon/polygon2_triangulation_deviation.d.ts.map +1 -0
  67. package/src/core/geom/2d/polygon/polygon2_triangulation_deviation.js +77 -0
  68. package/src/core/geom/2d/triangle/tri2_rasterize_conservative.d.ts +6 -3
  69. package/src/core/geom/2d/triangle/tri2_rasterize_conservative.d.ts.map +1 -1
  70. package/src/core/geom/2d/triangle/tri2_rasterize_conservative.js +26 -13
  71. package/src/core/geom/2d/triangle/tri2_signed_area.d.ts +17 -1
  72. package/src/core/geom/2d/triangle/tri2_signed_area.d.ts.map +1 -1
  73. package/src/core/geom/2d/triangle/tri2_signed_area.js +35 -23
  74. package/src/core/geom/2d/v2_morton_encode.d.ts +20 -0
  75. package/src/core/geom/2d/v2_morton_encode.d.ts.map +1 -0
  76. package/src/core/geom/2d/v2_morton_encode.js +23 -0
  77. package/src/core/geom/3d/atlas/segment/atlas_merge_charts.d.ts.map +1 -1
  78. package/src/core/geom/3d/atlas/segment/atlas_merge_charts.js +4 -1
  79. package/src/core/geom/3d/polygon/polygon3_compute_normal.d.ts +27 -0
  80. package/src/core/geom/3d/polygon/polygon3_compute_normal.d.ts.map +1 -0
  81. package/src/core/geom/3d/polygon/polygon3_compute_normal.js +60 -0
  82. package/src/core/geom/3d/polygon/polygon3_triangulate.d.ts +34 -0
  83. package/src/core/geom/3d/polygon/polygon3_triangulate.d.ts.map +1 -0
  84. package/src/core/geom/3d/polygon/polygon3_triangulate.js +94 -0
  85. package/src/core/geom/3d/quaternion/quat3_multiply.d.ts +8 -2
  86. package/src/core/geom/3d/quaternion/quat3_multiply.d.ts.map +1 -1
  87. package/src/core/geom/3d/quaternion/quat3_multiply.js +8 -2
  88. package/src/core/geom/3d/shape/ConvexHullShape3D.d.ts.map +1 -1
  89. package/src/core/geom/3d/shape/ConvexHullShape3D.js +32 -2
  90. package/src/core/geom/3d/topology/struct/binary/io/face/bt_face_triangulate.d.ts +23 -6
  91. package/src/core/geom/3d/topology/struct/binary/io/face/bt_face_triangulate.d.ts.map +1 -1
  92. package/src/core/geom/3d/topology/struct/binary/io/face/bt_face_triangulate.js +268 -124
  93. package/src/core/geom/3d/topology/struct/binary/query/bt_mesh_assert_valid.d.ts +17 -0
  94. package/src/core/geom/3d/topology/struct/binary/query/bt_mesh_assert_valid.d.ts.map +1 -0
  95. package/src/core/geom/3d/topology/struct/binary/query/bt_mesh_assert_valid.js +44 -0
  96. package/src/core/geom/3d/topology/struct/binary/query/bt_mesh_count_edge_faces.d.ts +20 -0
  97. package/src/core/geom/3d/topology/struct/binary/query/bt_mesh_count_edge_faces.d.ts.map +1 -0
  98. package/src/core/geom/3d/topology/struct/binary/query/bt_mesh_count_edge_faces.js +40 -0
  99. package/src/core/geom/3d/topology/struct/binary/query/bt_mesh_is_closed.d.ts +19 -0
  100. package/src/core/geom/3d/topology/struct/binary/query/bt_mesh_is_closed.d.ts.map +1 -0
  101. package/src/core/geom/3d/topology/struct/binary/query/bt_mesh_is_closed.js +34 -0
  102. package/src/core/geom/3d/topology/struct/binary/query/bt_mesh_is_manifold.d.ts +22 -0
  103. package/src/core/geom/3d/topology/struct/binary/query/bt_mesh_is_manifold.d.ts.map +1 -0
  104. package/src/core/geom/3d/topology/struct/binary/query/bt_mesh_is_manifold.js +37 -0
  105. package/src/core/geom/3d/topology/struct/binary/query/bt_mesh_validate.d.ts +87 -0
  106. package/src/core/geom/3d/topology/struct/binary/query/bt_mesh_validate.d.ts.map +1 -0
  107. package/src/core/geom/3d/topology/struct/binary/query/bt_mesh_validate.js +599 -0
  108. package/src/core/geom/3d/triangle/tri3_compute_signed_volume.d.ts +32 -0
  109. package/src/core/geom/3d/triangle/tri3_compute_signed_volume.d.ts.map +1 -1
  110. package/src/core/geom/3d/triangle/tri3_compute_signed_volume.js +66 -7
  111. package/src/core/geom/3d/triangle/tri3_mesh_compute_signed_volume.d.ts +22 -1
  112. package/src/core/geom/3d/triangle/tri3_mesh_compute_signed_volume.d.ts.map +1 -1
  113. package/src/core/geom/3d/triangle/tri3_mesh_compute_signed_volume.js +83 -38
  114. package/src/core/geom/MANIFOLD_COMPARISON_2026_08_01.md +554 -0
  115. package/src/core/geom/vec3/v3_cotangent.d.ts +6 -2
  116. package/src/core/geom/vec3/v3_cotangent.d.ts.map +1 -1
  117. package/src/core/geom/vec3/v3_cotangent.js +6 -2
  118. package/src/core/geom/vec3/v3_cross.d.ts +6 -2
  119. package/src/core/geom/vec3/v3_cross.d.ts.map +1 -1
  120. package/src/core/geom/vec3/v3_cross.js +6 -2
  121. package/src/core/geom/vec3/v3_multiply.d.ts +6 -2
  122. package/src/core/geom/vec3/v3_multiply.d.ts.map +1 -1
  123. package/src/core/geom/vec3/v3_multiply.js +6 -2
  124. package/src/core/geom/vec3/v3_subtract.d.ts +6 -2
  125. package/src/core/geom/vec3/v3_subtract.d.ts.map +1 -1
  126. package/src/core/geom/vec3/v3_subtract.js +6 -2
  127. package/src/core/localization/Localization.js +1 -1
  128. package/src/core/math/random/randomSeed.d.ts +13 -0
  129. package/src/core/math/random/randomSeed.d.ts.map +1 -0
  130. package/src/core/math/random/randomSeed.js +16 -0
  131. package/src/core/math/spline/spline3_hermite_apply_transform.d.ts +50 -0
  132. package/src/core/math/spline/spline3_hermite_apply_transform.d.ts.map +1 -0
  133. package/src/core/math/spline/spline3_hermite_apply_transform.js +107 -0
  134. package/src/core/math/spline/spline3_hermite_reverse.d.ts +34 -0
  135. package/src/core/math/spline/spline3_hermite_reverse.d.ts.map +1 -0
  136. package/src/core/math/spline/spline3_hermite_reverse.js +49 -0
  137. package/src/core/math/statistics/hammersley_sequence.d.ts +17 -4
  138. package/src/core/math/statistics/hammersley_sequence.d.ts.map +1 -1
  139. package/src/core/math/statistics/hammersley_sequence.js +25 -16
  140. package/src/core/process/Future.d.ts.map +1 -1
  141. package/src/core/process/Future.js +12 -0
  142. package/src/core/process/PromiseWatcher.d.ts.map +1 -1
  143. package/src/core/process/PromiseWatcher.js +9 -2
  144. package/src/core/process/executor/ConcurrentExecutor.d.ts.map +1 -1
  145. package/src/core/process/executor/ConcurrentExecutor.js +12 -2
  146. package/src/core/process/worker/WorkerProxy.d.ts.map +1 -1
  147. package/src/core/process/worker/WorkerProxy.js +5 -2
  148. package/src/core/process/worker/extractTransferables.d.ts.map +1 -1
  149. package/src/core/process/worker/extractTransferables.js +4 -1
  150. package/src/engine/Engine.d.ts +12 -12
  151. package/src/engine/Engine.d.ts.map +1 -1
  152. package/src/engine/Engine.js +149 -10
  153. package/src/engine/EngineHarness.d.ts.map +1 -1
  154. package/src/engine/EngineHarness.js +4 -1
  155. package/src/engine/asset/loaders/ArrayBufferLoader.d.ts.map +1 -1
  156. package/src/engine/asset/loaders/ArrayBufferLoader.js +7 -0
  157. package/src/engine/ecs/speaker/lines/sets/LineSetDescription.d.ts.map +1 -1
  158. package/src/engine/ecs/speaker/lines/sets/LineSetDescription.js +3 -1
  159. package/src/engine/ecs/terrain/ecs/TerrainSystem.d.ts.map +1 -1
  160. package/src/engine/ecs/terrain/ecs/TerrainSystem.js +4 -1
  161. package/src/engine/ecs/terrain/tiles/TerrainTileManager.d.ts +29 -0
  162. package/src/engine/ecs/terrain/tiles/TerrainTileManager.d.ts.map +1 -1
  163. package/src/engine/ecs/terrain/tiles/TerrainTileManager.js +84 -23
  164. package/src/engine/graphics/CONTEXT_LOSS_RECOVERY_PLAN.md +446 -0
  165. package/src/engine/graphics/GraphicsEngine.d.ts +56 -7
  166. package/src/engine/graphics/GraphicsEngine.d.ts.map +1 -1
  167. package/src/engine/graphics/GraphicsEngine.js +196 -24
  168. package/src/engine/graphics/context/WebGLContextFailureReason.d.ts +9 -0
  169. package/src/engine/graphics/context/WebGLContextFailureReason.d.ts.map +1 -0
  170. package/src/engine/graphics/context/WebGLContextFailureReason.js +17 -0
  171. package/src/engine/graphics/context/WebGLContextMonitor.d.ts +106 -0
  172. package/src/engine/graphics/context/WebGLContextMonitor.d.ts.map +1 -0
  173. package/src/engine/graphics/context/WebGLContextMonitor.js +341 -0
  174. package/src/engine/graphics/context/WebGLContextState.d.ts +14 -0
  175. package/src/engine/graphics/context/WebGLContextState.d.ts.map +1 -0
  176. package/src/engine/graphics/context/WebGLContextState.js +24 -0
  177. package/src/engine/graphics/context/testWebGLContextLoss.d.ts +2 -0
  178. package/src/engine/graphics/context/testWebGLContextLoss.d.ts.map +1 -0
  179. package/src/engine/graphics/context/testWebGLContextLoss.js +696 -0
  180. package/src/engine/graphics/ecs/camera/serialization/CameraSerializationAdapter.d.ts.map +1 -1
  181. package/src/engine/graphics/ecs/camera/serialization/CameraSerializationAdapter.js +68 -32
  182. package/src/engine/graphics/ecs/camera/serialization/CameraSerializationUpgrader_0_1.d.ts +14 -0
  183. package/src/engine/graphics/ecs/camera/serialization/CameraSerializationUpgrader_0_1.d.ts.map +1 -0
  184. package/src/engine/graphics/ecs/camera/serialization/CameraSerializationUpgrader_0_1.js +41 -0
  185. package/src/engine/graphics/ecs/decal/v2/FPDecalSystem.js +1 -1
  186. package/src/engine/graphics/ecs/mesh-v2/ShadedGeometrySystem.d.ts.map +1 -1
  187. package/src/engine/graphics/ecs/mesh-v2/ShadedGeometrySystem.js +5 -0
  188. package/src/engine/graphics/ecs/trail2d/Trail2D.d.ts +5 -1
  189. package/src/engine/graphics/ecs/trail2d/Trail2D.d.ts.map +1 -1
  190. package/src/engine/graphics/ecs/trail2d/Trail2D.js +15 -0
  191. package/src/engine/graphics/ecs/trail2d/Trail2DSystem.d.ts +1 -1
  192. package/src/engine/graphics/ecs/trail2d/Trail2DSystem.d.ts.map +1 -1
  193. package/src/engine/graphics/ecs/trail2d/Trail2DSystem.js +2 -1
  194. package/src/engine/graphics/ecs/trail3d/Trail3D.d.ts +4 -1
  195. package/src/engine/graphics/ecs/trail3d/Trail3D.d.ts.map +1 -1
  196. package/src/engine/graphics/ecs/trail3d/Trail3D.js +488 -476
  197. package/src/engine/graphics/ecs/trail3d/Trail3DSystem.d.ts +1 -1
  198. package/src/engine/graphics/ecs/trail3d/Trail3DSystem.d.ts.map +1 -1
  199. package/src/engine/graphics/ecs/trail3d/Trail3DSystem.js +280 -253
  200. package/src/engine/graphics/geometry/MikkT/BuildNeighborsFast.d.ts.map +1 -1
  201. package/src/engine/graphics/geometry/MikkT/BuildNeighborsFast.js +3 -2
  202. package/src/engine/graphics/geometry/MikkT/GenerateSharedVerticesIndexList.d.ts.map +1 -1
  203. package/src/engine/graphics/geometry/MikkT/GenerateSharedVerticesIndexList.js +3 -1
  204. package/src/engine/graphics/geometry/computeMeshSurfaceArea.js +1 -1
  205. package/src/engine/graphics/load_and_set_cubemap_v0.d.ts +5 -0
  206. package/src/engine/graphics/load_and_set_cubemap_v0.d.ts.map +1 -1
  207. package/src/engine/graphics/load_and_set_cubemap_v0.js +26 -21
  208. package/src/engine/graphics/particles/particular/group/ParticleGroup.d.ts.map +1 -1
  209. package/src/engine/graphics/particles/particular/group/ParticleGroup.js +19 -8
  210. package/src/engine/graphics/particles/particular/group/optimizeCommandQueue.js +1 -1
  211. package/src/engine/graphics/texture/atlas/AtlasLookupTexture.d.ts.map +1 -1
  212. package/src/engine/graphics/texture/atlas/AtlasLookupTexture.js +10 -3
  213. package/src/engine/graphics/texture/atlas/TextureAtlas.d.ts.map +1 -1
  214. package/src/engine/graphics/texture/atlas/TextureAtlas.js +4 -1
  215. package/src/engine/graphics/texture/atlas/gpu/WebGLTextureAtlas.d.ts.map +1 -1
  216. package/src/engine/graphics/texture/atlas/gpu/WebGLTextureAtlas.js +11 -0
  217. package/src/engine/graphics/texture/cubemap/load_environment_map.d.ts.map +1 -1
  218. package/src/engine/graphics/texture/cubemap/load_environment_map.js +5 -2
  219. package/src/engine/graphics/texture/sampler/distance/computeSignedDistanceField_Chamfer.d.ts.map +1 -1
  220. package/src/engine/graphics/texture/sampler/distance/computeSignedDistanceField_Chamfer.js +26 -18
  221. package/src/engine/graphics/texture/sampler/filter/sampler2d_blur_gaussian.d.ts +15 -2
  222. package/src/engine/graphics/texture/sampler/filter/sampler2d_blur_gaussian.d.ts.map +1 -1
  223. package/src/engine/graphics/texture/sampler/filter/sampler2d_blur_gaussian.js +29 -3
  224. package/src/engine/graphics/texture/sampler/resize/sampler2d_scale_down_lanczos.d.ts +11 -1
  225. package/src/engine/graphics/texture/sampler/resize/sampler2d_scale_down_lanczos.d.ts.map +1 -1
  226. package/src/engine/graphics/texture/sampler/resize/sampler2d_scale_down_lanczos.js +158 -171
  227. package/src/engine/graphics/texture/sampler/sampler2d_paint.js +1 -1
  228. package/src/engine/graphics/texture/sampler/util/bitSet2Sampler2D.js +2 -2
  229. package/src/engine/input/ecs/util/TopDownCameraControllerHelper.d.ts.map +1 -1
  230. package/src/engine/input/ecs/util/TopDownCameraControllerHelper.js +10 -3
  231. package/src/engine/navigation/ecs/components/PathSerializationUpgrader_2_3.d.ts +14 -0
  232. package/src/engine/navigation/ecs/components/PathSerializationUpgrader_2_3.d.ts.map +1 -0
  233. package/src/engine/navigation/ecs/components/PathSerializationUpgrader_2_3.js +38 -0
  234. package/src/engine/network/orchestrator/ServerAuthoritativeClient.d.ts.map +1 -1
  235. package/src/engine/network/orchestrator/ServerAuthoritativeClient.js +433 -425
  236. package/src/engine/physics/constraint/solve_constraints.d.ts +4 -1
  237. package/src/engine/physics/constraint/solve_constraints.d.ts.map +1 -1
  238. package/src/engine/physics/constraint/solve_constraints.js +38 -13
  239. package/src/engine/physics/contact/ManifoldStore.d.ts +15 -3
  240. package/src/engine/physics/contact/ManifoldStore.d.ts.map +1 -1
  241. package/src/engine/physics/contact/ManifoldStore.js +15 -3
  242. package/src/engine/physics/ecs/Joint.d.ts +7 -4
  243. package/src/engine/physics/ecs/Joint.d.ts.map +1 -1
  244. package/src/engine/physics/ecs/Joint.js +7 -4
  245. package/src/engine/physics/ecs/PhysicsSystem.d.ts +14 -0
  246. package/src/engine/physics/ecs/PhysicsSystem.d.ts.map +1 -1
  247. package/src/engine/physics/ecs/PhysicsSystem.js +16 -0
  248. package/src/engine/physics/fluid/ecs/FluidObstacleSystem.d.ts +4 -4
  249. package/src/engine/physics/fluid/ecs/FluidSystem.d.ts +3 -3
  250. package/src/engine/physics/narrowphase/convex_convex_manifold.d.ts +15 -7
  251. package/src/engine/physics/narrowphase/convex_convex_manifold.d.ts.map +1 -1
  252. package/src/engine/physics/narrowphase/convex_convex_manifold.js +33 -10
  253. package/src/engine/physics/narrowphase/refine_ray_concave.d.ts +6 -2
  254. package/src/engine/physics/narrowphase/refine_ray_concave.d.ts.map +1 -1
  255. package/src/engine/physics/narrowphase/refine_ray_concave.js +6 -2
  256. package/src/engine/physics/narrowphase/refine_ray_hit.d.ts +6 -2
  257. package/src/engine/physics/narrowphase/refine_ray_hit.d.ts.map +1 -1
  258. package/src/engine/physics/narrowphase/refine_ray_hit.js +6 -2
  259. package/src/engine/physics/queries/raycast.d.ts.map +1 -1
  260. package/src/engine/physics/queries/raycast.js +11 -4
  261. package/src/engine/save/storage/IndexedDBStorage.d.ts.map +1 -1
  262. package/src/engine/save/storage/IndexedDBStorage.js +21 -3
  263. package/src/engine/simulation/Ticker.d.ts +12 -0
  264. package/src/engine/simulation/Ticker.d.ts.map +1 -1
  265. package/src/engine/simulation/Ticker.js +18 -0
  266. package/src/engine/sound/simulation/AcousticSimulator.d.ts.map +1 -1
  267. package/src/engine/sound/simulation/AcousticSimulator.js +9 -1
  268. package/src/engine/sound/simulation/core/VolumeField.d.ts +6 -2
  269. package/src/engine/sound/simulation/core/VolumeField.d.ts.map +1 -1
  270. package/src/engine/sound/simulation/core/VolumeField.js +6 -2
  271. package/src/engine/sound/simulation/probe/AcousticProbeField.d.ts +6 -2
  272. package/src/engine/sound/simulation/probe/AcousticProbeField.d.ts.map +1 -1
  273. package/src/engine/sound/simulation/probe/AcousticProbeField.js +6 -2
  274. package/src/engine/sound/simulation/probe/acoustic_probe_transfer.d.ts +6 -2
  275. package/src/engine/sound/simulation/probe/acoustic_probe_transfer.d.ts.map +1 -1
  276. package/src/engine/sound/simulation/probe/acoustic_probe_transfer.js +6 -2
  277. package/src/engine/sound/simulation/probe/bakeProbeReflectors.d.ts +3 -1
  278. package/src/engine/sound/simulation/probe/bakeProbeReflectors.d.ts.map +1 -1
  279. package/src/engine/sound/simulation/probe/bakeProbeReflectors.js +3 -1
  280. package/src/engine/ui/GUIEngine.d.ts.map +1 -1
  281. package/src/engine/ui/GUIEngine.js +8 -1
  282. package/src/generation/theme/TerrainTheme.d.ts.map +1 -1
  283. package/src/generation/theme/TerrainTheme.js +2 -1
  284. package/src/generation/theme/ThemeEngine.d.ts.map +1 -1
  285. package/src/generation/theme/ThemeEngine.js +6 -5
  286. package/src/view/ViewGroup.d.ts.map +1 -1
  287. package/src/view/ViewGroup.js +9 -7
  288. package/src/view/graphics/WebGLContextFailureView.d.ts +19 -0
  289. package/src/view/graphics/WebGLContextFailureView.d.ts.map +1 -0
  290. package/src/view/graphics/WebGLContextFailureView.js +76 -0
  291. package/src/view/minimap/Minimap.d.ts +8 -0
  292. package/src/view/minimap/Minimap.d.ts.map +1 -1
  293. package/src/view/minimap/Minimap.js +16 -3
  294. package/src/view/minimap/dom/MinimapMarkerView.d.ts.map +1 -1
  295. package/src/view/minimap/dom/MinimapMarkerView.js +3 -1
@@ -1,21 +1,26 @@
1
- import { buildCubeURLs } from "./texture/cubemap/buildCubeURLs.js";
2
- import { load_environment_map } from "./texture/cubemap/load_environment_map.js";
3
-
4
- /**
5
- *
6
- * @param {GraphicsEngine} graphics
7
- * @param {string} folder_path
8
- * @param {string} file_extension
9
- */
10
- export async function load_and_set_cubemap_v0(graphics, folder_path, file_extension) {
11
- const paths = buildCubeURLs(folder_path, file_extension);
12
-
13
- const { filtered } = await load_environment_map({
14
- path: paths,
15
- renderer: graphics.renderer,
16
- original: false,
17
- filtered: true
18
- });
19
-
20
- graphics.scene.environment = filtered;
21
- }
1
+ import { EnvironmentTextureProjection } from "./texture/EnvironmentTextureProjection.js";
2
+ import { buildCubeURLs } from "./texture/cubemap/buildCubeURLs.js";
3
+ import { load_environment_map } from "./texture/cubemap/load_environment_map.js";
4
+
5
+ /**
6
+ * Loads a piece-wise cubemap and installs it as the scene's image-based-lighting source.
7
+ *
8
+ * The prefiltering (PMREM) is performed by the graphics engine rather than the loader, so that the
9
+ * engine keeps hold of the source texture and can repeat the bake - the prefiltered result lives in a
10
+ * render target and does not survive a WebGL context loss.
11
+ *
12
+ * @param {GraphicsEngine} graphics
13
+ * @param {string} folder_path
14
+ * @param {string} file_extension
15
+ */
16
+ export async function load_and_set_cubemap_v0(graphics, folder_path, file_extension) {
17
+ const paths = buildCubeURLs(folder_path, file_extension);
18
+
19
+ const { original } = await load_environment_map({
20
+ path: paths,
21
+ original: true,
22
+ filtered: false
23
+ });
24
+
25
+ graphics.set_environment_map(original, EnvironmentTextureProjection.Cube);
26
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"ParticleGroup.d.ts","sourceRoot":"","sources":["../../../../../../../src/engine/graphics/particles/particular/group/ParticleGroup.js"],"names":[],"mappings":"AAoBA;IACI;;;;;OAKG;IACH,qDAHW,OAAO,EA8CjB;IA1CG,mBAA0B;IAC1B;;;OAGG;IACH,4BAAgB;IAEhB,kBAAoB;IAEpB;;;OAGG;IACH,cAAuC;IAEvC;;;OAGG;IACH,UAAa;IAEb;;;OAGG;IACH,cAAmB;IAEnB,mBAAqB;IACrB,qBAAuB;IAEvB,oCAAqC;IACrC,4BAA8B;IAE9B;;;OAGG;IACH,cAFU,MAAO,SAAS,CAAC,CAEL;IAEtB,sBAAiC;IAKrC;;;;;OAKG;IACH,+BAJW,YAAY,GAAC,YAAY,GAAC,WAAW,GAAC,WAAW,GAAC,UAAU,GAAC,UAAU,GAAC,UAAU,GAAC,SAAS,kBAE1F,wBAAwB,GAAC,eAAe,CAQpD;IAED;;;OAGG;IACH,oBAFa,uBAAuB,GAAC,cAAc,CAUlD;IAED,cAmCC;IAED;;OAEG;IACH,gCAcC;IAED,cASC;IAED;;;OAGG;IACH,UAFa,OAAO,CAanB;IAED,6BAEC;IAED;;;OAGG;IACH,mBAFW,MAAM,QAMhB;IAED;;;OAGG;IACH,UAFa,MAAM,CASlB;IAED;;OAEG;IACH,6BAEC;IAED;;;OAGG;IACH,kCAEC;IAED,uCAIC;IAED;;;;;OAKG;IACH,2DAFW,MAAO,MAAM,CAAC,QAIxB;IAED;;;;;OAKG;IACH,4BAJW,MAAM,kBACN,MAAM,UACN,QAAM,YAAY,GAAC,YAAY,GAAC,UAAU,QAapD;IAED,sEAKC;IAED;;;;OAIG;IACH,wBAHW,MAAM,GACJ,MAAM,CAIlB;IAED,0BAKC;IAED,2CAaC;IAED,8CAkBC;IAED;;;;;OAKG;IACH,2EAFW,MAAM,EAAE,QAclB;IAED;;;;;OAKG;IACH,kFAFW,MAAM,QAahB;IAED;;;;;;;OAOG;IACH,0GAiBC;IAED;;;;;;;;OAQG;IACH,kHAkBC;IAED;;;OAGG;IACH,4BAFW,SAAS,QA+BnB;IAED;;;OAGG;IACH,uBAFW,UAAW,QAgFrB;IAED;;;;OAIG;IACH,4BAHW,MAAM,UACN,MAAM,QAiChB;IAED;;;;OAIG;IACH,aAHW,MAAM,UACN,MAAM,QAahB;IAED;;;OAGG;IACH,0BAKC;IAED,kCAMC;IAED,mCAaC;IAED;;;OAGG;IACH,4BAIC;CACJ;0BA1mByB,gBAAgB;mBAHvB,+BAA+B;yCAD3C,OAAO;gCAAP,OAAO;wCAAP,OAAO;+BAAP,OAAO"}
1
+ {"version":3,"file":"ParticleGroup.d.ts","sourceRoot":"","sources":["../../../../../../../src/engine/graphics/particles/particular/group/ParticleGroup.js"],"names":[],"mappings":"AAoBA;IACI;;;;;OAKG;IACH,qDAHW,OAAO,EA8CjB;IA1CG,mBAA0B;IAC1B;;;OAGG;IACH,4BAAgB;IAEhB,kBAAoB;IAEpB;;;OAGG;IACH,cAAuC;IAEvC;;;OAGG;IACH,UAAa;IAEb;;;OAGG;IACH,cAAmB;IAEnB,mBAAqB;IACrB,qBAAuB;IAEvB,oCAAqC;IACrC,4BAA8B;IAE9B;;;OAGG;IACH,cAFU,MAAO,SAAS,CAAC,CAEL;IAEtB,sBAAiC;IAKrC;;;;;OAKG;IACH,+BAJW,YAAY,GAAC,YAAY,GAAC,WAAW,GAAC,WAAW,GAAC,UAAU,GAAC,UAAU,GAAC,UAAU,GAAC,SAAS,kBAE1F,wBAAwB,GAAC,eAAe,CAQpD;IAED;;;OAGG;IACH,oBAFa,uBAAuB,GAAC,cAAc,CAUlD;IAED,cAmCC;IAED;;OAEG;IACH,gCAcC;IAED,cASC;IAED;;;OAGG;IACH,UAFa,OAAO,CAanB;IAED,6BAEC;IAED;;;OAGG;IACH,mBAFW,MAAM,QAMhB;IAED;;;OAGG;IACH,UAFa,MAAM,CASlB;IAED;;OAEG;IACH,6BAEC;IAED;;;OAGG;IACH,kCAEC;IAED,uCAIC;IAED;;;;;OAKG;IACH,2DAFW,MAAO,MAAM,CAAC,QAIxB;IAED;;;;;OAKG;IACH,4BAJW,MAAM,kBACN,MAAM,UACN,QAAM,YAAY,GAAC,YAAY,GAAC,UAAU,QAapD;IAED,sEAKC;IAED;;;;OAIG;IACH,wBAHW,MAAM,GACJ,MAAM,CAIlB;IAED,0BAKC;IAED,2CAaC;IAED,8CAkBC;IAED;;;;;OAKG;IACH,2EAFW,MAAM,EAAE,QAclB;IAED;;;;;OAKG;IACH,kFAFW,MAAM,QAahB;IAED;;;;;;;OAOG;IACH,0GAiBC;IAED;;;;;;;;OAQG;IACH,kHAkBC;IAED;;;OAGG;IACH,4BAFW,SAAS,QA+BnB;IAED;;;OAGG;IACH,uBAFW,UAAW,QA2FrB;IAED;;;;OAIG;IACH,4BAHW,MAAM,UACN,MAAM,QAiChB;IAED;;;;OAIG;IACH,aAHW,MAAM,UACN,MAAM,QAahB;IAED;;;OAGG;IACH,0BAKC;IAED,kCAMC;IAED,mCAaC;IAED;;;OAGG;IACH,4BAIC;CACJ;0BArnByB,gBAAgB;mBAHvB,+BAA+B;yCAD3C,OAAO;gCAAP,OAAO;wCAAP,OAAO;+BAAP,OAAO"}
@@ -471,24 +471,35 @@ export class ParticleGroup {
471
471
 
472
472
  let numSwapElements = 0;
473
473
  const swaps = [];
474
- let swapDestination = this.size - 1;
475
474
 
476
475
  let i, j;
477
476
 
478
- for (i = deleteCount - 1; i >= 0; i--) {
477
+ //Compaction: every hole below the new size is backfilled with a live
478
+ //element taken from the tail block that is about to be discarded. Each
479
+ //backfill must consume a *different* source -- reusing one duplicates
480
+ //that particle into several slots and silently drops the others.
481
+ let source = oldSize - 1;
482
+ let tailVictim = deleteCount - 1;
483
+
484
+ for (i = 0; i < deleteCount; i++) {
479
485
  const victim = indices[i];
480
486
 
481
- if (swapDestination === victim) {
482
- swapDestination--;
487
+ if (victim >= newSize) {
488
+ //indices ascend, so this and everything after it already sits
489
+ //inside the discarded tail and needs no backfill
490
+ break;
483
491
  }
484
492
 
485
- if (victim >= newSize) {
486
- //is beyond the end of the new array and will be removed anyway, no need to swap
487
- continue;
493
+ //a tail slot that is itself being deleted is not a live source
494
+ while (tailVictim >= 0 && indices[tailVictim] === source) {
495
+ tailVictim--;
496
+ source--;
488
497
  }
489
498
 
490
- swaps.push(victim, swapDestination);
499
+ swaps.push(victim, source);
491
500
  numSwapElements += 2;
501
+
502
+ source--;
492
503
  }
493
504
 
494
505
 
@@ -140,7 +140,7 @@ export function optimizeCommandQueue(queue) {
140
140
  //it's important that Add and Remove operations are sorted to the front of the queue, before Write operations
141
141
  if (operatorA < operatorB) {
142
142
  return -1;
143
- } else if (operatorB > operatorA) {
143
+ } else if (operatorA > operatorB) {
144
144
  return 1;
145
145
  }
146
146
 
@@ -1 +1 @@
1
- {"version":3,"file":"AtlasLookupTexture.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/graphics/texture/atlas/AtlasLookupTexture.js"],"names":[],"mappings":"AAEA;IAEQ;;;OAGG;IACH,OAFU,eAAa,IAAI,CAEV;IAEjB;;;;OAIG;IACH,mBAAoB;IAEpB;;;;OAIG;IACH,eAAgC;IAEhC,qBAAiD;IAUrD;;;OAGG;IACH,kCAEC;IAED,eA0CC;CACJ;4BArFgF,OAAO"}
1
+ {"version":3,"file":"AtlasLookupTexture.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/graphics/texture/atlas/AtlasLookupTexture.js"],"names":[],"mappings":"AAEA;IAEQ;;;OAGG;IACH,OAFU,eAAa,IAAI,CAEV;IAEjB;;;;OAIG;IACH,mBAAoB;IAEpB;;;;OAIG;IACH,eAAgC;IAEhC,qBAAiD;IAYrD;;;OAGG;IACH,kCAEC;IAED,eA+CC;CACJ;4BA5FgF,OAAO"}
@@ -29,7 +29,9 @@ export class AtlasLookupTexture {
29
29
  this.texture.magFilter = NearestFilter;
30
30
  this.texture.minFilter = NearestFilter;
31
31
  this.texture.generateMipmaps = false;
32
- this.texture.internalFormat = 'RGB16UI';
32
+ // four channels are written per record, so the internal format has to be
33
+ // the four-channel one to match RGBAIntegerFormat
34
+ this.texture.internalFormat = 'RGBA16UI';
33
35
  }
34
36
 
35
37
  /**
@@ -49,13 +51,18 @@ export class AtlasLookupTexture {
49
51
 
50
52
  const rowSize = this.__row_size;
51
53
 
52
- const expected_row_count = Math.ceil(patch_count / rowSize);
54
+ // at least one row: a zero-height texture is not a valid GL allocation,
55
+ // and an atlas legitimately starts out with no patches
56
+ const expected_row_count = Math.max(1, Math.ceil(patch_count / rowSize));
53
57
 
54
58
  const texture = this.texture;
55
59
 
56
60
  const image = texture.image;
57
61
 
58
- if (image.height < expected_row_count) {
62
+ // the texture starts out 1x1, so a height-only check is satisfied by any
63
+ // patch count that fits in a single row and no storage is ever allocated
64
+ // for it -- writes past the first record are then silently dropped
65
+ if (image.width !== rowSize || image.height < expected_row_count) {
59
66
  texture.dispose();
60
67
 
61
68
  image.height = expected_row_count;
@@ -1 +1 @@
1
- {"version":3,"file":"TextureAtlas.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/graphics/texture/atlas/TextureAtlas.js"],"names":[],"mappings":"AAkBA;IACI;;;;;;OAMG;IACH,mBALW,MAAM,cACN,cAAc,kBACd,MAAM,EA2DhB;IAjDG;;;;OAIG;IACH,eAA0B;IAE1B;;;OAGG;IACH,gBAAiB;IAEjB;;;OAGG;IACH,eAFU,OAAO,CAEkB;IAInC;;;;OAIG;IACH,2BAAgH;IAGhH;;;OAGG;IACH,eAAiD;IAEjD;;QAEI;;WAEG;;MAEN;IAED;;;;OAIG;IACH,sBAA0B;IAG9B;;;OAGG;IACH,yBAEC;IAED;;;;OAIG;IACH,kBAHW,SAAS,GACP,UAAU,GAAC,SAAS,CAYhC;IAED;;;OAGG;IACH,eAFa,OAAO,CAInB;IAED;;;;OAIG;IACH,gBAHW,UAAU,GACR,OAAO,CAQnB;IAED;;OAEG;IACH,cAkBC;IAED;;;;;OAKG;IACH,UAJW,MAAM,KACN,MAAM,GACJ,OAAO,CA0CnB;IAED;;;;OAIG;IACH,mBAqBC;IAED;;;;OAIG;IACH,mBAaC;IAED;;;;;;OAMG;IACH,kBAIC;IAED;;;;;OAKG;IACH,aAJW,SAAS,YACT,MAAM,GACL,UAAU,CAgCrB;IAED;;;;;OAKG;IACH,YAJW,MAAM,KACN,MAAM,GACJ,OAAO,CAInB;IAED;;;;OAIG;IACH,cAHW,UAAU,GACT,OAAO,CAiClB;IAED;;;OAGG;IACH,UAFa,OAAO,CAsBnB;IAED;;;;OAIG;IACH,aAqGC;IAED;;OAEG;IACH,cA6BC;IAsDD;;OAEG;IACH,cAQC;CACJ;qCAtjBoC,2BAA2B;oBAN5C,kCAAkC;mBAFnC,0CAA0C;0BAMnC,yBAAyB;2BAGxB,iBAAiB;+BAbb,gDAAgD"}
1
+ {"version":3,"file":"TextureAtlas.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/graphics/texture/atlas/TextureAtlas.js"],"names":[],"mappings":"AAkBA;IACI;;;;;;OAMG;IACH,mBALW,MAAM,cACN,cAAc,kBACd,MAAM,EA2DhB;IAjDG;;;;OAIG;IACH,eAA0B;IAE1B;;;OAGG;IACH,gBAAiB;IAEjB;;;OAGG;IACH,eAFU,OAAO,CAEkB;IAInC;;;;OAIG;IACH,2BAAgH;IAGhH;;;OAGG;IACH,eAAiD;IAEjD;;QAEI;;WAEG;;MAEN;IAED;;;;OAIG;IACH,sBAA0B;IAG9B;;;OAGG;IACH,yBAEC;IAED;;;;OAIG;IACH,kBAHW,SAAS,GACP,UAAU,GAAC,SAAS,CAYhC;IAED;;;OAGG;IACH,eAFa,OAAO,CAInB;IAED;;;;OAIG;IACH,gBAHW,UAAU,GACR,OAAO,CAQnB;IAED;;OAEG;IACH,cAkBC;IAED;;;;;OAKG;IACH,UAJW,MAAM,KACN,MAAM,GACJ,OAAO,CA0CnB;IAED;;;;OAIG;IACH,mBAqBC;IAED;;;;OAIG;IACH,mBAaC;IAED;;;;;;OAMG;IACH,kBAIC;IAED;;;;;OAKG;IACH,aAJW,SAAS,YACT,MAAM,GACL,UAAU,CAgCrB;IAED;;;;;OAKG;IACH,YAJW,MAAM,KACN,MAAM,GACJ,OAAO,CAInB;IAED;;;;OAIG;IACH,cAHW,UAAU,GACT,OAAO,CAiClB;IAED;;;OAGG;IACH,UAFa,OAAO,CAyBnB;IAED;;;;OAIG;IACH,aAqGC;IAED;;OAEG;IACH,cA6BC;IAsDD;;OAEG;IACH,cAQC;CACJ;qCAzjBoC,2BAA2B;oBAN5C,kCAAkC;mBAFnC,0CAA0C;0BAMnC,yBAAyB;2BAGxB,iBAAiB;+BAbb,gDAAgD"}
@@ -359,7 +359,10 @@ export class TextureAtlas extends AbstractTextureAtlas {
359
359
  const patch = patches[i];
360
360
 
361
361
  if (patch.getFlag(AtlasPatchFlag.Packed)) {
362
- patch.clearFlag(AtlasPatchFlag.Packed | AtlasPatchFlag.Packed);
362
+ // repacking moves patches, so whatever is painted at the old
363
+ // position is stale -- clearing Painted is what schedules the
364
+ // repaint at the new one
365
+ patch.clearFlag(AtlasPatchFlag.Packed | AtlasPatchFlag.Painted);
363
366
 
364
367
  this.packer.remove(patch.packing);
365
368
  }
@@ -1 +1 @@
1
- {"version":3,"file":"WebGLTextureAtlas.d.ts","sourceRoot":"","sources":["../../../../../../../src/engine/graphics/texture/atlas/gpu/WebGLTextureAtlas.js"],"names":[],"mappings":"AAeA;IACI;;;;;;;;OAgEC;IAvDG;;;;OAIG;IACH,kBAAmB;IAEnB;;;;OAIG;IACH,kBAAmB;IAEnB;;;;OAIG;IACH,cAAyB;IAEzB;;;;OAIG;IACH,gBAAgB;IAEhB;;;;OAIG;IACH,iBAAiB;IAEjB;;;;OAIG;IACH,qBAAqB;IAErB;;;;OAIG;IACH,mBAAuB;IAEvB;;;;OAIG;IACH,kBAAsK;IAG1K;;;;;;;;;OASG;IACH,+BAPW,MAAM,YACN,MAAM,gBACN,MAAM,iBACN,MAAM,gBACN,MAAM,iBACN,MAAM,cAiBhB;IAED,eAqCC;IAED;;;;OAIG;IACH,qCA0BC;CACJ;2BAvK0B,kBAAkB"}
1
+ {"version":3,"file":"WebGLTextureAtlas.d.ts","sourceRoot":"","sources":["../../../../../../../src/engine/graphics/texture/atlas/gpu/WebGLTextureAtlas.js"],"names":[],"mappings":"AAeA;IACI;;;;;;;;OAgEC;IAvDG;;;;OAIG;IACH,kBAAmB;IAEnB;;;;OAIG;IACH,kBAAmB;IAEnB;;;;OAIG;IACH,cAAyB;IAEzB;;;;OAIG;IACH,gBAAgB;IAEhB;;;;OAIG;IACH,iBAAiB;IAEjB;;;;OAIG;IACH,qBAAqB;IAErB;;;;OAIG;IACH,mBAAuB;IAEvB;;;;OAIG;IACH,kBAAsK;IAG1K;;;;;;;;;OASG;IACH,+BAPW,MAAM,YACN,MAAM,gBACN,MAAM,iBACN,MAAM,gBACN,MAAM,iBACN,MAAM,cAuBhB;IAED,eA0CC;IAED;;;;OAIG;IACH,qCA0BC;CACJ;2BAlL0B,kBAAkB"}
@@ -96,6 +96,12 @@ export class WebGLTextureAtlas {
96
96
  const patch = new AtlasPatch();
97
97
  patch.id = id;
98
98
 
99
+ // layout() packs `patch.packing`, so the target dimensions have to be
100
+ // recorded here or every patch is a zero-sized rectangle at the origin
101
+ // and they all pack on top of one another
102
+ patch.size.set(target_width, target_height);
103
+ patch.packing.set(0, 0, target_width, target_height);
104
+
99
105
  this.__patches.push(patch);
100
106
  this.__sources[id] = source;
101
107
 
@@ -143,6 +149,11 @@ export class WebGLTextureAtlas {
143
149
  const patch = this.__patches[i];
144
150
 
145
151
  patch.packing.copy(aabb);
152
+
153
+ // build() paints through patch.position, so the packed origin has
154
+ // to land there too -- otherwise every patch is copied to (0,0)
155
+ // no matter where the packer placed it
156
+ patch.position.set(aabb.x0, aabb.y0);
146
157
  });
147
158
  }
148
159
 
@@ -1 +1 @@
1
- {"version":3,"file":"load_environment_map.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/graphics/texture/cubemap/load_environment_map.js"],"names":[],"mappings":"AA8EA;;;;;;;GAOG;AACH,6EANW,MAAM,GAAC,MAAM,EAAE,GAIb;IAAC,QAAQ,CAAC,EAAC,MAAM,WAAW,CAAC;IAAC,QAAQ,CAAC,EAAE,MAAM,WAAW,CAAA;CAAC,CA8EvE"}
1
+ {"version":3,"file":"load_environment_map.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/graphics/texture/cubemap/load_environment_map.js"],"names":[],"mappings":"AAiFA;;;;;;;GAOG;AACH,6EANW,MAAM,GAAC,MAAM,EAAE,GAIb;IAAC,QAAQ,CAAC,EAAC,MAAM,WAAW,CAAC;IAAC,QAAQ,CAAC,EAAE,MAAM,WAAW,CAAA;CAAC,CA8EvE"}
@@ -1,4 +1,4 @@
1
- import { CubeTextureLoader, LinearFilter, PMREMGenerator, sRGBEncoding, TextureLoader, UnsignedByteType } from "three";
1
+ import { CubeTextureLoader, LinearFilter, PMREMGenerator, sRGBEncoding, TextureLoader } from "three";
2
2
  import { EXRLoader } from "three/examples/jsm/loaders/EXRLoader.js";
3
3
  import { HDRCubeTextureLoader } from "three/examples/jsm/loaders/HDRCubeTextureLoader.js";
4
4
  import { noop } from "../../../../core/function/noop.js";
@@ -53,8 +53,11 @@ function load_hdr_cube_texture(paths) {
53
53
  */
54
54
  function load_exr_texture(path) {
55
55
  return new Promise((resolve, reject) => {
56
+ // EXR is HDR data; EXRLoader only decodes into FloatType or HalfFloatType
57
+ // and defaults to HalfFloatType. Requesting UnsignedByteType left the
58
+ // decoder without an output buffer, so every .exr environment map failed
59
+ // to load. Match load_hdr_cube_texture and take the loader's default.
56
60
  new EXRLoader()
57
- .setDataType(UnsignedByteType)
58
61
  .load(path, texture => {
59
62
  resolve(texture);
60
63
  }, noop, reject);
@@ -1 +1 @@
1
- {"version":3,"file":"computeSignedDistanceField_Chamfer.d.ts","sourceRoot":"","sources":["../../../../../../../src/engine/graphics/texture/sampler/distance/computeSignedDistanceField_Chamfer.js"],"names":[],"mappings":"AAGA;;;;;;;;GAQG;AACH,4GALW,MAAM,MACN,MAAM,MACN,MAAM,mBAkIhB"}
1
+ {"version":3,"file":"computeSignedDistanceField_Chamfer.d.ts","sourceRoot":"","sources":["../../../../../../../src/engine/graphics/texture/sampler/distance/computeSignedDistanceField_Chamfer.js"],"names":[],"mappings":"AAGA;;;;;;;;GAQG;AACH,4GALW,MAAM,MACN,MAAM,MACN,MAAM,mBA0IhB"}
@@ -69,62 +69,70 @@ export function computeSignedDistanceField_Chamfer(source, distanceField, emptyV
69
69
  for (y = 0; y < height; y++) {
70
70
  for (x = 0; x < width; x++) {
71
71
 
72
- const v = getD(x, y);
72
+ // each candidate must be compared against the running minimum, not
73
+ // against the value the cell started with -- otherwise the *last*
74
+ // candidate that beat the original wins instead of the smallest.
75
+ // Accumulating and writing once is also fewer stores than before.
76
+ let best = getD(x, y);
73
77
 
74
78
  const v0 = getD(x - 1, y - 1) + d2;
75
79
 
76
- if (v0 < v) {
77
- setD(x, y, v0);
80
+ if (v0 < best) {
81
+ best = v0;
78
82
  }
79
83
 
80
84
  const v1 = getD(x, y - 1) + d1;
81
85
 
82
- if (v1 < v) {
83
- setD(x, y, v1);
86
+ if (v1 < best) {
87
+ best = v1;
84
88
  }
85
89
 
86
90
  const v2 = getD(x + 1, y - 1) + d2;
87
91
 
88
- if (v2 < v) {
89
- setD(x, y, v2);
92
+ if (v2 < best) {
93
+ best = v2;
90
94
  }
91
95
 
92
96
  const v3 = getD(x - 1, y) + d1;
93
97
 
94
- if (v3 < v) {
95
- setD(x, y, v3);
98
+ if (v3 < best) {
99
+ best = v3;
96
100
  }
101
+
102
+ setD(x, y, best);
97
103
  }
98
104
  }
99
105
 
100
106
  //second pass (backward)
101
107
  for (y = maxY; y >= 0; y--) {
102
108
  for (x = maxX; x >= 0; x--) {
103
- const v = getD(x, y);
109
+ let best = getD(x, y);
104
110
 
105
111
  const v0 = getD(x + 1, y) + d1;
106
112
 
107
- if (v0 < v) {
108
- setD(x, y, v0);
113
+ if (v0 < best) {
114
+ best = v0;
109
115
  }
110
116
 
111
117
  const v1 = getD(x - 1, y + 1) + d2;
112
118
 
113
- if (v1 < v) {
114
- setD(x, y, v1);
119
+ if (v1 < best) {
120
+ best = v1;
115
121
  }
116
122
 
117
123
  const v2 = getD(x, y + 1) + d1;
118
124
 
119
- if (v2 < v) {
120
- setD(x, y, v2);
125
+ if (v2 < best) {
126
+ best = v2;
121
127
  }
122
128
 
123
129
  const v3 = getD(x + 1, y + 1) + d2;
124
130
 
125
- if (v3 < v) {
126
- setD(x, y, v3);
131
+ if (v3 < best) {
132
+ best = v3;
127
133
  }
134
+
135
+ setD(x, y, best);
128
136
  }
129
137
  }
130
138
 
@@ -1,9 +1,22 @@
1
1
  /**
2
+ * Separable gaussian blur.
3
+ *
4
+ * `size` is the full footprint width in pixels: every output pixel is gathered
5
+ * from `[-size/2, +size/2]` around itself along each axis, at `sample_count`
6
+ * evenly spaced taps. `quality` scales the tap count, trading cost against
7
+ * sampling density; it leaves both the footprint and the standard deviation in
8
+ * pixels unchanged.
9
+ *
10
+ * Below `quality = 1` the taps are spaced more than a pixel apart, so detail
11
+ * finer than that spacing aliases — an isolated bright pixel gets smeared into
12
+ * a ring of tap-spaced echoes rather than a smooth falloff. On smooth input the
13
+ * result is indistinguishable from the fully sampled filter, which is what the
14
+ * setting is for; do not turn it down on input with isolated highlights.
2
15
  *
3
16
  * @param {Sampler2D} output
4
17
  * @param {Sampler2D} input
5
- * @param {number} size
6
- * @param {number} [quality]
18
+ * @param {number} size footprint width, in pixels
19
+ * @param {number} [quality] taps per pixel of footprint; 1 gives roughly one tap per pixel
7
20
  */
8
21
  export function sampler2d_blur_gaussian(output: Sampler2D, input: Sampler2D, size: number, quality?: number): void;
9
22
  import { Sampler2D } from "../Sampler2D.js";
@@ -1 +1 @@
1
- {"version":3,"file":"sampler2d_blur_gaussian.d.ts","sourceRoot":"","sources":["../../../../../../../src/engine/graphics/texture/sampler/filter/sampler2d_blur_gaussian.js"],"names":[],"mappings":"AAQA;;;;;;GAMG;AACH,gDALW,SAAS,SACT,SAAS,QACT,MAAM,YACN,MAAM,QAoFhB;0BA9FyB,iBAAiB"}
1
+ {"version":3,"file":"sampler2d_blur_gaussian.d.ts","sourceRoot":"","sources":["../../../../../../../src/engine/graphics/texture/sampler/filter/sampler2d_blur_gaussian.js"],"names":[],"mappings":"AAQA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,gDALW,SAAS,SACT,SAAS,QACT,MAAM,YACN,MAAM,QAiGhB;0BAxHyB,iBAAiB"}
@@ -7,17 +7,43 @@ import { Sampler2D } from "../Sampler2D.js";
7
7
  let temp_data = new Float64Array(1);
8
8
 
9
9
  /**
10
+ * Separable gaussian blur.
11
+ *
12
+ * `size` is the full footprint width in pixels: every output pixel is gathered
13
+ * from `[-size/2, +size/2]` around itself along each axis, at `sample_count`
14
+ * evenly spaced taps. `quality` scales the tap count, trading cost against
15
+ * sampling density; it leaves both the footprint and the standard deviation in
16
+ * pixels unchanged.
17
+ *
18
+ * Below `quality = 1` the taps are spaced more than a pixel apart, so detail
19
+ * finer than that spacing aliases — an isolated bright pixel gets smeared into
20
+ * a ring of tap-spaced echoes rather than a smooth falloff. On smooth input the
21
+ * result is indistinguishable from the fully sampled filter, which is what the
22
+ * setting is for; do not turn it down on input with isolated highlights.
10
23
  *
11
24
  * @param {Sampler2D} output
12
25
  * @param {Sampler2D} input
13
- * @param {number} size
14
- * @param {number} [quality]
26
+ * @param {number} size footprint width, in pixels
27
+ * @param {number} [quality] taps per pixel of footprint; 1 gives roughly one tap per pixel
15
28
  */
16
29
  export function sampler2d_blur_gaussian(output, input, size, quality = 1) {
17
30
 
18
- const sigma = size * 3;
19
31
  const sample_count = max2(3, nextOdd(Math.round(size * quality)));
20
32
 
33
+ // `build_gaussian_kernel_1d` places taps one unit apart, so its sigma is in
34
+ // TAP units, whereas the footprint is in pixels -- the two are related by
35
+ // `local_u_scale` below. Working in tap units, the outermost tap sits at
36
+ // (sample_count - 1) / 2, and we want the kernel truncated there at three
37
+ // standard deviations: beyond 3 sigma a gaussian carries ~0.3% of its mass,
38
+ // so cutting it there is visually lossless while keeping the taps busy.
39
+ //
40
+ // This previously read `size * 3`, which is the same expression with the
41
+ // ratio inverted and the wrong unit. That put every tap inside ±(1/6) of a
42
+ // standard deviation, where a gaussian is flat: the outermost tap carried
43
+ // ~99% of the weight of the centre one, so the filter was a box blur and
44
+ // `size` had no influence on the shape of the falloff at all.
45
+ const sigma = (sample_count - 1) / 6;
46
+
21
47
  const kernel = new Float32Array(sample_count);
22
48
 
23
49
  build_gaussian_kernel_1d(kernel, sample_count, sigma);
@@ -1,5 +1,15 @@
1
1
  /**
2
- * Good for down-sampling
2
+ * Good for down-sampling.
3
+ *
4
+ * The kernel is separable and evaluated in destination-pixel units: a source
5
+ * texel's distance from the destination pixel's centre is divided by the
6
+ * scaling ratio, which is what stretches the filter's support to cover the
7
+ * whole footprint being averaged.
8
+ *
9
+ * Negative lobes are kept. They are the entire point of Lanczos -- discarding
10
+ * them removes the sharpening and, when every sample in the footprint happens
11
+ * to land in a negative lobe, leaves a zero weight sum and a NaN result.
12
+ *
3
13
  * @param {Sampler2D} source
4
14
  * @param {Sampler2D} destination
5
15
  * @param {number} [lobes]
@@ -1 +1 @@
1
- {"version":3,"file":"sampler2d_scale_down_lanczos.d.ts","sourceRoot":"","sources":["../../../../../../../src/engine/graphics/texture/sampler/resize/sampler2d_scale_down_lanczos.js"],"names":[],"mappings":"AAkEA;;;;;GAKG;AACH,gGAFW,MAAM,QAoGhB"}
1
+ {"version":3,"file":"sampler2d_scale_down_lanczos.d.ts","sourceRoot":"","sources":["../../../../../../../src/engine/graphics/texture/sampler/resize/sampler2d_scale_down_lanczos.js"],"names":[],"mappings":"AAiCA;;;;;;;;;;;;;;;GAeG;AACH,gGAFW,MAAM,QA8GhB"}