Game Development Reference
In-Depth Information
Although different concrete particle systems have different behav-
ior, we can generalize and find some basic properties that all particle
systems share. We put these common properties into an abstract
PSystem base class, which is the parent to all of our concrete particle
systems. Let's review the PSystem class now:
class PSystem
{
public:
PSystem();
virtual ~PSystem();
virtual bool init(IDirect3DDevice9* device, char* texFileName);
virtual void reset();
virtual void resetParticle(Attribute* attribute) = 0;
virtual void addParticle();
virtual void update(float timeDelta) = 0;
virtual void preRender();
virtual void render();
virtual void postRender();
bool isEmpty();
bool isDead();
protected:
virtual void removeDeadParticles();
protected:
IDirect3DDevice9* _device;
D3DXVECTOR3 _origin;
d3d::BoundingBox _boundingBox;
float _emitRate;
float _size;
IDirect3DTexture9* _tex;
IDirect3DVertexBuffer9* _vb;
std::list<Attribute>
_particles;
int
_maxParticles;
DWORD _vbSize;
DWORD _vbOffset;
DWORD _vbBatchSize;
};
Selected data members:
_origin —The origin of the system. This is where particles in the
system originate.
_boundingBox —The bounding box is used for systems in which
we want to limit the volume where the particles can go. For exam-
ple, suppose we want a snow system to only fall in the volume sur-
rounding a high mountain peak; we would define the bounding box
to cover this volume, and particles going outside this volume would
be killed.
Search WWH ::




Custom Search