particle.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.h
00012  * \author  Raj Sharma, roos@allacrost.org
00013  * \brief   Header file for particle data
00014  *
00015  * This file contains structure(s) for representing a single particle. In theory,
00016  * we should be able to just have one structure which holds all properties for
00017  * a particle, but in fact we have two: one for the position, and one for everything
00018  * else. The reason is that having the positions separated is more efficient
00019  * for rendering.
00020  *****************************************************************************/
00021 
00022 #ifndef __PARTICLE_HEADER__
00023 #define __PARTICLE_HEADER__
00024 
00025 #include "defs.h"
00026 #include "utils.h"
00027 #include "color.h"
00028 #include "particle_keyframe.h"
00029 
00030 
00031 namespace hoa_video
00032 {
00033 
00034 namespace private_video
00035 {
00036 
00037 
00038 /*!***************************************************************************
00039  *  \brief this is used in the vertex array for DrawArrays(). Every time
00040  *         the particle system is rendered, we need to iterate through all the
00041  *         particles in the system, and use the position, size, and rotation
00042  *         to generate 4 ParticleVertex's. This is pretty expensive, but
00043  *         unfortunately it's necessary since the positions change every frame.
00044  *****************************************************************************/
00045 
00046 class ParticleVertex
00047 {
00048 public:
00049 
00051   float _x;
00052   float _y;
00053 };
00054 
00055 
00056 /*!***************************************************************************
00057  *  \brief this is used in texture coordinate array for DrawArrays()
00058  *         Unless animated particles are used, this can be generated just once
00059  *****************************************************************************/
00060 
00061 class ParticleTexCoord
00062 {
00063 public:
00064 
00066   float _t0;
00067   float _t1;
00068 };
00069 
00070 
00071 /*!***************************************************************************
00072  *  \brief this is the structure we use to represent a particle
00073  *****************************************************************************/
00074 
00075 
00076 class Particle
00077 {
00078 public:
00079 
00081   float  x;
00082   float  y;
00083   
00085   float  size_x;
00086   float  size_y;
00087   
00089   float  velocity_x;
00090   float  velocity_y;
00091   
00094   float combined_velocity_x;
00095   float combined_velocity_y;
00096   
00098   Color  color;
00099     
00101   float  rotation_angle;
00102   
00104   float  rotation_speed;
00105   
00107   float  time;
00108   
00110   float  lifetime;
00111   
00115   float wave_length_coefficient;  
00116   
00120   float wave_half_amplitude;
00121 
00126   float acceleration_x;
00127   float acceleration_y;
00128   
00131   float tangential_acceleration;
00132   
00137   float radial_acceleration;
00138   
00142   float wind_velocity_x;
00143   float wind_velocity_y;
00144   
00148   float damping;  
00149   
00152   float rotation_direction;
00153     
00155   float current_size_variation_x;
00156   float current_size_variation_y;
00157   float next_size_variation_x;
00158   float next_size_variation_y;  
00159   float current_rotation_speed_variation;
00160   float next_rotation_speed_variation;  
00161   Color current_color_variation;
00162   Color next_color_variation;
00163   
00165   ParticleKeyframe *current_keyframe;
00166   ParticleKeyframe *next_keyframe;
00167 };
00168 
00169 }
00170 }
00171 
00172 #endif  

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