82 class AnimationPack :
public Profiling::Trackable<AnimationPack>,
public std::enable_shared_from_this<AnimationPack>{
109 m_RuntimeID(s_NextRuntimeID.fetch_add(1, std::memory_order_relaxed))
117 return m_RuntimeID == other.m_RuntimeID;
122 return std::hash<uint32_t>{}(descriptor.m_RuntimeID);
131 const uint32_t m_RuntimeID{ 0 };
132 inline static std::atomic<uint32_t> s_NextRuntimeID{ 1 };
142 [[nodiscard]]
static std::shared_ptr<AnimationPack>
Create(
const std::filesystem::path& jsonPath,
ConfigType type,
const std::string& name);
155 [[nodiscard]]
static std::shared_ptr<AnimationPack>
Create(
const Descriptor& descriptor);
160 AnimationPack(std::vector<Internal::AnimationData> animations,
const std::shared_ptr<SpriteAtlas>& spriteAtlas, std::string name,
const ConfigType type);
161 AnimationPack(std::vector<Internal::AnimationData> animations,
const std::shared_ptr<Texture2D>& spriteAtlas, std::string name,
const ConfigType type);
165 bool m_Valid =
false;
AnimationPack Descriptor meant to be used with AssetManager only.
constexpr bool operator==(const Descriptor &other) const noexcept
uint32_t GetRuntimeID() const
const ConfigType m_ConfigType
const std::filesystem::path m_JsonPath
constexpr Descriptor(std::string name, std::filesystem::path jsonPath, const ConfigType type) noexcept
Constructs a descriptor.
std::variant< std::shared_ptr< SpriteAtlas >, std::shared_ptr< Texture2D > > m_TextureOrAtlas
Animation GetAnimation(const uint32_t index)
ConfigType
Available animation pack config types.
std::vector< Internal::AnimationData > m_Animations
static std::shared_ptr< AnimationPack > Create(const std::filesystem::path &jsonPath, ConfigType type, const std::string &name)
Creates an AnimationPack.
AnimationData(const glm::u16vec2 frameSize, std::vector< AnimationFrame > frames)
std::vector< AnimationFrame > m_Frames
For InstanceMetrics to work with a type it should derive from this.
Responsible for playing animations when attached to an entity.
Almost everything connected to graphics is in this namespace.
Components designed to be used with entities.
Components that are used with the WorldSystem (ECS).
Anything connected to WorldSystem (ECS) is in this namespace.
std::size_t operator()(const Descriptor &descriptor) const noexcept