Page principale | Liste des namespaces | Hiérarchie des classes | Liste par ordre alphabétique | Liste des composants | Liste des fichiers | Membres des namespaces | Composants | Déclarations

# ExCSystemeParticule.h

Aller à la documentation de ce fichier.

    00001 /************************************************************************/
    00002 /* Ex Nihlo Engine by Hermanns Christophe                                                               */
    00003 /************************************************************************/
    00004 /* This program is free software; you can redistribute it and/or                */
    00005 /* modify it under the terms of the GNU General Public License                  */
    00006 /* as published by the Free Software Foundation; either version 2               */
    00007 /* of the License, or (at your option) any later version.                               */
    00008 /*                                                                                                                                              */
    00009 /* This program is distributed in the hope that it will be useful,              */
    00010 /* but WITHOUT ANY WARRANTY; without even the implied warranty of               */
    00011 /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.                                 */
    00012 /*                                                                                                                                              */
    00013 /* See the GNU General Public License for more details.                                 */
    00014 /*                                                                                                                                              */
    00015 /* You should have received a copy of the GNU General Public License    */
    00016 /* along with this program; if not, write to the Free Software                  */
    00017 /* Foundation, Inc., 59 Temple Place - Suite 330,                                               */
    00018 /* Boston, MA  02111-1307, USA.                                                                                 */
    00019 /*                                                                                                                                              */
    00020 /* If you use a important part of this code please send me a mail               */
    00021 /* I just want to see where my code go thks :)                                                  */
    00022 /************************************************************************/
    00023
    00024 /************************************************************************/
    00025 /* Contact                                                              */
    00026 /************************************************************************/
    00027 /* ExNihilo Website :www.ploksoftware.org                               */
    00028 /*                                                                      */
    00029 /* Hermanns Christophe ExNihilo creator and main programmer             */
    00030 /*                                                                      */
    00031 /* Mail             : Data@ploksoftware.org                                                             */
    00032 /* ICQ              : 8030901                                                                                   */
    00033 /* MSN Messenger    : Data_7@hotmail.com                                                                */
    00034 /*                                                                      */
    00035 /*                                                                      */
    00036 /************************************************************************/
    00037
    00038 /************************************************************************/
    00039 /* File Description                                                                                             */
    00040 /************************************************************************/
    00041 /* File Name   :ExCSystemeParticule.h                                                                   */
    00042 /*                                                                                                                                              */
    00043 /* Start Date   :05/25/2002                                                                                             */
    00044 /*                                                                                                                                              */
    00045 /* Last Update :06/20/2003                                              */
    00046 /*                                                                                                                                              */
    00047 /* File Description :                                                                                                   */
    00048 /*                                                                      */
    00049 /* For update of this file check : www.ploksoftware.org                 */
    00050 /************************************************************************/
    00051
    00052 #ifndef __EXSYSTEMEPARTICULE_H__
    00053 #define __EXSYSTEMEPARTICULE_H__
    00054 //------------------------------------------------------------------------
    00055 //Includes
    00056 //------------------------------------------------------------------------
    00057 #include "ExDefine.h"
    00058 //------------------------------------------------------------------------
    00059 #include "Math/ExMath.h"
    00060 #include "Math/ExCRandomNumber.h"
    00061 #include "Math/ExCFrustum.h"
    00062 //------------------------------------------------------------------------
    00063 #include "Object/Object3D/ExCObject3D.h"
    00064 //------------------------------------------------------------------------
    00065 #include "ExCParticule.h"
    00066 //------------------------------------------------------------------------
    00067 #include "Manager/ExManagerCollision.h"
    00068 #include "Manager/ManagerObject/ExManagerTexture.h"
    00069 //------------------------------------------------------------------------
    00070 //Define
    00071 //------------------------------------------------------------------------
    00072 #define EMMETEUR_POINT                  1
    00073 #define EMMETEUR_LIGNE                  2
    00074 #define EMMETEUR_RECTANGLE              3
    00075 #define EMMETEUR_CUBE                   4
    00076 #define EMMETEUR_CERCLE                 5
    00077 #define EMMETEUR_SPIRAL                 6
    00078 #define EMMETEUR_DISQUE                 7
    00079 //------------------------------------------------------------------------
    00080
    00081 class ExCSystemeParticule : public ExCObject3D
    00082 {
    00083 protected:
    00084         ExManagerCollision                      *ManagerCollision;
    00085 //------------------------------------------------------------------------
    00086 // Variable
    00087 //------------------------------------------------------------------------
    00088         std::vector<ExCParticule>                       m_VecParticule;
    00089         std::vector<ExCParticule>::iterator m_ItVecParticule;
    00090
    00091
    00092         bool                            m_State;
    00093         bool                            m_Pause;
    00094
    00095         float                           m_TimeLastParticule;
    00096         char                            *m_ParticuleSystemeName;
    00097
    00098         //Param for emmeteur
    00099         float                           m_EmissionRate;
    00100         unsigned int            m_MaxParticule;
    00101         int                                     m_TypeEmmeteur;
    00102         ExCVec3D                        m_P1;//use for point
    00103         ExCVec3D                        m_P2;//use for line
    00104         float                           m_rayon;
    00105         int                                     m_angle;
    00106         int                                     m_vitesseangle;
    00107         //Max and min value for particule
    00108         int                             m_Type;
    00109         std::string             m_TextureName;
    00110         int                             m_MaxLifeSpan;
    00111         int                             m_MinLifeSpan;
    00112         float                           m_MaxGrowth;
    00113         float                           m_MinGrowth;
    00114         float                   m_MaxSize;
    00115         float                   m_MinSize;
    00116         int                             m_MaxWeight;
    00117         int                             m_MinWeight;
    00118         int                             m_MaxColorR;
    00119         int                             m_MinColorR;
    00120         int                             m_MaxColorG;
    00121         int                             m_MinColorG;
    00122         int                             m_MaxColorB;
    00123         int                             m_MinColorB;
    00124         int                             m_MaxBlending;
    00125         int                             m_MinBlending;
    00126         ExCVec3D                m_MaxVelocity;
    00127         ExCVec3D                m_MinVelocity;
    00128         ExCVec3D                m_MaxAcceleration;
    00129         ExCVec3D                m_MinAcceleration;
    00130         ExCVec3D                m_MaxGravity;
    00131         ExCVec3D                m_MinGravity;
    00132
    00133         ExCVec3D                m_CurrentEmitPosition;
    00134
    00135         float                   m_MaxRotation;
    00136         float                   m_MinRotation;
    00137
    00138         void CalculateEmitPosition(void);
    00139         void CreateNewParticle(void);
    00140
    00141 public:
    00142         //struct for bmp
    00143         GLuint                          m_TextureID;
    00144         ExManagerTexture        *ManagerTexture;
    00145         std::ostrstream *Consol;
    00146 //------------------------------------------------------------------------
    00147 // Constructor // Destructor
    00148 //------------------------------------------------------------------------
    00149         ExCSystemeParticule(void);
    00150         ~ExCSystemeParticule(void);
    00151 //------------------------------------------------------------------------
    00152 // Methode
    00153 //------------------------------------------------------------------------
    00154         inline void SetManagerCollision(ExManagerCollision * Collision){ManagerCollision = Collision;}
    00155
    00156         inline void SetEmitterType(int value){m_TypeEmmeteur=value;}
    00157         inline void SetMaxParticule(int value){m_MaxParticule=value;}
    00158         inline void SetRange(float value){m_rayon=value;}
    00159         inline void SetSpeedAngle(int value){m_vitesseangle=value;}
    00160         inline void SetRate(int value){m_EmissionRate=value;}
    00161
    00162         inline int GetEmitterType(void){return m_TypeEmmeteur;}
    00163         inline int GetMaxParticule(void){return m_MaxParticule;}
    00164         inline float GetRange(void){return m_rayon;}
    00165         inline int GetSpeedAngle(void){return m_vitesseangle;}
    00166         inline int GetRate(void){return m_EmissionRate;}
    00167
    00168         void Draw(void);
    00169         void Start(void);
    00170         void Pause(void);
    00171         void Stop(void);
    00172
    00173         bool Load(std::string FileName);
    00174         bool Save(std::string  FileName);
    00175
    00176         inline char * GetParticuleSystemeName(void){return m_ParticuleSystemeName;}
    00177         void SetParticuleSystemeName(char * name);
    00178
    00179         inline void SetManagerTexture(ExManagerTexture * Texture){ManagerTexture = Texture;}
    00180         inline bool GetParticuleSystemeState(void){return m_State;}
    00181         inline void SetParticuleSystemeState(bool state){m_State=state;}
    00182
    00183         void SetParticuleType(int type);
    00184         inline int GetParticuleType(void){return m_Type;}
    00185
    00186         void SetParticuleTexture(std::string Name);
    00187         void SetParticuleTextureName(std::string Name){m_TextureName=Name;}
    00188         inline std::string GetParticuleTexture(void){return m_TextureName;}
    00189
    00190         inline void SetParticuleMaxLife(int life) {m_MaxLifeSpan=life;}
    00191         inline int      GetParticuleMaxLife(void)       {return m_MaxLifeSpan;}
    00192         inline void SetParticuleMinLife(int life) {m_MinLifeSpan=life;}
    00193         inline int      GetParticuleMinLife(void)       {return m_MinLifeSpan;}
    00194
    00195         inline void SetParticuleMaxGrowth(float Growth) {m_MaxGrowth =Growth;}
    00196         inline float    GetParticuleMaxGrowth(void)     {return m_MaxGrowth ;}
    00197         inline void SetParticuleMinGrowth(float Growth) {m_MinGrowth =Growth;}
    00198         inline float    GetParticuleMinGrowth(void)     {return m_MinGrowth ;}
    00199
    00200         inline void SetParticuleMaxSize(float Size) {m_MaxSize=Size;}
    00201         inline float    GetParticuleMaxSize(void)       {return m_MaxSize;}
    00202         inline void SetParticuleMinSize(float Size) {m_MinSize=Size;}
    00203         inline float    GetParticuleMinSize(void)       {return m_MinSize;}
    00204
    00205
    00206         inline void SetParticuleMaxWeight(int Weight) {m_MaxWeight=Weight;}
    00207         inline int      GetParticuleMaxWeight(void)     {return m_MaxWeight;}
    00208         inline void SetParticuleMinWeight(int Weight) {m_MinWeight=Weight;}
    00209         inline int      GetParticuleMinWeight(void)     {return m_MinWeight;}
    00210
    00211         inline void SetParticuleMaxColorR(int ColorR) {m_MaxColorR=ColorR;}
    00212         inline int      GetParticuleMaxColorR(void)     {return m_MaxColorR;}
    00213         inline void SetParticuleMinColorR(int ColorR) {m_MinColorR=ColorR;}
    00214         inline int      GetParticuleMinColorR(void)     {return m_MinColorR;}
    00215
    00216         inline void SetParticuleMaxColorG(int ColorG) {m_MaxColorG=ColorG;}
    00217         inline int      GetParticuleMaxColorG(void)     {return m_MaxColorG;}
    00218         inline void SetParticuleMinColorG(int ColorG) {m_MinColorG=ColorG;}
    00219         inline int      GetParticuleMinColorG(void)     {return m_MinColorG;}
    00220
    00221         inline void SetParticuleMaxColorB(int ColorB) {m_MaxColorB=ColorB;}
    00222         inline int      GetParticuleMaxColorB(void)     {return m_MaxColorB;}
    00223         inline void SetParticuleMinColorB(int ColorB) {m_MinColorB=ColorB;}
    00224         inline int      GetParticuleMinColorB(void)     {return m_MinColorB;}
    00225
    00226         inline void SetParticuleMaxBlending(int Blending) {m_MaxBlending=Blending;}
    00227         inline int      GetParticuleMaxBlending(void)   {return m_MaxBlending;}
    00228         inline void SetParticuleMinBlending(int Blending) {m_MinBlending=Blending;}
    00229         inline int      GetParticuleMinBlending(void)   {return m_MinBlending;}
    00230
    00231         inline void SetParticuleMaxVelocity(ExCVec3D Velocity) {m_MaxVelocity=Velocity;}
    00232         inline ExCVec3D GetParticuleMaxVelocity(void)   {return m_MaxVelocity;}
    00233         inline void SetParticuleMinVelocity(ExCVec3D Velocity) {m_MinVelocity=Velocity;}
    00234         inline ExCVec3D GetParticuleMinVelocity(void)   {return m_MinVelocity;}
    00235
    00236         inline void SetParticuleMaxAcceleration(ExCVec3D Acceleration) {m_MaxAcceleration=Acceleration;}
    00237         inline ExCVec3D GetParticuleMaxAcceleration(void)       {return m_MaxAcceleration;}
    00238         inline void SetParticuleMinAcceleration(ExCVec3D Acceleration) {m_MinAcceleration=Acceleration;}
    00239         inline ExCVec3D GetParticuleMinAcceleration(void)       {return m_MinAcceleration;}
    00240
    00241         //-------------------------------------------------------
    00242         inline void             SetEmitterP1X(float P1) {m_P1.SetX(P1);}
    00243         inline float    GetEmitterP1X(void)             {return m_P1.GetX();}
    00244         inline void             SetEmitterP1Y(float P1) {m_P1.SetY(P1);}
    00245         inline float    GetEmitterP1Y(void)             {return m_P1.GetY();}
    00246         inline void             SetEmitterP1Z(float P1) {m_P1.SetZ(P1);}
    00247         inline float    GetEmitterP1Z(void)             {return m_P1.GetZ();}
    00248
    00249         inline void             SetEmitterP2X(float P2) {m_P2.SetX(P2);}
    00250         inline float    GetEmitterP2X(void)             {return m_P2.GetX();}
    00251         inline void             SetEmitterP2Y(float P2) {m_P2.SetY(P2);}
    00252         inline float    GetEmitterP2Y(void)             {return m_P2.GetY();}
    00253         inline void             SetEmitterP2Z(float P2) {m_P2.SetZ(P2);}
    00254         inline float    GetEmitterP2Z(void)             {return m_P2.GetZ();}
    00255         //-------------------------------------------------------
    00256         inline void             SetEmitterMaxGravityX(float MaxGravity) {m_MaxGravity.SetX(MaxGravity);}
    00257         inline float    GetEmitterMaxGravityX(void)             {return m_MaxGravity.GetX();}
    00258         inline void             SetEmitterMaxGravityY(float MaxGravity) {m_MaxGravity.SetY(MaxGravity);}
    00259         inline float    GetEmitterMaxGravityY(void)             {return m_MaxGravity.GetY();}
    00260         inline void             SetEmitterMaxGravityZ(float MaxGravity) {m_MaxGravity.SetZ(MaxGravity);}
    00261         inline float    GetEmitterMaxGravityZ(void)             {return m_MaxGravity.GetZ();}
    00262
    00263         inline void             SetEmitterMinGravityX(float MinGravity) {m_MinGravity.SetX(MinGravity);}
    00264         inline float    GetEmitterMinGravityX(void)             {return m_MinGravity.GetX();}
    00265         inline void             SetEmitterMinGravityY(float MinGravity) {m_MinGravity.SetY(MinGravity);}
    00266         inline float    GetEmitterMinGravityY(void)             {return m_MinGravity.GetY();}
    00267         inline void             SetEmitterMinGravityZ(float MinGravity) {m_MinGravity.SetZ(MinGravity);}
    00268         inline float    GetEmitterMinGravityZ(void)             {return m_MinGravity.GetZ();}
    00269         //-------------------------------------------------------
    00270         inline void             SetEmitterMaxAccelerationX(float MaxAcceleration)       {m_MaxAcceleration.SetX(MaxAcceleration);}
    00271         inline float    GetEmitterMaxAccelerationX(void)                {return m_MaxAcceleration.GetX();}
    00272         inline void             SetEmitterMaxAccelerationY(float MaxAcceleration)       {m_MaxAcceleration.SetY(MaxAcceleration);}
    00273         inline float    GetEmitterMaxAccelerationY(void)                {return m_MaxAcceleration.GetY();}
    00274         inline void             SetEmitterMaxAccelerationZ(float MaxAcceleration)       {m_MaxAcceleration.SetZ(MaxAcceleration);}
    00275         inline float    GetEmitterMaxAccelerationZ(void)                {return m_MaxAcceleration.GetZ();}
    00276
    00277         inline void             SetEmitterMinAccelerationX(float MinAcceleration)       {m_MinAcceleration.SetX(MinAcceleration);}
    00278         inline float    GetEmitterMinAccelerationX(void)                {return m_MinAcceleration.GetX();}
    00279         inline void             SetEmitterMinAccelerationY(float MinAcceleration)       {m_MinAcceleration.SetY(MinAcceleration);}
    00280         inline float    GetEmitterMinAccelerationY(void)                {return m_MinAcceleration.GetY();}
    00281         inline void             SetEmitterMinAccelerationZ(float MinAcceleration)       {m_MinAcceleration.SetZ(MinAcceleration);}
    00282         inline float    GetEmitterMinAccelerationZ(void)                {return m_MinAcceleration.GetZ();}
    00283         //-------------------------------------------------------
    00284         inline void             SetEmitterMaxVelocityX(float MaxVelocity)       {m_MaxVelocity.SetX(MaxVelocity);}
    00285         inline float    GetEmitterMaxVelocityX(void)            {return m_MaxVelocity.GetX();}
    00286         inline void             SetEmitterMaxVelocityY(float MaxVelocity)       {m_MaxVelocity.SetY(MaxVelocity);}
    00287         inline float    GetEmitterMaxVelocityY(void)            {return m_MaxVelocity.GetY();}
    00288         inline void             SetEmitterMaxVelocityZ(float MaxVelocity)       {m_MaxVelocity.SetZ(MaxVelocity);}
    00289         inline float    GetEmitterMaxVelocityZ(void)            {return m_MaxVelocity.GetZ();}
    00290
    00291         inline void             SetEmitterMinVelocityX(float MinVelocity)       {m_MinVelocity.SetX(MinVelocity);}
    00292         inline float    GetEmitterMinVelocityX(void)            {return m_MinVelocity.GetX();}
    00293         inline void             SetEmitterMinVelocityY(float MinVelocity)       {m_MinVelocity.SetY(MinVelocity);}
    00294         inline float    GetEmitterMinVelocityY(void)            {return m_MinVelocity.GetY();}
    00295         inline void             SetEmitterMinVelocityZ(float MinVelocity)       {m_MinVelocity.SetZ(MinVelocity);}
    00296         inline float    GetEmitterMinVelocityZ(void)            {return m_MinVelocity.GetZ();}
    00297         //-------------------------------------------------------
    00298 };
    00299 //------------------------------------------------------------------------
    00300 #endif // __EXSYSTEMEPARTICULE_H__
    00301