Main Page   Namespace List   Class Hierarchy   Alphabetical List   Data Structures   File List   Namespace Members   Data Fields   Globals  

ExCParticule Class Reference

#include <ExCParticule.h>

Inheritance diagram for ExCParticule:

ExCObject3D ExCObject ExCParticuleLine ExCParticulePoint ExCParticuleTexture

Public Methods

 ExCParticule (void)
 ~ExCParticule (void)
void PrecalculeParticuleTrajectory (int start, int end)
void ApplyForceToParitcule (ExCVec3D force)
void Draw (void)
void SetParticuleType (int type)
void SetParticuleTexture (GLint texture)
void SetParticuleSize (float Size)
float GetParticuleSize (void)
void SetParticuleGrowth (float Growth)
float GetParticuleGrowth (void)
void SetParticuleMass (float Mass)
float GetParticuleMass (void)
void SetParticuleLife (int life)
int GetParticuleLife (void)
void SetParticuleWeight (int Weight)
int GetParticuleWeight (void)
void SetParticuleColorR (int ColorR)
int GetParticuleColorR (void)
void SetParticuleColorG (int ColorG)
int GetParticuleColorG (void)
void SetParticuleColorB (int ColorB)
int GetParticuleColorB (void)
void SetParticuleBlending (int Blending)
int GetParticuleBlending (void)
void SetParticuleVelocity (ExCVec3D Velocity)
ExCVec3D GetParticuleVelocity (void)
void SetParticuleAcceleration (ExCVec3D Acceleration)
ExCVec3D GetParticuleAcceleration (void)
void SetParticuleGravity (ExCVec3D Gravity)
ExCVec3D GetParticuleGravity (void)
void SetParticulePosition (ExCVec3D Position)
ExCVec3D GetParticulePosition (void)
void DecreaseLifeSpan (void)

Protected Attributes

ExCVec3D m_Position
ExCVec3D m_Velocity
ExCVec3D m_Acceleration
ExCVec3D m_Gravity
float m_Size
float m_Mass
float m_Growth
int m_LifeSpan
int m_TotalLife
int m_Weight
int m_Type
int m_ColorR
int m_ColorG
int m_ColorB
int m_Blending
GLint m_Texture
std::vector< ExCVec3Dm_VecPosition
std::vector< ExCVec3D >::iterator m_ItVecPosition

Constructor & Destructor Documentation

ExCParticule void   
 

Definition at line 26 of file ExCParticule.cpp.

References ExCParticule(), Guard, m_Acceleration, m_ColorB, m_ColorG, m_ColorR, m_Gravity, m_Growth, m_LifeSpan, m_Mass, m_Position, m_Size, m_Type, m_Velocity, m_Weight, ExCObject::SetName(), ExCObject::SetType(), and ExCVec3D::SetValue().

Referenced by ExCParticule(), and ~ExCParticule().

00027 {
00028 Guard(ExCParticule::ExCParticule(void))
00029         m_LifeSpan=1000;
00030         m_Size=0.6;
00031         m_Weight=1;
00032         m_Mass=1;
00033         m_Type=PARTICULE_LINE;
00034         m_ColorR=255;
00035         m_ColorG=255;
00036         m_ColorB=255;
00037         m_Velocity.SetValue(0.0f,0.1f,0.0f);
00038         m_Position.SetValue(0.0f,0.0f,0.0f);
00039         m_Acceleration.SetValue(1.0f,1.0f,1.0f);
00040         m_Gravity.SetValue(0.0f,0.0f,0.0f);
00041         SetName("ExCParticule");
00042         SetType(typeid(this).name());
00043         m_Growth=100;//in %
00044 UnGuard
00045 }

~ExCParticule void   
 

Definition at line 47 of file ExCParticule.cpp.

References ExCParticule(), and Guard.

00048 {
00049 Guard(ExCParticule::~ExCParticule(void))
00050 UnGuard
00051 }


Member Function Documentation

void ApplyForceToParitcule ExCVec3D    force
 

Definition at line 186 of file ExCParticule.cpp.

References ApplyForceToParitcule(), and Guard.

Referenced by ApplyForceToParitcule().

00187 {
00188 Guard(void ExCParticule::ApplyForceToParitcule(ExCVec3D force))
00189         
00190 UnGuard
00191 }

