@woosh/meep-engine 3.22.0 → 3.23.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.
- package/package.json +1 -1
- package/src/core/geom/3d/hash-grid/PointHashGrid3.d.ts +118 -0
- package/src/core/geom/3d/hash-grid/PointHashGrid3.d.ts.map +1 -0
- package/src/core/geom/3d/hash-grid/PointHashGrid3.js +283 -0
- package/src/core/geom/3d/shape/BoxShape3D.d.ts.map +1 -1
- package/src/core/geom/3d/shape/BoxShape3D.js +6 -17
- package/src/core/geom/3d/shape/CapsuleShape3D.d.ts.map +1 -1
- package/src/core/geom/3d/shape/CapsuleShape3D.js +3 -14
- package/src/core/geom/3d/shape/CylinderShape3D.d.ts.map +1 -1
- package/src/core/geom/3d/shape/CylinderShape3D.js +3 -21
- package/src/core/geom/3d/shape/PlaneShape3D.d.ts +105 -0
- package/src/core/geom/3d/shape/PlaneShape3D.d.ts.map +1 -0
- package/src/core/geom/3d/shape/PlaneShape3D.js +251 -0
- package/src/core/geom/3d/shape/SphereShape3D.js +3 -3
- package/src/core/geom/3d/shape/json/shape_to_type.d.ts.map +1 -1
- package/src/core/geom/3d/shape/json/shape_to_type.js +3 -0
- package/src/core/geom/3d/shape/json/type_adapters.d.ts +14 -0
- package/src/core/geom/3d/shape/json/type_adapters.d.ts.map +1 -1
- package/src/core/geom/3d/shape/json/type_adapters.js +15 -0
- package/src/core/geom/3d/shape/sdf/sdf3_box.d.ts +51 -0
- package/src/core/geom/3d/shape/sdf/sdf3_box.d.ts.map +1 -0
- package/src/core/geom/3d/shape/sdf/sdf3_box.js +113 -0
- package/src/core/geom/3d/shape/sdf/sdf3_capsule.d.ts +46 -0
- package/src/core/geom/3d/shape/sdf/sdf3_capsule.d.ts.map +1 -0
- package/src/core/geom/3d/shape/sdf/sdf3_capsule.js +82 -0
- package/src/core/geom/3d/shape/sdf/sdf3_cylinder.d.ts +60 -0
- package/src/core/geom/3d/shape/sdf/sdf3_cylinder.d.ts.map +1 -0
- package/src/core/geom/3d/shape/sdf/sdf3_cylinder.js +126 -0
- package/src/core/geom/3d/shape/sdf/sdf3_degenerate_normal.d.ts +50 -0
- package/src/core/geom/3d/shape/sdf/sdf3_degenerate_normal.d.ts.map +1 -0
- package/src/core/geom/3d/shape/sdf/sdf3_degenerate_normal.js +53 -0
- package/src/core/geom/3d/shape/sdf/sdf3_plane.d.ts +52 -0
- package/src/core/geom/3d/shape/sdf/sdf3_plane.d.ts.map +1 -0
- package/src/core/geom/3d/shape/sdf/sdf3_plane.js +61 -0
- package/src/core/geom/3d/shape/sdf/sdf3_sphere.d.ts +41 -0
- package/src/core/geom/3d/shape/sdf/sdf3_sphere.d.ts.map +1 -0
- package/src/core/geom/3d/shape/sdf/sdf3_sphere.js +71 -0
- package/src/core/process/ConcurrencyGate.d.ts +103 -0
- package/src/core/process/ConcurrencyGate.d.ts.map +1 -0
- package/src/core/process/ConcurrencyGate.js +207 -0
- package/src/engine/asset/AssetManager.d.ts +10 -0
- package/src/engine/asset/AssetManager.d.ts.map +1 -1
- package/src/engine/asset/AssetManager.js +10 -0
- package/src/engine/graphics/CONTEXT_LOSS_RECOVERY_PLAN.md +30 -13
- package/src/engine/graphics3/pose/collect_entity_playbacks.d.ts +26 -0
- package/src/engine/graphics3/pose/collect_entity_playbacks.d.ts.map +1 -0
- package/src/engine/graphics3/pose/collect_entity_playbacks.js +40 -0
- package/src/engine/graphics3/pose/query_entity_node_world_pose.d.ts.map +1 -1
- package/src/engine/graphics3/pose/query_entity_node_world_pose.js +74 -101
- package/src/engine/physics/cloth/MEASUREMENTS.md +1287 -4
- package/src/engine/physics/cloth/PLAN.md +1967 -1581
- package/src/engine/physics/cloth/build/ClothProxy.d.ts +147 -0
- package/src/engine/physics/cloth/build/ClothProxy.d.ts.map +1 -0
- package/src/engine/physics/cloth/build/ClothProxy.js +207 -0
- package/src/engine/physics/cloth/build/cloth_proxy_from_joints.d.ts +70 -0
- package/src/engine/physics/cloth/build/cloth_proxy_from_joints.d.ts.map +1 -0
- package/src/engine/physics/cloth/build/cloth_proxy_from_joints.js +256 -0
- package/src/engine/physics/cloth/collider/ClothColliderIndex.d.ts +176 -0
- package/src/engine/physics/cloth/collider/ClothColliderIndex.d.ts.map +1 -0
- package/src/engine/physics/cloth/collider/ClothColliderIndex.js +435 -0
- package/src/engine/physics/cloth/collider/ClothColliderKind.d.ts +12 -0
- package/src/engine/physics/cloth/collider/ClothColliderKind.d.ts.map +1 -0
- package/src/engine/physics/cloth/collider/ClothColliderKind.js +38 -0
- package/src/engine/physics/cloth/collider/ClothColliderRecord.d.ts +120 -0
- package/src/engine/physics/cloth/collider/ClothColliderRecord.d.ts.map +1 -0
- package/src/engine/physics/cloth/collider/ClothColliderRecord.js +137 -0
- package/src/engine/physics/cloth/collider/cloth_collider_bounds.d.ts +25 -0
- package/src/engine/physics/cloth/collider/cloth_collider_bounds.d.ts.map +1 -0
- package/src/engine/physics/cloth/collider/cloth_collider_bounds.js +190 -0
- package/src/engine/physics/cloth/collider/cloth_collider_pack.d.ts +44 -0
- package/src/engine/physics/cloth/collider/cloth_collider_pack.d.ts.map +1 -0
- package/src/engine/physics/cloth/collider/cloth_collider_pack.js +173 -0
- package/src/engine/physics/cloth/collider/cloth_collider_sdf.d.ts +94 -0
- package/src/engine/physics/cloth/collider/cloth_collider_sdf.d.ts.map +1 -0
- package/src/engine/physics/cloth/collider/cloth_collider_sdf.js +275 -0
- package/src/engine/physics/cloth/ecs/ClothCollider.d.ts +126 -0
- package/src/engine/physics/cloth/ecs/ClothCollider.d.ts.map +1 -0
- package/src/engine/physics/cloth/ecs/ClothCollider.js +199 -0
- package/src/engine/physics/cloth/ecs/ClothColliderFlags.d.ts +9 -0
- package/src/engine/physics/cloth/ecs/ClothColliderFlags.d.ts.map +1 -0
- package/src/engine/physics/cloth/ecs/ClothColliderFlags.js +32 -0
- package/src/engine/physics/cloth/ecs/ClothColliderSystem.d.ts +114 -0
- package/src/engine/physics/cloth/ecs/ClothColliderSystem.d.ts.map +1 -0
- package/src/engine/physics/cloth/ecs/ClothColliderSystem.js +243 -0
- package/src/engine/physics/cloth/ecs/ClothDynamicsFlags.js +66 -57
- package/src/engine/physics/cloth/ecs/ClothInstance.d.ts +109 -1
- package/src/engine/physics/cloth/ecs/ClothInstance.d.ts.map +1 -1
- package/src/engine/physics/cloth/ecs/ClothInstance.js +479 -363
- package/src/engine/physics/cloth/ecs/ClothRig.d.ts +95 -0
- package/src/engine/physics/cloth/ecs/ClothRig.d.ts.map +1 -0
- package/src/engine/physics/cloth/ecs/ClothRig.js +140 -0
- package/src/engine/physics/cloth/ecs/ClothSystem.d.ts +30 -1
- package/src/engine/physics/cloth/ecs/ClothSystem.d.ts.map +1 -1
- package/src/engine/physics/cloth/ecs/ClothSystem.js +1021 -773
- package/src/engine/physics/cloth/ecs/cloth_build_rows.d.ts +90 -0
- package/src/engine/physics/cloth/ecs/cloth_build_rows.d.ts.map +1 -0
- package/src/engine/physics/cloth/ecs/cloth_build_rows.js +374 -0
- package/src/engine/physics/cloth/ecs/cloth_dynamics_library.d.ts +32 -3
- package/src/engine/physics/cloth/ecs/cloth_dynamics_library.d.ts.map +1 -1
- package/src/engine/physics/cloth/ecs/cloth_dynamics_library.js +283 -254
- package/src/engine/physics/cloth/ecs/cloth_gather_colliders.d.ts +59 -0
- package/src/engine/physics/cloth/ecs/cloth_gather_colliders.d.ts.map +1 -0
- package/src/engine/physics/cloth/ecs/cloth_gather_colliders.js +328 -0
- package/src/engine/physics/cloth/ecs/cloth_reconstruct_pose.d.ts +13 -0
- package/src/engine/physics/cloth/ecs/cloth_reconstruct_pose.d.ts.map +1 -0
- package/src/engine/physics/cloth/ecs/cloth_reconstruct_pose.js +288 -0
- package/src/engine/physics/cloth/ecs/cloth_seed_rig.d.ts +58 -0
- package/src/engine/physics/cloth/ecs/cloth_seed_rig.d.ts.map +1 -0
- package/src/engine/physics/cloth/ecs/cloth_seed_rig.js +199 -0
- package/src/engine/physics/cloth/ecs/cloth_seed_subtree.d.ts +8 -63
- package/src/engine/physics/cloth/ecs/cloth_seed_subtree.d.ts.map +1 -1
- package/src/engine/physics/cloth/ecs/cloth_seed_subtree.js +317 -645
- package/src/engine/physics/cloth/ecs/cloth_write_back.d.ts +61 -0
- package/src/engine/physics/cloth/ecs/cloth_write_back.d.ts.map +1 -1
- package/src/engine/physics/cloth/ecs/cloth_write_back.js +212 -449
- package/src/engine/physics/cloth/ecs/cloth_write_back_rig.d.ts +49 -0
- package/src/engine/physics/cloth/ecs/cloth_write_back_rig.d.ts.map +1 -0
- package/src/engine/physics/cloth/ecs/cloth_write_back_rig.js +115 -0
- package/src/engine/physics/cloth/playground/README.md +155 -1
- package/src/engine/physics/cloth/playground/collide.html +178 -0
- package/src/engine/physics/cloth/playground/collide_build.d.ts +95 -0
- package/src/engine/physics/cloth/playground/collide_build.d.ts.map +1 -0
- package/src/engine/physics/cloth/playground/collide_build.js +315 -0
- package/src/engine/physics/cloth/playground/collide_main.d.ts +2 -0
- package/src/engine/physics/cloth/playground/collide_main.d.ts.map +1 -0
- package/src/engine/physics/cloth/playground/collide_main.js +720 -0
- package/src/engine/physics/cloth/playground/garment.html +182 -0
- package/src/engine/physics/cloth/playground/garment_build.d.ts +78 -0
- package/src/engine/physics/cloth/playground/garment_build.d.ts.map +1 -0
- package/src/engine/physics/cloth/playground/garment_build.js +359 -0
- package/src/engine/physics/cloth/playground/garment_main.d.ts +2 -0
- package/src/engine/physics/cloth/playground/garment_main.d.ts.map +1 -0
- package/src/engine/physics/cloth/playground/garment_main.js +633 -0
- package/src/engine/physics/cloth/solver/ClothState.d.ts +208 -5
- package/src/engine/physics/cloth/solver/ClothState.d.ts.map +1 -1
- package/src/engine/physics/cloth/solver/ClothState.js +302 -8
- package/src/engine/physics/cloth/solver/cloth_contact_find.d.ts +87 -0
- package/src/engine/physics/cloth/solver/cloth_contact_find.d.ts.map +1 -0
- package/src/engine/physics/cloth/solver/cloth_contact_find.js +343 -0
- package/src/engine/physics/cloth/solver/cloth_self_find.d.ts +112 -0
- package/src/engine/physics/cloth/solver/cloth_self_find.d.ts.map +1 -0
- package/src/engine/physics/cloth/solver/cloth_self_find.js +448 -0
- package/src/engine/physics/cloth/solver/cloth_solve_vertex.d.ts +4 -1
- package/src/engine/physics/cloth/solver/cloth_solve_vertex.d.ts.map +1 -1
- package/src/engine/physics/cloth/solver/cloth_solve_vertex.js +16 -1
- package/src/engine/physics/cloth/solver/cloth_solver_constants.d.ts +112 -5
- package/src/engine/physics/cloth/solver/cloth_solver_constants.d.ts.map +1 -1
- package/src/engine/physics/cloth/solver/cloth_solver_constants.js +117 -6
- package/src/engine/physics/cloth/solver/cloth_step.d.ts +40 -9
- package/src/engine/physics/cloth/solver/cloth_step.d.ts.map +1 -1
- package/src/engine/physics/cloth/solver/cloth_step.js +122 -10
- package/src/engine/physics/cloth/solver/constraint/cloth_backstop_row.d.ts +95 -0
- package/src/engine/physics/cloth/solver/constraint/cloth_backstop_row.d.ts.map +1 -0
- package/src/engine/physics/cloth/solver/constraint/cloth_backstop_row.js +285 -0
- package/src/engine/physics/cloth/solver/constraint/cloth_contact_row.d.ts +129 -0
- package/src/engine/physics/cloth/solver/constraint/cloth_contact_row.d.ts.map +1 -0
- package/src/engine/physics/cloth/solver/constraint/cloth_contact_row.js +501 -0
- package/src/engine/physics/cloth/solver/constraint/cloth_self_row.d.ts +75 -0
- package/src/engine/physics/cloth/solver/constraint/cloth_self_row.d.ts.map +1 -0
- package/src/engine/physics/cloth/solver/constraint/cloth_self_row.js +202 -0
- package/src/engine/physics/fluid/ecs/FluidObstacleSystem.d.ts +4 -4
- package/src/shade/playground/vgeo_viewer/README.md +18 -0
- package/src/shade/playground/vgeo_viewer/main.js +87 -50
- package/src/shade/renderer/buffer/table/GPUDatabase.d.ts.map +1 -1
- package/src/shade/renderer/buffer/table/GPUDatabase.js +191 -62
- package/src/shade/renderer/buffer/table/GPUTypedTable.d.ts +94 -2
- package/src/shade/renderer/buffer/table/GPUTypedTable.d.ts.map +1 -1
- package/src/shade/renderer/buffer/table/GPUTypedTable.js +414 -2
- package/src/shade/renderer/buffer/table/GPU_TABLE_PARTIAL_UPLOAD_DESCRIPTOR_WORDS.d.ts +14 -0
- package/src/shade/renderer/buffer/table/GPU_TABLE_PARTIAL_UPLOAD_DESCRIPTOR_WORDS.d.ts.map +1 -0
- package/src/shade/renderer/buffer/table/GPU_TABLE_PARTIAL_UPLOAD_DESCRIPTOR_WORDS.js +13 -0
- package/src/shade/renderer/buffer/table/gpu_table_partial_upload_shader.d.ts +17 -0
- package/src/shade/renderer/buffer/table/gpu_table_partial_upload_shader.d.ts.map +1 -0
- package/src/shade/renderer/buffer/table/gpu_table_partial_upload_shader.js +116 -0
- package/src/shade/renderer/geometry/bvh/GPUGeometryBVHManager.d.ts +9 -4
- package/src/shade/renderer/geometry/bvh/GPUGeometryBVHManager.d.ts.map +1 -1
- package/src/shade/renderer/geometry/bvh/GPUGeometryBVHManager.js +843 -734
- package/src/shade/renderer/geometry/bvh/GPUGeometryMeshletsBVH.d.ts +12 -0
- package/src/shade/renderer/geometry/bvh/GPUGeometryMeshletsBVH.d.ts.map +1 -1
- package/src/shade/renderer/geometry/bvh/GPUGeometryMeshletsBVH.js +13 -0
- package/src/shade/renderer/geometry/meshlet/GPUMeshletManager.d.ts +17 -0
- package/src/shade/renderer/geometry/meshlet/GPUMeshletManager.d.ts.map +1 -1
- package/src/shade/renderer/geometry/meshlet/GPUMeshletManager.js +185 -30
- package/src/shade/renderer/geometry/virtual/MICRON_COMPARISON_2026_08_20.md +17 -0
- package/src/shade/renderer/geometry/virtual/VGEO_FORMAT.md +141 -24
- package/src/shade/renderer/geometry/virtual/VIRTUAL_GEOMETRY_DESIGN.md +204 -64
- package/src/shade/renderer/geometry/virtual/VIRTUAL_GEOMETRY_PLAN.md +110 -10
- package/src/shade/renderer/geometry/virtual/VK_LOD_CLUSTERS_COMPARISON_2026_08_20.md +19 -0
- package/src/shade/renderer/geometry/virtual/format/read/VGeoByteSource.d.ts +19 -6
- package/src/shade/renderer/geometry/virtual/format/read/VGeoByteSource.d.ts.map +1 -1
- package/src/shade/renderer/geometry/virtual/format/read/VGeoByteSource.js +26 -7
- package/src/shade/renderer/geometry/virtual/format/read/VGeoContainerReader.d.ts +173 -14
- package/src/shade/renderer/geometry/virtual/format/read/VGeoContainerReader.d.ts.map +1 -1
- package/src/shade/renderer/geometry/virtual/format/read/VGeoContainerReader.js +458 -51
- package/src/shade/renderer/geometry/virtual/format/read/VGeoReadOptions.d.ts +49 -13
- package/src/shade/renderer/geometry/virtual/format/read/VGeoReadOptions.d.ts.map +1 -1
- package/src/shade/renderer/geometry/virtual/format/read/VGeoReadOptions.js +52 -14
- package/src/shade/renderer/geometry/virtual/format/read/tool/VGEO_MAX_AUDIT_BYTES.d.ts +20 -0
- package/src/shade/renderer/geometry/virtual/format/read/tool/VGEO_MAX_AUDIT_BYTES.d.ts.map +1 -0
- package/src/shade/renderer/geometry/virtual/format/read/tool/VGEO_MAX_AUDIT_BYTES.js +19 -0
- package/src/shade/renderer/geometry/virtual/format/read/tool/vgeo_audit_container.d.ts +27 -0
- package/src/shade/renderer/geometry/virtual/format/read/tool/vgeo_audit_container.d.ts.map +1 -0
- package/src/shade/renderer/geometry/virtual/format/read/tool/vgeo_audit_container.js +48 -0
- package/src/shade/renderer/geometry/virtual/format/read/tool/vgeo_install_all_pages.d.ts +29 -0
- package/src/shade/renderer/geometry/virtual/format/read/tool/vgeo_install_all_pages.d.ts.map +1 -0
- package/src/shade/renderer/geometry/virtual/format/read/tool/vgeo_install_all_pages.js +60 -0
- package/src/shade/renderer/geometry/virtual/format/read/vgeo_fetch_byte_source.d.ts +8 -1
- package/src/shade/renderer/geometry/virtual/format/read/vgeo_fetch_byte_source.d.ts.map +1 -1
- package/src/shade/renderer/geometry/virtual/format/read/vgeo_fetch_byte_source.js +32 -2
- package/src/shade/renderer/geometry/virtual/residency/VGeoResidencyManager.d.ts +258 -0
- package/src/shade/renderer/geometry/virtual/residency/VGeoResidencyManager.d.ts.map +1 -0
- package/src/shade/renderer/geometry/virtual/residency/VGeoResidencyManager.js +723 -0
- package/src/shade/renderer/geometry/virtual/residency/VGeoResidencyOptions.d.ts +49 -0
- package/src/shade/renderer/geometry/virtual/residency/VGeoResidencyOptions.d.ts.map +1 -0
- package/src/shade/renderer/geometry/virtual/residency/VGeoResidencyOptions.js +50 -0
- package/src/shade/renderer/loader/gltf/tiny-gltf.d.ts +1 -1
- package/src/shade/renderer/postprocess/nss/NSS.d.ts +1 -1
- package/src/shade/renderer/texture/bindless/GPUBindlessTextureManager.d.ts +3 -0
- package/src/shade/renderer/texture/bindless/GPUBindlessTextureManager.d.ts.map +1 -1
- package/src/shade/renderer/texture/bindless/GPUBindlessTextureManager.js +121 -21
- package/src/shade/renderer/texture/virtual/README.md +6 -4
- package/src/shade/renderer/texture/virtual/VirtualTextureManager.d.ts.map +1 -1
- package/src/shade/renderer/texture/virtual/VirtualTextureManager.js +7 -0
- package/src/shade/renderer/texture/virtual/source/VTSourceTiled.d.ts +3 -3
- package/src/shade/renderer/texture/virtual/source/VTSourceTiled.js +3 -3
- package/src/engine/ecs/system/SystemExecutionPhase.d.ts +0 -9
- package/src/engine/ecs/system/SystemExecutionPhase.d.ts.map +0 -1
- package/src/engine/graphics/texture/virtual/NOTES.md +0 -128
- package/src/engine/graphics/texture/virtual/VT_DEFAULT_PAGE_RESOLUTION.d.ts +0 -6
- package/src/engine/graphics/texture/virtual/VT_DEFAULT_PAGE_RESOLUTION.d.ts.map +0 -1
- package/src/engine/graphics/texture/virtual/VT_DEFAULT_PAGE_RESOLUTION.js +0 -5
- package/src/engine/graphics/texture/virtual/VirtualTextureTileLoader.d.ts +0 -49
- package/src/engine/graphics/texture/virtual/VirtualTextureTileLoader.d.ts.map +0 -1
- package/src/engine/graphics/texture/virtual/VirtualTextureTileLoader.js +0 -264
- package/src/engine/graphics/texture/virtual/VirtualTextureUsage.d.ts +0 -44
- package/src/engine/graphics/texture/virtual/VirtualTextureUsage.d.ts.map +0 -1
- package/src/engine/graphics/texture/virtual/VirtualTextureUsage.js +0 -228
- package/src/engine/graphics/texture/virtual/VirtualTextureUsageShader.d.ts +0 -3
- package/src/engine/graphics/texture/virtual/VirtualTextureUsageShader.d.ts.map +0 -1
- package/src/engine/graphics/texture/virtual/VirtualTextureUsageShader.js +0 -73
- package/src/engine/graphics/texture/virtual/debug/ResidencyDebugView.d.ts +0 -14
- package/src/engine/graphics/texture/virtual/debug/ResidencyDebugView.d.ts.map +0 -1
- package/src/engine/graphics/texture/virtual/debug/ResidencyDebugView.js +0 -85
- package/src/engine/graphics/texture/virtual/debug/UsageDebugView.d.ts +0 -12
- package/src/engine/graphics/texture/virtual/debug/UsageDebugView.d.ts.map +0 -1
- package/src/engine/graphics/texture/virtual/debug/UsageDebugView.js +0 -63
- package/src/engine/graphics/texture/virtual/debug/UsagePyramidDebugView.d.ts +0 -12
- package/src/engine/graphics/texture/virtual/debug/UsagePyramidDebugView.d.ts.map +0 -1
- package/src/engine/graphics/texture/virtual/debug/UsagePyramidDebugView.js +0 -243
- package/src/engine/graphics/texture/virtual/tile/VirtualTextureTile.d.ts +0 -30
- package/src/engine/graphics/texture/virtual/tile/VirtualTextureTile.d.ts.map +0 -1
- package/src/engine/graphics/texture/virtual/tile/VirtualTextureTile.js +0 -39
- package/src/engine/graphics/texture/virtual/tile/compose_finger_print.d.ts +0 -9
- package/src/engine/graphics/texture/virtual/tile/compose_finger_print.d.ts.map +0 -1
- package/src/engine/graphics/texture/virtual/tile/compose_finger_print.js +0 -24
- package/src/engine/graphics/texture/virtual/tile/compose_tile_address.d.ts +0 -9
- package/src/engine/graphics/texture/virtual/tile/compose_tile_address.d.ts.map +0 -1
- package/src/engine/graphics/texture/virtual/tile/compose_tile_address.js +0 -26
- package/src/engine/graphics/texture/virtual/tile/decompose_finger_print.d.ts +0 -11
- package/src/engine/graphics/texture/virtual/tile/decompose_finger_print.d.ts.map +0 -1
- package/src/engine/graphics/texture/virtual/tile/decompose_finger_print.js +0 -12
- package/src/engine/graphics/texture/virtual/tile/finger_print_to_tile_address.d.ts +0 -7
- package/src/engine/graphics/texture/virtual/tile/finger_print_to_tile_address.d.ts.map +0 -1
- package/src/engine/graphics/texture/virtual/tile/finger_print_to_tile_address.js +0 -16
- package/src/engine/graphics/texture/virtual/tile/tile_address_to_finger_print.d.ts +0 -7
- package/src/engine/graphics/texture/virtual/tile/tile_address_to_finger_print.d.ts.map +0 -1
- package/src/engine/graphics/texture/virtual/tile/tile_address_to_finger_print.js +0 -35
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* # Capped cylinder — signed distance and its analytic gradient
|
|
3
|
+
*
|
|
4
|
+
* A cylinder about the **Y axis** of its own frame: `radius` across, `height`
|
|
5
|
+
* tall, so the flat caps sit at `±height/2`. Inigo Quilez's capped-cylinder
|
|
6
|
+
* field, written with the radial and axial distances named:
|
|
7
|
+
*
|
|
8
|
+
* s = ‖(x, z)‖
|
|
9
|
+
* dr = s − r distance outside the infinite cylinder
|
|
10
|
+
* da = |y| − h/2 distance outside the slab
|
|
11
|
+
* d = ‖max(dr, 0), max(da, 0)‖ + min(max(dr, da), 0)
|
|
12
|
+
*
|
|
13
|
+
* The gradient is the two directions the field is built from, blended by how
|
|
14
|
+
* much of each the point is outside by:
|
|
15
|
+
*
|
|
16
|
+
* û = (x, 0, z)/s the radial direction
|
|
17
|
+
* â = (0, sign(y), 0) the axial direction
|
|
18
|
+
* ∇d = (max(dr,0)·û + max(da,0)·â) / d outside
|
|
19
|
+
* ∇d = û or â, whichever of dr, da is larger inside
|
|
20
|
+
*
|
|
21
|
+
* — which is exactly right on the rim, where both terms are live and the
|
|
22
|
+
* normalised sum sweeps continuously from the side to the cap.
|
|
23
|
+
*
|
|
24
|
+
* ## The axis is degenerate, and not in the way the others are
|
|
25
|
+
*
|
|
26
|
+
* On the axis, `û` does not exist. Unlike the sphere and the capsule this is
|
|
27
|
+
* *not* covered by `sdf3_degenerate_normal.js`'s `+Y`: a long thin cylinder's
|
|
28
|
+
* nearest exit from a point on its axis is sideways, and `+Y` is the one
|
|
29
|
+
* direction that is certainly not it. The fallback here is therefore `+X` — an
|
|
30
|
+
* arbitrary radial direction, which is what the configuration actually is:
|
|
31
|
+
* every radial direction is equally near and one has to be chosen.
|
|
32
|
+
*
|
|
33
|
+
* @author Alex Goldring
|
|
34
|
+
* @copyright Company Named Limited (c) 2026
|
|
35
|
+
*/
|
|
36
|
+
/**
|
|
37
|
+
* Signed distance from a point to a capped cylinder's surface: negative inside.
|
|
38
|
+
*
|
|
39
|
+
* @param {number} x
|
|
40
|
+
* @param {number} y
|
|
41
|
+
* @param {number} z
|
|
42
|
+
* @param {number} radius
|
|
43
|
+
* @param {number} height total extent along Y
|
|
44
|
+
* @returns {number}
|
|
45
|
+
*/
|
|
46
|
+
export function sdf3_cylinder(x: number, y: number, z: number, radius: number, height: number): number;
|
|
47
|
+
/**
|
|
48
|
+
* Signed distance and the unit outward gradient, written to `out`.
|
|
49
|
+
*
|
|
50
|
+
* @param {Float32Array|Float64Array|number[]} out gradient destination
|
|
51
|
+
* @param {number} out_offset
|
|
52
|
+
* @param {number} x
|
|
53
|
+
* @param {number} y
|
|
54
|
+
* @param {number} z
|
|
55
|
+
* @param {number} radius
|
|
56
|
+
* @param {number} height
|
|
57
|
+
* @returns {number} the signed distance
|
|
58
|
+
*/
|
|
59
|
+
export function sdf3_cylinder_gradient(out: Float32Array | Float64Array | number[], out_offset: number, x: number, y: number, z: number, radius: number, height: number): number;
|
|
60
|
+
//# sourceMappingURL=sdf3_cylinder.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sdf3_cylinder.d.ts","sourceRoot":"","sources":["../../../../../../../src/core/geom/3d/shape/sdf/sdf3_cylinder.js"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AAEH;;;;;;;;;GASG;AACH,iCAPW,MAAM,KACN,MAAM,KACN,MAAM,UACN,MAAM,UACN,MAAM,GACJ,MAAM,CAYlB;AAED;;;;;;;;;;;GAWG;AACH,4CATW,YAAY,GAAC,YAAY,GAAC,MAAM,EAAE,cAClC,MAAM,KACN,MAAM,KACN,MAAM,KACN,MAAM,UACN,MAAM,UACN,MAAM,GACJ,MAAM,CAuDlB"}
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import { SDF3_EPSILON } from "./sdf3_degenerate_normal.js";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* # Capped cylinder — signed distance and its analytic gradient
|
|
5
|
+
*
|
|
6
|
+
* A cylinder about the **Y axis** of its own frame: `radius` across, `height`
|
|
7
|
+
* tall, so the flat caps sit at `±height/2`. Inigo Quilez's capped-cylinder
|
|
8
|
+
* field, written with the radial and axial distances named:
|
|
9
|
+
*
|
|
10
|
+
* s = ‖(x, z)‖
|
|
11
|
+
* dr = s − r distance outside the infinite cylinder
|
|
12
|
+
* da = |y| − h/2 distance outside the slab
|
|
13
|
+
* d = ‖max(dr, 0), max(da, 0)‖ + min(max(dr, da), 0)
|
|
14
|
+
*
|
|
15
|
+
* The gradient is the two directions the field is built from, blended by how
|
|
16
|
+
* much of each the point is outside by:
|
|
17
|
+
*
|
|
18
|
+
* û = (x, 0, z)/s the radial direction
|
|
19
|
+
* â = (0, sign(y), 0) the axial direction
|
|
20
|
+
* ∇d = (max(dr,0)·û + max(da,0)·â) / d outside
|
|
21
|
+
* ∇d = û or â, whichever of dr, da is larger inside
|
|
22
|
+
*
|
|
23
|
+
* — which is exactly right on the rim, where both terms are live and the
|
|
24
|
+
* normalised sum sweeps continuously from the side to the cap.
|
|
25
|
+
*
|
|
26
|
+
* ## The axis is degenerate, and not in the way the others are
|
|
27
|
+
*
|
|
28
|
+
* On the axis, `û` does not exist. Unlike the sphere and the capsule this is
|
|
29
|
+
* *not* covered by `sdf3_degenerate_normal.js`'s `+Y`: a long thin cylinder's
|
|
30
|
+
* nearest exit from a point on its axis is sideways, and `+Y` is the one
|
|
31
|
+
* direction that is certainly not it. The fallback here is therefore `+X` — an
|
|
32
|
+
* arbitrary radial direction, which is what the configuration actually is:
|
|
33
|
+
* every radial direction is equally near and one has to be chosen.
|
|
34
|
+
*
|
|
35
|
+
* @author Alex Goldring
|
|
36
|
+
* @copyright Company Named Limited (c) 2026
|
|
37
|
+
*/
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Signed distance from a point to a capped cylinder's surface: negative inside.
|
|
41
|
+
*
|
|
42
|
+
* @param {number} x
|
|
43
|
+
* @param {number} y
|
|
44
|
+
* @param {number} z
|
|
45
|
+
* @param {number} radius
|
|
46
|
+
* @param {number} height total extent along Y
|
|
47
|
+
* @returns {number}
|
|
48
|
+
*/
|
|
49
|
+
export function sdf3_cylinder(x, y, z, radius, height) {
|
|
50
|
+
const radial = Math.sqrt(x * x + z * z) - radius;
|
|
51
|
+
const axial = Math.abs(y) - height * 0.5;
|
|
52
|
+
|
|
53
|
+
const ext_r = radial > 0 ? radial : 0;
|
|
54
|
+
const ext_a = axial > 0 ? axial : 0;
|
|
55
|
+
|
|
56
|
+
const inner = radial > axial ? radial : axial;
|
|
57
|
+
|
|
58
|
+
return Math.sqrt(ext_r * ext_r + ext_a * ext_a) + (inner < 0 ? inner : 0);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Signed distance and the unit outward gradient, written to `out`.
|
|
63
|
+
*
|
|
64
|
+
* @param {Float32Array|Float64Array|number[]} out gradient destination
|
|
65
|
+
* @param {number} out_offset
|
|
66
|
+
* @param {number} x
|
|
67
|
+
* @param {number} y
|
|
68
|
+
* @param {number} z
|
|
69
|
+
* @param {number} radius
|
|
70
|
+
* @param {number} height
|
|
71
|
+
* @returns {number} the signed distance
|
|
72
|
+
*/
|
|
73
|
+
export function sdf3_cylinder_gradient(out, out_offset, x, y, z, radius, height) {
|
|
74
|
+
const s = Math.sqrt(x * x + z * z);
|
|
75
|
+
|
|
76
|
+
const radial = s - radius;
|
|
77
|
+
const axial = Math.abs(y) - height * 0.5;
|
|
78
|
+
|
|
79
|
+
// The radial direction, with an arbitrary one chosen on the axis.
|
|
80
|
+
let ux;
|
|
81
|
+
let uz;
|
|
82
|
+
|
|
83
|
+
if (s < SDF3_EPSILON) {
|
|
84
|
+
ux = 1;
|
|
85
|
+
uz = 0;
|
|
86
|
+
} else {
|
|
87
|
+
const inverse = 1 / s;
|
|
88
|
+
|
|
89
|
+
ux = x * inverse;
|
|
90
|
+
uz = z * inverse;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
const axis_sign = y < 0 ? -1 : 1;
|
|
94
|
+
|
|
95
|
+
const ext_r = radial > 0 ? radial : 0;
|
|
96
|
+
const ext_a = axial > 0 ? axial : 0;
|
|
97
|
+
|
|
98
|
+
const outside = Math.sqrt(ext_r * ext_r + ext_a * ext_a);
|
|
99
|
+
|
|
100
|
+
if (outside > SDF3_EPSILON) {
|
|
101
|
+
const inverse = 1 / outside;
|
|
102
|
+
|
|
103
|
+
const wr = ext_r * inverse;
|
|
104
|
+
const wa = ext_a * inverse;
|
|
105
|
+
|
|
106
|
+
out[out_offset] = ux * wr;
|
|
107
|
+
out[out_offset + 1] = axis_sign * wa;
|
|
108
|
+
out[out_offset + 2] = uz * wr;
|
|
109
|
+
|
|
110
|
+
return outside;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
if (radial >= axial) {
|
|
114
|
+
out[out_offset] = ux;
|
|
115
|
+
out[out_offset + 1] = 0;
|
|
116
|
+
out[out_offset + 2] = uz;
|
|
117
|
+
|
|
118
|
+
return radial;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
out[out_offset] = 0;
|
|
122
|
+
out[out_offset + 1] = axis_sign;
|
|
123
|
+
out[out_offset + 2] = 0;
|
|
124
|
+
|
|
125
|
+
return axial;
|
|
126
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* # The direction to leave a shape by when there is no direction
|
|
3
|
+
*
|
|
4
|
+
* Every analytic gradient in this directory has one configuration where the
|
|
5
|
+
* true gradient does not exist: the centre of a sphere, the axis of a capsule,
|
|
6
|
+
* the axis of a cylinder, the centre of a cube. `‖x‖` is not differentiable at
|
|
7
|
+
* zero, and no continuous choice fixes that — it is a property of the distance
|
|
8
|
+
* field, not of the arithmetic.
|
|
9
|
+
*
|
|
10
|
+
* A gradient of `(0, 0, 0)` is the mathematically honest answer and it is the
|
|
11
|
+
* wrong one for every caller. The consumers of these functions are pushing
|
|
12
|
+
* something *out* of the shape: a zero gradient carries no force, so a particle
|
|
13
|
+
* that reaches the exact centre of a sphere stays there for ever. "It does not
|
|
14
|
+
* get stuck" is the second design commitment of the cloth system and the first
|
|
15
|
+
* thing a zero would break, so the answer is an arbitrary unit vector rather
|
|
16
|
+
* than no vector.
|
|
17
|
+
*
|
|
18
|
+
* `+Y`, because a degenerate case wants a deterministic answer more than a
|
|
19
|
+
* clever one, and because it agrees with the axis every axis-aligned primitive
|
|
20
|
+
* in this family is already built around.
|
|
21
|
+
*
|
|
22
|
+
* {@link compute_signed_distance_gradient_by_sampling} answers these
|
|
23
|
+
* configurations differently and worse: at a sphere's centre it returns
|
|
24
|
+
* `(1,1,1)/√3`, which is unit-length, plausible-looking, and a pure artefact of
|
|
25
|
+
* sampling three positive offsets from one point. That it is *an* answer rather
|
|
26
|
+
* than obviously nothing is the reason it went unnoticed.
|
|
27
|
+
*
|
|
28
|
+
* @author Alex Goldring
|
|
29
|
+
* @copyright Company Named Limited (c) 2026
|
|
30
|
+
*/
|
|
31
|
+
/**
|
|
32
|
+
* @type {number}
|
|
33
|
+
*/
|
|
34
|
+
export const SDF3_DEGENERATE_NORMAL_X: number;
|
|
35
|
+
/**
|
|
36
|
+
* @type {number}
|
|
37
|
+
*/
|
|
38
|
+
export const SDF3_DEGENERATE_NORMAL_Y: number;
|
|
39
|
+
/**
|
|
40
|
+
* @type {number}
|
|
41
|
+
*/
|
|
42
|
+
export const SDF3_DEGENERATE_NORMAL_Z: number;
|
|
43
|
+
/**
|
|
44
|
+
* Below this a length is treated as zero. It is well above `Float32`'s own
|
|
45
|
+
* resolution over a garment-sized coordinate and well below any distance a
|
|
46
|
+
* caller can act on, which is the whole of what an epsilon here has to be.
|
|
47
|
+
* @type {number}
|
|
48
|
+
*/
|
|
49
|
+
export const SDF3_EPSILON: number;
|
|
50
|
+
//# sourceMappingURL=sdf3_degenerate_normal.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sdf3_degenerate_normal.d.ts","sourceRoot":"","sources":["../../../../../../../src/core/geom/3d/shape/sdf/sdf3_degenerate_normal.js"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEH;;GAEG;AACH,uCAFU,MAAM,CAE0B;AAE1C;;GAEG;AACH,uCAFU,MAAM,CAE0B;AAE1C;;GAEG;AACH,uCAFU,MAAM,CAE0B;AAE1C;;;;;GAKG;AACH,2BAFU,MAAM,CAEiB"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* # The direction to leave a shape by when there is no direction
|
|
3
|
+
*
|
|
4
|
+
* Every analytic gradient in this directory has one configuration where the
|
|
5
|
+
* true gradient does not exist: the centre of a sphere, the axis of a capsule,
|
|
6
|
+
* the axis of a cylinder, the centre of a cube. `‖x‖` is not differentiable at
|
|
7
|
+
* zero, and no continuous choice fixes that — it is a property of the distance
|
|
8
|
+
* field, not of the arithmetic.
|
|
9
|
+
*
|
|
10
|
+
* A gradient of `(0, 0, 0)` is the mathematically honest answer and it is the
|
|
11
|
+
* wrong one for every caller. The consumers of these functions are pushing
|
|
12
|
+
* something *out* of the shape: a zero gradient carries no force, so a particle
|
|
13
|
+
* that reaches the exact centre of a sphere stays there for ever. "It does not
|
|
14
|
+
* get stuck" is the second design commitment of the cloth system and the first
|
|
15
|
+
* thing a zero would break, so the answer is an arbitrary unit vector rather
|
|
16
|
+
* than no vector.
|
|
17
|
+
*
|
|
18
|
+
* `+Y`, because a degenerate case wants a deterministic answer more than a
|
|
19
|
+
* clever one, and because it agrees with the axis every axis-aligned primitive
|
|
20
|
+
* in this family is already built around.
|
|
21
|
+
*
|
|
22
|
+
* {@link compute_signed_distance_gradient_by_sampling} answers these
|
|
23
|
+
* configurations differently and worse: at a sphere's centre it returns
|
|
24
|
+
* `(1,1,1)/√3`, which is unit-length, plausible-looking, and a pure artefact of
|
|
25
|
+
* sampling three positive offsets from one point. That it is *an* answer rather
|
|
26
|
+
* than obviously nothing is the reason it went unnoticed.
|
|
27
|
+
*
|
|
28
|
+
* @author Alex Goldring
|
|
29
|
+
* @copyright Company Named Limited (c) 2026
|
|
30
|
+
*/
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* @type {number}
|
|
34
|
+
*/
|
|
35
|
+
export const SDF3_DEGENERATE_NORMAL_X = 0;
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* @type {number}
|
|
39
|
+
*/
|
|
40
|
+
export const SDF3_DEGENERATE_NORMAL_Y = 1;
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* @type {number}
|
|
44
|
+
*/
|
|
45
|
+
export const SDF3_DEGENERATE_NORMAL_Z = 0;
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Below this a length is treated as zero. It is well above `Float32`'s own
|
|
49
|
+
* resolution over a garment-sized coordinate and well below any distance a
|
|
50
|
+
* caller can act on, which is the whole of what an epsilon here has to be.
|
|
51
|
+
* @type {number}
|
|
52
|
+
*/
|
|
53
|
+
export const SDF3_EPSILON = 1e-9;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* # Half-space — signed distance and its analytic gradient
|
|
3
|
+
*
|
|
4
|
+
* The solid is `{ p : n·p − offset ≤ 0 }`, so `n` points **out** of the
|
|
5
|
+
* material and `offset` is how far along `n` the boundary plane sits from the
|
|
6
|
+
* origin.
|
|
7
|
+
*
|
|
8
|
+
* d(x) = n·x − offset
|
|
9
|
+
* ∇d(x) = n
|
|
10
|
+
*
|
|
11
|
+
* The only field in this family with no degenerate configuration anywhere and a
|
|
12
|
+
* gradient that is constant, which is why it is also the cheapest thing a
|
|
13
|
+
* simulation can collide against and the reason it is worth having as a shape
|
|
14
|
+
* rather than approximating with a very large box.
|
|
15
|
+
*
|
|
16
|
+
* PRECONDITION: `n` is unit length. A caller with an unnormalised normal has a
|
|
17
|
+
* scaled field rather than a distance field, and every consumer of a signed
|
|
18
|
+
* *distance* would then be wrong by that scale rather than merely imprecise.
|
|
19
|
+
*
|
|
20
|
+
* @author Alex Goldring
|
|
21
|
+
* @copyright Company Named Limited (c) 2026
|
|
22
|
+
*/
|
|
23
|
+
/**
|
|
24
|
+
* Signed distance from a point to the boundary plane: negative inside the
|
|
25
|
+
* solid half-space.
|
|
26
|
+
*
|
|
27
|
+
* @param {number} x
|
|
28
|
+
* @param {number} y
|
|
29
|
+
* @param {number} z
|
|
30
|
+
* @param {number} normal_x unit
|
|
31
|
+
* @param {number} normal_y unit
|
|
32
|
+
* @param {number} normal_z unit
|
|
33
|
+
* @param {number} offset
|
|
34
|
+
* @returns {number}
|
|
35
|
+
*/
|
|
36
|
+
export function sdf3_plane(x: number, y: number, z: number, normal_x: number, normal_y: number, normal_z: number, offset: number): number;
|
|
37
|
+
/**
|
|
38
|
+
* Signed distance and the unit outward gradient, written to `out`.
|
|
39
|
+
*
|
|
40
|
+
* @param {Float32Array|Float64Array|number[]} out gradient destination
|
|
41
|
+
* @param {number} out_offset
|
|
42
|
+
* @param {number} x
|
|
43
|
+
* @param {number} y
|
|
44
|
+
* @param {number} z
|
|
45
|
+
* @param {number} normal_x unit
|
|
46
|
+
* @param {number} normal_y unit
|
|
47
|
+
* @param {number} normal_z unit
|
|
48
|
+
* @param {number} offset
|
|
49
|
+
* @returns {number} the signed distance
|
|
50
|
+
*/
|
|
51
|
+
export function sdf3_plane_gradient(out: Float32Array | Float64Array | number[], out_offset: number, x: number, y: number, z: number, normal_x: number, normal_y: number, normal_z: number, offset: number): number;
|
|
52
|
+
//# sourceMappingURL=sdf3_plane.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sdf3_plane.d.ts","sourceRoot":"","sources":["../../../../../../../src/core/geom/3d/shape/sdf/sdf3_plane.js"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH;;;;;;;;;;;;GAYG;AACH,8BATW,MAAM,KACN,MAAM,KACN,MAAM,YACN,MAAM,YACN,MAAM,YACN,MAAM,UACN,MAAM,GACJ,MAAM,CAIlB;AAED;;;;;;;;;;;;;GAaG;AACH,yCAXW,YAAY,GAAC,YAAY,GAAC,MAAM,EAAE,cAClC,MAAM,KACN,MAAM,KACN,MAAM,KACN,MAAM,YACN,MAAM,YACN,MAAM,YACN,MAAM,UACN,MAAM,GACJ,MAAM,CAQlB"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* # Half-space — signed distance and its analytic gradient
|
|
3
|
+
*
|
|
4
|
+
* The solid is `{ p : n·p − offset ≤ 0 }`, so `n` points **out** of the
|
|
5
|
+
* material and `offset` is how far along `n` the boundary plane sits from the
|
|
6
|
+
* origin.
|
|
7
|
+
*
|
|
8
|
+
* d(x) = n·x − offset
|
|
9
|
+
* ∇d(x) = n
|
|
10
|
+
*
|
|
11
|
+
* The only field in this family with no degenerate configuration anywhere and a
|
|
12
|
+
* gradient that is constant, which is why it is also the cheapest thing a
|
|
13
|
+
* simulation can collide against and the reason it is worth having as a shape
|
|
14
|
+
* rather than approximating with a very large box.
|
|
15
|
+
*
|
|
16
|
+
* PRECONDITION: `n` is unit length. A caller with an unnormalised normal has a
|
|
17
|
+
* scaled field rather than a distance field, and every consumer of a signed
|
|
18
|
+
* *distance* would then be wrong by that scale rather than merely imprecise.
|
|
19
|
+
*
|
|
20
|
+
* @author Alex Goldring
|
|
21
|
+
* @copyright Company Named Limited (c) 2026
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Signed distance from a point to the boundary plane: negative inside the
|
|
26
|
+
* solid half-space.
|
|
27
|
+
*
|
|
28
|
+
* @param {number} x
|
|
29
|
+
* @param {number} y
|
|
30
|
+
* @param {number} z
|
|
31
|
+
* @param {number} normal_x unit
|
|
32
|
+
* @param {number} normal_y unit
|
|
33
|
+
* @param {number} normal_z unit
|
|
34
|
+
* @param {number} offset
|
|
35
|
+
* @returns {number}
|
|
36
|
+
*/
|
|
37
|
+
export function sdf3_plane(x, y, z, normal_x, normal_y, normal_z, offset) {
|
|
38
|
+
return x * normal_x + y * normal_y + z * normal_z - offset;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Signed distance and the unit outward gradient, written to `out`.
|
|
43
|
+
*
|
|
44
|
+
* @param {Float32Array|Float64Array|number[]} out gradient destination
|
|
45
|
+
* @param {number} out_offset
|
|
46
|
+
* @param {number} x
|
|
47
|
+
* @param {number} y
|
|
48
|
+
* @param {number} z
|
|
49
|
+
* @param {number} normal_x unit
|
|
50
|
+
* @param {number} normal_y unit
|
|
51
|
+
* @param {number} normal_z unit
|
|
52
|
+
* @param {number} offset
|
|
53
|
+
* @returns {number} the signed distance
|
|
54
|
+
*/
|
|
55
|
+
export function sdf3_plane_gradient(out, out_offset, x, y, z, normal_x, normal_y, normal_z, offset) {
|
|
56
|
+
out[out_offset] = normal_x;
|
|
57
|
+
out[out_offset + 1] = normal_y;
|
|
58
|
+
out[out_offset + 2] = normal_z;
|
|
59
|
+
|
|
60
|
+
return x * normal_x + y * normal_y + z * normal_z - offset;
|
|
61
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* # Sphere — signed distance and its analytic gradient
|
|
3
|
+
*
|
|
4
|
+
* A sphere of `radius` centred at the origin of its own frame.
|
|
5
|
+
*
|
|
6
|
+
* d(x) = ‖x‖ − r
|
|
7
|
+
* ∇d(x) = x/‖x‖
|
|
8
|
+
*
|
|
9
|
+
* Free functions over scalars rather than methods on {@link SphereShape3D},
|
|
10
|
+
* because the caller that needs them most has no shape object: cloth evaluates
|
|
11
|
+
* a collider SDF per particle per iteration against a packed record in a typed
|
|
12
|
+
* array (§8.2), and constructing a shape to ask it a question would cost more
|
|
13
|
+
* than the question. {@link SphereShape3D} calls these too, so there is one
|
|
14
|
+
* implementation of the arithmetic rather than two that can drift.
|
|
15
|
+
*
|
|
16
|
+
* @author Alex Goldring
|
|
17
|
+
* @copyright Company Named Limited (c) 2026
|
|
18
|
+
*/
|
|
19
|
+
/**
|
|
20
|
+
* Signed distance from a point to a sphere's surface: negative inside.
|
|
21
|
+
*
|
|
22
|
+
* @param {number} x
|
|
23
|
+
* @param {number} y
|
|
24
|
+
* @param {number} z
|
|
25
|
+
* @param {number} radius
|
|
26
|
+
* @returns {number}
|
|
27
|
+
*/
|
|
28
|
+
export function sdf3_sphere(x: number, y: number, z: number, radius: number): number;
|
|
29
|
+
/**
|
|
30
|
+
* Signed distance and the unit outward gradient, written to `out`.
|
|
31
|
+
*
|
|
32
|
+
* @param {Float32Array|Float64Array|number[]} out gradient destination
|
|
33
|
+
* @param {number} out_offset
|
|
34
|
+
* @param {number} x
|
|
35
|
+
* @param {number} y
|
|
36
|
+
* @param {number} z
|
|
37
|
+
* @param {number} radius
|
|
38
|
+
* @returns {number} the signed distance
|
|
39
|
+
*/
|
|
40
|
+
export function sdf3_sphere_gradient(out: Float32Array | Float64Array | number[], out_offset: number, x: number, y: number, z: number, radius: number): number;
|
|
41
|
+
//# sourceMappingURL=sdf3_sphere.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sdf3_sphere.d.ts","sourceRoot":"","sources":["../../../../../../../src/core/geom/3d/shape/sdf/sdf3_sphere.js"],"names":[],"mappings":"AAOA;;;;;;;;;;;;;;;;;GAiBG;AAEH;;;;;;;;GAQG;AACH,+BANW,MAAM,KACN,MAAM,KACN,MAAM,UACN,MAAM,GACJ,MAAM,CAIlB;AAED;;;;;;;;;;GAUG;AACH,0CARW,YAAY,GAAC,YAAY,GAAC,MAAM,EAAE,cAClC,MAAM,KACN,MAAM,KACN,MAAM,KACN,MAAM,UACN,MAAM,GACJ,MAAM,CAsBlB"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import {
|
|
2
|
+
SDF3_DEGENERATE_NORMAL_X,
|
|
3
|
+
SDF3_DEGENERATE_NORMAL_Y,
|
|
4
|
+
SDF3_DEGENERATE_NORMAL_Z,
|
|
5
|
+
SDF3_EPSILON
|
|
6
|
+
} from "./sdf3_degenerate_normal.js";
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* # Sphere — signed distance and its analytic gradient
|
|
10
|
+
*
|
|
11
|
+
* A sphere of `radius` centred at the origin of its own frame.
|
|
12
|
+
*
|
|
13
|
+
* d(x) = ‖x‖ − r
|
|
14
|
+
* ∇d(x) = x/‖x‖
|
|
15
|
+
*
|
|
16
|
+
* Free functions over scalars rather than methods on {@link SphereShape3D},
|
|
17
|
+
* because the caller that needs them most has no shape object: cloth evaluates
|
|
18
|
+
* a collider SDF per particle per iteration against a packed record in a typed
|
|
19
|
+
* array (§8.2), and constructing a shape to ask it a question would cost more
|
|
20
|
+
* than the question. {@link SphereShape3D} calls these too, so there is one
|
|
21
|
+
* implementation of the arithmetic rather than two that can drift.
|
|
22
|
+
*
|
|
23
|
+
* @author Alex Goldring
|
|
24
|
+
* @copyright Company Named Limited (c) 2026
|
|
25
|
+
*/
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Signed distance from a point to a sphere's surface: negative inside.
|
|
29
|
+
*
|
|
30
|
+
* @param {number} x
|
|
31
|
+
* @param {number} y
|
|
32
|
+
* @param {number} z
|
|
33
|
+
* @param {number} radius
|
|
34
|
+
* @returns {number}
|
|
35
|
+
*/
|
|
36
|
+
export function sdf3_sphere(x, y, z, radius) {
|
|
37
|
+
return Math.sqrt(x * x + y * y + z * z) - radius;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Signed distance and the unit outward gradient, written to `out`.
|
|
42
|
+
*
|
|
43
|
+
* @param {Float32Array|Float64Array|number[]} out gradient destination
|
|
44
|
+
* @param {number} out_offset
|
|
45
|
+
* @param {number} x
|
|
46
|
+
* @param {number} y
|
|
47
|
+
* @param {number} z
|
|
48
|
+
* @param {number} radius
|
|
49
|
+
* @returns {number} the signed distance
|
|
50
|
+
*/
|
|
51
|
+
export function sdf3_sphere_gradient(out, out_offset, x, y, z, radius) {
|
|
52
|
+
const length = Math.sqrt(x * x + y * y + z * z);
|
|
53
|
+
|
|
54
|
+
if (length < SDF3_EPSILON) {
|
|
55
|
+
// The centre. See `sdf3_degenerate_normal.js` for why this is a
|
|
56
|
+
// direction rather than nothing.
|
|
57
|
+
out[out_offset] = SDF3_DEGENERATE_NORMAL_X;
|
|
58
|
+
out[out_offset + 1] = SDF3_DEGENERATE_NORMAL_Y;
|
|
59
|
+
out[out_offset + 2] = SDF3_DEGENERATE_NORMAL_Z;
|
|
60
|
+
|
|
61
|
+
return -radius;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
const inverse = 1 / length;
|
|
65
|
+
|
|
66
|
+
out[out_offset] = x * inverse;
|
|
67
|
+
out[out_offset + 1] = y * inverse;
|
|
68
|
+
out[out_offset + 2] = z * inverse;
|
|
69
|
+
|
|
70
|
+
return length - radius;
|
|
71
|
+
}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Runs at most {@link max_concurrent} tasks at a time, highest priority first across everything
|
|
3
|
+
* submitted to it.
|
|
4
|
+
*
|
|
5
|
+
* The point of putting one of these between a caller and its work is almost never the cap on its
|
|
6
|
+
* own — a caller can count its own in-flight requests. It is that **one** gate shared by several
|
|
7
|
+
* callers orders their work against each other. Per-caller caps do not compose: the number a
|
|
8
|
+
* browser, a CDN or a disk cares about is the total, and a caller that knows about one file cannot
|
|
9
|
+
* see it. Neither can a per-caller queue say that the second caller's request matters more than the
|
|
10
|
+
* first caller's, however truthfully their priorities compare.
|
|
11
|
+
*
|
|
12
|
+
* Ties are broken arbitrarily. Two tasks submitted at the same priority are, by the only measure the
|
|
13
|
+
* gate has, equally worth running.
|
|
14
|
+
*
|
|
15
|
+
* Nothing here is a new idea in this engine, which is why it ended up here rather than inside any
|
|
16
|
+
* one of its callers. `AssetManager` has capped concurrent top-level loads on `load_concurrency` for the
|
|
17
|
+
* same stated reason — keeping network slots free for higher-priority requests — and orders its
|
|
18
|
+
* pending queue through `get_pending_asset_priority_score`, which negates the priority for exactly
|
|
19
|
+
* the reason this heap does: `BinaryHeap` pops the lowest score first. `VirtualTextureManager` caps
|
|
20
|
+
* `max_concurrent_loads` against `#loads_in_flight`. When the virtual-geometry residency layer
|
|
21
|
+
* wanted the cap a third time and wrote that same negation a second time, it stopped being a detail
|
|
22
|
+
* of any one caller. The other two keep their own queues anyway, deliberately, and each says why
|
|
23
|
+
* where its cap is declared; the three paragraphs below are those reasons.
|
|
24
|
+
*
|
|
25
|
+
* **Priority is read once, at {@link submit}.** A gate keyed on a number captured at submission is
|
|
26
|
+
* the wrong shape for work whose importance moves while it waits, or whose priorities were never on
|
|
27
|
+
* a common scale: `AssetRequestScope.final_priority` is a richer model than a bare number, but it
|
|
28
|
+
* propagates hierarchically from an asset's requesting scopes and so compares only inside one
|
|
29
|
+
* hierarchy. For either, keep a queue over live records and re-score it (see below).
|
|
30
|
+
*
|
|
31
|
+
* **A task must not wait on another submission to the same gate.** The parent holds a slot while the
|
|
32
|
+
* child waits for one, so at a full gate that is a deadlock, and the gate cannot detect it: it sees
|
|
33
|
+
* a task that has not settled. Work that nests needs the parent's slot to cover the child, which
|
|
34
|
+
* means dispatching the child over the cap — `AssetManager` does exactly that for the requests its
|
|
35
|
+
* loaders make while servicing a load, and keeps its own queue for it.
|
|
36
|
+
*
|
|
37
|
+
* **What it deliberately is not.** There is no cancellation, and no way to drop or re-order a
|
|
38
|
+
* submission once it is made: a queued entry holds a closure and the gate will eventually run it.
|
|
39
|
+
* A caller that wants to *discard* pending work — because the page stopped being on screen, or a
|
|
40
|
+
* coarser mip arrived instead — wants a queue of live records it can filter, drained on its own
|
|
41
|
+
* clock, not a gate that owns closures. `VirtualTextureManager` drops queued requests untouched for
|
|
42
|
+
* `queue_stale_window` frames; it is that second thing, and no worse for it.
|
|
43
|
+
*
|
|
44
|
+
* Nothing bounds how long a low-priority submission waits. A caller that keeps feeding the gate
|
|
45
|
+
* higher-priority work will starve it indefinitely, which is what a priority queue means and is
|
|
46
|
+
* fine for the admission gates named above — where a dropped want is re-derived next frame — and not
|
|
47
|
+
* fine for work that has to finish eventually.
|
|
48
|
+
*
|
|
49
|
+
* @author Alex Goldring
|
|
50
|
+
* @copyright Company Named Limited (c) 2026
|
|
51
|
+
*/
|
|
52
|
+
export class ConcurrencyGate {
|
|
53
|
+
/**
|
|
54
|
+
* @param {number} max_concurrent how many tasks may be running at once
|
|
55
|
+
*/
|
|
56
|
+
constructor(max_concurrent: number);
|
|
57
|
+
/**
|
|
58
|
+
* Raising this starts whatever was already waiting. Lowering it starts nothing and stops
|
|
59
|
+
* nothing — tasks already running are left to finish, and the gate admits again once they have
|
|
60
|
+
* drained below the new value.
|
|
61
|
+
*
|
|
62
|
+
* @param {number} value
|
|
63
|
+
*/
|
|
64
|
+
set max_concurrent(value: number);
|
|
65
|
+
/**
|
|
66
|
+
* @returns {number}
|
|
67
|
+
*/
|
|
68
|
+
get max_concurrent(): number;
|
|
69
|
+
/**
|
|
70
|
+
* @returns {number}
|
|
71
|
+
*/
|
|
72
|
+
get in_flight(): number;
|
|
73
|
+
/**
|
|
74
|
+
* @returns {number}
|
|
75
|
+
*/
|
|
76
|
+
get queued(): number;
|
|
77
|
+
/**
|
|
78
|
+
* How many tasks this gate has started. Telemetry.
|
|
79
|
+
* @returns {number}
|
|
80
|
+
*/
|
|
81
|
+
get admitted(): number;
|
|
82
|
+
/**
|
|
83
|
+
* The most that were ever in flight at once — which should never exceed the cap that was in
|
|
84
|
+
* force when they started, and is here so that a test can say so rather than assume it.
|
|
85
|
+
* @returns {number}
|
|
86
|
+
*/
|
|
87
|
+
get peak_in_flight(): number;
|
|
88
|
+
/**
|
|
89
|
+
* Run a task when there is room, highest priority first.
|
|
90
|
+
*
|
|
91
|
+
* The task is never invoked synchronously, even when the gate is empty: it runs from a
|
|
92
|
+
* microtask, so a task that throws on its first line is a rejected promise here rather than an
|
|
93
|
+
* exception thrown back at whoever called {@link submit}.
|
|
94
|
+
*
|
|
95
|
+
* @template T
|
|
96
|
+
* @param {number} priority higher runs sooner
|
|
97
|
+
* @param {function(): Promise<T>} task
|
|
98
|
+
* @returns {Promise<T>} whatever the task settled to, once it ran
|
|
99
|
+
*/
|
|
100
|
+
submit<T>(priority: number, task: () => Promise<T>): Promise<T>;
|
|
101
|
+
#private;
|
|
102
|
+
}
|
|
103
|
+
//# sourceMappingURL=ConcurrencyGate.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ConcurrencyGate.d.ts","sourceRoot":"","sources":["../../../../src/core/process/ConcurrencyGate.js"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkDG;AACH;IA2BI;;OAEG;IACH,4BAFW,MAAM,EAMhB;IASD;;;;;;OAMG;IACH,kCAMC;IApBD;;OAEG;IACH,6BAEC;IAiBD;;OAEG;IACH,wBAEC;IAED;;OAEG;IACH,qBAEC;IAED;;;OAGG;IACH,uBAEC;IAED;;;;OAIG;IACH,6BAEC;IAED;;;;;;;;;;;OAWG;IACH,oBAJW,MAAM,sCAahB;;CA0CJ"}
|