diff options
Diffstat (limited to 'Source/Asset/Asset/syncedanimation.h')
-rw-r--r-- | Source/Asset/Asset/syncedanimation.h | 103 |
1 files changed, 52 insertions, 51 deletions
diff --git a/Source/Asset/Asset/syncedanimation.h b/Source/Asset/Asset/syncedanimation.h index 83336061..b025430a 100644 --- a/Source/Asset/Asset/syncedanimation.h +++ b/Source/Asset/Asset/syncedanimation.h @@ -29,7 +29,7 @@ class AssetManager; -struct PrevNext { +struct PrevNext { int prev_index; int next_index; }; @@ -44,60 +44,61 @@ struct SyncedAnimation { std::string time_coord_label; }; -class SyncedAnimationGroup: public AnimationAsset { - std::vector<SyncedAnimation> animations; - std::string coord_label; - bool looping; - bool overshoot; - bool in_air; +class SyncedAnimationGroup : public AnimationAsset { + std::vector<SyncedAnimation> animations; + std::string coord_label; + bool looping; + bool overshoot; + bool in_air; - // Get the two animations closest to the blend_coord - PrevNext NearestAnimations(float blend_coord) const; + // Get the two animations closest to the blend_coord + PrevNext NearestAnimations(float blend_coord) const; - // Returns the weight of the next index. For example, returns - // 0 if blend_coord is exactly on the previous index, and - // returns 1 if it is exactly on the next index. - float GetInterpolationValue(const PrevNext &indices, - float blend_coord) const; - public: - SyncedAnimationGroup(AssetManager* owner, uint32_t asset_id); - void AddAnimation( AnimationAssetRef animation, float blend_coord , float ground_speed, float run_bounce, const std::string& time_coord_label ); - void GetMatrices(float normalized_time, - AnimOutput &anim_output, - const AnimInput &anim_input) const override; - void GetMatrices(float normalized_time, - AnimOutput &anim_output, - const AnimInput &anim_input, - float blend_coord) const; - void GetMatrices(int first, - int second, - float weight, - float normalized_time, - AnimOutput &anim_output, - const AnimInput &anim_input) const; - float GetFrequency(const BlendMap& blendmap) const override; - float GetGroundSpeed(const BlendMap& blendmap) const override; - float GetPeriod(const BlendMap& blendmap) const override; - std::vector<NormalizedAnimationEvent> GetEvents(int &anim_id, bool mirrored) const override; - int Load(const std::string &path, uint32_t load_flags); - const char* GetLoadErrorString(); - const char* GetLoadErrorStringExtended() { return ""; } - void Unload(); - void Reload(); - void ReportLoad() override; - void clear(); - int GetActiveID(const BlendMap& blendmap, int &anim_id) const override; - bool IsLooping() const override; - void CalcMirrored(bool cache, const std::string &skeleton_path); - unsigned NearestAnimation(float blend_coord) const; - float AbsoluteTimeFromNormalized( float normalized_time ) const override; - void ReturnPaths(PathSet& path_set) override; + // Returns the weight of the next index. For example, returns + // 0 if blend_coord is exactly on the previous index, and + // returns 1 if it is exactly on the next index. + float GetInterpolationValue(const PrevNext& indices, + float blend_coord) const; - static AssetType GetType() { return SYNCED_ANIMATION_GROUP_ASSET; } - static const char* GetTypeName() { return "SYNCED_ANIMATION_GROUP_ASSET"; } - static bool AssetWarning() { return true; } + public: + SyncedAnimationGroup(AssetManager* owner, uint32_t asset_id); + void AddAnimation(AnimationAssetRef animation, float blend_coord, float ground_speed, float run_bounce, const std::string& time_coord_label); + void GetMatrices(float normalized_time, + AnimOutput& anim_output, + const AnimInput& anim_input) const override; + void GetMatrices(float normalized_time, + AnimOutput& anim_output, + const AnimInput& anim_input, + float blend_coord) const; + void GetMatrices(int first, + int second, + float weight, + float normalized_time, + AnimOutput& anim_output, + const AnimInput& anim_input) const; + float GetFrequency(const BlendMap& blendmap) const override; + float GetGroundSpeed(const BlendMap& blendmap) const override; + float GetPeriod(const BlendMap& blendmap) const override; + std::vector<NormalizedAnimationEvent> GetEvents(int& anim_id, bool mirrored) const override; + int Load(const std::string& path, uint32_t load_flags); + const char* GetLoadErrorString(); + const char* GetLoadErrorStringExtended() { return ""; } + void Unload(); + void Reload(); + void ReportLoad() override; + void clear(); + int GetActiveID(const BlendMap& blendmap, int& anim_id) const override; + bool IsLooping() const override; + void CalcMirrored(bool cache, const std::string& skeleton_path); + unsigned NearestAnimation(float blend_coord) const; + float AbsoluteTimeFromNormalized(float normalized_time) const override; + void ReturnPaths(PathSet& path_set) override; - AssetLoaderBase* NewLoader() override; + static AssetType GetType() { return SYNCED_ANIMATION_GROUP_ASSET; } + static const char* GetTypeName() { return "SYNCED_ANIMATION_GROUP_ASSET"; } + static bool AssetWarning() { return true; } + + AssetLoaderBase* NewLoader() override; }; typedef AssetRef<SyncedAnimationGroup> SyncedAnimationGroupRef; |