src/tron/gParticles.h

Go to the documentation of this file.
00001 /*
00002 
00003 *************************************************************************
00004 
00005 ArmageTron -- Just another Tron Lightcycle Game in 3D.
00006 Copyright (C) 2000  Manuel Moos (manuel@moosnet.de)
00007 
00008 **************************************************************************
00009 
00010 This program is free software; you can redistribute it and/or
00011 modify it under the terms of the GNU General Public License
00012 as published by the Free Software Foundation; either version 2
00013 of the License, or (at your option) any later version.
00014 
00015 This program is distributed in the hope that it will be useful,
00016 but WITHOUT ANY WARRANTY; without even the implied warranty of
00017 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00018 GNU General Public License for more details.
00019 
00020 You should have received a copy of the GNU General Public License
00021 along with this program; if not, write to the Free Software
00022 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
00023 
00024 ***************************************************************************
00025 
00026 */
00027 
00028 #if 0
00029 #ifndef ArmageTron_PARTICLES_H
00030 #define ArmageTron_PARTICLES_H
00031 
00032 // Uncomment the following line to use the particle system
00033 //#define USE_PARTICLES
00034 
00035 #include "defs.h"
00036 #include "eCamera.h"
00037 #include "rModel.h"
00038 #include "rTexture.h"
00039 #include "eGameObject.h"
00040 #include "eCoord.h"
00041 #include <vector>
00042 
00043 #define gNUM_PARTICLES 1000
00044 
00045 // The struct that defines the particle system.  Pass an instance of it to the
00046 //   gParticles constructor.
00047 typedef struct {
00048     float particle_size;  // Obviously, the size of the particles
00049     int numParticles;     // Total number of particles in the system
00050     float initialSpread;    // Initial spread of particles
00051     float gravity;        // (Gravity)
00052     bool generateNewParticles; // Flag, if false don't generate new particles
00053     int numStartParticles;  // Number of active particles to initialize with
00054     float life;           // Average lifetime of a particle
00055     float lifeRand;       // Factor to use to randomize particle lifetime
00056     float expansion;      // The rate at which the system will run
00057     float flow;           // The rate at which new particles will be generated
00058     //   New particle generation happens when a particles dies
00059     //      and also when the system is not full
00060     //      If the system is full of active particles,
00061     //      new particles will not be generated
00062 } ParticleSystem;
00063 
00064 typedef struct {
00065     float x;
00066     float y;
00067     float z;
00068 } glCoord;
00069 
00070 // Particle structure
00071 typedef struct {
00072     glCoord pos;
00073     glCoord vec;
00074     float life;
00075     REAL startTime;
00076     float decay;
00077 } ParticleInfo;
00078 
00079 class gParticles {
00080 public:
00081     gParticles(const eCoord &pos,const glCoord &vec,REAL time, ParticleSystem &param);
00082     virtual ~gParticles(){}
00083 
00084     virtual bool Timestep(REAL currentTime);
00085     virtual void GiveBirth(REAL currentTime = 0.0f);   // creates a new particle in the system
00086 #ifndef DEDICATED
00087     virtual void Render(const eCamera *cam);
00088 #endif
00089 
00090 private:
00091     std::vector<ParticleInfo> particles; // Array of particles
00092     ParticleSystem psystem;  // Info for the particle system
00093 
00094     glCoord focus;
00095     glCoord svector;
00096 
00097     REAL startTime;
00098     REAL lastTime;
00099     int thisSystem;
00100 };
00101 
00102 #endif // ArmageTron_PARTICLES_H
00103 
00104 #endif
00105 

Generated on Sat Mar 15 22:56:09 2008 for Armagetron Advanced by  doxygen 1.5.4