Skip to content

Commit ae1a33f

Browse files
Radient: replace skeleton animations with generic bindings
1 parent 9efafb8 commit ae1a33f

25 files changed

Lines changed: 1092 additions & 2346 deletions

‎Radient/include/Animation/RadientSkeletonPoseImpl.hpp‎

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
#pragma once
2828

2929
#include "RadientAnimation.h"
30+
#include "RadientSkinning.h"
3031

3132
#include "ObjectBase.hpp"
3233
#include "RefCntAutoPtr.hpp"
@@ -97,12 +98,6 @@ class RadientSkeletonPoseImpl final : public ObjectBase<IRadientSkeletonPose>
9798

9899
virtual RADIENT_STATUS DILIGENT_CALL_TYPE CreateWriter(IRadientSkeletonPoseWriter** ppWriter) override final;
99100

100-
// Temporary allocation-free bridge for IRadientSkeletonAnimationAsset::Evaluate().
101-
// Remove it together with the legacy skeleton animation API.
102-
RADIENT_STATUS BeginLegacyAnimationUpdate(RadientTransform*& pLocalTransforms) noexcept;
103-
104-
RADIENT_STATUS EndLegacyAnimationUpdate(Bool UpdateGlobals) noexcept;
105-
106101
private:
107102
friend class RadientSkeletonPoseAnimationDestinationBindingImpl;
108103
friend class RadientSkeletonPoseAnimationDestinationImpl;

‎Radient/include/Assets/RadientAssetManagerImpl.hpp‎

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,8 @@ class RadientAssetManagerImpl final : public ObjectBase<IRadientAssetManager>
9494
virtual RADIENT_STATUS DILIGENT_CALL_TYPE CreateSkin(const RadientSkinDesc& SkinDesc,
9595
IRadientSkinAsset** ppSkin) override final;
9696

97-
virtual RADIENT_STATUS DILIGENT_CALL_TYPE CreateSkeletonAnimation(const RadientSkeletonAnimationDesc& AnimationDesc,
98-
IRadientSkeletonAnimationAsset** ppAnimation) override final;
97+
virtual RADIENT_STATUS DILIGENT_CALL_TYPE CreateAnimationClip(const RadientAnimationClipDesc& ClipDesc,
98+
IRadientAnimationClipAsset** ppClip) override final;
9999

100100
virtual RADIENT_STATUS DILIGENT_CALL_TYPE CreateStandardMaterialDefinition(const RadientStandardMaterialDefinitionCreateInfo& DefinitionCI,
101101
IRadientMaterialDefinitionAsset** ppDefinition) override final;
@@ -113,9 +113,6 @@ 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-
119116
// Must be called from the render thread.
120117
static RadientDrawableMeshResolveResult GetDrawableMesh(IRadientMeshAsset* pMesh,
121118
bool RequireGPUResourcesReady);

‎Radient/include/Import/RadientImportedScene.hpp‎

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -91,25 +91,13 @@ struct ImportedAnimationSkinMapping
9191

9292
struct ImportedAnimation
9393
{
94-
void AddSkeletonAnimation(RefCntAutoPtr<IRadientSkeletonAnimationAsset> pAnimation)
95-
{
96-
SkeletonAnimationAssets.emplace_back(std::move(pAnimation));
97-
SkeletonAnimationBindings.push_back({SkeletonAnimationAssets.back().RawPtr()});
98-
}
99-
100-
std::string Name;
101-
Float32 Duration = 0.f;
102-
10394
/// Generic clip containing the imported node-transform channels from the
10495
/// source animation. Target objects use source-document identities.
10596
RefCntAutoPtr<IRadientAnimationClipAsset> pClip;
10697

10798
/// Per-skin intersections between pClip targets and imported skeleton
10899
/// joints. Skins that are not affected by this clip are omitted.
109100
std::vector<ImportedAnimationSkinMapping> SkinMappings;
110-
111-
std::vector<RefCntAutoPtr<IRadientSkeletonAnimationAsset>> SkeletonAnimationAssets;
112-
std::vector<RadientSceneSkeletonAnimationBinding> SkeletonAnimationBindings;
113101
};
114102

115103
/// Radient-native data produced by an asset importer. Source-format documents

‎Radient/interface/RadientAnimation.h‎

Lines changed: 108 additions & 102 deletions
Large diffs are not rendered by default.

‎Radient/interface/RadientAssets.h‎

Lines changed: 32 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -44,15 +44,13 @@ typedef struct IRadientTextureAsset IRadientTextureAsset;
4444
typedef struct IRadientSceneAsset IRadientSceneAsset;
4545
typedef struct IRadientSkeletonAsset IRadientSkeletonAsset;
4646
typedef struct IRadientSkinAsset IRadientSkinAsset;
47-
typedef struct IRadientSkeletonAnimationAsset IRadientSkeletonAnimationAsset;
4847
typedef struct IRadientAnimationClipAsset IRadientAnimationClipAsset;
4948
typedef struct IRadientMorphTargetWeights IRadientMorphTargetWeights;
5049
typedef struct IDeviceContext IDeviceContext;
5150

