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
Halo Class Reference

#include <halo.h>

Public Member Functions

 ~Halo ()
 
 Halo (const char *texture, const GFXColor &col=TranslucentWhite, const QVector &pos=ZeroQvector, float sizx=1, float sizy=1)
 
void Draw (const Transformation &quat=identity_transformation, const Matrix &m=identity_matrix, float alpha=-1)
 
void SetDimensions (float wid, float hei)
 
void SetPosition (const QVector &k)
 
QVectorPosition ()
 
void SetColor (const GFXColor &col)
 
void GetDimensions (float &wid, float &hei)
 

Static Public Member Functions

static void ProcessDrawQueue ()
 

Detailed Description

Definition at line 11 of file halo.h.

Constructor & Destructor Documentation

Halo::~Halo ( )

Definition at line 32 of file halo.cpp.

References DecalQueue::DelTexture(), and halodrawqueue.

33 {
34  halodrawqueue[decal]->DelQuad( quadnum );
35  if ( halodecal.DelTexture( decal ) ) {
36  delete halodrawqueue[decal]; //deletes the quad
37  halodrawqueue[decal] = NULL;
38  }
39 }
Halo::Halo ( const char *  texture,
const GFXColor col = TranslucentWhite,
const QVector pos = ZeroQvector,
float  sizx = 1,
float  sizy = 1 
)

Definition at line 14 of file halo.cpp.

References DecalQueue::AddTexture(), GFXTRUE, halodrawqueue, MIPMAP, and GFXColorVertex::SetColor().

15 {
16  string texname( texture );
17  position = pos;
18  sizex = sizx;
19  sizey = sizy;
20  decal = halodecal.AddTexture( texture, MIPMAP );
21  if ( ( (unsigned int) decal ) >= halodrawqueue.size() )
22  halodrawqueue.push_back( new GFXQuadList( GFXTRUE ) );
23  GFXColorVertex coltmp[4];
24  coltmp[0].SetColor( col );
25  coltmp[1].SetColor( col );
26  coltmp[2].SetColor( col );
27  coltmp[3].SetColor( col );
28 
29  quadnum = halodrawqueue[decal]->AddQuad( NULL, coltmp );
30 }

Member Function Documentation

void Halo::Draw ( const Transformation quat = identity_transformation,
const Matrix m = identity_matrix,
float  alpha = -1 
)

Definition at line 41 of file halo.cpp.

References CalculateOrientation(), VegaConfig::getVariable(), halodrawqueue, XMLSupport::parse_bool(), XMLSupport::parse_float(), q, QVector, Vector, and vs_config.

42 {
43  Vector p, q, r;
44  QVector pos;
45  static float HaloOffset = XMLSupport::parse_float( vs_config->getVariable( "graphics", "HaloOffset", ".1" ) );
46  pos = position.Transform( m );
47  float wid = sizex;
48  float hei = sizey;
49  static bool far_shine =
50  XMLSupport::parse_bool( vs_config->getVariable( "graphics", "draw_star_glow_halo",
51  "false" ) ) || XMLSupport::parse_bool(
52  vs_config->getVariable( "graphics", "HaloFarDraw", "false" ) );
53  CalculateOrientation( pos, p, q, r, wid, hei, HaloOffset, far_shine, NULL );
54  p = p*wid;
55  r = -r;
56  q = q*hei;
57  //offset = r*(sizex>sizey?sizex:sizey); //screws up cus of perspective
58  GFXVertex tmp[4] = {
59  GFXVertex( pos-(p+q).Cast(), r, 0, 1 ),
60  GFXVertex( pos+(p-q).Cast(), r, 1, 1 ),
61  GFXVertex( pos+(p+q).Cast(), r, 1, 0 ),
62  GFXVertex( pos-(p-q).Cast(), r, 0, 0 )
63  };
64  halodrawqueue[decal]->ModQuad( quadnum, tmp, alpha );
65 }
void Halo::GetDimensions ( float wid,
float hei 
)
inline

Definition at line 40 of file halo.h.

41  {
42  wid = sizex;
43  hei = sizey;
44  }
QVector& Halo::Position ( )
inline

Definition at line 35 of file halo.h.

36  {
37  return position;
38  }
void Halo::ProcessDrawQueue ( )
static

Definition at line 77 of file halo.cpp.

References CULLFACE, DEPTHWRITE, DecalQueue::GetTexture(), GFXBlendMode(), GFXDisable(), GFXEnable(), GFXLoadIdentity(), GFXPopBlendMode(), GFXPushBlendMode(), halodrawqueue, LIGHTING, Texture::MakeActive(), MODEL, ONE, TEXTURE0, and TEXTURE1.

Referenced by GameStarSystem::Draw().

78 {
82  GFXBlendMode( ONE, ONE );
86  for (unsigned int decal = 0; decal < halodrawqueue.size(); decal++)
87  if ( halodecal.GetTexture( decal ) ) {
88  halodecal.GetTexture( decal )->MakeActive();
89  halodrawqueue[decal]->Draw();
90  }
95 }
void Halo::SetColor ( const GFXColor col)

Definition at line 66 of file halo.cpp.

References halodrawqueue, and GFXColorVertex::SetColor().

67 {
68  GFXColorVertex coltmp[4];
69  coltmp[0].SetColor( col );
70  coltmp[1].SetColor( col );
71  coltmp[2].SetColor( col );
72  coltmp[3].SetColor( col );
73 
74  halodrawqueue[decal]->ModQuad( quadnum, coltmp );
75 }
void Halo::SetDimensions ( float  wid,
float  hei 
)
inline

Definition at line 26 of file halo.h.

27  {
28  sizex = wid;
29  sizey = hei;
30  }
void Halo::SetPosition ( const QVector k)
inline

Definition at line 31 of file halo.h.

32  {
33  position = k;
34  }

The documentation for this class was generated from the following files: