Vegastrike 0.5.1 rc1  1.0
Original sources for Vegastrike Evolved
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
WarpTrail Struct Reference

Public Member Functions

 WarpTrail (Unit *un, QVector beg, float tim)
 
bool Draw (warptrails *w)
 

Public Attributes

QVector start
 
UnitContainer cur
 
float tim
 

Detailed Description

Definition at line 19 of file warptrail.cpp.

Constructor & Destructor Documentation

WarpTrail::WarpTrail ( Unit un,
QVector  beg,
float  tim 
)
inline

Definition at line 24 of file warptrail.cpp.

References start, and tim.

24  : cur( un )
25  {
26  start = beg;
27  this->tim = tim;
28  }

Member Function Documentation

bool WarpTrail::Draw ( warptrails w)
inline

Definition at line 53 of file warptrail.cpp.

References _Universe, Universe::AccessCamera(), cur, Mesh::Draw(), Unit::faction, GetElapsedTime(), Camera::GetPosition(), UnitContainer::GetUnit(), VegaConfig::getVariable(), GetWarpMesh(), Magnitude(), Matrix::p, XMLSupport::parse_float(), Unit::Position(), q, QVector, Unit::rSize(), start, tim, Vector, and vs_config.

54  {
55  tim -= GetElapsedTime();
56  Unit *un = cur.GetUnit();
57  if (!un) return false;
58  Mesh *m = GetWarpMesh( un->faction, w );
59  if (!m)
60  return false;
61  QVector end( un->Position() );
62  float length = (end-start).Magnitude();
63  float d = ( end-_Universe->AccessCamera()->GetPosition().Cast() ).Magnitude();
64  Vector p, q, r;
65  r = (end-start).Cast();
66  r.Normalize();
67  static float stretch = XMLSupport::parse_float( vs_config->getVariable( "graphics", "warp_trail_stretch", "300" ) );
68  r *= un->rSize()*stretch;
69  q = Vector( 0, 1, 0 );
70  p = r.Cross( q );
71  q = p.Cross( r );
72  p.Normalize();
73  p *= un->rSize();
74  q.Normalize();
75  q *= un->rSize();
76  Matrix matrix( p, q, r, end );
77  m->Draw( length, matrix, d );
78  d = ( start-_Universe->AccessCamera()->GetPosition().Cast() ).Magnitude();
79  matrix.p = start+r;
80  m->Draw( length, matrix, d );
81  return tim > 0;
82  }

Member Data Documentation

UnitContainer WarpTrail::cur

Definition at line 22 of file warptrail.cpp.

Referenced by Draw().

QVector WarpTrail::start

Definition at line 21 of file warptrail.cpp.

Referenced by Draw(), and WarpTrail().

float WarpTrail::tim

Definition at line 23 of file warptrail.cpp.

Referenced by Draw(), and WarpTrail().


The documentation for this struct was generated from the following file: