| 930 | } |
| 931 | |
| 932 | void EveTurretSet::InitializeAnimation() |
| 933 | { |
| 934 | if( IsUsingCMF( m_geometryResource ) ) |
| 935 | { |
| 936 | // get a model, a meshbinding and animation stuff from the resource |
| 937 | const cmf::Data* cmfData = m_geometryResource->GetCMFData(); |
| 938 | if( cmfData ) |
| 939 | { |
| 940 | if( cmfData->skeletons.size() ) |
| 941 | { |
| 942 | auto mesh = std::find_if( cmfData->meshes.begin(), cmfData->meshes.end(), []( const cmf::Mesh& m ) { |
| 943 | return m.skeleton == 0; |
| 944 | } ); |
| 945 | |
| 946 | if( mesh != cmfData->meshes.end() && mesh->boneBindings.size() ) |
| 947 | { |
| 948 | if( m_skeletonBoneIndices.empty() ) |
| 949 | { |
| 950 | // create one mesh binding for all turrets |
| 951 | // and remember model |
| 952 | m_skeleton = &cmfData->skeletons[0]; |
| 953 | |
| 954 | // create animations for all turrets |
| 955 | for( auto& turret : m_singleTurrets ) |
| 956 | { |
| 957 | if( !turret.sequencer ) |
| 958 | { |
| 959 | turret.sequencer = std::make_unique<cmf::AnimationSequencer>( *m_skeleton ); |
| 960 | cmf::RestPose( turret.pose, *m_skeleton ); |
| 961 | } |
| 962 | } |
| 963 | |
| 964 | if( m_singleTurrets.size() > 0 ) |
| 965 | { |
| 966 | InitializeDynamicBounds( cmfData, m_skeleton ); |
| 967 | } |
| 968 | |
| 969 | m_skeletonBoneIndices = Tr2GrannyAnimationUtils::CreateMapping( *m_skeleton, mesh->boneBindings, (uint32_t)mesh->boneBindings.size() ); |
| 970 | } |
| 971 | } |
| 972 | } |
| 973 | } |
| 974 | } |
| 975 | #if WITH_GRANNY |
| 976 | else |
| 977 | { |
| 978 | // get a model, a meshbinding and animation stuff from the resource |
| 979 | granny_file_info* grannyFileInfo = m_geometryResource->GetGrannyInfo(); |
| 980 | if( grannyFileInfo ) |
| 981 | { |
| 982 | if( grannyFileInfo->ModelCount ) |
| 983 | { |
| 984 | if( grannyFileInfo->Models[0]->MeshBindingCount ) |
| 985 | { |
| 986 | if( grannyFileInfo->SkeletonCount ) |
| 987 | { |
| 988 | if( m_grnMeshBinding == NULL ) |
| 989 | { |
nothing calls this directly
no test coverage detected