// Copyright (C) 2023 Jérôme "Lynix" Leclercq (lynix680@gmail.com) // 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_UTILITY_SKELETON_HPP #define NAZARA_UTILITY_SKELETON_HPP #include #include #include #include #include #include namespace Nz { class Joint; class Skeleton; using SkeletonLibrary = ObjectLibrary; struct SkeletonImpl; class NAZARA_UTILITY_API Skeleton { friend Joint; public: Skeleton(); Skeleton(const Skeleton& skeleton); Skeleton(Skeleton&&) noexcept; ~Skeleton(); bool Create(std::size_t jointCount); void Destroy(); const Boxf& GetAABB() const; Joint* GetJoint(const std::string& jointName); Joint* GetJoint(std::size_t index); const Joint* GetJoint(const std::string& jointName) const; const Joint* GetJoint(std::size_t index) const; Joint* GetJoints(); const Joint* GetJoints() const; std::size_t GetJointCount() const; std::size_t GetJointIndex(const std::string& jointName) const; Joint* GetRootJoint(); const Joint* GetRootJoint() const; void Interpolate(const Skeleton& skeletonA, const Skeleton& skeletonB, float interpolation); void Interpolate(const Skeleton& skeletonA, const Skeleton& skeletonB, float interpolation, const std::size_t* indices, std::size_t indiceCount); bool IsValid() const; Skeleton& operator=(const Skeleton& skeleton); Skeleton& operator=(Skeleton&&) noexcept; // Signals: NazaraSignal(OnSkeletonJointsInvalidated, const Skeleton* /*skeleton*/); static constexpr std::size_t InvalidJointIndex = std::numeric_limits::max(); private: void InvalidateJoints(); void InvalidateJointMap(); void UpdateJointMap() const; std::unique_ptr m_impl; }; } #include #endif // NAZARA_UTILITY_SKELETON_HPP