| 567 | #endif |
| 568 | |
| 569 | void Tr2GrannyAnimationLayer::SampleMorphTracks( std::unordered_map<std::string, float>& morphAnimations, bool additive ) |
| 570 | { |
| 571 | for( const auto& morphTrack : m_morphTracks ) |
| 572 | { |
| 573 | cmf::AnimationPlayer* player = morphTrack.first; |
| 574 | float t = player->GetLocalTime( GetLayerAnimationTime() ); |
| 575 | |
| 576 | auto duration = player->GetLoopDuration(); |
| 577 | |
| 578 | if( t < 0 || t >= duration ) |
| 579 | { |
| 580 | continue; |
| 581 | } |
| 582 | |
| 583 | for( auto& track : morphTrack.second ) |
| 584 | { |
| 585 | float trackValue = track.SampleTrack( t, duration ) * m_layerWeight; |
| 586 | auto entry = morphAnimations.find( track.m_cmfTargetName ); |
| 587 | if( entry != morphAnimations.end() ) |
| 588 | { |
| 589 | entry->second = additive ? entry->second + trackValue : trackValue; |
| 590 | } |
| 591 | else |
| 592 | { |
| 593 | morphAnimations[track.m_cmfTargetName] = trackValue; |
| 594 | } |
| 595 | } |
| 596 | } |
| 597 | |
| 598 | #if WITH_GRANNY |
| 599 | for( auto it = m_controlMorphTracks.begin(); it != m_controlMorphTracks.end(); it++ ) |
| 600 | { |
| 601 | granny_control* control = it->first; |
| 602 | granny_real32 t = GrannyGetControlRawLocalClock( control ); |
| 603 | |
| 604 | auto duration = GrannyGetControlLocalDuration( control ); |
| 605 | |
| 606 | if( t < 0 || t >= duration ) |
| 607 | { |
| 608 | continue; |
| 609 | } |
| 610 | |
| 611 | for( auto trackIt = it->second.begin(); trackIt != it->second.end(); trackIt++ ) |
| 612 | { |
| 613 | float trackValue = trackIt->SampleTrack( t, duration ) * m_layerWeight; |
| 614 | auto entry = morphAnimations.find( trackIt->m_grannyTrack->Name ); |
| 615 | if( entry != morphAnimations.end() ) |
| 616 | { |
| 617 | entry->second = additive ? entry->second + trackValue : trackValue; |
| 618 | } |
| 619 | else |
| 620 | { |
| 621 | morphAnimations[trackIt->m_grannyTrack->Name] = trackValue; |
| 622 | } |
| 623 | } |
| 624 | } |
| 625 | #endif |
| 626 | } |
nothing calls this directly
no test coverage detected