AzerothCore 3.3.5a
OpenSource WoW Emulator
Loading...
Searching...
No Matches
TransportAnimation Struct Reference

#include "TransportMgr.h"

Public Member Functions

 TransportAnimation ()
 
bool GetAnimNode (uint32 time, TransportAnimationEntry const *&curr, TransportAnimationEntry const *&next, float &percPos) const
 
void GetAnimRotation (uint32 time, G3D::Quat &curr, G3D::Quat &next, float &percRot) const
 

Public Attributes

TransportPathContainer Path
 
TransportPathRotationContainer Rotations
 
uint32 TotalTime
 

Detailed Description

Constructor & Destructor Documentation

◆ TransportAnimation()

TransportAnimation::TransportAnimation ( )
inline
89: TotalTime(0) { }
uint32 TotalTime
Definition: TransportMgr.h:93

Member Function Documentation

◆ GetAnimNode()

bool TransportAnimation::GetAnimNode ( uint32  time,
TransportAnimationEntry const *&  curr,
TransportAnimationEntry const *&  next,
float &  percPos 
) const
494{
495 if (Path.empty())
496 return false;
497
498 for (TransportPathContainer::const_reverse_iterator itr = Path.rbegin(); itr != Path.rend(); ++itr)
499 if (time >= itr->first)
500 {
501 curr = itr->second;
502 ASSERT(itr != Path.rbegin());
503 --itr;
504 next = itr->second;
505 percPos = float(time - curr->TimeSeg) / float(next->TimeSeg - curr->TimeSeg);
506 return true;
507 }
508
509 return false;
510}
#define ASSERT
Definition: Errors.h:68
TransportPathContainer Path
Definition: TransportMgr.h:91

References ASSERT, Path, and TransportAnimationEntry::TimeSeg.

Referenced by StaticTransport::RelocateToProgress().

◆ GetAnimRotation()

void TransportAnimation::GetAnimRotation ( uint32  time,
G3D::Quat &  curr,
G3D::Quat &  next,
float &  percRot 
) const
513{
514 if (Rotations.empty())
515 {
516 curr = G3D::Quat(0.0f, 0.0f, 0.0f, 1.0f);
517 next = G3D::Quat(0.0f, 0.0f, 0.0f, 1.0f);
518 percRot = 0.0f;
519 return;
520 }
521
522 for (TransportPathRotationContainer::const_reverse_iterator itr = Rotations.rbegin(); itr != Rotations.rend(); ++itr)
523 if (time >= itr->first)
524 {
525 uint32 currSeg = itr->second->TimeSeg, nextSeg;
526 curr = G3D::Quat(itr->second->X, itr->second->Y, itr->second->Z, itr->second->W);
527 if (itr != Rotations.rbegin())
528 {
529 --itr;
530 next = G3D::Quat(itr->second->X, itr->second->Y, itr->second->Z, itr->second->W);
531 nextSeg = itr->second->TimeSeg;
532 }
533 else
534 {
535 next = G3D::Quat(Rotations.begin()->second->X, Rotations.begin()->second->Y, Rotations.begin()->second->Z, Rotations.begin()->second->W);
536 nextSeg = this->TotalTime;
537 }
538 percRot = float(time - currSeg) / float(nextSeg - currSeg);
539 return;
540 }
541
542 curr = G3D::Quat(0.0f, 0.0f, 0.0f, 1.0f);
543 next = G3D::Quat(0.0f, 0.0f, 0.0f, 1.0f);
544 percRot = 0.0f;
545}
std::uint32_t uint32
Definition: Define.h:108
TransportPathRotationContainer Rotations
Definition: TransportMgr.h:92

References Rotations, and TotalTime.

Referenced by StaticTransport::RelocateToProgress().

Member Data Documentation

◆ Path

TransportPathContainer TransportAnimation::Path

◆ Rotations

TransportPathRotationContainer TransportAnimation::Rotations

Referenced by GetAnimRotation().

◆ TotalTime