@woosh/meep-engine 2.155.0 → 2.157.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/README.md +2 -4
- package/build/bundle-worker-image-decoder.js +1 -1
- package/build/bundle-worker-terrain.js +1 -1
- package/editor/view/ecs/ComponentControlView.d.ts +0 -9
- package/editor/view/ecs/ComponentControlView.js +2 -98
- package/editor/view/ecs/components/common/AutoCanvasView.js +100 -53
- package/editor/view/ecs/components/common/TextController.js +59 -0
- package/editor/view/node-graph/NodeGraphCamera.js +90 -0
- package/editor/view/node-graph/NodeGraphEditorView.js +121 -22
- package/editor/view/node-graph/NodeGraphSelection.js +89 -0
- package/editor/view/node-graph/NodeGraphView.js +669 -453
- package/editor/view/node-graph/NodeView.js +211 -135
- package/editor/view/node-graph/actions/ConnectionCreateAction.js +53 -0
- package/editor/view/node-graph/actions/ConnectionDeleteAction.js +36 -0
- package/editor/view/node-graph/actions/NodeDeleteAction.js +88 -0
- package/editor/view/node-graph/actions/NodeParameterSetAction.js +52 -0
- package/editor/view/node-graph/actions/NodesMoveAction.js +41 -0
- package/editor/view/node-graph/actions/SelectionSetAction.js +60 -0
- package/editor/view/node-graph/connection_wire_geometry.js +107 -0
- package/package.json +1 -1
- package/samples/generation/SampleGenerator0.js +8 -1
- package/src/core/binary/32BitEncoder.js +1 -1
- package/src/core/binary/reinterpret_float32_as_uint32.d.ts +7 -0
- package/src/core/binary/reinterpret_float32_as_uint32.d.ts.map +1 -0
- package/src/core/binary/reinterpret_float32_as_uint32.js +13 -0
- package/src/core/binary/reinterpret_uint32_as_float32.d.ts +7 -0
- package/src/core/binary/reinterpret_uint32_as_float32.d.ts.map +1 -0
- package/src/core/binary/reinterpret_uint32_as_float32.js +14 -0
- package/src/core/binary/to_half_float_uint16.js +3 -3
- package/src/core/bvh2/bvh3/ebvh_build_for_geometry_incremental.d.ts.map +1 -1
- package/src/core/bvh2/bvh3/ebvh_build_for_geometry_incremental.js +1 -3
- package/src/core/bvh2/bvh3/ebvh_build_hierarchy_radix.d.ts.map +1 -1
- package/src/core/bvh2/bvh3/ebvh_build_hierarchy_radix.js +275 -253
- package/src/core/bvh2/bvh3/query/bvh_query_user_data_overlaps_sphere.d.ts +12 -0
- package/src/core/bvh2/bvh3/query/bvh_query_user_data_overlaps_sphere.d.ts.map +1 -0
- package/src/core/bvh2/bvh3/query/bvh_query_user_data_overlaps_sphere.js +92 -0
- package/src/core/bvh8/BVH8.d.ts +127 -0
- package/src/core/bvh8/BVH8.d.ts.map +1 -0
- package/src/core/bvh8/BVH8.js +436 -0
- package/src/core/bvh8/NOTES.md +63 -0
- package/src/core/bvh8/build/BVH8Converter.d.ts +59 -0
- package/src/core/bvh8/build/BVH8Converter.d.ts.map +1 -0
- package/src/core/bvh8/build/BVH8Converter.js +588 -0
- package/src/core/bvh8/build/NodeProxy.d.ts +66 -0
- package/src/core/bvh8/build/NodeProxy.d.ts.map +1 -0
- package/src/core/bvh8/build/NodeProxy.js +308 -0
- package/src/core/bvh8/build/TriangleCluster.d.ts +29 -0
- package/src/core/bvh8/build/TriangleCluster.d.ts.map +1 -0
- package/src/core/bvh8/build/TriangleCluster.js +123 -0
- package/src/core/bvh8/build/aabb3_compute_merge_cost.d.ts +8 -0
- package/src/core/bvh8/build/aabb3_compute_merge_cost.d.ts.map +1 -0
- package/src/core/bvh8/build/aabb3_compute_merge_cost.js +29 -0
- package/src/core/bvh8/build/aabb3_from_triangle_by_index.d.ts +10 -0
- package/src/core/bvh8/build/aabb3_from_triangle_by_index.d.ts.map +1 -0
- package/src/core/bvh8/build/aabb3_from_triangle_by_index.js +18 -0
- package/src/core/bvh8/build/bvh8_build_for_geometry.d.ts +10 -0
- package/src/core/bvh8/build/bvh8_build_for_geometry.d.ts.map +1 -0
- package/src/core/bvh8/build/bvh8_build_for_geometry.js +303 -0
- package/src/core/bvh8/build/bvh8_from_proxy.d.ts +9 -0
- package/src/core/bvh8/build/bvh8_from_proxy.d.ts.map +1 -0
- package/src/core/bvh8/build/bvh8_from_proxy.js +256 -0
- package/src/core/bvh8/build/byte.d.ts +7 -0
- package/src/core/bvh8/build/byte.d.ts.map +1 -0
- package/src/core/bvh8/build/byte.js +10 -0
- package/src/core/bvh8/build/encode_bounds_e.d.ts +9 -0
- package/src/core/bvh8/build/encode_bounds_e.d.ts.map +1 -0
- package/src/core/bvh8/build/encode_bounds_e.js +12 -0
- package/src/core/bvh8/bvh8_convert_to_dot.d.ts +11 -0
- package/src/core/bvh8/bvh8_convert_to_dot.d.ts.map +1 -0
- package/src/core/bvh8/bvh8_convert_to_dot.js +133 -0
- package/src/core/bvh8/bvh8_count_primitives.d.ts +22 -0
- package/src/core/bvh8/bvh8_count_primitives.d.ts.map +1 -0
- package/src/core/bvh8/bvh8_count_primitives.js +98 -0
- package/src/core/bvh8/bvh8_geometry_validate.d.ts +16 -0
- package/src/core/bvh8/bvh8_geometry_validate.d.ts.map +1 -0
- package/src/core/bvh8/bvh8_geometry_validate.js +149 -0
- package/src/core/bvh8/bvh8_geometry_validate_indirect.d.ts +16 -0
- package/src/core/bvh8/bvh8_geometry_validate_indirect.d.ts.map +1 -0
- package/src/core/bvh8/bvh8_geometry_validate_indirect.js +177 -0
- package/src/core/bvh8/bvh8_get_node_bounds.d.ts +9 -0
- package/src/core/bvh8/bvh8_get_node_bounds.d.ts.map +1 -0
- package/src/core/bvh8/bvh8_get_node_bounds.js +35 -0
- package/src/core/bvh8/bvh8_get_node_child_bounds.d.ts +10 -0
- package/src/core/bvh8/bvh8_get_node_child_bounds.d.ts.map +1 -0
- package/src/core/bvh8/bvh8_get_node_child_bounds.js +53 -0
- package/src/core/bvh8/bvh8_node_child_surface_area.d.ts +9 -0
- package/src/core/bvh8/bvh8_node_child_surface_area.d.ts.map +1 -0
- package/src/core/bvh8/bvh8_node_child_surface_area.js +18 -0
- package/src/core/bvh8/bvh8_node_count_triangles.d.ts +8 -0
- package/src/core/bvh8/bvh8_node_count_triangles.d.ts.map +1 -0
- package/src/core/bvh8/bvh8_node_count_triangles.js +28 -0
- package/src/core/bvh8/bvh8_quality.d.ts +8 -0
- package/src/core/bvh8/bvh8_quality.d.ts.map +1 -0
- package/src/core/bvh8/bvh8_quality.js +73 -0
- package/src/core/bvh8/bvh8_validate_structure.d.ts +15 -0
- package/src/core/bvh8/bvh8_validate_structure.d.ts.map +1 -0
- package/src/core/bvh8/bvh8_validate_structure.js +87 -0
- package/src/core/cache/Cache.d.ts.map +1 -1
- package/src/core/cache/Cache.js +7 -0
- package/src/core/cache/FrequencySketch.d.ts.map +1 -1
- package/src/core/cache/FrequencySketch.js +8 -4
- package/src/core/clipboard/obtainClipBoard.d.ts +6 -0
- package/src/core/clipboard/obtainClipBoard.d.ts.map +1 -0
- package/src/core/clipboard/obtainClipBoard.js +29 -0
- package/src/core/clipboard/safeClipboardReadText.d.ts +6 -0
- package/src/core/clipboard/safeClipboardReadText.d.ts.map +1 -0
- package/src/core/clipboard/safeClipboardReadText.js +55 -0
- package/src/core/clipboard/safeClipboardWriteText.d.ts +8 -0
- package/src/core/clipboard/safeClipboardWriteText.d.ts.map +1 -0
- package/src/core/clipboard/safeClipboardWriteText.js +23 -0
- package/src/core/collection/Uint32MinHeap.d.ts +56 -0
- package/src/core/collection/Uint32MinHeap.d.ts.map +1 -0
- package/src/core/collection/Uint32MinHeap.js +109 -0
- package/src/core/collection/array/array_quick_sort_by_lookup_map.js +1 -1
- package/src/core/collection/array/array_set_diff_sorting.d.ts.map +1 -1
- package/src/core/collection/array/array_set_diff_sorting.js +4 -1
- package/src/core/collection/array/array_shuffle.d.ts.map +1 -1
- package/src/core/collection/array/array_shuffle.js +30 -27
- package/src/core/collection/array/binarySearchLowIndex.d.ts.map +1 -1
- package/src/core/collection/array/binarySearchLowIndex.js +4 -3
- package/src/core/collection/array/typed/array_buffer_hash.js +1 -1
- package/src/core/collection/array/typed/is_typed_array_equals.d.ts.map +1 -1
- package/src/core/collection/array/typed/is_typed_array_equals.js +12 -2
- package/src/core/collection/heap/BinaryHeap.d.ts.map +1 -1
- package/src/core/collection/heap/BinaryHeap.js +12 -2
- package/src/core/collection/list/FilteredListProjection.js +1 -1
- package/src/core/collection/queue/Deque.d.ts.map +1 -1
- package/src/core/collection/queue/Deque.js +10 -8
- package/src/core/collection/table/RowFirstTable.d.ts.map +1 -1
- package/src/core/collection/table/RowFirstTable.js +4 -2
- package/src/core/collection/table/RowFirstTableSpec.js +2 -2
- package/src/{engine/physics/island → core/collection/union-find}/union_find.d.ts +8 -5
- package/src/core/collection/union-find/union_find.d.ts.map +1 -0
- package/src/{engine/physics/island → core/collection/union-find}/union_find.js +8 -5
- package/src/core/color/operations/color_lerp.d.ts.map +1 -1
- package/src/core/color/operations/color_lerp.js +10 -3
- package/src/core/color/rgb2uint32.js +1 -1
- package/src/core/color/rgbe9995_to_rgb.js +1 -1
- package/src/core/dom/isImageBitmap.d.ts +7 -0
- package/src/core/dom/isImageBitmap.d.ts.map +1 -0
- package/src/core/dom/isImageBitmap.js +12 -0
- package/src/core/function/frameThrottle.d.ts +8 -0
- package/src/core/function/frameThrottle.d.ts.map +1 -0
- package/src/core/function/frameThrottle.js +23 -0
- package/src/core/function/objectsEqual.d.ts.map +1 -1
- package/src/core/function/objectsEqual.js +2 -1
- package/src/core/geom/2d/aabb/AABB2.d.ts.map +1 -1
- package/src/core/geom/2d/aabb/AABB2.js +12 -11
- package/src/core/geom/2d/convex-hull/convex_hull_jarvis_2d.d.ts.map +1 -1
- package/src/core/geom/2d/convex-hull/convex_hull_jarvis_2d.js +30 -4
- package/src/core/geom/2d/convex-hull/fixed_convex_hull_relaxation.d.ts.map +1 -1
- package/src/core/geom/2d/convex-hull/fixed_convex_hull_relaxation.js +6 -2
- package/src/core/geom/2d/hash-grid/SpatialHashGrid.d.ts.map +1 -1
- package/src/core/geom/2d/hash-grid/SpatialHashGrid.js +388 -386
- package/src/core/geom/2d/hash-grid/shg_query_elements_line.d.ts.map +1 -1
- package/src/core/geom/2d/hash-grid/shg_query_elements_line.js +8 -3
- package/src/{engine/physics/narrowphase/clip_against_axis_uv.d.ts → core/geom/2d/polygon/polygon2_clip_axis_halfplane.d.ts} +3 -3
- package/src/core/geom/2d/polygon/polygon2_clip_axis_halfplane.d.ts.map +1 -0
- package/src/{engine/physics/narrowphase/clip_against_axis_uv.js → core/geom/2d/polygon/polygon2_clip_axis_halfplane.js} +51 -51
- package/src/core/geom/2d/quad-tree/QuadTreeDatum.d.ts.map +1 -1
- package/src/core/geom/2d/quad-tree/QuadTreeDatum.js +9 -1
- package/src/core/geom/2d/quad-tree/qt_query_data_nearest_to_point.d.ts +3 -1
- package/src/core/geom/2d/quad-tree/qt_query_data_nearest_to_point.d.ts.map +1 -1
- package/src/core/geom/2d/quad-tree/qt_query_data_nearest_to_point.js +3 -1
- package/src/core/geom/2d/quad-tree-binary/QuadTree.js +714 -714
- package/src/core/geom/2d/r-tree/StaticR2Tree.d.ts.map +1 -1
- package/src/core/geom/2d/r-tree/StaticR2Tree.js +5 -4
- package/src/core/geom/3d/aabb/aabb3_detailed_volume_intersection.d.ts.map +1 -1
- package/src/core/geom/3d/aabb/aabb3_detailed_volume_intersection.js +33 -29
- package/src/core/geom/3d/aabb/aabb3_near_distance_to_intersection_ray_segment.d.ts.map +1 -1
- package/src/core/geom/3d/aabb/aabb3_near_distance_to_intersection_ray_segment.js +3 -1
- package/src/core/geom/3d/aabb/aabb3_signed_distance_to_aabb3.d.ts.map +1 -1
- package/src/core/geom/3d/aabb/aabb3_signed_distance_to_aabb3.js +10 -7
- package/src/{engine/physics/narrowphase/decomposition/aabb_world_to_local.d.ts → core/geom/3d/aabb/aabb3_transform_oriented_inverse.d.ts} +9 -7
- package/src/core/geom/3d/aabb/aabb3_transform_oriented_inverse.d.ts.map +1 -0
- package/src/{engine/physics/narrowphase/decomposition/aabb_world_to_local.js → core/geom/3d/aabb/aabb3_transform_oriented_inverse.js} +9 -7
- package/src/core/geom/3d/aabb/aabb3_transformed_compute_plane_side.d.ts.map +1 -1
- package/src/core/geom/3d/aabb/aabb3_transformed_compute_plane_side.js +30 -9
- package/src/core/geom/3d/aabb/compute_aabb_from_points.js +3 -3
- package/src/core/geom/3d/aabb/compute_triangle_group_aabb3.d.ts +12 -0
- package/src/core/geom/3d/aabb/compute_triangle_group_aabb3.d.ts.map +1 -0
- package/src/core/geom/3d/aabb/compute_triangle_group_aabb3.js +46 -0
- package/src/core/geom/3d/box/box3_projected_half_extent.d.ts +28 -0
- package/src/core/geom/3d/box/box3_projected_half_extent.d.ts.map +1 -0
- package/src/core/geom/3d/box/box3_projected_half_extent.js +35 -0
- package/src/core/geom/3d/box/box3_raycast.d.ts +37 -0
- package/src/core/geom/3d/box/box3_raycast.d.ts.map +1 -0
- package/src/core/geom/3d/box/box3_raycast.js +81 -0
- package/src/core/geom/3d/capsule/capsule_raycast.d.ts +35 -0
- package/src/core/geom/3d/capsule/capsule_raycast.d.ts.map +1 -0
- package/src/core/geom/3d/capsule/capsule_raycast.js +93 -0
- package/src/core/geom/3d/cone/compute_bounding_cone_of_2_cones.d.ts.map +1 -1
- package/src/core/geom/3d/cone/compute_bounding_cone_of_2_cones.js +4 -0
- package/src/core/geom/3d/frustum/frustum3_computeNearestPointToPoint.js +1 -1
- package/src/core/geom/3d/frustum/read_cluster_frustum_corners.js +1 -1
- package/src/core/geom/3d/frustum/read_frustum_corner.d.ts +9 -0
- package/src/core/geom/3d/frustum/read_frustum_corner.d.ts.map +1 -0
- package/src/core/geom/3d/frustum/read_frustum_corner.js +14 -0
- package/src/core/geom/3d/gjk/gjk.d.ts.map +1 -0
- package/src/{engine/physics → core/geom/3d}/gjk/gjk.js +430 -372
- package/src/{engine/physics → core/geom/3d}/gjk/gjk_epa_penetration.d.ts +8 -5
- package/src/core/geom/3d/gjk/gjk_epa_penetration.d.ts.map +1 -0
- package/src/{engine/physics → core/geom/3d}/gjk/gjk_epa_penetration.js +520 -548
- package/src/{engine/physics → core/geom/3d}/gjk/minkowski_support.d.ts +5 -4
- package/src/core/geom/3d/gjk/minkowski_support.d.ts.map +1 -0
- package/src/{engine/physics → core/geom/3d}/gjk/minkowski_support.js +71 -70
- package/src/{engine/physics → core/geom/3d}/gjk/mpr.d.ts +3 -3
- package/src/core/geom/3d/gjk/mpr.d.ts.map +1 -0
- package/src/{engine/physics → core/geom/3d}/gjk/mpr.js +368 -362
- package/src/core/geom/3d/line/line3_compute_segment_point_distance_eikonal.d.ts.map +1 -1
- package/src/core/geom/3d/line/line3_compute_segment_point_distance_eikonal.js +3 -2
- package/src/core/geom/3d/mat4/decompose_matrix_4_array.d.ts.map +1 -1
- package/src/core/geom/3d/mat4/decompose_matrix_4_array.js +12 -2
- package/src/core/geom/3d/mat4/eulerAnglesFromMatrix.js +2 -2
- package/src/core/geom/3d/mat4/m4_multiply_alphatensor.d.ts +1 -1
- package/src/core/geom/3d/mat4/m4_multiply_alphatensor.d.ts.map +1 -1
- package/src/core/geom/3d/mat4/m4_multiply_alphatensor.js +19 -13
- package/src/core/geom/3d/octahedra/octahedral_direction_to_uv.d.ts.map +1 -1
- package/src/core/geom/3d/octahedra/octahedral_direction_to_uv.js +3 -2
- package/src/core/geom/3d/plane/plane3_compute_plane_intersection.js +3 -2
- package/src/{engine/physics/integration/quat_integrate.d.ts → core/geom/3d/quaternion/quat3_integrate.d.ts} +2 -2
- package/src/core/geom/3d/quaternion/quat3_integrate.d.ts.map +1 -0
- package/src/{engine/physics/integration/quat_integrate.js → core/geom/3d/quaternion/quat3_integrate.js} +1 -1
- package/src/core/geom/3d/shape/MeshShape3D.d.ts.map +1 -1
- package/src/core/geom/3d/shape/MeshShape3D.js +7 -0
- package/src/{engine/physics/narrowphase/PosedShape.d.ts → core/geom/3d/shape/PosedShape3D.d.ts} +9 -8
- package/src/{engine/physics/narrowphase/PosedShape.d.ts.map → core/geom/3d/shape/PosedShape3D.d.ts.map} +1 -1
- package/src/{engine/physics/narrowphase/PosedShape.js → core/geom/3d/shape/PosedShape3D.js} +10 -9
- package/src/core/geom/3d/shape/TransformedShape3D.d.ts.map +1 -1
- package/src/core/geom/3d/shape/TransformedShape3D.js +15 -11
- package/src/core/geom/3d/shape/UnionShape3D.d.ts.map +1 -1
- package/src/core/geom/3d/shape/UnionShape3D.js +3 -2
- package/src/core/geom/3d/shape/util/shape3d_voxelize_to_grid.d.ts.map +1 -1
- package/src/core/geom/3d/shape/util/shape3d_voxelize_to_grid.js +153 -148
- package/src/core/geom/3d/sphere/harmonics/sh3_dering_optimize_positive.d.ts.map +1 -1
- package/src/core/geom/3d/sphere/harmonics/sh3_dering_optimize_positive.js +7 -0
- package/src/core/geom/3d/sphere/harmonics/sh3_sample_by_direction.d.ts.map +1 -1
- package/src/core/geom/3d/sphere/harmonics/sh3_sample_by_direction.js +13 -10
- package/src/core/geom/3d/sphere/sphere_projected_sphere_radius_sqr.d.ts +1 -1
- package/src/core/geom/3d/sphere/sphere_projected_sphere_radius_sqr.js +2 -2
- package/src/core/geom/3d/sphere/sphere_raycast.d.ts +33 -0
- package/src/core/geom/3d/sphere/sphere_raycast.d.ts.map +1 -0
- package/src/core/geom/3d/sphere/sphere_raycast.js +47 -0
- package/src/core/geom/3d/tetrahedra/tetrahedral_mesh_tet_get_neighbours.d.ts +24 -0
- package/src/core/geom/3d/tetrahedra/tetrahedral_mesh_tet_get_neighbours.d.ts.map +1 -0
- package/src/core/geom/3d/tetrahedra/tetrahedral_mesh_tet_get_neighbours.js +39 -0
- package/src/core/geom/3d/tetrahedra/triangle/trace_triangular_depth_map.d.ts.map +1 -1
- package/src/core/geom/3d/tetrahedra/triangle/trace_triangular_depth_map.js +4 -2
- package/src/core/geom/3d/topology/bounds/computeTriangleClusterNormalBoundingCone.js +3 -3
- package/src/core/geom/3d/topology/simplify/decimate_edge_collapse_snap.js +1 -1
- package/src/core/geom/3d/topology/tm_vertex_compute_normal.d.ts.map +1 -1
- package/src/core/geom/3d/topology/tm_vertex_compute_normal.js +4 -2
- package/src/core/geom/3d/util/make_justified_point_grid.d.ts.map +1 -1
- package/src/core/geom/3d/util/make_justified_point_grid.js +18 -10
- package/src/core/geom/ConicRay.d.ts.map +1 -1
- package/src/core/geom/ConicRay.js +11 -13
- package/src/core/geom/packing/max-rect/removeRedundantBoxes.d.ts.map +1 -1
- package/src/core/geom/packing/max-rect/removeRedundantBoxes.js +19 -4
- package/src/core/geom/vec3/v3_orthonormal_matrix_from_normal.d.ts.map +1 -0
- package/src/{engine/graphics/sh3/path_tracer/sampling → core/geom/vec3}/v3_orthonormal_matrix_from_normal.js +1 -1
- package/src/core/geom/vec3/v3_quat3_apply_inverse.d.ts +1 -1
- package/src/core/geom/vec3/v3_quat3_apply_inverse.js +1 -1
- package/src/core/graph/coloring/colorizeGraph.js +2 -2
- package/src/core/graph/csr/CSRGraph.d.ts.map +1 -1
- package/src/core/graph/csr/CSRGraph.js +325 -319
- package/src/core/graph/layout/CircleLayout.d.ts.map +1 -1
- package/src/core/graph/layout/CircleLayout.js +8 -6
- package/src/core/graph/metis/native/refine/compute_kway_params.d.ts.map +1 -1
- package/src/core/graph/metis/native/refine/compute_kway_params.js +139 -138
- package/src/core/graph/mn_graph_coarsen.d.ts.map +1 -1
- package/src/core/graph/mn_graph_coarsen.js +4 -2
- package/src/core/graph/v2/NodeContainer.js +7 -7
- package/src/core/localization/LocalizationEngine.js +1 -1
- package/src/core/math/bell_membership_function.d.ts.map +1 -1
- package/src/core/math/bell_membership_function.js +3 -1
- package/src/core/math/complex/complex_add.d.ts +4 -4
- package/src/core/math/complex/complex_add.d.ts.map +1 -1
- package/src/core/math/complex/complex_add.js +14 -5
- package/src/core/math/complex/complex_div.d.ts +4 -4
- package/src/core/math/complex/complex_div.d.ts.map +1 -1
- package/src/core/math/complex/complex_div.js +13 -6
- package/src/core/math/complex/complex_mul.d.ts +4 -4
- package/src/core/math/complex/complex_mul.d.ts.map +1 -1
- package/src/core/math/complex/complex_mul.js +12 -5
- package/src/core/math/complex/complex_sub.d.ts +4 -4
- package/src/core/math/complex/complex_sub.d.ts.map +1 -1
- package/src/core/math/complex/complex_sub.js +14 -5
- package/src/core/math/idct_1d.d.ts +4 -4
- package/src/core/math/idct_1d.d.ts.map +1 -1
- package/src/core/math/idct_1d.js +3 -3
- package/src/{engine/physics/fluid/solver/optimal_sor_omega.d.ts → core/math/linalg/sor_optimal_omega.d.ts} +4 -3
- package/src/core/math/linalg/sor_optimal_omega.d.ts.map +1 -0
- package/src/{engine/physics/fluid/solver/optimal_sor_omega.js → core/math/linalg/sor_optimal_omega.js} +4 -3
- package/src/core/math/lookup/ParameterLookupTable.d.ts +123 -0
- package/src/core/math/lookup/ParameterLookupTable.d.ts.map +1 -0
- package/src/core/math/lookup/ParameterLookupTable.js +495 -0
- package/src/core/math/lookup/ParameterLookupTableFlags.d.ts +5 -0
- package/src/core/math/lookup/ParameterLookupTableFlags.d.ts.map +1 -0
- package/src/core/math/lookup/ParameterLookupTableFlags.js +6 -0
- package/src/core/math/noise/create_simplex_noise_2d.d.ts.map +1 -1
- package/src/core/math/noise/create_simplex_noise_2d.js +4 -2
- package/src/core/math/noise/sdnoise.d.ts.map +1 -1
- package/src/core/math/noise/sdnoise.js +12 -9
- package/src/core/math/physics/kinematics/computeInterceptPoint.d.ts.map +1 -0
- package/src/{engine/physics → core/math/physics/kinematics}/computeInterceptPoint.js +79 -79
- package/src/core/math/physics/mie/compute_bhmie_optical_properties.d.ts.map +1 -1
- package/src/core/math/physics/mie/compute_bhmie_optical_properties.js +94 -50
- package/src/core/math/physics/mie/lorenz_mie_coefs.d.ts +3 -6
- package/src/core/math/physics/mie/lorenz_mie_coefs.d.ts.map +1 -1
- package/src/core/math/physics/mie/lorenz_mie_coefs.js +180 -157
- package/src/core/math/physics/mie/mie_ab_to_optical_properties.d.ts +3 -4
- package/src/core/math/physics/mie/mie_ab_to_optical_properties.d.ts.map +1 -1
- package/src/core/math/physics/mie/mie_ab_to_optical_properties.js +47 -21
- package/src/core/math/physics/mie/ri_air.d.ts.map +1 -1
- package/src/core/math/physics/mie/ri_air.js +1 -3
- package/src/core/math/physics/mie/ri_ammonium_sulfate.d.ts.map +1 -1
- package/src/core/math/physics/mie/ri_ammonium_sulfate.js +1 -3
- package/src/core/math/physics/mie/ri_brine.d.ts.map +1 -1
- package/src/core/math/physics/mie/ri_brine.js +1 -3
- package/src/core/math/physics/mie/ri_dust.d.ts.map +1 -1
- package/src/core/math/physics/mie/ri_dust.js +1 -3
- package/src/core/math/physics/mie/ri_pollen.d.ts.map +1 -1
- package/src/core/math/physics/mie/ri_pollen.js +1 -3
- package/src/core/math/physics/mie/ri_smoke.d.ts.map +1 -1
- package/src/core/math/physics/mie/ri_smoke.js +1 -3
- package/src/core/math/physics/mie/ri_soot.d.ts.map +1 -1
- package/src/core/math/physics/mie/ri_soot.js +1 -3
- package/src/core/math/physics/mie/ri_water.d.ts.map +1 -1
- package/src/core/math/physics/mie/ri_water.js +1 -3
- package/src/core/math/random/randomIntegerBetween.d.ts.map +1 -1
- package/src/core/math/random/randomIntegerBetween.js +4 -1
- package/src/core/math/random/random_pick_weighted_index.d.ts +10 -0
- package/src/core/math/random/random_pick_weighted_index.d.ts.map +1 -0
- package/src/core/math/random/random_pick_weighted_index.js +26 -0
- package/src/core/math/solveCubic.d.ts.map +1 -1
- package/src/core/math/solveCubic.js +95 -82
- package/src/core/math/spline/computeCatmullRomSplineUniformDistance.d.ts.map +1 -1
- package/src/core/math/spline/computeCatmullRomSplineUniformDistance.js +13 -0
- package/src/core/math/statistics/softmax.js +1 -1
- package/src/core/model/node-graph/NodeGraph.d.ts +9 -0
- package/src/core/model/node-graph/NodeGraph.d.ts.map +1 -1
- package/src/core/model/node-graph/NodeGraph.js +38 -0
- package/src/core/model/node-graph/visual/NodeGraphVisualData.d.ts +24 -0
- package/src/core/model/node-graph/visual/NodeGraphVisualData.d.ts.map +1 -1
- package/src/core/model/node-graph/visual/NodeGraphVisualData.js +56 -1
- package/src/core/model/node-graph/visual/NodeVisualData.js +1 -1
- package/src/core/model/object/ImmutableObjectPool.d.ts +7 -0
- package/src/core/model/object/ImmutableObjectPool.d.ts.map +1 -1
- package/src/core/model/object/ImmutableObjectPool.js +20 -10
- package/src/core/model/reactive/evaluation/MultiPredicateEvaluator.d.ts.map +1 -1
- package/src/core/model/reactive/evaluation/MultiPredicateEvaluator.js +39 -2
- package/src/core/model/reactive/model/terminal/ReactiveReference.d.ts.map +1 -1
- package/src/core/model/reactive/model/terminal/ReactiveReference.js +2 -0
- package/src/core/parser/simple/readHexToken.d.ts.map +1 -1
- package/src/core/parser/simple/readHexToken.js +6 -0
- package/src/core/path/convertPathToURL.d.ts +9 -0
- package/src/core/path/convertPathToURL.d.ts.map +1 -0
- package/src/core/path/convertPathToURL.js +107 -0
- package/src/core/primitives/numbers/number_pretty_print.d.ts.map +1 -1
- package/src/core/primitives/numbers/number_pretty_print.js +4 -1
- package/src/core/primitives/strings/string_jaro_winkler.js +1 -1
- package/src/core/process/CompositeProcess.js +1 -1
- package/src/core/process/executor/ConcurrentExecutor.d.ts.map +1 -1
- package/src/core/process/executor/ConcurrentExecutor.js +3 -2
- package/src/core/process/task/util/randomCountTask.d.ts.map +1 -1
- package/src/core/process/task/util/randomCountTask.js +3 -1
- package/src/core/process/undo/ActionProcessor.d.ts.map +1 -1
- package/src/core/process/undo/ActionProcessor.js +5 -3
- package/src/core/process/worker/WorkerBuilder.js +4 -4
- package/src/core/process/worker/extractTransferables.js +1 -1
- package/src/engine/animation/curve/AnimationCurve.d.ts.map +1 -1
- package/src/engine/animation/curve/AnimationCurve.js +4 -2
- package/src/engine/animation/curve/draw/build_tangent_editor.d.ts.map +1 -1
- package/src/engine/animation/curve/draw/build_tangent_editor.js +8 -1
- package/src/engine/animation/curve/editor/createKeyframeDraggableAspect.d.ts.map +1 -1
- package/src/engine/animation/curve/editor/createKeyframeDraggableAspect.js +11 -5
- package/src/engine/asset/Asset.d.ts.map +1 -1
- package/src/engine/asset/Asset.js +16 -6
- package/src/engine/asset/AssetManager.d.ts +61 -52
- package/src/engine/asset/AssetManager.d.ts.map +1 -1
- package/src/engine/asset/AssetManager.js +1411 -1045
- package/src/engine/asset/AssetRequest.d.ts +1 -1
- package/src/engine/asset/AssetRequest.d.ts.map +1 -1
- package/src/engine/asset/AssetRequest.js +1 -1
- package/src/engine/asset/AssetRequestScope.d.ts.map +1 -1
- package/src/engine/asset/AssetRequestScope.js +7 -0
- package/src/engine/asset/PendingAsset.d.ts +32 -1
- package/src/engine/asset/PendingAsset.d.ts.map +1 -1
- package/src/engine/asset/PendingAsset.js +108 -61
- package/src/engine/asset/loaders/ArrayBufferLoader.js +2 -2
- package/src/engine/asset/loaders/AssetLoader.d.ts.map +1 -1
- package/src/engine/asset/loaders/AssetLoader.js +19 -2
- package/src/engine/asset/loaders/GLTFAssetLoader.d.ts.map +1 -1
- package/src/engine/asset/loaders/GLTFAssetLoader.js +123 -114
- package/src/engine/asset/loaders/JavascriptAssetLoader.d.ts +1 -1
- package/src/engine/asset/loaders/JavascriptAssetLoader.d.ts.map +1 -1
- package/src/engine/asset/loaders/JavascriptAssetLoader.js +31 -47
- package/src/engine/asset/loaders/JsonAssetLoader.js +1 -1
- package/src/engine/asset/loaders/SVGAssetLoader.js +2 -2
- package/src/engine/asset/loaders/SoundAssetLoader.js +1 -1
- package/src/engine/asset/loaders/TextAssetLoader.js +2 -2
- package/src/{core → engine/asset/loaders}/font/FontAsset.d.ts +1 -1
- package/src/engine/asset/loaders/font/FontAsset.d.ts.map +1 -0
- package/src/{core → engine/asset/loaders}/font/FontAsset.js +21 -21
- package/src/{core → engine/asset/loaders}/font/FontAssetLoader.d.ts +1 -1
- package/src/engine/asset/loaders/font/FontAssetLoader.d.ts.map +1 -0
- package/src/{core → engine/asset/loaders}/font/FontAssetLoader.js +20 -20
- package/src/engine/asset/loaders/image/ImageRGBADataLoader.d.ts +1 -1
- package/src/engine/asset/loaders/image/ImageRGBADataLoader.d.ts.map +1 -1
- package/src/engine/asset/loaders/image/ImageRGBADataLoader.js +11 -20
- package/src/engine/asset/loaders/texture/TextureAssetLoader.d.ts.map +1 -1
- package/src/engine/asset/loaders/texture/TextureAssetLoader.js +8 -2
- package/src/engine/asset/preloader/AssetPreloader.js +1 -1
- package/src/engine/control/first-person/DESIGN.md +1 -1
- package/src/engine/control/first-person/FirstPersonMotionPhase.d.ts +55 -0
- package/src/engine/control/first-person/FirstPersonMotionPhase.d.ts.map +1 -0
- package/src/engine/control/first-person/FirstPersonMotionPhase.js +134 -0
- package/src/engine/control/first-person/FirstPersonPlayerController.d.ts +23 -2
- package/src/engine/control/first-person/FirstPersonPlayerController.d.ts.map +1 -1
- package/src/engine/control/first-person/FirstPersonPlayerController.js +1 -1
- package/src/engine/control/first-person/FirstPersonPlayerControllerConfig.d.ts +168 -0
- package/src/engine/control/first-person/FirstPersonPlayerControllerConfig.d.ts.map +1 -1
- package/src/engine/control/first-person/FirstPersonPlayerControllerConfig.js +115 -0
- package/src/engine/control/first-person/FirstPersonPlayerControllerSystem.d.ts +71 -0
- package/src/engine/control/first-person/FirstPersonPlayerControllerSystem.d.ts.map +1 -1
- package/src/engine/control/first-person/FirstPersonPlayerControllerSystem.js +255 -55
- package/src/engine/control/first-person/abilities/LedgeGrab.d.ts +82 -43
- package/src/engine/control/first-person/abilities/LedgeGrab.d.ts.map +1 -1
- package/src/engine/control/first-person/abilities/LedgeGrab.js +405 -213
- package/src/engine/control/first-person/abilities/Mantle.d.ts +6 -0
- package/src/engine/control/first-person/abilities/Mantle.d.ts.map +1 -1
- package/src/engine/control/first-person/abilities/Mantle.js +104 -45
- package/src/engine/control/first-person/abilities/ScrambleUp.d.ts +61 -0
- package/src/engine/control/first-person/abilities/ScrambleUp.d.ts.map +1 -0
- package/src/engine/control/first-person/abilities/ScrambleUp.js +182 -0
- package/src/engine/control/first-person/math/jumpDynamics.d.ts +84 -0
- package/src/engine/control/first-person/math/jumpDynamics.d.ts.map +1 -0
- package/src/engine/control/first-person/math/jumpDynamics.js +108 -0
- package/src/engine/control/first-person/prototype_first_person_controller.js +45 -1
- package/src/engine/ecs/sockets/serialization/AttachmentSocketsAssetLoader.d.ts +1 -1
- package/src/engine/ecs/sockets/serialization/AttachmentSocketsAssetLoader.d.ts.map +1 -1
- package/src/engine/ecs/sockets/serialization/AttachmentSocketsAssetLoader.js +19 -22
- package/src/engine/graphics/FrameThrottle.d.ts +1 -7
- package/src/engine/graphics/FrameThrottle.d.ts.map +1 -1
- package/src/engine/graphics/FrameThrottle.js +2 -24
- package/src/engine/graphics/camera/testClippingPlaneComputation.js +1 -1
- package/src/{core/geom/3d/shape/util → engine/graphics/debug}/shape_to_visual_entity.d.ts +1 -1
- package/src/engine/graphics/debug/shape_to_visual_entity.d.ts.map +1 -0
- package/src/{core/geom/3d/shape/util → engine/graphics/debug}/shape_to_visual_entity.js +159 -159
- package/src/{core/geom/3d/tetrahedra → engine/graphics/debug}/visualize_tetrahedral_mesh.d.ts +1 -1
- package/src/engine/graphics/debug/visualize_tetrahedral_mesh.d.ts.map +1 -0
- package/src/{core/geom/3d/tetrahedra → engine/graphics/debug}/visualize_tetrahedral_mesh.js +46 -46
- package/src/engine/graphics/ecs/animation/animator/graph/definition/serialization/AnimationGraphDefinitionAssetLoader.d.ts +1 -1
- package/src/engine/graphics/ecs/animation/animator/graph/definition/serialization/AnimationGraphDefinitionAssetLoader.d.ts.map +1 -1
- package/src/engine/graphics/ecs/animation/animator/graph/definition/serialization/AnimationGraphDefinitionAssetLoader.js +22 -32
- package/src/engine/graphics/ecs/path/tube/prototypeAnimatedPathMask.js +1 -1
- package/src/engine/graphics/particles/particular/engine/emitter/serde/ParameterLookupTableSerializationAdapter.d.ts.map +1 -1
- package/src/engine/graphics/particles/particular/engine/emitter/serde/ParameterLookupTableSerializationAdapter.js +2 -76
- package/src/engine/graphics/particles/particular/engine/parameter/ParameterLookupTable.d.ts.map +1 -1
- package/src/engine/graphics/particles/particular/engine/parameter/ParameterLookupTable.js +2 -427
- package/src/engine/graphics/particles/particular/engine/parameter/ParameterLookupTableFlags.d.ts +1 -4
- package/src/engine/graphics/particles/particular/engine/parameter/ParameterLookupTableFlags.d.ts.map +1 -1
- package/src/engine/graphics/particles/particular/engine/parameter/ParameterLookupTableFlags.js +2 -6
- package/src/engine/graphics/particles/particular/engine/utils/volume/prototypeParticleVolume.js +2 -2
- package/src/engine/graphics/render/buffer/buffers/prototypeNormalFrameBuffer.js +1 -1
- package/src/engine/graphics/render/forward_plus/plugin/ptototypeFPPlugin.js +1 -1
- package/src/engine/graphics/render/forward_plus/read_frustum_corner.d.ts +1 -8
- package/src/engine/graphics/render/forward_plus/read_frustum_corner.d.ts.map +1 -1
- package/src/engine/graphics/render/forward_plus/read_frustum_corner.js +2 -14
- package/src/engine/graphics/render/visibility/hiz/prototypeHiZ.js +1 -1
- package/src/engine/graphics/sh3/path_tracer/geometry/compute_triangle_group_aabb3.d.ts +1 -11
- package/src/engine/graphics/sh3/path_tracer/geometry/compute_triangle_group_aabb3.d.ts.map +1 -1
- package/src/engine/graphics/sh3/path_tracer/geometry/compute_triangle_group_aabb3.js +2 -46
- package/src/engine/graphics/sh3/path_tracer/texture/sample_material.js +1 -1
- package/src/engine/graphics/sh3/prototypeSH3Probe.js +1 -1
- package/src/engine/graphics/shadows/testShadowMapRendering.js +1 -1
- package/src/engine/graphics/texture/3d/scs3d_sample_linear3.d.ts +27 -0
- package/src/engine/graphics/texture/3d/scs3d_sample_linear3.d.ts.map +1 -0
- package/src/engine/graphics/texture/3d/scs3d_sample_linear3.js +81 -0
- package/src/engine/graphics/texture/isImageBitmap.d.ts +1 -6
- package/src/engine/graphics/texture/isImageBitmap.d.ts.map +1 -1
- package/src/engine/graphics/texture/isImageBitmap.js +2 -12
- package/src/{core/process/action → engine/intelligence/behavior/util}/AsynchronousDelayAction.d.ts +2 -2
- package/src/engine/intelligence/behavior/util/AsynchronousDelayAction.d.ts.map +1 -0
- package/src/{core/process/action → engine/intelligence/behavior/util}/AsynchronousDelayAction.js +55 -52
- package/src/engine/network/NetworkSession.d.ts +12 -1
- package/src/engine/network/NetworkSession.d.ts.map +1 -1
- package/src/engine/network/NetworkSession.js +52 -1
- package/src/engine/network/README.md +45 -0
- package/src/engine/network/convertPathToURL.d.ts +1 -8
- package/src/engine/network/convertPathToURL.d.ts.map +1 -1
- package/src/engine/network/convertPathToURL.js +2 -107
- package/src/engine/network/core/quantize/quantize_float.d.ts.map +1 -1
- package/src/engine/network/core/quantize/quantize_float.js +7 -0
- package/src/engine/network/core/quantize/quantize_position.d.ts.map +1 -1
- package/src/engine/network/core/quantize/quantize_position.js +12 -1
- package/src/engine/network/orchestrator/NetworkPeer.d.ts.map +1 -1
- package/src/engine/network/orchestrator/NetworkPeer.js +15 -1
- package/src/engine/network/replication/Replicator.d.ts +8 -0
- package/src/engine/network/replication/Replicator.d.ts.map +1 -1
- package/src/engine/network/replication/Replicator.js +48 -0
- package/src/engine/network/transport/Channel.d.ts.map +1 -1
- package/src/engine/network/transport/Channel.js +46 -12
- package/src/engine/network/transport/ReliableCommandPipeline.d.ts +16 -0
- package/src/engine/network/transport/ReliableCommandPipeline.d.ts.map +1 -1
- package/src/engine/network/transport/ReliableCommandPipeline.js +29 -0
- package/src/engine/network/transport/adapters/NodeUDPTransport.d.ts.map +1 -1
- package/src/engine/network/transport/adapters/NodeUDPTransport.js +7 -1
- package/src/engine/network/transport/fragments/packet_size.d.ts +5 -5
- package/src/engine/network/transport/fragments/packet_size.d.ts.map +1 -1
- package/src/engine/network/transport/fragments/packet_size.js +5 -5
- package/src/engine/physics/BULLET_REVIEW.md +1 -1
- package/src/engine/physics/CONSTRAINT_SOLVER_BENCH_LOG.md +208 -0
- package/src/engine/physics/CONSTRAINT_SOLVER_IMPROVEMENTS_PLAN.md +364 -0
- package/src/engine/physics/JOLT_REVIEW.md +2 -2
- package/src/engine/physics/PLAN.md +1094 -944
- package/src/engine/physics/RAPIER_REVIEW.md +2 -2
- package/src/engine/physics/body/BodyStorage.d.ts +2 -12
- package/src/engine/physics/body/BodyStorage.d.ts.map +1 -1
- package/src/engine/physics/body/BodyStorage.js +406 -452
- package/src/engine/physics/body/SolverBodyState.d.ts.map +1 -1
- package/src/engine/physics/body/SolverBodyState.js +12 -3
- package/src/engine/physics/broadphase/compute_fat_world_aabb.d.ts +28 -3
- package/src/engine/physics/broadphase/compute_fat_world_aabb.d.ts.map +1 -1
- package/src/engine/physics/broadphase/compute_fat_world_aabb.js +60 -24
- package/src/engine/physics/broadphase/generate_pairs.d.ts +9 -5
- package/src/engine/physics/broadphase/generate_pairs.d.ts.map +1 -1
- package/src/engine/physics/broadphase/generate_pairs.js +52 -37
- package/src/engine/physics/ccd/linear_sweep.d.ts +15 -5
- package/src/engine/physics/ccd/linear_sweep.d.ts.map +1 -1
- package/src/engine/physics/ccd/linear_sweep.js +122 -40
- package/src/engine/physics/constraint/solve_constraints.d.ts +4 -1
- package/src/engine/physics/constraint/solve_constraints.d.ts.map +1 -1
- package/src/engine/physics/constraint/solve_constraints.js +830 -691
- package/src/engine/physics/contact/ManifoldStore.d.ts +91 -16
- package/src/engine/physics/contact/ManifoldStore.d.ts.map +1 -1
- package/src/engine/physics/contact/ManifoldStore.js +204 -60
- package/src/engine/physics/ecs/BodyKind.d.ts +7 -3
- package/src/engine/physics/ecs/BodyKind.d.ts.map +1 -1
- package/src/engine/physics/ecs/BodyKind.js +29 -25
- package/src/engine/physics/ecs/Collider.d.ts +7 -0
- package/src/engine/physics/ecs/Collider.d.ts.map +1 -1
- package/src/engine/physics/ecs/Collider.js +7 -0
- package/src/engine/physics/ecs/ColliderSerializationAdapter.js +1 -1
- package/src/engine/physics/ecs/PhysicsSystem.d.ts +110 -6
- package/src/engine/physics/ecs/PhysicsSystem.d.ts.map +1 -1
- package/src/engine/physics/ecs/PhysicsSystem.js +2172 -1747
- package/src/engine/physics/ecs/RigidBody.d.ts +20 -5
- package/src/engine/physics/ecs/RigidBody.d.ts.map +1 -1
- package/src/engine/physics/ecs/RigidBody.js +307 -286
- package/src/engine/physics/ecs/RigidBodyFlags.d.ts +6 -3
- package/src/engine/physics/ecs/RigidBodyFlags.d.ts.map +1 -1
- package/src/engine/physics/ecs/RigidBodyFlags.js +31 -28
- package/src/engine/physics/ecs/RigidBodySerializationAdapter.d.ts +12 -4
- package/src/engine/physics/ecs/RigidBodySerializationAdapter.d.ts.map +1 -1
- package/src/engine/physics/ecs/RigidBodySerializationAdapter.js +19 -5
- package/src/engine/physics/ecs/RigidBodySerializationUpgrader_0_1.d.ts +10 -0
- package/src/engine/physics/ecs/RigidBodySerializationUpgrader_0_1.d.ts.map +1 -0
- package/src/engine/physics/ecs/RigidBodySerializationUpgrader_0_1.js +37 -0
- package/src/engine/physics/ecs/find_non_finite_physics_state.d.ts +28 -0
- package/src/engine/physics/ecs/find_non_finite_physics_state.d.ts.map +1 -0
- package/src/engine/physics/ecs/find_non_finite_physics_state.js +76 -0
- package/src/engine/physics/events/ContactEventBuffer.d.ts +11 -0
- package/src/engine/physics/events/ContactEventBuffer.d.ts.map +1 -1
- package/src/engine/physics/events/ContactEventBuffer.js +40 -0
- package/src/engine/physics/events/diff_manifolds.d.ts +30 -13
- package/src/engine/physics/events/diff_manifolds.d.ts.map +1 -1
- package/src/engine/physics/events/diff_manifolds.js +87 -50
- package/src/engine/physics/fluid/FluidField.d.ts +45 -17
- package/src/engine/physics/fluid/FluidField.d.ts.map +1 -1
- package/src/engine/physics/fluid/FluidField.js +53 -23
- package/src/engine/physics/fluid/FluidSimulator.d.ts +141 -5
- package/src/engine/physics/fluid/FluidSimulator.d.ts.map +1 -1
- package/src/engine/physics/fluid/FluidSimulator.js +336 -43
- package/src/engine/physics/fluid/REVIEW_02_PLAN.md +114 -0
- package/src/engine/physics/fluid/ecs/FluidComponent.d.ts +4 -3
- package/src/engine/physics/fluid/ecs/FluidComponent.d.ts.map +1 -1
- package/src/engine/physics/fluid/ecs/FluidComponent.js +4 -3
- package/src/engine/physics/fluid/ecs/FluidSystem.d.ts +3 -3
- package/src/engine/physics/fluid/effector/AmbientWindFluidEffector.d.ts +41 -0
- package/src/engine/physics/fluid/effector/AmbientWindFluidEffector.d.ts.map +1 -0
- package/src/engine/physics/fluid/effector/AmbientWindFluidEffector.js +124 -0
- package/src/engine/physics/fluid/effector/WakeFluidEffector.d.ts +27 -8
- package/src/engine/physics/fluid/effector/WakeFluidEffector.d.ts.map +1 -1
- package/src/engine/physics/fluid/effector/WakeFluidEffector.js +67 -18
- package/src/engine/physics/fluid/solver/v3_grid_advect_maccormack_scalar.d.ts +42 -0
- package/src/engine/physics/fluid/solver/v3_grid_advect_maccormack_scalar.d.ts.map +1 -0
- package/src/engine/physics/fluid/solver/v3_grid_advect_maccormack_scalar.js +136 -0
- package/src/engine/physics/fluid/solver/v3_grid_advect_maccormack_velocity.d.ts +37 -0
- package/src/engine/physics/fluid/solver/v3_grid_advect_maccormack_velocity.d.ts.map +1 -0
- package/src/engine/physics/fluid/solver/v3_grid_advect_maccormack_velocity.js +169 -0
- package/src/engine/physics/fluid/solver/v3_grid_advect_sl_velocity.d.ts +36 -0
- package/src/engine/physics/fluid/solver/v3_grid_advect_sl_velocity.d.ts.map +1 -0
- package/src/engine/physics/fluid/solver/v3_grid_advect_sl_velocity.js +100 -0
- package/src/engine/physics/fluid/solver/v3_grid_apply_advection_forward.d.ts +6 -0
- package/src/engine/physics/fluid/solver/v3_grid_apply_advection_forward.d.ts.map +1 -1
- package/src/engine/physics/fluid/solver/v3_grid_apply_advection_forward.js +6 -0
- package/src/engine/physics/fluid/solver/v3_grid_apply_diffusion.d.ts +7 -2
- package/src/engine/physics/fluid/solver/v3_grid_apply_diffusion.d.ts.map +1 -1
- package/src/engine/physics/fluid/solver/v3_grid_apply_diffusion.js +17 -12
- package/src/engine/physics/fluid/solver/v3_grid_apply_vorticity_confinement.d.ts +42 -0
- package/src/engine/physics/fluid/solver/v3_grid_apply_vorticity_confinement.d.ts.map +1 -0
- package/src/engine/physics/fluid/solver/v3_grid_apply_vorticity_confinement.js +131 -0
- package/src/engine/physics/fluid/solver/v3_grid_compute_solid_neighbour_mask.d.ts +32 -22
- package/src/engine/physics/fluid/solver/v3_grid_compute_solid_neighbour_mask.d.ts.map +1 -1
- package/src/engine/physics/fluid/solver/v3_grid_compute_solid_neighbour_mask.js +43 -26
- package/src/engine/physics/fluid/solver/v3_grid_patch_edges_constant.d.ts +31 -0
- package/src/engine/physics/fluid/solver/v3_grid_patch_edges_constant.d.ts.map +1 -0
- package/src/engine/physics/fluid/solver/v3_grid_patch_edges_constant.js +77 -0
- package/src/engine/physics/fluid/solver/v3_grid_solve_pressure.d.ts +26 -19
- package/src/engine/physics/fluid/solver/v3_grid_solve_pressure.d.ts.map +1 -1
- package/src/engine/physics/fluid/solver/v3_grid_solve_pressure.js +46 -42
- package/src/engine/physics/fluid/solver/v3_grid_solve_pressure_pcg.d.ts +38 -10
- package/src/engine/physics/fluid/solver/v3_grid_solve_pressure_pcg.d.ts.map +1 -1
- package/src/engine/physics/fluid/solver/v3_grid_solve_pressure_pcg.js +158 -75
- package/src/engine/physics/fluid/solver/v3_grid_subtract_pressure_gradient.d.ts +22 -17
- package/src/engine/physics/fluid/solver/v3_grid_subtract_pressure_gradient.d.ts.map +1 -1
- package/src/engine/physics/fluid/solver/v3_grid_subtract_pressure_gradient.js +108 -96
- package/src/engine/physics/inertia/world_inverse_inertia.d.ts +30 -1
- package/src/engine/physics/inertia/world_inverse_inertia.d.ts.map +1 -1
- package/src/engine/physics/inertia/world_inverse_inertia.js +160 -116
- package/src/engine/physics/integration/integrate_position.js +97 -97
- package/src/engine/physics/island/IslandBuilder.d.ts +49 -8
- package/src/engine/physics/island/IslandBuilder.d.ts.map +1 -1
- package/src/engine/physics/island/IslandBuilder.js +93 -14
- package/src/engine/physics/narrowphase/box_box_manifold.d.ts.map +1 -1
- package/src/engine/physics/narrowphase/box_box_manifold.js +683 -673
- package/src/engine/physics/narrowphase/box_triangle_contact.d.ts.map +1 -1
- package/src/engine/physics/narrowphase/box_triangle_contact.js +899 -749
- package/src/engine/physics/narrowphase/capsule_contacts.d.ts +27 -0
- package/src/engine/physics/narrowphase/capsule_contacts.d.ts.map +1 -1
- package/src/engine/physics/narrowphase/capsule_contacts.js +624 -459
- package/src/engine/physics/narrowphase/capsule_triangle_contact.d.ts.map +1 -1
- package/src/engine/physics/narrowphase/capsule_triangle_contact.js +58 -38
- package/src/engine/physics/narrowphase/compute_penetration.d.ts.map +1 -1
- package/src/engine/physics/narrowphase/compute_penetration.js +369 -325
- package/src/engine/physics/narrowphase/convex_convex_manifold.d.ts +3 -1
- package/src/engine/physics/narrowphase/convex_convex_manifold.d.ts.map +1 -1
- package/src/engine/physics/narrowphase/convex_convex_manifold.js +568 -425
- package/src/engine/physics/narrowphase/convex_decomposition.d.ts +32 -13
- package/src/engine/physics/narrowphase/convex_decomposition.d.ts.map +1 -1
- package/src/engine/physics/narrowphase/convex_decomposition.js +61 -65
- package/src/engine/physics/narrowphase/decomposition/heightmap_enumerate_triangles.d.ts +6 -3
- package/src/engine/physics/narrowphase/decomposition/heightmap_enumerate_triangles.d.ts.map +1 -1
- package/src/engine/physics/narrowphase/decomposition/heightmap_enumerate_triangles.js +66 -10
- package/src/engine/physics/narrowphase/decomposition/mesh_enumerate_triangles.d.ts +4 -1
- package/src/engine/physics/narrowphase/decomposition/mesh_enumerate_triangles.d.ts.map +1 -1
- package/src/engine/physics/narrowphase/decomposition/mesh_enumerate_triangles.js +97 -94
- package/src/engine/physics/narrowphase/mesh_convex_hull.d.ts.map +1 -1
- package/src/engine/physics/narrowphase/mesh_convex_hull.js +13 -8
- package/src/engine/physics/narrowphase/mesh_mesh_tet_manifold.js +117 -117
- package/src/engine/physics/narrowphase/narrowphase_step.d.ts.map +1 -1
- package/src/engine/physics/narrowphase/narrowphase_step.js +1738 -1739
- package/src/engine/physics/narrowphase/reduce_manifold_contacts.d.ts +14 -7
- package/src/engine/physics/narrowphase/reduce_manifold_contacts.d.ts.map +1 -1
- package/src/engine/physics/narrowphase/reduce_manifold_contacts.js +74 -69
- package/src/engine/physics/narrowphase/refine_ray_concave.d.ts.map +1 -1
- package/src/engine/physics/narrowphase/refine_ray_concave.js +5 -3
- package/src/engine/physics/narrowphase/refine_ray_hit.d.ts.map +1 -1
- package/src/engine/physics/narrowphase/refine_ray_hit.js +81 -78
- package/src/engine/physics/persistence/solver_caches.d.ts +20 -0
- package/src/engine/physics/persistence/solver_caches.d.ts.map +1 -0
- package/src/engine/physics/persistence/solver_caches.js +309 -0
- package/src/engine/physics/queries/overlap_shape.d.ts.map +1 -1
- package/src/engine/physics/queries/overlap_shape.js +187 -184
- package/src/engine/physics/queries/raycast.d.ts +3 -2
- package/src/engine/physics/queries/raycast.d.ts.map +1 -1
- package/src/engine/physics/queries/raycast.js +37 -11
- package/src/engine/physics/queries/shape_cast.d.ts +18 -5
- package/src/engine/physics/queries/shape_cast.d.ts.map +1 -1
- package/src/engine/physics/queries/shape_cast.js +417 -393
- package/src/engine/physics/solver/solve_contacts.d.ts +22 -6
- package/src/engine/physics/solver/solve_contacts.d.ts.map +1 -1
- package/src/engine/physics/solver/solve_contacts.js +1482 -1338
- package/src/engine/physics/vehicle/RaycastVehicle.d.ts.map +1 -1
- package/src/engine/physics/vehicle/RaycastVehicle.js +344 -339
- package/src/engine/sound/SoundEngine.d.ts.map +1 -1
- package/src/engine/sound/SoundEngine.js +28 -0
- package/src/engine/sound/dB2Volume.d.ts +1 -1
- package/src/engine/sound/dB2Volume.d.ts.map +1 -1
- package/src/engine/sound/dB2Volume.js +1 -1
- package/src/engine/sound/ecs/SoundController.d.ts +4 -0
- package/src/engine/sound/ecs/SoundController.d.ts.map +1 -1
- package/src/engine/sound/ecs/SoundController.js +4 -0
- package/src/engine/sound/ecs/SoundControllerSystem.d.ts +5 -0
- package/src/engine/sound/ecs/SoundControllerSystem.d.ts.map +1 -1
- package/src/engine/sound/ecs/SoundControllerSystem.js +5 -0
- package/src/engine/sound/ecs/audio/AudioEmitter.d.ts +69 -0
- package/src/engine/sound/ecs/audio/AudioEmitter.d.ts.map +1 -0
- package/src/engine/sound/ecs/audio/AudioEmitter.js +83 -0
- package/src/engine/sound/ecs/audio/AudioEmitterSystem.d.ts +97 -0
- package/src/engine/sound/ecs/audio/AudioEmitterSystem.d.ts.map +1 -0
- package/src/engine/sound/ecs/audio/AudioEmitterSystem.js +238 -0
- package/src/engine/sound/ecs/audio/LiveEmitterSet.d.ts +90 -0
- package/src/engine/sound/ecs/audio/LiveEmitterSet.d.ts.map +1 -0
- package/src/engine/sound/ecs/audio/LiveEmitterSet.js +324 -0
- package/src/engine/sound/ecs/audio/SpatialAudioIndex.d.ts +59 -0
- package/src/engine/sound/ecs/audio/SpatialAudioIndex.d.ts.map +1 -0
- package/src/engine/sound/ecs/audio/SpatialAudioIndex.js +140 -0
- package/src/engine/sound/ecs/emitter/SoundEmitter.d.ts +16 -65
- package/src/engine/sound/ecs/emitter/SoundEmitter.d.ts.map +1 -1
- package/src/engine/sound/ecs/emitter/SoundEmitter.js +19 -224
- package/src/engine/sound/ecs/emitter/SoundEmitterComponentContext.d.ts +26 -29
- package/src/engine/sound/ecs/emitter/SoundEmitterComponentContext.d.ts.map +1 -1
- package/src/engine/sound/ecs/emitter/SoundEmitterComponentContext.js +168 -135
- package/src/engine/sound/ecs/emitter/SoundEmitterSystem.d.ts +36 -59
- package/src/engine/sound/ecs/emitter/SoundEmitterSystem.d.ts.map +1 -1
- package/src/engine/sound/ecs/emitter/SoundEmitterSystem.js +154 -390
- package/src/engine/sound/ecs/emitter/SoundTrack.d.ts +20 -23
- package/src/engine/sound/ecs/emitter/SoundTrack.d.ts.map +1 -1
- package/src/engine/sound/ecs/emitter/SoundTrack.js +34 -152
- package/src/engine/sound/sopra/IMPLEMENTATION_PLAN.md +993 -0
- package/src/engine/sound/sopra/README.md +643 -7
- package/src/engine/sound/sopra/SopraEngine.d.ts +229 -0
- package/src/engine/sound/sopra/SopraEngine.d.ts.map +1 -0
- package/src/engine/sound/sopra/SopraEngine.js +423 -0
- package/src/engine/sound/sopra/asset/AssetManagerBufferProvider.d.ts +26 -0
- package/src/engine/sound/sopra/asset/AssetManagerBufferProvider.d.ts.map +1 -0
- package/src/engine/sound/sopra/asset/AssetManagerBufferProvider.js +71 -0
- package/src/engine/sound/sopra/asset/BufferProvider.d.ts +24 -0
- package/src/engine/sound/sopra/asset/BufferProvider.d.ts.map +1 -0
- package/src/engine/sound/sopra/asset/BufferProvider.js +29 -0
- package/src/engine/sound/sopra/asset/StubBufferProvider.d.ts +31 -0
- package/src/engine/sound/sopra/asset/StubBufferProvider.d.ts.map +1 -0
- package/src/engine/sound/sopra/asset/StubBufferProvider.js +58 -0
- package/src/engine/sound/sopra/definition/BusDefinition.d.ts +83 -0
- package/src/engine/sound/sopra/definition/BusDefinition.d.ts.map +1 -0
- package/src/engine/sound/sopra/definition/BusDefinition.js +142 -0
- package/src/engine/sound/sopra/definition/BusDefinitionSerializationAdapter.d.ts +17 -0
- package/src/engine/sound/sopra/definition/BusDefinitionSerializationAdapter.d.ts.map +1 -0
- package/src/engine/sound/sopra/definition/BusDefinitionSerializationAdapter.js +54 -0
- package/src/engine/sound/sopra/definition/DuckingRule.d.ts +71 -0
- package/src/engine/sound/sopra/definition/DuckingRule.d.ts.map +1 -0
- package/src/engine/sound/sopra/definition/DuckingRule.js +106 -0
- package/src/engine/sound/sopra/definition/DuckingRuleSerializationAdapter.d.ts +18 -0
- package/src/engine/sound/sopra/definition/DuckingRuleSerializationAdapter.d.ts.map +1 -0
- package/src/engine/sound/sopra/definition/DuckingRuleSerializationAdapter.js +31 -0
- package/src/engine/sound/sopra/definition/EventDescription.d.ts +132 -0
- package/src/engine/sound/sopra/definition/EventDescription.d.ts.map +1 -0
- package/src/engine/sound/sopra/definition/EventDescription.js +259 -0
- package/src/engine/sound/sopra/definition/EventDescriptionSerializationAdapter.d.ts +17 -0
- package/src/engine/sound/sopra/definition/EventDescriptionSerializationAdapter.d.ts.map +1 -0
- package/src/engine/sound/sopra/definition/EventDescriptionSerializationAdapter.js +71 -0
- package/src/engine/sound/sopra/definition/MixerSnapshot.d.ts +51 -0
- package/src/engine/sound/sopra/definition/MixerSnapshot.d.ts.map +1 -0
- package/src/engine/sound/sopra/definition/MixerSnapshot.js +83 -0
- package/src/engine/sound/sopra/definition/MixerSnapshotSerializationAdapter.d.ts +18 -0
- package/src/engine/sound/sopra/definition/MixerSnapshotSerializationAdapter.d.ts.map +1 -0
- package/src/engine/sound/sopra/definition/MixerSnapshotSerializationAdapter.js +39 -0
- package/src/engine/sound/sopra/definition/ParameterDefinition.d.ts +72 -0
- package/src/engine/sound/sopra/definition/ParameterDefinition.d.ts.map +1 -0
- package/src/engine/sound/sopra/definition/ParameterDefinition.js +117 -0
- package/src/engine/sound/sopra/definition/ParameterDefinitionSerializationAdapter.d.ts +18 -0
- package/src/engine/sound/sopra/definition/ParameterDefinitionSerializationAdapter.d.ts.map +1 -0
- package/src/engine/sound/sopra/definition/ParameterDefinitionSerializationAdapter.js +31 -0
- package/src/engine/sound/sopra/definition/SopraPanningModel.d.ts +14 -0
- package/src/engine/sound/sopra/definition/SopraPanningModel.d.ts.map +1 -0
- package/src/engine/sound/sopra/definition/SopraPanningModel.js +20 -0
- package/src/engine/sound/sopra/definition/VoiceStealMode.d.ts +10 -0
- package/src/engine/sound/sopra/definition/VoiceStealMode.d.ts.map +1 -0
- package/src/engine/sound/sopra/definition/VoiceStealMode.js +18 -0
- package/src/engine/sound/sopra/definition/clip/AbstractAudioClip.d.ts +93 -0
- package/src/engine/sound/sopra/definition/clip/AbstractAudioClip.d.ts.map +1 -0
- package/src/engine/sound/sopra/definition/clip/AbstractAudioClip.js +109 -0
- package/src/engine/sound/sopra/definition/clip/BlendContainerAudioClip.d.ts +80 -0
- package/src/engine/sound/sopra/definition/clip/BlendContainerAudioClip.d.ts.map +1 -0
- package/src/engine/sound/sopra/definition/clip/BlendContainerAudioClip.js +181 -0
- package/src/engine/sound/sopra/definition/clip/BlendContainerAudioClipSerializationAdapter.d.ts +17 -0
- package/src/engine/sound/sopra/definition/clip/BlendContainerAudioClipSerializationAdapter.d.ts.map +1 -0
- package/src/engine/sound/sopra/definition/clip/BlendContainerAudioClipSerializationAdapter.js +74 -0
- package/src/engine/sound/sopra/definition/clip/ContainerAudioClip.d.ts +34 -0
- package/src/engine/sound/sopra/definition/clip/ContainerAudioClip.d.ts.map +1 -0
- package/src/engine/sound/sopra/definition/clip/ContainerAudioClip.js +100 -0
- package/src/engine/sound/sopra/definition/clip/RandomContainerAudioClip.d.ts +101 -0
- package/src/engine/sound/sopra/definition/clip/RandomContainerAudioClip.d.ts.map +1 -0
- package/src/engine/sound/sopra/definition/clip/RandomContainerAudioClip.js +230 -0
- package/src/engine/sound/sopra/definition/clip/RandomContainerAudioClipSerializationAdapter.d.ts +17 -0
- package/src/engine/sound/sopra/definition/clip/RandomContainerAudioClipSerializationAdapter.d.ts.map +1 -0
- package/src/engine/sound/sopra/definition/clip/RandomContainerAudioClipSerializationAdapter.js +54 -0
- package/src/engine/sound/sopra/definition/clip/SampleAudioClip.d.ts +103 -0
- package/src/engine/sound/sopra/definition/clip/SampleAudioClip.d.ts.map +1 -0
- package/src/engine/sound/sopra/definition/clip/SampleAudioClip.js +191 -0
- package/src/engine/sound/sopra/definition/clip/SampleAudioClipSerializationAdapter.d.ts +18 -0
- package/src/engine/sound/sopra/definition/clip/SampleAudioClipSerializationAdapter.d.ts.map +1 -0
- package/src/engine/sound/sopra/definition/clip/SampleAudioClipSerializationAdapter.js +39 -0
- package/src/engine/sound/sopra/definition/clip/SequenceContainerAudioClip.d.ts +40 -0
- package/src/engine/sound/sopra/definition/clip/SequenceContainerAudioClip.d.ts.map +1 -0
- package/src/engine/sound/sopra/definition/clip/SequenceContainerAudioClip.js +91 -0
- package/src/engine/sound/sopra/definition/clip/SequenceContainerAudioClipSerializationAdapter.d.ts +17 -0
- package/src/engine/sound/sopra/definition/clip/SequenceContainerAudioClipSerializationAdapter.d.ts.map +1 -0
- package/src/engine/sound/sopra/definition/clip/SequenceContainerAudioClipSerializationAdapter.js +42 -0
- package/src/engine/sound/sopra/definition/clip/SilenceAudioClip.d.ts +44 -0
- package/src/engine/sound/sopra/definition/clip/SilenceAudioClip.d.ts.map +1 -0
- package/src/engine/sound/sopra/definition/clip/SilenceAudioClip.js +77 -0
- package/src/engine/sound/sopra/definition/clip/SilenceAudioClipSerializationAdapter.d.ts +18 -0
- package/src/engine/sound/sopra/definition/clip/SilenceAudioClipSerializationAdapter.d.ts.map +1 -0
- package/src/engine/sound/sopra/definition/clip/SilenceAudioClipSerializationAdapter.js +27 -0
- package/src/engine/sound/sopra/definition/clip/SwitchContainerAudioClip.d.ts +65 -0
- package/src/engine/sound/sopra/definition/clip/SwitchContainerAudioClip.d.ts.map +1 -0
- package/src/engine/sound/sopra/definition/clip/SwitchContainerAudioClip.js +131 -0
- package/src/engine/sound/sopra/definition/clip/SwitchContainerAudioClipSerializationAdapter.d.ts +17 -0
- package/src/engine/sound/sopra/definition/clip/SwitchContainerAudioClipSerializationAdapter.d.ts.map +1 -0
- package/src/engine/sound/sopra/definition/clip/SwitchContainerAudioClipSerializationAdapter.js +41 -0
- package/src/engine/sound/sopra/definition/effect/AbstractAudioEffect.d.ts +24 -0
- package/src/engine/sound/sopra/definition/effect/AbstractAudioEffect.d.ts.map +1 -0
- package/src/engine/sound/sopra/definition/effect/AbstractAudioEffect.js +24 -0
- package/src/engine/sound/sopra/definition/effect/CompressorEffect.d.ts +70 -0
- package/src/engine/sound/sopra/definition/effect/CompressorEffect.d.ts.map +1 -0
- package/src/engine/sound/sopra/definition/effect/CompressorEffect.js +120 -0
- package/src/engine/sound/sopra/definition/effect/CompressorEffectSerializationAdapter.d.ts +18 -0
- package/src/engine/sound/sopra/definition/effect/CompressorEffectSerializationAdapter.d.ts.map +1 -0
- package/src/engine/sound/sopra/definition/effect/CompressorEffectSerializationAdapter.js +31 -0
- package/src/engine/sound/sopra/definition/effect/EqEffect.d.ts +74 -0
- package/src/engine/sound/sopra/definition/effect/EqEffect.d.ts.map +1 -0
- package/src/engine/sound/sopra/definition/effect/EqEffect.js +128 -0
- package/src/engine/sound/sopra/definition/effect/EqEffectSerializationAdapter.d.ts +18 -0
- package/src/engine/sound/sopra/definition/effect/EqEffectSerializationAdapter.d.ts.map +1 -0
- package/src/engine/sound/sopra/definition/effect/EqEffectSerializationAdapter.js +29 -0
- package/src/engine/sound/sopra/definition/effect/ReverbEffect.d.ts +49 -0
- package/src/engine/sound/sopra/definition/effect/ReverbEffect.d.ts.map +1 -0
- package/src/engine/sound/sopra/definition/effect/ReverbEffect.js +101 -0
- package/src/engine/sound/sopra/definition/effect/ReverbEffectSerializationAdapter.d.ts +18 -0
- package/src/engine/sound/sopra/definition/effect/ReverbEffectSerializationAdapter.d.ts.map +1 -0
- package/src/engine/sound/sopra/definition/effect/ReverbEffectSerializationAdapter.js +25 -0
- package/src/engine/sound/sopra/legacy/soundEmitterToEventDescription.d.ts +31 -0
- package/src/engine/sound/sopra/legacy/soundEmitterToEventDescription.d.ts.map +1 -0
- package/src/engine/sound/sopra/legacy/soundEmitterToEventDescription.js +106 -0
- package/src/engine/sound/sopra/runtime/BusGraph.d.ts +79 -0
- package/src/engine/sound/sopra/runtime/BusGraph.d.ts.map +1 -0
- package/src/engine/sound/sopra/runtime/BusGraph.js +227 -0
- package/src/engine/sound/sopra/runtime/EventInstance.d.ts +144 -0
- package/src/engine/sound/sopra/runtime/EventInstance.d.ts.map +1 -0
- package/src/engine/sound/sopra/runtime/EventInstance.js +579 -0
- package/src/engine/sound/sopra/runtime/ParameterStore.d.ts +42 -0
- package/src/engine/sound/sopra/runtime/ParameterStore.d.ts.map +1 -0
- package/src/engine/sound/sopra/runtime/ParameterStore.js +98 -0
- package/src/engine/sound/sopra/runtime/SopraPlaybackContext.d.ts +42 -0
- package/src/engine/sound/sopra/runtime/SopraPlaybackContext.d.ts.map +1 -0
- package/src/engine/sound/sopra/runtime/SopraPlaybackContext.js +68 -0
- package/src/engine/sound/sopra/runtime/Voice.d.ts +67 -0
- package/src/engine/sound/sopra/runtime/Voice.d.ts.map +1 -0
- package/src/engine/sound/sopra/runtime/Voice.js +145 -0
- package/src/engine/sound/sopra/runtime/VoiceManager.d.ts +38 -0
- package/src/engine/sound/sopra/runtime/VoiceManager.d.ts.map +1 -0
- package/src/engine/sound/sopra/runtime/VoiceManager.js +136 -0
- package/src/engine/sound/sopra/runtime/VoicePool.d.ts +12 -0
- package/src/engine/sound/sopra/runtime/VoicePool.d.ts.map +1 -0
- package/src/engine/sound/sopra/runtime/VoicePool.js +17 -0
- package/src/engine/sound/sopra/serialization/populateSopraSerializationRegistry.d.ts +11 -0
- package/src/engine/sound/sopra/serialization/populateSopraSerializationRegistry.d.ts.map +1 -0
- package/src/engine/sound/sopra/serialization/populateSopraSerializationRegistry.js +42 -0
- package/src/engine/sound/sopra/serialization/sopraJSON.d.ts +33 -0
- package/src/engine/sound/sopra/serialization/sopraJSON.d.ts.map +1 -0
- package/src/engine/sound/sopra/serialization/sopraJSON.js +99 -0
- package/src/engine/sound/sopra/serialization/sopraSerializationHarness.d.ts +27 -0
- package/src/engine/sound/sopra/serialization/sopraSerializationHarness.d.ts.map +1 -0
- package/src/engine/sound/sopra/serialization/sopraSerializationHarness.js +49 -0
- package/src/engine/sound/sopra/util/MockAudioContext.d.ts +74 -0
- package/src/engine/sound/sopra/util/MockAudioContext.d.ts.map +1 -0
- package/src/engine/sound/sopra/util/MockAudioContext.js +215 -0
- package/src/engine/sound/sopra/util/buildAttenuationCurve.d.ts +15 -0
- package/src/engine/sound/sopra/util/buildAttenuationCurve.d.ts.map +1 -0
- package/src/engine/sound/sopra/util/buildAttenuationCurve.js +40 -0
- package/src/engine/sound/sopra/util/fadeOutAndStop.d.ts +34 -0
- package/src/engine/sound/sopra/util/fadeOutAndStop.d.ts.map +1 -0
- package/src/engine/sound/sopra/util/fadeOutAndStop.js +60 -0
- package/src/engine/sound/volume2dB.d.ts +1 -1
- package/src/engine/sound/volume2dB.d.ts.map +1 -1
- package/src/engine/sound/volume2dB.js +1 -1
- package/src/engine/ui/DraggableAspect.d.ts +12 -3
- package/src/engine/ui/DraggableAspect.d.ts.map +1 -1
- package/src/engine/ui/DraggableAspect.js +115 -83
- package/src/generation/COORDINATES.md +54 -0
- package/src/generation/GridTaskGroup.js +2 -2
- package/src/generation/REVIEW_01_ACTION_PLAN.md +628 -0
- package/src/generation/automata/CaveGeneratorCellularAutomata.d.ts +9 -1
- package/src/generation/automata/CaveGeneratorCellularAutomata.d.ts.map +1 -1
- package/src/generation/automata/CaveGeneratorCellularAutomata.js +79 -59
- package/src/generation/automata/CellularAutomata.d.ts +6 -3
- package/src/generation/automata/CellularAutomata.d.ts.map +1 -1
- package/src/generation/automata/CellularAutomata.js +22 -19
- package/src/generation/filtering/CellFilter.d.ts +17 -0
- package/src/generation/filtering/CellFilter.d.ts.map +1 -1
- package/src/generation/filtering/CellFilter.js +117 -77
- package/src/generation/filtering/CellFilterCellMatcher.d.ts.map +1 -1
- package/src/generation/filtering/CellFilterCellMatcher.js +2 -0
- package/src/generation/filtering/boolean/CellFilterLiteralBoolean.d.ts +5 -0
- package/src/generation/filtering/boolean/CellFilterLiteralBoolean.d.ts.map +1 -1
- package/src/generation/filtering/boolean/CellFilterLiteralBoolean.js +15 -0
- package/src/generation/filtering/core/CellFilterBinaryOperation.d.ts +0 -1
- package/src/generation/filtering/core/CellFilterBinaryOperation.d.ts.map +1 -1
- package/src/generation/filtering/core/CellFilterBinaryOperation.js +37 -50
- package/src/generation/filtering/core/CellFilterOperationTertiary.d.ts +0 -1
- package/src/generation/filtering/core/CellFilterOperationTertiary.d.ts.map +1 -1
- package/src/generation/filtering/core/CellFilterOperationTertiary.js +43 -59
- package/src/generation/filtering/core/CellFilterUnaryOperation.d.ts +0 -1
- package/src/generation/filtering/core/CellFilterUnaryOperation.d.ts.map +1 -1
- package/src/generation/filtering/core/CellFilterUnaryOperation.js +29 -33
- package/src/generation/filtering/numeric/CellFilterCache.d.ts +1 -0
- package/src/generation/filtering/numeric/CellFilterCache.d.ts.map +1 -1
- package/src/generation/filtering/numeric/complex/CellFilterAngleToNormal.d.ts +3 -2
- package/src/generation/filtering/numeric/complex/CellFilterAngleToNormal.d.ts.map +1 -1
- package/src/generation/filtering/numeric/complex/CellFilterAngleToNormal.js +9 -35
- package/src/generation/filtering/numeric/complex/CellFilterCurvature.d.ts +0 -1
- package/src/generation/filtering/numeric/complex/CellFilterCurvature.d.ts.map +1 -1
- package/src/generation/filtering/numeric/complex/CellFilterCurvature.js +19 -43
- package/src/generation/filtering/numeric/complex/CellFilterFXAA.d.ts +0 -1
- package/src/generation/filtering/numeric/complex/CellFilterFXAA.d.ts.map +1 -1
- package/src/generation/filtering/numeric/complex/CellFilterFXAA.js +2 -6
- package/src/generation/filtering/numeric/complex/CellFilterGaussianBlur.d.ts.map +1 -1
- package/src/generation/filtering/numeric/complex/CellFilterGaussianBlur.js +9 -12
- package/src/generation/filtering/numeric/complex/CellFilterSimplexNoise.d.ts.map +1 -1
- package/src/generation/filtering/numeric/complex/CellFilterSimplexNoise.js +2 -1
- package/src/generation/filtering/numeric/complex/CellFilterSobel.d.ts +0 -1
- package/src/generation/filtering/numeric/complex/CellFilterSobel.d.ts.map +1 -1
- package/src/generation/filtering/numeric/complex/CellFilterSobel.js +2 -6
- package/src/generation/filtering/numeric/math/CellFilterInverseLerp.d.ts +5 -4
- package/src/generation/filtering/numeric/math/CellFilterInverseLerp.d.ts.map +1 -1
- package/src/generation/filtering/numeric/math/CellFilterInverseLerp.js +5 -4
- package/src/generation/filtering/numeric/process/computeFilterSurfaceNormal.d.ts +17 -0
- package/src/generation/filtering/numeric/process/computeFilterSurfaceNormal.d.ts.map +1 -0
- package/src/generation/filtering/numeric/process/computeFilterSurfaceNormal.js +42 -0
- package/src/generation/filtering/numeric/sampling/AbstractCellFilterSampleGridLayer.d.ts.map +1 -1
- package/src/generation/filtering/numeric/sampling/AbstractCellFilterSampleGridLayer.js +7 -1
- package/src/generation/filtering/numeric/util/populateSampler2DFromCellFilter.d.ts.map +1 -1
- package/src/generation/filtering/numeric/util/populateSampler2DFromCellFilter.js +7 -10
- package/src/generation/filtering/numeric/util/sampler_from_filter.d.ts.map +1 -1
- package/src/generation/filtering/numeric/util/sampler_from_filter.js +2 -1
- package/src/generation/grid/GridData.d.ts.map +1 -1
- package/src/generation/grid/GridData.js +14 -1
- package/src/generation/grid/actions/ContinuousGridCellAction.d.ts +10 -3
- package/src/generation/grid/actions/ContinuousGridCellAction.d.ts.map +1 -1
- package/src/generation/grid/actions/ContinuousGridCellAction.js +18 -3
- package/src/generation/grid/actions/ContinuousGridCellActionSetTerrainHeight.d.ts +11 -1
- package/src/generation/grid/actions/ContinuousGridCellActionSetTerrainHeight.d.ts.map +1 -1
- package/src/generation/grid/actions/ContinuousGridCellActionSetTerrainHeight.js +13 -3
- package/src/generation/grid/actions/ContinuousGridCellActionSetTerrainObstacle.d.ts +1 -1
- package/src/generation/grid/actions/ContinuousGridCellActionSetTerrainObstacle.js +2 -2
- package/src/generation/grid/actions/ContinuousGridCellActionWriteObstacle.d.ts +1 -1
- package/src/generation/grid/actions/ContinuousGridCellActionWriteObstacle.d.ts.map +1 -1
- package/src/generation/grid/actions/ContinuousGridCellActionWriteObstacle.js +4 -6
- package/src/generation/grid/coords/grid_to_texel.d.ts +9 -0
- package/src/generation/grid/coords/grid_to_texel.d.ts.map +1 -0
- package/src/generation/grid/coords/grid_to_texel.js +10 -0
- package/src/generation/grid/coords/texel_to_grid.d.ts +9 -0
- package/src/generation/grid/coords/texel_to_grid.d.ts.map +1 -0
- package/src/generation/grid/coords/texel_to_grid.js +10 -0
- package/src/generation/grid/generation/GridTaskApplyActionToCells.d.ts +2 -2
- package/src/generation/grid/generation/GridTaskApplyActionToCells.d.ts.map +1 -1
- package/src/generation/grid/generation/GridTaskApplyActionToCells.js +10 -6
- package/src/generation/grid/generation/GridTaskDensityMarkerDistribution.d.ts.map +1 -1
- package/src/generation/grid/generation/GridTaskDensityMarkerDistribution.js +20 -21
- package/src/generation/grid/generation/GridTaskExecuteRuleTimes.d.ts +7 -0
- package/src/generation/grid/generation/GridTaskExecuteRuleTimes.d.ts.map +1 -1
- package/src/generation/grid/generation/GridTaskExecuteRuleTimes.js +18 -10
- package/src/generation/grid/generation/discrete/GridTaskCellularAutomata.d.ts.map +1 -1
- package/src/generation/grid/generation/discrete/GridTaskCellularAutomata.js +16 -7
- package/src/generation/grid/generation/discrete/GridTaskConnectRooms.d.ts +5 -3
- package/src/generation/grid/generation/discrete/GridTaskConnectRooms.d.ts.map +1 -1
- package/src/generation/grid/generation/discrete/GridTaskConnectRooms.js +26 -23
- package/src/generation/grid/generation/discrete/layer/GridTaskBuildSourceDistanceMap.d.ts.map +1 -1
- package/src/generation/grid/generation/discrete/layer/GridTaskBuildSourceDistanceMap.js +10 -1
- package/src/generation/grid/generation/grid/select/CellSupplierBestN.d.ts.map +1 -1
- package/src/generation/grid/generation/grid/select/CellSupplierBestN.js +4 -0
- package/src/generation/grid/generation/road/GridTaskGenerateRoads.d.ts +15 -8
- package/src/generation/grid/generation/road/GridTaskGenerateRoads.d.ts.map +1 -1
- package/src/generation/grid/generation/road/GridTaskGenerateRoads.js +89 -92
- package/src/generation/markers/GridActionRuleSet.d.ts.map +1 -1
- package/src/generation/markers/GridActionRuleSet.js +10 -2
- package/src/generation/markers/GridCellActionPlaceMarker.d.ts +11 -0
- package/src/generation/markers/GridCellActionPlaceMarker.d.ts.map +1 -1
- package/src/generation/markers/GridCellActionPlaceMarker.js +20 -3
- package/src/generation/markers/GridCellActionPlaceMarkerGroup.d.ts +3 -1
- package/src/generation/markers/GridCellActionPlaceMarkerGroup.d.ts.map +1 -1
- package/src/generation/markers/GridCellActionPlaceMarkerGroup.js +9 -2
- package/src/generation/markers/MarkerNode.d.ts +8 -3
- package/src/generation/markers/MarkerNode.d.ts.map +1 -1
- package/src/generation/markers/MarkerNode.js +12 -5
- package/src/generation/markers/actions/MarkerNodeActionEntityPlacement.js +1 -1
- package/src/generation/markers/actions/placement/MarkerNodeEntityProcessor.d.ts +1 -1
- package/src/generation/markers/actions/placement/MarkerNodeEntityProcessor.d.ts.map +1 -1
- package/src/generation/markers/actions/placement/MarkerNodeEntityProcessor.js +1 -1
- package/src/generation/markers/actions/placement/MarkerNodeEntityProcessorClingToTerrain.d.ts +1 -1
- package/src/generation/markers/actions/placement/MarkerNodeEntityProcessorClingToTerrain.d.ts.map +1 -1
- package/src/generation/markers/actions/placement/MarkerNodeEntityProcessorClingToTerrain.js +1 -1
- package/src/generation/markers/actions/placement/MarkerNodeEntityProcessorRandomRotation.d.ts +1 -1
- package/src/generation/markers/actions/placement/MarkerNodeEntityProcessorRandomRotation.d.ts.map +1 -1
- package/src/generation/markers/actions/placement/MarkerNodeEntityProcessorRandomRotation.js +2 -2
- package/src/generation/markers/actions/placement/MarkerNodeEntityProcessorSequence.d.ts +1 -1
- package/src/generation/markers/actions/placement/MarkerNodeEntityProcessorSequence.d.ts.map +1 -1
- package/src/generation/markers/actions/placement/MarkerNodeEntityProcessorSequence.js +2 -2
- package/src/generation/markers/actions/probability/MarkerNodeActionSelectWeighted.d.ts.map +1 -1
- package/src/generation/markers/actions/probability/MarkerNodeActionSelectWeighted.js +6 -4
- package/src/generation/markers/actions/probability/MarkerNodeActionWeightedElement.d.ts.map +1 -1
- package/src/generation/markers/actions/probability/MarkerNodeActionWeightedElement.js +1 -3
- package/src/generation/markers/actions/terrain/MarkerNodeActionPaintTerrain.d.ts.map +1 -1
- package/src/generation/markers/actions/terrain/MarkerNodeActionPaintTerrain.js +12 -11
- package/src/generation/markers/matcher/MarkerNodeMatcherAnd.js +2 -2
- package/src/generation/markers/transform/MarkerNodeTransformer.d.ts +4 -1
- package/src/generation/markers/transform/MarkerNodeTransformer.d.ts.map +1 -1
- package/src/generation/markers/transform/MarkerNodeTransformer.js +4 -1
- package/src/generation/markers/transform/MarkerNodeTransformerAddPositionYFromFilter.d.ts.map +1 -1
- package/src/generation/markers/transform/MarkerNodeTransformerAddPositionYFromFilter.js +1 -3
- package/src/generation/markers/transform/MarkerNodeTransformerOffsetPosition.d.ts +5 -0
- package/src/generation/markers/transform/MarkerNodeTransformerOffsetPosition.d.ts.map +1 -1
- package/src/generation/markers/transform/MarkerNodeTransformerOffsetPosition.js +15 -0
- package/src/generation/markers/transform/MarkerNodeTransformerRecordProperty.d.ts.map +1 -1
- package/src/generation/markers/transform/MarkerNodeTransformerRecordProperty.js +1 -3
- package/src/generation/markers/transform/MarkerNodeTransformerYRotateByFilter.d.ts.map +1 -1
- package/src/generation/markers/transform/MarkerNodeTransformerYRotateByFilter.js +2 -4
- package/src/generation/markers/transform/MarkerNodeTransformerYRotateByFilterGradient.d.ts.map +1 -1
- package/src/generation/markers/transform/MarkerNodeTransformerYRotateByFilterGradient.js +1 -3
- package/src/generation/placement/GridCellPlacementRule.d.ts.map +1 -1
- package/src/generation/placement/GridCellPlacementRule.js +1 -3
- package/src/generation/placement/action/GridCellActionWriteFilterToLayer.d.ts.map +1 -1
- package/src/generation/placement/action/GridCellActionWriteFilterToLayer.js +8 -10
- package/src/generation/placement/action/random/weighted/CellActionSelectWeightedRandom.d.ts.map +1 -1
- package/src/generation/placement/action/random/weighted/CellActionSelectWeightedRandom.js +6 -4
- package/src/generation/placement/action/random/weighted/WeightedGridCellAction.d.ts.map +1 -1
- package/src/generation/placement/action/random/weighted/WeightedGridCellAction.js +1 -3
- package/src/generation/rules/CellMatcher.d.ts +3 -1
- package/src/generation/rules/CellMatcher.d.ts.map +1 -1
- package/src/generation/rules/CellMatcher.js +3 -1
- package/src/generation/rules/CellMatcherFromFilter.d.ts.map +1 -1
- package/src/generation/rules/CellMatcherFromFilter.js +1 -3
- package/src/generation/rules/CellMatcherLayerBitMaskTest.d.ts.map +1 -1
- package/src/generation/rules/CellMatcherLayerBitMaskTest.js +6 -20
- package/src/generation/test_support/executeTaskTreeSync.d.ts +9 -0
- package/src/generation/test_support/executeTaskTreeSync.d.ts.map +1 -0
- package/src/generation/test_support/executeTaskTreeSync.js +78 -0
- package/src/generation/theme/TerrainLayerRuleAggregator.d.ts +2 -1
- package/src/generation/theme/TerrainLayerRuleAggregator.d.ts.map +1 -1
- package/src/generation/theme/TerrainLayerRuleAggregator.js +9 -6
- package/src/generation/theme/Theme.d.ts +1 -1
- package/src/generation/theme/Theme.d.ts.map +1 -1
- package/src/generation/theme/Theme.js +2 -2
- package/src/generation/theme/ThemeEngine.d.ts +3 -3
- package/src/generation/theme/ThemeEngine.d.ts.map +1 -1
- package/src/generation/theme/ThemeEngine.js +26 -16
- package/src/generation/theme/cell/CellProcessingRule.d.ts +3 -3
- package/src/generation/theme/cell/CellProcessingRule.d.ts.map +1 -1
- package/src/generation/theme/cell/CellProcessingRule.js +6 -10
- package/src/generation/theme/cell/CellProcessingRuleSet.d.ts +1 -1
- package/src/generation/theme/cell/CellProcessingRuleSet.d.ts.map +1 -1
- package/src/generation/theme/cell/CellProcessingRuleSet.js +2 -2
- package/src/view/common/ListView.js +1 -1
- package/src/view/elements/BottomLeftResizeHandleView.d.ts.map +1 -1
- package/src/view/elements/BottomLeftResizeHandleView.js +13 -5
- package/src/core/font/FontAsset.d.ts.map +0 -1
- package/src/core/font/FontAssetLoader.d.ts.map +0 -1
- package/src/core/geom/3d/shape/util/shape_to_visual_entity.d.ts.map +0 -1
- package/src/core/geom/3d/tetrahedra/visualize_tetrahedral_mesh.d.ts.map +0 -1
- package/src/core/process/action/AsynchronousDelayAction.d.ts.map +0 -1
- package/src/engine/graphics/sh3/path_tracer/sampling/v3_orthonormal_matrix_from_normal.d.ts.map +0 -1
- package/src/engine/physics/computeInterceptPoint.d.ts.map +0 -1
- package/src/engine/physics/fluid/solver/optimal_sor_omega.d.ts.map +0 -1
- package/src/engine/physics/gjk/gjk.d.ts.map +0 -1
- package/src/engine/physics/gjk/gjk_epa_penetration.d.ts.map +0 -1
- package/src/engine/physics/gjk/minkowski_support.d.ts.map +0 -1
- package/src/engine/physics/gjk/mpr.d.ts.map +0 -1
- package/src/engine/physics/integration/quat_integrate.d.ts.map +0 -1
- package/src/engine/physics/island/union_find.d.ts.map +0 -1
- package/src/engine/physics/narrowphase/clip_against_axis_uv.d.ts.map +0 -1
- package/src/engine/physics/narrowphase/decomposition/aabb_world_to_local.d.ts.map +0 -1
- package/src/engine/physics/narrowphase/ray_shapes.d.ts +0 -66
- package/src/engine/physics/narrowphase/ray_shapes.d.ts.map +0 -1
- package/src/engine/physics/narrowphase/ray_shapes.js +0 -187
- package/src/engine/sound/ecs/emitter/SoundEmitterChannel.d.ts +0 -23
- package/src/engine/sound/ecs/emitter/SoundEmitterChannel.d.ts.map +0 -1
- package/src/engine/sound/ecs/emitter/SoundEmitterChannel.js +0 -32
- package/src/engine/sound/ecs/emitter/SoundTrackNodes.d.ts +0 -18
- package/src/engine/sound/ecs/emitter/SoundTrackNodes.d.ts.map +0 -1
- package/src/engine/sound/ecs/emitter/SoundTrackNodes.js +0 -18
- package/src/engine/sound/sopra/AbstractAudioClip.d.ts +0 -26
- package/src/engine/sound/sopra/AbstractAudioClip.d.ts.map +0 -1
- package/src/engine/sound/sopra/AbstractAudioClip.js +0 -29
- package/src/engine/sound/sopra/ContainerAudioClip.d.ts +0 -12
- package/src/engine/sound/sopra/ContainerAudioClip.d.ts.map +0 -1
- package/src/engine/sound/sopra/ContainerAudioClip.js +0 -13
- package/src/engine/sound/sopra/RandomContainerAudioClip.d.ts +0 -12
- package/src/engine/sound/sopra/RandomContainerAudioClip.d.ts.map +0 -1
- package/src/engine/sound/sopra/RandomContainerAudioClip.js +0 -15
- package/src/engine/sound/sopra/SequenceContainerAudioClip.d.ts +0 -7
- package/src/engine/sound/sopra/SequenceContainerAudioClip.d.ts.map +0 -1
- package/src/engine/sound/sopra/SequenceContainerAudioClip.js +0 -8
- package/src/engine/sound/sopra/SilenceAudioClip.d.ts +0 -13
- package/src/engine/sound/sopra/SilenceAudioClip.d.ts.map +0 -1
- package/src/engine/sound/sopra/SilenceAudioClip.js +0 -15
- package/src/generation/grid/generation/discrete/layer/GridTaskDistanceToMarkers.d.ts +0 -21
- package/src/generation/grid/generation/discrete/layer/GridTaskDistanceToMarkers.d.ts.map +0 -1
- package/src/generation/grid/generation/discrete/layer/GridTaskDistanceToMarkers.js +0 -68
- package/src/generation/grid/generation/grid/GridTaskGridAlignedNodeGenerator.d.ts +0 -10
- package/src/generation/grid/generation/grid/GridTaskGridAlignedNodeGenerator.d.ts.map +0 -1
- package/src/generation/grid/generation/grid/GridTaskGridAlignedNodeGenerator.js +0 -17
- /package/src/{engine/physics → core/geom/3d}/gjk/NOTES.md +0 -0
- /package/src/{engine/physics → core/geom/3d}/gjk/gjk.d.ts +0 -0
- /package/src/{engine/graphics/sh3/path_tracer/sampling → core/geom/vec3}/v3_orthonormal_matrix_from_normal.d.ts +0 -0
- /package/src/{engine/physics → core/math/physics/kinematics}/computeInterceptPoint.d.ts +0 -0
|
@@ -1,1045 +1,1411 @@
|
|
|
1
|
-
import { assert } from "../../core/assert.js";
|
|
2
|
-
import { array_push_if_unique } from "../../core/collection/array/array_push_if_unique.js";
|
|
3
|
-
import { array_remove_first } from "../../core/collection/array/array_remove_first.js";
|
|
4
|
-
import BinaryHeap from "../../core/collection/heap/BinaryHeap.js";
|
|
5
|
-
import { HashMap } from "../../core/collection/map/HashMap.js";
|
|
6
|
-
import { ObservedMap } from "../../core/collection/map/ObservedMap.js";
|
|
7
|
-
import { Deque } from "../../core/collection/queue/Deque.js";
|
|
8
|
-
import { HashSet } from "../../core/collection/set/HashSet.js";
|
|
9
|
-
import { noop } from "../../core/function/noop.js";
|
|
10
|
-
import ConcurrentExecutor from "../../core/process/executor/ConcurrentExecutor.js";
|
|
11
|
-
import Task from "../../core/process/task/Task.js";
|
|
12
|
-
import { TaskSignal } from "../../core/process/task/TaskSignal.js";
|
|
13
|
-
import { AssetDescription } from "./AssetDescription.js";
|
|
14
|
-
import { AssetLoadState } from "./AssetLoadState.js";
|
|
15
|
-
import { AssetRequest, AssetRequestFlags } from "./AssetRequest.js";
|
|
16
|
-
import { AssetRequestScope } from "./AssetRequestScope.js";
|
|
17
|
-
import { CrossOriginConfig } from "./CORS/CrossOriginConfig.js";
|
|
18
|
-
import { AssetLoader } from "./loaders/AssetLoader.js";
|
|
19
|
-
import { PendingAsset } from "./PendingAsset.js";
|
|
20
|
-
import { extractAssetListFromManager } from "./preloader/extractAssetListFromManager.js";
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
class Response {
|
|
24
|
-
/**
|
|
25
|
-
*
|
|
26
|
-
* @param {
|
|
27
|
-
* @param {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
*
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
*
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
*
|
|
99
|
-
*
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
*
|
|
112
|
-
*
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
*
|
|
125
|
-
* @
|
|
126
|
-
*/
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
/**
|
|
130
|
-
*
|
|
131
|
-
* @
|
|
132
|
-
* @
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
*
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
*
|
|
146
|
-
* @
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
*
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
if (
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
*
|
|
244
|
-
*/
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
*
|
|
256
|
-
* @
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
*
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
*
|
|
447
|
-
*
|
|
448
|
-
*
|
|
449
|
-
* @
|
|
450
|
-
* @param {
|
|
451
|
-
* @param {
|
|
452
|
-
* @param {
|
|
453
|
-
*/
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
*
|
|
519
|
-
*
|
|
520
|
-
* @
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
/**
|
|
531
|
-
*
|
|
532
|
-
* @
|
|
533
|
-
* @
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
*
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
*
|
|
574
|
-
*
|
|
575
|
-
*
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
const
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
}
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
try {
|
|
711
|
-
|
|
712
|
-
} catch (e) {
|
|
713
|
-
console.error(
|
|
714
|
-
}
|
|
715
|
-
}
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
*
|
|
819
|
-
* @
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
return
|
|
1009
|
-
}
|
|
1010
|
-
|
|
1011
|
-
/**
|
|
1012
|
-
*
|
|
1013
|
-
* @param {
|
|
1014
|
-
* @
|
|
1015
|
-
*/
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1
|
+
import { assert } from "../../core/assert.js";
|
|
2
|
+
import { array_push_if_unique } from "../../core/collection/array/array_push_if_unique.js";
|
|
3
|
+
import { array_remove_first } from "../../core/collection/array/array_remove_first.js";
|
|
4
|
+
import BinaryHeap from "../../core/collection/heap/BinaryHeap.js";
|
|
5
|
+
import { HashMap } from "../../core/collection/map/HashMap.js";
|
|
6
|
+
import { ObservedMap } from "../../core/collection/map/ObservedMap.js";
|
|
7
|
+
import { Deque } from "../../core/collection/queue/Deque.js";
|
|
8
|
+
import { HashSet } from "../../core/collection/set/HashSet.js";
|
|
9
|
+
import { noop } from "../../core/function/noop.js";
|
|
10
|
+
import ConcurrentExecutor from "../../core/process/executor/ConcurrentExecutor.js";
|
|
11
|
+
import Task from "../../core/process/task/Task.js";
|
|
12
|
+
import { TaskSignal } from "../../core/process/task/TaskSignal.js";
|
|
13
|
+
import { AssetDescription } from "./AssetDescription.js";
|
|
14
|
+
import { AssetLoadState } from "./AssetLoadState.js";
|
|
15
|
+
import { AssetRequest, AssetRequestFlags } from "./AssetRequest.js";
|
|
16
|
+
import { AssetRequestScope } from "./AssetRequestScope.js";
|
|
17
|
+
import { CrossOriginConfig } from "./CORS/CrossOriginConfig.js";
|
|
18
|
+
import { AssetLoader } from "./loaders/AssetLoader.js";
|
|
19
|
+
import { PendingAsset } from "./PendingAsset.js";
|
|
20
|
+
import { extractAssetListFromManager } from "./preloader/extractAssetListFromManager.js";
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
class Response {
|
|
24
|
+
/**
|
|
25
|
+
*
|
|
26
|
+
* @param {AssetRequest} request
|
|
27
|
+
* @param {Asset|*} value loaded asset when success is true, error otherwise
|
|
28
|
+
* @param {boolean} success
|
|
29
|
+
* @param {AssetDescription} description
|
|
30
|
+
*/
|
|
31
|
+
constructor(request, value, success, description) {
|
|
32
|
+
this.request = request;
|
|
33
|
+
this.value = value;
|
|
34
|
+
this.success = success;
|
|
35
|
+
this.description = description;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Used by the priority queue, so the priority is inverted as the BinaryHeap returns elements in ascending score order (from lowest)
|
|
41
|
+
* @param {PendingAsset} pending_asset
|
|
42
|
+
* @returns {number}
|
|
43
|
+
*/
|
|
44
|
+
function get_pending_asset_priority_score(pending_asset) {
|
|
45
|
+
return -pending_asset.priority;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
// TODO handle 429 HTTP error gracefully
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Handles loading/generating assets
|
|
53
|
+
* @template CTX
|
|
54
|
+
* @class
|
|
55
|
+
*/
|
|
56
|
+
export class AssetManager {
|
|
57
|
+
/**
|
|
58
|
+
*
|
|
59
|
+
* @type {HashMap<AssetDescription, Asset>}
|
|
60
|
+
* @private
|
|
61
|
+
*/
|
|
62
|
+
assets = new HashMap({
|
|
63
|
+
capacity: 1024
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
*
|
|
68
|
+
* @type {ObservedMap<AssetDescription, PendingAsset>}
|
|
69
|
+
*/
|
|
70
|
+
request_map = new ObservedMap(new HashMap());
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Waiting queue for assets that haven't yet been scheduled (passed to relevant loader)
|
|
74
|
+
* @type {BinaryHeap<PendingAsset>}
|
|
75
|
+
* @private
|
|
76
|
+
*/
|
|
77
|
+
#pending_asset_wait_queue = new BinaryHeap(get_pending_asset_priority_score);
|
|
78
|
+
/**
|
|
79
|
+
* Assets currently being processed by #loaders
|
|
80
|
+
* @type {Set<PendingAsset>}
|
|
81
|
+
* @private
|
|
82
|
+
*/
|
|
83
|
+
#pending_asset_active_load_set = new Set();
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Dispatch scopes of loads that are currently in flight. A request whose scope chain reaches
|
|
87
|
+
* one of these was made by a loader as part of that load (a nested request).
|
|
88
|
+
* @type {Map<AssetRequestScope, PendingAsset>}
|
|
89
|
+
* @private
|
|
90
|
+
*/
|
|
91
|
+
#active_load_scopes = new Map();
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* Maximum number of top-level requests that can be handled at the same time.
|
|
95
|
+
* Since most of the requests are handled over the network, this can help you control network concurrency,
|
|
96
|
+
* this can be useful to keep some network slots available for high-priority requests such as UI related ones.
|
|
97
|
+
* Nested requests (made by a loader while servicing another load) are dispatched immediately and never wait
|
|
98
|
+
* on this limit: their parent occupies a slot until they resolve, so queueing them would deadlock.
|
|
99
|
+
* @type {number}
|
|
100
|
+
*/
|
|
101
|
+
load_concurrency = Infinity;
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* Registered asset loaders
|
|
105
|
+
* @private
|
|
106
|
+
* @type {Object<AssetLoader>}
|
|
107
|
+
*/
|
|
108
|
+
#loaders = {};
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* After an asset is loaded, a chain of transforms can be applied to it, these are registered here
|
|
112
|
+
* Transformers are executed in the order in which they are added
|
|
113
|
+
* Identified by asset "type" string
|
|
114
|
+
* @type {Object<AssetTransformer[]>}
|
|
115
|
+
* @private
|
|
116
|
+
*/
|
|
117
|
+
#transformers = {};
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* Named links to specific assets. Useful to later re-mapping assets and having meaningful names for them
|
|
121
|
+
* @type {Map<string, AssetDescription>}
|
|
122
|
+
* @private
|
|
123
|
+
* @see resolveAlias
|
|
124
|
+
* @see assignAlias
|
|
125
|
+
* @see promiseByAlias
|
|
126
|
+
*/
|
|
127
|
+
#aliases = new Map();
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* This will be added to asset path for actual network resolution.
|
|
131
|
+
* Paths exchanged with the manager ({@link get}, {@link promise}, cache keys) are never prefixed;
|
|
132
|
+
* loaders apply the prefix at the fetch boundary via {@link resolveNetworkPath}.
|
|
133
|
+
* @type {string}
|
|
134
|
+
* @private
|
|
135
|
+
*/
|
|
136
|
+
rootPath = '';
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
*
|
|
140
|
+
* @type {CrossOriginConfig}
|
|
141
|
+
*/
|
|
142
|
+
crossOriginConfig = new CrossOriginConfig();
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* Descriptions of assets whose most recent load attempt failed.
|
|
146
|
+
* Purely advisory (see {@link isFailed}); a new {@link get} for a failed asset will retry the load.
|
|
147
|
+
* @type {HashSet<AssetDescription>}
|
|
148
|
+
* @private
|
|
149
|
+
*/
|
|
150
|
+
#failures = new HashSet();
|
|
151
|
+
|
|
152
|
+
/**
|
|
153
|
+
* Queue of responses that are waiting to be dispatched
|
|
154
|
+
* @type {Deque<Response>}
|
|
155
|
+
* @private
|
|
156
|
+
*/
|
|
157
|
+
#response_queue = new Deque();
|
|
158
|
+
|
|
159
|
+
/**
|
|
160
|
+
* Resolvers of {@link shutdown} calls that are waiting for outstanding work to finish
|
|
161
|
+
* @type {function[]}
|
|
162
|
+
* @private
|
|
163
|
+
*/
|
|
164
|
+
#drain_waiters = [];
|
|
165
|
+
|
|
166
|
+
/**
|
|
167
|
+
* Delivers queued responses. Ends as soon as the queue is drained and is re-scheduled by
|
|
168
|
+
* {@link #wake_response_processor} when a new response is enqueued, so an idle manager keeps
|
|
169
|
+
* no task on the executor and the executor itself can go fully idle.
|
|
170
|
+
* @type {Task}
|
|
171
|
+
* @private
|
|
172
|
+
*/
|
|
173
|
+
#response_processor = new Task({
|
|
174
|
+
name: "Asset Manager Response processor",
|
|
175
|
+
cycleFunction: () => {
|
|
176
|
+
if (this.#response_queue.isEmpty()) {
|
|
177
|
+
this.#flush_drain_waiters();
|
|
178
|
+
|
|
179
|
+
return TaskSignal.EndSuccess;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
const response = this.#response_queue.removeFirst();
|
|
183
|
+
|
|
184
|
+
this.#process_response(response);
|
|
185
|
+
|
|
186
|
+
return TaskSignal.Continue;
|
|
187
|
+
}
|
|
188
|
+
});
|
|
189
|
+
|
|
190
|
+
/**
|
|
191
|
+
* True when a wake of {@link #response_processor} is already sitting on the microtask queue
|
|
192
|
+
* @type {boolean}
|
|
193
|
+
* @private
|
|
194
|
+
*/
|
|
195
|
+
#wake_queued = false;
|
|
196
|
+
|
|
197
|
+
/**
|
|
198
|
+
* Deferred half of {@link #wake_response_processor}. By the time the microtask fires the world
|
|
199
|
+
* may have changed (manager shut down, queue already drained, processor already scheduled), so
|
|
200
|
+
* every condition is re-checked here.
|
|
201
|
+
*/
|
|
202
|
+
#wake = () => {
|
|
203
|
+
this.#wake_queued = false;
|
|
204
|
+
|
|
205
|
+
if (!this.#is_running) {
|
|
206
|
+
// shut down before the wake fired; #abort_outstanding has already delivered the queue
|
|
207
|
+
return;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
if (this.#response_queue.isEmpty()) {
|
|
211
|
+
// queue was drained before the wake fired
|
|
212
|
+
return;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
if (this.#executor.contains(this.#response_processor)) {
|
|
216
|
+
// processor is already scheduled and will drain the queue
|
|
217
|
+
return;
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
this.#executor.run(this.#response_processor);
|
|
221
|
+
};
|
|
222
|
+
|
|
223
|
+
/**
|
|
224
|
+
* Schedules {@link #response_processor} to run. Deferred via the microtask queue: responses are
|
|
225
|
+
* enqueued from inside {@link #settle} (e.g. by {@link insert} or a loader callback), and
|
|
226
|
+
* {@link ConcurrentExecutor#run} executes a time slice synchronously — waking the processor
|
|
227
|
+
* directly would deliver requester callbacks synchronously to whoever caused the settle.
|
|
228
|
+
* @private
|
|
229
|
+
*/
|
|
230
|
+
#wake_response_processor() {
|
|
231
|
+
if (this.#wake_queued) {
|
|
232
|
+
return;
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
this.#wake_queued = true;
|
|
236
|
+
|
|
237
|
+
queueMicrotask(this.#wake);
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
/**
|
|
241
|
+
*
|
|
242
|
+
* @type {boolean}
|
|
243
|
+
* @private
|
|
244
|
+
*/
|
|
245
|
+
#is_running = false;
|
|
246
|
+
|
|
247
|
+
/**
|
|
248
|
+
*
|
|
249
|
+
* @type {CTX|null}
|
|
250
|
+
* @private
|
|
251
|
+
*/
|
|
252
|
+
#context = null;
|
|
253
|
+
|
|
254
|
+
/**
|
|
255
|
+
*
|
|
256
|
+
* @type {ConcurrentExecutor|null}
|
|
257
|
+
*/
|
|
258
|
+
#executor = null;
|
|
259
|
+
|
|
260
|
+
/**
|
|
261
|
+
*
|
|
262
|
+
* @param {CTX} context
|
|
263
|
+
* @param {ConcurrentExecutor} executor
|
|
264
|
+
* @constructor
|
|
265
|
+
*/
|
|
266
|
+
constructor({
|
|
267
|
+
context,
|
|
268
|
+
executor = new ConcurrentExecutor()
|
|
269
|
+
} = {}) {
|
|
270
|
+
|
|
271
|
+
this.#context = context;
|
|
272
|
+
this.#executor = executor;
|
|
273
|
+
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
startup() {
|
|
277
|
+
if (this.#is_running) {
|
|
278
|
+
return;
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
this.#is_running = true;
|
|
282
|
+
|
|
283
|
+
// deliver anything that was enqueued before startup
|
|
284
|
+
if (!this.#response_queue.isEmpty()) {
|
|
285
|
+
this.#wake_response_processor();
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
/**
|
|
290
|
+
*
|
|
291
|
+
* @param {boolean} [immediate] should we let pending work finish, or shut down immediately?
|
|
292
|
+
* Defaults to false (wait until all in-flight requests are resolved and all responses are delivered).
|
|
293
|
+
* When true, outstanding requests are failed and all responses are delivered before the method returns.
|
|
294
|
+
* @return {Promise<void>}
|
|
295
|
+
*/
|
|
296
|
+
async shutdown(immediate = false) {
|
|
297
|
+
if (!this.#is_running) {
|
|
298
|
+
return;
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
if (!immediate) {
|
|
302
|
+
await this.#drain();
|
|
303
|
+
} else {
|
|
304
|
+
this.#abort_outstanding();
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
this.#executor.removeTask(this.#response_processor);
|
|
308
|
+
|
|
309
|
+
this.#is_running = false;
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
/**
|
|
313
|
+
* Fail every outstanding request and deliver all queued responses synchronously.
|
|
314
|
+
* In-flight loaders keep running, but their late resolutions will be dropped by the claim guard.
|
|
315
|
+
* @private
|
|
316
|
+
*/
|
|
317
|
+
#abort_outstanding() {
|
|
318
|
+
// empty the wait queue first, otherwise settling an active load would pop and dispatch queued ones
|
|
319
|
+
const queue = this.#pending_asset_wait_queue;
|
|
320
|
+
|
|
321
|
+
while (!queue.isEmpty()) {
|
|
322
|
+
queue.pop();
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
/**
|
|
326
|
+
* @type {PendingAsset[]}
|
|
327
|
+
*/
|
|
328
|
+
const outstanding = [];
|
|
329
|
+
|
|
330
|
+
this.request_map.forEach(pending => outstanding.push(pending));
|
|
331
|
+
|
|
332
|
+
if (outstanding.length > 0) {
|
|
333
|
+
const error = new Error('AssetManager was shut down before the asset resolved');
|
|
334
|
+
|
|
335
|
+
for (let i = 0; i < outstanding.length; i++) {
|
|
336
|
+
const pending = outstanding[i];
|
|
337
|
+
|
|
338
|
+
pending.resolution_claimed = true;
|
|
339
|
+
this.#settle(pending, AssetLoadState.Failed, error);
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
// the response processor is about to be removed, deliver everything now
|
|
344
|
+
while (!this.#response_queue.isEmpty()) {
|
|
345
|
+
this.#process_response(this.#response_queue.removeFirst());
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
// a graceful shutdown() may still be waiting on the drain
|
|
349
|
+
this.#flush_drain_waiters();
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
/**
|
|
353
|
+
* Resolves once there are no in-flight requests and no undelivered responses.
|
|
354
|
+
* @returns {Promise<void>}
|
|
355
|
+
* @private
|
|
356
|
+
*/
|
|
357
|
+
#drain() {
|
|
358
|
+
if (this.#response_queue.isEmpty() && this.request_map.size === 0) {
|
|
359
|
+
return Promise.resolve();
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
return new Promise(resolve => this.#drain_waiters.push(resolve));
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
/**
|
|
366
|
+
* @private
|
|
367
|
+
*/
|
|
368
|
+
#flush_drain_waiters() {
|
|
369
|
+
if (this.#drain_waiters.length === 0) {
|
|
370
|
+
return;
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
if (!this.#response_queue.isEmpty() || this.request_map.size > 0) {
|
|
374
|
+
// still busy
|
|
375
|
+
return;
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
const waiters = this.#drain_waiters;
|
|
379
|
+
this.#drain_waiters = [];
|
|
380
|
+
|
|
381
|
+
for (let i = 0; i < waiters.length; i++) {
|
|
382
|
+
waiters[i]();
|
|
383
|
+
}
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
/**
|
|
387
|
+
* Resolves a caller-facing asset path to the path used for actual network retrieval.
|
|
388
|
+
* Loaders that fetch over the network should apply this at the fetch boundary; paths passed to
|
|
389
|
+
* {@link get}/{@link promise} (including nested requests made by loaders) always stay un-prefixed,
|
|
390
|
+
* so they are keyed consistently in the cache.
|
|
391
|
+
* @param {string} path
|
|
392
|
+
* @returns {string}
|
|
393
|
+
*/
|
|
394
|
+
resolveNetworkPath(path) {
|
|
395
|
+
return this.rootPath + path;
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
/**
|
|
399
|
+
* Remove asset if it is loaded, does nothing otherwise
|
|
400
|
+
* @param {String} path
|
|
401
|
+
* @param {String} type
|
|
402
|
+
* @returns {boolean} true if asset was removed, else otherwise
|
|
403
|
+
*/
|
|
404
|
+
remove(path, type) {
|
|
405
|
+
|
|
406
|
+
const assetDescription = new AssetDescription(path, type);
|
|
407
|
+
|
|
408
|
+
return this.assets.delete(assetDescription);
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
/**
|
|
412
|
+
* Clear out all loaded assets
|
|
413
|
+
*/
|
|
414
|
+
clear() {
|
|
415
|
+
this.assets.clear();
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
dumpLoadedAssetList() {
|
|
419
|
+
return JSON.stringify(extractAssetListFromManager(this), null, 3);
|
|
420
|
+
}
|
|
421
|
+
|
|
422
|
+
/**
|
|
423
|
+
* @param {String} path
|
|
424
|
+
* @param {String} type
|
|
425
|
+
* @param {AssetRequestScope} [scope]
|
|
426
|
+
* @param {boolean} [skip_queue] if true will skip the queue and dispatch request immediately
|
|
427
|
+
* @param {function(loaded:number, total:number)} [progress]
|
|
428
|
+
* @returns {Promise<Asset>}
|
|
429
|
+
*/
|
|
430
|
+
promise(path, type, { scope, skip_queue = false, progress } = {}) {
|
|
431
|
+
return new Promise((resolve, reject) => {
|
|
432
|
+
this.get({
|
|
433
|
+
path,
|
|
434
|
+
type,
|
|
435
|
+
callback: resolve,
|
|
436
|
+
failure: reject,
|
|
437
|
+
progress,
|
|
438
|
+
skip_queue,
|
|
439
|
+
scope
|
|
440
|
+
});
|
|
441
|
+
});
|
|
442
|
+
}
|
|
443
|
+
|
|
444
|
+
/**
|
|
445
|
+
* @template T
|
|
446
|
+
* @param {String} path
|
|
447
|
+
* @param {String} type
|
|
448
|
+
* @param {function(asset:Asset<T>)} [callback] success callback
|
|
449
|
+
* @param {function(reason:*)} [failure]
|
|
450
|
+
* @param {function(loaded:number, total:number)} [progress]
|
|
451
|
+
* @param {boolean} [skip_queue]
|
|
452
|
+
* @param {AssetRequestScope} [scope]
|
|
453
|
+
*/
|
|
454
|
+
get({
|
|
455
|
+
path,
|
|
456
|
+
type,
|
|
457
|
+
callback = noop,
|
|
458
|
+
failure = console.error,
|
|
459
|
+
progress = noop,
|
|
460
|
+
skip_queue = false,
|
|
461
|
+
scope = null
|
|
462
|
+
}) {
|
|
463
|
+
|
|
464
|
+
if (typeof path !== "string") {
|
|
465
|
+
throw new TypeError(`Path must be string. instead was '${typeof path}'`);
|
|
466
|
+
}
|
|
467
|
+
|
|
468
|
+
if (typeof type !== "string") {
|
|
469
|
+
throw new TypeError(`type must be a string, instead was '${typeof type}'`);
|
|
470
|
+
}
|
|
471
|
+
|
|
472
|
+
assert.isFunction(callback, 'success');
|
|
473
|
+
assert.isFunction(failure, 'failure');
|
|
474
|
+
assert.isFunction(progress, 'progress');
|
|
475
|
+
|
|
476
|
+
const assetDescription = new AssetDescription(path, type);
|
|
477
|
+
|
|
478
|
+
// requests made from inside an active load are recorded as dependencies of that load
|
|
479
|
+
const parent_pending = this.#find_enclosing_load(scope);
|
|
480
|
+
|
|
481
|
+
if (parent_pending !== null) {
|
|
482
|
+
parent_pending.addChild(assetDescription);
|
|
483
|
+
}
|
|
484
|
+
|
|
485
|
+
const asset = this.assets.get(assetDescription);
|
|
486
|
+
|
|
487
|
+
if (asset !== undefined) {
|
|
488
|
+
|
|
489
|
+
// already exists, dispatch callback immediately
|
|
490
|
+
callback(asset);
|
|
491
|
+
|
|
492
|
+
return;
|
|
493
|
+
}
|
|
494
|
+
|
|
495
|
+
// a request for an asset that is an ancestor of this request can never resolve
|
|
496
|
+
const cycle = this.#find_request_cycle(scope, assetDescription);
|
|
497
|
+
|
|
498
|
+
if (cycle !== null) {
|
|
499
|
+
const request = new AssetRequest(callback, failure, progress);
|
|
500
|
+
|
|
501
|
+
this.#schedule_response(request, new Error(`Cyclic asset request: ${cycle}`), false, assetDescription);
|
|
502
|
+
|
|
503
|
+
return;
|
|
504
|
+
}
|
|
505
|
+
|
|
506
|
+
//create request object
|
|
507
|
+
const assetRequest = new AssetRequest(callback, failure, progress);
|
|
508
|
+
|
|
509
|
+
assetRequest.scope = scope;
|
|
510
|
+
assetRequest.writeFlag(AssetRequestFlags.SkipQueue, skip_queue);
|
|
511
|
+
|
|
512
|
+
//submit request
|
|
513
|
+
this.submitRequest(assetDescription, assetRequest, parent_pending);
|
|
514
|
+
}
|
|
515
|
+
|
|
516
|
+
/**
|
|
517
|
+
* Checks if an asset is currently being loaded.
|
|
518
|
+
* Useful for avoiding redundant requests.
|
|
519
|
+
*
|
|
520
|
+
* @param {string} path
|
|
521
|
+
* @param {string} type
|
|
522
|
+
* @return {boolean}
|
|
523
|
+
*/
|
|
524
|
+
isPending(path, type) {
|
|
525
|
+
const assetDescription = new AssetDescription(path, type);
|
|
526
|
+
return this.request_map.has(assetDescription);
|
|
527
|
+
}
|
|
528
|
+
|
|
529
|
+
|
|
530
|
+
/**
|
|
531
|
+
* Whether the most recent load attempt for the asset failed.
|
|
532
|
+
* Advisory only: a new {@link get} will still retry the load.
|
|
533
|
+
* @param {string} path
|
|
534
|
+
* @param {string} type
|
|
535
|
+
* @returns {boolean}
|
|
536
|
+
* @see isPending
|
|
537
|
+
*/
|
|
538
|
+
isFailed(path, type) {
|
|
539
|
+
const ad = new AssetDescription(path, type);
|
|
540
|
+
|
|
541
|
+
return this.#failures.has(ad);
|
|
542
|
+
}
|
|
543
|
+
|
|
544
|
+
/**
|
|
545
|
+
* Checks if an asset is loaded.
|
|
546
|
+
* If the asset is loaded, calls to {@link tryGet} are guaranteed to succeed.
|
|
547
|
+
*
|
|
548
|
+
* @param {string} path
|
|
549
|
+
* @param {string} type
|
|
550
|
+
* @return {boolean}
|
|
551
|
+
*/
|
|
552
|
+
isLoaded(path, type) {
|
|
553
|
+
const ad = new AssetDescription(path, type);
|
|
554
|
+
|
|
555
|
+
return this.assets.has(ad);
|
|
556
|
+
}
|
|
557
|
+
|
|
558
|
+
/**
|
|
559
|
+
* Same as {@link insert}, but will register the asset as pending until loader function resolves.
|
|
560
|
+
*
|
|
561
|
+
* NOTE: {@link AssetTransformer}s are not applied to the asset
|
|
562
|
+
*
|
|
563
|
+
* NOTE: any subsequent normal requests such as {@link get} will be routed to the same loader
|
|
564
|
+
*
|
|
565
|
+
* @template T
|
|
566
|
+
* @param {string} path
|
|
567
|
+
* @param {string} type
|
|
568
|
+
* @param {function(progress?:function(current:number, total:number)):Promise<Asset<T>>} loader
|
|
569
|
+
* @returns {Promise<Asset<T>>} loaded asset
|
|
570
|
+
* @see insert
|
|
571
|
+
* @example
|
|
572
|
+
* manager.insertAsync('path/to/asset', 'my-type', async (progress) => {
|
|
573
|
+
* const asset = await loadAssetFromNetwork('path/to/asset', 'type', progress);
|
|
574
|
+
* return asset;
|
|
575
|
+
* });
|
|
576
|
+
*
|
|
577
|
+
*/
|
|
578
|
+
insertAsync(path, type, loader) {
|
|
579
|
+
|
|
580
|
+
const asset_descriptor = new AssetDescription(path, type);
|
|
581
|
+
|
|
582
|
+
if (this.request_map.get(asset_descriptor)) {
|
|
583
|
+
throw new Error(`Asset with path '${path}' and type '${type}' is already pending`);
|
|
584
|
+
}
|
|
585
|
+
|
|
586
|
+
const pending = new PendingAsset(asset_descriptor);
|
|
587
|
+
|
|
588
|
+
// resolution comes from the supplied loader function, there is nothing for the manager to dispatch
|
|
589
|
+
pending.dispatchable = false;
|
|
590
|
+
|
|
591
|
+
this.request_map.set(asset_descriptor, pending);
|
|
592
|
+
|
|
593
|
+
/**
|
|
594
|
+
*
|
|
595
|
+
* @param {number} current
|
|
596
|
+
* @param {number} total
|
|
597
|
+
*/
|
|
598
|
+
const progress = (current, total) => {
|
|
599
|
+
pending.progress.setValue(current);
|
|
600
|
+
pending.progress.setUpperLimit(total);
|
|
601
|
+
};
|
|
602
|
+
|
|
603
|
+
let asset_promise;
|
|
604
|
+
|
|
605
|
+
try {
|
|
606
|
+
asset_promise = loader(progress);
|
|
607
|
+
} catch (e) {
|
|
608
|
+
this.request_map.delete(asset_descriptor);
|
|
609
|
+
|
|
610
|
+
// the deleted entry may have been the last outstanding work
|
|
611
|
+
this.#flush_drain_waiters();
|
|
612
|
+
|
|
613
|
+
throw e;
|
|
614
|
+
}
|
|
615
|
+
|
|
616
|
+
return asset_promise.then(asset => {
|
|
617
|
+
const existing = this.request_map.get(asset_descriptor);
|
|
618
|
+
|
|
619
|
+
if (existing !== pending) {
|
|
620
|
+
// looks like another resolution is pending, this completely invalidates current insersion request
|
|
621
|
+
// Likely reason is that something else was inserted later on
|
|
622
|
+
throw new Error(`Race condition. Asset with path '${path}' and type '${type}' was already resolved somewhere else.`);
|
|
623
|
+
}
|
|
624
|
+
|
|
625
|
+
this.insert(path, type, asset);
|
|
626
|
+
|
|
627
|
+
return asset;
|
|
628
|
+
}, error => {
|
|
629
|
+
const existing = this.request_map.get(asset_descriptor);
|
|
630
|
+
|
|
631
|
+
if (existing === pending) {
|
|
632
|
+
// deliver the failure to any requests that attached while the insertion was pending
|
|
633
|
+
pending.resolution_claimed = true;
|
|
634
|
+
this.#settle(pending, AssetLoadState.Failed, error);
|
|
635
|
+
}
|
|
636
|
+
|
|
637
|
+
//rethrow
|
|
638
|
+
throw error;
|
|
639
|
+
});
|
|
640
|
+
}
|
|
641
|
+
|
|
642
|
+
/**
|
|
643
|
+
* Manually add a fully resolved resource.
|
|
644
|
+
* If a load for the same description is in flight, it is squashed: the inserted asset wins,
|
|
645
|
+
* all accumulated requests are answered with it exactly once, and the loader's late resolution is dropped.
|
|
646
|
+
*
|
|
647
|
+
* NOTE: {@link AssetTransformer}s are not applied to the asset
|
|
648
|
+
*
|
|
649
|
+
* @template T
|
|
650
|
+
* @param {string} path
|
|
651
|
+
* @param {string} type
|
|
652
|
+
* @param {Asset<T>} asset
|
|
653
|
+
*/
|
|
654
|
+
insert(path, type, asset) {
|
|
655
|
+
assert.isString(path, 'path');
|
|
656
|
+
assert.isString(type, 'type');
|
|
657
|
+
assert.isObject(asset, 'asset');
|
|
658
|
+
|
|
659
|
+
const asset_descriptor = new AssetDescription(path, type);
|
|
660
|
+
|
|
661
|
+
const existing_resource = this.assets.get(asset_descriptor);
|
|
662
|
+
|
|
663
|
+
if (existing_resource !== undefined && existing_resource !== asset) {
|
|
664
|
+
console.warn(`Another asset under ${asset_descriptor} already exists and will be replaced`);
|
|
665
|
+
}
|
|
666
|
+
|
|
667
|
+
// check for assets in-flight
|
|
668
|
+
const pending = this.request_map.get(asset_descriptor);
|
|
669
|
+
|
|
670
|
+
if (pending !== undefined) {
|
|
671
|
+
// squash the load in-flight: block the loader from claiming the resolution later
|
|
672
|
+
pending.resolution_claimed = true;
|
|
673
|
+
|
|
674
|
+
// if the load is still waiting in the queue there is no point dispatching it anymore
|
|
675
|
+
this.#pending_asset_wait_queue.delete(pending);
|
|
676
|
+
|
|
677
|
+
this.#settle(pending, AssetLoadState.Succeeded, asset);
|
|
678
|
+
} else {
|
|
679
|
+
// link asset description
|
|
680
|
+
asset.description = asset_descriptor;
|
|
681
|
+
|
|
682
|
+
// clear failures
|
|
683
|
+
this.#failures.delete(asset_descriptor);
|
|
684
|
+
|
|
685
|
+
this.assets.set(asset_descriptor, asset);
|
|
686
|
+
}
|
|
687
|
+
}
|
|
688
|
+
|
|
689
|
+
/**
|
|
690
|
+
*
|
|
691
|
+
* @param {Response} response
|
|
692
|
+
* @private
|
|
693
|
+
*/
|
|
694
|
+
#process_response(response) {
|
|
695
|
+
const request = response.request;
|
|
696
|
+
|
|
697
|
+
if (response.success) {
|
|
698
|
+
|
|
699
|
+
try {
|
|
700
|
+
request.successCallback(response.value);
|
|
701
|
+
} catch (e) {
|
|
702
|
+
console.error(`Asset success callback raised an exception. AD:${response.description}`, e);
|
|
703
|
+
}
|
|
704
|
+
|
|
705
|
+
} else {
|
|
706
|
+
|
|
707
|
+
const failureCallback = request.failureCallback;
|
|
708
|
+
|
|
709
|
+
if (typeof failureCallback === "function") {
|
|
710
|
+
try {
|
|
711
|
+
failureCallback(response.value);
|
|
712
|
+
} catch (e) {
|
|
713
|
+
console.error(`Asset failure callback raised an exception. AD:${response.description}`, e);
|
|
714
|
+
}
|
|
715
|
+
} else {
|
|
716
|
+
//uncaught
|
|
717
|
+
console.error(`Uncaught asset load failure. AD:${response.description}`, response.value);
|
|
718
|
+
}
|
|
719
|
+
|
|
720
|
+
}
|
|
721
|
+
}
|
|
722
|
+
|
|
723
|
+
/**
|
|
724
|
+
*
|
|
725
|
+
* @param {AssetRequest} request
|
|
726
|
+
* @param {Asset|*} value
|
|
727
|
+
* @param {boolean} success
|
|
728
|
+
* @param {AssetDescription} description
|
|
729
|
+
* @private
|
|
730
|
+
*/
|
|
731
|
+
#schedule_response(request, value, success, description) {
|
|
732
|
+
// technically you can schedule responses just fine, but commonly the user forgets to call 'startup' and so nothing happens which is perceived as a bug.
|
|
733
|
+
assert.equal(this.#is_running, true, 'AssetManager must be running to schedule responses');
|
|
734
|
+
|
|
735
|
+
this.#response_queue.add(new Response(request, value, success, description));
|
|
736
|
+
|
|
737
|
+
this.#wake_response_processor();
|
|
738
|
+
}
|
|
739
|
+
|
|
740
|
+
/**
|
|
741
|
+
*
|
|
742
|
+
* @param {PendingAsset} asset
|
|
743
|
+
* @private
|
|
744
|
+
*/
|
|
745
|
+
#schedule_load(asset) {
|
|
746
|
+
if (this.#pending_asset_active_load_set.size < this.load_concurrency) {
|
|
747
|
+
this.#dispatch_pending_asset(asset);
|
|
748
|
+
} else {
|
|
749
|
+
asset.state = AssetLoadState.Queued;
|
|
750
|
+
|
|
751
|
+
this.#pending_asset_wait_queue.push(asset);
|
|
752
|
+
}
|
|
753
|
+
}
|
|
754
|
+
|
|
755
|
+
/**
|
|
756
|
+
* Force load of the asset
|
|
757
|
+
* @param {PendingAsset} asset
|
|
758
|
+
* @private
|
|
759
|
+
*/
|
|
760
|
+
#force_load(asset) {
|
|
761
|
+
// externally resolved pending assets (see insertAsync) have no loader run to expedite
|
|
762
|
+
if (!asset.dispatchable) {
|
|
763
|
+
return;
|
|
764
|
+
}
|
|
765
|
+
|
|
766
|
+
// check if the asset is already being loaded
|
|
767
|
+
if (this.#pending_asset_active_load_set.has(asset)) {
|
|
768
|
+
return;
|
|
769
|
+
}
|
|
770
|
+
|
|
771
|
+
// remove from queue
|
|
772
|
+
this.#pending_asset_wait_queue.delete(asset);
|
|
773
|
+
|
|
774
|
+
// dispatch
|
|
775
|
+
this.#dispatch_pending_asset(asset);
|
|
776
|
+
|
|
777
|
+
}
|
|
778
|
+
|
|
779
|
+
/**
|
|
780
|
+
* Bookkeeping for a pending asset that reached a terminal state: de-register it everywhere
|
|
781
|
+
* and pull more work from the wait queue.
|
|
782
|
+
* @param {PendingAsset} pending_asset
|
|
783
|
+
* @private
|
|
784
|
+
*/
|
|
785
|
+
#handle_asset_resolved(pending_asset) {
|
|
786
|
+
const active_set = this.#pending_asset_active_load_set;
|
|
787
|
+
|
|
788
|
+
// the map entry may already belong to a different pending asset (the load was squashed
|
|
789
|
+
// by an insert and a new request batch started since); only remove our own registration
|
|
790
|
+
if (this.request_map.get(pending_asset.description) === pending_asset) {
|
|
791
|
+
this.request_map.delete(pending_asset.description);
|
|
792
|
+
}
|
|
793
|
+
|
|
794
|
+
active_set.delete(pending_asset);
|
|
795
|
+
|
|
796
|
+
const dispatch_scope = pending_asset.dispatch_scope;
|
|
797
|
+
|
|
798
|
+
if (dispatch_scope !== null) {
|
|
799
|
+
this.#active_load_scopes.delete(dispatch_scope);
|
|
800
|
+
}
|
|
801
|
+
|
|
802
|
+
const queue = this.#pending_asset_wait_queue;
|
|
803
|
+
|
|
804
|
+
// schedule more if possible
|
|
805
|
+
while (!queue.isEmpty() && active_set.size < this.load_concurrency) {
|
|
806
|
+
const load = queue.pop();
|
|
807
|
+
|
|
808
|
+
this.#dispatch_pending_asset(load);
|
|
809
|
+
}
|
|
810
|
+
}
|
|
811
|
+
|
|
812
|
+
/**
|
|
813
|
+
* Single termination point for a pending asset. Exactly one resolution wins; the rest are dropped.
|
|
814
|
+
* All bookkeeping happens here, in a fixed order, before any requester callback is delivered.
|
|
815
|
+
* @param {PendingAsset} pendingAsset
|
|
816
|
+
* @param {AssetLoadState} state {@link AssetLoadState.Succeeded} or {@link AssetLoadState.Failed}
|
|
817
|
+
* @param {Asset|*} value loaded asset when succeeded, error otherwise
|
|
818
|
+
* @returns {boolean} false if the pending asset was already resolved and this resolution lost
|
|
819
|
+
* @private
|
|
820
|
+
*/
|
|
821
|
+
#settle(pendingAsset, state, value) {
|
|
822
|
+
const current_state = pendingAsset.state;
|
|
823
|
+
|
|
824
|
+
if (current_state === AssetLoadState.Succeeded || current_state === AssetLoadState.Failed) {
|
|
825
|
+
console.warn(`Asset already resolved, late resolution dropped. AD:${pendingAsset.description}`);
|
|
826
|
+
return false;
|
|
827
|
+
}
|
|
828
|
+
|
|
829
|
+
pendingAsset.state = state;
|
|
830
|
+
|
|
831
|
+
const assetDescription = pendingAsset.description;
|
|
832
|
+
|
|
833
|
+
if (state === AssetLoadState.Succeeded) {
|
|
834
|
+
// link asset description
|
|
835
|
+
value.description = assetDescription;
|
|
836
|
+
|
|
837
|
+
// record dependencies gathered from nested requests made during the load
|
|
838
|
+
if (pendingAsset.children.length > 0) {
|
|
839
|
+
value.dependencies = pendingAsset.children;
|
|
840
|
+
}
|
|
841
|
+
|
|
842
|
+
// clear possible failure
|
|
843
|
+
this.#failures.delete(assetDescription);
|
|
844
|
+
|
|
845
|
+
// register asset
|
|
846
|
+
this.assets.set(assetDescription, value);
|
|
847
|
+
} else {
|
|
848
|
+
// record failure
|
|
849
|
+
this.#failures.add(assetDescription);
|
|
850
|
+
}
|
|
851
|
+
|
|
852
|
+
this.#handle_asset_resolved(pendingAsset);
|
|
853
|
+
|
|
854
|
+
// deliver responses
|
|
855
|
+
const requests = pendingAsset.requests;
|
|
856
|
+
const success = state === AssetLoadState.Succeeded;
|
|
857
|
+
|
|
858
|
+
for (let i = 0; i < requests.length; i++) {
|
|
859
|
+
this.#schedule_response(requests[i], value, success, assetDescription);
|
|
860
|
+
}
|
|
861
|
+
|
|
862
|
+
if (requests.length === 0) {
|
|
863
|
+
// nothing was scheduled for delivery (e.g. an insertAsync pending with no requesters),
|
|
864
|
+
// so the response processor will not run; this settle may have been the last outstanding work
|
|
865
|
+
this.#flush_drain_waiters();
|
|
866
|
+
}
|
|
867
|
+
|
|
868
|
+
return true;
|
|
869
|
+
}
|
|
870
|
+
|
|
871
|
+
/**
|
|
872
|
+
* Finalize a successful load: apply the transform chain, then settle.
|
|
873
|
+
* A broken transform chain fails the request instead of hanging it.
|
|
874
|
+
* @param {PendingAsset} pendingAsset
|
|
875
|
+
* @param {Asset} loaded_asset
|
|
876
|
+
* @returns {Promise<void>}
|
|
877
|
+
* @private
|
|
878
|
+
*/
|
|
879
|
+
async #finalize_success(pendingAsset, loaded_asset) {
|
|
880
|
+
const assetDescription = pendingAsset.description;
|
|
881
|
+
|
|
882
|
+
let asset = loaded_asset;
|
|
883
|
+
|
|
884
|
+
try {
|
|
885
|
+
// apply the transform chain
|
|
886
|
+
const transformers = this.#transformers[assetDescription.type];
|
|
887
|
+
|
|
888
|
+
if (transformers !== undefined) {
|
|
889
|
+
const transformer_count = transformers.length;
|
|
890
|
+
|
|
891
|
+
for (let i = 0; i < transformer_count; i++) {
|
|
892
|
+
const transformer = transformers[i];
|
|
893
|
+
|
|
894
|
+
const transformed_asset = await transformer.transform(asset, assetDescription);
|
|
895
|
+
|
|
896
|
+
if (typeof transformed_asset !== "object" || transformed_asset === null) {
|
|
897
|
+
console.error('Transformer produced invalid result. Ignoring result.', transformer, assetDescription);
|
|
898
|
+
} else {
|
|
899
|
+
asset = transformed_asset;
|
|
900
|
+
}
|
|
901
|
+
}
|
|
902
|
+
}
|
|
903
|
+
} catch (e) {
|
|
904
|
+
this.#settle(pendingAsset, AssetLoadState.Failed, e);
|
|
905
|
+
|
|
906
|
+
return;
|
|
907
|
+
}
|
|
908
|
+
|
|
909
|
+
this.#settle(pendingAsset, AssetLoadState.Succeeded, asset);
|
|
910
|
+
}
|
|
911
|
+
|
|
912
|
+
/**
|
|
913
|
+
* Returns the in-flight load that the given request scope belongs to, or null if the scope
|
|
914
|
+
* does not descend from any active load (i.e. the request is top-level).
|
|
915
|
+
* @param {AssetRequestScope|null} scope
|
|
916
|
+
* @returns {PendingAsset|null}
|
|
917
|
+
* @private
|
|
918
|
+
*/
|
|
919
|
+
#find_enclosing_load(scope) {
|
|
920
|
+
if (scope === null || this.#active_load_scopes.size === 0) {
|
|
921
|
+
return null;
|
|
922
|
+
}
|
|
923
|
+
|
|
924
|
+
const active = this.#active_load_scopes;
|
|
925
|
+
|
|
926
|
+
const visited = new Set();
|
|
927
|
+
const stack = [scope];
|
|
928
|
+
|
|
929
|
+
while (stack.length > 0) {
|
|
930
|
+
const s = stack.pop();
|
|
931
|
+
|
|
932
|
+
if (visited.has(s)) {
|
|
933
|
+
continue;
|
|
934
|
+
}
|
|
935
|
+
|
|
936
|
+
visited.add(s);
|
|
937
|
+
|
|
938
|
+
const pending = active.get(s);
|
|
939
|
+
|
|
940
|
+
if (pending !== undefined) {
|
|
941
|
+
return pending;
|
|
942
|
+
}
|
|
943
|
+
|
|
944
|
+
const sources = s.sources;
|
|
945
|
+
for (let i = 0; i < sources.length; i++) {
|
|
946
|
+
stack.push(sources[i]);
|
|
947
|
+
}
|
|
948
|
+
}
|
|
949
|
+
|
|
950
|
+
return null;
|
|
951
|
+
}
|
|
952
|
+
|
|
953
|
+
/**
|
|
954
|
+
* Detects a request for an asset that is itself an ancestor of the request (load cycle).
|
|
955
|
+
* @param {AssetRequestScope|null} scope
|
|
956
|
+
* @param {AssetDescription} description
|
|
957
|
+
* @returns {string|null} human-readable chain from the requested asset down to the requester, or null when there is no cycle
|
|
958
|
+
* @private
|
|
959
|
+
*/
|
|
960
|
+
#find_request_cycle(scope, description) {
|
|
961
|
+
if (scope === null || this.#active_load_scopes.size === 0) {
|
|
962
|
+
return null;
|
|
963
|
+
}
|
|
964
|
+
|
|
965
|
+
const visited = new Set();
|
|
966
|
+
|
|
967
|
+
/**
|
|
968
|
+
*
|
|
969
|
+
* @param {AssetRequestScope} s
|
|
970
|
+
* @returns {AssetDescription[]|null}
|
|
971
|
+
*/
|
|
972
|
+
function find(s) {
|
|
973
|
+
if (visited.has(s)) {
|
|
974
|
+
return null;
|
|
975
|
+
}
|
|
976
|
+
|
|
977
|
+
visited.add(s);
|
|
978
|
+
|
|
979
|
+
if (s.description !== null && s.description.equals(description)) {
|
|
980
|
+
return [s.description];
|
|
981
|
+
}
|
|
982
|
+
|
|
983
|
+
const sources = s.sources;
|
|
984
|
+
for (let i = 0; i < sources.length; i++) {
|
|
985
|
+
const chain = find(sources[i]);
|
|
986
|
+
|
|
987
|
+
if (chain !== null) {
|
|
988
|
+
if (s.description !== null) {
|
|
989
|
+
chain.push(s.description);
|
|
990
|
+
}
|
|
991
|
+
|
|
992
|
+
return chain;
|
|
993
|
+
}
|
|
994
|
+
}
|
|
995
|
+
|
|
996
|
+
return null;
|
|
997
|
+
}
|
|
998
|
+
|
|
999
|
+
// `find` builds the chain ancestor-first: [offender, ..., immediate parent]
|
|
1000
|
+
const chain = find(scope);
|
|
1001
|
+
|
|
1002
|
+
if (chain === null) {
|
|
1003
|
+
return null;
|
|
1004
|
+
}
|
|
1005
|
+
|
|
1006
|
+
chain.push(description);
|
|
1007
|
+
|
|
1008
|
+
return chain.join(' -> ');
|
|
1009
|
+
}
|
|
1010
|
+
|
|
1011
|
+
/**
|
|
1012
|
+
* Dispatch load request to relevant loader
|
|
1013
|
+
* @param {PendingAsset} pendingAsset
|
|
1014
|
+
* @private
|
|
1015
|
+
*/
|
|
1016
|
+
#dispatch_pending_asset(pendingAsset) {
|
|
1017
|
+
const requests = pendingAsset.requests;
|
|
1018
|
+
const assetDescription = pendingAsset.description;
|
|
1019
|
+
const type = assetDescription.type;
|
|
1020
|
+
const path = assetDescription.path;
|
|
1021
|
+
|
|
1022
|
+
pendingAsset.state = AssetLoadState.Loading;
|
|
1023
|
+
|
|
1024
|
+
const loader = this.#loaders[type];
|
|
1025
|
+
|
|
1026
|
+
if (loader === undefined) {
|
|
1027
|
+
// no loader
|
|
1028
|
+
this.#settle(
|
|
1029
|
+
pendingAsset,
|
|
1030
|
+
AssetLoadState.Failed,
|
|
1031
|
+
new Error(`no loader exists for asset type '${type}', valid types are: ${Object.keys(this.#loaders).join(', ')}`)
|
|
1032
|
+
);
|
|
1033
|
+
|
|
1034
|
+
return;
|
|
1035
|
+
}
|
|
1036
|
+
|
|
1037
|
+
// mark as being loaded
|
|
1038
|
+
this.#pending_asset_active_load_set.add(pendingAsset);
|
|
1039
|
+
|
|
1040
|
+
// build the dispatch scope; it identifies this load for requests made by the loader (nested requests)
|
|
1041
|
+
const scope = new AssetRequestScope();
|
|
1042
|
+
|
|
1043
|
+
scope.description = assetDescription;
|
|
1044
|
+
|
|
1045
|
+
for (let i = 0; i < requests.length; i++) {
|
|
1046
|
+
const request_scope = requests[i].scope;
|
|
1047
|
+
|
|
1048
|
+
if (request_scope !== null) {
|
|
1049
|
+
array_push_if_unique(scope.sources, request_scope);
|
|
1050
|
+
}
|
|
1051
|
+
}
|
|
1052
|
+
|
|
1053
|
+
pendingAsset.dispatch_scope = scope;
|
|
1054
|
+
this.#active_load_scopes.set(scope, pendingAsset);
|
|
1055
|
+
|
|
1056
|
+
/**
|
|
1057
|
+
*
|
|
1058
|
+
* @param {Asset} loaded_asset
|
|
1059
|
+
*/
|
|
1060
|
+
const success = (loaded_asset) => {
|
|
1061
|
+
if (pendingAsset.resolution_claimed) {
|
|
1062
|
+
console.warn(`Asset resolution already claimed, success invocation ignored. AD:${assetDescription}`);
|
|
1063
|
+
return;
|
|
1064
|
+
}
|
|
1065
|
+
|
|
1066
|
+
pendingAsset.resolution_claimed = true;
|
|
1067
|
+
|
|
1068
|
+
this.#finalize_success(pendingAsset, loaded_asset);
|
|
1069
|
+
}
|
|
1070
|
+
|
|
1071
|
+
const failure = (error) => {
|
|
1072
|
+
if (pendingAsset.resolution_claimed) {
|
|
1073
|
+
console.warn(`Asset resolution already claimed, failure invocation ignored. AD:${assetDescription}`);
|
|
1074
|
+
return;
|
|
1075
|
+
}
|
|
1076
|
+
|
|
1077
|
+
pendingAsset.resolution_claimed = true;
|
|
1078
|
+
|
|
1079
|
+
this.#settle(pendingAsset, AssetLoadState.Failed, error);
|
|
1080
|
+
}
|
|
1081
|
+
|
|
1082
|
+
function progress(current, total) {
|
|
1083
|
+
const request_count = requests.length;
|
|
1084
|
+
|
|
1085
|
+
for (let i = 0; i < request_count; i++) {
|
|
1086
|
+
const progressCallback = requests[i].progressCallback;
|
|
1087
|
+
|
|
1088
|
+
if (typeof progressCallback !== "function") {
|
|
1089
|
+
//progress callback is not a function, ignore
|
|
1090
|
+
continue;
|
|
1091
|
+
}
|
|
1092
|
+
|
|
1093
|
+
try {
|
|
1094
|
+
progressCallback(current, total);
|
|
1095
|
+
} catch (e) {
|
|
1096
|
+
console.error("Failed to execute asset progress callback", e);
|
|
1097
|
+
}
|
|
1098
|
+
}
|
|
1099
|
+
|
|
1100
|
+
pendingAsset.progress.setValue(current);
|
|
1101
|
+
pendingAsset.progress.setUpperLimit(total);
|
|
1102
|
+
}
|
|
1103
|
+
|
|
1104
|
+
try {
|
|
1105
|
+
|
|
1106
|
+
const result = loader.load(scope, path, success, failure, progress);
|
|
1107
|
+
|
|
1108
|
+
if (result instanceof Promise) {
|
|
1109
|
+
// allow promise responses
|
|
1110
|
+
result.catch(failure);
|
|
1111
|
+
}
|
|
1112
|
+
|
|
1113
|
+
} catch (e) {
|
|
1114
|
+
console.error(`Loader failed on invocation. path=${path}, type=${type}`, 'Loader exception: ', e);
|
|
1115
|
+
failure(e);
|
|
1116
|
+
}
|
|
1117
|
+
}
|
|
1118
|
+
|
|
1119
|
+
/**
|
|
1120
|
+
*
|
|
1121
|
+
* @param {AssetDescription} assetDescription
|
|
1122
|
+
* @param {AssetRequest} request
|
|
1123
|
+
* @param {PendingAsset|null} [parent_pending] the in-flight load this request was made from, if any
|
|
1124
|
+
* @private
|
|
1125
|
+
*/
|
|
1126
|
+
submitRequest(assetDescription, request, parent_pending = null) {
|
|
1127
|
+
const requestMap = this.request_map;
|
|
1128
|
+
|
|
1129
|
+
let pendingAsset = requestMap.get(assetDescription);
|
|
1130
|
+
|
|
1131
|
+
const is_new = pendingAsset === undefined;
|
|
1132
|
+
|
|
1133
|
+
if (is_new) {
|
|
1134
|
+
pendingAsset = new PendingAsset(assetDescription);
|
|
1135
|
+
requestMap.set(assetDescription, pendingAsset);
|
|
1136
|
+
}
|
|
1137
|
+
|
|
1138
|
+
pendingAsset.requests.push(request);
|
|
1139
|
+
|
|
1140
|
+
// a nested request must not wait behind the concurrency limit: its parent occupies a
|
|
1141
|
+
// slot until this request resolves, so queueing it could deadlock
|
|
1142
|
+
const expedite = parent_pending !== null || request.getFlag(AssetRequestFlags.SkipQueue);
|
|
1143
|
+
|
|
1144
|
+
if (is_new) {
|
|
1145
|
+
|
|
1146
|
+
if (expedite) {
|
|
1147
|
+
this.#force_load(pendingAsset);
|
|
1148
|
+
} else {
|
|
1149
|
+
this.#schedule_load(pendingAsset);
|
|
1150
|
+
}
|
|
1151
|
+
|
|
1152
|
+
} else {
|
|
1153
|
+
// update priority queue if necessary
|
|
1154
|
+
this.#pending_asset_wait_queue.updateElementScore(pendingAsset);
|
|
1155
|
+
|
|
1156
|
+
if (expedite) {
|
|
1157
|
+
this.#force_load(pendingAsset);
|
|
1158
|
+
}
|
|
1159
|
+
}
|
|
1160
|
+
}
|
|
1161
|
+
|
|
1162
|
+
|
|
1163
|
+
/**
|
|
1164
|
+
*
|
|
1165
|
+
* @param {string} type
|
|
1166
|
+
* @return {boolean}
|
|
1167
|
+
*/
|
|
1168
|
+
hasLoaderForType(type) {
|
|
1169
|
+
return this.getLoaderByType(type) !== undefined;
|
|
1170
|
+
}
|
|
1171
|
+
|
|
1172
|
+
/**
|
|
1173
|
+
*
|
|
1174
|
+
* @param {string} type
|
|
1175
|
+
* @returns {AssetLoader|undefined}
|
|
1176
|
+
*/
|
|
1177
|
+
getLoaderByType(type) {
|
|
1178
|
+
assert.isString(type, 'type');
|
|
1179
|
+
|
|
1180
|
+
return this.#loaders[type];
|
|
1181
|
+
}
|
|
1182
|
+
|
|
1183
|
+
/**
|
|
1184
|
+
*
|
|
1185
|
+
* @param {string} type
|
|
1186
|
+
* @return {AssetDescription[]}
|
|
1187
|
+
* @private
|
|
1188
|
+
*/
|
|
1189
|
+
#getLoadedAssetDescriptorsByType(type) {
|
|
1190
|
+
const loaded_assets = Array.from(this.assets.keys());
|
|
1191
|
+
return loaded_assets.filter(t => t.type === type);
|
|
1192
|
+
}
|
|
1193
|
+
|
|
1194
|
+
/**
|
|
1195
|
+
* Transformer will be applied to all assets of the given type in order of registration.
|
|
1196
|
+
*
|
|
1197
|
+
* Does not apply retroactively, assets that were already loaded will not be transformed.
|
|
1198
|
+
*
|
|
1199
|
+
* @template T
|
|
1200
|
+
* @param {string} type
|
|
1201
|
+
* @param {AssetTransformer<T>} transformer
|
|
1202
|
+
* @returns {void}
|
|
1203
|
+
* @see removeTransformer
|
|
1204
|
+
*/
|
|
1205
|
+
registerTransformer(type, transformer) {
|
|
1206
|
+
let transformers = this.#transformers[type];
|
|
1207
|
+
|
|
1208
|
+
if (transformers === undefined) {
|
|
1209
|
+
transformers = [];
|
|
1210
|
+
|
|
1211
|
+
this.#transformers[type] = transformers;
|
|
1212
|
+
}
|
|
1213
|
+
|
|
1214
|
+
transformers.push(transformer);
|
|
1215
|
+
|
|
1216
|
+
// check for loaded assets
|
|
1217
|
+
const matching_assets = this.#getLoadedAssetDescriptorsByType(type);
|
|
1218
|
+
|
|
1219
|
+
if (matching_assets.length > 0) {
|
|
1220
|
+
console.warn(`Following assets of matching type '${type}' are already loaded and transform is not applied to them:\n\t${matching_assets.join('\n\t')}`);
|
|
1221
|
+
}
|
|
1222
|
+
|
|
1223
|
+
}
|
|
1224
|
+
|
|
1225
|
+
/**
|
|
1226
|
+
* @template T
|
|
1227
|
+
* @param {string} type
|
|
1228
|
+
* @param {AssetTransformer<T>} transformer
|
|
1229
|
+
* @returns {boolean} true if removed, false if not found
|
|
1230
|
+
* @see registerTransformer
|
|
1231
|
+
*/
|
|
1232
|
+
unregisterTransformer(type, transformer) {
|
|
1233
|
+
|
|
1234
|
+
const transformers = this.#transformers[type];
|
|
1235
|
+
|
|
1236
|
+
if (transformers === undefined) {
|
|
1237
|
+
// not found
|
|
1238
|
+
return false;
|
|
1239
|
+
}
|
|
1240
|
+
|
|
1241
|
+
if (!array_remove_first(transformers, transformer)) {
|
|
1242
|
+
// not found
|
|
1243
|
+
return false;
|
|
1244
|
+
}
|
|
1245
|
+
|
|
1246
|
+
// check for loaded assets
|
|
1247
|
+
const matching_assets = this.#getLoadedAssetDescriptorsByType(type);
|
|
1248
|
+
|
|
1249
|
+
if (matching_assets.length > 0) {
|
|
1250
|
+
console.warn(`Following assets of matching type '${type}' are already loaded and transform was probably already applied to them:\n\t${matching_assets.join('\n\t')}`);
|
|
1251
|
+
}
|
|
1252
|
+
|
|
1253
|
+
return true;
|
|
1254
|
+
}
|
|
1255
|
+
|
|
1256
|
+
/**
|
|
1257
|
+
* Will register loader only if none exists for this type
|
|
1258
|
+
* @template T
|
|
1259
|
+
* @param {string} type
|
|
1260
|
+
* @param {AssetLoader<T>} loader
|
|
1261
|
+
* @returns {Promise<boolean>} true if registered, false otherwise
|
|
1262
|
+
*/
|
|
1263
|
+
async tryRegisterLoader(type, loader) {
|
|
1264
|
+
if (this.hasLoaderForType(type)) {
|
|
1265
|
+
return false;
|
|
1266
|
+
}
|
|
1267
|
+
|
|
1268
|
+
await this.registerLoader(type, loader);
|
|
1269
|
+
|
|
1270
|
+
return true;
|
|
1271
|
+
}
|
|
1272
|
+
|
|
1273
|
+
/**
|
|
1274
|
+
* @template T
|
|
1275
|
+
* @param {string} type
|
|
1276
|
+
* @param {AssetLoader<T>} loader
|
|
1277
|
+
* @throws {Error} if a loader is already registered for the given type
|
|
1278
|
+
*/
|
|
1279
|
+
async registerLoader(type, loader) {
|
|
1280
|
+
assert.isString(type, 'type');
|
|
1281
|
+
|
|
1282
|
+
const existing_loader = this.getLoaderByType(type);
|
|
1283
|
+
|
|
1284
|
+
if (existing_loader !== undefined) {
|
|
1285
|
+
if (existing_loader === loader) {
|
|
1286
|
+
// all is well, already registered
|
|
1287
|
+
return existing_loader;
|
|
1288
|
+
} else if (Object.getPrototypeOf(existing_loader) === Object.getPrototypeOf(loader)) {
|
|
1289
|
+
console.warn(`Another instance of this loader is already registered for type '${type}'. Ignoring.`);
|
|
1290
|
+
return existing_loader;
|
|
1291
|
+
} else {
|
|
1292
|
+
throw new Error(`Loader for type '${type}' is already registered`);
|
|
1293
|
+
}
|
|
1294
|
+
}
|
|
1295
|
+
|
|
1296
|
+
|
|
1297
|
+
let _loader = loader;
|
|
1298
|
+
|
|
1299
|
+
if (typeof _loader === "function") {
|
|
1300
|
+
|
|
1301
|
+
// legacy function-based loader with signature (path, success, failure, progress):
|
|
1302
|
+
// adapt to the AssetLoader contract, resolving the network path on its behalf
|
|
1303
|
+
_loader = new AssetLoader();
|
|
1304
|
+
_loader.load = (scope, path, success, failure, progress) => loader(this.resolveNetworkPath(path), success, failure, progress);
|
|
1305
|
+
|
|
1306
|
+
console.warn(`function-based loaders are deprecated (${type})`);
|
|
1307
|
+
|
|
1308
|
+
}
|
|
1309
|
+
|
|
1310
|
+
await _loader.link(this, this.#context);
|
|
1311
|
+
|
|
1312
|
+
this.#loaders[type] = _loader;
|
|
1313
|
+
|
|
1314
|
+
return _loader;
|
|
1315
|
+
}
|
|
1316
|
+
|
|
1317
|
+
/**
|
|
1318
|
+
*
|
|
1319
|
+
* @param {string} type
|
|
1320
|
+
*/
|
|
1321
|
+
async unregisterLoader(type) {
|
|
1322
|
+
const loader = this.getLoaderByType(type);
|
|
1323
|
+
|
|
1324
|
+
if (loader === undefined) {
|
|
1325
|
+
// asset loader is not registered, nothing to do
|
|
1326
|
+
return;
|
|
1327
|
+
|
|
1328
|
+
}
|
|
1329
|
+
|
|
1330
|
+
// first remove the loader from registry so no further asset requests can be made
|
|
1331
|
+
delete this.#loaders[type];
|
|
1332
|
+
|
|
1333
|
+
// TODO address all pending requests, possibly waiting for all of them to finalize
|
|
1334
|
+
|
|
1335
|
+
// finally unlink the loader
|
|
1336
|
+
await loader.unlink();
|
|
1337
|
+
}
|
|
1338
|
+
|
|
1339
|
+
/**
|
|
1340
|
+
* Retrieve an asset if it is loaded, returns null if the asset is not loaded.
|
|
1341
|
+
* Does not trigger loading if the asset is not loaded.
|
|
1342
|
+
* @template T
|
|
1343
|
+
* @param {String} path
|
|
1344
|
+
* @param {String} type
|
|
1345
|
+
* @returns {Asset<T>|null}
|
|
1346
|
+
*/
|
|
1347
|
+
tryGet(path, type) {
|
|
1348
|
+
const assetDescription = new AssetDescription(path, type);
|
|
1349
|
+
|
|
1350
|
+
const asset = this.assets.get(assetDescription);
|
|
1351
|
+
|
|
1352
|
+
if (asset !== undefined) {
|
|
1353
|
+
return asset;
|
|
1354
|
+
} else {
|
|
1355
|
+
return null;
|
|
1356
|
+
}
|
|
1357
|
+
}
|
|
1358
|
+
|
|
1359
|
+
/**
|
|
1360
|
+
* @template T
|
|
1361
|
+
* @param {string} alias
|
|
1362
|
+
* @return {Promise<Asset<T>>}
|
|
1363
|
+
*/
|
|
1364
|
+
promiseByAlias(alias) {
|
|
1365
|
+
assert.isString(alias, 'alias');
|
|
1366
|
+
|
|
1367
|
+
// resolve alias
|
|
1368
|
+
const assetDescription = this.#aliases.get(alias);
|
|
1369
|
+
|
|
1370
|
+
if (assetDescription === undefined) {
|
|
1371
|
+
return Promise.reject(new Error(`Alias '${alias}' not found`));
|
|
1372
|
+
}
|
|
1373
|
+
|
|
1374
|
+
return this.promise(assetDescription.path, assetDescription.type);
|
|
1375
|
+
}
|
|
1376
|
+
|
|
1377
|
+
/**
|
|
1378
|
+
*
|
|
1379
|
+
* @param {string} alias
|
|
1380
|
+
* @return {AssetDescription|undefined}
|
|
1381
|
+
*/
|
|
1382
|
+
resolveAlias(alias) {
|
|
1383
|
+
|
|
1384
|
+
// todo consider cloning result to protect against mutation
|
|
1385
|
+
|
|
1386
|
+
return this.#aliases.get(alias);
|
|
1387
|
+
|
|
1388
|
+
}
|
|
1389
|
+
|
|
1390
|
+
/**
|
|
1391
|
+
*
|
|
1392
|
+
* @param {string} alias
|
|
1393
|
+
* @param {string} path
|
|
1394
|
+
* @param {string} type
|
|
1395
|
+
*/
|
|
1396
|
+
assignAlias(alias, path, type) {
|
|
1397
|
+
assert.isString(alias, 'alias');
|
|
1398
|
+
assert.isString(path, 'path');
|
|
1399
|
+
assert.isString(type, 'type');
|
|
1400
|
+
|
|
1401
|
+
const assetDescription = new AssetDescription(path, type);
|
|
1402
|
+
|
|
1403
|
+
this.#aliases.set(alias, assetDescription);
|
|
1404
|
+
}
|
|
1405
|
+
}
|
|
1406
|
+
|
|
1407
|
+
/**
|
|
1408
|
+
* @readonly
|
|
1409
|
+
* @type {boolean}
|
|
1410
|
+
*/
|
|
1411
|
+
AssetManager.prototype.isAssetManager = true;
|