src/thirdparty/particles/ParticleDLL/Particle.h

Go to the documentation of this file.
00001 // Particle.h
00002 //
00003 // Copyright 1998-2005 by David K. McAllister.
00004 //
00005 // This file contains the definition of a particle.
00006 // It is only included by API implementation files, not by applications.
00007 
00008 #ifndef _Particle_h
00009 #define _Particle_h
00010 
00011 #include "pVec.h"
00012 
00013 // A single particle
00014 struct Particle
00015 {
00016     pVec pos;
00017     pVec posB;
00018     pVec up;
00019     pVec upB;
00020     pVec vel;
00021     pVec velB;      // Used to compute binormal, normal, etc.
00022     pVec rvel;
00023     pVec rvelB;
00024     pVec size;
00025     pVec color;     // Color must be next to alpha so glColor4fv works.
00026     float alpha;        // This is both cunning and scary.
00027     float age;
00028     float mass;
00029     long data;          // arbitrary data for user
00030     float tmp0;         // These temporaries are used as padding and for sorting.
00031 
00032     inline Particle(const pVec &pos, const pVec &posB,
00033                     const pVec &up, const pVec &upB,
00034                     const pVec &vel, const pVec &velB,
00035                     const pVec &rvel, const pVec &rvelB,
00036                     const pVec &size, const pVec &color,
00037                     float alpha, float age, float mass, long data, float tmp0) :
00038             pos(pos), posB(posB),
00039             up(up), upB(upB),
00040             vel(vel), velB(velB),
00041             rvel(rvel), rvelB(rvelB),
00042             size(size), color(color),
00043             alpha(alpha), age(age), mass(mass), data(data), tmp0(0)
00044     {
00045     }
00046 
00047     inline Particle(const Particle &rhs) :
00048             pos(rhs.pos), posB(rhs.posB),
00049             up(rhs.up), upB(rhs.upB),
00050             vel(rhs.vel), velB(rhs.velB),
00051             rvel(rhs.rvel), rvelB(rhs.rvelB),
00052             size(rhs.size), color(rhs.color),
00053             alpha(rhs.alpha), age(rhs.age), mass(rhs.mass), data(rhs.data), tmp0(rhs.tmp0)
00054     {
00055     }
00056 
00057     Particle() : data(0)
00058     {
00059     }
00060 
00061     // For sorting.
00062     bool operator<(const Particle &P) const
00063     {
00064         return tmp0 < P.tmp0;
00065     }
00066 };
00067 
00068 #endif

Generated on Sat Mar 15 22:55:58 2008 for Armagetron Advanced by  doxygen 1.5.4