void DecreaseLifeSpan void    [inline]
 

Definition at line 118 of file ExCParticule.h.

References m_LifeSpan.

00119 {m_LifeSpan--;}

void Draw void    [virtual]
 

Reimplemented from ExCObject.

Definition at line 63 of file ExCParticule.cpp.

References Draw(), Guard, m_Blending, m_ColorB, m_ColorG, m_ColorR, m_Gravity, m_Growth, m_LifeSpan, m_Position, m_Size, m_Texture, m_TotalLife, m_VecPosition, ExCVec3D::m_Vector, m_Velocity, and ExCVec3D::SetValue().

Referenced by Draw().

00064 {
00065 Guard(void ExCParticule::Draw(void))
00066         float final,pas,current;
00067         
00068         float x,y,z,x1,y1,z1;
00069         float GravityX,GravityY,GravityZ;
00070         int TimeNow=(m_TotalLife-m_LifeSpan);
00071         
00072         final=((float)m_Size/100)*m_Growth;
00073         pas=(float)(final-m_Size)/m_TotalLife;
00074         current=m_Size+(TimeNow*pas);
00075 
00076         if(TimeNow>=m_TotalLife){return;}
00077 
00078         switch(m_Type)
00079         {
00080         case PARTICULE_POINT:
00081                 glPushMatrix();
00082                         glTranslatef(m_Position.m_Vector[0],m_Position.m_Vector[1],m_Position.m_Vector[2]);
00083                         m_Position=m_Position+m_Velocity;
00084                         glColor4ub(m_ColorR,m_ColorG,m_ColorB,m_Blending);
00085                         glBegin(GL_POINT);
00086                                 glVertex3fv(m_Position.m_Vector);
00087                         glEnd();
00088                 glPopMatrix();
00089                 break;
00090 
00091         case PARTICULE_LINE:
00092                 GravityX=((TimeNow*TimeNow)*(m_Gravity.m_Vector[0])/20);
00093                 GravityY=((TimeNow*TimeNow)*(m_Gravity.m_Vector[1])/20);
00094                 GravityZ=((TimeNow*TimeNow)*(m_Gravity.m_Vector[2])/20);
00095                                 
00096                 x=m_Position.m_Vector[0]+(m_Velocity.m_Vector[0]*TimeNow)-GravityX;
00097                 y=m_Position.m_Vector[1]+(m_Velocity.m_Vector[1]*TimeNow)-GravityY;
00098                 z=m_Position.m_Vector[2]+(m_Velocity.m_Vector[2]*TimeNow)-GravityZ;     
00099 
00100                 x1=m_Position.m_Vector[0]+(m_Velocity.m_Vector[0]*(TimeNow+current))-GravityX;
00101                 y1=m_Position.m_Vector[1]+(m_Velocity.m_Vector[1]*(TimeNow+current))-GravityY;
00102                 z1=m_Position.m_Vector[2]+(m_Velocity.m_Vector[2]*(TimeNow+current))-GravityZ;
00103                 
00104                 glPushMatrix();
00105                 glPushAttrib(GL_ALL_ATTRIB_BITS);
00106                         glTranslatef(x,y,z);
00107                         glColor4ub(m_ColorR,m_ColorG,m_ColorB,m_Blending);
00108                         glDisable(GL_LIGHTING);
00109                         glEnable(GL_BLEND);
00110                         glEnable(GL_ALPHA);
00111                         glBlendFunc(GL_ONE,GL_ONE);
00112                         glEnable(GL_ALPHA_TEST);
00113                         glAlphaFunc(GL_GREATER,0);
00114                         glLineWidth(2.0f);
00115                         glBegin(GL_LINES);
00116                                 glVertex3f(x,y,z);      
00117                                 glVertex3f(x1,y1,z1);
00118                         glEnd();
00119                 glPopAttrib();
00120                 glPopMatrix();
00121                 break;
00122 
00123         case PARTICULE_TEXTURE:
00124                 glPushMatrix();
00125                 glPushAttrib(GL_ALL_ATTRIB_BITS);
00126                         ExCVec3D position;
00127         
00128                         position=m_VecPosition.at(TimeNow);
00129                         glTranslatef(position.m_Vector[0],position.m_Vector[1],position.m_Vector[2]);
00130                         // Orienation of particule
00131                         GLfloat viewMatrix[16];
00132                         glGetFloatv(GL_MODELVIEW_MATRIX, viewMatrix);
00133                         ExCVec3D right;
00134                         ExCVec3D up;
00135 
00136                         right.SetValue(viewMatrix[0],viewMatrix[4],viewMatrix[8]);
00137                         up.SetValue(viewMatrix[1],viewMatrix[5],viewMatrix[9]);
00138 
00139                         ExCVec3D v1,v2,v3,v4;
00140                         v1=m_Position+(right+up)*-current;
00141                         v2=m_Position+(right-up)*current;
00142                         v3=m_Position+(right+up)*current;
00143                         v4=m_Position+(up-right)*current;
00144 
00145                         glEnable(GL_BLEND);
00146                         glBlendFunc(GL_SRC_ALPHA,GL_ONE);
00147                         glEnable(GL_TEXTURE_2D);
00148                         glDisable(GL_LIGHTING);
00149                         glTexEnvf(GL_TEXTURE_ENV,GL_TEXTURE_ENV_MODE,GL_MODULATE);
00150                         glBindTexture(GL_TEXTURE_2D, m_Texture);
00151                         glColor4ub(m_ColorR,m_ColorG,m_ColorB,m_Blending);
00152                         glBegin(GL_QUADS);
00153                                 glTexCoord2f(0.0f, 0.0f); glVertex3fv(v1.m_Vector);
00154                                 glTexCoord2f(1.0f, 0.0f); glVertex3fv(v2.m_Vector);
00155                                 glTexCoord2f(1.0f, 1.0f); glVertex3fv(v3.m_Vector);
00156                                 glTexCoord2f(0.0f, 1.0f); glVertex3fv(v4.m_Vector);
00157                         glEnd();
00158                 
00159                 glPopAttrib();
00160                 glPopMatrix();
00161                 break;
00162         }
00163         
00164 UnGuard
00165 }

