| 45 | } |
| 46 | |
| 47 | std::vector<int32_t> CreateMapping( const cmf::Skeleton& skeleton, cmf::Span<cmf::BoneBinding> boneBindings, uint32_t meshBoneCount ) |
| 48 | { |
| 49 | std::vector<int32_t> mapping( meshBoneCount, -1 ); |
| 50 | for( uint32_t meshBoneIndex = 0; meshBoneIndex < meshBoneCount; ++meshBoneIndex ) |
| 51 | { |
| 52 | const auto boundBoneName = boneBindings[meshBoneIndex].name; |
| 53 | |
| 54 | auto foundBone = std::find_if( skeleton.bones.begin(), skeleton.bones.end(), [boundBoneName]( cmf::String boneName ) { |
| 55 | return boundBoneName == boneName; |
| 56 | } ); |
| 57 | if( foundBone != skeleton.bones.end() ) |
| 58 | { |
| 59 | mapping[meshBoneIndex] = (int32_t)std::distance( skeleton.bones.begin(), foundBone ); |
| 60 | } |
| 61 | } |
| 62 | return mapping; |
| 63 | } |
| 64 | }; |
| 65 | |
| 66 | static const int MAX_JOINT_COUNT = 254; |
no test coverage detected