Game Development Reference
In-Depth Information
// read, but don't write particles to z-buffer
_device->SetRenderState(D3DRS_ZWRITEENABLE, false);
}
void Firework::postRender()
{
PSystem::postRender();
_device->SetRenderState(D3DRS_ZWRITEENABLE, true);
}
Notice that both of the methods call the parent version. In this way, we
can still reuse some of the functionality of the parent while making
minimal specific changes to the Firework system.
14.3.3 Sample Application: Particle Gun
Figure 14.4: A
screen shot of
the Laser (Parti-
cle Gun) sample
The Particle Gun system's class is defined as:
class ParticleGun : public PSystem
{
public:
ParticleGun(Camera* camera);
void resetParticle(Attribute* attribute);
void update(float timeDelta);
private:
Camera* _camera;
};
The constructor takes a pointer to the camera. This is because the sys-
tem needs to know the position and direction of the camera whenever
it creates a new particle.
Team-Fly ®
Search WWH ::




Custom Search