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
495{
496 if (Path.empty())
497 return false;
498
499 for (TransportPathContainer::const_reverse_iterator itr = Path.rbegin(); itr != Path.rend(); ++itr)
500 if (time >= itr->first)
501 {
502 curr = itr->second;
503 ASSERT(itr != Path.rbegin());
504 --itr;
505 next = itr->second;
506 percPos = float(time - curr->TimeSeg) / float(next->TimeSeg - curr->TimeSeg);
507 return true;
508 }
509
510 return false;
511}
#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
514{
515 if (Rotations.empty())
516 {
517 curr = G3D::Quat(0.0f, 0.0f, 0.0f, 1.0f);
518 next = G3D::Quat(0.0f, 0.0f, 0.0f, 1.0f);
519 percRot = 0.0f;
520 return;
521 }
522
523 for (TransportPathRotationContainer::const_reverse_iterator itr = Rotations.rbegin(); itr != Rotations.rend(); ++itr)
524 if (time >= itr->first)
525 {
526 uint32 currSeg = itr->second->TimeSeg, nextSeg;
527 curr = G3D::Quat(itr->second->X, itr->second->Y, itr->second->Z, itr->second->W);
528 if (itr != Rotations.rbegin())
529 {
530 --itr;
531 next = G3D::Quat(itr->second->X, itr->second->Y, itr->second->Z, itr->second->W);
532 nextSeg = itr->second->TimeSeg;
533 }
534 else
535 {
536 next = G3D::Quat(Rotations.begin()->second->X, Rotations.begin()->second->Y, Rotations.begin()->second->Z, Rotations.begin()->second->W);
537 nextSeg = this->TotalTime;
538 }
539 percRot = float(time - currSeg) / float(nextSeg - currSeg);
540 return;
541 }
542
543 curr = G3D::Quat(0.0f, 0.0f, 0.0f, 1.0f);
544 next = G3D::Quat(0.0f, 0.0f, 0.0f, 1.0f);
545 percRot = 0.0f;
546}
std::uint32_t uint32
Definition: Define.h:107
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