Skip to content

Commit 06dcd58

Browse files
Radient: add generic animation clip asset API
Define schema-based animation targets, samplers, and channels. Implement validated packed clip storage and asset-manager creation. Add documented C/C++ API examples and comprehensive validation tests.
1 parent 687b7c8 commit 06dcd58

13 files changed

Lines changed: 2093 additions & 9 deletions

‎Radient/CMakeLists.txt‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ project(Radient CXX)
44

55
set(SOURCE
66
src/Animation/RadientAnimationRegistryImpl.cpp
7+
src/Assets/RadientAnimation.cpp
78
src/Assets/RadientAssetManagerImpl.cpp
89
src/Assets/RadientAssetResolver.cpp
910
src/Assets/RadientAssetValidation.cpp

‎Radient/include/Assets/RadientAssetManagerImpl.hpp‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,9 @@ class RadientAssetManagerImpl final : public ObjectBase<IRadientAssetManager>
113113

114114
virtual RADIENT_STATUS DILIGENT_CALL_TYPE Stop(IDeviceContext* pContext) override final;
115115

116+
virtual RADIENT_STATUS DILIGENT_CALL_TYPE CreateAnimationClip(const RadientAnimationClipDesc& ClipDesc,
117+
IRadientAnimationClipAsset** ppClip) override final;
118+
116119
// Must be called from the render thread.
117120
static RadientDrawableMeshResolveResult GetDrawableMesh(IRadientMeshAsset* pMesh,
118121
bool RequireGPUResourcesReady);

‎Radient/interface/RadientAnimation.h‎

Lines changed: 422 additions & 2 deletions
Large diffs are not rendered by default.

‎Radient/interface/RadientAssets.h‎

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,15 @@ typedef struct IRadientSceneAsset IRadientSceneAsset;
4545
typedef struct IRadientSkeletonAsset IRadientSkeletonAsset;
4646
typedef struct IRadientSkinAsset IRadientSkinAsset;
4747
typedef struct IRadientSkeletonAnimationAsset IRadientSkeletonAnimationAsset;
48+
typedef struct IRadientAnimationClipAsset IRadientAnimationClipAsset;
4849
typedef struct IRadientMorphTargetWeights IRadientMorphTargetWeights;
4950
typedef struct IDeviceContext IDeviceContext;
5051

5152
typedef struct RadientStandardMaterialDefinitionCreateInfo RadientStandardMaterialDefinitionCreateInfo;
5253
typedef struct RadientSkeletonDesc RadientSkeletonDesc;
5354
typedef struct RadientSkinDesc RadientSkinDesc;
5455
typedef struct RadientSkeletonAnimationDesc RadientSkeletonAnimationDesc;
56+
typedef struct RadientAnimationClipDesc RadientAnimationClipDesc;
5557
typedef struct RadientMorphTargetCreateInfo RadientMorphTargetCreateInfo;
5658
typedef struct RadientMorphTargetDesc RadientMorphTargetDesc;
5759

@@ -82,7 +84,10 @@ DILIGENT_TYPED_ENUM(RADIENT_ASSET_TYPE, Uint8)
8284
RADIENT_ASSET_TYPE_SKIN,
8385

8486
/// Immutable animation clip targeting a skeleton hierarchy.
85-
RADIENT_ASSET_TYPE_SKELETON_ANIMATION
87+
RADIENT_ASSET_TYPE_SKELETON_ANIMATION,
88+
89+
/// Immutable, unbound animation clip.
90+
RADIENT_ASSET_TYPE_ANIMATION_CLIP
8691
};
8792

8893
/// Authored scene/model source format.
@@ -677,6 +682,27 @@ DILIGENT_BEGIN_INTERFACE(IRadientAssetManager, IObject)
677682
/// is executing.
678683
VIRTUAL RADIENT_STATUS METHOD(Stop)(THIS_
679684
IDeviceContext* pContext) PURE;
685+
686+
/// Creates an immutable, unbound animation clip.
687+
///
688+
/// The manager validates structural and native-storage invariants and
689+
/// copies the name, descriptor tables, target names, keyframe times, and
690+
/// value bytes before returning. It does not resolve target schemas or
691+
/// validate property-specific value compatibility; those checks occur when
692+
/// the clip is bound to a runtime instance.
693+
///
694+
/// \param [in] ClipDesc - Clip description to validate and copy. Its data
695+
/// only needs to remain valid for this call.
696+
/// \param [out] ppClip - Address of a null pointer that receives a strong
697+
/// reference on success. It remains null on failure.
698+
///
699+
/// \return RADIENT_STATUS_OK on success, RADIENT_STATUS_INVALID_ARGUMENT
700+
/// for a malformed description or output pointer,
701+
/// RADIENT_STATUS_INVALID_OPERATION after Stop(), or
702+
/// RADIENT_STATUS_FAILED if storage creation fails.
703+
VIRTUAL RADIENT_STATUS METHOD(CreateAnimationClip)(THIS_
704+
const RadientAnimationClipDesc REF ClipDesc,
705+
IRadientAnimationClipAsset** ppClip) PURE;
680706
};
681707
DILIGENT_END_INTERFACE
682708

@@ -695,6 +721,7 @@ DILIGENT_END_INTERFACE
695721
# define IRadientAssetManager_LoadScene(This, ...) CALL_IFACE_METHOD(RadientAssetManager, LoadScene, This, __VA_ARGS__)
696722
# define IRadientAssetManager_WaitForAssetLoad(This, ...) CALL_IFACE_METHOD(RadientAssetManager, WaitForAssetLoad, This, __VA_ARGS__)
697723
# define IRadientAssetManager_Stop(This, ...) CALL_IFACE_METHOD(RadientAssetManager, Stop, This, __VA_ARGS__)
724+
# define IRadientAssetManager_CreateAnimationClip(This, ...) CALL_IFACE_METHOD(RadientAssetManager, CreateAnimationClip, This, __VA_ARGS__)
698725

699726
#endif
700727

‎Radient/interface/RadientSkinning.h‎

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -123,14 +123,18 @@ DILIGENT_TYPED_ENUM(RADIENT_ANIMATION_INTERPOLATION, Uint8)
123123
/// Holds the preceding keyframe value until the next keyframe.
124124
RADIENT_ANIMATION_INTERPOLATION_STEP = 0,
125125

126-
/// Linearly interpolates vectors and spherically interpolates rotations.
126+
/// Applies the target property's linear interpolation semantics. Numeric
127+
/// values are normally interpolated component-wise; a rotation property
128+
/// may instead use spherical interpolation of quaternion storage.
127129
RADIENT_ANIMATION_INTERPOLATION_LINEAR,
128130

129131
/// Evaluates a cubic Hermite spline using authored incoming and outgoing
130-
/// tangents.
132+
/// tangents. Tangents are derivatives per second; the target property's
133+
/// schema defines any additional semantic interpretation.
131134
RADIENT_ANIMATION_INTERPOLATION_CUBIC_SPLINE,
132135

133-
/// Number of animation interpolation modes.
136+
/// Sentinel equal to the number of animation interpolation modes. This is
137+
/// not a valid interpolation mode.
134138
RADIENT_ANIMATION_INTERPOLATION_COUNT
135139
};
136140

0 commit comments

Comments
 (0)