//transform a point from eye coordinate to world coordinate using viewing transformation matrix
QVector ViewingParams::calPosInWorldCoord(const QVector& p ){
	//P_w = M . P_e	
	double _x = QVector::dot4(transMatrix[0],p);	
	double _y = QVector::dot4(transMatrix[1],p);	
	double _z = QVector::dot4(transMatrix[2],p);
	return QVector(_x, _y, _z,1);
}
void CarSimUpdate( Unit *un, float height )
{
    un->SetVelocity( Vector( un->GetVelocity().i, 0, un->GetVelocity().k ) );
    un->curr_physical_state.position = QVector( un->curr_physical_state.position.i,
                                                height,
                                                un->curr_physical_state.position.k );
}
void LocationSelect::MoveLocation (Vector start,Vector Plane1, Vector Plane2, Vector Plane3) {    
  //BindKey (1,::MouseMoveHandle);
  //UnbindMouse (getMouseDrawFunc());
  LocalPosition = QVector(0,0,0);
  r = Plane3;
  p = Plane1;
  q = Plane2;
  local_transformation.position= start.Cast();
}
QVector CubicSplinePrediction::InterpolatePosition( Unit *un, double deltatime ) const
{
    //There should be another function called when received a new position update and creating the spline
    if (this->deltatime == 0 || deltatime > this->deltatime) {
        double delay = deltatime-this->deltatime;
        return A2+VB*delay;
    } else {
        return QVector( interpolation_spline.computePoint( deltatime/this->deltatime ) );
    }
}
Stars::Stars(int num, float spread): vlist(NULL),spread(spread) {
    static string starspritetextures = vs_config->getVariable("graphics","near_stars_sprite_texture","");
    static float starspritesize = XMLSupport::parse_float(vs_config->getVariable("graphics","near_stars_sprite_size","2"));
    if (starspritetextures.length()==0) {
        vlist = new PointStarVlist((num/STARnumvlist)+1,spread,"");
    } else {
        vlist = new SpriteStarVlist((num/STARnumvlist)+1,spread,"",starspritetextures,starspritesize);
    }
    fade = blend=true;
    ResetPosition(QVector(0,0,0));
}
void LocationSelect::MoveLocation (Vector start,Vector Plane1, Vector Plane2) {    
  //BindKey (1,LocationSelect::MouseMoveHandle);
  //UnbindMouse (getMouseDrawFunc()); //don't draw the mouse
  //BindKey (']',::incConstant);
  //BindKey ('[',::decConstant);
  LocalPosition = QVector(0,0,0);
  MakeRVector (Plane1,Plane2,r);
  p = Plane1;
  q = Plane2;


  local_transformation.position = start.Cast();
}
void GameUnit<UnitType>::Thrust(const Vector &amt1,bool afterburn){
  
  if (this->afterburntype == 0)
  afterburn=afterburn&&this->energy>this->afterburnenergy*SIMULATION_ATOM;
  if (this->afterburntype == 1)
	  afterburn=afterburn&&this->fuel>0;
  if (this->afterburntype == 2)
	  afterburn=afterburn&&this->warpenergy>0;

  Unit::Thrust( amt1, afterburn);


  static bool must_afterburn_to_buzz=XMLSupport::parse_bool(vs_config->getVariable("audio","buzzing_needs_afterburner","false"));
  if (_Universe->isPlayerStarship(this)!=NULL) {
    static int playerengine = AUDCreateSound (vs_config->getVariable ("unitaudio","player_afterburner","sfx10.wav"),true);
    static float enginegain=XMLSupport::parse_float(vs_config->getVariable("audio","afterburner_gain",".5"));
    if (afterburn!=AUDIsPlaying (playerengine)) {
      if (afterburn)
        AUDPlay (playerengine,QVector(0,0,0),Vector(0,0,0),enginegain);
      else
        AUDStopPlaying (playerengine);
    }
  }else if (afterburn||!must_afterburn_to_buzz) {
    static float buzzingtime=XMLSupport::parse_float(vs_config->getVariable("audio","buzzing_time","5"));
    static float buzzingdistance=XMLSupport::parse_float(vs_config->getVariable("audio","buzzing_distance","5"));
    static float lastbuzz=getNewTime();
    Unit * playa = _Universe->AccessCockpit()->GetParent();
    if (playa) {
      Vector diff=this->Position()-playa->Position();
      if (UnitUtil::getDistance(this,playa)<buzzingdistance&&playa->owner!=this&&this->owner!=playa&&this->owner!=playa->owner) {
        float ttime=getNewTime();
        if (ttime-lastbuzz>buzzingtime) {
          Vector pvel=playa->GetVelocity();
          Vector vel=this->GetVelocity();
          pvel.Normalize();
          vel.Normalize();
          float dotprod=vel.Dot(pvel);
          if (dotprod<.86) {
            
            lastbuzz=ttime;
            AUDPlay(this->sound->engine,this->Position(),this->GetVelocity(),1);
          } else {

          }         
        }
      }
    }
    
  }
}
QVector ComputeJumpPointArrival( QVector pos, std::string origin, std::string destination )
{
    QVector finish = SystemLocation( destination );
    QVector start  = SystemLocation( origin );
    QVector dir    = finish-start;
    if ( dir.MagnitudeSquared() ) {
        dir.Normalize();
        dir = -dir;
        pos = -pos;
        pos.Normalize();
        if ( pos.MagnitudeSquared() ) pos.Normalize();
        return (dir*.5+pos*.125)*howFarToJump();
    }
    return QVector( 0, 0, 0 );
}
void UnitFactory::addPlanetBuffer( NetBuffer &netbuf,
                                   QVector x,
                                   QVector y,
                                   float vely,
                                   const Vector &rotvel,
                                   float pos,
                                   float gravity,
                                   float radius,
                                   const char *filename,
                                   BLENDFUNC sr,
                                   BLENDFUNC ds,
                                   const vector< string > &dest,
                                   const QVector &orbitcent,
                                   Unit *parent,
                                   const GFXMaterial &ourmat,
                                   const std::vector< GFXLightLocal > &ligh,
                                   int faction,
                                   string fullname,
                                   bool inside_out,
                                   ObjSerial netcreate )
{
    netbuf.addChar( ZoneMgr::AddPlanet );
    netbuf.addSerial( netcreate );
    netbuf.addQVector( x );
    netbuf.addQVector( y );
    netbuf.addFloat( vely );
    netbuf.addVector( Vector( rotvel ) );
    netbuf.addFloat( pos );
    netbuf.addFloat( gravity );
    netbuf.addFloat( radius );

    netbuf.addString( string( filename ) );
    netbuf.addChar( sr );
    netbuf.addChar( ds );

    netbuf.addShort( dest.size() );
    for (unsigned int i = 0; i < dest.size(); i++)
        netbuf.addString( dest[i] );
    netbuf.addQVector( QVector( orbitcent ) );
    netbuf.addSerial( parent->GetSerial() );
    netbuf.addGFXMaterial( ourmat );
    netbuf.addShort( ligh.size() );
    for (unsigned int j = 0; j < ligh.size(); j++)
        netbuf.addGFXLightLocal( ligh[j] );
    netbuf.addInt32( faction );
    netbuf.addString( fullname );
    netbuf.addChar( inside_out );
}
Unit* Mission::call_unit_launch( CreateFlightgroup *fg, int type, const string &destinations )
{
    int    faction_nr = FactionUtil::GetFactionIndex( fg->fg->faction );
    Unit **units = new Unit*[fg->nr_ships];
    int    u;
    Unit  *par   = _Universe->AccessCockpit()->GetParent();
    CollideMap::iterator  metahint[2] = {
        _Universe->scriptStarSystem()->collidemap[Unit::UNIT_ONLY]->begin(),
        _Universe->scriptStarSystem()->collidemap[Unit::UNIT_BOLT]->begin()
    };
    CollideMap::iterator *hint = metahint;
    if ( par && !is_null( par->location[Unit::UNIT_ONLY] ) && !is_null( par->location[Unit::UNIT_BOLT] )
        && par->activeStarSystem == _Universe->scriptStarSystem() )
        hint = par->location;
    for (u = 0; u < fg->nr_ships; u++) {
        Unit *my_unit;
        if (type == PLANETPTR) {
            float radius     = 1;
            char *tex        = strdup( fg->fg->type.c_str() );
            char *nam        = strdup( fg->fg->type.c_str() );
            char *bsrc       = strdup( fg->fg->type.c_str() );
            char *bdst       = strdup( fg->fg->type.c_str() );
            char *citylights = strdup( fg->fg->type.c_str() );
            tex[0]  = '\0';
            bsrc[0] = '\0';             //have at least 1 char
            bdst[0] = '\0';
            citylights[0] = '\0';
            GFXMaterial mat;
            GFXGetMaterial( 0, mat );
            BLENDFUNC   s = ONE;
            BLENDFUNC   d = ZERO;
            if (bdst[0] != '\0')
                d = parse_alpha( bdst );
            if (bsrc[0] != '\0')
                s = parse_alpha( bsrc );
            my_unit = UnitFactory::createPlanet( QVector( 0, 0, 0 ), QVector( 0, 0, 0 ), 0, Vector( 0, 0, 0 ), 
                                                 0, 0, radius, tex, "", "", s,
                                                 d, ParseDestinations( destinations ),
                                                 QVector( 0, 0, 0 ), NULL, mat,
                                                 vector< GFXLightLocal > (), faction_nr, nam, getUniqueSerial() );
            free( bsrc );
            free( bdst );
            free( tex );
            free( nam );
            free( citylights );
        } else if (type == NEBULAPTR) {
            my_unit = UnitFactory::createNebula(
                fg->fg->type.c_str(), false, faction_nr, fg->fg, u+fg->fg->nr_ships-fg->nr_ships, getUniqueSerial() );
        } else if (type == ASTEROIDPTR) {
            my_unit = UnitFactory::createAsteroid(
                fg->fg->type.c_str(), faction_nr, fg->fg, u+fg->fg->nr_ships-fg->nr_ships, .01, getUniqueSerial() );
        } else {
            my_unit = UnitFactory::createUnit( fg->fg->type.c_str(), false, faction_nr, string(
                                                  "" ), fg->fg, u+fg->fg->nr_ships-fg->nr_ships, NULL, getUniqueSerial() );
        }
        units[u] = my_unit;
    }
    float fg_radius = units[0]->rSize();
    Unit *my_unit;
    for (u = 0; u < fg->nr_ships; u++) {
        my_unit = units[u];
        QVector pox;
        pox.i = fg->fg->pos.i+u*fg_radius*3;
        pox.j = fg->fg->pos.j+u*fg_radius*3;
        pox.k = fg->fg->pos.k+u*fg_radius*3;
        my_unit->SetPosAndCumPos( pox );
        if (type == ASTEROIDPTR || type == NEBULAPTR) {
            my_unit->PrimeOrders();
        } else {
            my_unit->LoadAIScript( fg->fg->ainame );
            my_unit->SetTurretAI();
        }
        _Universe->scriptStarSystem()->AddUnit( my_unit );
        my_unit->UpdateCollideQueue( _Universe->scriptStarSystem(), hint );
        if ( !is_null( my_unit->location[Unit::UNIT_ONLY] ) && !is_null( my_unit->location[Unit::UNIT_BOLT] ) )
            hint = my_unit->location;
        my_unit->Target( NULL );
    }
    my_unit = units[0];
    if ( !_Universe->isPlayerStarship( fg->fg->leader.GetUnit() ) )
        fg->fg->leader.SetUnit( my_unit );
    delete[] units;
    return my_unit;
}
Exemple #11
0
QPlane::QPlane(){
	point = QVector();
	normal = QVector();
}
QVector AUDListenerLocation() {
  return QVector(0,0,0);
}
bool StarSystem::JumpTo( Unit *un, Unit *jumppoint, const std::string &system, bool force, bool save_coordinates )
{
    if ( ( un->DockedOrDocking()&(~Unit::DOCKING_UNITS) ) != 0 )
        return false;
    if (Network == NULL || force) {
        if (un->jump.drive >= 0)
            un->jump.drive = -1;
#ifdef JUMP_DEBUG
        VSFileSystem::vs_fprintf( stderr, "jumping to %s.  ", system.c_str() );
#endif
        StarSystem *ss = star_system_table.Get( system );
        std::string ssys( system+".system" );
        if (!ss)
            ss = star_system_table.Get( ssys );
        bool justloaded = false;
        if (!ss) {
            justloaded = true;
            ss = _Universe->GenerateStarSystem( ssys.c_str(), filename.c_str(), Vector( 0, 0, 0 ) );
            //NETFIXME: Do we want to generate the system if an AI unit jumps?
        }
        if ( ss && !isJumping( pendingjump, un ) ) {
#ifdef JUMP_DEBUG
            VSFileSystem::vs_fprintf( stderr, "Pushing back to pending queue!\n" );
#endif
            bool dosightandsound = ( ( this == _Universe->getActiveStarSystem( 0 ) ) || _Universe->isPlayerStarship( un ) );
            int  ani = -1;
            if (dosightandsound)
                ani = _Universe->activeStarSystem()->DoJumpingLeaveSightAndSound( un );
	    _Universe->AccessCockpit()->OnJumpBegin(un);
            pendingjump.push_back( new unorigdest( un, jumppoint, this, ss, un->GetJumpStatus().delay, ani, justloaded,
                                                  save_coordinates ? ComputeJumpPointArrival( un->Position(), this->getFileName(),
                                                                                              system ) : QVector( 0, 0, 0 ) ) );
        } else {
#ifdef JUMP_DEBUG
            VSFileSystem::vs_fprintf( stderr, "Failed to retrieve!\n" );
#endif
            return false;
        }
        if (jumppoint)
            ActivateAnimation( jumppoint );
    } else
    //Networking mode
    if (jumppoint) {
        Network->jumpRequest( system, jumppoint->GetSerial() );
    }
    return true;
}
void LocationSelect::SetPosition (float x,float y, float z) {
  local_transformation.position = QVector (x,y,z);
}
void LocationSelect:: Draw () {

  Matrix transformation;
  local_transformation.to_matrix(transformation);
  
  GFXLoadIdentity(MODEL);
  GFXMultMatrixModel (transformation);
  /*
    GFXEnable(DEPTHWRITE);
    GFXEnable(DEPTHTEST);
    GFXDisable(TEXTURE0);
    GFXDisable(TEXTURE1);
    GFXDisable(LIGHTING);
    GFXPushBlendMode();
    //  GFXBlendMode(SRCALPHA,INVSRCALPHA);
    //GFXColor4f (parentScene->HUDColor.r, parentScene->HUDColor.g, parentScene->HUDColor.b, parentScene->HUDColor.a);

    GFXColor4f (0,.5,0,.3);
*/
#ifdef DELTA_MOVEMENT
  if (vert) {
    LocalPosition.k=0;
    
  }
  vert=false;

  if (DeltaPosition.k) {
    LocalPosition.k-=DeltaPosition.k*.3;
    DeltaPosition.k=0;
  }
#endif

  if (changed||vert) {
    Matrix t,m;
    Matrix v;

    GFXGetMatrixView (v);

    GFXGetMatrixModel (m);
    MultMatrix(t,v,m);

    //following translates 'z'...not sure it's necessary
    //    Translate (v,0,0,LocalPosition.k);
    //    MultMatrix (m,t,v);

    //the location in camera coordinates of the beginning of the location select
    Vector tLocation (t.p.Cast());
    Vector tP (t.getP());//the p vector of the plane being selected on
    Vector tQ (t.getQ());//the q vector of the plane being selected on
    ///unused    Vector tR (t[8],t[9],t[10]);//the q vector of the plane being selected on
    //VSFileSystem::Fprintf (stderr,"<%f,%f,%f>",t[0],t[1],t[2]);
    //VSFileSystem::Fprintf (stderr,"<%f,%f,%f>",t[4],t[5],t[6]);
    //VSFileSystem::Fprintf (stderr,"<%f,%f,%f>",t[8],t[9],t[10]);
#ifdef DELTA_MOVEMENT
    float zvalueXY = tLocation.k+LocalPosition.i*tP.k+LocalPosition.j*tQ.k; // z val of the parallelogram
#else
    float zvalueXY = tLocation.k+LocalPosition.i*tP.k+LocalPosition.j*tQ.k+LocalPosition.k*tR.k; //zvalue of the cursor
#endif

    if (changed&&!vert) {    //planar movement
    
    if (zvalueXY >1000)  /// zfar
      zvalueXY = 1000;
    if (zvalueXY<-1000)
      zvalueXY = -1000;

      LocalPosition.i= fabs(zvalueXY)*(((2*DeltaPosition.i/g_game.x_resolution - 1)*g_game.MouseSensitivityX*GFXGetXInvPerspective()*tP.i)-(1-(2*DeltaPosition.j/g_game.y_resolution)*g_game.MouseSensitivityY*GFXGetYInvPerspective()*tP.j));
      LocalPosition.j= fabs(zvalueXY)*(((2*DeltaPosition.i/g_game.x_resolution - 1)*g_game.MouseSensitivityX*GFXGetXInvPerspective()*tQ.i)-(1-(2*DeltaPosition.j/g_game.y_resolution)*tQ.j*g_game.MouseSensitivityY*GFXGetYInvPerspective()));
      DeltaPosition= Vector(0,0,0);
      //    Vector TransPQR (t[0]*i+t[4]*LocalPosition.j+t[8]*LocalPosition.k+t[12],t[1]*LocalPosition.i+t[5]*LocalPosition.j+t[9]*LocalPosition.k+t[13],t[2]*LocalPosition.i+t[6]*LocalPosition.j+t[10]*LocalPosition.k+t[14]);
      changed=false;
    }
#ifndef DELTA_MOVEMENT 
    else { //vertical movement

    if (zvalueXY >1000)  /// zfar
      zvalueXY = 1000;
    if (zvalueXY<-1000)
      zvalueXY = -1000;

      LocalPosition.k= fabs(zvalueXY)*(((2*DeltaPosition.i/g_game.x_resolution - 1)*g_game.MouseSensitivityX*GFXGetXInvPerspective()*tR.i)-((2*DeltaPosition.j/g_game.y_resolution -1)*g_game.MouseSensitivityY*GFXGetYInvPerspective()*tR.j));
      if (DeltaPosition.k) {
	LocalPosition.k=0;
	DeltaPosition.k=0;
      }
      vert =false;
      changed=false;
    }
#endif
  }

  //draw the animation
  LocSelUpAni.SetPosition (QVector (LocalPosition.i,LocalPosition.j,0));
  LocSelUpAni.Draw();
  LocSelAni.SetPosition(LocalPosition);
  LocSelAni.Draw();
  

  /*
  GFXBegin(TRIANGLES);
  if (fabs(LocalPosition.k-CrosshairSize)>CrosshairSize) {
    int tmp;
    if (LocalPosition.k>=0)
      tmp =1;
    else
      tmp =-1;
    GFXVertex3f (LocalPosition.i,LocalPosition.j,LocalPosition.k-tmp*CrosshairSize);
    GFXVertex3f (LocalPosition.i,LocalPosition.j+CrosshairSize*.125,0);
    GFXVertex3f (LocalPosition.i,LocalPosition.j-CrosshairSize*.125,0);

    GFXVertex3f (LocalPosition.i,LocalPosition.j-CrosshairSize*.125,0);
    GFXVertex3f (LocalPosition.i,LocalPosition.j+CrosshairSize*.125,0);
    GFXVertex3f (LocalPosition.i,LocalPosition.j,LocalPosition.k-tmp*CrosshairSize);

    GFXVertex3f (LocalPosition.i,LocalPosition.j,LocalPosition.k-tmp*CrosshairSize);
    GFXVertex3f (LocalPosition.i+.125*CrosshairSize,LocalPosition.j,0);
    GFXVertex3f (LocalPosition.i-CrosshairSize*.125,LocalPosition.j,0);

    GFXVertex3f (LocalPosition.i-CrosshairSize*.125,LocalPosition.j,0);
    GFXVertex3f (LocalPosition.i+CrosshairSize*.125,LocalPosition.j,0);
    GFXVertex3f (LocalPosition.i,LocalPosition.j,LocalPosition.k-tmp*CrosshairSize);
  }
  if (fabs(LocalPosition.i)+fabs(LocalPosition.j)>CrosshairSize) {
    GFXVertex3f (0,0,0);
    GFXVertex3f (LocalPosition.i,LocalPosition.j,CrosshairSize*.125);
    GFXVertex3f (LocalPosition.i,LocalPosition.j,CrosshairSize*-.125);
    
    GFXVertex3f (LocalPosition.i,LocalPosition.j,CrosshairSize*-.125);
    GFXVertex3f (LocalPosition.i,LocalPosition.j,CrosshairSize*.125);
    GFXVertex3f (0,0,0);
  }	
  POSITION_GFXVertex (0,0,0);
  POSITION_GFXVertex (1,.1,.1);	
  POSITION_GFXVertex (1,.1,-.1);
  POSITION_GFXVertex (0,0,0);
  POSITION_GFXVertex (1,-.1,-.1);	
  POSITION_GFXVertex (1,-.1,.1);
  POSITION_GFXVertex (0,0,0);
  POSITION_GFXVertex (1,-.1,.1);
  POSITION_GFXVertex (1,.1,.1);
  POSITION_GFXVertex (0,0,0);
  POSITION_GFXVertex (1,.1,-.1);
  POSITION_GFXVertex (1,-.1,-.1);//one of the arrows to point
  POSITION_GFXVertex (0,0,0);
  POSITION_GFXVertex (-1,.1,-.1);	
  POSITION_GFXVertex (-1,.1,.1);
  POSITION_GFXVertex (0,0,0);
  POSITION_GFXVertex (-1,-.1,.1);	
  POSITION_GFXVertex (-1,-.1,-.1);
  POSITION_GFXVertex (0,0,0);
  POSITION_GFXVertex (-1,.1,.1);
  POSITION_GFXVertex (-1,-.1,.1);
  POSITION_GFXVertex (0,0,0);
  POSITION_GFXVertex (-1,-.1,-.1);
  POSITION_GFXVertex (-1,.1,-.1);//one of the arrows to point

  //vertical
  POSITION_GFXVertex (0,0,0);
  POSITION_GFXVertex (.1,.1,1);	
  POSITION_GFXVertex (.1,-.1,1);
  POSITION_GFXVertex (0,0,0);
  POSITION_GFXVertex (-.1,-.1,1);	
  POSITION_GFXVertex (-.1,.1,1);
  POSITION_GFXVertex (0,0,0);
  POSITION_GFXVertex (-.1,.1,1);
  POSITION_GFXVertex (.1,.1,1);
  POSITION_GFXVertex (0,0,0);
  POSITION_GFXVertex (.1,-.1,1);
  POSITION_GFXVertex(-.1,-.1,1);//one of the arrows to point
  POSITION_GFXVertex (0,0,0);
  POSITION_GFXVertex (.1,-.1,-1);	
  POSITION_GFXVertex (.1,.1,-1);
  POSITION_GFXVertex (0,0,0);
  POSITION_GFXVertex (-.1,.1,-1);	
  POSITION_GFXVertex (-.1,-.1,-1);
  POSITION_GFXVertex (0,0,0);
  POSITION_GFXVertex (.1,.1,-1);
  POSITION_GFXVertex (-.1,.1,-1);
  POSITION_GFXVertex (0,0,0);
  POSITION_GFXVertex (-.1,-.1,-1);
  POSITION_GFXVertex (.1,-.1,-1);//one of the arrows to point


  POSITION_GFXVertex (0,0,0);
  POSITION_GFXVertex (.1,-1,.1);	
  POSITION_GFXVertex (.1,-1,-.1);
  POSITION_GFXVertex (0,0,0);
  POSITION_GFXVertex (-.1,-1,-.1);	
  POSITION_GFXVertex (-.1,-1,.1);
  POSITION_GFXVertex (0,0,0);
  POSITION_GFXVertex (-.1,-1,.1);
  POSITION_GFXVertex (.1,-1,.1);
  POSITION_GFXVertex (0,0,0);
  POSITION_GFXVertex (.1,-1,-.1);
  POSITION_GFXVertex (-.1,-1,-.1);//one of the arrows to point
  POSITION_GFXVertex (0,0,0);
  POSITION_GFXVertex (.1,1,-.1);	
  POSITION_GFXVertex (.1,1,.1);
  POSITION_GFXVertex (0,0,0);
  POSITION_GFXVertex (-.1,1,.1);	
  POSITION_GFXVertex (-.1,1,-.1);
  POSITION_GFXVertex (0,0,0);
  POSITION_GFXVertex (.1,1,.1);
  POSITION_GFXVertex (-.1,1,.1);
  POSITION_GFXVertex (0,0,0);
  POSITION_GFXVertex (-.1,1,-.1);
  POSITION_GFXVertex (.1,1,-.1);//one of the arrows to point


 GFXEnd();
  GFXBegin (QUADS);
  //GFXColor4f (parentScene->HUDColor.r, parentScene->HUDColor.g, parentScene->HUDColor.b, 1.5*parentScene->HUDColor.a);

  GFXVertex3f(.5*CrosshairSize +LocalPosition.i,LocalPosition.j,0);
  GFXVertex3f(LocalPosition.i,.5*CrosshairSize+LocalPosition.j,0);
  GFXVertex3f(-.5*CrosshairSize +LocalPosition.i,LocalPosition.j,0);
  GFXVertex3f(LocalPosition.i,-.5*CrosshairSize+LocalPosition.j,0);

  GFXVertex3f(LocalPosition.i,-.5*CrosshairSize+LocalPosition.j,0);
  GFXVertex3f(-.5*CrosshairSize +LocalPosition.i,LocalPosition.j,0);
  GFXVertex3f(LocalPosition.i,.5*CrosshairSize+LocalPosition.j,0);
  GFXVertex3f(.5*CrosshairSize +LocalPosition.i,LocalPosition.j,0);

  GFXColor4f (0,.5,0,.5);
  POSITION_GFXVertex (1,.1,.1); //cap
  POSITION_GFXVertex (1,-.1,.1);
  POSITION_GFXVertex (1,-.1,-.1);
  POSITION_GFXVertex (1,.1,-.1);

  POSITION_GFXVertex (-1,.1,-.1);
  POSITION_GFXVertex (-1,-.1,-.1);
  POSITION_GFXVertex (-1,-.1,.1);
  POSITION_GFXVertex (-1,.1,.1); //cap


  POSITION_GFXVertex (.1,-1,.1); //cap
  POSITION_GFXVertex (-.1,-1,.1);
  POSITION_GFXVertex (-.1,-1,-.1);
  POSITION_GFXVertex (.1,-1,-.1);

  POSITION_GFXVertex (.1,1,-.1);
  POSITION_GFXVertex (-.1,1,-.1);
  POSITION_GFXVertex (-.1,1,.1);
  POSITION_GFXVertex (.1,1,.1); //cap


  POSITION_GFXVertex (.1,.1,1); //cap
  POSITION_GFXVertex (-.1,.1,1);
  POSITION_GFXVertex (-.1,-.1,1);
  POSITION_GFXVertex (.1,-.1,1);

  POSITION_GFXVertex (.1,-.1,-1);
  POSITION_GFXVertex (-.1,-.1,-1);
  POSITION_GFXVertex (-.1,.1,-1);
  POSITION_GFXVertex (.1,.1,-1); //cap



  GFXEnd();
*/

  GFXPopBlendMode();


}