// // AnimSkeleton.h // // Created by Anthony J. Thibault on 9/2/15. // Copyright (c) 2015 High Fidelity, Inc. All rights reserved. // // Distributed under the Apache License, Version 2.0. // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // #ifndef hifi_AnimSkeleton #define hifi_AnimSkeleton #include #include #include #include #include "AnimPose.h" class AnimSkeleton { public: using Pointer = std::shared_ptr; using ConstPointer = std::shared_ptr; AnimSkeleton(const FBXGeometry& fbxGeometry); AnimSkeleton(const std::vector& joints); int nameToJointIndex(const QString& jointName) const; const QString& getJointName(int jointIndex) const; int getNumJoints() const; // absolute pose, not relative to parent const AnimPose& getAbsoluteBindPose(int jointIndex) const; // relative to parent pose const AnimPose& getRelativeBindPose(int jointIndex) const; const AnimPoseVec& getRelativeBindPoses() const { return _relativeBindPoses; } // the default poses are the orientations of the joints on frame 0. const AnimPose& getRelativeDefaultPose(int jointIndex) const; const AnimPoseVec& getRelativeDefaultPoses() const { return _relativeDefaultPoses; } const AnimPose& getAbsoluteDefaultPose(int jointIndex) const; const AnimPoseVec& getAbsoluteDefaultPoses() const { return _absoluteDefaultPoses; } // get pre transform which should include FBX pre potations const AnimPose& getPreRotationPose(int jointIndex) const; // get post transform which might include FBX offset transformations const AnimPose& getPostRotationPose(int jointIndex) const; int getParentIndex(int jointIndex) const; AnimPose getAbsolutePose(int jointIndex, const AnimPoseVec& poses) const; void convertRelativePosesToAbsolute(AnimPoseVec& poses) const; #ifndef NDEBUG void dump() const; void dump(const AnimPoseVec& poses) const; #endif protected: void buildSkeletonFromJoints(const std::vector& joints); std::vector _joints; AnimPoseVec _absoluteBindPoses; AnimPoseVec _relativeBindPoses; AnimPoseVec _relativeDefaultPoses; AnimPoseVec _absoluteDefaultPoses; AnimPoseVec _relativePreRotationPoses; AnimPoseVec _relativePostRotationPoses; // no copies AnimSkeleton(const AnimSkeleton&) = delete; AnimSkeleton& operator=(const AnimSkeleton&) = delete; }; #endif