class cogs::Armature — HIRO 0.7.0 documentation

# class cogs::Armature

    #include <Armature.h>

    class Armature: public cogs::Skeleton {
    public:
        // construction

        Armature();

        // methods

        void ConvertSkinDataFromNodeToBoneIds(std::unordered_map<int, cogs::Bone*> bone_for_nodeid);
        void SetMesh(const Mesh& mesh, const SkinningData& skindata);
        const Mesh* GetMesh() const;
        const SkinningData* GetSkinningData() const;
    };

## Inherited Members

    public:
        // structs

        struct BaseProperty;

        template <class T>
        struct Property;

        // fields

        cogs::Transform transform;

        // methods

        Skeleton& operator=(const Skeleton& skeleton);
        std::string GetName() const;
        void SetName(const std::string& new_name);
        std::vector<Bone*> GetAllBones() const;
        std::vector<std::string> GetAllBoneCaptions() const;
        std::vector<Bone*> GetBones(const std::vector<std::string>& bone_captions) const;
        Bone* GetBone(const uint32_t id) const;
        Bone* GetBone(const std::string& bone_caption) const;
        std::vector<Bone*> GetRootBones() const;
        void Clear();
        unsigned GetBoneCount() const;
        Bone* AddBone(const std::string& name, const std::string& parent_name, const glm::vec3& tail_position);
        Bone* AddBone(const std::string& name, const std::string& parent_name, const BoneTransform& transform);
        Bone* AddBoneToRoot(const std::string& name, const glm::vec3& tail_position);
        Bone* AddBoneToRoot(const std::string& name, const BoneTransform& transform);
        void RollBasis(const std::string& bone_name, const float roll_angle);
        void ApplyBoneLengths(const std::vector<float>& bone_lengths);
        void SortBySkeleton(const cogs::Skeleton& ref_skeleton);
        void InterpolateTo(const cogs::Skeleton& target_skel, float target_weight, cogs::Skeleton* out_skeleton) const;
        SkeletonPose GetCurrentPose() const;
        SkeletonPose GetCurrentPose(const std::vector<std::string>& bone_order) const;
        void ApplyPose(const SkeletonPose& pose, bool ignore_root_transform = false);
        void ApplyBindpose();
        void ApplyCurrentPoseAsBindpose();
        BaseProperty* GetProperty(const std::string& prop) const;

        template <class T>
        T GetProperty(const std::string& prop) const;

        template <class T>
        void SetProperty(const std::string& prop, const T& value);

        bool HasProperty(const std::string& prop) const;

    protected:
        // fields

        std::string name_;
        cogs::Transform bind_transform;
        std::unordered_map<std::string, BaseProperty*> properties_;
        std::map<std::string, Bone*> bone_for_name_;
        std::vector<Bone*> bones_;
        std::vector<Bone*> root_bones_;
        unsigned bone_count_ = 0;

        // methods

        Bone* CreateNewBone(const std::string& caption);
        Bone* CreateBoneClone(const cogs::Bone* bone);
        void MakeCloneOf(const Skeleton& skeleton);
        void OnTransformChange();