@woosh/meep-engine 3.43.0 → 3.45.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/build/bundle-worker-terrain.js +1 -1
- package/editor/prototypeEditorShell.d.ts.map +1 -1
- package/editor/prototypeEditorShell.js +4 -2
- package/package.json +1 -1
- package/src/core/collection/array/array_sort_insertion_ascending.d.ts +19 -0
- package/src/core/collection/array/array_sort_insertion_ascending.d.ts.map +1 -0
- package/src/core/collection/array/array_sort_insertion_ascending.js +31 -0
- package/src/core/geom/3d/aabb/aabb3_array_round_outward_f32.d.ts +27 -0
- package/src/core/geom/3d/aabb/aabb3_array_round_outward_f32.d.ts.map +1 -0
- package/src/core/geom/3d/aabb/aabb3_array_round_outward_f32.js +39 -0
- package/src/core/geom/3d/aabb/aabb3_from_v3_array.d.ts.map +1 -1
- package/src/core/geom/3d/aabb/aabb3_from_v3_array.js +4 -1
- package/src/core/geom/3d/aabb/aabb3_transform_oriented.d.ts +2 -2
- package/src/core/geom/3d/aabb/aabb3_transform_oriented.d.ts.map +1 -1
- package/src/core/geom/3d/aabb/aabb3_transform_oriented.js +1 -1
- package/src/core/geom/3d/pose/pose3_apply_inverse_point_array.d.ts +21 -0
- package/src/core/geom/3d/pose/pose3_apply_inverse_point_array.d.ts.map +1 -0
- package/src/core/geom/3d/pose/pose3_apply_inverse_point_array.js +36 -0
- package/src/core/geom/3d/pose/pose3_apply_point_array.d.ts +25 -0
- package/src/core/geom/3d/pose/pose3_apply_point_array.d.ts.map +1 -0
- package/src/core/geom/3d/pose/pose3_apply_point_array.js +40 -0
- package/src/core/geom/3d/pose/pose3_compose_array.d.ts +28 -0
- package/src/core/geom/3d/pose/pose3_compose_array.d.ts.map +1 -0
- package/src/core/geom/3d/pose/pose3_compose_array.js +41 -0
- package/src/core/geom/3d/pose/pose3_to_local_array.d.ts +29 -0
- package/src/core/geom/3d/pose/pose3_to_local_array.d.ts.map +1 -0
- package/src/core/geom/3d/pose/pose3_to_local_array.js +42 -0
- package/src/core/geom/3d/quaternion/quat3_clamp_angle_array.d.ts +28 -0
- package/src/core/geom/3d/quaternion/quat3_clamp_angle_array.d.ts.map +1 -0
- package/src/core/geom/3d/quaternion/quat3_clamp_angle_array.js +66 -0
- package/src/core/geom/3d/quaternion/quat3_multiply_conjugate_left_array.d.ts +22 -0
- package/src/core/geom/3d/quaternion/quat3_multiply_conjugate_left_array.d.ts.map +1 -0
- package/src/core/geom/3d/quaternion/quat3_multiply_conjugate_left_array.js +30 -0
- package/src/core/geom/3d/quaternion/quat3_multiply_conjugate_right_array.d.ts +23 -0
- package/src/core/geom/3d/quaternion/quat3_multiply_conjugate_right_array.d.ts.map +1 -0
- package/src/core/geom/3d/quaternion/quat3_multiply_conjugate_right_array.js +31 -0
- package/src/core/geom/3d/triangle/tri3_compute_normal_area_weighted_array.d.ts +26 -0
- package/src/core/geom/3d/triangle/tri3_compute_normal_area_weighted_array.d.ts.map +1 -0
- package/src/core/geom/3d/triangle/tri3_compute_normal_area_weighted_array.js +46 -0
- package/src/core/geom/vec3/v3_distance_array.d.ts +11 -0
- package/src/core/geom/vec3/v3_distance_array.d.ts.map +1 -0
- package/src/core/geom/vec3/v3_distance_array.js +19 -0
- package/src/core/geom/vec3/v3_normalize_array_checked.d.ts +23 -0
- package/src/core/geom/vec3/v3_normalize_array_checked.d.ts.map +1 -0
- package/src/core/geom/vec3/v3_normalize_array_checked.js +49 -0
- package/src/core/geom/vec3/v3_reject_array.d.ts +15 -0
- package/src/core/geom/vec3/v3_reject_array.d.ts.map +1 -0
- package/src/core/geom/vec3/v3_reject_array.js +32 -0
- package/src/core/graph/csr/csr_build_incidence.d.ts +26 -0
- package/src/core/graph/csr/csr_build_incidence.d.ts.map +1 -0
- package/src/core/graph/csr/csr_build_incidence.js +71 -0
- package/src/core/graph/csr/csr_graph_color_greedy.d.ts +25 -0
- package/src/core/graph/csr/csr_graph_color_greedy.d.ts.map +1 -0
- package/src/core/graph/csr/csr_graph_color_greedy.js +83 -0
- package/src/core/graph/csr/csr_graph_validate_coloring.d.ts +15 -0
- package/src/core/graph/csr/csr_graph_validate_coloring.d.ts.map +1 -0
- package/src/core/graph/csr/csr_graph_validate_coloring.js +33 -0
- package/src/core/math/linalg/matrix_symmetric_3x3_solve_ldlt.d.ts +26 -0
- package/src/core/math/linalg/matrix_symmetric_3x3_solve_ldlt.d.ts.map +1 -0
- package/src/core/math/linalg/matrix_symmetric_3x3_solve_ldlt.js +71 -0
- package/src/core/math/max2_exact.d.ts +15 -0
- package/src/core/math/max2_exact.d.ts.map +1 -0
- package/src/core/math/max2_exact.js +30 -0
- package/src/core/math/min2_exact.d.ts +20 -0
- package/src/core/math/min2_exact.d.ts.map +1 -0
- package/src/core/math/min2_exact.js +35 -0
- package/src/engine/Clock.d.ts +15 -0
- package/src/engine/Clock.d.ts.map +1 -1
- package/src/engine/Clock.js +29 -5
- package/src/engine/Engine.d.ts.map +1 -1
- package/src/engine/Engine.js +11 -19
- package/src/engine/ecs/ik/IKGoalSystem.d.ts.map +1 -1
- package/src/engine/ecs/ik/IKGoalSystem.js +3 -19
- package/src/engine/ecs/parent/parent_entity_model_of.d.ts +17 -0
- package/src/engine/ecs/parent/parent_entity_model_of.d.ts.map +1 -0
- package/src/engine/ecs/parent/parent_entity_model_of.js +26 -0
- package/src/engine/ecs/transform/t64_read_pose_array.d.ts +15 -0
- package/src/engine/ecs/transform/t64_read_pose_array.d.ts.map +1 -0
- package/src/engine/ecs/transform/t64_read_pose_array.js +24 -0
- package/src/engine/graphics/ecs/mesh-v2/MeshSkin.d.ts +57 -0
- package/src/engine/graphics/ecs/mesh-v2/MeshSkin.d.ts.map +1 -0
- package/src/engine/graphics/ecs/mesh-v2/MeshSkin.js +84 -0
- package/src/engine/graphics/geometry/geometry_construct_triangle_normal_area_weighted.d.ts +2 -0
- package/src/engine/graphics/geometry/geometry_construct_triangle_normal_area_weighted.d.ts.map +1 -1
- package/src/engine/graphics/geometry/geometry_construct_triangle_normal_area_weighted.js +10 -21
- package/src/engine/graphics3/AnimationGraphSystem.d.ts +28 -13
- package/src/engine/graphics3/AnimationGraphSystem.d.ts.map +1 -1
- package/src/engine/graphics3/AnimationGraphSystem.js +107 -64
- package/src/engine/graphics3/AnimationSystem.d.ts +29 -15
- package/src/engine/graphics3/AnimationSystem.d.ts.map +1 -1
- package/src/engine/graphics3/AnimationSystem.js +112 -61
- package/src/engine/graphics3/MeshSkinSystem.d.ts +56 -0
- package/src/engine/graphics3/MeshSkinSystem.d.ts.map +1 -0
- package/src/engine/graphics3/MeshSkinSystem.js +317 -0
- package/src/engine/graphics3/MeshSystem.d.ts +15 -35
- package/src/engine/graphics3/MeshSystem.d.ts.map +1 -1
- package/src/engine/graphics3/MeshSystem.js +21 -298
- package/src/engine/graphics3/RowChains.d.ts +76 -0
- package/src/engine/graphics3/RowChains.d.ts.map +1 -0
- package/src/engine/graphics3/RowChains.js +347 -0
- package/src/engine/graphics3/ShadedGeometrySystem.d.ts +6 -0
- package/src/engine/graphics3/ShadedGeometrySystem.d.ts.map +1 -1
- package/src/engine/graphics3/ShadedGeometrySystem.js +329 -309
- package/src/engine/graphics3/animation/AnimationClips.d.ts +56 -0
- package/src/engine/graphics3/animation/AnimationClips.d.ts.map +1 -0
- package/src/engine/graphics3/animation/AnimationClips.js +79 -0
- package/src/engine/graphics3/animation/ClipListPlayer.d.ts +13 -14
- package/src/engine/graphics3/animation/ClipListPlayer.d.ts.map +1 -1
- package/src/engine/graphics3/animation/ClipListPlayer.js +262 -263
- package/src/engine/graphics3/animation/write_clip_playback.d.ts +3 -3
- package/src/engine/graphics3/animation/write_clip_playback.js +4 -4
- package/src/engine/graphics3/pose/query_entity_node_world_pose.d.ts +5 -0
- package/src/engine/graphics3/pose/query_entity_node_world_pose.d.ts.map +1 -1
- package/src/engine/graphics3/pose/query_entity_node_world_pose.js +80 -75
- package/src/engine/graphics3/prefab/PrefabInstance.d.ts +4 -24
- package/src/engine/graphics3/prefab/PrefabInstance.d.ts.map +1 -1
- package/src/engine/graphics3/prefab/PrefabInstance.js +60 -80
- package/src/engine/graphics3/prefab/prefab_instantiate.d.ts +16 -3
- package/src/engine/graphics3/prefab/prefab_instantiate.d.ts.map +1 -1
- package/src/engine/graphics3/prefab/prefab_instantiate.js +49 -12
- package/src/engine/graphics3/prefab/prefab_place.d.ts +31 -17
- package/src/engine/graphics3/prefab/prefab_place.d.ts.map +1 -1
- package/src/engine/graphics3/prefab/prefab_place.js +175 -130
- package/src/engine/graphics3/register_clips.d.ts +93 -0
- package/src/engine/graphics3/register_clips.d.ts.map +1 -0
- package/src/engine/graphics3/register_clips.js +166 -0
- package/src/engine/physics/broadphase/compute_fat_world_aabb.d.ts +9 -0
- package/src/engine/physics/broadphase/compute_fat_world_aabb.d.ts.map +1 -1
- package/src/engine/physics/broadphase/compute_fat_world_aabb.js +3 -1
- package/src/engine/physics/cloth/MEASUREMENTS.md +795 -0
- package/src/engine/physics/cloth/PLAN.md +349 -17
- package/src/engine/physics/cloth/build/ClothProxy.d.ts +113 -61
- package/src/engine/physics/cloth/build/ClothProxy.d.ts.map +1 -1
- package/src/engine/physics/cloth/build/ClothProxy.js +142 -77
- package/src/engine/physics/cloth/build/cloth_bind_in_frame.d.ts +44 -0
- package/src/engine/physics/cloth/build/cloth_bind_in_frame.d.ts.map +1 -0
- package/src/engine/physics/cloth/build/cloth_bind_in_frame.js +107 -0
- package/src/engine/physics/cloth/build/cloth_proxy_from_joints.d.ts +43 -30
- package/src/engine/physics/cloth/build/cloth_proxy_from_joints.d.ts.map +1 -1
- package/src/engine/physics/cloth/build/cloth_proxy_from_joints.js +371 -284
- package/src/engine/physics/cloth/build/cloth_proxy_from_mesh.d.ts +62 -0
- package/src/engine/physics/cloth/build/cloth_proxy_from_mesh.d.ts.map +1 -0
- package/src/engine/physics/cloth/build/cloth_proxy_from_mesh.js +275 -0
- package/src/engine/physics/cloth/collider/ClothColliderIndex.d.ts +7 -0
- package/src/engine/physics/cloth/collider/ClothColliderIndex.d.ts.map +1 -1
- package/src/engine/physics/cloth/collider/ClothColliderIndex.js +85 -67
- package/src/engine/physics/cloth/collider/cloth_collider_bounds.d.ts.map +1 -1
- package/src/engine/physics/cloth/collider/cloth_collider_bounds.js +19 -101
- package/src/engine/physics/cloth/collider/cloth_collider_pack.d.ts +2 -5
- package/src/engine/physics/cloth/collider/cloth_collider_pack.d.ts.map +1 -1
- package/src/engine/physics/cloth/collider/cloth_collider_pack.js +7 -15
- package/src/engine/physics/cloth/collider/cloth_collider_sdf.d.ts +1 -1
- package/src/engine/physics/cloth/collider/cloth_collider_sdf.d.ts.map +1 -1
- package/src/engine/physics/cloth/collider/cloth_collider_sdf.js +17 -62
- package/src/engine/physics/cloth/ecs/Cloth.d.ts +17 -9
- package/src/engine/physics/cloth/ecs/Cloth.d.ts.map +1 -1
- package/src/engine/physics/cloth/ecs/Cloth.js +220 -212
- package/src/engine/physics/cloth/ecs/ClothColliderFlags.d.ts +0 -1
- package/src/engine/physics/cloth/ecs/ClothColliderFlags.js +6 -19
- package/src/engine/physics/cloth/ecs/ClothColliderSystem.d.ts +1 -2
- package/src/engine/physics/cloth/ecs/ClothColliderSystem.d.ts.map +1 -1
- package/src/engine/physics/cloth/ecs/ClothColliderSystem.js +3 -12
- package/src/engine/physics/cloth/ecs/ClothDynamicsFlags.js +6 -0
- package/src/engine/physics/cloth/ecs/ClothHold.d.ts +91 -0
- package/src/engine/physics/cloth/ecs/ClothHold.d.ts.map +1 -0
- package/src/engine/physics/cloth/ecs/ClothHold.js +103 -0
- package/src/engine/physics/cloth/ecs/ClothInstance.d.ts +254 -48
- package/src/engine/physics/cloth/ecs/ClothInstance.d.ts.map +1 -1
- package/src/engine/physics/cloth/ecs/ClothInstance.js +277 -47
- package/src/engine/physics/cloth/ecs/ClothPin.d.ts +73 -0
- package/src/engine/physics/cloth/ecs/ClothPin.d.ts.map +1 -0
- package/src/engine/physics/cloth/ecs/ClothPin.js +92 -0
- package/src/engine/physics/cloth/ecs/ClothPinSerializationAdapter.d.ts +36 -0
- package/src/engine/physics/cloth/ecs/ClothPinSerializationAdapter.d.ts.map +1 -0
- package/src/engine/physics/cloth/ecs/ClothPinSerializationAdapter.js +61 -0
- package/src/engine/physics/cloth/ecs/ClothRig.d.ts +23 -17
- package/src/engine/physics/cloth/ecs/ClothRig.d.ts.map +1 -1
- package/src/engine/physics/cloth/ecs/ClothRig.js +29 -27
- package/src/engine/physics/cloth/ecs/ClothSystem.d.ts +12 -14
- package/src/engine/physics/cloth/ecs/ClothSystem.d.ts.map +1 -1
- package/src/engine/physics/cloth/ecs/ClothSystem.js +20 -15
- package/src/engine/physics/cloth/ecs/ClothWorld.d.ts +57 -36
- package/src/engine/physics/cloth/ecs/ClothWorld.d.ts.map +1 -1
- package/src/engine/physics/cloth/ecs/ClothWorld.js +754 -207
- package/src/engine/physics/cloth/ecs/WorkerClothSystem.d.ts +12 -13
- package/src/engine/physics/cloth/ecs/WorkerClothSystem.d.ts.map +1 -1
- package/src/engine/physics/cloth/ecs/WorkerClothSystem.js +20 -14
- package/src/engine/physics/cloth/ecs/cloth_build_rows.d.ts +63 -11
- package/src/engine/physics/cloth/ecs/cloth_build_rows.d.ts.map +1 -1
- package/src/engine/physics/cloth/ecs/cloth_build_rows.js +297 -101
- package/src/engine/physics/cloth/ecs/cloth_dynamics_map.d.ts +9 -7
- package/src/engine/physics/cloth/ecs/cloth_dynamics_map.d.ts.map +1 -1
- package/src/engine/physics/cloth/ecs/cloth_dynamics_map.js +12 -10
- package/src/engine/physics/cloth/ecs/cloth_gather_colliders.d.ts +3 -3
- package/src/engine/physics/cloth/ecs/cloth_gather_colliders.d.ts.map +1 -1
- package/src/engine/physics/cloth/ecs/cloth_gather_colliders.js +60 -120
- package/src/engine/physics/cloth/ecs/cloth_geodesic.d.ts +37 -0
- package/src/engine/physics/cloth/ecs/cloth_geodesic.d.ts.map +1 -0
- package/src/engine/physics/cloth/ecs/cloth_geodesic.js +135 -0
- package/src/engine/physics/cloth/ecs/cloth_holds.d.ts +97 -0
- package/src/engine/physics/cloth/ecs/cloth_holds.d.ts.map +1 -0
- package/src/engine/physics/cloth/ecs/cloth_holds.js +583 -0
- package/src/engine/physics/cloth/ecs/cloth_reconstruct_pose.d.ts +2 -2
- package/src/engine/physics/cloth/ecs/cloth_reconstruct_pose.d.ts.map +1 -1
- package/src/engine/physics/cloth/ecs/cloth_reconstruct_pose.js +168 -51
- package/src/engine/physics/cloth/ecs/cloth_seed_rig.d.ts +17 -22
- package/src/engine/physics/cloth/ecs/cloth_seed_rig.d.ts.map +1 -1
- package/src/engine/physics/cloth/ecs/cloth_seed_rig.js +55 -117
- package/src/engine/physics/cloth/ecs/cloth_seed_subtree.d.ts +21 -6
- package/src/engine/physics/cloth/ecs/cloth_seed_subtree.d.ts.map +1 -1
- package/src/engine/physics/cloth/ecs/cloth_seed_subtree.js +51 -42
- package/src/engine/physics/cloth/ecs/cloth_write_back.d.ts +5 -0
- package/src/engine/physics/cloth/ecs/cloth_write_back.d.ts.map +1 -1
- package/src/engine/physics/cloth/ecs/cloth_write_back.js +62 -50
- package/src/engine/physics/cloth/ecs/cloth_write_back_rig.d.ts.map +1 -1
- package/src/engine/physics/cloth/ecs/cloth_write_back_rig.js +65 -58
- package/src/engine/physics/cloth/playground/cloth_playground_build.d.ts.map +1 -1
- package/src/engine/physics/cloth/playground/cloth_playground_build.js +2 -3
- package/src/engine/physics/cloth/playground/collide_main.js +3 -29
- package/src/engine/physics/cloth/playground/garment_build.d.ts.map +1 -1
- package/src/engine/physics/cloth/playground/garment_build.js +17 -5
- package/src/engine/physics/cloth/playground/garment_main.js +5 -20
- package/src/engine/physics/cloth/playground/main.js +6 -48
- package/src/engine/physics/cloth/playground/rig_build.d.ts.map +1 -1
- package/src/engine/physics/cloth/playground/rig_build.js +302 -296
- package/src/engine/physics/cloth/playground/rig_main.js +947 -955
- package/src/engine/physics/cloth/playground/wind_main.js +8 -7
- package/src/engine/physics/cloth/solver/ClothState.d.ts +45 -7
- package/src/engine/physics/cloth/solver/ClothState.d.ts.map +1 -1
- package/src/engine/physics/cloth/solver/ClothState.js +79 -83
- package/src/engine/physics/cloth/solver/cloth_color_particles.d.ts +10 -8
- package/src/engine/physics/cloth/solver/cloth_color_particles.d.ts.map +1 -1
- package/src/engine/physics/cloth/solver/cloth_color_particles.js +30 -102
- package/src/engine/physics/cloth/solver/cloth_contact_find.d.ts +6 -1
- package/src/engine/physics/cloth/solver/cloth_contact_find.d.ts.map +1 -1
- package/src/engine/physics/cloth/solver/cloth_contact_find.js +9 -3
- package/src/engine/physics/cloth/solver/cloth_hold_line.d.ts +114 -0
- package/src/engine/physics/cloth/solver/cloth_hold_line.d.ts.map +1 -0
- package/src/engine/physics/cloth/solver/cloth_hold_line.js +350 -0
- package/src/engine/physics/cloth/solver/cloth_kinetic_energy.d.ts +21 -0
- package/src/engine/physics/cloth/solver/cloth_kinetic_energy.d.ts.map +1 -0
- package/src/engine/physics/cloth/solver/cloth_kinetic_energy.js +45 -0
- package/src/engine/physics/cloth/solver/cloth_particle_coupling.d.ts +32 -0
- package/src/engine/physics/cloth/solver/cloth_particle_coupling.d.ts.map +1 -0
- package/src/engine/physics/cloth/solver/cloth_particle_coupling.js +133 -0
- package/src/engine/physics/cloth/solver/cloth_particle_of_source.d.ts +16 -0
- package/src/engine/physics/cloth/solver/cloth_particle_of_source.d.ts.map +1 -0
- package/src/engine/physics/cloth/solver/cloth_particle_of_source.js +19 -0
- package/src/engine/physics/cloth/solver/cloth_self_find.d.ts +6 -2
- package/src/engine/physics/cloth/solver/cloth_self_find.d.ts.map +1 -1
- package/src/engine/physics/cloth/solver/cloth_self_find.js +19 -68
- package/src/engine/physics/cloth/solver/cloth_solve_vertex.d.ts.map +1 -1
- package/src/engine/physics/cloth/solver/cloth_solve_vertex.js +30 -65
- package/src/engine/physics/cloth/solver/cloth_solver_constants.d.ts +24 -12
- package/src/engine/physics/cloth/solver/cloth_solver_constants.d.ts.map +1 -1
- package/src/engine/physics/cloth/solver/cloth_solver_constants.js +24 -12
- package/src/engine/physics/cloth/solver/cloth_step.d.ts +16 -0
- package/src/engine/physics/cloth/solver/cloth_step.d.ts.map +1 -1
- package/src/engine/physics/cloth/solver/cloth_step.js +189 -48
- package/src/engine/physics/cloth/solver/cloth_step_instance.d.ts +1 -0
- package/src/engine/physics/cloth/solver/cloth_step_instance.d.ts.map +1 -1
- package/src/engine/physics/cloth/solver/cloth_step_instance.js +12 -6
- package/src/engine/physics/cloth/solver/cloth_stretch_residual.d.ts +21 -0
- package/src/engine/physics/cloth/solver/cloth_stretch_residual.d.ts.map +1 -0
- package/src/engine/physics/cloth/solver/cloth_stretch_residual.js +54 -0
- package/src/engine/physics/cloth/solver/cloth_vertex_accumulator.d.ts +15 -0
- package/src/engine/physics/cloth/solver/cloth_vertex_accumulator.d.ts.map +1 -1
- package/src/engine/physics/cloth/solver/cloth_vertex_accumulator.js +28 -0
- package/src/engine/physics/cloth/solver/cloth_worst_tether_ratio.d.ts +30 -0
- package/src/engine/physics/cloth/solver/cloth_worst_tether_ratio.d.ts.map +1 -0
- package/src/engine/physics/cloth/solver/cloth_worst_tether_ratio.js +56 -0
- package/src/engine/physics/cloth/solver/constraint/cloth_contact_row.d.ts.map +1 -1
- package/src/engine/physics/cloth/solver/constraint/cloth_contact_row.js +3 -17
- package/src/engine/physics/cloth/solver/constraint/cloth_leash_row.d.ts +1 -1
- package/src/engine/physics/cloth/solver/constraint/cloth_leash_row.d.ts.map +1 -1
- package/src/engine/physics/cloth/solver/constraint/cloth_leash_row.js +353 -346
- package/src/engine/physics/cloth/solver/constraint/cloth_self_row.d.ts +7 -5
- package/src/engine/physics/cloth/solver/constraint/cloth_self_row.d.ts.map +1 -1
- package/src/engine/physics/cloth/solver/constraint/cloth_self_row.js +7 -5
- package/src/engine/physics/cloth/wind/ClothFluidWind.d.ts +2 -1
- package/src/engine/physics/cloth/wind/ClothFluidWind.d.ts.map +1 -1
- package/src/engine/physics/cloth/wind/ClothFluidWind.js +7 -25
- package/src/engine/physics/cloth/wind/cloth_sample_air.d.ts +12 -10
- package/src/engine/physics/cloth/wind/cloth_sample_air.d.ts.map +1 -1
- package/src/engine/physics/cloth/wind/cloth_sample_air.js +60 -82
- package/src/engine/physics/ecs/ContactProbeSystem.d.ts.map +1 -1
- package/src/engine/physics/ecs/ContactProbeSystem.js +2 -18
- package/src/engine/physics/ecs/PhysicsSystem.d.ts.map +1 -1
- package/src/engine/physics/ecs/PhysicsSystem.js +9 -50
- package/src/engine/physics/fluid/ecs/FluidObstacleSystem.d.ts +4 -4
- package/src/engine/physics/fluid/ecs/fluid_sample_domain_bounds.d.ts +24 -0
- package/src/engine/physics/fluid/ecs/fluid_sample_domain_bounds.d.ts.map +1 -0
- package/src/engine/physics/fluid/ecs/fluid_sample_domain_bounds.js +42 -0
- package/src/engine/physics/fluid/ecs/fluid_sample_velocity_world_mps.d.ts +25 -0
- package/src/engine/physics/fluid/ecs/fluid_sample_velocity_world_mps.d.ts.map +1 -0
- package/src/engine/physics/fluid/ecs/fluid_sample_velocity_world_mps.js +40 -0
- package/src/engine/physics/inverse_kinematics/frame_fabrik/frame_fabrik_solve.d.ts.map +1 -1
- package/src/engine/physics/inverse_kinematics/frame_fabrik/frame_fabrik_solve.js +40 -90
- package/src/engine/physics/narrowphase/capsule_contacts.d.ts.map +1 -1
- package/src/engine/physics/narrowphase/capsule_contacts.js +3 -5
- package/src/engine/physics/narrowphase/decomposition/mesh_enumerate_triangles.d.ts.map +1 -1
- package/src/engine/physics/narrowphase/decomposition/mesh_enumerate_triangles.js +2 -14
- package/src/engine/physics/narrowphase/hull_sphere_contact.d.ts.map +1 -1
- package/src/engine/physics/narrowphase/hull_sphere_contact.js +2 -5
- package/src/engine/physics/narrowphase/narrowphase_step.d.ts.map +1 -1
- package/src/engine/physics/narrowphase/narrowphase_step.js +13 -32
- package/src/engine/physics/narrowphase/sphere_box_contact.d.ts.map +1 -1
- package/src/engine/physics/narrowphase/sphere_box_contact.js +2 -5
- package/src/engine/simulation/Ticker.d.ts +13 -0
- package/src/engine/simulation/Ticker.d.ts.map +1 -1
- package/src/engine/simulation/Ticker.js +43 -8
- package/src/format/texture/basis/transcode/etc1s_to_astc.d.ts.map +1 -1
- package/src/format/texture/basis/transcode/etc1s_to_astc.js +2 -1
- package/src/shade/RENDERER_CONTRACT.md +8 -2
- package/src/shade/playground/image_decode_bench/main.js +2 -1
- package/src/shade/playground/mesh_row_ceiling/main.js +2 -1
- package/src/shade/playground/skinned_blas_refit/diff_traced_against_rasterized.d.ts.map +1 -1
- package/src/shade/playground/skinned_blas_refit/diff_traced_against_rasterized.js +2 -1
- package/src/shade/playground/skinned_blas_refit/main.d.ts.map +1 -1
- package/src/shade/playground/skinned_blas_refit/main.js +11 -19
- package/src/shade/playground/skinned_blas_refit/place_character.d.ts +6 -3
- package/src/shade/playground/skinned_blas_refit/place_character.d.ts.map +1 -1
- package/src/shade/playground/skinned_blas_refit/place_character.js +90 -90
- package/src/shade/playground/skinned_mesh_soup/main.d.ts.map +1 -1
- package/src/shade/playground/skinned_mesh_soup/main.js +502 -509
- package/src/shade/playground/skinned_mesh_soup/verify_clone_vertices.d.ts.map +1 -1
- package/src/shade/playground/skinned_mesh_soup/verify_clone_vertices.js +2 -1
- package/src/shade/playground/ssr_variance/statistics.d.ts.map +1 -1
- package/src/shade/playground/ssr_variance/statistics.js +2 -1
- package/src/shade/playground/texture_encode/README.md +129 -109
- package/src/shade/playground/texture_encode/main.d.ts.map +1 -1
- package/src/shade/playground/texture_encode/main.js +1431 -1430
- package/src/shade/playground/volumetrics_froxel/measure.d.ts.map +1 -1
- package/src/shade/playground/volumetrics_froxel/measure.js +2 -1
- package/src/shade/renderer/animation/GPUAnimationManager.d.ts +45 -14
- package/src/shade/renderer/animation/GPUAnimationManager.d.ts.map +1 -1
- package/src/shade/renderer/animation/GPUAnimationManager.js +316 -64
- package/src/shade/renderer/animation/skinning/GPUMeshSkinningContext.d.ts +5 -0
- package/src/shade/renderer/animation/skinning/GPUMeshSkinningContext.d.ts.map +1 -1
- package/src/shade/renderer/animation/skinning/GPUMeshSkinningContext.js +11 -1
- package/src/shade/renderer/buffer/table/gpu_database_check_links.d.ts.map +1 -1
- package/src/shade/renderer/buffer/table/gpu_database_check_links.js +2 -1
- package/src/shade/renderer/geometry/BoxGeometry.d.ts +1 -11
- package/src/shade/renderer/geometry/BoxGeometry.d.ts.map +1 -1
- package/src/shade/renderer/geometry/BoxGeometry.js +6 -13
- package/src/shade/renderer/geometry/CapsuleGeometry.d.ts +19 -0
- package/src/shade/renderer/geometry/CapsuleGeometry.d.ts.map +1 -0
- package/src/shade/renderer/geometry/CapsuleGeometry.js +24 -0
- package/src/shade/renderer/geometry/ConeGeometry.d.ts +20 -0
- package/src/shade/renderer/geometry/ConeGeometry.d.ts.map +1 -0
- package/src/shade/renderer/geometry/ConeGeometry.js +33 -0
- package/src/shade/renderer/geometry/CylinderGeometry.d.ts +21 -0
- package/src/shade/renderer/geometry/CylinderGeometry.d.ts.map +1 -0
- package/src/shade/renderer/geometry/CylinderGeometry.js +35 -0
- package/src/shade/renderer/geometry/PlaneGeometry.d.ts +17 -0
- package/src/shade/renderer/geometry/PlaneGeometry.d.ts.map +1 -0
- package/src/shade/renderer/geometry/PlaneGeometry.js +22 -0
- package/src/shade/renderer/geometry/TorusGeometry.d.ts +18 -0
- package/src/shade/renderer/geometry/TorusGeometry.d.ts.map +1 -0
- package/src/shade/renderer/geometry/TorusGeometry.js +23 -0
- package/src/shade/renderer/geometry/UVSphereGeometry.d.ts +21 -0
- package/src/shade/renderer/geometry/UVSphereGeometry.d.ts.map +1 -0
- package/src/shade/renderer/geometry/UVSphereGeometry.js +34 -0
- package/src/shade/renderer/geometry/primitives/make_capsule_geometry.d.ts +19 -0
- package/src/shade/renderer/geometry/primitives/make_capsule_geometry.d.ts.map +1 -0
- package/src/shade/renderer/geometry/primitives/make_capsule_geometry.js +205 -0
- package/src/shade/renderer/geometry/primitives/make_cone_geometry.d.ts +21 -0
- package/src/shade/renderer/geometry/primitives/make_cone_geometry.d.ts.map +1 -0
- package/src/shade/renderer/geometry/primitives/make_cone_geometry.js +36 -0
- package/src/shade/renderer/geometry/primitives/make_cylinder_geometry.d.ts +1 -1
- package/src/shade/renderer/geometry/primitives/make_cylinder_geometry.d.ts.map +1 -1
- package/src/shade/renderer/geometry/primitives/make_cylinder_geometry.js +44 -9
- package/src/shade/renderer/geometry/primitives/make_uv_sphere_geometry.d.ts +20 -0
- package/src/shade/renderer/geometry/primitives/make_uv_sphere_geometry.d.ts.map +1 -0
- package/src/shade/renderer/geometry/primitives/make_uv_sphere_geometry.js +190 -0
- package/src/shade/renderer/geometry/virtual/build/level/vgeo_build_group_step.d.ts.map +1 -1
- package/src/shade/renderer/geometry/virtual/build/level/vgeo_build_group_step.js +3 -2
- package/src/shade/renderer/geometry/virtual/build/level/vgeo_build_leaf_frontier.d.ts.map +1 -1
- package/src/shade/renderer/geometry/virtual/build/level/vgeo_build_leaf_frontier.js +2 -1
- package/src/shade/renderer/geometry/virtual/build/level/vgeo_partition_into_groups.d.ts.map +1 -1
- package/src/shade/renderer/geometry/virtual/build/level/vgeo_partition_into_groups.js +2 -1
- package/src/shade/renderer/geometry/virtual/build/level/vgeo_run_round.d.ts.map +1 -1
- package/src/shade/renderer/geometry/virtual/build/level/vgeo_run_round.js +2 -1
- package/src/shade/renderer/geometry/virtual/build/level/vgeo_try_repack.d.ts.map +1 -1
- package/src/shade/renderer/geometry/virtual/build/level/vgeo_try_repack.js +3 -2
- package/src/shade/renderer/geometry/virtual/build/partition/vgeo_graph_components.d.ts.map +1 -1
- package/src/shade/renderer/geometry/virtual/build/partition/vgeo_graph_components.js +2 -1
- package/src/shade/renderer/geometry/virtual/build/partition/vgeo_split_face_set_packed.d.ts.map +1 -1
- package/src/shade/renderer/geometry/virtual/build/partition/vgeo_split_face_set_packed.js +2 -1
- package/src/shade/renderer/geometry/virtual/format/vgeo_write_container.d.ts.map +1 -1
- package/src/shade/renderer/geometry/virtual/format/vgeo_write_container.js +3 -2
- package/src/shade/renderer/geometry/virtual/runtime/graph_vgeo_expand_instances_to_meshlets.d.ts.map +1 -1
- package/src/shade/renderer/geometry/virtual/runtime/graph_vgeo_expand_instances_to_meshlets.js +7 -2
- package/src/shade/renderer/gpu_primitive/prefix_sum/v1/graph_prefix_scan_csdldf.d.ts +26 -8
- package/src/shade/renderer/gpu_primitive/prefix_sum/v1/graph_prefix_scan_csdldf.d.ts.map +1 -1
- package/src/shade/renderer/gpu_primitive/prefix_sum/v1/graph_prefix_scan_csdldf.js +56 -39
- package/src/shade/renderer/gpu_primitive/prefix_sum/v1/shader_prefix_scan_csdldf.d.ts +7 -0
- package/src/shade/renderer/gpu_primitive/prefix_sum/v1/shader_prefix_scan_csdldf.d.ts.map +1 -1
- package/src/shade/renderer/gpu_primitive/prefix_sum/v1/shader_prefix_scan_csdldf.js +46 -4
- package/src/shade/renderer/gpu_primitive/prefix_sum/v1/test_prefix_sum.d.ts.map +1 -1
- package/src/shade/renderer/gpu_primitive/prefix_sum/v1/test_prefix_sum.js +4 -2
- package/src/shade/renderer/gpu_primitive/sort/defs.d.ts +2 -2
- package/src/shade/renderer/gpu_primitive/sort/defs.js +79 -79
- package/src/shade/renderer/gpu_primitive/sort/graph_radix_sort.d.ts +1 -1
- package/src/shade/renderer/gpu_primitive/sort/graph_radix_sort.d.ts.map +1 -1
- package/src/shade/renderer/gpu_primitive/sort/graph_radix_sort.js +7 -3
- package/src/shade/renderer/particles/GPUParticleSystem.js +1 -1
- package/src/shade/renderer/particles/coherence/graph_particle_bucket.d.ts +4 -3
- package/src/shade/renderer/particles/coherence/graph_particle_bucket.d.ts.map +1 -1
- package/src/shade/renderer/particles/coherence/graph_particle_bucket.js +200 -194
- package/src/shade/renderer/particles/graph_particles.d.ts.map +1 -1
- package/src/shade/renderer/particles/graph_particles.js +6 -2
- package/src/shade/renderer/particles/optimizer/dag/particle_vector_extract.d.ts.map +1 -1
- package/src/shade/renderer/particles/optimizer/dag/particle_vector_extract.js +3 -2
- package/src/shade/renderer/particles/warmup/graph_particle_warmup.d.ts.map +1 -1
- package/src/shade/renderer/particles/warmup/graph_particle_warmup.js +334 -329
- package/src/shade/renderer/rasterize/bucket/prepare_meshlet_draw_commands_by_material.d.ts.map +1 -1
- package/src/shade/renderer/rasterize/bucket/prepare_meshlet_draw_commands_by_material.js +7 -2
- package/src/shade/renderer/rasterize/expand/mesh/graph_expand_meshes_to_meshlets.d.ts.map +1 -1
- package/src/shade/renderer/rasterize/expand/mesh/graph_expand_meshes_to_meshlets.js +16 -4
- package/src/shade/renderer/texture/COMPRESSED_TEXTURE_PLAN_2026_09_01.md +2444 -2345
- package/src/shade/renderer/texture/encode/chunk_astc_encode_block_4x4_rgb.d.ts.map +1 -1
- package/src/shade/renderer/texture/encode/chunk_astc_encode_block_4x4_rgb.js +312 -310
- package/src/shade/renderer/texture/encode/chunk_bc1_encode_block.d.ts +3 -3
- package/src/shade/renderer/texture/encode/chunk_bc1_encode_block.d.ts.map +1 -1
- package/src/shade/renderer/texture/encode/chunk_bc1_encode_block.js +383 -375
- package/src/shade/renderer/texture/encode/chunk_bc6h_encode_block_mode11.d.ts.map +1 -1
- package/src/shade/renderer/texture/encode/chunk_bc6h_encode_block_mode11.js +349 -346
- package/src/shade/renderer/texture/encode/chunk_bc7_encode_block.d.ts +58 -0
- package/src/shade/renderer/texture/encode/chunk_bc7_encode_block.d.ts.map +1 -0
- package/src/shade/renderer/texture/encode/chunk_bc7_encode_block.js +536 -0
- package/src/shade/renderer/texture/encode/chunk_bc7_encode_block_mode6.d.ts +21 -7
- package/src/shade/renderer/texture/encode/chunk_bc7_encode_block_mode6.d.ts.map +1 -1
- package/src/shade/renderer/texture/encode/chunk_bc7_encode_block_mode6.js +291 -327
- package/src/shade/renderer/texture/encode/chunk_bc7_pack_mode1.d.ts +25 -0
- package/src/shade/renderer/texture/encode/chunk_bc7_pack_mode1.d.ts.map +1 -0
- package/src/shade/renderer/texture/encode/chunk_bc7_pack_mode1.js +99 -0
- package/src/shade/renderer/texture/encode/chunk_bc7_pack_mode6.d.ts +5 -3
- package/src/shade/renderer/texture/encode/chunk_bc7_pack_mode6.d.ts.map +1 -1
- package/src/shade/renderer/texture/encode/chunk_bc7_pack_mode6.js +47 -71
- package/src/shade/renderer/texture/encode/chunk_bc7_partition_2.d.ts +10 -0
- package/src/shade/renderer/texture/encode/chunk_bc7_partition_2.d.ts.map +1 -0
- package/src/shade/renderer/texture/encode/chunk_bc7_partition_2.js +50 -0
- package/src/shade/renderer/texture/encode/shader_texture_encode_bc7.d.ts +4 -5
- package/src/shade/renderer/texture/encode/shader_texture_encode_bc7.d.ts.map +1 -1
- package/src/shade/renderer/texture/encode/shader_texture_encode_bc7.js +7 -8
- package/src/shade/renderer/water/chunk_water_transport.d.ts.map +1 -1
- package/src/shade/renderer/water/chunk_water_transport.js +7 -5
- package/src/shade/renderer/water/medium/GPUWaterBodies.d.ts.map +1 -1
- package/src/shade/renderer/water/medium/GPUWaterBodies.js +8 -2
- package/src/shade/renderer/water/optics/chunk_water_receiver_downwelling.d.ts +3 -2
- package/src/shade/renderer/water/optics/chunk_water_receiver_downwelling.d.ts.map +1 -1
- package/src/shade/renderer/water/optics/chunk_water_receiver_downwelling.js +3 -2
- package/src/shade/renderer/water/shader_water.d.ts.map +1 -1
- package/src/shade/renderer/water/shader_water.js +3 -1
- package/src/shade/renderer/water/surface/GPUWaterSurface.d.ts.map +1 -1
- package/src/shade/renderer/water/surface/GPUWaterSurface.js +3 -1
- package/src/shade/renderer/water/surface/graph_water_tessellation.d.ts.map +1 -1
- package/src/shade/renderer/water/surface/graph_water_tessellation.js +11 -4
- package/src/shade/renderer/water/surface/particles/GPUWaterParticles.d.ts.map +1 -1
- package/src/shade/renderer/water/surface/particles/GPUWaterParticles.js +37 -20
- package/src/shade/wgsl/validate_wgsl_source.d.ts.map +1 -1
- package/src/shade/wgsl/validate_wgsl_source.js +74 -3
- package/src/engine/graphics3/register_instance_animation.d.ts +0 -114
- package/src/engine/graphics3/register_instance_animation.d.ts.map +0 -1
- package/src/engine/graphics3/register_instance_animation.js +0 -201
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { assert } from "../../../../../core/assert.js";
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
graph_prefix_scan_csdldf,
|
|
4
|
+
prefix_scan_csdldf_output_descriptor
|
|
5
|
+
} from "../../../gpu_primitive/prefix_sum/v1/graph_prefix_scan_csdldf.js";
|
|
3
6
|
import {
|
|
4
7
|
build_indirect_compute_dispatch_command,
|
|
5
8
|
INDIRECT_COMPUTE_COMMAND_DESCRIPTOR
|
|
@@ -53,11 +56,14 @@ export class GPUWaterParticles {
|
|
|
53
56
|
#parity = 0;
|
|
54
57
|
#particles = [];
|
|
55
58
|
#children = null;
|
|
59
|
+
#child_sums = null;
|
|
56
60
|
#images = null;
|
|
57
61
|
#fronts = null;
|
|
62
|
+
#front_sums = null;
|
|
58
63
|
#runs = null;
|
|
59
64
|
#draw = null;
|
|
60
65
|
#buckets = null;
|
|
66
|
+
#offsets = null;
|
|
61
67
|
#slots = null;
|
|
62
68
|
#bucket_amplitude = null;
|
|
63
69
|
#bucket_weight = null;
|
|
@@ -69,7 +75,7 @@ export class GPUWaterParticles {
|
|
|
69
75
|
#commands = null;
|
|
70
76
|
|
|
71
77
|
/** @returns {GPUBuffer} the frame's hash: table size, then inclusive bucket offsets */
|
|
72
|
-
get offsets() { return this.#
|
|
78
|
+
get offsets() { return this.#offsets; }
|
|
73
79
|
/** @returns {GPUBuffer} the frame's entries, bucket by bucket, each bucket ordered by particle */
|
|
74
80
|
get entries() { return this.#entries; }
|
|
75
81
|
/** @returns {GPUBuffer} per wave row: occupied-level mask, then a height bound per level (f32 bits) */
|
|
@@ -102,15 +108,21 @@ export class GPUWaterParticles {
|
|
|
102
108
|
size: Math.max(16, size), usage: GPUBufferUsage.STORAGE | GPUBufferUsage.COPY_DST | GPUBufferUsage.COPY_SRC | usage });
|
|
103
109
|
const array_size = 16 + capacity * WATER_PARTICLE_STRUCT.size;
|
|
104
110
|
this.#particles = [buffer('a', array_size), buffer('b', array_size)];
|
|
111
|
+
// a scan reads one buffer and writes another: per particle how many it leaves, then where they end
|
|
112
|
+
const sums = elements => prefix_scan_csdldf_output_descriptor(elements).size;
|
|
105
113
|
this.#children = buffer('children', 16 + capacity * 4);
|
|
114
|
+
this.#child_sums = buffer('child sums', sums(capacity));
|
|
106
115
|
// per particle the mirror image the step left beside it at the outline
|
|
107
116
|
this.#images = buffer('images', capacity * WATER_PARTICLE_STRUCT.size);
|
|
108
|
-
// per particle the scanned run it is in; per run its first particle and its
|
|
109
|
-
// and how it is drawn
|
|
117
|
+
// per particle whether it starts a run, then the scanned run it is in; per run its first particle and its
|
|
118
|
+
// share; per particle its run and how it is drawn
|
|
110
119
|
this.#fronts = buffer('fronts', 16 + capacity * 4);
|
|
120
|
+
this.#front_sums = buffer('front sums', sums(capacity));
|
|
111
121
|
this.#runs = buffer('runs', capacity * 8);
|
|
112
122
|
this.#draw = buffer('draw', capacity * 8);
|
|
123
|
+
// per bucket its entries, then the hash: table size and inclusive offsets
|
|
113
124
|
this.#buckets = buffer('buckets', 16 + this.#table_limit * 4);
|
|
125
|
+
this.#offsets = buffer('offsets', sums(this.#table_limit));
|
|
114
126
|
this.#slots = buffer('slots', capacity * WATER_PARTICLE_CORNERS * 4);
|
|
115
127
|
this.#bucket_amplitude = buffer('bucket amplitude', this.#table_limit * 4);
|
|
116
128
|
// the summed steepness, the largest front and front complement entered, and the entries; then the most a point
|
|
@@ -145,13 +157,15 @@ export class GPUWaterParticles {
|
|
|
145
157
|
}
|
|
146
158
|
|
|
147
159
|
dispose() {
|
|
148
|
-
for (const buffer of [...this.#particles, this.#children, this.#
|
|
149
|
-
this.#
|
|
160
|
+
for (const buffer of [...this.#particles, this.#children, this.#child_sums, this.#images, this.#fronts, this.#front_sums, this.#runs,
|
|
161
|
+
this.#draw, this.#buckets, this.#offsets, this.#slots, this.#bucket_amplitude, this.#bucket_weight, this.#bucket_nest, this.#visible,
|
|
162
|
+
this.#staging, this.#entries, this.#body_bounds, ...(this.#commands ?? [])]) {
|
|
150
163
|
buffer?.destroy();
|
|
151
164
|
}
|
|
152
165
|
this.#particles = [];
|
|
153
|
-
this.#children = this.#
|
|
154
|
-
this.#
|
|
166
|
+
this.#children = this.#child_sums = this.#images = this.#buckets = this.#offsets = this.#slots = this.#bucket_amplitude = null;
|
|
167
|
+
this.#staging = this.#entries = null;
|
|
168
|
+
this.#fronts = this.#front_sums = this.#runs = this.#draw = null;
|
|
155
169
|
this.#bucket_weight = this.#bucket_nest = this.#visible = null;
|
|
156
170
|
this.#body_bounds = null;
|
|
157
171
|
this.#commands = null;
|
|
@@ -188,8 +202,11 @@ export class GPUWaterParticles {
|
|
|
188
202
|
const [command_current, command_next, command_table] = this.#commands;
|
|
189
203
|
const geometries = scene.geometries;
|
|
190
204
|
let children = graph_import_buffer(graph, this.#children, 'Water / particle children');
|
|
205
|
+
let child_sums = graph_import_buffer(graph, this.#child_sums, 'Water / particle child sums');
|
|
191
206
|
let buckets = graph_import_buffer(graph, this.#buckets, 'Water / particle buckets');
|
|
207
|
+
let offsets = graph_import_buffer(graph, this.#offsets, 'Water / particle offsets');
|
|
192
208
|
let fronts = graph_import_buffer(graph, this.#fronts, 'Water / particle fronts');
|
|
209
|
+
let front_sums = graph_import_buffer(graph, this.#front_sums, 'Water / particle front sums');
|
|
193
210
|
const node = (name, execute, reads, writes) => {
|
|
194
211
|
const data = {};
|
|
195
212
|
const pass = graph.add(name, data, (d, resources, context) => execute(resources, context, d));
|
|
@@ -211,19 +228,19 @@ export class GPUWaterParticles {
|
|
|
211
228
|
meshlet_metadata: geometries.meshlets.buffer_metadata, meshlet_data: geometries.meshlets.buffer_data,
|
|
212
229
|
} });
|
|
213
230
|
}, {}, { children }).children;
|
|
214
|
-
|
|
231
|
+
child_sums = graph_prefix_scan_csdldf({ graph, input: children, output: child_sums, element_max_count: capacity });
|
|
215
232
|
|
|
216
233
|
// What they leave into the next array, then the frame's splashes after them.
|
|
217
234
|
node('Water / particles split and emit', (resources, { encoder }) => {
|
|
218
235
|
shader_water_particles_split.dispatchIndirect({ encoder, command: command_current, bindings: {
|
|
219
|
-
capacity, particles: current, children: this.#
|
|
220
|
-
shader_water_particles_total.dispatch({ encoder, bindings: { capacity, children: this.#
|
|
236
|
+
capacity, particles: current, children: this.#child_sums, images: this.#images, next } });
|
|
237
|
+
shader_water_particles_total.dispatch({ encoder, bindings: { capacity, children: this.#child_sums, next } });
|
|
221
238
|
shader_water_particles_emit.dispatchIndirect({ encoder, command: commands, command_offset: emit_command,
|
|
222
239
|
bindings: { capacity, scene_database: scene.scene_database_buffer, emit_rows, steep, activity,
|
|
223
240
|
particle_bounds: this.#body_bounds, next } });
|
|
224
241
|
shader_water_particles_finalize.dispatch({ encoder, bindings: { limits: { capacity, table_limit }, next, offsets: this.#buckets,
|
|
225
242
|
table_command: command_table } });
|
|
226
|
-
}, {
|
|
243
|
+
}, { child_sums }, {});
|
|
227
244
|
}
|
|
228
245
|
|
|
229
246
|
// Each front's run of particles, so that a whole one is drawn as the seven it was emitted as.
|
|
@@ -237,14 +254,14 @@ export class GPUWaterParticles {
|
|
|
237
254
|
encoder.copyBufferToBuffer(next, 0, this.#fronts, 0, 4);
|
|
238
255
|
shader_water_particles_fronts.dispatchIndirect({ encoder, command: command_next, bindings: { next, fronts: this.#fronts } });
|
|
239
256
|
}, {}, { fronts }).fronts;
|
|
240
|
-
|
|
257
|
+
front_sums = graph_prefix_scan_csdldf({ graph, input: fronts, output: front_sums, element_max_count: capacity });
|
|
241
258
|
|
|
242
259
|
// The frame's hash: how each particle is drawn, how crowded each cell is and so how much of each run its crowd
|
|
243
260
|
// leaves drawn, then each packet drawn into the cells its support overlaps, offsets, entries in order.
|
|
244
261
|
buckets = node('Water / particles bin', (resources, { encoder }) => {
|
|
245
262
|
const draw = this.#draw, runs = this.#runs;
|
|
246
|
-
shader_water_particles_runs.dispatchIndirect({ encoder, command: command_next, bindings: { next, fronts: this.#
|
|
247
|
-
shader_water_particles_groups.dispatchIndirect({ encoder, command: command_next, bindings: { next, fronts: this.#
|
|
263
|
+
shader_water_particles_runs.dispatchIndirect({ encoder, command: command_next, bindings: { next, fronts: this.#front_sums, runs } });
|
|
264
|
+
shader_water_particles_groups.dispatchIndirect({ encoder, command: command_next, bindings: { next, fronts: this.#front_sums, runs, draw } });
|
|
248
265
|
shader_water_particles_clear.dispatchIndirect({ encoder, command: command_table, bindings: {
|
|
249
266
|
buckets: this.#buckets, bucket_amplitude: this.#bucket_amplitude, bucket_weight: this.#bucket_weight,
|
|
250
267
|
bucket_nest: this.#bucket_nest } });
|
|
@@ -259,16 +276,16 @@ export class GPUWaterParticles {
|
|
|
259
276
|
shader_water_particles_bin.dispatchIndirect({ encoder, command: command_next, bindings: {
|
|
260
277
|
next, activity, buckets: this.#buckets, slots: this.#slots, bucket_amplitude: this.#bucket_amplitude,
|
|
261
278
|
body_bounds: this.#body_bounds, draw, runs, visible: this.#visible } });
|
|
262
|
-
}, {
|
|
263
|
-
|
|
279
|
+
}, { front_sums }, { buckets }).buckets;
|
|
280
|
+
offsets = graph_prefix_scan_csdldf({ graph, input: buckets, output: offsets, element_max_count: table_limit });
|
|
264
281
|
node('Water / particles order and bound', (resources, { encoder }) => {
|
|
265
|
-
const bindings = { next, offsets: this.#
|
|
282
|
+
const bindings = { next, offsets: this.#offsets, slots: this.#slots, draw: this.#draw };
|
|
266
283
|
shader_water_particles_scatter.dispatchIndirect({ encoder, command: command_next, bindings: { ...bindings,
|
|
267
284
|
visible: this.#visible, staging: this.#staging } });
|
|
268
285
|
shader_water_particles_rank.dispatchIndirect({ encoder, command: command_next, bindings: { ...bindings,
|
|
269
286
|
staging: this.#staging, entries: this.#entries } });
|
|
270
287
|
shader_water_particles_bounds.dispatchIndirect({ encoder, command: command_next, bindings: { next, activity,
|
|
271
|
-
offsets: this.#
|
|
272
|
-
}, {
|
|
288
|
+
offsets: this.#offsets, bucket_amplitude: this.#bucket_amplitude, draw: this.#draw, body_bounds: this.#body_bounds } });
|
|
289
|
+
}, { offsets }, {});
|
|
273
290
|
}
|
|
274
291
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validate_wgsl_source.d.ts","sourceRoot":"","sources":["../../../../src/shade/wgsl/validate_wgsl_source.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"validate_wgsl_source.d.ts","sourceRoot":"","sources":["../../../../src/shade/wgsl/validate_wgsl_source.js"],"names":[],"mappings":"AAqMA;;;;;;GAMG;AACH,6CAJW,MAAM,UACN,OAAO,iBAAiB,EAAE,UAAU,GAClC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,EAAE,CAsP7D"}
|
|
@@ -12,6 +12,8 @@ import { WGSLLanguageCore } from "./emulator/WGSLLanguageCore.js";
|
|
|
12
12
|
* - immutable-assignment: assigning to a `let`/`const` local or a function parameter
|
|
13
13
|
* (all immutable in WGSL); only `var` is mutable.
|
|
14
14
|
* - swizzle-store: assigning to a multi-component swizzle (`v.xy = …`), which WGSL forbids.
|
|
15
|
+
* A struct may name a member `xy`, and then the store is legal; where one does, only a base
|
|
16
|
+
* declared as a vector is flagged.
|
|
15
17
|
* - foreign-token: HLSL/GLSL constructs that are not WGSL (`float3`, `int2`, `#if`,
|
|
16
18
|
* `imageAtomicMax`, `lerp(`, `rsqrt(`, …) — unambiguous, lexical.
|
|
17
19
|
* - reserved-keyword: an identifier that is a WGSL reserved word (`target`, `filter`,
|
|
@@ -87,13 +89,16 @@ const WGSL_BUILTIN_NAMES = new Set([
|
|
|
87
89
|
|
|
88
90
|
const SWIZZLE_COMPONENTS = /^[xyzwrgba]+$/;
|
|
89
91
|
const LHS_SWIZZLE_TAIL = /\.([xyzwrgba]{2,})\s*$/;
|
|
92
|
+
const VECTOR_TYPE_NAME = /^vec[234][fhiu]?$/;
|
|
90
93
|
|
|
91
|
-
// Unambiguous non-WGSL tokens. Each entry is a regex and a human label.
|
|
94
|
+
// Unambiguous non-WGSL tokens. Each entry is a regex and a human label. The bare scalar names
|
|
95
|
+
// (`float`, `int`, `half`, `fixed`) are neither keywords nor reserved words in WGSL, so they are
|
|
96
|
+
// legal identifiers (`let half = n / 2u;`) and only their vector forms are matched.
|
|
92
97
|
const FOREIGN_TOKENS = [
|
|
93
98
|
[/\bfloat[1-4]x[1-4]\b/, 'HLSL matrix type (use matNxM<f32>)'],
|
|
94
99
|
[/\bfloat[2-4]\b/, 'HLSL vector type (use vecN<f32>)'],
|
|
95
100
|
[/\b(?:int|uint)[2-4]\b/, 'HLSL integer vector type (use vecN<i32|u32>)'],
|
|
96
|
-
[/\b(?:half|fixed)[2-4]
|
|
101
|
+
[/\b(?:half|fixed)[2-4]\b/, 'HLSL vector type (use vecN<f16>)'],
|
|
97
102
|
[/#\s*(?:if|ifdef|ifndef|endif|else|elif|define|pragma)\b/, 'C-preprocessor directive'],
|
|
98
103
|
[/\bimageAtomic(?:Max|Min|Add|And|Or|Xor|Exchange)\b/, 'GLSL image atomic (use atomic* on a storage binding)'],
|
|
99
104
|
[/\bimageStore\b/, 'GLSL imageStore (use textureStore)'],
|
|
@@ -153,6 +158,31 @@ function firstIdentToken(node) {
|
|
|
153
158
|
return null;
|
|
154
159
|
}
|
|
155
160
|
|
|
161
|
+
/**
|
|
162
|
+
* Whether a `type_specifier` or `call_phrase` names a vector type (`vec3<f32>`, `vec4f`, …).
|
|
163
|
+
* @param {Node} node
|
|
164
|
+
*/
|
|
165
|
+
function namesVector(node) {
|
|
166
|
+
const ident = node.namedChildren.find(c => c.type === 'template_elaborated_ident')
|
|
167
|
+
?.namedChildren.find(c => c.type === 'ident');
|
|
168
|
+
return ident !== undefined && VECTOR_TYPE_NAME.test(ident.text.trim());
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
/**
|
|
172
|
+
* Whether a declaration can be seen to be a vector without inferring types: its type annotation
|
|
173
|
+
* names one, or, unannotated, its whole initializer is a vector constructor (`vec3<f32>(0.0)`).
|
|
174
|
+
* @param {Node|undefined} type_specifier
|
|
175
|
+
* @param {Node|undefined} initializer
|
|
176
|
+
*/
|
|
177
|
+
function declaresVector(type_specifier, initializer) {
|
|
178
|
+
if (type_specifier !== undefined) return namesVector(type_specifier);
|
|
179
|
+
if (initializer === undefined) return false;
|
|
180
|
+
|
|
181
|
+
let node = initializer;
|
|
182
|
+
while (node.namedChildren.length === 1) node = node.namedChildren[0];
|
|
183
|
+
return node.type === 'call_phrase' && namesVector(node);
|
|
184
|
+
}
|
|
185
|
+
|
|
156
186
|
/**
|
|
157
187
|
* Strip line comments and block comments and string-free WGSL has no strings, so a coarse
|
|
158
188
|
* comment strip is enough to keep the lexical foreign-token scan from firing inside a
|
|
@@ -181,6 +211,8 @@ export function validate_wgsl_source(source, parser) {
|
|
|
181
211
|
// ── collect the symbol table (user functions + structs) ──
|
|
182
212
|
const declared_functions = new Set();
|
|
183
213
|
const declared_structs = new Set();
|
|
214
|
+
/** Every struct member name; one shaped like a swizzle makes `x.xy = …` legal on that struct. */
|
|
215
|
+
const declared_members = new Set();
|
|
184
216
|
|
|
185
217
|
for (const fn of descendantsOfType(root, 'function_decl')) {
|
|
186
218
|
const header = fn.namedChildren.find(c => c.type === 'function_header');
|
|
@@ -191,6 +223,11 @@ export function validate_wgsl_source(source, parser) {
|
|
|
191
223
|
for (const s of descendantsOfType(root, 'struct_decl')) {
|
|
192
224
|
const ident = s.namedChildren.find(c => c.type === 'ident');
|
|
193
225
|
if (ident !== undefined) declared_structs.add(ident.text.trim());
|
|
226
|
+
|
|
227
|
+
for (const member of descendantsOfType(s, 'struct_member')) {
|
|
228
|
+
const name = member.namedChildren.find(c => c.type === 'member_ident');
|
|
229
|
+
if (name !== undefined) declared_members.add(name.text.trim());
|
|
230
|
+
}
|
|
194
231
|
}
|
|
195
232
|
|
|
196
233
|
const core_builtins = new Set(Object.keys(WGSLLanguageCore));
|
|
@@ -209,6 +246,21 @@ export function validate_wgsl_source(source, parser) {
|
|
|
209
246
|
/** Everything a const-expression may NOT read: parameters, `var`, `let`. @type {Set<string>} */
|
|
210
247
|
const runtime = new Set();
|
|
211
248
|
|
|
249
|
+
// Scopes are flat here, so a name is a vector only if every declaration of it says so.
|
|
250
|
+
/** Names every declaration of which is seen to be a vector. @type {Set<string>} */
|
|
251
|
+
const vectors = new Set();
|
|
252
|
+
/** Names declared at least once as anything else. @type {Set<string>} */
|
|
253
|
+
const not_vectors = new Set();
|
|
254
|
+
|
|
255
|
+
const declare_vector = (name, is_vector) => {
|
|
256
|
+
if (is_vector && !not_vectors.has(name)) {
|
|
257
|
+
vectors.add(name);
|
|
258
|
+
} else {
|
|
259
|
+
vectors.delete(name);
|
|
260
|
+
not_vectors.add(name);
|
|
261
|
+
}
|
|
262
|
+
};
|
|
263
|
+
|
|
212
264
|
// Value parameters are immutable; POINTER parameters are not — writing through a
|
|
213
265
|
// pointer (`*p = …`, `p.x = …`, `memory[i] = …`) is the legal, common case in this
|
|
214
266
|
// codebase, so excluding them is what keeps this rule free of false positives.
|
|
@@ -223,6 +275,7 @@ export function validate_wgsl_source(source, parser) {
|
|
|
223
275
|
if (!is_pointer) immutable.add(id.text.trim());
|
|
224
276
|
|
|
225
277
|
runtime.add(id.text.trim());
|
|
278
|
+
declare_vector(id.text.trim(), declaresVector(type, undefined));
|
|
226
279
|
}
|
|
227
280
|
}
|
|
228
281
|
}
|
|
@@ -237,6 +290,11 @@ export function validate_wgsl_source(source, parser) {
|
|
|
237
290
|
const name = opt !== undefined && opt !== null ? firstIdentToken(opt) : null;
|
|
238
291
|
if (name === null) continue;
|
|
239
292
|
|
|
293
|
+
declare_vector(name, declaresVector(
|
|
294
|
+
opt.namedChildren.find(c => c.type === 'type_specifier'),
|
|
295
|
+
decl.namedChildren.find(c => c.type === 'expression'),
|
|
296
|
+
));
|
|
297
|
+
|
|
240
298
|
if (is_var) {
|
|
241
299
|
mutable.add(name);
|
|
242
300
|
immutable.delete(name);
|
|
@@ -269,8 +327,21 @@ export function validate_wgsl_source(source, parser) {
|
|
|
269
327
|
if (lhs === undefined) return;
|
|
270
328
|
|
|
271
329
|
// swizzle-store
|
|
330
|
+
//
|
|
331
|
+
// `.xy` is an l-value only as a struct member, so with no struct declaring one the
|
|
332
|
+
// store is illegal whatever the base is. With one, the base has to be seen to be a
|
|
333
|
+
// vector: a parameter or local declared as one and stored to directly (`v.xy`).
|
|
272
334
|
const tail = lhs.text.match(LHS_SWIZZLE_TAIL);
|
|
273
|
-
|
|
335
|
+
const core = lhs.namedChildren.find(c => c.type === 'core_lhs_expression');
|
|
336
|
+
const access = lhs.namedChildren.find(c => c.type === 'component_or_swizzle_specifier');
|
|
337
|
+
const base = core?.namedChildren.find(c => c.type === 'ident');
|
|
338
|
+
const on_vector = base !== undefined
|
|
339
|
+
&& access !== undefined
|
|
340
|
+
&& access.namedChildren.length === 1
|
|
341
|
+
&& access.namedChildren[0].type === 'member_ident'
|
|
342
|
+
&& vectors.has(base.text.trim());
|
|
343
|
+
|
|
344
|
+
if (tail !== null && SWIZZLE_COMPONENTS.test(tail[1]) && (!declared_members.has(tail[1]) || on_vector)) {
|
|
274
345
|
diagnostics.push({
|
|
275
346
|
rule: 'swizzle-store',
|
|
276
347
|
message: `assignment to multi-component swizzle '.${tail[1]}' is not an l-value in WGSL`,
|
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Hand one entity's instance to the GPU: its skins become deformations.
|
|
3
|
-
*
|
|
4
|
-
* **Registration is eventually consistent by design**, which is what makes this callable the moment
|
|
5
|
-
* an instance exists rather than at some later moment when the scene is known to be built. An id is
|
|
6
|
-
* allocated and returned synchronously, while the skin's meshes are bound to it only once every
|
|
7
|
-
* joint has a row in the scene. Until then the skin is inert rather than wrong: its meshes draw
|
|
8
|
-
* undeformed.
|
|
9
|
-
*
|
|
10
|
-
* The instance's entities therefore do **not** have to hold their rows yet.
|
|
11
|
-
*
|
|
12
|
-
* @param {GPUSceneContext} context the scene's GPU state, which owns the manager and is what the
|
|
13
|
-
* registration is stamped with so it can be given back to the right one
|
|
14
|
-
* @param {PrefabInstance} instance its skins name joint and mesh entities
|
|
15
|
-
* @returns {InstanceAnimationRegistration}
|
|
16
|
-
*/
|
|
17
|
-
export function register_instance_animation(context: GPUSceneContext, instance: PrefabInstance): InstanceAnimationRegistration;
|
|
18
|
-
/**
|
|
19
|
-
* Give back everything {@link register_instance_animation} took out, for a manager that is still
|
|
20
|
-
* the one that issued it.
|
|
21
|
-
*
|
|
22
|
-
* **A destroyed manager must not be handed its own ids back.** A renderer restart takes the GPU
|
|
23
|
-
* scene context with it, and the ids it issued mean nothing to the context that replaces it — so
|
|
24
|
-
* the caller forgets them rather than returning them. This is only for the ordinary case: an entity
|
|
25
|
-
* that leaves while the renderer it registered with is still running, and the registration's own
|
|
26
|
-
* {@link InstanceAnimationRegistration#context} is how a caller tells the two apart.
|
|
27
|
-
*
|
|
28
|
-
* @param {InstanceAnimationRegistration} registration
|
|
29
|
-
*/
|
|
30
|
-
export function unregister_instance_animation(registration: InstanceAnimationRegistration): void;
|
|
31
|
-
/**
|
|
32
|
-
* Make some of an instance's clips playable — the ones a driver actually plays, and no others.
|
|
33
|
-
*
|
|
34
|
-
* **Registering a clip is not free of consequence, which is why this takes a set.** The pose
|
|
35
|
-
* accumulator marks a joint dirty for every bound clip that writes to it, whatever its weight, so a
|
|
36
|
-
* bound clip at weight zero resolves the joints only it drives to zero rather than leaving them at
|
|
37
|
-
* rest. A driver therefore registers what it can play and re-registers when that changes; a clip no
|
|
38
|
-
* driver claims is never bound and so moves nothing.
|
|
39
|
-
*
|
|
40
|
-
* Each index is registered once however many times it is named. Two states of one graph can play
|
|
41
|
-
* the same clip of the model, and two registrations of one clip are two rows the accumulator would
|
|
42
|
-
* add together.
|
|
43
|
-
*
|
|
44
|
-
* @param {GPUSceneContext} context
|
|
45
|
-
* @param {PrefabInstance} instance its clips target entities
|
|
46
|
-
* @param {ArrayLike<number>} slots indices into `instance.clips`; duplicates are ignored
|
|
47
|
-
* @returns {InstanceClipRegistration}
|
|
48
|
-
*/
|
|
49
|
-
export function register_instance_clips(context: GPUSceneContext, instance: PrefabInstance, slots: ArrayLike<number>): InstanceClipRegistration;
|
|
50
|
-
/**
|
|
51
|
-
* Give back everything {@link register_instance_clips} took out, for a manager that is still the one
|
|
52
|
-
* that issued it — see {@link unregister_instance_animation} for why that qualification matters.
|
|
53
|
-
*
|
|
54
|
-
* @param {InstanceClipRegistration} registration
|
|
55
|
-
*/
|
|
56
|
-
export function unregister_instance_clips(registration: InstanceClipRegistration): void;
|
|
57
|
-
/**
|
|
58
|
-
* What the animation manager handed back for one {@link PrefabInstance}'s **skins**.
|
|
59
|
-
*
|
|
60
|
-
* Positional: `skins[i]` is the id of the instance's `skins[i]`.
|
|
61
|
-
*
|
|
62
|
-
* **Clips are not here, and that is D37.** A skin belongs to the model — it is how the mesh
|
|
63
|
-
* deforms, and every placement of the model needs it whatever is playing — so the system that
|
|
64
|
-
* places the model registers it. A clip belongs to whatever plays it, and a clip nothing plays must
|
|
65
|
-
* not be registered at all: the pose accumulator marks a joint dirty for any *bound* clip, weight
|
|
66
|
-
* and all, so a joint driven only by clips at weight zero resolves to zero rather than to its rest
|
|
67
|
-
* pose. A model carrying clips and no animation component used to render the sum of every one of
|
|
68
|
-
* them. See {@link register_instance_clips}.
|
|
69
|
-
*/
|
|
70
|
-
export class InstanceAnimationRegistration {
|
|
71
|
-
/**
|
|
72
|
-
* The GPU scene context these ids were issued by.
|
|
73
|
-
*
|
|
74
|
-
* Carried rather than inferred, because **an id may only be handed back to the manager that
|
|
75
|
-
* issued it** and there is no other way to be sure. A renderer restart builds a new context, and
|
|
76
|
-
* a holder comparing this against what `scene_context` answers now knows in one `===` whether
|
|
77
|
-
* giving the ids back is returning them or corrupting a stranger's table — without depending on
|
|
78
|
-
* when anything last ran.
|
|
79
|
-
*
|
|
80
|
-
* @type {GPUSceneContext}
|
|
81
|
-
*/
|
|
82
|
-
context: GPUSceneContext;
|
|
83
|
-
/**
|
|
84
|
-
* @type {number[]}
|
|
85
|
-
*/
|
|
86
|
-
skins: number[];
|
|
87
|
-
}
|
|
88
|
-
/**
|
|
89
|
-
* The id a clip has when nobody registered it.
|
|
90
|
-
* @type {number}
|
|
91
|
-
*/
|
|
92
|
-
export const CLIP_NOT_REGISTERED: number;
|
|
93
|
-
/**
|
|
94
|
-
* Which of an instance's clips a driver has playable, by the instance's own clip index.
|
|
95
|
-
*
|
|
96
|
-
* `ids[i]` is the manager's id for `instance.clips[i]`, or {@link CLIP_NOT_REGISTERED} where this
|
|
97
|
-
* driver does not play that clip. Indexed by the instance rather than packed, because that is how
|
|
98
|
-
* both drivers already address a clip — the graph resolves a name to a model slot, the clip list
|
|
99
|
-
* does the same — and a packed array would want a second table to say what each entry was.
|
|
100
|
-
*/
|
|
101
|
-
export class InstanceClipRegistration {
|
|
102
|
-
/**
|
|
103
|
-
* The GPU scene context these ids were issued by. See
|
|
104
|
-
* {@link InstanceAnimationRegistration#context} — same reasoning, same `===` check.
|
|
105
|
-
*
|
|
106
|
-
* @type {GPUSceneContext|null}
|
|
107
|
-
*/
|
|
108
|
-
context: GPUSceneContext | null;
|
|
109
|
-
/**
|
|
110
|
-
* @type {Int32Array}
|
|
111
|
-
*/
|
|
112
|
-
ids: Int32Array;
|
|
113
|
-
}
|
|
114
|
-
//# sourceMappingURL=register_instance_animation.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"register_instance_animation.d.ts","sourceRoot":"","sources":["../../../../src/engine/graphics3/register_instance_animation.js"],"names":[],"mappings":"AAmCA;;;;;;;;;;;;;;;GAeG;AACH,iGAFa,6BAA6B,CAmBzC;AAED;;;;;;;;;;;GAWG;AACH,4DAFW,6BAA6B,QAevC;AA+BD;;;;;;;;;;;;;;;;;GAiBG;AACH,mGAHW,UAAU,MAAM,CAAC,GACf,wBAAwB,CA+BpC;AAED;;;;;GAKG;AACH,wDAFW,wBAAwB,QAqBlC;AAtMD;;;;;;;;;;;;GAYG;AACH;IACI;;;;;;;;;;OAUG;IACH,yBAAe;IAEf;;OAEG;IACH,OAFU,MAAM,EAAE,CAEP;CACd;AAgED;;;GAGG;AACH,kCAFU,MAAM,CAEsB;AAEtC;;;;;;;GAOG;AACH;IACI;;;;;OAKG;IACH,SAFU,kBAAgB,IAAI,CAEf;IAEf;;OAEG;IACH,KAFU,UAAU,CAEI;CAC3B"}
|
|
@@ -1,201 +0,0 @@
|
|
|
1
|
-
import { assert } from "../../core/assert.js";
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* What the animation manager handed back for one {@link PrefabInstance}'s **skins**.
|
|
5
|
-
*
|
|
6
|
-
* Positional: `skins[i]` is the id of the instance's `skins[i]`.
|
|
7
|
-
*
|
|
8
|
-
* **Clips are not here, and that is D37.** A skin belongs to the model — it is how the mesh
|
|
9
|
-
* deforms, and every placement of the model needs it whatever is playing — so the system that
|
|
10
|
-
* places the model registers it. A clip belongs to whatever plays it, and a clip nothing plays must
|
|
11
|
-
* not be registered at all: the pose accumulator marks a joint dirty for any *bound* clip, weight
|
|
12
|
-
* and all, so a joint driven only by clips at weight zero resolves to zero rather than to its rest
|
|
13
|
-
* pose. A model carrying clips and no animation component used to render the sum of every one of
|
|
14
|
-
* them. See {@link register_instance_clips}.
|
|
15
|
-
*/
|
|
16
|
-
export class InstanceAnimationRegistration {
|
|
17
|
-
/**
|
|
18
|
-
* The GPU scene context these ids were issued by.
|
|
19
|
-
*
|
|
20
|
-
* Carried rather than inferred, because **an id may only be handed back to the manager that
|
|
21
|
-
* issued it** and there is no other way to be sure. A renderer restart builds a new context, and
|
|
22
|
-
* a holder comparing this against what `scene_context` answers now knows in one `===` whether
|
|
23
|
-
* giving the ids back is returning them or corrupting a stranger's table — without depending on
|
|
24
|
-
* when anything last ran.
|
|
25
|
-
*
|
|
26
|
-
* @type {GPUSceneContext}
|
|
27
|
-
*/
|
|
28
|
-
context = null;
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* @type {number[]}
|
|
32
|
-
*/
|
|
33
|
-
skins = [];
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
/**
|
|
37
|
-
* Hand one entity's instance to the GPU: its skins become deformations.
|
|
38
|
-
*
|
|
39
|
-
* **Registration is eventually consistent by design**, which is what makes this callable the moment
|
|
40
|
-
* an instance exists rather than at some later moment when the scene is known to be built. An id is
|
|
41
|
-
* allocated and returned synchronously, while the skin's meshes are bound to it only once every
|
|
42
|
-
* joint has a row in the scene. Until then the skin is inert rather than wrong: its meshes draw
|
|
43
|
-
* undeformed.
|
|
44
|
-
*
|
|
45
|
-
* The instance's entities therefore do **not** have to hold their rows yet.
|
|
46
|
-
*
|
|
47
|
-
* @param {GPUSceneContext} context the scene's GPU state, which owns the manager and is what the
|
|
48
|
-
* registration is stamped with so it can be given back to the right one
|
|
49
|
-
* @param {PrefabInstance} instance its skins name joint and mesh entities
|
|
50
|
-
* @returns {InstanceAnimationRegistration}
|
|
51
|
-
*/
|
|
52
|
-
export function register_instance_animation(context, instance) {
|
|
53
|
-
assert.defined(context, 'context');
|
|
54
|
-
assert.defined(instance, 'instance');
|
|
55
|
-
|
|
56
|
-
const manager = context.animation_manager;
|
|
57
|
-
|
|
58
|
-
const r = new InstanceAnimationRegistration();
|
|
59
|
-
|
|
60
|
-
r.context = context;
|
|
61
|
-
|
|
62
|
-
const skins = instance.skins;
|
|
63
|
-
|
|
64
|
-
for (let i = 0; i < skins.length; i++) {
|
|
65
|
-
r.skins.push(manager.register_skin(skins[i]));
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
return r;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
/**
|
|
72
|
-
* Give back everything {@link register_instance_animation} took out, for a manager that is still
|
|
73
|
-
* the one that issued it.
|
|
74
|
-
*
|
|
75
|
-
* **A destroyed manager must not be handed its own ids back.** A renderer restart takes the GPU
|
|
76
|
-
* scene context with it, and the ids it issued mean nothing to the context that replaces it — so
|
|
77
|
-
* the caller forgets them rather than returning them. This is only for the ordinary case: an entity
|
|
78
|
-
* that leaves while the renderer it registered with is still running, and the registration's own
|
|
79
|
-
* {@link InstanceAnimationRegistration#context} is how a caller tells the two apart.
|
|
80
|
-
*
|
|
81
|
-
* @param {InstanceAnimationRegistration} registration
|
|
82
|
-
*/
|
|
83
|
-
export function unregister_instance_animation(registration) {
|
|
84
|
-
assert.defined(registration, 'registration');
|
|
85
|
-
assert.defined(registration.context, 'registration.context');
|
|
86
|
-
|
|
87
|
-
const manager = registration.context.animation_manager;
|
|
88
|
-
|
|
89
|
-
const skins = registration.skins;
|
|
90
|
-
|
|
91
|
-
for (let i = 0; i < skins.length; i++) {
|
|
92
|
-
manager.unregister_skin(skins[i]);
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
skins.length = 0;
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
/**
|
|
99
|
-
* The id a clip has when nobody registered it.
|
|
100
|
-
* @type {number}
|
|
101
|
-
*/
|
|
102
|
-
export const CLIP_NOT_REGISTERED = -1;
|
|
103
|
-
|
|
104
|
-
/**
|
|
105
|
-
* Which of an instance's clips a driver has playable, by the instance's own clip index.
|
|
106
|
-
*
|
|
107
|
-
* `ids[i]` is the manager's id for `instance.clips[i]`, or {@link CLIP_NOT_REGISTERED} where this
|
|
108
|
-
* driver does not play that clip. Indexed by the instance rather than packed, because that is how
|
|
109
|
-
* both drivers already address a clip — the graph resolves a name to a model slot, the clip list
|
|
110
|
-
* does the same — and a packed array would want a second table to say what each entry was.
|
|
111
|
-
*/
|
|
112
|
-
export class InstanceClipRegistration {
|
|
113
|
-
/**
|
|
114
|
-
* The GPU scene context these ids were issued by. See
|
|
115
|
-
* {@link InstanceAnimationRegistration#context} — same reasoning, same `===` check.
|
|
116
|
-
*
|
|
117
|
-
* @type {GPUSceneContext|null}
|
|
118
|
-
*/
|
|
119
|
-
context = null;
|
|
120
|
-
|
|
121
|
-
/**
|
|
122
|
-
* @type {Int32Array}
|
|
123
|
-
*/
|
|
124
|
-
ids = new Int32Array(0);
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
/**
|
|
128
|
-
* Make some of an instance's clips playable — the ones a driver actually plays, and no others.
|
|
129
|
-
*
|
|
130
|
-
* **Registering a clip is not free of consequence, which is why this takes a set.** The pose
|
|
131
|
-
* accumulator marks a joint dirty for every bound clip that writes to it, whatever its weight, so a
|
|
132
|
-
* bound clip at weight zero resolves the joints only it drives to zero rather than leaving them at
|
|
133
|
-
* rest. A driver therefore registers what it can play and re-registers when that changes; a clip no
|
|
134
|
-
* driver claims is never bound and so moves nothing.
|
|
135
|
-
*
|
|
136
|
-
* Each index is registered once however many times it is named. Two states of one graph can play
|
|
137
|
-
* the same clip of the model, and two registrations of one clip are two rows the accumulator would
|
|
138
|
-
* add together.
|
|
139
|
-
*
|
|
140
|
-
* @param {GPUSceneContext} context
|
|
141
|
-
* @param {PrefabInstance} instance its clips target entities
|
|
142
|
-
* @param {ArrayLike<number>} slots indices into `instance.clips`; duplicates are ignored
|
|
143
|
-
* @returns {InstanceClipRegistration}
|
|
144
|
-
*/
|
|
145
|
-
export function register_instance_clips(context, instance, slots) {
|
|
146
|
-
assert.defined(context, 'context');
|
|
147
|
-
assert.defined(instance, 'instance');
|
|
148
|
-
assert.defined(slots, 'slots');
|
|
149
|
-
|
|
150
|
-
const manager = context.animation_manager;
|
|
151
|
-
|
|
152
|
-
const clips = instance.clips;
|
|
153
|
-
|
|
154
|
-
const r = new InstanceClipRegistration();
|
|
155
|
-
|
|
156
|
-
r.context = context;
|
|
157
|
-
r.ids = new Int32Array(clips.length).fill(CLIP_NOT_REGISTERED);
|
|
158
|
-
|
|
159
|
-
for (let i = 0; i < slots.length; i++) {
|
|
160
|
-
const slot = slots[i];
|
|
161
|
-
|
|
162
|
-
assert.isNonNegativeInteger(slot, 'slot');
|
|
163
|
-
assert.lessThan(slot, clips.length, 'slot');
|
|
164
|
-
|
|
165
|
-
if (r.ids[slot] !== CLIP_NOT_REGISTERED) {
|
|
166
|
-
// named twice by one driver, which is one clip either way
|
|
167
|
-
continue;
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
r.ids[slot] = manager.register_clip(clips[slot]);
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
return r;
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
/**
|
|
177
|
-
* Give back everything {@link register_instance_clips} took out, for a manager that is still the one
|
|
178
|
-
* that issued it — see {@link unregister_instance_animation} for why that qualification matters.
|
|
179
|
-
*
|
|
180
|
-
* @param {InstanceClipRegistration} registration
|
|
181
|
-
*/
|
|
182
|
-
export function unregister_instance_clips(registration) {
|
|
183
|
-
assert.defined(registration, 'registration');
|
|
184
|
-
assert.defined(registration.context, 'registration.context');
|
|
185
|
-
|
|
186
|
-
const manager = registration.context.animation_manager;
|
|
187
|
-
|
|
188
|
-
const ids = registration.ids;
|
|
189
|
-
|
|
190
|
-
for (let i = 0; i < ids.length; i++) {
|
|
191
|
-
const id = ids[i];
|
|
192
|
-
|
|
193
|
-
if (id === CLIP_NOT_REGISTERED) {
|
|
194
|
-
continue;
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
manager.unregister_clip(id);
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
ids.fill(CLIP_NOT_REGISTERED);
|
|
201
|
-
}
|