-------------------------------------------------------------------------------- Description: add the hull locator sets to the new ship --------------------------------------------------------------------------------
| 2981 | // add the hull locator sets to the new ship |
| 2982 | // -------------------------------------------------------------------------------- |
| 2983 | void EveSOF::SetupLocatorSets( EveSpaceObject2Ptr obj, const EveSOFDNAPtr dna, const std::vector<Matrix>& offsets ) |
| 2984 | { |
| 2985 | CCP_STATS_ZONE( __FUNCTION__ ); |
| 2986 | |
| 2987 | // cycle over all hulls in the multi-hull list |
| 2988 | Vector3 hullOffset( 0.f, 0.f, 0.f ); |
| 2989 | for( size_t hullIdx = 0; hullIdx < dna->GetMultiHullCount(); ++hullIdx ) |
| 2990 | { |
| 2991 | // locator sets (like damage, explosions, etc.) |
| 2992 | const std::vector<BlueSharedString> locatorSetsNames = dna->GetHullLocatorSetNames( hullIdx ); |
| 2993 | for( auto locatorSetName = locatorSetsNames.begin(); locatorSetName != locatorSetsNames.end(); ++locatorSetName ) |
| 2994 | { |
| 2995 | auto locators = dna->GetHullLocators( locatorSetName->c_str(), hullIdx ); |
| 2996 | if( locators ) |
| 2997 | { |
| 2998 | EveLocatorSetsPtr locSets; |
| 2999 | locSets.CreateInstance(); |
| 3000 | |
| 3001 | if( !offsets.empty() ) |
| 3002 | { |
| 3003 | // add the distributed locators |
| 3004 | // need to move the locators by the hullOffset |
| 3005 | std::vector<EveSOFDataMgr::LocatorDirectionData> distributedLocators; |
| 3006 | distributedLocators.reserve( offsets.size() * locators->size() ); |
| 3007 | for( auto& offset : offsets ) |
| 3008 | { |
| 3009 | std::transform( ( *locators ).begin(), ( *locators ).end(), std::back_inserter( distributedLocators ), [offset, hullOffset]( EveSOFDataMgr::LocatorDirectionData d ) -> EveSOFDataMgr::LocatorDirectionData { |
| 3010 | Matrix m = TransformationMatrix( Vector3( 1.0, 1.0, 1.0 ), d.rotation, d.position + hullOffset ) * offset; |
| 3011 | Vector3 tmp; |
| 3012 | Decompose( tmp, d.rotation, d.position, m ); |
| 3013 | return d; |
| 3014 | } ); |
| 3015 | } |
| 3016 | locSets->Set( locatorSetName->c_str(), distributedLocators.data(), distributedLocators.size() ); |
| 3017 | } |
| 3018 | obj->MergeToLocatorSet( *locSets ); |
| 3019 | } |
| 3020 | } |
| 3021 | // next hull needs offset update from hull's locator |
| 3022 | const Vector3* nextSubsystemOffset = dna->GetHullNextSubsystemOffset( hullIdx ); |
| 3023 | if( nextSubsystemOffset ) |
| 3024 | { |
| 3025 | hullOffset += *nextSubsystemOffset; |
| 3026 | } |
| 3027 | } |
| 3028 | } |
| 3029 | |
| 3030 | void EveSOF::SetupLayout( EveSpaceObject2Ptr obj, EveChildContainerPtr layoutContainer, EveChildInstancedMeshesPtr& sharedMeshes, const EveSOFDNAPtr dna, const std::vector<Matrix>& offsets, uint32_t seedOverwrite ) |
| 3031 | { |
nothing calls this directly
no test coverage detected