MCPcopy Create free account
hub / github.com/carbonengine/trinity / CreateMapping

Function CreateMapping

trinity/Tr2GrannyAnimation.cpp:47–63  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

45}
46
47std::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
66static const int MAX_JOINT_COUNT = 254;

Callers 3

RebuildCachedDataMethod · 0.85
CreateBindingMethod · 0.85
InitializeAnimationMethod · 0.85

Calls 2

beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected