コード例 #1
0
ファイル: AnimSkeleton.cpp プロジェクト: AaronHillaker/hifi
AnimSkeleton::AnimSkeleton(const FBXGeometry& fbxGeometry) {
    // convert to std::vector of joints
    std::vector<FBXJoint> joints;
    joints.reserve(fbxGeometry.joints.size());
    for (auto& joint : fbxGeometry.joints) {
        joints.push_back(joint);
    }
    buildSkeletonFromJoints(joints);
}
コード例 #2
0
ファイル: AnimSkeleton.cpp プロジェクト: Nex-Pro/hifi
AnimSkeleton::AnimSkeleton(const HFMModel& hfmModel) {
    // convert to std::vector of joints
    std::vector<HFMJoint> joints;
    joints.reserve(hfmModel.joints.size());
    for (auto& joint : hfmModel.joints) {
        joints.push_back(joint);
    }
    buildSkeletonFromJoints(joints, hfmModel.jointRotationOffsets);

    // we make a copy of the inverseBindMatrices in order to prevent mutating the model bind pose
    // when we are dealing with a joint offset in the model
    for (int i = 0; i < (int)hfmModel.meshes.size(); i++) {
        const HFMMesh& mesh = hfmModel.meshes.at(i);
        std::vector<HFMCluster> dummyClustersList;

        for (int j = 0; j < mesh.clusters.size(); j++) {
            std::vector<glm::mat4> bindMatrices;
            // cast into a non-const reference, so we can mutate the FBXCluster
            HFMCluster& cluster = const_cast<HFMCluster&>(mesh.clusters.at(j));

            HFMCluster localCluster;
            localCluster.jointIndex = cluster.jointIndex;
            localCluster.inverseBindMatrix = cluster.inverseBindMatrix;
            localCluster.inverseBindTransform.evalFromRawMatrix(localCluster.inverseBindMatrix);

            // if we have a joint offset in the fst file then multiply its inverse by the
            // model cluster inverse bind matrix
            if (hfmModel.jointRotationOffsets.contains(cluster.jointIndex)) {
                AnimPose localOffset(hfmModel.jointRotationOffsets[cluster.jointIndex], glm::vec3());
                localCluster.inverseBindMatrix = (glm::mat4)localOffset.inverse() * cluster.inverseBindMatrix;
                localCluster.inverseBindTransform.evalFromRawMatrix(localCluster.inverseBindMatrix);
            }
            dummyClustersList.push_back(localCluster);
        }
        _clusterBindMatrixOriginalValues.push_back(dummyClustersList);
    }
}
コード例 #3
0
ファイル: AnimSkeleton.cpp プロジェクト: AaronHillaker/hifi
AnimSkeleton::AnimSkeleton(const std::vector<FBXJoint>& joints) {
    buildSkeletonFromJoints(joints);
}
コード例 #4
0
ファイル: AnimSkeleton.cpp プロジェクト: pewing/hifi
AnimSkeleton::AnimSkeleton(const std::vector<FBXJoint>& joints, const AnimPose& geometryOffset) {
    buildSkeletonFromJoints(joints, geometryOffset);
}
コード例 #5
0
ファイル: AnimSkeleton.cpp プロジェクト: Nex-Pro/hifi
AnimSkeleton::AnimSkeleton(const std::vector<HFMJoint>& joints, const QMap<int, glm::quat> jointOffsets) {
    buildSkeletonFromJoints(joints, jointOffsets);
}