@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
|
@@ -1,264 +0,0 @@
|
|
|
1
|
-
import { assert } from "../../../../core/assert.js";
|
|
2
|
-
import { array_remove_first } from "../../../../core/collection/array/array_remove_first.js";
|
|
3
|
-
import { array_sort_quick } from "../../../../core/collection/array/array_sort_quick.js";
|
|
4
|
-
import Signal from "../../../../core/events/signal/Signal.js";
|
|
5
|
-
import { AssetManager } from "../../../asset/AssetManager.js";
|
|
6
|
-
import { GameAssetType } from "../../../asset/GameAssetType.js";
|
|
7
|
-
import { Sampler2D } from "../sampler/Sampler2D.js";
|
|
8
|
-
import { sampler2d_to_uint8_RGBA } from "../sampler/sampler2d_to_uint8_RGBA.js";
|
|
9
|
-
import { compose_finger_print } from "./tile/compose_finger_print.js";
|
|
10
|
-
import { decompose_finger_print } from "./tile/decompose_finger_print.js";
|
|
11
|
-
import { VirtualTextureTile } from "./tile/VirtualTextureTile.js";
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* Facilitates prioritized queueing and loading of individual texture tiles
|
|
15
|
-
*/
|
|
16
|
-
export class VirtualTextureTileLoader {
|
|
17
|
-
/**
|
|
18
|
-
* Where the tiles are stored
|
|
19
|
-
* @type {string}
|
|
20
|
-
*/
|
|
21
|
-
#root_path = "";
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* Lets user specify a custom file name template
|
|
25
|
-
* @type {(mip: number, x: number, y: number) => string}
|
|
26
|
-
*/
|
|
27
|
-
#file_name_builder = (mip, x, y) => {
|
|
28
|
-
|
|
29
|
-
assert.isNonNegativeInteger(mip, 'mip');
|
|
30
|
-
assert.isNonNegativeInteger(x, 'x');
|
|
31
|
-
assert.isNonNegativeInteger(y, 'y');
|
|
32
|
-
|
|
33
|
-
return `${mip}-${x}-${y}.png`;
|
|
34
|
-
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
*
|
|
39
|
-
* @return {function(number, number, number): string}
|
|
40
|
-
*/
|
|
41
|
-
get file_name_builder() {
|
|
42
|
-
return this.#file_name_builder;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
/**
|
|
46
|
-
*
|
|
47
|
-
* @param {(mip: number, x: number, y: number) => string} builder
|
|
48
|
-
*/
|
|
49
|
-
set file_name_builder(builder) {
|
|
50
|
-
assert.isFunction(builder, 'builder');
|
|
51
|
-
|
|
52
|
-
this.#file_name_builder = builder;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
set path(v) {
|
|
56
|
-
this.#root_path = v;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
/**
|
|
60
|
-
* When queue gets larger than this, we start discarding elements
|
|
61
|
-
* @type {number}
|
|
62
|
-
*/
|
|
63
|
-
queue_limit = Infinity;
|
|
64
|
-
|
|
65
|
-
/**
|
|
66
|
-
*
|
|
67
|
-
* @type {AssetManager}
|
|
68
|
-
*/
|
|
69
|
-
#asset_manager = null;
|
|
70
|
-
|
|
71
|
-
set asset_manager(v) {
|
|
72
|
-
this.#asset_manager = v;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
/**
|
|
76
|
-
* How many tiles can be loaded at the same time
|
|
77
|
-
* @type {number}
|
|
78
|
-
*/
|
|
79
|
-
#concurrency = 4;
|
|
80
|
-
|
|
81
|
-
/**
|
|
82
|
-
* Tiles that are currently being loaded
|
|
83
|
-
* @readonly
|
|
84
|
-
* @type {number[]}
|
|
85
|
-
*/
|
|
86
|
-
#in_flight = [];
|
|
87
|
-
|
|
88
|
-
/**
|
|
89
|
-
* Contains fingerprints
|
|
90
|
-
* @readonly
|
|
91
|
-
* @type {number[]}
|
|
92
|
-
*/
|
|
93
|
-
#queue = [];
|
|
94
|
-
|
|
95
|
-
/**
|
|
96
|
-
* @readonly
|
|
97
|
-
*/
|
|
98
|
-
on = {
|
|
99
|
-
/**
|
|
100
|
-
* @type {Signal<VirtualTextureTile>}
|
|
101
|
-
*/
|
|
102
|
-
loaded: new Signal()
|
|
103
|
-
};
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
/**
|
|
107
|
-
*
|
|
108
|
-
* @param {number} fingerprint
|
|
109
|
-
* @returns {boolean}
|
|
110
|
-
*/
|
|
111
|
-
#queue_remove(fingerprint) {
|
|
112
|
-
assert.isNonNegativeInteger(fingerprint, 'fingerprint');
|
|
113
|
-
|
|
114
|
-
const i = this.#queue.indexOf(fingerprint);
|
|
115
|
-
|
|
116
|
-
if (i === -1) {
|
|
117
|
-
return false;
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
this.#queue.splice(i, 1);
|
|
121
|
-
|
|
122
|
-
return true;
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
#queue_add(fingerprint) {
|
|
126
|
-
assert.isNonNegativeInteger(fingerprint, 'fingerprint');
|
|
127
|
-
|
|
128
|
-
if (this.is_queued(fingerprint)) {
|
|
129
|
-
return false;
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
this.#queue.push(fingerprint);
|
|
133
|
-
|
|
134
|
-
return true;
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
/**
|
|
138
|
-
*
|
|
139
|
-
* @param {number} fingerprint
|
|
140
|
-
*/
|
|
141
|
-
enqueue(fingerprint) {
|
|
142
|
-
if (this.#in_flight.indexOf(fingerprint) !== -1) {
|
|
143
|
-
return false;
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
if (this.#queue_add(fingerprint) === false) {
|
|
147
|
-
return false;
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
this.#prod();
|
|
151
|
-
|
|
152
|
-
return true;
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
/**
|
|
156
|
-
*
|
|
157
|
-
* @param {number} fingerprint
|
|
158
|
-
* @returns {boolean}
|
|
159
|
-
*/
|
|
160
|
-
is_queued(fingerprint) {
|
|
161
|
-
assert.isNonNegativeInteger(fingerprint, 'fingerprint');
|
|
162
|
-
|
|
163
|
-
return this.#queue.indexOf(fingerprint) !== -1;
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
/**
|
|
167
|
-
*
|
|
168
|
-
* @param {VirtualTextureUsage} usage
|
|
169
|
-
*/
|
|
170
|
-
#sort_queue_by_usage(usage) {
|
|
171
|
-
|
|
172
|
-
/**
|
|
173
|
-
*
|
|
174
|
-
* @param {number} fingerprint
|
|
175
|
-
*/
|
|
176
|
-
const score = (fingerprint) => -usage.getCountByFingerprint(fingerprint);
|
|
177
|
-
|
|
178
|
-
array_sort_quick(
|
|
179
|
-
this.#queue,
|
|
180
|
-
score, null,
|
|
181
|
-
0, this.#queue.length - 1
|
|
182
|
-
);
|
|
183
|
-
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
/**
|
|
187
|
-
*
|
|
188
|
-
* @param {VirtualTextureUsage} usage
|
|
189
|
-
*/
|
|
190
|
-
update_usage(usage) {
|
|
191
|
-
this.#sort_queue_by_usage(usage);
|
|
192
|
-
|
|
193
|
-
// truncate the queue if necessary
|
|
194
|
-
const queue_overflow = this.#queue.length - this.queue_limit;
|
|
195
|
-
|
|
196
|
-
if (queue_overflow > 0) {
|
|
197
|
-
this.#queue.splice(this.queue_limit, queue_overflow);
|
|
198
|
-
}
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
/**
|
|
202
|
-
* Initializes load of the next element in the queue if there is capacity
|
|
203
|
-
*/
|
|
204
|
-
#prod() {
|
|
205
|
-
while (this.#in_flight.length < this.#concurrency && this.#queue.length > 0) {
|
|
206
|
-
const fingerprint = this.#queue[0];
|
|
207
|
-
const { mip, x, y } = decompose_finger_print(fingerprint);
|
|
208
|
-
|
|
209
|
-
this.#load(mip, x, y);
|
|
210
|
-
}
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
/**
|
|
214
|
-
*
|
|
215
|
-
* @param {number} mip
|
|
216
|
-
* @param {number} x
|
|
217
|
-
* @param {number} y
|
|
218
|
-
* @returns {Promise<VirtualTextureTile>}
|
|
219
|
-
*/
|
|
220
|
-
#load(mip, x, y) {
|
|
221
|
-
const file_name = this.#file_name_builder(mip, x, y);
|
|
222
|
-
|
|
223
|
-
assert.isString(file_name, 'file_name');
|
|
224
|
-
|
|
225
|
-
const finger_print = compose_finger_print(mip, x, y);
|
|
226
|
-
|
|
227
|
-
this.#queue_remove(finger_print);
|
|
228
|
-
this.#in_flight.push(finger_print);
|
|
229
|
-
|
|
230
|
-
return this.#asset_manager.promise(`${this.#root_path}/${file_name}`, GameAssetType.Image)
|
|
231
|
-
.then(asset => {
|
|
232
|
-
|
|
233
|
-
const sampler = asset.create();
|
|
234
|
-
|
|
235
|
-
const tile = new VirtualTextureTile();
|
|
236
|
-
|
|
237
|
-
let rgba = sampler;
|
|
238
|
-
|
|
239
|
-
if (rgba.itemSize !== 4) {
|
|
240
|
-
rgba = Sampler2D.uint8(4, sampler.width, sampler.height);
|
|
241
|
-
|
|
242
|
-
sampler2d_to_uint8_RGBA(rgba, sampler);
|
|
243
|
-
}
|
|
244
|
-
|
|
245
|
-
tile.data = rgba;
|
|
246
|
-
tile.finger_print = finger_print;
|
|
247
|
-
|
|
248
|
-
this.on.loaded.send1(tile);
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
return tile;
|
|
252
|
-
}, (reason) => {
|
|
253
|
-
console.error(`Failed to load tile ${file_name}, reason:${reason}`);
|
|
254
|
-
})
|
|
255
|
-
.finally(() => {
|
|
256
|
-
|
|
257
|
-
array_remove_first(this.#in_flight,finger_print);
|
|
258
|
-
|
|
259
|
-
this.#prod();
|
|
260
|
-
|
|
261
|
-
})
|
|
262
|
-
|
|
263
|
-
}
|
|
264
|
-
}
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
export class VirtualTextureUsage {
|
|
2
|
-
get counts(): Uint32Array;
|
|
3
|
-
set max_mip_level(v: number);
|
|
4
|
-
get max_mip_level(): number;
|
|
5
|
-
/**
|
|
6
|
-
*
|
|
7
|
-
* @return {Uint32Array}
|
|
8
|
-
*/
|
|
9
|
-
get occupancy(): Uint32Array;
|
|
10
|
-
/**
|
|
11
|
-
*
|
|
12
|
-
* @return {number}
|
|
13
|
-
*/
|
|
14
|
-
get occupancy_count(): number;
|
|
15
|
-
/**
|
|
16
|
-
*
|
|
17
|
-
* @param {number} fingerprint
|
|
18
|
-
* @returns {number}
|
|
19
|
-
*/
|
|
20
|
-
getCountByFingerprint(fingerprint: number): number;
|
|
21
|
-
/**
|
|
22
|
-
*
|
|
23
|
-
* @param {number} mip
|
|
24
|
-
* @param {number} x
|
|
25
|
-
* @param {number} y
|
|
26
|
-
* @returns {number}
|
|
27
|
-
*/
|
|
28
|
-
getCountBy(mip: number, x: number, y: number): number;
|
|
29
|
-
clear(): void;
|
|
30
|
-
/**
|
|
31
|
-
* Given existing usage, award same usage to all tiles up the chain all the way to the root
|
|
32
|
-
* This helps avoid popping and ensures that when there's not enough space - at least the higher level LOD tiles are available
|
|
33
|
-
* @param {number} bias added to the ancestor tiles to make them more likely to be loaded
|
|
34
|
-
*/
|
|
35
|
-
promoteAncestors(bias?: number): void;
|
|
36
|
-
sortOccupancyByLOD(): void;
|
|
37
|
-
/**
|
|
38
|
-
*
|
|
39
|
-
* @param {Uint8Array} data usage texture data
|
|
40
|
-
*/
|
|
41
|
-
fromTexture(data: Uint8Array): void;
|
|
42
|
-
#private;
|
|
43
|
-
}
|
|
44
|
-
//# sourceMappingURL=VirtualTextureUsage.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"VirtualTextureUsage.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/graphics/texture/virtual/VirtualTextureUsage.js"],"names":[],"mappings":"AAMA;IAcI,0BAEC;IAKD,6BAIC;IAED,4BAEC;IAED;;;OAGG;IACH,6BAEC;IAED;;;OAGG;IACH,8BAEC;IAkBD;;;;OAIG;IACH,mCAHW,MAAM,GACJ,MAAM,CAMlB;IAED;;;;;;OAMG;IACH,gBALW,MAAM,KACN,MAAM,KACN,MAAM,GACJ,MAAM,CAMlB;IAED,cAGC;IAED;;;;OAIG;IACH,wBAFW,MAAM,QAsChB;IAWD,2BAiCC;IAGD;;;OAGG;IACH,kBAFW,UAAU,QAsCpB;;CACJ"}
|
|
@@ -1,228 +0,0 @@
|
|
|
1
|
-
import { array_quick_sort_by_comparator } from "../../../../core/collection/array/array_quick_sort_by_comparator.js";
|
|
2
|
-
import { compose_tile_address } from "./tile/compose_tile_address.js";
|
|
3
|
-
import { finger_print_to_tile_address } from "./tile/finger_print_to_tile_address.js";
|
|
4
|
-
import { tile_address_to_finger_print } from "./tile/tile_address_to_finger_print.js";
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
export class VirtualTextureUsage {
|
|
8
|
-
|
|
9
|
-
#counts_intrinsic = new Uint32Array(0);
|
|
10
|
-
/**
|
|
11
|
-
* Stores indices of tiles with usage > 0
|
|
12
|
-
* @type {Uint32Array}
|
|
13
|
-
*/
|
|
14
|
-
#occupancy = new Uint32Array(0);
|
|
15
|
-
/**
|
|
16
|
-
* Points at the end of the occupancy list
|
|
17
|
-
* @type {number}
|
|
18
|
-
*/
|
|
19
|
-
#occupancy_cursor = 0;
|
|
20
|
-
|
|
21
|
-
get counts() {
|
|
22
|
-
return this.#counts_intrinsic;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
#max_mip_level = 0;
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
set max_mip_level(v) {
|
|
29
|
-
this.#max_mip_level = v;
|
|
30
|
-
|
|
31
|
-
this.#ensureCapacity();
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
get max_mip_level() {
|
|
35
|
-
return this.#max_mip_level;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
*
|
|
40
|
-
* @return {Uint32Array}
|
|
41
|
-
*/
|
|
42
|
-
get occupancy() {
|
|
43
|
-
return this.#occupancy;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
/**
|
|
47
|
-
*
|
|
48
|
-
* @return {number}
|
|
49
|
-
*/
|
|
50
|
-
get occupancy_count() {
|
|
51
|
-
return this.#occupancy_cursor;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
/**
|
|
55
|
-
*
|
|
56
|
-
*/
|
|
57
|
-
#ensureCapacity() {
|
|
58
|
-
|
|
59
|
-
const size = compose_tile_address(this.#max_mip_level + 1, 0, 0);
|
|
60
|
-
|
|
61
|
-
if (this.#counts_intrinsic.length >= size) {
|
|
62
|
-
// already large enough
|
|
63
|
-
return;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
this.#counts_intrinsic = new Uint32Array(size);
|
|
67
|
-
this.#occupancy = new Uint32Array(size);
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
/**
|
|
71
|
-
*
|
|
72
|
-
* @param {number} fingerprint
|
|
73
|
-
* @returns {number}
|
|
74
|
-
*/
|
|
75
|
-
getCountByFingerprint(fingerprint) {
|
|
76
|
-
const index = finger_print_to_tile_address(fingerprint);
|
|
77
|
-
|
|
78
|
-
return this.#counts_intrinsic[index];
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
/**
|
|
82
|
-
*
|
|
83
|
-
* @param {number} mip
|
|
84
|
-
* @param {number} x
|
|
85
|
-
* @param {number} y
|
|
86
|
-
* @returns {number}
|
|
87
|
-
*/
|
|
88
|
-
getCountBy(mip, x, y) {
|
|
89
|
-
const address = compose_tile_address(mip, x, y);
|
|
90
|
-
|
|
91
|
-
return this.#counts_intrinsic[address];
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
clear() {
|
|
95
|
-
this.#counts_intrinsic.fill(0);
|
|
96
|
-
this.#occupancy_cursor = 0;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
/**
|
|
100
|
-
* Given existing usage, award same usage to all tiles up the chain all the way to the root
|
|
101
|
-
* This helps avoid popping and ensures that when there's not enough space - at least the higher level LOD tiles are available
|
|
102
|
-
* @param {number} bias added to the ancestor tiles to make them more likely to be loaded
|
|
103
|
-
*/
|
|
104
|
-
promoteAncestors(bias = 1) {
|
|
105
|
-
|
|
106
|
-
// traverse mip pyramid in reverse, so we can push counts to parents one level at a time
|
|
107
|
-
const max_mip = this.#max_mip_level;
|
|
108
|
-
for (let mip = max_mip; mip > 0; mip--) {
|
|
109
|
-
|
|
110
|
-
const mip_resolution = 1 << mip;
|
|
111
|
-
|
|
112
|
-
for (let y = 0; y < mip_resolution; y++) {
|
|
113
|
-
for (let x = 0; x < mip_resolution; x++) {
|
|
114
|
-
|
|
115
|
-
const count = this.getCountBy(mip, x, y);
|
|
116
|
-
|
|
117
|
-
if (count <= 0) {
|
|
118
|
-
continue;
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
// get higher-level lod
|
|
122
|
-
const parent_level = mip - 1;
|
|
123
|
-
const parent_x = x >>> 1;
|
|
124
|
-
const parent_y = y >>> 1;
|
|
125
|
-
|
|
126
|
-
const parent_index = compose_tile_address(parent_level, parent_x, parent_y);
|
|
127
|
-
|
|
128
|
-
const parent_count = this.#counts_intrinsic[parent_index];
|
|
129
|
-
|
|
130
|
-
this.#counts_intrinsic[parent_index] = parent_count + count + bias;
|
|
131
|
-
|
|
132
|
-
if (parent_count === 0) {
|
|
133
|
-
this.#append_to_occupancy(parent_index);
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
/**
|
|
143
|
-
*
|
|
144
|
-
* @param {number} address
|
|
145
|
-
*/
|
|
146
|
-
#append_to_occupancy(address) {
|
|
147
|
-
this.#occupancy[this.#occupancy_cursor] = address;
|
|
148
|
-
this.#occupancy_cursor++;
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
sortOccupancyByLOD() {
|
|
152
|
-
/**
|
|
153
|
-
*
|
|
154
|
-
* @param {number} a
|
|
155
|
-
* @param {number} b
|
|
156
|
-
* @return {number}
|
|
157
|
-
*/
|
|
158
|
-
const compare = (a, b) => {
|
|
159
|
-
|
|
160
|
-
const fingerprint_a = tile_address_to_finger_print(a);
|
|
161
|
-
const fingerprint_b = tile_address_to_finger_print(b);
|
|
162
|
-
|
|
163
|
-
// read MIP levels
|
|
164
|
-
const mip_a = (fingerprint_a >> 24) & 0xFF;
|
|
165
|
-
const mip_b = (fingerprint_b >> 24) & 0xFF;
|
|
166
|
-
|
|
167
|
-
const mip_delta = mip_a - mip_b;
|
|
168
|
-
|
|
169
|
-
if (mip_delta !== 0) {
|
|
170
|
-
return mip_delta;
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
const intrinsic = this.#counts_intrinsic;
|
|
174
|
-
|
|
175
|
-
const count_a = intrinsic[a];
|
|
176
|
-
const count_b = intrinsic[b];
|
|
177
|
-
|
|
178
|
-
return count_b - count_a;
|
|
179
|
-
|
|
180
|
-
};
|
|
181
|
-
|
|
182
|
-
array_quick_sort_by_comparator(this.#occupancy, compare, null, 0, this.#occupancy_cursor - 1);
|
|
183
|
-
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
/**
|
|
188
|
-
*
|
|
189
|
-
* @param {Uint8Array} data usage texture data
|
|
190
|
-
*/
|
|
191
|
-
fromTexture(data) {
|
|
192
|
-
this.clear();
|
|
193
|
-
|
|
194
|
-
const data_size = data.length;
|
|
195
|
-
|
|
196
|
-
this.#ensureCapacity();
|
|
197
|
-
|
|
198
|
-
const counts = this.#counts_intrinsic;
|
|
199
|
-
|
|
200
|
-
for (let offset = 0; offset < data_size; offset += 4) {
|
|
201
|
-
|
|
202
|
-
if (data[offset + 3] === 0) {
|
|
203
|
-
// no data
|
|
204
|
-
continue;
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
const mip_level = data[offset];
|
|
208
|
-
|
|
209
|
-
// we create a mask to make sure we don't end up with invalid tile position values
|
|
210
|
-
const max_tile_value = (1 << mip_level) - 1;
|
|
211
|
-
|
|
212
|
-
const tile_x = data[offset + 1] & max_tile_value;
|
|
213
|
-
const tile_y = data[offset + 2] & max_tile_value;
|
|
214
|
-
|
|
215
|
-
const tile_address = compose_tile_address(mip_level, tile_x, tile_y);
|
|
216
|
-
|
|
217
|
-
const previous_count = counts[tile_address];
|
|
218
|
-
|
|
219
|
-
if (previous_count === 0) {
|
|
220
|
-
// first occurrence, mark occupancy
|
|
221
|
-
this.#append_to_occupancy(tile_address);
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
counts[tile_address] = previous_count + 1;
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
}
|
|
228
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"VirtualTextureUsageShader.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/graphics/texture/virtual/VirtualTextureUsageShader.js"],"names":[],"mappings":"AAAA,iCAoBC;AAED,mCA6CC"}
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
function vertex() {
|
|
2
|
-
return `
|
|
3
|
-
precision mediump float;
|
|
4
|
-
precision mediump int;
|
|
5
|
-
|
|
6
|
-
uniform mat4 modelViewMatrix;
|
|
7
|
-
uniform mat4 projectionMatrix;
|
|
8
|
-
|
|
9
|
-
in vec2 uv;
|
|
10
|
-
in vec3 position;
|
|
11
|
-
|
|
12
|
-
out vec2 vUv;
|
|
13
|
-
void main()
|
|
14
|
-
{
|
|
15
|
-
vUv = uv;
|
|
16
|
-
|
|
17
|
-
vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );
|
|
18
|
-
gl_Position = projectionMatrix * mvPosition;
|
|
19
|
-
}
|
|
20
|
-
`
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
function fragment() {
|
|
24
|
-
return `
|
|
25
|
-
precision highp float;
|
|
26
|
-
precision highp int;
|
|
27
|
-
|
|
28
|
-
uniform uvec4 u_mt_tex; // [ width, height, tileSize, id ]
|
|
29
|
-
uniform vec2 u_mt_params; // [ bias, maxLevel ]
|
|
30
|
-
uniform vec2 u_mt_viewport_scale;
|
|
31
|
-
in vec2 vUv;
|
|
32
|
-
|
|
33
|
-
out uvec4 out_decoded;
|
|
34
|
-
|
|
35
|
-
float MTCalculateMipLevel( const in vec2 uv, const in float bias ) {
|
|
36
|
-
|
|
37
|
-
float scale_x = float(u_mt_tex.x) ;
|
|
38
|
-
float scale_y = float(u_mt_tex.y) ;
|
|
39
|
-
|
|
40
|
-
vec2 dx = dFdx( uv * scale_x ) * u_mt_viewport_scale.x;
|
|
41
|
-
vec2 dy = dFdy( uv * scale_y ) * u_mt_viewport_scale.y;
|
|
42
|
-
|
|
43
|
-
float d = max( dot( dx, dx ), dot( dy, dy ) );
|
|
44
|
-
|
|
45
|
-
return log2( d ) * 0.5 + bias;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
uvec4 MTCalculateTileKeyRGBA( const in vec2 uv ) {
|
|
49
|
-
uint level = clamp( uint( floor( MTCalculateMipLevel( uv, u_mt_params.x ) ) ), 0u, uint(u_mt_params.y) );
|
|
50
|
-
|
|
51
|
-
uint mip_resolution_in_tiles = 1u << level;
|
|
52
|
-
|
|
53
|
-
uint mip_resolution_in_texels = mip_resolution_in_tiles * u_mt_tex.z;
|
|
54
|
-
|
|
55
|
-
vec2 texel_position = fract(uv.xy) * vec2(u_mt_tex.xy);
|
|
56
|
-
|
|
57
|
-
uvec2 tile_position = uvec2( texel_position / float(mip_resolution_in_texels) );
|
|
58
|
-
|
|
59
|
-
// [ level, tileX, tileY, texId ] -> RGBA
|
|
60
|
-
return uvec4( uint(u_mt_params.y) - level, tile_position, u_mt_tex.w );
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
void main(){
|
|
65
|
-
out_decoded = MTCalculateTileKeyRGBA(vUv);
|
|
66
|
-
}
|
|
67
|
-
`;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
export {
|
|
71
|
-
vertex,
|
|
72
|
-
fragment
|
|
73
|
-
};
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
export class ResidencyDebugView extends EmptyView {
|
|
2
|
-
constructor({ scale }?: {
|
|
3
|
-
scale?: number;
|
|
4
|
-
});
|
|
5
|
-
/**
|
|
6
|
-
*
|
|
7
|
-
* @type {VirtualTexturePage|null}
|
|
8
|
-
*/
|
|
9
|
-
texture: VirtualTexturePage | null;
|
|
10
|
-
update(): void;
|
|
11
|
-
#private;
|
|
12
|
-
}
|
|
13
|
-
import EmptyView from "../../../../../view/elements/EmptyView.js";
|
|
14
|
-
//# sourceMappingURL=ResidencyDebugView.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ResidencyDebugView.d.ts","sourceRoot":"","sources":["../../../../../../../src/engine/graphics/texture/virtual/debug/ResidencyDebugView.js"],"names":[],"mappings":"AAKA;IAaI;;OAkBC;IA9BD;;;OAGG;IACH,SAFU,qBAAmB,IAAI,CAElB;IA4Bf,eA6CC;;CACJ;sBAlFqB,2CAA2C"}
|