// Copyright (C) 2015 Jérôme Leclercq // This file is part of the "Nazara Engine - Utility module" // For conditions of distribution and use, see copyright notice in Config.hpp #pragma once #ifndef NAZARA_ANIMATION_HPP #define NAZARA_ANIMATION_HPP #include #include #include #include #include #include #include #include #include #include #include #include #include struct NAZARA_UTILITY_API NzAnimationParams { // La frame de fin à charger unsigned int endFrame = std::numeric_limits::max(); // La frame de début à charger unsigned int startFrame = 0; bool IsValid() const; }; class NzAnimation; class NzSkeleton; using NzAnimationConstRef = NzObjectRef; using NzAnimationLibrary = NzObjectLibrary; using NzAnimationLoader = NzResourceLoader; using NzAnimationManager = NzResourceManager; using NzAnimationRef = NzObjectRef; struct NzAnimationImpl; class NAZARA_UTILITY_API NzAnimation : public NzRefCounted, public NzResource { friend NzAnimationLibrary; friend NzAnimationLoader; friend NzAnimationManager; friend class NzUtility; public: NzAnimation() = default; ~NzAnimation(); bool AddSequence(const NzSequence& sequence); void AnimateSkeleton(NzSkeleton* targetSkeleton, unsigned int frameA, unsigned int frameB, float interpolation) const; bool CreateSkeletal(unsigned int frameCount, unsigned int jointCount); void Destroy(); void EnableLoopPointInterpolation(bool loopPointInterpolation); unsigned int GetFrameCount() const; unsigned int GetJointCount() const; NzSequence* GetSequence(const NzString& sequenceName); NzSequence* GetSequence(unsigned int index); const NzSequence* GetSequence(const NzString& sequenceName) const; const NzSequence* GetSequence(unsigned int index) const; unsigned int GetSequenceCount() const; int GetSequenceIndex(const NzString& sequenceName) const; NzSequenceJoint* GetSequenceJoints(unsigned int frameIndex = 0); const NzSequenceJoint* GetSequenceJoints(unsigned int frameIndex = 0) const; nzAnimationType GetType() const; bool HasSequence(const NzString& sequenceName) const; bool HasSequence(unsigned int index = 0) const; bool IsLoopPointInterpolationEnabled() const; bool IsValid() const; bool LoadFromFile(const NzString& filePath, const NzAnimationParams& params = NzAnimationParams()); bool LoadFromMemory(const void* data, std::size_t size, const NzAnimationParams& params = NzAnimationParams()); bool LoadFromStream(NzInputStream& stream, const NzAnimationParams& params = NzAnimationParams()); void RemoveSequence(const NzString& sequenceName); void RemoveSequence(unsigned int index); template static NzAnimationRef New(Args&&... args); // Signals: NazaraSignal(OnAnimationDestroy, const NzAnimation* /*animation*/); NazaraSignal(OnAnimationRelease, const NzAnimation* /*animation*/); private: static bool Initialize(); static void Uninitialize(); NzAnimationImpl* m_impl = nullptr; static NzAnimationLibrary::LibraryMap s_library; static NzAnimationLoader::LoaderList s_loaders; static NzAnimationManager::ManagerMap s_managerMap; static NzAnimationManager::ManagerParams s_managerParameters; }; #include #endif // NAZARA_ANIMATION_HPP