5251
typedef struct RadientStandardMaterialDefinitionCreateInfo RadientStandardMaterialDefinitionCreateInfo;
5352
typedef struct RadientSkeletonDesc RadientSkeletonDesc;
5453
typedef struct RadientSkinDesc RadientSkinDesc;
55-
typedef struct RadientSkeletonAnimationDesc RadientSkeletonAnimationDesc;
5654
typedef struct RadientAnimationClipDesc RadientAnimationClipDesc;
5755
typedef struct RadientMorphTargetCreateInfo RadientMorphTargetCreateInfo;
5856
typedef struct RadientMorphTargetDesc RadientMorphTargetDesc;
@@ -83,9 +81,6 @@ DILIGENT_TYPED_ENUM(RADIENT_ASSET_TYPE, Uint8)
8381
/// Immutable mapping from a mesh skin palette to skeleton joints.
8482
RADIENT_ASSET_TYPE_SKIN,
8583

86-
/// Immutable animation clip targeting a skeleton hierarchy.
87-
RADIENT_ASSET_TYPE_SKELETON_ANIMATION,
88-
8984
/// Immutable, unbound animation clip.
9085
RADIENT_ASSET_TYPE_ANIMATION_CLIP
9186
};
@@ -420,51 +415,20 @@ struct RadientSceneLoadInfo
420415
typedef struct RadientSceneLoadInfo RadientSceneLoadInfo;
421416

422417

423-
/// Associates one skeleton-specific animation with a logical scene animation.
424-
/// The animation is retained by the scene asset and the pointer is borrowed by
425-
/// callers.
426-
struct RadientSceneSkeletonAnimationBinding
427-
{
428-
IRadientSkeletonAnimationAsset* pAnimation DEFAULT_INITIALIZER(nullptr);
429-
};
430-
typedef struct RadientSceneSkeletonAnimationBinding RadientSceneSkeletonAnimationBinding;
431-
432-
433-
/// Immutable logical animation imported with a scene asset.
434-
///
435-
/// One source animation may contain SkeletonAnimationCount independent
436-
/// skeleton animations. Every skeleton animation identifies its target through
437-
/// IRadientSkeletonAnimationAsset::GetDesc().pSkeleton. Name may be empty or
438-
/// shared by multiple animations; the animation index is its stable identity
439-
/// within the scene asset.
440-
struct RadientSceneAnimationDesc
441-
{
442-
/// Source animation name. The value returned by a scene asset is never null.
443-
const Char* Name DEFAULT_INITIALIZER(nullptr);
444-
445-
/// Clip-local duration in seconds.
446-
Float32 Duration DEFAULT_INITIALIZER(0.f);
447-
448-
/// Array of SkeletonAnimationCount skeleton-animation bindings. The array
449-
/// and its pointers remain valid while the scene asset is retained.
450-
const RadientSceneSkeletonAnimationBinding* pSkeletonAnimations DEFAULT_INITIALIZER(nullptr);
451-
452-
/// Number of elements in pSkeletonAnimations.
453-
Uint32 SkeletonAnimationCount DEFAULT_INITIALIZER(0);
454-
};
455-
typedef struct RadientSceneAnimationDesc RadientSceneAnimationDesc;
456-
457-
458418
/// Immutable description of an imported scene asset.
459419
struct RadientSceneAssetDesc
460420
{
461-
/// Array of AnimationCount logical animations. The array and all data
462-
/// referenced by its elements remain valid while the scene asset is
463-
/// retained. May be null when AnimationCount is zero.
464-
const RadientSceneAnimationDesc* pAnimations DEFAULT_INITIALIZER(nullptr);
465-
466-
/// Number of elements in pAnimations.
467-
Uint32 AnimationCount DEFAULT_INITIALIZER(0);
421+
/// Array of AnimationClipCount animation clips imported with the scene.
422+
/// The array and its pointers remain valid while the scene asset is
423+
/// retained. Clips preserve source-animation order, so the array index is
424+
/// the stable identity within the scene even when names are empty or
425+
/// duplicated. Individual clip name, duration, targets, and channels are
426+
/// available through IRadientAnimationClipAsset::GetDesc(). May be null
427+
/// when AnimationClipCount is zero.
428+
IRadientAnimationClipAsset* const* ppAnimationClips DEFAULT_INITIALIZER(nullptr);
429+
430+
/// Number of elements in ppAnimationClips.
431+
Uint32 AnimationClipCount DEFAULT_INITIALIZER(0);
468432
};
469433
typedef struct RadientSceneAssetDesc RadientSceneAssetDesc;
470434

@@ -625,12 +589,26 @@ DILIGENT_BEGIN_INTERFACE(IRadientAssetManager, IObject)
625589
const RadientSkinDesc REF SkinDesc,
626590
IRadientSkinAsset** ppSkin) PURE;
627591