ExCVec3D GetParticuleAcceleration void    [inline]
 

Definition at line 110 of file ExCParticule.h.

00110 {m_Acceleration=Acceleration;}

int GetParticuleBlending void    [inline]
 

Definition at line 104 of file ExCParticule.h.

References m_Blending.

00104 {m_Blending=Blending;}

int GetParticuleColorB void    [inline]
 

Definition at line 101 of file ExCParticule.h.

References m_ColorB.

00101 {m_ColorB=ColorB;}

int GetParticuleColorG void    [inline]
 

Definition at line 98 of file ExCParticule.h.

References m_ColorG.

00098 {m_ColorG=ColorG;}

int GetParticuleColorR void    [inline]
 

Definition at line 95 of file ExCParticule.h.

References m_ColorR.

00095 {m_ColorR=ColorR;}

ExCVec3D GetParticuleGravity void    [inline]
 

Definition at line 113 of file ExCParticule.h.

00113 {m_Gravity=Gravity;}

float GetParticuleGrowth void    [inline]
 

Definition at line 83 of file ExCParticule.h.

References m_Growth.

00083 {m_Growth=Growth;}

int GetParticuleLife void    [inline]
 

Definition at line 89 of file ExCParticule.h.

References m_LifeSpan, and m_TotalLife.

Referenced by ExCSystemeParticule::CreateNewParticle().

00089 {m_LifeSpan=life;m_TotalLife=life;}

float GetParticuleMass void    [inline]
 

Definition at line 86 of file ExCParticule.h.

References m_Mass.

00086 {m_Mass=Mass;}

ExCVec3D GetParticulePosition void    [inline]
 

Definition at line 116 of file ExCParticule.h.

00116 {m_Position=Position;}

float GetParticuleSize void    [inline]
 

Definition at line 80 of file ExCParticule.h.

References m_Size.

00080 {m_Size=Size;}

ExCVec3D GetParticuleVelocity void    [inline]
 

Definition at line 107 of file ExCParticule.h.

00107 {m_Velocity=Velocity;}

int GetParticuleWeight void    [inline]
 

Definition at line 92 of file ExCParticule.h.

References m_Weight.

