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

Method SetupEffectChildren

trinity/Eve/SpaceObjectFactory/EveSOF.cpp:1920–2007  ·  view source on GitHub ↗

-------------------------------------------------------------------------------- Description: add effect children to the space object --------------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

1918// add effect children to the space object
1919// --------------------------------------------------------------------------------
1920void EveSOF::SetupEffectChildren( EveSpaceObject2Ptr newObj, IEveEffectChildrenOwnerPtr childOwner, const EveSOFDNAPtr dna, const std::vector<Matrix>& offsets, uint32_t buildFlags ) const
1921{
1922 CCP_STATS_ZONE( __FUNCTION__ );
1923 // Experimental features for PHASE-6
1924 // Note that this will ignore the child id and the animation id thing... don't know what will happen with the rorqual...
1925 const std::vector<EveSOFDataMgr::HullChildSetData>& hullChildSets = dna->GetHullChildSets();
1926
1927 for( auto childSet : hullChildSets )
1928 {
1929 if( !dna->IsInVisibilityData( childSet.visibilityGroup ) )
1930 {
1931 continue;
1932 }
1933
1934 for( auto childSetItem : childSet.items )
1935 {
1936 if( ( childSetItem.buildFilter & buildFlags ) == 0 )
1937 {
1938 continue;
1939 }
1940
1941 IRootPtr p = BeResMan->LoadObject( childSetItem.redFilePath.c_str() );
1942 if( !p )
1943 {
1944 CCP_LOGERR( "resource file %s is invalid!", childSetItem.redFilePath.c_str() );
1945 continue;
1946 }
1947
1948 // is it of right type?
1949 if( EveTransformPtr child = BlueCastPtr( p ) )
1950 {
1951 for( auto& offset : offsets )
1952 {
1953 EveTransformPtr transformedChild;
1954 if( &offset != &offsets.back() )
1955 {
1956 BeClasses->CopyTo( child->GetRawRoot(), (IRoot**)&transformedChild );
1957 }
1958 else
1959 {
1960 transformedChild = child;
1961 }
1962
1963 // set up the position data
1964 Vector3 tmp, pos;
1965 Quaternion rot;
1966 Matrix m = TransformationMatrix( Vector3( 1.0f, 1.0f, 1.0f ), childSetItem.rotation, childSetItem.translation ) * offset;
1967 Decompose( tmp, rot, pos, m );
1968 transformedChild->SetRotation( rot );
1969 transformedChild->SetScaling( childSetItem.scaling );
1970 transformedChild->SetTranslation( pos );
1971 newObj->AddToChildrenList( transformedChild );
1972 }
1973 }
1974 else if( IEveSpaceObjectChildPtr effectChild = BlueCastPtr( p ) )
1975 {
1976 for( auto& offset : offsets )
1977 {

Callers

nothing calls this directly

Calls 9

IsInVisibilityDataMethod · 0.80
AddToChildrenListMethod · 0.80
Vector3Class · 0.50
SetRotationMethod · 0.45
SetScalingMethod · 0.45
SetTranslationMethod · 0.45
SetupMethod · 0.45
SetOriginMethod · 0.45

Tested by

no test coverage detected