particle_emitter.h

Go to the documentation of this file.
00001 
00002 //            Copyright (C) 2004-2007 by The Allacrost Project
00003 //                         All Rights Reserved
00004 //
00005 // This code is licensed under the GNU GPL version 2. It is free software 
00006 // and you may modify it and/or redistribute it under the terms of this license.
00007 // See http://www.gnu.org/copyleft/gpl.html for details.
00009 
00010 /*!****************************************************************************
00011  * \file    particle_emitter.h
00012  * \author  Raj Sharma, roos@allacrost.org
00013  * \brief   Header file for particle emitter
00014  *
00015  * This file contains the ParticleEmitter class, and some enumerations for
00016  * emitter properties.
00017  *
00018  * ParticleEmitter stores info about how a system emits particles. This is made
00019  * up of two things:
00020  *
00021  *  1) Where are particles emitted?
00022  *      -For example, you could create a circle-shaped emitter, and then every
00023  *         time a particle is emitted, a random spot in that circle is chosen.
00024  *
00025  *  2) When are particles emitted?
00026  *      -For example, you could emit them all at once, or slowly through the
00027  *         life of the system.
00028  *****************************************************************************/
00029 
00030 #ifndef __PARTICLE_EMITTER_HEADER__
00031 #define __PARTICLE_EMITTER_HEADER__
00032 
00033 #include "defs.h"
00034 #include "utils.h"
00035 
00036 namespace hoa_video {
00037 
00038 /*!***************************************************************************
00039  *  \brief Specifies whether the orientation for particle rotations should be
00040  *         counterclockwise, clockwise, or random.
00041  *****************************************************************************/
00042 
00043 enum EMITTER_SPIN
00044 {
00045   EMITTER_SPIN_INVALID          = -1,
00046   
00047   EMITTER_SPIN_CLOCKWISE        = 0,   
00048   EMITTER_SPIN_COUNTERCLOCKWISE = 1,   
00049   EMITTER_SPIN_RANDOM           = 2,   
00050   
00051   EMITTER_SPIN_TOTAL = 3
00052 };
00053 
00054 
00055 /*!***************************************************************************
00056  *  \brief Shape of the emitter. A point emitter is the most simple- all
00057  *         particles come out from a point. Another example is a line emitter.
00058  *         This may be useful for a snow effect- you place the line at the top
00059  *         of the screen, and particles will be generated anywhere along that line.
00060  *****************************************************************************/
00061 
00062 enum EMITTER_SHAPE
00063 {
00064   EMITTER_SHAPE_INVALID          = -1,
00065   
00066   EMITTER_SHAPE_POINT            =  0,   
00067   EMITTER_SHAPE_LINE             =  1,   
00068   EMITTER_SHAPE_CIRCLE           =  2,   
00069   EMITTER_SHAPE_FILLED_CIRCLE    =  3,   
00070   EMITTER_SHAPE_FILLED_RECTANGLE =  4,   
00071   
00072   EMITTER_SHAPE_TOTAL = 5
00073 };
00074 
00075 /*!***************************************************************************
00076  *  \brief An enumeration of EMITTER modes for particles
00077  *****************************************************************************/
00078 
00079 enum EMITTER_MODE
00080 {
00081   EMITTER_MODE_INVALID = -1, 
00082   
00083   EMITTER_MODE_LOOPING  = 0,   
00084   EMITTER_MODE_ONE_SHOT = 1,   
00085   EMITTER_MODE_BURST    = 2,   
00086   EMITTER_MODE_ALWAYS   = 3,   
00087   
00088   EMITTER_MODE_TOTAL = 4
00089 };
00090 
00091 
00092 class ParticleEmitter
00093 {
00094 public:
00095 
00098   float _x; 
00099   float _y;
00100   
00102   float _x2;
00103   float _y2;
00104 
00109   float _center_x;
00110   float _center_y;
00111 
00113   float _x_variation;
00114   float _y_variation;
00115 
00117   float _radius;  
00118   
00120   EMITTER_SHAPE _shape;
00121 
00123   bool _omnidirectional;
00124   
00128   float _orientation;
00129   
00132   float _outer_cone;
00133   
00136   float _inner_cone;
00137   
00141   float _initial_speed;
00142   
00145   float _initial_speed_variation;
00146     
00148   float _emission_rate;
00149   
00153   float _start_time;
00154   
00156   EMITTER_MODE _emitter_mode;
00157   
00159   EMITTER_SPIN _spin;
00160 };
00161 
00162 } // namespace hoa_video
00163 
00164 #endif  // __PARTICLE_EMITTER_HEADER__

Generated on Fri Jul 6 23:11:20 2007 for Hero of Allacrost by  doxygen 1.5.1