/*****************************************************************************
 * $LastChangedDate: 2010-02-03 19:48:51 -0500 (Wed, 03 Feb 2010) $
 * @file
 * @author  Jim E. Brooks  http://www.palomino3d.org
 * @brief   Trail particle-system (private implementation of FX class).
 *//*
 * LEGAL:   COPYRIGHT (C) 2008 JIM E. BROOKS
 *          THIS SOURCE CODE IS RELEASED UNDER THE TERMS
 *          OF THE GNU GENERAL PUBLIC LICENSE VERSION 2 (GPL 2).
 *****************************************************************************/

#ifndef FX_PARTSYS_TRAIL_HH
#define FX_PARTSYS_TRAIL_HH 1

#include "object/events.hh"
using namespace object;
#include "fx/partsys.hh"
#include "fx/partsys_medium.hh"

namespace fx {

////////////////////////////////////////////////////////////////////////////////
/// @brief Trail particle-system (private implementation of FX class).
///
class TrailParticleSystem : public MediumParticleSystem
{
PREVENT_COPYING(TrailParticleSystem)
typedef MediumParticleSystem Parent;
friend class FX; friend class shptr<TrailParticleSystem>;
private:
                    TrailParticleSystem( const Milliseconds lifetime,
                                         shptr<Object> trailMaker );
                    ~TrailParticleSystem();
    virtual void    Tick( const Milliseconds millisecElapsed );
    void            MakeParticles( const uint count, const Milliseconds millisecElapsed );

private:
    CLASS_DESTROY_OBJECT_LISTENER( TrailParticleSystem, mTrailParticleSystem )

private:
    shptr<Object>                   mTrailMaker;                ///< emitter of particles
    WorldVertex                     mTrailMakerPrevPos;         ///< prev position of trail maker
    const Milliseconds              mTimeOfDeath;               ///< time when particle system expires
    Milliseconds                    mTimeOfPrevTick;            ///< previous tick
    shptr<DestroyObjectListener>    mDestroyObjectListener;     ///< listen for the destroying of trail-maker Object
};

} // namespace fx

#endif // FX_PARTSYS_TRAIL_HH