00092 {m_Weight=Weight;}

void PrecalculeParticuleTrajectory int    start,
int    end
 

Definition at line 167 of file ExCParticule.cpp.

References Guard, m_Gravity, m_Position, m_VecPosition, ExCVec3D::m_Vector, m_Velocity, and PrecalculeParticuleTrajectory().

Referenced by ExCSystemeParticule::CreateNewParticle(), and PrecalculeParticuleTrajectory().

00168 {
00169 Guard(void ExCParticule::PrecalculeParticuleTrajectory(int start,int end))
00170         float GravityX,GravityY,GravityZ;
00171         ExCVec3D Position;
00172         for(int i=start;i<end;i++)
00173         {
00174                 GravityX=((i*i)*(m_Gravity.m_Vector[0])/2000);
00175                 GravityY=((i*i)*(m_Gravity.m_Vector[1])/2000);
00176                 GravityZ=((i*i)*(m_Gravity.m_Vector[2])/2000);
00177                                 
00178                 Position.m_Vector[0]=m_Position.m_Vector[0]+(m_Velocity.m_Vector[0]*i)-GravityX;
00179                 Position.m_Vector[1]=m_Position.m_Vector[1]+(m_Velocity.m_Vector[1]*i)-GravityY;
00180                 Position.m_Vector[2]=m_Position.m_Vector[2]+(m_Velocity.m_Vector[2]*i)-GravityZ;        
00181                 m_VecPosition.push_back(Position);
00182         }
00183 UnGuard
00184 }

void SetParticuleAcceleration ExCVec3D    Acceleration [inline]
 

Definition at line 109 of file ExCParticule.h.

Referenced by ExCSystemeParticule::CreateNewParticle().

00110 {m_Acceleration=Acceleration;}

void SetParticuleBlending int    Blending [inline]
 

Definition at line 103 of file ExCParticule.h.

Referenced by ExCSystemeParticule::CreateNewParticle().

00104 {m_Blending=Blending;}

void SetParticuleColorB int    ColorB [inline]
 

Definition at line 100 of file ExCParticule.h.

Referenced by ExCSystemeParticule::CreateNewParticle().

00101 {m_ColorB=ColorB;}

void SetParticuleColorG int    ColorG [inline]
 

Definition at line 97 of file ExCParticule.h.

Referenced by ExCSystemeParticule::CreateNewParticle().

00098 {m_ColorG=ColorG;}

void SetParticuleColorR int    ColorR [inline]
 

Definition at line 94 of file ExCParticule.h.

Referenced by ExCSystemeParticule::CreateNewParticle().

00095 {m_ColorR=ColorR;}

void SetParticuleGravity ExCVec3D    Gravity [inline]
 

Definition at line 112 of file ExCParticule.h.

Referenced by ExCSystemeParticule::CreateNewParticle().

00113 {m_Gravity=Gravity;}

void SetParticuleGrowth float    Growth [inline]
 

Definition at line 82 of file ExCParticule.h.

Referenced by ExCSystemeParticule::CreateNewParticle().

00083 {m_Growth=Growth;}

void SetParticuleLife int    life [inline]
 

Definition at line 88 of file ExCParticule.h.

Referenced by ExCSystemeParticule::CreateNewParticle().

00089 {m_LifeSpan=life;m_TotalLife=life;}

void SetParticuleMass float    Mass [inline]
 

Definition at line 85 of file ExCParticule.h.

Referenced by ExCSystemeParticule::CreateNewParticle().

00086 {m_Mass=Mass;}

void SetParticulePosition ExCVec3D    Position [inline]
 

Definition at line 115 of file ExCParticule.h.

Referenced by ExCSystemeParticule::CreateNewParticle().

00116 {m_Position=Position;}

void SetParticuleSize float    Size [inline]
 

Definition at line 79 of file ExCParticule.h.

Referenced by ExCSystemeParticule::CreateNewParticle().

00080 {m_Size=Size;}

void SetParticuleTexture GLint    texture [inline]
 

Definition at line 77 of file ExCParticule.h.

References m_Texture.

Referenced by ExCSystemeParticule::CreateNewParticle(), and ExCSystemeParticule::SetParticuleTexture().

00078 {m_Texture=texture;}

