@woosh/meep-engine 3.80.2 → 3.82.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/CHANGELOG.md +94 -0
- package/build/bundle-worker-terrain.js +1 -1
- package/editor/Editor.d.ts +10 -2
- package/editor/Editor.d.ts.map +1 -1
- package/editor/Editor.js +33 -23
- package/editor/EditorCameraNavigation.d.ts +3 -4
- package/editor/EditorCameraNavigation.d.ts.map +1 -1
- package/editor/EditorCameraNavigation.js +29 -8
- package/editor/ecs/component/editors/common/BitFlagsEditor.d.ts.map +1 -1
- package/editor/ecs/component/editors/common/BitFlagsEditor.js +11 -0
- package/editor/prototypeEditorShell.d.ts.map +1 -1
- package/editor/prototypeEditorShell.js +14 -3
- package/editor/tools/GridPaintTool.d.ts.map +1 -1
- package/editor/tools/GridPaintTool.js +12 -7
- package/package.json +1 -1
- package/src/core/geom/3d/quaternion/quat3_slerp.d.ts +25 -0
- package/src/core/geom/3d/quaternion/quat3_slerp.d.ts.map +1 -0
- package/src/core/geom/3d/quaternion/quat3_slerp.js +66 -0
- package/src/core/geom/3d/topology/struct/binary/query/bt_face_cluster_compute_normal_bounding_cone.d.ts.map +1 -1
- package/src/core/geom/3d/topology/struct/binary/query/bt_face_cluster_compute_normal_bounding_cone.js +9 -5
- package/src/core/geom/3d/topology/struct/binary/query/bt_mesh_compute_bounding_sphere.d.ts +3 -3
- package/src/core/geom/3d/topology/struct/binary/query/bt_mesh_compute_bounding_sphere.d.ts.map +1 -1
- package/src/core/geom/3d/topology/struct/binary/query/bt_mesh_compute_bounding_sphere.js +5 -14
- package/src/core/geom/packing/miniball/Miniball.d.ts +8 -181
- package/src/core/geom/packing/miniball/Miniball.d.ts.map +1 -1
- package/src/core/geom/packing/miniball/Miniball.js +10 -452
- package/src/core/geom/packing/miniball/PointSet.d.ts +13 -39
- package/src/core/geom/packing/miniball/PointSet.d.ts.map +1 -1
- package/src/core/geom/packing/miniball/PointSet.js +14 -54
- package/src/core/geom/packing/sphere_compute_bounding_of_points.d.ts +20 -0
- package/src/core/geom/packing/sphere_compute_bounding_of_points.d.ts.map +1 -0
- package/src/core/geom/packing/sphere_compute_bounding_of_points.js +66 -0
- package/src/core/geom/packing/sphere_compute_bounding_of_spheres.d.ts.map +1 -1
- package/src/core/geom/packing/sphere_compute_bounding_of_spheres.js +0 -1
- package/src/core/math/exponential_approach.d.ts +23 -0
- package/src/core/math/exponential_approach.d.ts.map +1 -0
- package/src/core/math/exponential_approach.js +31 -0
- package/src/core/math/physics/spring/Spring.d.ts.map +1 -0
- package/src/core/math/physics/spring/criticallyDampedSpring.d.ts.map +1 -0
- package/src/core/math/physics/spring/dampedSpringStep.d.ts.map +1 -0
- package/src/engine/EngineHarness.d.ts +1 -3
- package/src/engine/EngineHarness.d.ts.map +1 -1
- package/src/engine/EngineHarness.js +13 -10
- package/src/engine/control/first-person/FirstPersonPlayerController.d.ts +9 -15
- package/src/engine/control/first-person/FirstPersonPlayerController.d.ts.map +1 -1
- package/src/engine/control/first-person/FirstPersonPlayerController.js +9 -10
- package/src/engine/control/first-person/FirstPersonPlayerControllerSystem.d.ts +68 -14
- package/src/engine/control/first-person/FirstPersonPlayerControllerSystem.d.ts.map +1 -1
- package/src/engine/control/first-person/FirstPersonPlayerControllerSystem.js +196 -184
- package/src/engine/ecs/gui/hud/testHudEdgeStick.js +4 -2
- package/src/engine/ecs/parent/parent_entity_root_of.d.ts +11 -0
- package/src/engine/ecs/parent/parent_entity_root_of.d.ts.map +1 -0
- package/src/engine/ecs/parent/parent_entity_root_of.js +32 -0
- package/src/engine/ecs/terrain/util/loadVisibleTerrainTiles.js +130 -130
- package/src/engine/graphics/camera/makeOrbitalCameraController.d.ts +3 -2
- package/src/engine/graphics/camera/makeOrbitalCameraController.d.ts.map +1 -1
- package/src/engine/graphics/camera/makeOrbitalCameraController.js +18 -11
- package/src/engine/graphics/camera/orbital/OrbitalCameraRig.d.ts +4 -5
- package/src/engine/graphics/camera/orbital/OrbitalCameraRig.d.ts.map +1 -1
- package/src/engine/graphics/camera/orbital/OrbitalCameraRig.js +6 -6
- package/src/engine/graphics/camera/rig/CameraRig.d.ts +55 -0
- package/src/engine/graphics/camera/rig/CameraRig.d.ts.map +1 -0
- package/src/engine/graphics/camera/rig/CameraRig.js +65 -0
- package/src/engine/graphics/camera/rig/CameraRigContext.d.ts +58 -0
- package/src/engine/graphics/camera/rig/CameraRigContext.d.ts.map +1 -0
- package/src/engine/graphics/camera/rig/CameraRigContext.js +51 -0
- package/src/engine/graphics/camera/rig/CameraRigDriver.d.ts +36 -0
- package/src/engine/graphics/camera/rig/CameraRigDriver.d.ts.map +1 -0
- package/src/engine/graphics/camera/rig/CameraRigDriver.js +39 -0
- package/src/engine/graphics/camera/rig/CameraRigSystem.d.ts +30 -0
- package/src/engine/graphics/camera/rig/CameraRigSystem.d.ts.map +1 -0
- package/src/engine/graphics/camera/rig/CameraRigSystem.js +81 -0
- package/src/engine/graphics/camera/rig/CameraState.d.ts +59 -0
- package/src/engine/graphics/camera/rig/CameraState.d.ts.map +1 -0
- package/src/engine/graphics/camera/rig/CameraState.js +76 -0
- package/src/engine/graphics/camera/rig/camera_rig_output.d.ts +17 -0
- package/src/engine/graphics/camera/rig/camera_rig_output.d.ts.map +1 -0
- package/src/engine/graphics/camera/rig/camera_rig_output.js +80 -0
- package/src/engine/graphics/camera/rig/camera_rig_update.d.ts +38 -0
- package/src/engine/graphics/camera/rig/camera_rig_update.d.ts.map +1 -0
- package/src/engine/graphics/camera/rig/camera_rig_update.js +102 -0
- package/src/engine/graphics/camera/rig/camera_state_read_entity.d.ts +17 -0
- package/src/engine/graphics/camera/rig/camera_state_read_entity.d.ts.map +1 -0
- package/src/engine/graphics/camera/rig/camera_state_read_entity.js +71 -0
- package/src/engine/graphics/camera/rig/drivers/CameraBlendDriver.d.ts +95 -0
- package/src/engine/graphics/camera/rig/drivers/CameraBlendDriver.d.ts.map +1 -0
- package/src/engine/graphics/camera/rig/drivers/CameraBlendDriver.js +290 -0
- package/src/engine/graphics/camera/rig/drivers/CameraCollideDriver.d.ts +37 -0
- package/src/engine/graphics/camera/rig/drivers/CameraCollideDriver.d.ts.map +1 -0
- package/src/engine/graphics/camera/rig/drivers/CameraCollideDriver.js +158 -0
- package/src/engine/graphics/camera/rig/drivers/CameraFollowDriver.d.ts +28 -0
- package/src/engine/graphics/camera/rig/drivers/CameraFollowDriver.d.ts.map +1 -0
- package/src/engine/graphics/camera/rig/drivers/CameraFollowDriver.js +66 -0
- package/src/engine/graphics/camera/rig/drivers/CameraFovDriver.d.ts +29 -0
- package/src/engine/graphics/camera/rig/drivers/CameraFovDriver.d.ts.map +1 -0
- package/src/engine/graphics/camera/rig/drivers/CameraFovDriver.js +65 -0
- package/src/engine/graphics/camera/rig/drivers/CameraImpulseDriver.d.ts +113 -0
- package/src/engine/graphics/camera/rig/drivers/CameraImpulseDriver.d.ts.map +1 -0
- package/src/engine/graphics/camera/rig/drivers/CameraImpulseDriver.js +442 -0
- package/src/engine/graphics/camera/rig/drivers/CameraLookAtDriver.d.ts +32 -0
- package/src/engine/graphics/camera/rig/drivers/CameraLookAtDriver.d.ts.map +1 -0
- package/src/engine/graphics/camera/rig/drivers/CameraLookAtDriver.js +78 -0
- package/src/engine/graphics/camera/rig/drivers/CameraOffsetDriver.d.ts +36 -0
- package/src/engine/graphics/camera/rig/drivers/CameraOffsetDriver.d.ts.map +1 -0
- package/src/engine/graphics/camera/rig/drivers/CameraOffsetDriver.js +54 -0
- package/src/engine/graphics/camera/rig/drivers/CameraOffsetFrame.d.ts +10 -0
- package/src/engine/graphics/camera/rig/drivers/CameraOffsetFrame.d.ts.map +1 -0
- package/src/engine/graphics/camera/rig/drivers/CameraOffsetFrame.js +22 -0
- package/src/engine/graphics/camera/rig/drivers/CameraOrbitDriver.d.ts +182 -0
- package/src/engine/graphics/camera/rig/drivers/CameraOrbitDriver.d.ts.map +1 -0
- package/src/engine/graphics/camera/rig/drivers/CameraOrbitDriver.js +455 -0
- package/src/engine/graphics/camera/rig/drivers/CameraPositionDriver.d.ts +31 -0
- package/src/engine/graphics/camera/rig/drivers/CameraPositionDriver.d.ts.map +1 -0
- package/src/engine/graphics/camera/rig/drivers/CameraPositionDriver.js +57 -0
- package/src/engine/graphics/camera/rig/drivers/CameraShakeDriver.d.ts +62 -0
- package/src/engine/graphics/camera/rig/drivers/CameraShakeDriver.d.ts.map +1 -0
- package/src/engine/graphics/camera/rig/drivers/CameraShakeDriver.js +174 -0
- package/src/engine/graphics/camera/rig/drivers/CameraSmoothDriver.d.ts +29 -0
- package/src/engine/graphics/camera/rig/drivers/CameraSmoothDriver.d.ts.map +1 -0
- package/src/engine/graphics/camera/rig/drivers/CameraSmoothDriver.js +82 -0
- package/src/engine/graphics/camera/rig/drivers/CameraYawPitchRollDriver.d.ts +40 -0
- package/src/engine/graphics/camera/rig/drivers/CameraYawPitchRollDriver.d.ts.map +1 -0
- package/src/engine/graphics/camera/rig/drivers/CameraYawPitchRollDriver.js +66 -0
- package/src/engine/graphics/camera/rig/drivers/camera_state_add_offset.d.ts +22 -0
- package/src/engine/graphics/camera/rig/drivers/camera_state_add_offset.d.ts.map +1 -0
- package/src/engine/graphics/camera/rig/drivers/camera_state_add_offset.js +81 -0
- package/src/engine/graphics/ecs/camera/topdown/TopDownCameraController.d.ts +6 -131
- package/src/engine/graphics/ecs/camera/topdown/TopDownCameraController.d.ts.map +1 -1
- package/src/engine/graphics/ecs/camera/topdown/TopDownCameraController.js +4 -378
- package/src/engine/graphics/ecs/camera/topdown/TopDownCameraControllerSerializationAdapter.d.ts +4 -2
- package/src/engine/graphics/ecs/camera/topdown/TopDownCameraControllerSerializationAdapter.d.ts.map +1 -1
- package/src/engine/graphics/ecs/camera/topdown/TopDownCameraControllerSerializationAdapter.js +16 -27
- package/src/engine/graphics/ecs/camera/topdown/TopDownCameraLander.d.ts +4 -0
- package/src/engine/graphics/ecs/camera/topdown/TopDownCameraLander.d.ts.map +1 -1
- package/src/engine/graphics/ecs/camera/topdown/TopDownCameraLander.js +4 -0
- package/src/engine/graphics/ecs/light/Light.d.ts +10 -5
- package/src/engine/graphics/ecs/light/Light.d.ts.map +1 -1
- package/src/engine/graphics/ecs/light/Light.js +15 -24
- package/src/engine/graphics/ecs/mesh-v2/MESH_MORPH_EVENT_CHANGE.d.ts +13 -0
- package/src/engine/graphics/ecs/mesh-v2/MESH_MORPH_EVENT_CHANGE.d.ts.map +1 -0
- package/src/engine/graphics/ecs/mesh-v2/MESH_MORPH_EVENT_CHANGE.js +12 -0
- package/src/engine/graphics/ecs/mesh-v2/MeshMorph.d.ts +64 -0
- package/src/engine/graphics/ecs/mesh-v2/MeshMorph.d.ts.map +1 -0
- package/src/engine/graphics/ecs/mesh-v2/MeshMorph.js +89 -0
- package/src/engine/graphics/ecs/mesh-v2/MeshSkin.d.ts +1 -1
- package/src/engine/graphics/ecs/mesh-v2/MeshSkin.js +1 -1
- package/src/engine/graphics/ecs/mesh-v2/ShadedGeometryFlags.d.ts +1 -0
- package/src/engine/graphics/ecs/mesh-v2/ShadedGeometryFlags.js +10 -3
- package/src/engine/graphics/ecs/mesh-v2/mesh_morph_announce_change.d.ts +14 -0
- package/src/engine/graphics/ecs/mesh-v2/mesh_morph_announce_change.d.ts.map +1 -0
- package/src/engine/graphics/ecs/mesh-v2/mesh_morph_announce_change.js +21 -0
- package/src/engine/graphics/geometry/computeBoundingSphereFromVertexData.d.ts +0 -4
- package/src/engine/graphics/geometry/computeBoundingSphereFromVertexData.d.ts.map +1 -1
- package/src/engine/graphics/geometry/computeBoundingSphereFromVertexData.js +12 -11
- package/src/engine/graphics/impostors/octahedral/bake/compute_bounding_sphere.d.ts.map +1 -1
- package/src/engine/graphics/impostors/octahedral/bake/compute_bounding_sphere.js +5 -5
- package/src/engine/graphics3/HairSystem.js +1 -1
- package/src/engine/graphics3/LightSystem.js +0 -3
- package/src/engine/graphics3/MeshMorphSystem.d.ts +48 -0
- package/src/engine/graphics3/MeshMorphSystem.d.ts.map +1 -0
- package/src/engine/graphics3/MeshMorphSystem.js +355 -0
- package/src/engine/graphics3/MeshSkinSystem.js +2 -2
- package/src/engine/graphics3/MeshSystem.d.ts +2 -1
- package/src/engine/graphics3/MeshSystem.d.ts.map +1 -1
- package/src/engine/graphics3/MeshSystem.js +2 -1
- package/src/engine/graphics3/ShadedGeometrySystem.d.ts +1 -1
- package/src/engine/graphics3/ShadedGeometrySystem.js +2 -2
- package/src/engine/graphics3/prefab/Prefab.d.ts +14 -0
- package/src/engine/graphics3/prefab/Prefab.d.ts.map +1 -1
- package/src/engine/graphics3/prefab/Prefab.js +16 -0
- package/src/engine/graphics3/prefab/prefab_compile.d.ts.map +1 -1
- package/src/engine/graphics3/prefab/prefab_compile.js +8 -1
- package/src/engine/graphics3/prefab/prefab_instantiate.d.ts +3 -2
- package/src/engine/graphics3/prefab/prefab_instantiate.d.ts.map +1 -1
- package/src/engine/graphics3/prefab/prefab_instantiate.js +17 -4
- package/src/engine/graphics3/prefab/prefab_place.d.ts +27 -9
- package/src/engine/graphics3/prefab/prefab_place.d.ts.map +1 -1
- package/src/engine/graphics3/prefab/prefab_place.js +69 -13
- package/src/engine/graphics3/register_clips.d.ts.map +1 -1
- package/src/engine/graphics3/register_clips.js +8 -2
- package/src/engine/input/ecs/controllers/KeyboardCameraController.d.ts +2 -2
- package/src/engine/input/ecs/controllers/KeyboardCameraController.d.ts.map +1 -1
- package/src/engine/input/ecs/controllers/KeyboardCameraController.js +3 -3
- package/src/engine/physics/ecs/ContactProbeSystem.d.ts.map +1 -1
- package/src/engine/physics/ecs/ContactProbeSystem.js +3 -25
- package/src/engine/physics/fluid/ecs/FluidObstacleSystem.d.ts +4 -4
- package/src/shade/playground/foliage_wind/foliage_world.d.ts.map +1 -1
- package/src/shade/playground/foliage_wind/foliage_world.js +0 -1
- package/src/shade/playground/hair_skinned/skinned_hair.js +2 -2
- package/src/shade/playground/skinned_blas_refit/verify_clone_leaves.js +1 -1
- package/src/shade/playground/skinned_blas_refit/verify_instance_bounds.js +1 -1
- package/src/shade/playground/skinned_blas_refit/verify_skinned_blas_refit.js +1 -1
- package/src/shade/playground/skinned_mesh_soup/main.js +1 -1
- package/src/shade/playground/skinned_mesh_soup/verify_clone_vertices.js +2 -2
- package/src/shade/renderer/Renderer.js +2 -2
- package/src/shade/renderer/acoustics/GPUAcousticLattice.d.ts +1 -1
- package/src/shade/renderer/acoustics/GPUAcousticProbes.d.ts +1 -1
- package/src/shade/renderer/acoustics/GPUAcoustics.d.ts +1 -1
- package/src/shade/renderer/animation/ANIMATION_DATABASE_SPEC.d.ts +5 -0
- package/src/shade/renderer/animation/ANIMATION_DATABASE_SPEC.d.ts.map +1 -1
- package/src/shade/renderer/animation/ANIMATION_DATABASE_SPEC.js +19 -0
- package/src/shade/renderer/animation/ANIMATION_MORPH_STRUCT.d.ts +8 -0
- package/src/shade/renderer/animation/ANIMATION_MORPH_STRUCT.d.ts.map +1 -0
- package/src/shade/renderer/animation/ANIMATION_MORPH_STRUCT.js +19 -0
- package/src/shade/renderer/animation/ANIMATION_MORPH_WEIGHT_STRUCT.d.ts +6 -0
- package/src/shade/renderer/animation/ANIMATION_MORPH_WEIGHT_STRUCT.d.ts.map +1 -0
- package/src/shade/renderer/animation/ANIMATION_MORPH_WEIGHT_STRUCT.js +13 -0
- package/src/shade/renderer/animation/GPUAnimationManager.d.ts +71 -0
- package/src/shade/renderer/animation/GPUAnimationManager.d.ts.map +1 -1
- package/src/shade/renderer/animation/GPUAnimationManager.js +559 -9
- package/src/shade/renderer/animation/ShadeAnimationChannel.d.ts +23 -2
- package/src/shade/renderer/animation/ShadeAnimationChannel.d.ts.map +1 -1
- package/src/shade/renderer/animation/ShadeAnimationChannel.js +43 -2
- package/src/shade/renderer/animation/ShadeAnimationClip.d.ts +9 -3
- package/src/shade/renderer/animation/ShadeAnimationClip.d.ts.map +1 -1
- package/src/shade/renderer/animation/ShadeAnimationClip.js +67 -3
- package/src/shade/renderer/animation/ShadeAnimationClipSerializationAdapter.d.ts +3 -2
- package/src/shade/renderer/animation/ShadeAnimationClipSerializationAdapter.d.ts.map +1 -1
- package/src/shade/renderer/animation/ShadeAnimationClipSerializationAdapter.js +6 -3
- package/src/shade/renderer/animation/ShadeAnimationClipSerializationUpgrader_0_1.d.ts +14 -0
- package/src/shade/renderer/animation/ShadeAnimationClipSerializationUpgrader_0_1.d.ts.map +1 -0
- package/src/shade/renderer/animation/ShadeAnimationClipSerializationUpgrader_0_1.js +49 -0
- package/src/shade/renderer/animation/ShadeAnimationProperty.d.ts +12 -0
- package/src/shade/renderer/animation/ShadeAnimationProperty.d.ts.map +1 -0
- package/src/shade/renderer/animation/ShadeAnimationProperty.js +30 -0
- package/src/shade/renderer/animation/Skin.d.ts +1 -1
- package/src/shade/renderer/animation/Skin.js +1 -1
- package/src/shade/renderer/animation/deformation/DEFORMATION_BINDING_STRUCT.d.ts +26 -0
- package/src/shade/renderer/animation/deformation/DEFORMATION_BINDING_STRUCT.d.ts.map +1 -0
- package/src/shade/renderer/animation/{skinning/SKINNING_BINDING_STRUCT.js → deformation/DEFORMATION_BINDING_STRUCT.js} +33 -8
- package/src/shade/renderer/animation/{skinning/GPUMeshSkinningContext.d.ts → deformation/GPUMeshDeformationContext.d.ts} +60 -17
- package/src/shade/renderer/animation/deformation/GPUMeshDeformationContext.d.ts.map +1 -0
- package/src/shade/renderer/animation/{skinning/GPUMeshSkinningContext.js → deformation/GPUMeshDeformationContext.js} +458 -55
- package/src/shade/renderer/animation/{skinning/bounds_refresh/shader_skinned_mesh_bounds_refresh.d.ts → deformation/bounds_refresh/shader_deformed_mesh_bounds_refresh.d.ts} +2 -2
- package/src/shade/renderer/animation/deformation/bounds_refresh/shader_deformed_mesh_bounds_refresh.d.ts.map +1 -0
- package/src/shade/renderer/animation/{skinning/bounds_refresh/shader_skinned_mesh_bounds_refresh.js → deformation/bounds_refresh/shader_deformed_mesh_bounds_refresh.js} +3 -3
- package/src/shade/renderer/animation/deformation/bounds_refresh/shader_geometry_sphere_derive.d.ts.map +1 -0
- package/src/shade/renderer/animation/{skinning → deformation}/bounds_refresh/shader_geometry_sphere_derive.js +2 -2
- package/src/shade/renderer/animation/deformation/bounds_refresh/shader_meshlet_bounds_reduce.d.ts.map +1 -0
- package/src/shade/renderer/animation/{skinning → deformation}/bounds_refresh/shader_meshlet_bounds_reduce.js +2 -2
- package/src/shade/renderer/animation/deformation/bounds_refresh/shader_meshlet_bounds_scatter.d.ts.map +1 -0
- package/src/shade/renderer/animation/{skinning → deformation}/bounds_refresh/shader_meshlet_bounds_scatter.js +2 -2
- package/src/shade/renderer/animation/morph/shader_meshlet_apply_morph.d.ts +24 -0
- package/src/shade/renderer/animation/morph/shader_meshlet_apply_morph.d.ts.map +1 -0
- package/src/shade/renderer/animation/morph/shader_meshlet_apply_morph.js +257 -0
- package/src/shade/renderer/animation/morph/shader_morph_weights_resolve.d.ts +18 -0
- package/src/shade/renderer/animation/morph/shader_morph_weights_resolve.d.ts.map +1 -0
- package/src/shade/renderer/animation/morph/shader_morph_weights_resolve.js +75 -0
- package/src/shade/renderer/animation/shader_animation_apply.d.ts.map +1 -1
- package/src/shade/renderer/animation/shader_animation_apply.js +3 -1
- package/src/shade/renderer/animation/skinning/shader_meshlet_apply_skinning.d.ts.map +1 -1
- package/src/shade/renderer/animation/skinning/shader_meshlet_apply_skinning.js +31 -7
- package/src/shade/renderer/camera/orbital/OrbitalCameraController.d.ts +4 -4
- package/src/shade/renderer/camera/orbital/OrbitalCameraController.d.ts.map +1 -1
- package/src/shade/renderer/camera/orbital/OrbitalCameraController.js +26 -11
- package/src/shade/renderer/fluid/GPUFluidCascade.d.ts +3 -3
- package/src/shade/renderer/fluid/GPUFluidCascadeStack.d.ts +1 -1
- package/src/shade/renderer/fluid/forcing/GPUFluidForcing.d.ts +7 -7
- package/src/shade/renderer/fluid/pressure/GPUFluidPressureSolve.d.ts +1 -1
- package/src/shade/renderer/fluid/query/GPUFluidQueries.d.ts +1 -1
- package/src/shade/renderer/geometry/GPUGeometryManager.d.ts +8 -1
- package/src/shade/renderer/geometry/GPUGeometryManager.d.ts.map +1 -1
- package/src/shade/renderer/geometry/GPUGeometryManager.js +18 -1
- package/src/shade/renderer/geometry/Geometry.d.ts.map +1 -1
- package/src/shade/renderer/geometry/Geometry.js +2 -11
- package/src/shade/renderer/geometry/bvh/GPUBLASRefitBatch.d.ts +1 -1
- package/src/shade/renderer/geometry/bvh/GPUBLASRefitBatch.js +1 -1
- package/src/shade/renderer/geometry/meshlet/GPUMeshletManager.d.ts +9 -0
- package/src/shade/renderer/geometry/meshlet/GPUMeshletManager.d.ts.map +1 -1
- package/src/shade/renderer/geometry/meshlet/GPUMeshletManager.js +30 -2
- package/src/shade/renderer/geometry/meshlet/MeshletBatch.d.ts +27 -0
- package/src/shade/renderer/geometry/meshlet/MeshletBatch.d.ts.map +1 -1
- package/src/shade/renderer/geometry/meshlet/MeshletBatch.js +85 -6
- package/src/shade/renderer/geometry/meshlet/meshlet_payload_collapse.d.ts +5 -1
- package/src/shade/renderer/geometry/meshlet/meshlet_payload_collapse.d.ts.map +1 -1
- package/src/shade/renderer/geometry/meshlet/meshlet_payload_collapse.js +8 -3
- package/src/shade/renderer/geometry/meshlet_geometry_build_from_geometry.d.ts +13 -0
- package/src/shade/renderer/geometry/meshlet_geometry_build_from_geometry.d.ts.map +1 -1
- package/src/shade/renderer/geometry/meshlet_geometry_build_from_geometry.js +47 -4
- package/src/shade/renderer/geometry/morph/MESHLET_MORPH_LAYOUT.d.ts +51 -0
- package/src/shade/renderer/geometry/morph/MESHLET_MORPH_LAYOUT.d.ts.map +1 -0
- package/src/shade/renderer/geometry/morph/MESHLET_MORPH_LAYOUT.js +60 -0
- package/src/shade/renderer/geometry/morph/MESHLET_MORPH_NORMAL_EXPONENT.d.ts +12 -0
- package/src/shade/renderer/geometry/morph/MESHLET_MORPH_NORMAL_EXPONENT.d.ts.map +1 -0
- package/src/shade/renderer/geometry/morph/MESHLET_MORPH_NORMAL_EXPONENT.js +11 -0
- package/src/shade/renderer/geometry/morph/MeshletMorphTargets.d.ts +73 -0
- package/src/shade/renderer/geometry/morph/MeshletMorphTargets.d.ts.map +1 -0
- package/src/shade/renderer/geometry/morph/MeshletMorphTargets.js +130 -0
- package/src/shade/renderer/geometry/morph/MeshletMorphTargetsSerializationAdapter.d.ts +34 -0
- package/src/shade/renderer/geometry/morph/MeshletMorphTargetsSerializationAdapter.d.ts.map +1 -0
- package/src/shade/renderer/geometry/morph/MeshletMorphTargetsSerializationAdapter.js +126 -0
- package/src/shade/renderer/geometry/morph/MorphedGeometry.d.ts +50 -0
- package/src/shade/renderer/geometry/morph/MorphedGeometry.d.ts.map +1 -0
- package/src/shade/renderer/geometry/morph/MorphedGeometry.js +81 -0
- package/src/shade/renderer/geometry/morph/meshlet_morph_targets_build.d.ts +22 -0
- package/src/shade/renderer/geometry/morph/meshlet_morph_targets_build.d.ts.map +1 -0
- package/src/shade/renderer/geometry/morph/meshlet_morph_targets_build.js +375 -0
- package/src/shade/renderer/geometry/morph/meshlet_morph_targets_read.d.ts +25 -0
- package/src/shade/renderer/geometry/morph/meshlet_morph_targets_read.d.ts.map +1 -0
- package/src/shade/renderer/geometry/morph/meshlet_morph_targets_read.js +134 -0
- package/src/shade/renderer/geometry/morph/meshlet_morph_targets_validate.d.ts +15 -0
- package/src/shade/renderer/geometry/morph/meshlet_morph_targets_validate.d.ts.map +1 -0
- package/src/shade/renderer/geometry/morph/meshlet_morph_targets_validate.js +110 -0
- package/src/shade/renderer/geometry/morph/morphed_geometry_build.d.ts +22 -0
- package/src/shade/renderer/geometry/morph/morphed_geometry_build.d.ts.map +1 -0
- package/src/shade/renderer/geometry/morph/morphed_geometry_build.js +32 -0
- package/src/shade/renderer/geometry/virtual/build/level/vgeo_build_cluster.d.ts.map +1 -1
- package/src/shade/renderer/geometry/virtual/build/level/vgeo_build_cluster.js +2 -1
- package/src/shade/renderer/geometry/virtual/build/sphere/vgeo_bounding_sphere.d.ts.map +1 -1
- package/src/shade/renderer/geometry/virtual/build/sphere/vgeo_bounding_sphere.js +3 -6
- package/src/shade/renderer/global_illumination/probe_clipmap/GPUProbeClipmapGI.d.ts +1 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/ProbeClipmapSceneHolds.js +3 -3
- package/src/shade/renderer/hair/GPUHairSystem.js +1 -1
- package/src/shade/renderer/loader/SceneNode.d.ts +20 -1
- package/src/shade/renderer/loader/SceneNode.d.ts.map +1 -1
- package/src/shade/renderer/loader/SceneNode.js +142 -114
- package/src/shade/renderer/loader/gltf/load_gltf.d.ts +1 -0
- package/src/shade/renderer/loader/gltf/load_gltf.d.ts.map +1 -1
- package/src/shade/renderer/loader/gltf/load_gltf.js +214 -30
- package/src/shade/renderer/loader/gltf/tiny-gltf.d.ts +1 -1
- package/src/shade/renderer/loader/mtf/MTFMorphBinding.d.ts +41 -0
- package/src/shade/renderer/loader/mtf/MTFMorphBinding.d.ts.map +1 -0
- package/src/shade/renderer/loader/mtf/MTFMorphBinding.js +60 -0
- package/src/shade/renderer/loader/mtf/MTFMorphBindingSerializationAdapter.d.ts +31 -0
- package/src/shade/renderer/loader/mtf/MTFMorphBindingSerializationAdapter.d.ts.map +1 -0
- package/src/shade/renderer/loader/mtf/MTFMorphBindingSerializationAdapter.js +108 -0
- package/src/shade/renderer/loader/mtf/MTF_PACKAGE_VERSION.d.ts +3 -0
- package/src/shade/renderer/loader/mtf/MTF_PACKAGE_VERSION.d.ts.map +1 -1
- package/src/shade/renderer/loader/mtf/MTF_PACKAGE_VERSION.js +4 -1
- package/src/shade/renderer/loader/mtf/mtf_export.d.ts.map +1 -1
- package/src/shade/renderer/loader/mtf/mtf_export.js +7 -0
- package/src/shade/renderer/loader/mtf/mtf_read_scene.d.ts +6 -3
- package/src/shade/renderer/loader/mtf/mtf_read_scene.d.ts.map +1 -1
- package/src/shade/renderer/loader/mtf/mtf_read_scene.js +43 -3
- package/src/shade/renderer/loader/mtf/mtf_serialization_registry.d.ts +2 -0
- package/src/shade/renderer/loader/mtf/mtf_serialization_registry.d.ts.map +1 -1
- package/src/shade/renderer/loader/mtf/mtf_serialization_registry.js +9 -0
- package/src/shade/renderer/loader/mtf/mtf_write.d.ts +3 -1
- package/src/shade/renderer/loader/mtf/mtf_write.d.ts.map +1 -1
- package/src/shade/renderer/loader/mtf/mtf_write.js +20 -1
- package/src/shade/renderer/object_property/ObjectType.d.ts +1 -0
- package/src/shade/renderer/object_property/ObjectType.js +8 -0
- package/src/shade/renderer/object_property/chunk_write_object_property.d.ts +6 -7
- package/src/shade/renderer/object_property/chunk_write_object_property.d.ts.map +1 -1
- package/src/shade/renderer/object_property/chunk_write_object_property.js +13 -7
- package/src/shade/renderer/object_property/chunk_write_object_property_morph_weight.d.ts +17 -0
- package/src/shade/renderer/object_property/chunk_write_object_property_morph_weight.d.ts.map +1 -0
- package/src/shade/renderer/object_property/chunk_write_object_property_morph_weight.js +38 -0
- package/src/shade/renderer/postprocess/nss/NSS.d.ts +1 -1
- package/src/shade/renderer/scene/GPUSceneContext.d.ts +5 -6
- package/src/shade/renderer/scene/GPUSceneContext.d.ts.map +1 -1
- package/src/shade/renderer/scene/GPUSceneContext.js +17 -20
- package/src/shade/renderer/scene/MESH_INSTANCE_METADATA_STRUCT.d.ts +1 -1
- package/src/shade/renderer/scene/MESH_INSTANCE_METADATA_STRUCT.d.ts.map +1 -1
- package/src/shade/renderer/scene/MESH_INSTANCE_METADATA_STRUCT.js +2 -2
- package/src/shade/renderer/scene/chunk_mesh_flags.js +3 -3
- package/src/shade/renderer/scene/movers/graph_scene_movers.d.ts +1 -1
- package/src/shade/renderer/scene/movers/graph_scene_movers.d.ts.map +1 -1
- package/src/shade/renderer/scene/movers/graph_scene_movers.js +20 -13
- package/src/shade/renderer/scene/movers/shader_scene_deformed_movers.d.ts +25 -0
- package/src/shade/renderer/scene/movers/shader_scene_deformed_movers.d.ts.map +1 -0
- package/src/shade/renderer/scene/movers/{shader_scene_skinned_movers.js → shader_scene_deformed_movers.js} +28 -18
- package/src/shade/renderer/scene/movers/shader_scene_movers.d.ts +1 -1
- package/src/shade/renderer/scene/movers/shader_scene_movers.js +2 -2
- package/src/shade/renderer/scene/rows/GPUSceneRows.d.ts +13 -13
- package/src/shade/renderer/scene/rows/GPUSceneRows.d.ts.map +1 -1
- package/src/shade/renderer/scene/rows/GPUSceneRows.js +30 -30
- package/src/shade/renderer/shader/chunk/geometry/meshlet/chunk_read_lattice_position.d.ts +17 -0
- package/src/shade/renderer/shader/chunk/geometry/meshlet/chunk_read_lattice_position.d.ts.map +1 -0
- package/src/shade/renderer/shader/chunk/geometry/meshlet/chunk_read_lattice_position.js +78 -0
- package/src/shade/renderer/shader/chunk/geometry/meshlet/chunk_read_meshlet_position.d.ts +2 -1
- package/src/shade/renderer/shader/chunk/geometry/meshlet/chunk_read_meshlet_position.d.ts.map +1 -1
- package/src/shade/renderer/shader/chunk/geometry/meshlet/chunk_read_meshlet_position.js +10 -54
- package/src/shade/renderer/shadow/vsm/VSMPageManager.d.ts.map +1 -1
- package/src/shade/renderer/shadow/vsm/VSMPageManager.js +33 -163
- package/src/shade/renderer/texture/virtual/README.md +12 -4
- package/src/shade/renderer/texture/virtual/VTLodBiasController.d.ts +116 -0
- package/src/shade/renderer/texture/virtual/VTLodBiasController.d.ts.map +1 -0
- package/src/shade/renderer/texture/virtual/VTLodBiasController.js +301 -0
- package/src/shade/renderer/texture/virtual/VirtualTextureManager.d.ts +8 -3
- package/src/shade/renderer/texture/virtual/VirtualTextureManager.d.ts.map +1 -1
- package/src/shade/renderer/texture/virtual/VirtualTextureManager.js +110 -20
- package/src/shade/renderer/water/query/GPUWaterQueries.d.ts +1 -1
- package/src/shade/renderer/wind/GPUSceneWind.d.ts +1 -1
- package/src/core/geom/packing/miniball/Quality.d.ts +0 -92
- package/src/core/geom/packing/miniball/Quality.d.ts.map +0 -1
- package/src/core/geom/packing/miniball/Quality.js +0 -114
- package/src/core/geom/packing/miniball/Subspan.d.ts +0 -191
- package/src/core/geom/packing/miniball/Subspan.d.ts.map +0 -1
- package/src/core/geom/packing/miniball/Subspan.js +0 -529
- package/src/core/geom/packing/miniball/miniball_compute_quality.d.ts +0 -10
- package/src/core/geom/packing/miniball/miniball_compute_quality.d.ts.map +0 -1
- package/src/core/geom/packing/miniball/miniball_compute_quality.js +0 -60
- package/src/engine/control/first-person/composer/EyeOffsetStack.d.ts +0 -146
- package/src/engine/control/first-person/composer/EyeOffsetStack.d.ts.map +0 -1
- package/src/engine/control/first-person/composer/EyeOffsetStack.js +0 -395
- package/src/engine/control/first-person/math/Spring.d.ts.map +0 -1
- package/src/engine/control/first-person/math/criticallyDampedSpring.d.ts.map +0 -1
- package/src/engine/control/first-person/math/dampedSpringStep.d.ts.map +0 -1
- package/src/engine/graphics/camera/CameraShake.d.ts +0 -32
- package/src/engine/graphics/camera/CameraShake.d.ts.map +0 -1
- package/src/engine/graphics/camera/CameraShake.js +0 -68
- package/src/engine/graphics/camera/CameraShakeBehavior.d.ts +0 -41
- package/src/engine/graphics/camera/CameraShakeBehavior.d.ts.map +0 -1
- package/src/engine/graphics/camera/CameraShakeBehavior.js +0 -91
- package/src/engine/graphics/camera/CameraShakeTraumaBehavior.d.ts +0 -19
- package/src/engine/graphics/camera/CameraShakeTraumaBehavior.d.ts.map +0 -1
- package/src/engine/graphics/camera/CameraShakeTraumaBehavior.js +0 -37
- package/src/engine/graphics/ecs/camera/filter/setup_filtered_camera_controller.d.ts +0 -21
- package/src/engine/graphics/ecs/camera/filter/setup_filtered_camera_controller.d.ts.map +0 -1
- package/src/engine/graphics/ecs/camera/filter/setup_filtered_camera_controller.js +0 -79
- package/src/engine/graphics/ecs/camera/topdown/TopDownCameraControllerSystem.d.ts +0 -28
- package/src/engine/graphics/ecs/camera/topdown/TopDownCameraControllerSystem.d.ts.map +0 -1
- package/src/engine/graphics/ecs/camera/topdown/TopDownCameraControllerSystem.js +0 -100
- package/src/engine/graphics/ecs/camera/topdown/TopDownCameraLanderSystem.d.ts +0 -36
- package/src/engine/graphics/ecs/camera/topdown/TopDownCameraLanderSystem.d.ts.map +0 -1
- package/src/engine/graphics/ecs/camera/topdown/TopDownCameraLanderSystem.js +0 -160
- package/src/shade/renderer/animation/skinning/GPUMeshSkinningContext.d.ts.map +0 -1
- package/src/shade/renderer/animation/skinning/SKINNING_BINDING_STRUCT.d.ts +0 -22
- package/src/shade/renderer/animation/skinning/SKINNING_BINDING_STRUCT.d.ts.map +0 -1
- package/src/shade/renderer/animation/skinning/bounds_refresh/shader_geometry_sphere_derive.d.ts.map +0 -1
- package/src/shade/renderer/animation/skinning/bounds_refresh/shader_meshlet_bounds_reduce.d.ts.map +0 -1
- package/src/shade/renderer/animation/skinning/bounds_refresh/shader_meshlet_bounds_scatter.d.ts.map +0 -1
- package/src/shade/renderer/animation/skinning/bounds_refresh/shader_skinned_mesh_bounds_refresh.d.ts.map +0 -1
- package/src/shade/renderer/scene/movers/shader_scene_skinned_movers.d.ts +0 -24
- package/src/shade/renderer/scene/movers/shader_scene_skinned_movers.d.ts.map +0 -1
- /package/src/{engine/control/first-person/math → core/math/physics/spring}/Spring.d.ts +0 -0
- /package/src/{engine/control/first-person/math → core/math/physics/spring}/Spring.js +0 -0
- /package/src/{engine/control/first-person/math → core/math/physics/spring}/criticallyDampedSpring.d.ts +0 -0
- /package/src/{engine/control/first-person/math → core/math/physics/spring}/criticallyDampedSpring.js +0 -0
- /package/src/{engine/control/first-person/math → core/math/physics/spring}/dampedSpringStep.d.ts +0 -0
- /package/src/{engine/control/first-person/math → core/math/physics/spring}/dampedSpringStep.js +0 -0
- /package/src/shade/renderer/animation/{skinning → deformation}/bounds_refresh/shader_geometry_sphere_derive.d.ts +0 -0
- /package/src/shade/renderer/animation/{skinning → deformation}/bounds_refresh/shader_meshlet_bounds_reduce.d.ts +0 -0
- /package/src/shade/renderer/animation/{skinning → deformation}/bounds_refresh/shader_meshlet_bounds_scatter.d.ts +0 -0
|
@@ -39,6 +39,8 @@ import { TransformAttachment } from "../../../engine/ecs/transform-attachment/Tr
|
|
|
39
39
|
import { TRANSFORM_ATTACHMENT_EVENT_CHANGE } from "../../../engine/ecs/transform-attachment/TRANSFORM_ATTACHMENT_EVENT_CHANGE.js";
|
|
40
40
|
import { Transform64 } from "../../../engine/ecs/transform/Transform64.js";
|
|
41
41
|
import { Node3DProperty } from "../object_property/Node3DProperty.js";
|
|
42
|
+
import { ObjectType } from "../object_property/ObjectType.js";
|
|
43
|
+
import { ShadeAnimationProperty } from "./ShadeAnimationProperty.js";
|
|
42
44
|
import { pose_evaluate_local } from "./pose/pose_evaluate_local.js";
|
|
43
45
|
import { PosePlayback } from "./pose/PosePlayback.js";
|
|
44
46
|
import {
|
|
@@ -57,6 +59,11 @@ import {
|
|
|
57
59
|
shader_skin_matrix_prep,
|
|
58
60
|
WORKGROUP_SIZE as SKIN_MATRIX_PREP_WORKGROUP_SIZE,
|
|
59
61
|
} from "./skinning/shader_skin_matrix_prep.js";
|
|
62
|
+
import { ANIMATION_MORPH_WEIGHT_STRUCT } from "./ANIMATION_MORPH_WEIGHT_STRUCT.js";
|
|
63
|
+
import {
|
|
64
|
+
shader_morph_weights_resolve,
|
|
65
|
+
WORKGROUP_SIZE as MORPH_WEIGHTS_RESOLVE_WORKGROUP_SIZE,
|
|
66
|
+
} from "./morph/shader_morph_weights_resolve.js";
|
|
60
67
|
|
|
61
68
|
/**
|
|
62
69
|
* @typedef {import("../../device/pipeline/PipelineEnquiry.js").PipelineEnquiry} PipelineEnquiry
|
|
@@ -170,6 +177,46 @@ function rest_for_property(dataset, entity, property) {
|
|
|
170
177
|
*/
|
|
171
178
|
|
|
172
179
|
const KEYFRAME_WRITER = generate_record_writer(ANIMATION_CURVE_KEYFRAME_STRUCT);
|
|
180
|
+
const MORPH_WEIGHT_WRITER = generate_record_writer(ANIMATION_MORPH_WEIGHT_STRUCT);
|
|
181
|
+
|
|
182
|
+
/**
|
|
183
|
+
* Scratch record for {@link MORPH_WEIGHT_WRITER}: a base changed in place is written through it, one
|
|
184
|
+
* row at a time, without an object a row.
|
|
185
|
+
*
|
|
186
|
+
* @type {{base: number}}
|
|
187
|
+
*/
|
|
188
|
+
const MORPH_WEIGHT = { base: 0 };
|
|
189
|
+
|
|
190
|
+
/**
|
|
191
|
+
* One morph weight is an `f32`.
|
|
192
|
+
*/
|
|
193
|
+
const MORPH_WEIGHT_BYTES = 4;
|
|
194
|
+
|
|
195
|
+
/**
|
|
196
|
+
* Initial capacity of each half of the weights buffer, in weights. Doubles on growth.
|
|
197
|
+
*/
|
|
198
|
+
const MORPH_WEIGHTS_INITIAL_CAPACITY = 256;
|
|
199
|
+
|
|
200
|
+
/**
|
|
201
|
+
* The handle a {@link ObjectType.MorphWeight} binding carries holds the weight row in 24 bits.
|
|
202
|
+
*/
|
|
203
|
+
const MORPH_WEIGHT_ROW_LIMIT = 1 << 24;
|
|
204
|
+
|
|
205
|
+
/**
|
|
206
|
+
* The rest rotation a {@link ShadeAnimationProperty.MorphWeight} binding carries: read by Node3D rotation
|
|
207
|
+
* writers alone, so any value would do, and the identity says nothing.
|
|
208
|
+
*/
|
|
209
|
+
const MORPH_WEIGHT_REST_ROTATION = Object.freeze([0, 0, 0, 1]);
|
|
210
|
+
|
|
211
|
+
/**
|
|
212
|
+
* The handle a binding keying weight row `row` carries.
|
|
213
|
+
*
|
|
214
|
+
* @param {number} row
|
|
215
|
+
* @returns {number}
|
|
216
|
+
*/
|
|
217
|
+
function morph_weight_handle(row) {
|
|
218
|
+
return ((ObjectType.MorphWeight << 24) | row) >>> 0;
|
|
219
|
+
}
|
|
173
220
|
const BINDING_WRITER = generate_record_writer(ANIMATION_TRACK_BINDING_STRUCT);
|
|
174
221
|
const SKIN_JOINT_WRITER = generate_record_writer(ANIMATION_SKIN_JOINT_STRUCT);
|
|
175
222
|
const FOLIAGE_JOINT_WRITER = generate_record_writer(ANIMATION_FOLIAGE_JOINT_STRUCT);
|
|
@@ -546,6 +593,79 @@ export class GPUAnimationManager {
|
|
|
546
593
|
*/
|
|
547
594
|
#skin_matrix_count = 0;
|
|
548
595
|
|
|
596
|
+
/**
|
|
597
|
+
* Ping-pong pair of morph weight buffers, `f32` each, one holding this frame's weights and the
|
|
598
|
+
* other the last frame's: a weight's value sits at its `animation_morph_weights` row, as a joint's
|
|
599
|
+
* matrix sits at its row of the skin matrices, and the pair flips the way theirs does.
|
|
600
|
+
* {@link #morph_weights_current_index} says which is this frame's.
|
|
601
|
+
*
|
|
602
|
+
* `null` until the first {@link register_morph}.
|
|
603
|
+
*
|
|
604
|
+
* @type {Array<GPUBuffer|null>}
|
|
605
|
+
*/
|
|
606
|
+
#morph_weights_buffers = [null, null];
|
|
607
|
+
|
|
608
|
+
/**
|
|
609
|
+
* Weights each of {@link #morph_weights_buffers} holds.
|
|
610
|
+
*
|
|
611
|
+
* @type {number}
|
|
612
|
+
*/
|
|
613
|
+
#morph_weights_capacity = 0;
|
|
614
|
+
|
|
615
|
+
/**
|
|
616
|
+
* Which of {@link #morph_weights_buffers} holds this frame's weights: 0 or 1.
|
|
617
|
+
*
|
|
618
|
+
* @type {number}
|
|
619
|
+
*/
|
|
620
|
+
#morph_weights_current_index = 0;
|
|
621
|
+
|
|
622
|
+
/**
|
|
623
|
+
* One past the highest weight row any morph has been given.
|
|
624
|
+
*
|
|
625
|
+
* @type {number}
|
|
626
|
+
*/
|
|
627
|
+
#morph_weight_count = 0;
|
|
628
|
+
|
|
629
|
+
/**
|
|
630
|
+
* Runs of weight rows, `[first_row, count]`, whose "last frame" the next resolve copies from
|
|
631
|
+
* "this frame": a run just handed out holds another morph's last weights or zeros there, and the
|
|
632
|
+
* morph pass reads it for the previous positions. As {@link #skin_matrix_seed_runs}.
|
|
633
|
+
*
|
|
634
|
+
* @type {Array<[number, number]>}
|
|
635
|
+
*/
|
|
636
|
+
#morph_weight_seed_runs = [];
|
|
637
|
+
|
|
638
|
+
/**
|
|
639
|
+
* When true, the next resolve seeds all of "last frame" from "this frame": the buffer was made
|
|
640
|
+
* again at a larger size.
|
|
641
|
+
*
|
|
642
|
+
* @type {boolean}
|
|
643
|
+
*/
|
|
644
|
+
#morph_weight_seed_all = false;
|
|
645
|
+
|
|
646
|
+
/**
|
|
647
|
+
* What the clips add to each weight in a frame, one `atomic<u32>` cell (f32 bits) per weight row:
|
|
648
|
+
* the apply pass adds, the resolve drains. Sized with {@link #morph_weights_buffers}; a placeholder
|
|
649
|
+
* of one cell until the first morph, because the apply pass binds it whatever it drives.
|
|
650
|
+
*
|
|
651
|
+
* @type {GPUBuffer|null}
|
|
652
|
+
*/
|
|
653
|
+
#morph_accumulator_buffer = null;
|
|
654
|
+
|
|
655
|
+
/**
|
|
656
|
+
* Every registered morph by id: the entity it weighs and its run of weight rows.
|
|
657
|
+
*
|
|
658
|
+
* @type {Map<number, {entity: number, weights_first: number, weight_count: number}>}
|
|
659
|
+
*/
|
|
660
|
+
#morphs = new Map();
|
|
661
|
+
|
|
662
|
+
/**
|
|
663
|
+
* The morph id of each entity that has one.
|
|
664
|
+
*
|
|
665
|
+
* @type {Map<number, number>}
|
|
666
|
+
*/
|
|
667
|
+
#morph_of_entity = new Map();
|
|
668
|
+
|
|
549
669
|
/**
|
|
550
670
|
* The bound clips that drive each entity, by entity — counted by the list's length, and named
|
|
551
671
|
* so that a hold can find the bindings to mute. An entity's local TRS is the GPU's while the
|
|
@@ -566,6 +686,21 @@ export class GPUAnimationManager {
|
|
|
566
686
|
*/
|
|
567
687
|
#targets_by_clip = new Map();
|
|
568
688
|
|
|
689
|
+
/**
|
|
690
|
+
* The bound clips keying morph weights of each entity, by entity: whose bindings go muted when the
|
|
691
|
+
* entity's weights are given back, and name its weights again when it is given new ones.
|
|
692
|
+
*
|
|
693
|
+
* @type {Map<number, number[]>}
|
|
694
|
+
*/
|
|
695
|
+
#clips_weighing = new Map();
|
|
696
|
+
|
|
697
|
+
/**
|
|
698
|
+
* The distinct entities whose morph weights each completed clip keys, by clip id.
|
|
699
|
+
*
|
|
700
|
+
* @type {Map<number, number[]>}
|
|
701
|
+
*/
|
|
702
|
+
#weighed_by_clip = new Map();
|
|
703
|
+
|
|
569
704
|
/**
|
|
570
705
|
* The CPU's copy of what each registered clip is playing at: the clip itself and the last
|
|
571
706
|
* time and weight set on it. What a joint is evaluated against when its last clip leaves, so
|
|
@@ -808,6 +943,340 @@ export class GPUAnimationManager {
|
|
|
808
943
|
return this.#skin_matrices_buffers[1 - this.#skin_matrices_current_index];
|
|
809
944
|
}
|
|
810
945
|
|
|
946
|
+
/**
|
|
947
|
+
* This frame's morph weights, `f32`, a weight at its `animation_morph_weights` row. `null` until
|
|
948
|
+
* the first {@link register_morph}. Flips role every frame with {@link prev_morph_weights_buffer}
|
|
949
|
+
* and is replaced when it grows, so re-fetch each frame.
|
|
950
|
+
*
|
|
951
|
+
* @returns {GPUBuffer|null}
|
|
952
|
+
*/
|
|
953
|
+
get morph_weights_buffer() {
|
|
954
|
+
return this.#morph_weights_buffers[this.#morph_weights_current_index];
|
|
955
|
+
}
|
|
956
|
+
|
|
957
|
+
/**
|
|
958
|
+
* The last frame's morph weights, laid out as {@link morph_weights_buffer}: what the morph pass
|
|
959
|
+
* makes previous positions from, and what the movers pass compares against.
|
|
960
|
+
*
|
|
961
|
+
* @returns {GPUBuffer|null}
|
|
962
|
+
*/
|
|
963
|
+
get prev_morph_weights_buffer() {
|
|
964
|
+
return this.#morph_weights_buffers[1 - this.#morph_weights_current_index];
|
|
965
|
+
}
|
|
966
|
+
|
|
967
|
+
/**
|
|
968
|
+
* Give a mesh entity its morph target weights: a run of `animation_morph_weights` rows, one per
|
|
969
|
+
* target, holding `base_weights` as their bases. Completes at once, waiting for no other entity.
|
|
970
|
+
* One entity, one registration: {@link unregister_morph} before registering it again.
|
|
971
|
+
*
|
|
972
|
+
* Clip channels keying a weight of `entity` bind once this has run, and the entity's morph binding
|
|
973
|
+
* in the deformation context reads its weights through the id.
|
|
974
|
+
*
|
|
975
|
+
* @param {number} entity
|
|
976
|
+
* @param {ArrayLike<number>} base_weights one per target, at least one
|
|
977
|
+
* @returns {number} morph id (a row of `animation_morphs`)
|
|
978
|
+
*/
|
|
979
|
+
register_morph(entity, base_weights) {
|
|
980
|
+
assert.isNonNegativeInteger(entity, 'entity');
|
|
981
|
+
assert.defined(base_weights, 'base_weights');
|
|
982
|
+
assert.greaterThanOrEqual(base_weights.length, 1, 'a morph has at least one target');
|
|
983
|
+
assert.equal(this.#morph_of_entity.has(entity), false, `entity ${entity} already has morph weights; unregister them first`);
|
|
984
|
+
|
|
985
|
+
const count = base_weights.length;
|
|
986
|
+
const records = new Array(count);
|
|
987
|
+
|
|
988
|
+
for (let i = 0; i < count; i++) {
|
|
989
|
+
records[i] = { base: base_weights[i] };
|
|
990
|
+
}
|
|
991
|
+
|
|
992
|
+
const weights_first = this.#database.get('animation_morph_weights').add_run_records(records, MORPH_WEIGHT_WRITER);
|
|
993
|
+
|
|
994
|
+
assert.lessThanOrEqual(weights_first + count, MORPH_WEIGHT_ROW_LIMIT, 'morph weight rows past what a binding handle holds');
|
|
995
|
+
|
|
996
|
+
const morph_id = this.#database.get('animation_morphs').add({
|
|
997
|
+
weights_first,
|
|
998
|
+
weight_count: count,
|
|
999
|
+
});
|
|
1000
|
+
|
|
1001
|
+
const end = weights_first + count;
|
|
1002
|
+
|
|
1003
|
+
if (end > this.#morph_weight_count) {
|
|
1004
|
+
this.#morph_weight_count = end;
|
|
1005
|
+
this.#ensure_morph_weights_capacity(end);
|
|
1006
|
+
}
|
|
1007
|
+
|
|
1008
|
+
// no last frame for these rows yet: the first resolve makes it this frame's
|
|
1009
|
+
this.#morph_weight_seed_runs.push([weights_first, count]);
|
|
1010
|
+
|
|
1011
|
+
this.#morphs.set(morph_id, { entity, weights_first, weight_count: count });
|
|
1012
|
+
this.#morph_of_entity.set(entity, morph_id);
|
|
1013
|
+
|
|
1014
|
+
// clips that bound against weights the entity had before name these now
|
|
1015
|
+
this.#point_weight_bindings(entity, weights_first, count);
|
|
1016
|
+
|
|
1017
|
+
return morph_id;
|
|
1018
|
+
}
|
|
1019
|
+
|
|
1020
|
+
/**
|
|
1021
|
+
* Write a registered morph's bases again, after its `MeshMorph` changed: only these rows' words go
|
|
1022
|
+
* up, and the next resolve publishes them.
|
|
1023
|
+
*
|
|
1024
|
+
* @param {number} morph_id
|
|
1025
|
+
* @param {ArrayLike<number>} base_weights as many as the morph has
|
|
1026
|
+
*/
|
|
1027
|
+
set_morph_weights(morph_id, base_weights) {
|
|
1028
|
+
const morph = this.#morphs.get(morph_id);
|
|
1029
|
+
|
|
1030
|
+
assert.defined(morph, `morph ${morph_id}`);
|
|
1031
|
+
assert.equal(base_weights.length, morph.weight_count, 'base_weights.length !== the morph\'s weight count');
|
|
1032
|
+
|
|
1033
|
+
const table = this.#database.get('animation_morph_weights');
|
|
1034
|
+
|
|
1035
|
+
for (let i = 0; i < morph.weight_count; i++) {
|
|
1036
|
+
MORPH_WEIGHT.base = base_weights[i];
|
|
1037
|
+
|
|
1038
|
+
table.set_record(morph.weights_first + i, MORPH_WEIGHT, MORPH_WEIGHT_WRITER);
|
|
1039
|
+
}
|
|
1040
|
+
}
|
|
1041
|
+
|
|
1042
|
+
/**
|
|
1043
|
+
* Give a morph's rows back. The entity's morph binding in the deformation context goes first, so its
|
|
1044
|
+
* next upload names no freed row, and every clip binding keying the weights is muted; registering the
|
|
1045
|
+
* entity again points them at its new weights.
|
|
1046
|
+
*
|
|
1047
|
+
* @param {number} morph_id
|
|
1048
|
+
*/
|
|
1049
|
+
unregister_morph(morph_id) {
|
|
1050
|
+
const morph = this.#morphs.get(morph_id);
|
|
1051
|
+
|
|
1052
|
+
if (morph === undefined) {
|
|
1053
|
+
return;
|
|
1054
|
+
}
|
|
1055
|
+
|
|
1056
|
+
this.#scene_context.deformation.unbind_all_by_morph(morph_id);
|
|
1057
|
+
|
|
1058
|
+
// a clip still keying the weights writes nothing from here on, rather than into rows the
|
|
1059
|
+
// next morph is handed
|
|
1060
|
+
this.#point_weight_bindings(morph.entity, 0, 0);
|
|
1061
|
+
|
|
1062
|
+
this.#morphs.delete(morph_id);
|
|
1063
|
+
this.#morph_of_entity.delete(morph.entity);
|
|
1064
|
+
|
|
1065
|
+
const runs = this.#morph_weight_seed_runs;
|
|
1066
|
+
|
|
1067
|
+
for (let i = runs.length - 1; i >= 0; i--) {
|
|
1068
|
+
if (runs[i][0] === morph.weights_first) {
|
|
1069
|
+
runs[i] = runs[runs.length - 1];
|
|
1070
|
+
runs.pop();
|
|
1071
|
+
}
|
|
1072
|
+
}
|
|
1073
|
+
|
|
1074
|
+
// the weights go with the morph
|
|
1075
|
+
this.#database.get('animation_morphs').remove(morph_id);
|
|
1076
|
+
}
|
|
1077
|
+
|
|
1078
|
+
/**
|
|
1079
|
+
* Name the weight run `[weights_first, weights_first + count)` in every binding of a bound clip
|
|
1080
|
+
* keying a weight of `entity`: its `element`'s row, or nothing for an element past `count` —
|
|
1081
|
+
* `count` 0 mutes them all. Only the `instance` word of each binding is written.
|
|
1082
|
+
*
|
|
1083
|
+
* @param {number} entity
|
|
1084
|
+
* @param {number} weights_first
|
|
1085
|
+
* @param {number} count
|
|
1086
|
+
*/
|
|
1087
|
+
#point_weight_bindings(entity, weights_first, count) {
|
|
1088
|
+
const clips = this.#clips_weighing.get(entity);
|
|
1089
|
+
|
|
1090
|
+
if (clips === undefined) {
|
|
1091
|
+
return;
|
|
1092
|
+
}
|
|
1093
|
+
|
|
1094
|
+
const clips_table = this.#database.get('animation_clips');
|
|
1095
|
+
const bindings = this.#database.get('animation_bindings');
|
|
1096
|
+
|
|
1097
|
+
for (let c = 0; c < clips.length; c++) {
|
|
1098
|
+
const clip_id = clips[c];
|
|
1099
|
+
const first = clips_table.get_word(clip_id, CLIP_BINDINGS_FIRST_WORD);
|
|
1100
|
+
const channels = this.#playback_by_clip.get(clip_id).clip.channels;
|
|
1101
|
+
|
|
1102
|
+
for (let i = 0; i < channels.length; i++) {
|
|
1103
|
+
const channel = channels[i];
|
|
1104
|
+
|
|
1105
|
+
if (channel.property !== ShadeAnimationProperty.MorphWeight || channel.target !== entity) {
|
|
1106
|
+
continue;
|
|
1107
|
+
}
|
|
1108
|
+
|
|
1109
|
+
assert.ok(count === 0 || channel.element < count, `clip ${clip_id} keys morph target ${channel.element} of entity ${entity}, which has ${count}`);
|
|
1110
|
+
|
|
1111
|
+
BINDING_INSTANCE.instance = channel.element < count
|
|
1112
|
+
? morph_weight_handle(weights_first + channel.element)
|
|
1113
|
+
: GPU_DATABASE_NULL;
|
|
1114
|
+
|
|
1115
|
+
bindings.set_fields(first + i, BINDING_INSTANCE, BINDING_INSTANCE_WRITER);
|
|
1116
|
+
}
|
|
1117
|
+
}
|
|
1118
|
+
}
|
|
1119
|
+
|
|
1120
|
+
/**
|
|
1121
|
+
* @param {number} entity
|
|
1122
|
+
* @returns {number} the entity's morph id, or -1 while it has none
|
|
1123
|
+
*/
|
|
1124
|
+
morph_of_entity(entity) {
|
|
1125
|
+
const id = this.#morph_of_entity.get(entity);
|
|
1126
|
+
|
|
1127
|
+
return id === undefined ? -1 : id;
|
|
1128
|
+
}
|
|
1129
|
+
|
|
1130
|
+
/**
|
|
1131
|
+
* @param {number} morph_id
|
|
1132
|
+
* @returns {number} the morph's first weight row
|
|
1133
|
+
*/
|
|
1134
|
+
get_morph_weights_first(morph_id) {
|
|
1135
|
+
const morph = this.#morphs.get(morph_id);
|
|
1136
|
+
|
|
1137
|
+
assert.defined(morph, `morph ${morph_id}`);
|
|
1138
|
+
|
|
1139
|
+
return morph.weights_first;
|
|
1140
|
+
}
|
|
1141
|
+
|
|
1142
|
+
/**
|
|
1143
|
+
* @param {number} morph_id
|
|
1144
|
+
* @returns {number} how many weights the morph has
|
|
1145
|
+
*/
|
|
1146
|
+
get_morph_weight_count(morph_id) {
|
|
1147
|
+
const morph = this.#morphs.get(morph_id);
|
|
1148
|
+
|
|
1149
|
+
assert.defined(morph, `morph ${morph_id}`);
|
|
1150
|
+
|
|
1151
|
+
return morph.weight_count;
|
|
1152
|
+
}
|
|
1153
|
+
|
|
1154
|
+
/**
|
|
1155
|
+
* Grow the weights buffers, both, and the accumulator with them. Nothing is copied: "this
|
|
1156
|
+
* frame" is written whole by the next resolve, and "last frame" is seeded from it, all of it, so
|
|
1157
|
+
* every morphed mesh reads no motion for that one frame, as after a skin matrix grow.
|
|
1158
|
+
*
|
|
1159
|
+
* @param {number} required_count weights each buffer must hold
|
|
1160
|
+
*/
|
|
1161
|
+
#ensure_morph_weights_capacity(required_count) {
|
|
1162
|
+
if (required_count <= this.#morph_weights_capacity) {
|
|
1163
|
+
return;
|
|
1164
|
+
}
|
|
1165
|
+
|
|
1166
|
+
let capacity = Math.max(this.#morph_weights_capacity, MORPH_WEIGHTS_INITIAL_CAPACITY);
|
|
1167
|
+
|
|
1168
|
+
while (capacity < required_count) {
|
|
1169
|
+
capacity *= 2;
|
|
1170
|
+
}
|
|
1171
|
+
|
|
1172
|
+
for (let i = 0; i < 2; i++) {
|
|
1173
|
+
if (this.#morph_weights_buffers[i] !== null) {
|
|
1174
|
+
this.#morph_weights_buffers[i].destroy();
|
|
1175
|
+
}
|
|
1176
|
+
|
|
1177
|
+
this.#morph_weights_buffers[i] = this.#device.createBuffer({
|
|
1178
|
+
label: `${this.#label}/MorphWeights/${i}`,
|
|
1179
|
+
size: capacity * MORPH_WEIGHT_BYTES,
|
|
1180
|
+
usage: GPUBufferUsage.STORAGE | GPUBufferUsage.COPY_SRC | GPUBufferUsage.COPY_DST,
|
|
1181
|
+
});
|
|
1182
|
+
}
|
|
1183
|
+
|
|
1184
|
+
if (this.#morph_accumulator_buffer !== null) {
|
|
1185
|
+
this.#morph_accumulator_buffer.destroy();
|
|
1186
|
+
}
|
|
1187
|
+
|
|
1188
|
+
// createBuffer zeroes it, which is an empty sum for every cell
|
|
1189
|
+
this.#morph_accumulator_buffer = this.#device.createBuffer({
|
|
1190
|
+
label: `${this.#label}/MorphAccumulator`,
|
|
1191
|
+
size: capacity * 4,
|
|
1192
|
+
usage: GPUBufferUsage.STORAGE,
|
|
1193
|
+
});
|
|
1194
|
+
|
|
1195
|
+
this.#morph_weights_capacity = capacity;
|
|
1196
|
+
this.#morph_weight_seed_all = true;
|
|
1197
|
+
}
|
|
1198
|
+
|
|
1199
|
+
/**
|
|
1200
|
+
* The accumulator the apply pass binds, made at its smallest when no morph has asked for one yet.
|
|
1201
|
+
*
|
|
1202
|
+
* @returns {GPUBuffer}
|
|
1203
|
+
*/
|
|
1204
|
+
#obtain_morph_accumulator() {
|
|
1205
|
+
if (this.#morph_accumulator_buffer === null) {
|
|
1206
|
+
this.#morph_accumulator_buffer = this.#device.createBuffer({
|
|
1207
|
+
label: `${this.#label}/MorphAccumulator`,
|
|
1208
|
+
size: 4,
|
|
1209
|
+
usage: GPUBufferUsage.STORAGE,
|
|
1210
|
+
});
|
|
1211
|
+
}
|
|
1212
|
+
|
|
1213
|
+
return this.#morph_accumulator_buffer;
|
|
1214
|
+
}
|
|
1215
|
+
|
|
1216
|
+
/**
|
|
1217
|
+
* Resolve this frame's morph weights: flip the pair, write every weight row's base plus what the
|
|
1218
|
+
* clips added into the new "this frame", and seed "last frame" over the rows that have none. After
|
|
1219
|
+
* the apply pass, before any pass that reads the weights. No-op while no morph is registered.
|
|
1220
|
+
*
|
|
1221
|
+
* @param {ShadeGPUCommandContext} cmd_ctx
|
|
1222
|
+
*/
|
|
1223
|
+
dispatch_morph_weights_resolve(cmd_ctx) {
|
|
1224
|
+
const groups = this.#database
|
|
1225
|
+
.get('animation_morph_weights')
|
|
1226
|
+
.dispatch_group_count(MORPH_WEIGHTS_RESOLVE_WORKGROUP_SIZE);
|
|
1227
|
+
|
|
1228
|
+
if (groups === 0 || this.#morph_weights_buffers[0] === null) {
|
|
1229
|
+
return;
|
|
1230
|
+
}
|
|
1231
|
+
|
|
1232
|
+
this.#morph_weights_current_index = 1 - this.#morph_weights_current_index;
|
|
1233
|
+
|
|
1234
|
+
shader_morph_weights_resolve.dispatch({
|
|
1235
|
+
encoder: cmd_ctx,
|
|
1236
|
+
group_count_x: groups,
|
|
1237
|
+
bindings: {
|
|
1238
|
+
animation_database: this.#database.buffer,
|
|
1239
|
+
morph_accumulator: this.#morph_accumulator_buffer,
|
|
1240
|
+
morph_weights: this.morph_weights_buffer,
|
|
1241
|
+
},
|
|
1242
|
+
});
|
|
1243
|
+
|
|
1244
|
+
this.#seed_previous_morph_weights(cmd_ctx);
|
|
1245
|
+
}
|
|
1246
|
+
|
|
1247
|
+
/**
|
|
1248
|
+
* Copy this frame's weights over the last frame's on the rows that have no last frame: all of them
|
|
1249
|
+
* after a grow, otherwise the runs handed out since the last resolve.
|
|
1250
|
+
*
|
|
1251
|
+
* @param {ShadeGPUCommandContext} cmd_ctx
|
|
1252
|
+
*/
|
|
1253
|
+
#seed_previous_morph_weights(cmd_ctx) {
|
|
1254
|
+
const current = this.morph_weights_buffer;
|
|
1255
|
+
const previous = this.prev_morph_weights_buffer;
|
|
1256
|
+
const runs = this.#morph_weight_seed_runs;
|
|
1257
|
+
|
|
1258
|
+
if (this.#morph_weight_seed_all) {
|
|
1259
|
+
cmd_ctx.copyBufferToBuffer(current, 0, previous, 0, current.size);
|
|
1260
|
+
|
|
1261
|
+
this.#morph_weight_seed_all = false;
|
|
1262
|
+
runs.length = 0;
|
|
1263
|
+
|
|
1264
|
+
return;
|
|
1265
|
+
}
|
|
1266
|
+
|
|
1267
|
+
for (let i = 0; i < runs.length; i++) {
|
|
1268
|
+
const [first, count] = runs[i];
|
|
1269
|
+
|
|
1270
|
+
cmd_ctx.copyBufferToBuffer(
|
|
1271
|
+
current, first * MORPH_WEIGHT_BYTES,
|
|
1272
|
+
previous, first * MORPH_WEIGHT_BYTES,
|
|
1273
|
+
count * MORPH_WEIGHT_BYTES,
|
|
1274
|
+
);
|
|
1275
|
+
}
|
|
1276
|
+
|
|
1277
|
+
runs.length = 0;
|
|
1278
|
+
}
|
|
1279
|
+
|
|
811
1280
|
/**
|
|
812
1281
|
* Matrices the buffer has to address: one past the highest joint row any skin has been
|
|
813
1282
|
* given. Independent of buffer capacity, which is at least this big.
|
|
@@ -1403,7 +1872,7 @@ export class GPUAnimationManager {
|
|
|
1403
1872
|
skin.meshes.push(entity);
|
|
1404
1873
|
|
|
1405
1874
|
if (skin.named) {
|
|
1406
|
-
this.#scene_context.
|
|
1875
|
+
this.#scene_context.deformation.bind(entity, skin_id);
|
|
1407
1876
|
}
|
|
1408
1877
|
}
|
|
1409
1878
|
|
|
@@ -1427,7 +1896,7 @@ export class GPUAnimationManager {
|
|
|
1427
1896
|
meshes[index] = meshes[meshes.length - 1];
|
|
1428
1897
|
meshes.pop();
|
|
1429
1898
|
|
|
1430
|
-
this.#scene_context.
|
|
1899
|
+
this.#scene_context.deformation.unbind(entity);
|
|
1431
1900
|
}
|
|
1432
1901
|
|
|
1433
1902
|
/**
|
|
@@ -1436,7 +1905,7 @@ export class GPUAnimationManager {
|
|
|
1436
1905
|
* @param {RegisteredSkin} skin
|
|
1437
1906
|
*/
|
|
1438
1907
|
#bind_meshes(skin) {
|
|
1439
|
-
const skinning = this.#scene_context.
|
|
1908
|
+
const skinning = this.#scene_context.deformation;
|
|
1440
1909
|
const meshes = skin.meshes;
|
|
1441
1910
|
|
|
1442
1911
|
for (let i = 0; i < meshes.length; i++) {
|
|
@@ -1546,6 +2015,10 @@ export class GPUAnimationManager {
|
|
|
1546
2015
|
* the component — a prefab does, on every node a clip reaches — because a grant that could
|
|
1547
2016
|
* silently do nothing would be a claim nobody could see.
|
|
1548
2017
|
*
|
|
2018
|
+
* A {@link ShadeAnimationProperty.MorphWeight} channel is different: it waits for its target's morph
|
|
2019
|
+
* weights ({@link register_morph}) rather than its row, keys the weight of its `element`, and hands
|
|
2020
|
+
* nothing to the GPU — the weights were never the CPU's to write.
|
|
2021
|
+
*
|
|
1549
2022
|
* Curves and tracks are interned synchronously since they're pure data.
|
|
1550
2023
|
*
|
|
1551
2024
|
* @param {ShadeAnimationClip} clip
|
|
@@ -1580,6 +2053,7 @@ export class GPUAnimationManager {
|
|
|
1580
2053
|
track: this.#intern_track(track_channels),
|
|
1581
2054
|
target: channel.target,
|
|
1582
2055
|
property: channel.property,
|
|
2056
|
+
element: channel.element,
|
|
1583
2057
|
};
|
|
1584
2058
|
}
|
|
1585
2059
|
|
|
@@ -1620,7 +2094,7 @@ export class GPUAnimationManager {
|
|
|
1620
2094
|
*
|
|
1621
2095
|
* @param {{
|
|
1622
2096
|
* clip_id: number,
|
|
1623
|
-
* channels: Array<{ track: number, target: number, property: number }>,
|
|
2097
|
+
* channels: Array<{ track: number, target: number, property: number, element: number }>,
|
|
1624
2098
|
* }} pending
|
|
1625
2099
|
* @returns {boolean}
|
|
1626
2100
|
*/
|
|
@@ -1637,6 +2111,26 @@ export class GPUAnimationManager {
|
|
|
1637
2111
|
|
|
1638
2112
|
assert.isNonNegativeInteger(target, `clip channel ${i} target`);
|
|
1639
2113
|
|
|
2114
|
+
if (ch.property === ShadeAnimationProperty.MorphWeight) {
|
|
2115
|
+
const morph = this.#morphs.get(this.morph_of_entity(target));
|
|
2116
|
+
|
|
2117
|
+
if (morph === undefined) return false;
|
|
2118
|
+
|
|
2119
|
+
assert.lessThan(ch.element, morph.weight_count, `clip channel ${i} keys morph target ${ch.element} of entity ${target}, which has ${morph.weight_count}`);
|
|
2120
|
+
|
|
2121
|
+
bindings[i] = {
|
|
2122
|
+
track: ch.track,
|
|
2123
|
+
instance: ch.element < morph.weight_count
|
|
2124
|
+
? morph_weight_handle(morph.weights_first + ch.element)
|
|
2125
|
+
: GPU_DATABASE_NULL,
|
|
2126
|
+
property: ch.property,
|
|
2127
|
+
clip: clip_id,
|
|
2128
|
+
rest_rotation: MORPH_WEIGHT_REST_ROTATION,
|
|
2129
|
+
};
|
|
2130
|
+
|
|
2131
|
+
continue;
|
|
2132
|
+
}
|
|
2133
|
+
|
|
1640
2134
|
if (!rows.has(target)) return false;
|
|
1641
2135
|
|
|
1642
2136
|
bindings[i] = {
|
|
@@ -1671,7 +2165,7 @@ export class GPUAnimationManager {
|
|
|
1671
2165
|
* of them leaves.
|
|
1672
2166
|
*
|
|
1673
2167
|
* @param {number} clip_id
|
|
1674
|
-
* @param {Array<{target: number}>} channels
|
|
2168
|
+
* @param {Array<{target: number, property: number}>} channels
|
|
1675
2169
|
*/
|
|
1676
2170
|
#take_targets(clip_id, channels) {
|
|
1677
2171
|
const rows = this.#scene_context.rows;
|
|
@@ -1679,10 +2173,29 @@ export class GPUAnimationManager {
|
|
|
1679
2173
|
const driving = this.#clips_driving;
|
|
1680
2174
|
|
|
1681
2175
|
const targets = [];
|
|
2176
|
+
const weighed = [];
|
|
1682
2177
|
|
|
1683
2178
|
for (let i = 0; i < channels.length; i++) {
|
|
1684
2179
|
const target = channels[i].target;
|
|
1685
2180
|
|
|
2181
|
+
if (channels[i].property === ShadeAnimationProperty.MorphWeight) {
|
|
2182
|
+
// a weight is no transform: listed so the binding follows the entity's weights
|
|
2183
|
+
if (weighed.indexOf(target) === -1) {
|
|
2184
|
+
weighed.push(target);
|
|
2185
|
+
|
|
2186
|
+
let clips = this.#clips_weighing.get(target);
|
|
2187
|
+
|
|
2188
|
+
if (clips === undefined) {
|
|
2189
|
+
clips = [];
|
|
2190
|
+
this.#clips_weighing.set(target, clips);
|
|
2191
|
+
}
|
|
2192
|
+
|
|
2193
|
+
clips.push(clip_id);
|
|
2194
|
+
}
|
|
2195
|
+
|
|
2196
|
+
continue;
|
|
2197
|
+
}
|
|
2198
|
+
|
|
1686
2199
|
if (targets.indexOf(target) !== -1) {
|
|
1687
2200
|
continue;
|
|
1688
2201
|
}
|
|
@@ -1730,6 +2243,7 @@ export class GPUAnimationManager {
|
|
|
1730
2243
|
}
|
|
1731
2244
|
|
|
1732
2245
|
this.#targets_by_clip.set(clip_id, targets);
|
|
2246
|
+
this.#weighed_by_clip.set(clip_id, weighed);
|
|
1733
2247
|
}
|
|
1734
2248
|
|
|
1735
2249
|
/**
|
|
@@ -1771,6 +2285,22 @@ export class GPUAnimationManager {
|
|
|
1771
2285
|
* @param {number} clip_id
|
|
1772
2286
|
*/
|
|
1773
2287
|
#release_targets(clip_id) {
|
|
2288
|
+
const weighed = this.#weighed_by_clip.get(clip_id);
|
|
2289
|
+
|
|
2290
|
+
if (weighed !== undefined) {
|
|
2291
|
+
this.#weighed_by_clip.delete(clip_id);
|
|
2292
|
+
|
|
2293
|
+
for (let i = 0; i < weighed.length; i++) {
|
|
2294
|
+
const clips = this.#clips_weighing.get(weighed[i]);
|
|
2295
|
+
|
|
2296
|
+
clips.splice(clips.indexOf(clip_id), 1);
|
|
2297
|
+
|
|
2298
|
+
if (clips.length === 0) {
|
|
2299
|
+
this.#clips_weighing.delete(weighed[i]);
|
|
2300
|
+
}
|
|
2301
|
+
}
|
|
2302
|
+
}
|
|
2303
|
+
|
|
1774
2304
|
const targets = this.#targets_by_clip.get(clip_id);
|
|
1775
2305
|
|
|
1776
2306
|
if (targets === undefined) {
|
|
@@ -1950,7 +2480,7 @@ export class GPUAnimationManager {
|
|
|
1950
2480
|
const channels = this.#playback_by_clip.get(clip_id).clip.channels;
|
|
1951
2481
|
|
|
1952
2482
|
for (let i = 0; i < channels.length; i++) {
|
|
1953
|
-
if (channels[i].target === entity) {
|
|
2483
|
+
if (channels[i].target === entity && channels[i].property !== ShadeAnimationProperty.MorphWeight) {
|
|
1954
2484
|
write_rest_for_property(rest_rotation, rest, channels[i].property);
|
|
1955
2485
|
bindings.set_fields(first + i, BINDING_UNMUTE, BINDING_UNMUTE_WRITER);
|
|
1956
2486
|
}
|
|
@@ -1993,7 +2523,8 @@ export class GPUAnimationManager {
|
|
|
1993
2523
|
const channels = this.#playback_by_clip.get(clip_id).clip.channels;
|
|
1994
2524
|
|
|
1995
2525
|
for (let i = 0; i < channels.length; i++) {
|
|
1996
|
-
|
|
2526
|
+
// a weight binding is no transform's, and a hold on the node does not mute it
|
|
2527
|
+
if (channels[i].target === entity && channels[i].property !== ShadeAnimationProperty.MorphWeight) {
|
|
1997
2528
|
bindings.set_fields(first + i, fields, writer);
|
|
1998
2529
|
}
|
|
1999
2530
|
}
|
|
@@ -2360,7 +2891,7 @@ export class GPUAnimationManager {
|
|
|
2360
2891
|
// context's next upload doesn't reference a freed skin row
|
|
2361
2892
|
// (its upload path looks up skin_matrix_offset via
|
|
2362
2893
|
// get_skin_matrix_offset, which would assert post-removal).
|
|
2363
|
-
this.#scene_context.
|
|
2894
|
+
this.#scene_context.deformation.unbind_all_by_skin(skin_id);
|
|
2364
2895
|
|
|
2365
2896
|
const skins_table = this.#database.get('animation_skins');
|
|
2366
2897
|
|
|
@@ -2861,6 +3392,10 @@ export class GPUAnimationManager {
|
|
|
2861
3392
|
cmd_ctx.encodeGraph(graph);
|
|
2862
3393
|
}
|
|
2863
3394
|
|
|
3395
|
+
// The frame's morph weights, from their bases and what the apply added. Every frame while a
|
|
3396
|
+
// morph is registered, clips or not: it is also what publishes a base the CPU changed.
|
|
3397
|
+
this.dispatch_morph_weights_resolve(cmd_ctx);
|
|
3398
|
+
|
|
2864
3399
|
// Skin matrix prep + skinning deformation. Both no-op when
|
|
2865
3400
|
// no skins are registered — and both run independent of the
|
|
2866
3401
|
// bound-track gate above: a registered skin whose joints
|
|
@@ -2868,7 +3403,7 @@ export class GPUAnimationManager {
|
|
|
2868
3403
|
// each frame, otherwise it renders bind pose forever.
|
|
2869
3404
|
this.dispatch_skin_matrix_prep(cmd_ctx);
|
|
2870
3405
|
|
|
2871
|
-
const deformed = this.#scene_context.
|
|
3406
|
+
const deformed = this.#scene_context.deformation.update(cmd_ctx);
|
|
2872
3407
|
|
|
2873
3408
|
// Whether anything on the GPU moved a row this frame without the CPU knowing: a clip wrote
|
|
2874
3409
|
// a TRS, a foliage wind bone deflected, or a skinning pass moved a clone.
|
|
@@ -2934,6 +3469,9 @@ export class GPUAnimationManager {
|
|
|
2934
3469
|
const gr_materials = graph_import_buffer(
|
|
2935
3470
|
graph, this.#scene_context.materials.metadata_table.buffer, "materials"
|
|
2936
3471
|
);
|
|
3472
|
+
const gr_morph_accumulator = graph_import_buffer(
|
|
3473
|
+
graph, this.#obtain_morph_accumulator(), "morph_accumulator"
|
|
3474
|
+
);
|
|
2937
3475
|
const apply_data = {};
|
|
2938
3476
|
const apply_pass = graph.add("animation/apply", apply_data, (data, resources, ctx) => {
|
|
2939
3477
|
shader_animation_apply.dispatch({
|
|
@@ -2943,11 +3481,13 @@ export class GPUAnimationManager {
|
|
|
2943
3481
|
animation_database: resources.get(data.animation_database),
|
|
2944
3482
|
pose_accumulator: resources.get(data.pose_accumulator),
|
|
2945
3483
|
materials: resources.get(data.materials),
|
|
3484
|
+
morph_accumulator: resources.get(data.morph_accumulator),
|
|
2946
3485
|
},
|
|
2947
3486
|
});
|
|
2948
3487
|
});
|
|
2949
3488
|
apply_data.animation_database = apply_pass.read(gr_animation_database);
|
|
2950
3489
|
apply_data.materials = apply_pass.write(apply_pass.read(gr_materials));
|
|
3490
|
+
apply_data.morph_accumulator = apply_pass.write(apply_pass.read(gr_morph_accumulator));
|
|
2951
3491
|
apply_data.pose_accumulator = apply_pass.write(apply_pass.read(last_pose_accumulator));
|
|
2952
3492
|
last_pose_accumulator = apply_data.pose_accumulator;
|
|
2953
3493
|
}
|
|
@@ -3026,5 +3566,15 @@ export class GPUAnimationManager {
|
|
|
3026
3566
|
this.#pose_accumulator_buffer.destroy();
|
|
3027
3567
|
this.#pose_accumulator_buffer = null;
|
|
3028
3568
|
}
|
|
3569
|
+
for (let i = 0; i < 2; i++) {
|
|
3570
|
+
if (this.#morph_weights_buffers[i] !== null) {
|
|
3571
|
+
this.#morph_weights_buffers[i].destroy();
|
|
3572
|
+
this.#morph_weights_buffers[i] = null;
|
|
3573
|
+
}
|
|
3574
|
+
}
|
|
3575
|
+
if (this.#morph_accumulator_buffer !== null) {
|
|
3576
|
+
this.#morph_accumulator_buffer.destroy();
|
|
3577
|
+
this.#morph_accumulator_buffer = null;
|
|
3578
|
+
}
|
|
3029
3579
|
}
|
|
3030
3580
|
}
|