Owning, solver-independent baked rigid-fragment animation within Physics. @ownership Owns all samples; retains no instance/world pointers. @thread Mutation requires exclusive access. Const sampling/saving may run concurrently when no caller mutates the clip. Sampling/saving have no callbacks. Copies may play independently. capture synchronously invokes the source interface without locks; source methods must not reenter or mutate this clip, and the source must remain stable throughout the call. @lifetime Valid after source instance/world destruction and process restart. File schema EVECOLL1 versions 3/4 checksum all bytes (noncryptographic); v4 embeds provenance. Versions 1/2 load as unverified legacy input; saving upgrades them. Version 1 migrates as boxes. Unknown versions, trailing bytes and malformed data are rejected before publication. 更多...
#include <CollapseAnimation.h>
Public 成员函数 | |
| Result< void > | beginBake (const CollapseBakeRecipe &recipe) |
| Freeze complete provenance before the first recorded frame. @cost Linear in bounded metadata, once per bake admission. Does not retain a mutable builder alias. | |
| std::shared_ptr< const CollapseBakeRecipe > | recipe () const noexcept |
| Immutable recorded provenance; null means historical/unidentified recording. @ownership Shared result extends metadata lifetime beyond the clip. No borrowed world or asset data. | |
| Result< void > | capture (const CollapseCaptureSource &source, float seconds) |
| Record a complete frame at strictly increasing seconds, starting at zero. @cost Linear in fragments per frame; the first embedded geometry is also validated quadratically in vertices per fragment. Amortize that admission over the entire offline recording. | |
| Result< BonePresentation > | sample (float seconds, int bone) const |
| Sample a fragment, clamping time to endpoints; linear translation and shortest quaternion nlerp. | |
| Result< void > | save (std::string_view path) const |
| Save a new file; refuses existing paths to preserve previous bakes. @cost Linear in recorded samples, with one bounded serialized buffer; perform outside the frame loop. | |
| float | duration () const noexcept |
| Recorded duration in seconds. | |
| int | boneCount () const noexcept |
| Number of fragments. | |
| int | frameCount () const noexcept |
| Number of recorded frames. | |
| std::shared_ptr< const FractureGeometry > | fragmentGeometry () const noexcept |
| Shared immutable embedded meshes; empty for v1/box animations. @ownership Return value extends mesh lifetime across clip replacement or destruction. @thread Single caller during mutation; immutable geometry is safe to share. | |
静态 Public 成员函数 | |
| static Result< CollapseAnimation > | loadForRecipe (std::string_view path, const CollapseBakeRecipe &expected) |
| Load only if embedded provenance exactly matches the supplied expected recipe. @cost Linear file validation plus bounded metadata comparison, once per asset admission. | |
| static std::string | contentKey (std::string_view source) |
| Stable noncryptographic cache identity over every source byte. Compatibility facade; canonical native implementation is physics/bake bakedAssetContentKey. | |
| static Result< CollapseAnimation > | load (std::string_view path) |
| Load and validate a file before publishing an owning animation. @cost Linear in file size; perform once per asset, reuse for all playback instances. | |
详细描述
Owning, solver-independent baked rigid-fragment animation within Physics. @ownership Owns all samples; retains no instance/world pointers. @thread Mutation requires exclusive access. Const sampling/saving may run concurrently when no caller mutates the clip. Sampling/saving have no callbacks. Copies may play independently. capture synchronously invokes the source interface without locks; source methods must not reenter or mutate this clip, and the source must remain stable throughout the call. @lifetime Valid after source instance/world destruction and process restart. File schema EVECOLL1 versions 3/4 checksum all bytes (noncryptographic); v4 embeds provenance. Versions 1/2 load as unverified legacy input; saving upgrades them. Version 1 migrates as boxes. Unknown versions, trailing bytes and malformed data are rejected before publication.
在文件 CollapseAnimation.h 第 27 行定义.
成员函数说明
◆ beginBake()
| Result< void > eve::physics::CollapseAnimation::beginBake | ( | const CollapseBakeRecipe & | recipe | ) |
Freeze complete provenance before the first recorded frame. @cost Linear in bounded metadata, once per bake admission. Does not retain a mutable builder alias.
- 返回
- Failure leaves clip unchanged; recordings and loaded assets cannot be relabeled after capture.
在文件 CollapseAnimation.cpp 第 45 行定义.
引用了 eve::Diagnostic::error(), eve::Result< T >::failure(), eve::physics::force_detail::invalid(), eve::physics::MetresRightHandedYUp, eve::PreconditionViolation, recipe() , 以及 eve::Result< T >::success().
◆ boneCount()
|
noexcept |
Number of fragments.
在文件 CollapseAnimation.cpp 第 76 行定义.
被这些函数引用 capture(), eve::physics::GeometryCollectionRenderer::drawAnimation(), eve::physics::exposeCollapseAnimation(), eve::physics::GeometryCollectionRenderer::prepareAnimation(), sample(), save(), eve::physics::GeometryCollectionRenderer::submitAnimation() , 以及 eve::physics::GeometryCollectionRenderer::submitPlayback().
◆ capture()
| Result< void > eve::physics::CollapseAnimation::capture | ( | const CollapseCaptureSource & | source, |
| float | seconds | ||
| ) |
Record a complete frame at strictly increasing seconds, starting at zero. @cost Linear in fragments per frame; the first embedded geometry is also validated quadratically in vertices per fragment. Amortize that admission over the entire offline recording.
- 返回
- Failure leaves recorded frames unchanged. Source is borrowed only here.
在文件 CollapseAnimationCapture.cpp 第 11 行定义.
引用了 a, b, boneCount(), count, duration(), eve::Result< T >::failure(), frame, eve::physics::force_detail::invalid(), eve::physics::collapse_detail::MaxSamples, pose, source, eve::Result< T >::success() , 以及 valid.
◆ contentKey()
|
static |
Stable noncryptographic cache identity over every source byte. Compatibility facade; canonical native implementation is physics/bake bakedAssetContentKey.
- 参数
-
source Borrowed recipe/model/script bytes, consumed synchronously.
- 返回
- Owning 32-character lowercase hex key; not a security digest. @cost Linear native byte hashing, once per source/recipe admission, never per frame. @thread Reentrant, no IO, global state or callbacks.
在文件 CollapseAnimation.cpp 第 23 行定义.
引用了 eve::physics::bakedAssetContentKey() , 以及 source.
被这些函数引用 eve::physics::exposeCollapseAnimation(), load(), eve::physics::CollapseDust::load(), save() , 以及 eve::physics::CollapseDust::save().
◆ duration()
|
noexcept |
Recorded duration in seconds.
在文件 CollapseAnimation.cpp 第 75 行定义.
被这些函数引用 capture() , 以及 eve::physics::exposeCollapseAnimation().
◆ fragmentGeometry()
|
noexcept |
Shared immutable embedded meshes; empty for v1/box animations. @ownership Return value extends mesh lifetime across clip replacement or destruction. @thread Single caller during mutation; immutable geometry is safe to share.
在文件 CollapseAnimation.cpp 第 74 行定义.
被这些函数引用 eve::physics::GeometryCollectionRenderer::drawAnimation() , 以及 eve::physics::GeometryCollectionRenderer::prepareAnimation().
◆ frameCount()
|
noexcept |
Number of recorded frames.
在文件 CollapseAnimation.cpp 第 79 行定义.
被这些函数引用 eve::physics::exposeCollapseAnimation(), eve::physics::CollapsePlayback::prepare() , 以及 save().
◆ load()
|
static |
Load and validate a file before publishing an owning animation. @cost Linear in file size; perform once per asset, reuse for all playback instances.
- 返回
- Complete animation or failure, with no observable partial restore.
在文件 CollapseAnimation.cpp 第 155 行定义.
引用了 a, b, bones, bytes, clip, contentKey(), eve::physics::BakeRecipe::decode(), error, eve::Diagnostic::error(), f, eve::Failed, eve::Result< T >::failure(), file, frame, geometry, eve::physics::BonePresentation::halfExtentX, eve::physics::FractureFragment::indices, eve::physics::force_detail::invalid(), level, m, eve::physics::FractureFragment::materials, eve::physics::collapse_detail::MaxRecipeBytes, eve::physics::collapse_detail::MaxSamples, eve::physics::MetresRightHandedYUp, eve::NotFound, path, position, eve::physics::FractureFragment::positions, eve::physics::snapshot_detail::readFloat(), state, status, eve::Result< T >::success(), tag, triangles, v, valid, values, version , 以及 vertices.
被这些函数引用 eve::physics::exposeCollapseAnimation() , 以及 loadForRecipe().
◆ loadForRecipe()
|
static |
Load only if embedded provenance exactly matches the supplied expected recipe. @cost Linear file validation plus bounded metadata comparison, once per asset admission.
- 返回
- NotFound for absent files, Conflict for mismatched provenance, PreconditionViolation for legacy unidentified clips. A failure never replaces a caller's current asset.
在文件 CollapseAnimation.cpp 第 58 行定义.
引用了 eve::Conflict, eve::physics::BakeRecipe::encode(), eve::Diagnostic::error(), eve::Result< T >::failure(), load(), loaded, path , 以及 eve::PreconditionViolation.
◆ recipe()
|
noexcept |
Immutable recorded provenance; null means historical/unidentified recording. @ownership Shared result extends metadata lifetime beyond the clip. No borrowed world or asset data.
在文件 CollapseAnimation.cpp 第 57 行定义.
被这些函数引用 beginBake().
◆ sample()
| Result< BonePresentation > eve::physics::CollapseAnimation::sample | ( | float | seconds, |
| int | bone | ||
| ) | const |
Sample a fragment, clamping time to endpoints; linear translation and shortest quaternion nlerp.
- 返回
- Owning pose; state switches at the recorded frame boundary.
在文件 CollapseAnimation.cpp 第 80 行定义.
引用了 a, b, bone, boneCount(), f, eve::Result< T >::failure(), index, eve::physics::force_detail::invalid(), result, eve::Result< T >::success() , 以及 t.
被这些函数引用 eve::physics::GeometryCollectionRenderer::drawAnimation(), eve::physics::GeometryCollectionRenderer::prepareAnimation() , 以及 eve::physics::GeometryCollectionRenderer::submitAnimation().
◆ save()
| Result< void > eve::physics::CollapseAnimation::save | ( | std::string_view | path | ) | const |
Save a new file; refuses existing paths to preserve previous bakes. @cost Linear in recorded samples, with one bounded serialized buffer; perform outside the frame loop.
- 返回
- Checked IO status. Complete staged data is published without replacement. Filesystems without hard links fail explicitly. Linux syncs data before publication and the parent directory afterwards; other platforms currently guarantee atomic visibility only. Storage must honor fsync. Linux requires anonymous O_TMPFILE staging and procfs descriptor links; unsupported staging fails explicitly. A Linux barrier failure carries publication=not_published or published and durability=unconfirmed diagnostic details. A published failure leaves a complete target: inspect it before deciding to retry. Failure never removes the target; only this call's private temporary files are cleaned.
在文件 CollapseAnimation.cpp 第 109 行定义.
引用了 b, boneCount(), bytes, contentKey(), f, eve::Result< T >::failure(), frameCount(), eve::physics::force_detail::invalid(), mesh, out, path, eve::physics::publishBakedAsset(), tag , 以及 v.
该类的文档由以下文件生成:
- src/modules/physics/backend/bake/collapse/CollapseAnimation.h
- src/modules/physics/backend/bake/collapse/CollapseAnimation.cpp
- src/modules/physics/backend/bake/collapse/CollapseAnimationCapture.cpp