void SetParticuleType int    type
 

Definition at line 54 of file ExCParticule.cpp.

References Guard, m_Type, and SetParticuleType().

Referenced by ExCSystemeParticule::CreateNewParticle(), ExCSystemeParticule::SetParticuleType(), and SetParticuleType().

00055 {
00056 Guard(void ExCParticule::SetParticuleType(int type))
00057         m_Type=type;
00058         if(m_Type>3)m_Type=1;
00059 UnGuard
00060 }

void SetParticuleVelocity ExCVec3D    Velocity [inline]
 

Definition at line 106 of file ExCParticule.h.

Referenced by ExCSystemeParticule::CreateNewParticle().

00107 {m_Velocity=Velocity;}

void SetParticuleWeight int    Weight [inline]
 

Definition at line 91 of file ExCParticule.h.

Referenced by ExCSystemeParticule::CreateNewParticle().

00092 {m_Weight=Weight;}


Field Documentation

ExCVec3D m_Acceleration [protected]
 

Reimplemented from ExCObject3D.

Definition at line 45 of file ExCParticule.h.

Referenced by ExCParticule().

int m_Blending [protected]
 

Definition at line 57 of file ExCParticule.h.

Referenced by Draw(), and GetParticuleBlending().

int m_ColorB [protected]
 

Definition at line 56 of file ExCParticule.h.

Referenced by Draw(), ExCParticule(), and GetParticuleColorB().

int m_ColorG [protected]
 

Definition at line 55 of file ExCParticule.h.

Referenced by Draw(), ExCParticule(), and GetParticuleColorG().

int m_ColorR [protected]
 

Definition at line 54 of file ExCParticule.h.

Referenced by Draw(), ExCParticule(), and GetParticuleColorR().

ExCVec3D m_Gravity [protected]
 

Reimplemented from ExCObject3D.

Definition at line 46 of file ExCParticule.h.

Referenced by Draw(), ExCParticule(), and PrecalculeParticuleTrajectory().

float m_Growth [protected]
 

Definition at line 49 of file ExCParticule.h.

Referenced by Draw(), ExCParticule(), and GetParticuleGrowth().

std::vector<ExCVec3D>::iterator m_ItVecPosition [protected]
 

Definition at line 60 of file ExCParticule.h.

int m_LifeSpan [protected]
 

Definition at line 50 of file ExCParticule.h.

Referenced by DecreaseLifeSpan(), Draw(), ExCParticule(), and GetParticuleLife().

float m_Mass [protected]
 

Reimplemented from ExCObject3D.

Definition at line 48 of file ExCParticule.h.

Referenced by ExCParticule(), and GetParticuleMass().

ExCVec3D m_Position [protected]
 

Reimplemented from ExCObject3D.

Definition at line 43 of file ExCParticule.h.

Referenced by Draw(), ExCParticule(), and PrecalculeParticuleTrajectory().

float m_Size [protected]
 

Reimplemented from ExCObject3D.

Definition at line 47 of file ExCParticule.h.

Referenced by Draw(), ExCParticule(), and GetParticuleSize().

GLint m_Texture [protected]
 

Definition at line 58 of file ExCParticule.h.

Referenced by Draw(), and SetParticuleTexture().

int m_TotalLife [protected]
 

Definition at line 51 of file ExCParticule.h.

Referenced by Draw(), and GetParticuleLife().

int m_Type [protected]
 

Definition at line 53 of file ExCParticule.h.

Referenced by ExCParticule(), and SetParticuleType().

std::vector<ExCVec3D> m_VecPosition [protected]
 

Definition at line 59 of file ExCParticule.h.

Referenced by Draw(), and PrecalculeParticuleTrajectory().

ExCVec3D m_Velocity [protected]
 

Reimplemented from ExCObject3D.

Definition at line 44 of file ExCParticule.h.

Referenced by Draw(), ExCParticule(), and PrecalculeParticuleTrajectory().

int m_Weight [protected]
 

Definition at line 52 of file ExCParticule.h.

Referenced by ExCParticule(), and GetParticuleWeight().


The documentation for this class was generated from the following files:
Generated on Tue Dec 10 18:20:26 2002 for ExNihilo by doxygen1.3-rc1