628-
/// Creates an immutable animation clip targeting a skeleton. The animation
629-
/// retains the skeleton and copies all tracks, keyframe times, and values.
630-
/// On success, ppAnimation receives a strong reference.
631-
VIRTUAL RADIENT_STATUS METHOD(CreateSkeletonAnimation)(THIS_
632-
const RadientSkeletonAnimationDesc REF AnimationDesc,
633-
IRadientSkeletonAnimationAsset** ppAnimation) PURE;
592+
/// Creates an immutable, unbound animation clip.
593+
///
594+
/// The manager validates structural and native-storage invariants and
595+
/// copies the name, descriptor tables, target names, keyframe times, and
596+
/// value bytes before returning. It does not resolve target schemas or
597+
/// validate property-specific value compatibility; those checks occur when
598+
/// the clip is bound to a runtime instance.
599+
///
600+
/// \param [in] ClipDesc - Clip description to validate and copy. Its data
601+
/// only needs to remain valid for this call.
602+
/// \param [out] ppClip - Address of a null pointer that receives a strong
603+
/// reference on success. It remains null on failure.
604+
///
605+
/// \return RADIENT_STATUS_OK on success, RADIENT_STATUS_INVALID_ARGUMENT
606+
/// for a malformed description or output pointer,
607+
/// RADIENT_STATUS_INVALID_OPERATION after Stop(), or
608+
/// RADIENT_STATUS_FAILED if storage creation fails.
609+
VIRTUAL RADIENT_STATUS METHOD(CreateAnimationClip)(THIS_
610+
const RadientAnimationClipDesc REF ClipDesc,
611+
IRadientAnimationClipAsset** ppClip) PURE;
634612

635613
/// Creates or retrieves a cached built-in standard material definition asset.
636614
/// Compatible descriptions may return the same immutable asset. On success,
@@ -683,26 +661,6 @@ DILIGENT_BEGIN_INTERFACE(IRadientAssetManager, IObject)
683661
VIRTUAL RADIENT_STATUS METHOD(Stop)(THIS_
684662
IDeviceContext* pContext) PURE;
685663

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;
706664
};
707665
DILIGENT_END_INTERFACE
708666

@@ -714,14 +672,13 @@ DILIGENT_END_INTERFACE
714672
# define IRadientAssetManager_CreateMesh(This, ...) CALL_IFACE_METHOD(RadientAssetManager, CreateMesh, This, __VA_ARGS__)
715673
# define IRadientAssetManager_CreateSkeleton(This, ...) CALL_IFACE_METHOD(RadientAssetManager, CreateSkeleton, This, __VA_ARGS__)
716674
# define IRadientAssetManager_CreateSkin(This, ...) CALL_IFACE_METHOD(RadientAssetManager, CreateSkin, This, __VA_ARGS__)
717-
# define IRadientAssetManager_CreateSkeletonAnimation(This, ...) CALL_IFACE_METHOD(RadientAssetManager, CreateSkeletonAnimation, This, __VA_ARGS__)
675+
# define IRadientAssetManager_CreateAnimationClip(This, ...) CALL_IFACE_METHOD(RadientAssetManager, CreateAnimationClip, This, __VA_ARGS__)
718676
# define IRadientAssetManager_CreateStandardMaterialDefinition(This, ...) CALL_IFACE_METHOD(RadientAssetManager, CreateStandardMaterialDefinition, This, __VA_ARGS__)
719677
# define IRadientAssetManager_CreateMaterial(This, ...) CALL_IFACE_METHOD(RadientAssetManager, CreateMaterial, This, __VA_ARGS__)
720678
# define IRadientAssetManager_LoadTexture(This, ...) CALL_IFACE_METHOD(RadientAssetManager, LoadTexture, This, __VA_ARGS__)
721679
# define IRadientAssetManager_LoadScene(This, ...) CALL_IFACE_METHOD(RadientAssetManager, LoadScene, This, __VA_ARGS__)
722680
# define IRadientAssetManager_WaitForAssetLoad(This, ...) CALL_IFACE_METHOD(RadientAssetManager, WaitForAssetLoad, This, __VA_ARGS__)
723681
# 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__)
725682

726683
#endif
727684

‎Radient/interface/RadientSceneImporter.h‎

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,14 @@ struct RadientSceneInstantiateInfo
5959
Uint32 SceneIndex DEFAULT_INITIALIZER(InvalidRadientSceneIndex);
6060

6161
/// Optional external animation registry associated with the destination
62-
/// scene. When provided, the importer registers the instantiated entities
63-
/// targeted by each imported skeleton animation. GetScene() must return the
64-
/// destination scene; otherwise, instantiation fails with
62+
/// scene. When provided, the importer attempts to compile every clip/skin
63+
/// intersection against the corresponding instantiated skeleton pose and
64+
/// register the resulting bindings with their instance entities. Binding
65+
/// and registration failures are logged and skipped, leaving the scene
66+
/// usable without the affected animations. Unskinned and other currently
67+
/// unsupported targets remain available through the scene asset's clip
68+
/// catalog but are not registered. GetScene() must return the destination
69+
/// scene; otherwise, instantiation fails with
6570
/// RADIENT_STATUS_INVALID_ARGUMENT. The importer retains the registry while
6671
/// an asynchronous instantiation is pending. The caller is responsible for
6772
/// removing associations after later scene changes.

0 commit comments

Comments
 (0)