Main Page | Modules | Namespace List | Class Hierarchy | Compound List | File List | Compound Members | File Members

photon.h

Go to the documentation of this file.
00001 /*****************************************************************************
00002  * $Id: photon.h,v 1.5 2003/06/27 08:38:26 schou Exp $
00003  * Author: Jakob Schou Jensen <schou@sourceforge.net>
00004  * Licence: GPL
00005  *
00006  * Description: Photon particle
00007  *
00008  ****************************************************************************/
00009 
00015 #ifndef PHOTON_H
00016 #define PHOTON_H
00017 
00018 #include <adsobase.h>
00019 #include <adsomath.h>
00020 #include "vehicle.h"
00021 
00022 #define PHOTON_COUNT 128
00023 
00024 struct PhotonDef {
00025   u_int createTime;
00026   v3f x, P;
00027   float lifeTimer;
00028 };
00029 
00030 class Photon {
00031   static int photonIndex;
00032   static int st_pi[SOUND_PHOTON_NUM];
00033   static int st_si[SOUND_PHOTON_NUM];
00034  public:
00035   static Photon array[PHOTON_COUNT];
00036   int active;
00037   float lifeTimer;
00038   class Vehicle *ignoreCollision;
00039   int remoteOwner;
00040 
00041   // Constants
00042   float mass;     // mass M
00043 
00044   // State values
00045   v3f x;          // Center of mass
00046   v3f P;          // Linear momentum
00047 
00048   // Derived values
00049   v3f v;          // Linear velocity
00050 
00051   void update(float);
00052   void draw();
00053 
00054   Photon(){
00055     mass = 1.0;
00056     x = v3f(0.0,0.0,0.0);
00057     P = v3f(0.0,0.0,0.0);
00058     active = 0;
00059     lifeTimer = 0.0;
00060     ignoreCollision = 0;
00061     remoteOwner = 0;
00062   }
00063 
00064   static Photon *create(){ 
00065     Photon *p = &array[photonIndex++]; 
00066     if(photonIndex>=PHOTON_COUNT) photonIndex=0; 
00067     return p;
00068   }
00069 
00070   static void audio();
00071   static void audioInit();
00072 };
00073 
00074 #endif
00075 

Generated on Mon Jul 21 10:44:47 2003 for Rover by doxygen 1.3.2