#include <ExCSDKParticuleSyteme.h>
|
|
Definition at line 42 of file ExCSDKParticuleSyteme.cpp.
00044 { |
|
Definition at line 63 of file ExCSDKParticuleSyteme.cpp.
00065 { 00066 /* ExCRandomNumber Randomnum; 00067 double a,c; 00068 unsigned int i; 00069 00070 glPushMatrix(); 00071 00072 ExCVec3D Position; 00073 00074 switch(m_TypeEmmeteur) 00075 { 00076 case EMMETEUR_POINT : 00077 Position=m_Position+m_P1; 00078 break; 00079 00080 case EMMETEUR_LIGNE : 00081 case EMMETEUR_RECTANGLE : 00082 case EMMETEUR_CUBE : 00083 Position.SetValue(Randomnum.getFloat(m_P1.m_Vector[0],m_P2.m_Vector[0]), 00084 Randomnum.getFloat(m_P1.m_Vector[1],m_P2.m_Vector[1]), 00085 Randomnum.getFloat(m_P1.m_Vector[2],m_P2.m_Vector[2])); 00086 Position=m_Position+Position; 00087 break; 00088 00089 case EMMETEUR_CERCLE : 00090 a=Cos[m_angle]*m_rayon; 00091 c=Sin[m_angle]*m_rayon; 00092 m_angle=Randomnum.getInt(0,360); 00093 Position.SetValue(a,0.0f,c); 00094 Position=m_Position+Position; 00095 break; 00096 00097 case EMMETEUR_DISQUE : 00098 a=Cos[m_angle]*(Randomnum.getFloat(0.0f,m_rayon)); 00099 c=Sin[m_angle]*(Randomnum.getFloat(0.0f,m_rayon)); 00100 m_angle++; 00101 if(m_angle>360)m_angle=0; 00102 Position.SetValue(a,0.0f,c); 00103 Position=m_Position+Position; 00104 break; 00105 00106 case EMMETEUR_SPIRAL : 00107 a=Cos[m_angle]*m_rayon; 00108 c=Sin[m_angle]*m_rayon; 00109 m_angle+=m_vitesseangle; 00110 if(m_angle>360)m_angle=0; 00111 Position.SetValue(a,0.0f,c); 00112 Position=m_Position+Position; 00113 break; 00114 } 00115 00116 time_t ltime; 00117 time( <ime ); 00118 00119 // create new particule 00120 if(!m_Pause) 00121 { 00122 if(m_TimeLastParticule<ltime) 00123 { 00124 ExCSDKParticule Particule; 00125 ExCVec3D Velocity,Acceleration,Gravity; 00126 Particule.SetParticuleTexture(m_Texture); 00127 Particule.SetParticuleType(m_Type); 00128 Particule.SetParticulePosition(Position); 00129 Particule.SetParticuleLife(Randomnum.getInt(m_MinLifeSpan,m_MaxLifeSpan)); 00130 Particule.SetParticuleWeight(Randomnum.getInt(m_MinWeight,m_MaxWeight)); 00131 Particule.SetParticuleColorB(Randomnum.getInt(m_MinColorB,m_MaxColorB)); 00132 Particule.SetParticuleColorG(Randomnum.getInt(m_MinColorG,m_MaxColorG)); 00133 Particule.SetParticuleColorR(Randomnum.getInt(m_MinColorR,m_MaxColorR)); 00134 Particule.SetParticuleBlending(Randomnum.getInt(m_MinBlending,m_MaxBlending)); 00135 Particule.SetParticuleMass(1.0f); 00136 //Particule.SetParticuleSize(Randomnum.getFloat (m_MinSize,m_MaxSize)); 00137 Velocity.m_Vector[0]=Randomnum.getFloat(m_MaxVelocity.m_Vector[0],m_MinVelocity.m_Vector[0]); 00138 Velocity.m_Vector[1]=Randomnum.getFloat(m_MaxVelocity.m_Vector[1],m_MinVelocity.m_Vector[1]); 00139 Velocity.m_Vector[2]=Randomnum.getFloat(m_MaxVelocity.m_Vector[2],m_MinVelocity.m_Vector[2]); 00140 Particule.SetParticuleVelocity(Velocity); 00141 Acceleration.m_Vector[0]=Randomnum.getFloat(m_MaxAcceleration.m_Vector[0],m_MinAcceleration.m_Vector[0]); 00142 Acceleration.m_Vector[1]=Randomnum.getFloat(m_MaxAcceleration.m_Vector[1],m_MinAcceleration.m_Vector[1]); 00143 Acceleration.m_Vector[2]=Randomnum.getFloat(m_MaxAcceleration.m_Vector[2],m_MinAcceleration.m_Vector[2]); 00144 Particule.SetParticuleAcceleration(Acceleration); 00145 Gravity.m_Vector[0]=Randomnum.getFloat(m_MaxGravity.m_Vector[0],m_MinGravity.m_Vector[0]); 00146 Gravity.m_Vector[1]=Randomnum.getFloat(m_MaxGravity.m_Vector[1],m_MinGravity.m_Vector[1]); 00147 Gravity.m_Vector[2]=Randomnum.getFloat(m_MaxGravity.m_Vector[2],m_MinGravity.m_Vector[2]); 00148 Particule.SetParticuleGravity(Gravity); 00149 Particule.PrecalculeParticuleTrajectory(0,Particule.GetParticuleLife()); 00150 m_VecParticule.push_back(Particule); 00151 } 00152 } 00153 glPopMatrix(); 00154 00155 if(m_VecParticule.size()>0) 00156 { 00157 00158 for(i=0,m_ItVecParticule=m_VecParticule.begin();i<m_VecParticule.size();m_ItVecParticule++,i++) 00159 { 00160 m_ItVecParticule->Draw(); 00161 if(!m_Pause)m_ItVecParticule->DecreaseLifeSpan(); 00162 if(!m_State)m_ItVecParticule->DecreaseLifeSpan(); 00163 if(m_ItVecParticule->GetParticuleLife()<0) 00164 { 00165 m_VecParticule.erase(m_ItVecParticule); 00166 } 00167 } 00168 }*/ |
|
Definition at line 144 of file ExCSDKParticuleSyteme.h.
00144 {m_MaxAcceleration=Acceleration;} |
|
Definition at line 134 of file ExCSDKParticuleSyteme.h. References m_MaxBlending.
00134 {m_MaxBlending=Blending;} |
|
Definition at line 129 of file ExCSDKParticuleSyteme.h. References m_MaxColorB.
00129 {m_MaxColorB=ColorB;} |
|
Definition at line 124 of file ExCSDKParticuleSyteme.h. References m_MaxColorG.
00124 {m_MaxColorG=ColorG;} |
|
Definition at line 119 of file ExCSDKParticuleSyteme.h. References m_MaxColorR.
00119 {m_MaxColorR=ColorR;} |
|
Definition at line 104 of file ExCSDKParticuleSyteme.h. References m_MaxLifeSpan.
00104 {m_MaxLifeSpan=life;} |
|
Definition at line 109 of file ExCSDKParticuleSyteme.h. References m_MaxSize.
00109 {m_MaxSize=Size;} |
|
Definition at line 139 of file ExCSDKParticuleSyteme.h.
00139 {m_MaxVelocity=Velocity;} |
|
Definition at line 114 of file ExCSDKParticuleSyteme.h. References m_MaxWeight.
00114 {m_MaxWeight=Weight;} |
|
Definition at line 146 of file ExCSDKParticuleSyteme.h.
00146 {m_MinAcceleration=Acceleration;} |
|
Definition at line 136 of file ExCSDKParticuleSyteme.h. References m_MinBlending.
00136 {m_MinBlending=Blending;} |
|
Definition at line 131 of file ExCSDKParticuleSyteme.h. References m_MinColorB.
00131 {m_MinColorB=ColorB;} |
|
Definition at line 126 of file ExCSDKParticuleSyteme.h. References m_MinColorG.
00126 {m_MinColorG=ColorG;} |
|
Definition at line 121 of file ExCSDKParticuleSyteme.h. References m_MinColorR.
00121 {m_MinColorR=ColorR;} |
|
Definition at line 106 of file ExCSDKParticuleSyteme.h. References m_MinLifeSpan.
00106 {m_MinLifeSpan=life;} |
|
Definition at line 111 of file ExCSDKParticuleSyteme.h. References m_MinSize.
00111 {m_MinSize=Size;} |
|
Definition at line 141 of file ExCSDKParticuleSyteme.h.
00141 {m_MinVelocity=Velocity;} |
|
Definition at line 116 of file ExCSDKParticuleSyteme.h. References m_MinWeight.
00116 {m_MinWeight=Weight;} |
|
Definition at line 94 of file ExCSDKParticuleSyteme.h. References m_ParticuleSystemeName.
00095 {return m_ParticuleSystemeName;} |
|
Definition at line 97 of file ExCSDKParticuleSyteme.h.
00098 {return m_State;} |
|
Definition at line 191 of file ExCSDKParticuleSyteme.cpp.
00193 { 00194 /* SetParticuleTexture("star"); 00195 m_Type=PARTICULE_TEXTURE; 00196 00197 int i=0; 00198 char ch; 00199 int FileSize; 00200 FILE *MyFile; 00201 bool endfile=false; 00202 std::string StBuffer; 00203 char buffer[255],bufferbis[255]; 00204 std::vector<float> vecvalue; 00205 00206 00207 sprintf(buffer,"../Data/ParticuleSystem/%s",FileName); 00208 m_ParticuleSystemeName=new char[strlen(FileName)]; 00209 sprintf(m_ParticuleSystemeName,"%s",FileName); 00210 00211 MyFile=fopen (buffer,"r"); 00212 if(!MyFile) 00213 { 00214 sprintf(bufferbis,"Particule syteme File not found:%s",buffer); 00215 AfxMessageBox(bufferbis); 00216 return false; 00217 }else 00218 { 00219 sprintf(buffer,"Loading Particule systeme file :%s",FileName); 00220 AfxMessageBox(buffer); 00221 00222 fseek(MyFile,0,SEEK_END); 00223 FileSize=ftell(MyFile); 00224 sprintf(bufferbis,"Size:%d",FileSize); 00225 AfxMessageBox(bufferbis); 00226 //Start of file 00227 fseek(MyFile,0,SEEK_SET); 00228 do 00229 { 00230 fread(&ch,sizeof(char),1,MyFile); 00231 }while(ch!='#'); 00232 //reading file type; 00233 do 00234 { 00235 fread(&ch,sizeof(char),1,MyFile); 00236 StBuffer=StBuffer+ch; 00237 }while(ch!='#'); 00238 if(strcmp(StBuffer.data(),"particulesystem#")==0) 00239 { 00240 for(i=0;i<44;i++) 00241 { 00242 StBuffer.erase(StBuffer.begin(),StBuffer.end()); 00243 do 00244 { 00245 fread(&ch,sizeof(char),1,MyFile); 00246 StBuffer=StBuffer+ch; 00247 }while(ch!='#'); 00248 StBuffer.erase(StBuffer.begin(),StBuffer.end()); 00249 do 00250 { 00251 fread(&ch,sizeof(char),1,MyFile); 00252 StBuffer=StBuffer+ch; 00253 }while(ch!='#'); 00254 00255 StBuffer.erase(StBuffer.end()-1,StBuffer.end()); 00256 00257 try 00258 { 00259 vecvalue.push_back(atof(StBuffer.data())); 00260 }catch(...) 00261 { 00262 vecvalue.push_back(0); 00263 } 00264 } 00265 00266 00267 //read texture for particule 00268 StBuffer.erase(StBuffer.begin(),StBuffer.end()); 00269 do 00270 { 00271 fread(&ch,sizeof(char),1,MyFile); 00272 StBuffer=StBuffer+ch; 00273 }while(ch!='#'); 00274 00275 StBuffer.erase(StBuffer.begin(),StBuffer.end()); 00276 do 00277 { 00278 fread(&ch,sizeof(char),1,MyFile); 00279 StBuffer=StBuffer+ch; 00280 }while(ch!='#'); 00281 StBuffer.erase(StBuffer.end()-1,StBuffer.end()); 00282 00283 SetParticuleTexture((char *)StBuffer.data()); 00284 //----------------------------------- 00285 m_EmissionRate =vecvalue.at(0); 00286 m_MaxParticule =vecvalue.at(1); 00287 m_TypeEmmeteur=vecvalue.at(2); 00288 m_P1.SetValue(vecvalue.at(3),vecvalue.at(4),vecvalue.at(5)); 00289 m_P2.SetValue(vecvalue.at(6),vecvalue.at(7),vecvalue.at(8)); 00290 m_rayon=vecvalue.at(9); 00291 m_vitesseangle=vecvalue.at(10); 00292 m_MaxLifeSpan = vecvalue.at(11); 00293 m_MinLifeSpan = vecvalue.at(12); 00294 m_MaxSize = vecvalue.at(13); 00295 m_MinSize = vecvalue.at(14); 00296 m_MaxWeight = vecvalue.at(15); 00297 m_MinWeight = vecvalue.at(16); 00298 m_MaxColorR = vecvalue.at(17); 00299 m_MinColorR = vecvalue.at(18); 00300 m_MaxColorG = vecvalue.at(19); 00301 m_MinColorG = vecvalue.at(20); 00302 m_MaxColorB = vecvalue.at(21); 00303 m_MinColorB = vecvalue.at(22); 00304 m_MaxBlending = vecvalue.at(23); 00305 m_MinBlending = vecvalue.at(24); 00306 m_MaxVelocity.SetValue(vecvalue.at(25),vecvalue.at(26),vecvalue.at(27)); 00307 m_MinVelocity.SetValue(vecvalue.at(28),vecvalue.at(29),vecvalue.at(30)); 00308 m_MaxAcceleration.SetValue(vecvalue.at(31),vecvalue.at(32),vecvalue.at(33)); 00309 m_MinAcceleration.SetValue(vecvalue.at(34),vecvalue.at(35),vecvalue.at(36)); 00310 m_MaxGravity.SetValue(vecvalue.at(37),vecvalue.at(38),vecvalue.at(39)); 00311 m_MinGravity.SetValue(vecvalue.at(40),vecvalue.at(41),vecvalue.at(42)); 00312 00313 m_Type = vecvalue.at(43); 00314 00315 return true; 00316 }else 00317 { 00318 sprintf(buffer,"%s is not a valide particule syteme file",FileName); 00319 AfxMessageBox(buffer); 00320 return false; 00321 } 00322 fclose(MyFile); 00323 }*/ 00324 return false; |
|
Definition at line 187 of file ExCSDKParticuleSyteme.cpp. Referenced by SetParticuleTexture().
00189 { 00190 return true; |
|
Definition at line 176 of file ExCSDKParticuleSyteme.cpp. References m_Pause.
00178 { 00179 m_Pause=true; |
|
|
|
Definition at line 143 of file ExCSDKParticuleSyteme.h.
00144 {m_MaxAcceleration=Acceleration;} |
|
Definition at line 133 of file ExCSDKParticuleSyteme.h.
00134 {m_MaxBlending=Blending;} |
|
Definition at line 128 of file ExCSDKParticuleSyteme.h.
00129 {m_MaxColorB=ColorB;} |
|
Definition at line 123 of file ExCSDKParticuleSyteme.h.
00124 {m_MaxColorG=ColorG;} |
|
Definition at line 118 of file ExCSDKParticuleSyteme.h.
00119 {m_MaxColorR=ColorR;} |
|
Definition at line 103 of file ExCSDKParticuleSyteme.h.
00104 {m_MaxLifeSpan=life;} |
|
Definition at line 108 of file ExCSDKParticuleSyteme.h.
00109 {m_MaxSize=Size;} |
|
Definition at line 138 of file ExCSDKParticuleSyteme.h.
00139 {m_MaxVelocity=Velocity;} |
|
Definition at line 113 of file ExCSDKParticuleSyteme.h.
00114 {m_MaxWeight=Weight;} |
|
Definition at line 145 of file ExCSDKParticuleSyteme.h.
00145 {return m_MaxAcceleration;} |
|
Definition at line 135 of file ExCSDKParticuleSyteme.h. References m_MaxBlending.
00135 {return m_MaxBlending;} |
|
Definition at line 130 of file ExCSDKParticuleSyteme.h. References m_MaxColorB.
00130 {return m_MaxColorB;} |
|
Definition at line 125 of file ExCSDKParticuleSyteme.h. References m_MaxColorG.
00125 {return m_MaxColorG;} |
|
Definition at line 120 of file ExCSDKParticuleSyteme.h. References m_MaxColorR.
00120 {return m_MaxColorR;} |
|
Definition at line 105 of file ExCSDKParticuleSyteme.h. References m_MaxLifeSpan.
00105 {return m_MaxLifeSpan;} |
|
Definition at line 110 of file ExCSDKParticuleSyteme.h. References m_MaxSize.
00110 {return m_MaxSize;} |
|
Definition at line 140 of file ExCSDKParticuleSyteme.h.
00140 {return m_MaxVelocity;} |
|
Definition at line 115 of file ExCSDKParticuleSyteme.h. References m_MaxWeight.
00115 {return m_MaxWeight;} |
|
Definition at line 46 of file ExCSDKParticuleSyteme.cpp. References m_ParticuleSystemeName.
00048 { 00049 m_ParticuleSystemeName=new char[strlen(name)]; 00050 strcpy(m_ParticuleSystemeName,name); |
|
Definition at line 98 of file ExCSDKParticuleSyteme.h. References m_State.
00098 {return m_State;} |
|
Definition at line 58 of file ExCSDKParticuleSyteme.cpp. References LoadTexture().
00060 { 00061 LoadTexture(texture); |
|
Definition at line 52 of file ExCSDKParticuleSyteme.cpp. References m_Type.
|
|
Definition at line 170 of file ExCSDKParticuleSyteme.cpp. References m_Pause, and m_State.
|
|
Definition at line 181 of file ExCSDKParticuleSyteme.cpp. References m_Pause, and m_State.
|
|
Definition at line 50 of file ExCSDKParticuleSyteme.h. Referenced by ExCSDKParticuleSyteme(). |
|
Definition at line 42 of file ExCSDKParticuleSyteme.h. Referenced by ExCSDKParticuleSyteme(). |
|
Definition at line 32 of file ExCSDKParticuleSyteme.h. |
|
Definition at line 74 of file ExCSDKParticuleSyteme.h. Referenced by ExCSDKParticuleSyteme(). |
|
Definition at line 70 of file ExCSDKParticuleSyteme.h. Referenced by ExCSDKParticuleSyteme(), GetParticuleMaxBlending(), and SetParticuleMinBlending(). |
|
Definition at line 68 of file ExCSDKParticuleSyteme.h. Referenced by ExCSDKParticuleSyteme(), GetParticuleMaxColorB(), and SetParticuleMinColorB(). |
|
Definition at line 66 of file ExCSDKParticuleSyteme.h. Referenced by ExCSDKParticuleSyteme(), GetParticuleMaxColorG(), and SetParticuleMinColorG(). |
|
Definition at line 64 of file ExCSDKParticuleSyteme.h. Referenced by ExCSDKParticuleSyteme(), GetParticuleMaxColorR(), and SetParticuleMinColorR(). |
|
Definition at line 76 of file ExCSDKParticuleSyteme.h. Referenced by ExCSDKParticuleSyteme(). |
|
Definition at line 58 of file ExCSDKParticuleSyteme.h. Referenced by ExCSDKParticuleSyteme(), GetParticuleMaxLife(), and SetParticuleMinLife(). |
|
Definition at line 43 of file ExCSDKParticuleSyteme.h. Referenced by ExCSDKParticuleSyteme(). |
|
Definition at line 60 of file ExCSDKParticuleSyteme.h. Referenced by ExCSDKParticuleSyteme(), GetParticuleMaxSize(), and SetParticuleMinSize(). |
|
Definition at line 72 of file ExCSDKParticuleSyteme.h. Referenced by ExCSDKParticuleSyteme(). |
|
Definition at line 62 of file ExCSDKParticuleSyteme.h. Referenced by ExCSDKParticuleSyteme(), GetParticuleMaxWeight(), and SetParticuleMinWeight(). |
|
Definition at line 75 of file ExCSDKParticuleSyteme.h. Referenced by ExCSDKParticuleSyteme(). |
|
Definition at line 71 of file ExCSDKParticuleSyteme.h. Referenced by ExCSDKParticuleSyteme(), and GetParticuleMinBlending(). |
|
Definition at line 69 of file ExCSDKParticuleSyteme.h. Referenced by ExCSDKParticuleSyteme(), and GetParticuleMinColorB(). |
|
Definition at line 67 of file ExCSDKParticuleSyteme.h. Referenced by ExCSDKParticuleSyteme(), and GetParticuleMinColorG(). |
|
Definition at line 65 of file ExCSDKParticuleSyteme.h. Referenced by ExCSDKParticuleSyteme(), and GetParticuleMinColorR(). |
|
Definition at line 77 of file ExCSDKParticuleSyteme.h. Referenced by ExCSDKParticuleSyteme(). |
|
Definition at line 59 of file ExCSDKParticuleSyteme.h. Referenced by ExCSDKParticuleSyteme(), and GetParticuleMinLife(). |
|
Definition at line 61 of file ExCSDKParticuleSyteme.h. Referenced by ExCSDKParticuleSyteme(), and GetParticuleMinSize(). |
|
Definition at line 73 of file ExCSDKParticuleSyteme.h. Referenced by ExCSDKParticuleSyteme(). |
|
Definition at line 63 of file ExCSDKParticuleSyteme.h. Referenced by ExCSDKParticuleSyteme(), and GetParticuleMinWeight(). |
|
Definition at line 45 of file ExCSDKParticuleSyteme.h. Referenced by ExCSDKParticuleSyteme(). |
|
Definition at line 46 of file ExCSDKParticuleSyteme.h. Referenced by ExCSDKParticuleSyteme(). |
|
Definition at line 39 of file ExCSDKParticuleSyteme.h. Referenced by ExCSDKParticuleSyteme(), GetParticuleSystemeName(), and SetParticuleSystemeName(). |
|
Definition at line 36 of file ExCSDKParticuleSyteme.h. Referenced by ExCSDKParticuleSyteme(), Pause(), Start(), and Stop(). |
|
Definition at line 47 of file ExCSDKParticuleSyteme.h. |
|
Definition at line 49 of file ExCSDKParticuleSyteme.h. Referenced by ExCSDKParticuleSyteme(). |
|
Definition at line 35 of file ExCSDKParticuleSyteme.h. Referenced by ExCSDKParticuleSyteme(), SetParticuleSystemeState(), Start(), and Stop(). |
|
Definition at line 54 of file ExCSDKParticuleSyteme.h. |
|
Definition at line 38 of file ExCSDKParticuleSyteme.h. Referenced by ExCSDKParticuleSyteme(). |
|
Definition at line 57 of file ExCSDKParticuleSyteme.h. Referenced by ExCSDKParticuleSyteme(), and SetParticuleType(). |
|
Definition at line 44 of file ExCSDKParticuleSyteme.h. Referenced by ExCSDKParticuleSyteme(). |
|
Definition at line 31 of file ExCSDKParticuleSyteme.h. |
|
Definition at line 51 of file ExCSDKParticuleSyteme.h. |