#include "./pDomain.h"
#include <stdlib.h>
Go to the source code of this file.
Defines | |
#define | P_VERSION 200 |
#define | PARTICLEDLL_API |
#define | P_MAXFLOAT 1.0e16f |
#define | P_MAXINT 0x7fffffff |
#define | P_EPS 1e-3f |
Typedefs | |
typedef void(* | P_PARTICLE_CALLBACK )(struct Particle &particle, void *data) |
Enumerations | |
enum | ErrorCodes { PERR_NO_ERROR = 0, PERR_NOT_IMPLEMENTED = 1, PERR_INTERNAL_ERROR = 2 } |
Functions | |
PARTICLEDLL_API void | pColor (float red, float green, float blue, float alpha=1.0f) |
PARTICLEDLL_API void | pColorD (const pDomain &cdom) |
PARTICLEDLL_API void | pColorD (const pDomain &cdom, const pDomain &adom) |
PARTICLEDLL_API void | pSize (const pVec &size) |
PARTICLEDLL_API void | pSizeD (const pDomain &dom) |
PARTICLEDLL_API void | pMass (float mass) |
PARTICLEDLL_API void | pStartingAge (float age, float sigma=1.0f) |
PARTICLEDLL_API void | pTimeStep (float new_dt) |
PARTICLEDLL_API void | pUpVec (const pVec &v) |
PARTICLEDLL_API void | pUpVecD (const pDomain &dom) |
PARTICLEDLL_API void | pVelocity (const pVec &vel) |
PARTICLEDLL_API void | pVelocityD (const pDomain &dom) |
PARTICLEDLL_API void | pRotVelocity (const pVec &v) |
PARTICLEDLL_API void | pRotVelocityD (const pDomain &dom) |
PARTICLEDLL_API void | pVertexB (const pVec &v) |
PARTICLEDLL_API void | pVertexBD (const pDomain &dom) |
PARTICLEDLL_API void | pVertexBTracks (bool track_vertex=true) |
PARTICLEDLL_API void | pCallActionList (int action_list_num) |
PARTICLEDLL_API void | pDeleteActionLists (int action_list_num, int action_list_count=1) |
PARTICLEDLL_API void | pEndActionList () |
PARTICLEDLL_API int | pGenActionLists (int action_list_count=1) |
PARTICLEDLL_API void | pNewActionList (int action_list_num) |
PARTICLEDLL_API void | pCopyGroup (int p_src_group_num, size_t index=0, size_t copy_count=P_MAXINT) |
PARTICLEDLL_API void | pCurrentGroup (int p_group_num) |
PARTICLEDLL_API void | pDeleteParticleGroups (int p_group_num, int p_group_count=1) |
PARTICLEDLL_API int | pGenParticleGroups (int p_group_count=1, size_t max_particles=0) |
PARTICLEDLL_API size_t | pGetGroupCount () |
PARTICLEDLL_API size_t | pGetParticles (size_t index, size_t count, float *position=NULL, float *color=NULL, float *vel=NULL, float *size=NULL, float *age=NULL) |
PARTICLEDLL_API size_t | pGetParticlePointer (float *&ptr, size_t &stride, size_t &pos3Ofs, size_t &posB3Ofs, size_t &size3Ofs, size_t &vel3Ofs, size_t &velB3Ofs, size_t &color3Ofs, size_t &alpha1Ofs, size_t &age1Ofs) |
PARTICLEDLL_API size_t | pSetMaxParticles (size_t max_count) |
PARTICLEDLL_API size_t | pGetMaxParticles () |
PARTICLEDLL_API void | pAvoid (float magnitude, float epsilon, float look_ahead, const pDomain &dom) |
PARTICLEDLL_API void | pBounce (float friction, float resilience, float cutoff, const pDomain &dom) |
PARTICLEDLL_API void | pCopyVertexB (bool copy_pos=true, bool copy_vel=false) |
PARTICLEDLL_API void | pDamping (const pVec &damping, float vlow=0.0f, float vhigh=P_MAXFLOAT) |
PARTICLEDLL_API void | pRotDamping (const pVec &damping, float vlow=0.0f, float vhigh=P_MAXFLOAT) |
PARTICLEDLL_API void | pExplosion (const pVec ¢er, float velocity, float magnitude, float stdev, float epsilon=P_EPS, float age=0.0f) |
PARTICLEDLL_API void | pFollow (float magnitude=1.0f, float epsilon=P_EPS, float max_radius=P_MAXFLOAT) |
PARTICLEDLL_API void | pFountain () |
PARTICLEDLL_API void | pGravitate (float magnitude=1.0f, float epsilon=P_EPS, float max_radius=P_MAXFLOAT) |
PARTICLEDLL_API void | pGravity (const pVec &dir) |
PARTICLEDLL_API void | pJet (const pDomain &dom, const pDomain &acc) |
PARTICLEDLL_API void | pKillOld (float age_limit, bool kill_less_than=false) |
PARTICLEDLL_API void | pMatchVelocity (float magnitude=1.0f, float epsilon=P_EPS, float max_radius=P_MAXFLOAT) |
PARTICLEDLL_API void | pMatchRotVelocity (float magnitude=1.0f, float epsilon=P_EPS, float max_radius=P_MAXFLOAT) |
PARTICLEDLL_API void | pMove () |
PARTICLEDLL_API void | pOrbitLine (const pVec &p, const pVec &axis, float magnitude=1.0f, float epsilon=P_EPS, float max_radius=P_MAXFLOAT) |
PARTICLEDLL_API void | pOrbitPoint (const pVec ¢er, float magnitude=1.0f, float epsilon=P_EPS, float max_radius=P_MAXFLOAT) |
PARTICLEDLL_API void | pRandomAccel (const pDomain &dom) |
PARTICLEDLL_API void | pRandomDisplace (const pDomain &dom) |
PARTICLEDLL_API void | pRandomVelocity (const pDomain &dom) |
PARTICLEDLL_API void | pRandomRotVelocity (const pDomain &dom) |
PARTICLEDLL_API void | pRestore (float time, bool vel=true, bool rvel=true) |
PARTICLEDLL_API void | pSink (bool kill_inside, const pDomain &dom) |
PARTICLEDLL_API void | pSinkVelocity (bool kill_inside, const pDomain &dom) |
PARTICLEDLL_API void | pSort (const pVec &eye, const pVec &look) |
PARTICLEDLL_API void | pSource (float particle_rate, const pDomain &dom) |
PARTICLEDLL_API void | pSpeedLimit (float min_speed, float max_speed=P_MAXFLOAT) |
PARTICLEDLL_API void | pTargetColor (const pVec &color, float alpha, float scale) |
PARTICLEDLL_API void | pTargetSize (const pVec &size, const pVec &scale) |
PARTICLEDLL_API void | pTargetVelocity (const pVec &vel, float scale) |
PARTICLEDLL_API void | pTargetRotVelocity (const pVec &vel, float scale) |
PARTICLEDLL_API void | pVertex (const pVec &v, long data=0) |
PARTICLEDLL_API void | pVortex (const pVec ¢er, const pVec &axis, float magnitude=1.0f, float tightnessExponent=1.0f, float rotSpeed=1.0f, float epsilon=P_EPS, float max_radius=P_MAXFLOAT) |
PARTICLEDLL_API void | pBirthCallback (P_PARTICLE_CALLBACK callback, void *data=NULL) |
PARTICLEDLL_API void | pDeathCallback (P_PARTICLE_CALLBACK callback, void *data=NULL) |
PARTICLEDLL_API void | pReset () |
PARTICLEDLL_API void | pSeed (unsigned int seed) |
PARTICLEDLL_API int | pGetError () |
#define P_EPS 1e-3f |
typedef void(* P_PARTICLE_CALLBACK)(struct Particle &particle, void *data) |
enum ErrorCodes |
Definition at line 207 of file papi.h.
00207 { 00208 PERR_NO_ERROR = 0, 00209 PERR_NOT_IMPLEMENTED = 1, 00210 PERR_INTERNAL_ERROR = 2 00211 };
PARTICLEDLL_API void pAvoid | ( | float | magnitude, | |
float | epsilon, | |||
float | look_ahead, | |||
const pDomain & | dom | |||
) |
Definition at line 12 of file action_api.cpp.
References _GetPState(), pDomain::copy(), PAAvoid::epsilon, PAAvoid::look_ahead, PAAvoid::magnitude, PAAvoid::position, ParticleState::SendAction(), PActionBase::SetDoNotSegment(), and PActionBase::SetKillsParticles().
00013 { 00014 PAAvoid *S = new PAAvoid(); 00015 00016 S->position = dom.copy(); 00017 S->magnitude = magnitude; 00018 S->epsilon = epsilon; 00019 S->look_ahead = look_ahead; 00020 00021 S->SetKillsParticles(false); 00022 S->SetDoNotSegment(false); 00023 00024 _GetPState().SendAction(S); 00025 }
PARTICLEDLL_API void pBirthCallback | ( | P_PARTICLE_CALLBACK | callback, | |
void * | data = NULL | |||
) |
Definition at line 546 of file other_api.cpp.
References _GetPState(), ParticleState::GetPGroup(), ParticleState::in_new_list, ParticleState::pgroup_id, and ParticleGroup::SetBirthCallback().
00547 { 00548 ParticleState &PS = _GetPState(); 00549 if(PS.in_new_list) 00550 return; // ERROR 00551 00552 PS.GetPGroup(PS.pgroup_id).SetBirthCallback(callback, data); 00553 }
PARTICLEDLL_API void pBounce | ( | float | friction, | |
float | resilience, | |||
float | cutoff, | |||
const pDomain & | dom | |||
) |
Definition at line 27 of file action_api.cpp.
References _GetPState(), pDomain::copy(), PABounce::cutoffSqr, fsqr(), PABounce::oneMinusFriction, PABounce::position, PABounce::resilience, ParticleState::SendAction(), PActionBase::SetDoNotSegment(), and PActionBase::SetKillsParticles().
Referenced by gSpark::Timestep().
00028 { 00029 PABounce *S = new PABounce(); 00030 00031 S->position = dom.copy(); 00032 S->oneMinusFriction = 1.0f - friction; 00033 S->resilience = resilience; 00034 S->cutoffSqr = fsqr(cutoff); 00035 00036 S->SetKillsParticles(false); 00037 S->SetDoNotSegment(false); 00038 00039 _GetPState().SendAction(S); 00040 }
PARTICLEDLL_API void pCallActionList | ( | int | action_list_num | ) |
Definition at line 249 of file other_api.cpp.
References _GetPState(), _PLock(), _PUnLock(), PACallActionList::action_list_num, ParticleState::ALists, ParticleState::ExecuteActionList(), ParticleState::in_new_list, and ParticleState::SendAction().
00250 { 00251 ParticleState &PS = _GetPState(); 00252 00253 if(PS.in_new_list) { 00254 // Add this call as an action to the current list. 00255 PACallActionList *S = new PACallActionList; 00256 S->action_list_num = action_list_num; 00257 00258 PS.SendAction(S); 00259 } else { 00260 // Execute the specified action list. 00261 _PLock(); 00262 00263 if(action_list_num < 0 || action_list_num >= (int)PS.ALists.size()) 00264 return; // ERROR 00265 00266 ActionList &AList = PS.ALists[action_list_num]; 00267 00268 // Not sure it's safe to unlock here since AList can be accessed by another thread while 00269 // we're executing it, but we can't stay locked while doing all the actions or it's not parallel. 00270 _PUnLock(); 00271 00272 PS.ExecuteActionList(AList); 00273 } 00274 }
PARTICLEDLL_API void pColor | ( | float | red, | |
float | green, | |||
float | blue, | |||
float | alpha = 1.0f | |||
) |
Definition at line 36 of file other_api.cpp.
References _GetPState(), ParticleState::Alpha, and ParticleState::Color.
00037 { 00038 ParticleState &PS = _GetPState(); 00039 00040 delete PS.Color; 00041 delete PS.Alpha; 00042 PS.Color = new PDPoint(pVec(red, green, blue)); 00043 PS.Alpha = new PDPoint(pVec(alpha)); 00044 }
Definition at line 55 of file other_api.cpp.
References _GetPState(), ParticleState::Alpha, ParticleState::Color, and pDomain::copy().
00056 { 00057 ParticleState &PS = _GetPState(); 00058 00059 delete PS.Color; 00060 delete PS.Alpha; 00061 PS.Color = cdom.copy(); 00062 PS.Alpha = adom.copy(); 00063 }
PARTICLEDLL_API void pColorD | ( | const pDomain & | cdom | ) |
Definition at line 46 of file other_api.cpp.
References _GetPState(), ParticleState::Alpha, ParticleState::Color, and pDomain::copy().
Referenced by gSpark::Timestep().
00047 { 00048 ParticleState &PS = _GetPState(); 00049 delete PS.Color; 00050 delete PS.Alpha; 00051 PS.Color = cdom.copy(); 00052 PS.Alpha = new PDPoint(pVec(1)); 00053 }
PARTICLEDLL_API void pCopyGroup | ( | int | p_src_group_num, | |
size_t | index = 0 , |
|||
size_t | copy_count = P_MAXINT | |||
) |
Definition at line 357 of file other_api.cpp.
References _GetPState(), _PLock(), _PUnLock(), ParticleGroup::Add(), ParticleGroup::GetList(), ParticleGroup::GetMaxParticles(), ParticleState::GetPGroup(), ParticleState::in_new_list, ParticleState::pgroup_id, ParticleState::PGroups, and ParticleGroup::size().
00358 { 00359 ParticleState &PS = _GetPState(); 00360 00361 if(PS.in_new_list) 00362 return; // ERROR 00363 00364 _PLock(); 00365 00366 if(p_src_group_num < 0 || p_src_group_num >= (int)PS.PGroups.size()) 00367 return; // ERROR 00368 00369 ParticleGroup &srcgrp = PS.GetPGroup(p_src_group_num); 00370 00371 ParticleGroup &destgrp = PS.GetPGroup(PS.pgroup_id); 00372 00373 // Find out exactly how many to copy. 00374 size_t ccount = copy_count; 00375 if(ccount > srcgrp.size() - index) 00376 ccount = srcgrp.size() - index; 00377 if(ccount > destgrp.GetMaxParticles() - destgrp.size()) 00378 ccount = destgrp.GetMaxParticles() - destgrp.size(); 00379 00380 // useless test, can never be negative 00381 // if(ccount<0) 00382 // ccount = 0; 00383 00384 // Directly copy the particles to the current list. 00385 for(size_t i=0; i<ccount; i++) { 00386 // Is it bad to call a birth callback while locked? 00387 destgrp.Add(srcgrp.GetList()[index+i]); 00388 } 00389 00390 _PUnLock(); 00391 }
PARTICLEDLL_API void pCopyVertexB | ( | bool | copy_pos = true , |
|
bool | copy_vel = false | |||
) |
Definition at line 42 of file action_api.cpp.
References _GetPState(), PACopyVertexB::copy_pos, PACopyVertexB::copy_vel, ParticleState::SendAction(), PActionBase::SetDoNotSegment(), and PActionBase::SetKillsParticles().
00043 { 00044 PACopyVertexB *S = new PACopyVertexB; 00045 00046 S->copy_pos = copy_pos; 00047 S->copy_vel = copy_vel; 00048 00049 S->SetKillsParticles(false); 00050 S->SetDoNotSegment(false); 00051 00052 _GetPState().SendAction(S); 00053 }
PARTICLEDLL_API void pCurrentGroup | ( | int | p_group_num | ) |
Definition at line 321 of file other_api.cpp.
References _GetPState(), _PLock(), _PUnLock(), ParticleState::in_new_list, ParticleState::pgroup_id, and ParticleState::PGroups.
Referenced by gSpark::gSpark(), gSpark::Render(), and gSpark::Timestep().
00322 { 00323 ParticleState &PS = _GetPState(); 00324 00325 if(PS.in_new_list) 00326 return; // ERROR 00327 00328 _PLock(); 00329 00330 if(p_group_num < 0 || p_group_num >= (int)PS.PGroups.size()) 00331 return; // ERROR 00332 00333 _PUnLock(); 00334 00335 PS.pgroup_id = p_group_num; 00336 }
PARTICLEDLL_API void pDamping | ( | const pVec & | damping, | |
float | vlow = 0.0f , |
|||
float | vhigh = P_MAXFLOAT | |||
) |
Definition at line 55 of file action_api.cpp.
References _GetPState(), PADamping::damping, fsqr(), ParticleState::SendAction(), PActionBase::SetDoNotSegment(), PActionBase::SetKillsParticles(), PADamping::vhighSqr, and PADamping::vlowSqr.
00057 { 00058 PADamping *S = new PADamping; 00059 00060 S->damping = damping; 00061 S->vlowSqr = fsqr(vlow); 00062 S->vhighSqr = fsqr(vhigh); 00063 00064 S->SetKillsParticles(false); 00065 S->SetDoNotSegment(false); 00066 00067 _GetPState().SendAction(S); 00068 }
PARTICLEDLL_API void pDeathCallback | ( | P_PARTICLE_CALLBACK | callback, | |
void * | data = NULL | |||
) |
Definition at line 555 of file other_api.cpp.
References _GetPState(), ParticleState::GetPGroup(), ParticleState::in_new_list, ParticleState::pgroup_id, and ParticleGroup::SetDeathCallback().
00556 { 00557 ParticleState &PS = _GetPState(); 00558 if(PS.in_new_list) 00559 return; // ERROR 00560 00561 PS.GetPGroup(PS.pgroup_id).SetDeathCallback(callback, data); 00562 }
PARTICLEDLL_API void pDeleteActionLists | ( | int | action_list_num, | |
int | action_list_count = 1 | |||
) |
Definition at line 226 of file other_api.cpp.
References _GetPState(), _PLock(), _PUnLock(), ParticleState::ALists, and ParticleState::in_new_list.
00227 { 00228 ParticleState &PS = _GetPState(); 00229 00230 if(PS.in_new_list) 00231 return; // ERROR 00232 00233 if(action_list_num < 0) 00234 return; // ERROR 00235 00236 _PLock(); 00237 00238 if(action_list_num + action_list_count > (int)PS.ALists.size()) 00239 return; // ERROR 00240 00241 for(int i = action_list_num; i < action_list_num + action_list_count; i++) { 00242 PS.ALists[i].resize(0); 00243 // XXX Does that delete the actions? 00244 } 00245 00246 _PUnLock(); 00247 }
PARTICLEDLL_API void pDeleteParticleGroups | ( | int | p_group_num, | |
int | p_group_count = 1 | |||
) |
Definition at line 300 of file other_api.cpp.
References _GetPState(), _PLock(), _PUnLock(), ParticleState::ALists, and ParticleState::PGroups.
Referenced by gSpark::Timestep().
00301 { 00302 ParticleState &PS = _GetPState(); 00303 00304 if(p_group_num < 0) 00305 return; // ERROR 00306 00307 _PLock(); 00308 00309 if(p_group_num + p_group_count > (int)PS.ALists.size()) 00310 return; // ERROR 00311 00312 for(int i = p_group_num; i < p_group_num + p_group_count; i++) { 00313 PS.PGroups[i].SetMaxParticles(0); 00314 PS.PGroups[i].GetList().resize(0); 00315 } 00316 00317 _PUnLock(); 00318 }
PARTICLEDLL_API void pEndActionList | ( | ) |
Definition at line 214 of file other_api.cpp.
References _GetPState(), ParticleState::alist_id, and ParticleState::in_new_list.
00215 { 00216 ParticleState &PS = _GetPState(); 00217 00218 if(!PS.in_new_list) 00219 return; // ERROR 00220 00221 PS.in_new_list = false; 00222 00223 PS.alist_id = -1; 00224 }
PARTICLEDLL_API void pExplosion | ( | const pVec & | center, | |
float | velocity, | |||
float | magnitude, | |||
float | stdev, | |||
float | epsilon = P_EPS , |
|||
float | age = 0.0f | |||
) |
Definition at line 85 of file action_api.cpp.
References _GetPState(), PAExplosion::age, PAExplosion::center, PAExplosion::epsilon, PAExplosion::magnitude, P_EPS, ParticleState::SendAction(), PActionBase::SetDoNotSegment(), PActionBase::SetKillsParticles(), PAExplosion::stdev, and PAExplosion::velocity.
00087 { 00088 PAExplosion *S = new PAExplosion; 00089 00090 S->center = center; 00091 S->velocity = velocity; 00092 S->magnitude = magnitude; 00093 S->stdev = stdev; 00094 S->epsilon = epsilon; 00095 S->age = age; 00096 00097 if(S->epsilon < 0.0f) 00098 S->epsilon = P_EPS; 00099 00100 S->SetKillsParticles(false); 00101 S->SetDoNotSegment(false); 00102 00103 _GetPState().SendAction(S); 00104 }
PARTICLEDLL_API void pFollow | ( | float | magnitude = 1.0f , |
|
float | epsilon = P_EPS , |
|||
float | max_radius = P_MAXFLOAT | |||
) |
Definition at line 106 of file action_api.cpp.
References _GetPState(), PAFollow::epsilon, PAFollow::magnitude, PAFollow::max_radius, ParticleState::SendAction(), PActionBase::SetDoNotSegment(), and PActionBase::SetKillsParticles().
00107 { 00108 PAFollow *S = new PAFollow; 00109 00110 S->magnitude = magnitude; 00111 S->epsilon = epsilon; 00112 S->max_radius = max_radius; 00113 00114 S->SetKillsParticles(false); 00115 S->SetDoNotSegment(true); 00116 00117 _GetPState().SendAction(S); 00118 }
PARTICLEDLL_API void pFountain | ( | ) |
Definition at line 120 of file action_api.cpp.
References _GetPState(), ParticleState::SendAction(), PActionBase::SetDoNotSegment(), and PActionBase::SetKillsParticles().
00121 { 00122 PAFollow *S = new PAFollow; 00123 00124 S->SetKillsParticles(true); 00125 S->SetDoNotSegment(true); 00126 00127 _GetPState().SendAction(S); 00128 }
PARTICLEDLL_API int pGenActionLists | ( | int | action_list_count = 1 |
) |
Definition at line 178 of file other_api.cpp.
References _GetPState(), _PLock(), _PUnLock(), ParticleState::GenerateALists(), and ParticleState::in_new_list.
00179 { 00180 ParticleState &PS = _GetPState(); 00181 00182 if(PS.in_new_list) 00183 return -1; // ERROR 00184 00185 _PLock(); 00186 00187 int ind = PS.GenerateALists(action_list_count); 00188 00189 _PUnLock(); 00190 00191 return ind; 00192 }
PARTICLEDLL_API int pGenParticleGroups | ( | int | p_group_count = 1 , |
|
size_t | max_particles = 0 | |||
) |
Definition at line 280 of file other_api.cpp.
References _GetPState(), _PLock(), _PUnLock(), ParticleState::GeneratePGroups(), ParticleState::in_new_list, and ParticleState::PGroups.
Referenced by gSpark::gSpark().
00281 { 00282 ParticleState &PS = _GetPState(); 00283 00284 if(PS.in_new_list) 00285 return -1; // ERROR 00286 00287 _PLock(); 00288 00289 int ind = PS.GeneratePGroups(p_group_count); 00290 00291 for(int i = ind; i < ind + p_group_count; i++) { 00292 PS.PGroups[i].SetMaxParticles(max_particles); 00293 } 00294 00295 _PUnLock(); 00296 00297 return ind; 00298 }
PARTICLEDLL_API int pGetError | ( | ) |
PARTICLEDLL_API size_t pGetGroupCount | ( | ) |
Definition at line 507 of file other_api.cpp.
References _GetPState(), _PLock(), _PUnLock(), ParticleState::GetPGroup(), ParticleState::in_new_list, ParticleState::pgroup_id, and ParticleState::PGroups.
Referenced by gSpark::Render(), and gSpark::Timestep().
00508 { 00509 ParticleState &PS = _GetPState(); 00510 00511 if(PS.in_new_list) 00512 return 0; // ERROR 00513 00514 PS.GetPGroup(PS.pgroup_id); 00515 _PLock(); 00516 00517 if(PS.pgroup_id < 0 || PS.pgroup_id >= (int)PS.PGroups.size()) 00518 return static_cast< size_t >( -2 ); // ERROR 00519 00520 _PUnLock(); 00521 00522 return PS.PGroups[PS.pgroup_id].size(); 00523 }
PARTICLEDLL_API size_t pGetMaxParticles | ( | ) |
Definition at line 526 of file other_api.cpp.
References _GetPState(), _PLock(), _PUnLock(), ParticleState::in_new_list, ParticleState::pgroup_id, and ParticleState::PGroups.
00527 { 00528 ParticleState &PS = _GetPState(); 00529 00530 if(PS.in_new_list) 00531 return 0; // ERROR 00532 00533 _PLock(); 00534 00535 if(PS.pgroup_id < 0 || PS.pgroup_id >= (int)PS.PGroups.size()) 00536 return static_cast< size_t >( -2 ); // ERROR 00537 00538 _PUnLock(); 00539 00540 return PS.PGroups[PS.pgroup_id].GetMaxParticles(); 00541 }
PARTICLEDLL_API size_t pGetParticlePointer | ( | float *& | ptr, | |
size_t & | stride, | |||
size_t & | pos3Ofs, | |||
size_t & | posB3Ofs, | |||
size_t & | size3Ofs, | |||
size_t & | vel3Ofs, | |||
size_t & | velB3Ofs, | |||
size_t & | color3Ofs, | |||
size_t & | alpha1Ofs, | |||
size_t & | age1Ofs | |||
) |
Definition at line 470 of file other_api.cpp.
References _GetPState(), Particle::age, Particle::alpha, ParticleGroup::begin(), Particle::color, ParticleState::in_new_list, ParticleState::pgroup_id, ParticleState::PGroups, Particle::pos, Particle::posB, Particle::size, ParticleGroup::size(), Particle::vel, Particle::velB, and pVec::x().
Referenced by gSpark::Render().
00473 { 00474 ParticleState &PS = _GetPState(); 00475 00476 if(PS.in_new_list) 00477 return static_cast< size_t >( -1 ); // ERROR 00478 00479 ParticleGroup &pg = PS.PGroups[PS.pgroup_id]; 00480 00481 if(pg.size() < 1) { 00482 return static_cast< size_t >( -4 ); // ERROR index out of bounds. 00483 } 00484 00485 ParticleList::iterator it = pg.begin(); 00486 Particle *p0 = &(*it); 00487 ++it; 00488 Particle *p1 = &(*it); 00489 float *fp0 = (float *)p0; 00490 float *fp1 = (float *)p1; 00491 00492 ptr = (float *)p0; 00493 stride = fp1 - fp0; 00494 pos3Ofs = (float *)&(p0->pos.x()) - fp0; 00495 posB3Ofs = (float *)&(p0->posB.x()) - fp0; 00496 size3Ofs = (float *)&(p0->size.x()) - fp0; 00497 vel3Ofs = (float *)&(p0->vel.x()) - fp0; 00498 velB3Ofs = (float *)&(p0->velB.x()) - fp0; 00499 color3Ofs = (float *)&(p0->color.x()) - fp0; 00500 alpha1Ofs = (float *)&(p0->alpha) - fp0; 00501 age1Ofs = (float *)&(p0->age) - fp0; 00502 00503 return pg.size(); 00504 }
PARTICLEDLL_API size_t pGetParticles | ( | size_t | index, | |
size_t | count, | |||
float * | position = NULL , |
|||
float * | color = NULL , |
|||
float * | vel = NULL , |
|||
float * | size = NULL , |
|||
float * | age = NULL | |||
) |
Definition at line 394 of file other_api.cpp.
References _GetPState(), _PLock(), _PUnLock(), Particle::age, ai, Particle::alpha, Particle::color, ParticleGroup::GetList(), ParticleState::in_new_list, ParticleState::pgroup_id, ParticleState::PGroups, Particle::pos, si, Particle::size, ParticleGroup::size(), Particle::vel, pVec::x(), pVec::y(), and pVec::z().
00396 { 00397 ParticleState &PS = _GetPState(); 00398 00399 // XXX I should think about whether color means color3, color4, or what. 00400 // For now, it means color4. 00401 00402 if(PS.in_new_list) 00403 return static_cast< size_t >( -1 ); // ERROR 00404 00405 _PLock(); 00406 00407 if(PS.pgroup_id < 0 || PS.pgroup_id >= (int)PS.PGroups.size()) 00408 return static_cast< size_t >( -2 ); // ERROR 00409 00410 // useless test, both are never negative 00411 // if(index < 0 || count < 0) 00412 // return static_cast< size_t >( -3 ); // ERROR 00413 00414 ParticleGroup &pg = PS.PGroups[PS.pgroup_id]; 00415 00416 _PUnLock(); 00417 00418 if(index + count > pg.size()) { 00419 count = pg.size() - index; 00420 if(count <= 0) 00421 return static_cast< size_t >( -4 ); // ERROR index out of bounds. 00422 } 00423 00424 int vi = 0, ci = 0, li = 0, si = 0, ai = 0; 00425 00426 // This should be optimized. 00427 for(size_t i=index; i<index+count; i++) { 00428 const Particle &m = pg.GetList()[i]; 00429 00430 if(verts) { 00431 verts[vi++] = m.pos.x(); 00432 verts[vi++] = m.pos.y(); 00433 verts[vi++] = m.pos.z(); 00434 } 00435 00436 if(color) { 00437 color[ci++] = m.color.x(); 00438 color[ci++] = m.color.y(); 00439 color[ci++] = m.color.z(); 00440 color[ci++] = m.alpha; 00441 } 00442 00443 if(vel) { 00444 vel[li++] = m.vel.x(); 00445 vel[li++] = m.vel.y(); 00446 vel[li++] = m.vel.z(); 00447 } 00448 00449 if(size) { 00450 size[si++] = m.size.x(); 00451 size[si++] = m.size.y(); 00452 size[si++] = m.size.z(); 00453 } 00454 00455 if(age) { 00456 age[ai++] = m.age; 00457 } 00458 } 00459 00460 return count; 00461 }
PARTICLEDLL_API void pGravitate | ( | float | magnitude = 1.0f , |
|
float | epsilon = P_EPS , |
|||
float | max_radius = P_MAXFLOAT | |||
) |
Definition at line 130 of file action_api.cpp.
References _GetPState(), PAGravitate::epsilon, PAGravitate::magnitude, PAGravitate::max_radius, ParticleState::SendAction(), PActionBase::SetDoNotSegment(), and PActionBase::SetKillsParticles().
00131 { 00132 PAGravitate *S = new PAGravitate; 00133 00134 S->magnitude = magnitude; 00135 S->epsilon = epsilon; 00136 S->max_radius = max_radius; 00137 00138 S->SetKillsParticles(false); 00139 S->SetDoNotSegment(true); 00140 00141 _GetPState().SendAction(S); 00142 }
PARTICLEDLL_API void pGravity | ( | const pVec & | dir | ) |
Definition at line 144 of file action_api.cpp.
References _GetPState(), PAGravity::direction, ParticleState::SendAction(), PActionBase::SetDoNotSegment(), and PActionBase::SetKillsParticles().
Referenced by gSpark::Timestep().
00145 { 00146 PAGravity *S = new PAGravity; 00147 00148 S->direction = dir; 00149 00150 S->SetKillsParticles(false); 00151 S->SetDoNotSegment(false); 00152 00153 _GetPState().SendAction(S); 00154 }
Definition at line 156 of file action_api.cpp.
References _GetPState(), PAJet::acc, pDomain::copy(), PAJet::dom, ParticleState::SendAction(), PActionBase::SetDoNotSegment(), and PActionBase::SetKillsParticles().
00157 { 00158 // ParticleState &PS = _GetPState(); 00159 00160 PAJet *S = new PAJet(); 00161 00162 S->dom = dom.copy(); 00163 S->acc = accel.copy(); 00164 00165 S->SetKillsParticles(false); 00166 S->SetDoNotSegment(false); 00167 00168 _GetPState().SendAction(S); 00169 }
PARTICLEDLL_API void pKillOld | ( | float | age_limit, | |
bool | kill_less_than = false | |||
) |
Definition at line 171 of file action_api.cpp.
References _GetPState(), PAKillOld::age_limit, PAKillOld::kill_less_than, ParticleState::SendAction(), PActionBase::SetDoNotSegment(), and PActionBase::SetKillsParticles().
Referenced by gSpark::Timestep().
00172 { 00173 PAKillOld *S = new PAKillOld; 00174 00175 S->age_limit = age_limit; 00176 S->kill_less_than = kill_less_than; 00177 00178 S->SetKillsParticles(true); 00179 S->SetDoNotSegment(false); 00180 00181 _GetPState().SendAction(S); 00182 }
PARTICLEDLL_API void pMass | ( | float | mass | ) |
Definition at line 153 of file other_api.cpp.
References _GetPState(), and ParticleState::Mass.
00154 { 00155 ParticleState &PS = _GetPState(); 00156 00157 PS.Mass = mass; 00158 }
PARTICLEDLL_API void pMatchRotVelocity | ( | float | magnitude = 1.0f , |
|
float | epsilon = P_EPS , |
|||
float | max_radius = P_MAXFLOAT | |||
) |
Definition at line 198 of file action_api.cpp.
References _GetPState(), PAMatchRotVelocity::epsilon, PAMatchRotVelocity::magnitude, PAMatchRotVelocity::max_radius, ParticleState::SendAction(), PActionBase::SetDoNotSegment(), and PActionBase::SetKillsParticles().
00199 { 00200 PAMatchRotVelocity *S = new PAMatchRotVelocity; 00201 00202 S->magnitude = magnitude; 00203 S->epsilon = epsilon; 00204 S->max_radius = max_radius; 00205 00206 S->SetKillsParticles(false); 00207 S->SetDoNotSegment(true); 00208 00209 _GetPState().SendAction(S); 00210 }
PARTICLEDLL_API void pMatchVelocity | ( | float | magnitude = 1.0f , |
|
float | epsilon = P_EPS , |
|||
float | max_radius = P_MAXFLOAT | |||
) |
Definition at line 184 of file action_api.cpp.
References _GetPState(), PAMatchVelocity::epsilon, PAMatchVelocity::magnitude, PAMatchVelocity::max_radius, ParticleState::SendAction(), PActionBase::SetDoNotSegment(), and PActionBase::SetKillsParticles().
00185 { 00186 PAMatchVelocity *S = new PAMatchVelocity; 00187 00188 S->magnitude = magnitude; 00189 S->epsilon = epsilon; 00190 S->max_radius = max_radius; 00191 00192 S->SetKillsParticles(false); 00193 S->SetDoNotSegment(true); 00194 00195 _GetPState().SendAction(S); 00196 }
PARTICLEDLL_API void pMove | ( | ) |
Definition at line 212 of file action_api.cpp.
References _GetPState(), ParticleState::SendAction(), PActionBase::SetDoNotSegment(), and PActionBase::SetKillsParticles().
Referenced by gSpark::Timestep().
00213 { 00214 PAMove *S = new PAMove; 00215 00216 S->SetKillsParticles(false); 00217 S->SetDoNotSegment(false); 00218 00219 _GetPState().SendAction(S); 00220 }
PARTICLEDLL_API void pNewActionList | ( | int | action_list_num | ) |
Definition at line 194 of file other_api.cpp.
References _GetPState(), _PLock(), _PUnLock(), ParticleState::alist_id, ParticleState::ALists, and ParticleState::in_new_list.
00195 { 00196 ParticleState &PS = _GetPState(); 00197 00198 if(PS.in_new_list) 00199 return; // ERROR 00200 00201 _PLock(); 00202 00203 PS.alist_id = action_list_num; 00204 if(PS.alist_id < 0 || PS.alist_id >= (int)PS.ALists.size()) 00205 return; // ERROR 00206 00207 PS.in_new_list = true; 00208 PS.ALists[PS.alist_id].resize(0); // Remove any old actions 00209 // XXX Does that delete the actions? 00210 00211 _PUnLock(); 00212 }
PARTICLEDLL_API void pOrbitLine | ( | const pVec & | p, | |
const pVec & | axis, | |||
float | magnitude = 1.0f , |
|||
float | epsilon = P_EPS , |
|||
float | max_radius = P_MAXFLOAT | |||
) |
Definition at line 222 of file action_api.cpp.
References _GetPState(), PAOrbitLine::axis, PAOrbitLine::epsilon, PAOrbitLine::magnitude, PAOrbitLine::max_radius, pVec::normalize(), PAOrbitLine::p, ParticleState::SendAction(), PActionBase::SetDoNotSegment(), and PActionBase::SetKillsParticles().
00224 { 00225 PAOrbitLine *S = new PAOrbitLine; 00226 00227 S->p = p; 00228 S->axis = axis; 00229 S->axis.normalize(); 00230 S->magnitude = magnitude; 00231 S->epsilon = epsilon; 00232 S->max_radius = max_radius; 00233 00234 S->SetKillsParticles(false); 00235 S->SetDoNotSegment(false); 00236 00237 _GetPState().SendAction(S); 00238 }
PARTICLEDLL_API void pOrbitPoint | ( | const pVec & | center, | |
float | magnitude = 1.0f , |
|||
float | epsilon = P_EPS , |
|||
float | max_radius = P_MAXFLOAT | |||
) |
Definition at line 240 of file action_api.cpp.
References _GetPState(), PAOrbitPoint::center, PAOrbitPoint::epsilon, PAOrbitPoint::magnitude, PAOrbitPoint::max_radius, ParticleState::SendAction(), PActionBase::SetDoNotSegment(), and PActionBase::SetKillsParticles().
00241 { 00242 PAOrbitPoint *S = new PAOrbitPoint; 00243 00244 S->center = center; 00245 S->magnitude = magnitude; 00246 S->epsilon = epsilon; 00247 S->max_radius = max_radius; 00248 00249 S->SetKillsParticles(false); 00250 S->SetDoNotSegment(false); 00251 00252 _GetPState().SendAction(S); 00253 }
PARTICLEDLL_API void pRandomAccel | ( | const pDomain & | dom | ) |
Definition at line 255 of file action_api.cpp.
References _GetPState(), pDomain::copy(), PARandomAccel::gen_acc, ParticleState::SendAction(), PActionBase::SetDoNotSegment(), and PActionBase::SetKillsParticles().
00256 { 00257 PARandomAccel *S = new PARandomAccel(); 00258 00259 S->gen_acc = dom.copy(); 00260 S->SetKillsParticles(false); 00261 S->SetDoNotSegment(false); 00262 00263 _GetPState().SendAction(S); 00264 }
PARTICLEDLL_API void pRandomDisplace | ( | const pDomain & | dom | ) |
Definition at line 266 of file action_api.cpp.
References _GetPState(), pDomain::copy(), PARandomDisplace::gen_disp, ParticleState::SendAction(), PActionBase::SetDoNotSegment(), and PActionBase::SetKillsParticles().
00267 { 00268 PARandomDisplace *S = new PARandomDisplace(); 00269 00270 S->gen_disp = dom.copy(); 00271 S->SetKillsParticles(false); 00272 S->SetDoNotSegment(false); 00273 00274 _GetPState().SendAction(S); 00275 }
PARTICLEDLL_API void pRandomRotVelocity | ( | const pDomain & | dom | ) |
Definition at line 288 of file action_api.cpp.
References _GetPState(), pDomain::copy(), PARandomRotVelocity::gen_vel, ParticleState::SendAction(), PActionBase::SetDoNotSegment(), and PActionBase::SetKillsParticles().
00289 { 00290 PARandomRotVelocity *S = new PARandomRotVelocity(); 00291 00292 S->gen_vel = dom.copy(); 00293 S->SetKillsParticles(false); 00294 S->SetDoNotSegment(false); 00295 00296 _GetPState().SendAction(S); 00297 }
PARTICLEDLL_API void pRandomVelocity | ( | const pDomain & | dom | ) |
Definition at line 277 of file action_api.cpp.
References _GetPState(), pDomain::copy(), PARandomVelocity::gen_vel, ParticleState::SendAction(), PActionBase::SetDoNotSegment(), and PActionBase::SetKillsParticles().
00278 { 00279 PARandomVelocity *S = new PARandomVelocity(); 00280 00281 S->gen_vel = dom.copy(); 00282 S->SetKillsParticles(false); 00283 S->SetDoNotSegment(false); 00284 00285 _GetPState().SendAction(S); 00286 }
PARTICLEDLL_API void pReset | ( | ) |
Definition at line 564 of file other_api.cpp.
References _GetPState(), ParticleGroup::GetList(), ParticleState::GetPGroup(), ParticleState::in_new_list, and ParticleState::pgroup_id.
00565 { 00566 ParticleState &PS = _GetPState(); 00567 if(PS.in_new_list) 00568 return; // ERROR 00569 00570 PS.GetPGroup(PS.pgroup_id).GetList().clear(); 00571 }
PARTICLEDLL_API void pRestore | ( | float | time, | |
bool | vel = true , |
|||
bool | rvel = true | |||
) |
Definition at line 299 of file action_api.cpp.
References _GetPState(), PARestore::restore_rvelocity, PARestore::restore_velocity, ParticleState::SendAction(), PActionBase::SetDoNotSegment(), PActionBase::SetKillsParticles(), and PARestore::time_left.
00300 { 00301 PARestore *S = new PARestore; 00302 00303 S->time_left = time_left; 00304 S->restore_velocity = vel; 00305 S->restore_rvelocity = rvel; 00306 00307 S->SetKillsParticles(false); 00308 S->SetDoNotSegment(false); 00309 00310 _GetPState().SendAction(S); 00311 }
PARTICLEDLL_API void pRotDamping | ( | const pVec & | damping, | |
float | vlow = 0.0f , |
|||
float | vhigh = P_MAXFLOAT | |||
) |
Definition at line 70 of file action_api.cpp.
References _GetPState(), PADamping::damping, fsqr(), ParticleState::SendAction(), PActionBase::SetDoNotSegment(), PActionBase::SetKillsParticles(), PADamping::vhighSqr, and PADamping::vlowSqr.
00072 { 00073 PADamping *S = new PADamping; 00074 00075 S->damping = damping; 00076 S->vlowSqr = fsqr(vlow); 00077 S->vhighSqr = fsqr(vhigh); 00078 00079 S->SetKillsParticles(false); 00080 S->SetDoNotSegment(false); 00081 00082 _GetPState().SendAction(S); 00083 }
PARTICLEDLL_API void pRotVelocity | ( | const pVec & | v | ) |
Definition at line 97 of file other_api.cpp.
References _GetPState(), and ParticleState::RotVel.
00098 { 00099 ParticleState &PS = _GetPState(); 00100 00101 delete PS.RotVel; 00102 PS.RotVel = new PDPoint(v); 00103 }
PARTICLEDLL_API void pRotVelocityD | ( | const pDomain & | dom | ) |
Definition at line 105 of file other_api.cpp.
References _GetPState(), pDomain::copy(), and ParticleState::RotVel.
00106 { 00107 ParticleState &PS = _GetPState(); 00108 00109 delete PS.RotVel; 00110 PS.RotVel = dom.copy(); 00111 }
PARTICLEDLL_API void pSeed | ( | unsigned int | seed | ) |
Definition at line 573 of file other_api.cpp.
References pSRandf.
00574 { 00575 pSRandf(seed); 00576 }
PARTICLEDLL_API size_t pSetMaxParticles | ( | size_t | max_count | ) |
Definition at line 339 of file other_api.cpp.
References _GetPState(), ParticleState::GetPGroup(), ParticleState::in_new_list, ParticleState::pgroup_id, and ParticleGroup::SetMaxParticles().
00340 { 00341 ParticleState &PS = _GetPState(); 00342 00343 if(PS.in_new_list) 00344 return 0; // ERROR 00345 00346 // useless test, can never be negative 00347 // if(max_count < 0) 00348 // return 0; // ERROR 00349 00350 // This can kill them and call their death callback. 00351 PS.GetPGroup(PS.pgroup_id).SetMaxParticles(max_count); 00352 00353 return max_count; 00354 }
PARTICLEDLL_API void pSink | ( | bool | kill_inside, | |
const pDomain & | dom | |||
) |
Definition at line 313 of file action_api.cpp.
References _GetPState(), pDomain::copy(), PASink::kill_inside, PASink::position, ParticleState::SendAction(), PActionBase::SetDoNotSegment(), and PActionBase::SetKillsParticles().
Referenced by gSpark::Timestep().
00314 { 00315 PASink *S = new PASink(); 00316 00317 S->position = dom.copy(); 00318 S->kill_inside = kill_inside; 00319 00320 S->SetKillsParticles(true); 00321 S->SetDoNotSegment(false); 00322 00323 _GetPState().SendAction(S); 00324 }
PARTICLEDLL_API void pSinkVelocity | ( | bool | kill_inside, | |
const pDomain & | dom | |||
) |
Definition at line 326 of file action_api.cpp.
References _GetPState(), pDomain::copy(), PASinkVelocity::kill_inside, ParticleState::SendAction(), PActionBase::SetDoNotSegment(), PActionBase::SetKillsParticles(), and PASinkVelocity::velocity.
00327 { 00328 PASinkVelocity *S = new PASinkVelocity(); 00329 00330 S->velocity = dom.copy(); 00331 S->kill_inside = kill_inside; 00332 00333 S->SetKillsParticles(true); 00334 S->SetDoNotSegment(false); 00335 00336 _GetPState().SendAction(S); 00337 }
PARTICLEDLL_API void pSize | ( | const pVec & | size | ) |
Definition at line 137 of file other_api.cpp.
References _GetPState(), and ParticleState::Size.
Referenced by gSpark::Timestep().
00138 { 00139 ParticleState &PS = _GetPState(); 00140 00141 delete PS.Size; 00142 PS.Size = new PDPoint(size); 00143 }
PARTICLEDLL_API void pSizeD | ( | const pDomain & | dom | ) |
Definition at line 145 of file other_api.cpp.
References _GetPState(), pDomain::copy(), and ParticleState::Size.
00146 { 00147 ParticleState &PS = _GetPState(); 00148 00149 delete PS.Size; 00150 PS.Size = dom.copy(); 00151 }
Definition at line 339 of file action_api.cpp.
References _GetPState(), PASort::Eye, PASort::Look, ParticleState::SendAction(), PActionBase::SetDoNotSegment(), and PActionBase::SetKillsParticles().
00340 { 00341 PASort *S = new PASort; 00342 00343 S->Eye = eye; 00344 S->Look= look; 00345 00346 S->SetKillsParticles(false); 00347 S->SetDoNotSegment(true); // WARNING: Particles aren't a function of other particles, but since it can screw up the working set thing, I'm setting it true. 00348 00349 _GetPState().SendAction(S); 00350 }
PARTICLEDLL_API void pSource | ( | float | particle_rate, | |
const pDomain & | dom | |||
) |
Definition at line 352 of file action_api.cpp.
References _GetPState(), ParticleState::Age, PASource::age, PASource::age_sigma, ParticleState::AgeSigma, ParticleState::Alpha, PASource::alpha, ParticleState::Color, PASource::color, pDomain::copy(), PASource::particle_rate, PASource::position, PASource::positionB, ParticleState::RotVel, PASource::rvelocity, ParticleState::SendAction(), PActionBase::SetDoNotSegment(), PActionBase::SetKillsParticles(), ParticleState::Size, PASource::size, ParticleState::Up, PASource::upVec, ParticleState::Vel, PASource::velocity, ParticleState::VertexB, ParticleState::vertexB_tracks, and PASource::vertexB_tracks.
Referenced by gSpark::gSpark(), and pVertex().
00353 { 00354 ParticleState &PS = _GetPState(); 00355 00356 PASource *S = new PASource(); 00357 00358 S->position = dom.copy(); 00359 S->positionB = PS.VertexB->copy(); 00360 S->upVec = PS.Up->copy(); 00361 S->velocity = PS.Vel->copy(); 00362 S->rvelocity = PS.RotVel->copy(); 00363 S->size = PS.Size->copy(); 00364 S->color = PS.Color->copy(); 00365 S->alpha = PS.Alpha->copy(); 00366 S->particle_rate = particle_rate; 00367 S->age = PS.Age; 00368 S->age_sigma = PS.AgeSigma; 00369 S->vertexB_tracks = PS.vertexB_tracks; 00370 00371 S->SetKillsParticles(false); 00372 S->SetDoNotSegment(true); // WARNING: Particles aren't a function of other particles, but does affect the working sets optimizations 00373 00374 _GetPState().SendAction(S); 00375 }
PARTICLEDLL_API void pSpeedLimit | ( | float | min_speed, | |
float | max_speed = P_MAXFLOAT | |||
) |
Definition at line 377 of file action_api.cpp.
References _GetPState(), PASpeedLimit::max_speed, PASpeedLimit::min_speed, ParticleState::SendAction(), PActionBase::SetDoNotSegment(), and PActionBase::SetKillsParticles().
00378 { 00379 PASpeedLimit *S = new PASpeedLimit; 00380 00381 S->min_speed = min_speed; 00382 S->max_speed = max_speed; 00383 00384 S->SetKillsParticles(false); 00385 S->SetDoNotSegment(false); 00386 00387 _GetPState().SendAction(S); 00388 }
PARTICLEDLL_API void pStartingAge | ( | float | age, | |
float | sigma = 1.0f | |||
) |
Definition at line 160 of file other_api.cpp.
References _GetPState(), ParticleState::Age, and ParticleState::AgeSigma.
00161 { 00162 ParticleState &PS = _GetPState(); 00163 00164 PS.Age = age; 00165 PS.AgeSigma = sigma; 00166 }
PARTICLEDLL_API void pTargetColor | ( | const pVec & | color, | |
float | alpha, | |||
float | scale | |||
) |
Definition at line 390 of file action_api.cpp.
References _GetPState(), PATargetColor::alpha, PATargetColor::color, PATargetColor::scale, ParticleState::SendAction(), PActionBase::SetDoNotSegment(), and PActionBase::SetKillsParticles().
00391 { 00392 PATargetColor *S = new PATargetColor; 00393 00394 S->color = color; 00395 S->alpha = alpha; 00396 S->scale = scale; 00397 00398 S->SetKillsParticles(false); 00399 S->SetDoNotSegment(false); 00400 00401 _GetPState().SendAction(S); 00402 }
PARTICLEDLL_API void pTargetRotVelocity | ( | const pVec & | vel, | |
float | scale | |||
) |
Definition at line 430 of file action_api.cpp.
References _GetPState(), PATargetRotVelocity::scale, ParticleState::SendAction(), PActionBase::SetDoNotSegment(), PActionBase::SetKillsParticles(), and PATargetRotVelocity::velocity.
00431 { 00432 PATargetRotVelocity *S = new PATargetRotVelocity; 00433 00434 S->velocity = vel; 00435 S->scale = scale; 00436 00437 S->SetKillsParticles(false); 00438 S->SetDoNotSegment(false); 00439 00440 _GetPState().SendAction(S); 00441 }
Definition at line 404 of file action_api.cpp.
References _GetPState(), PATargetSize::scale, ParticleState::SendAction(), PActionBase::SetDoNotSegment(), PActionBase::SetKillsParticles(), and PATargetSize::size.
00405 { 00406 PATargetSize *S = new PATargetSize; 00407 00408 S->size = size; 00409 S->scale = scale; 00410 00411 S->SetKillsParticles(false); 00412 S->SetDoNotSegment(false); 00413 00414 _GetPState().SendAction(S); 00415 }
PARTICLEDLL_API void pTargetVelocity | ( | const pVec & | vel, | |
float | scale | |||
) |
Definition at line 417 of file action_api.cpp.
References _GetPState(), PATargetVelocity::scale, ParticleState::SendAction(), PActionBase::SetDoNotSegment(), PActionBase::SetKillsParticles(), and PATargetVelocity::velocity.
00418 { 00419 PATargetVelocity *S = new PATargetVelocity; 00420 00421 S->velocity = vel; 00422 S->scale = scale; 00423 00424 S->SetKillsParticles(false); 00425 S->SetDoNotSegment(false); 00426 00427 _GetPState().SendAction(S); 00428 }
PARTICLEDLL_API void pTimeStep | ( | float | new_dt | ) |
Definition at line 168 of file other_api.cpp.
References _GetPState(), and ParticleState::dt.
00169 { 00170 ParticleState &PS = _GetPState(); 00171 00172 PS.dt = newDT; 00173 }
PARTICLEDLL_API void pUpVec | ( | const pVec & | v | ) |
Definition at line 65 of file other_api.cpp.
References _GetPState(), and ParticleState::Up.
00066 { 00067 ParticleState &PS = _GetPState(); 00068 00069 delete PS.Up; 00070 PS.Up = new PDPoint(up); 00071 }
PARTICLEDLL_API void pUpVecD | ( | const pDomain & | dom | ) |
Definition at line 73 of file other_api.cpp.
References _GetPState(), pDomain::copy(), and ParticleState::Up.
00074 { 00075 ParticleState &PS = _GetPState(); 00076 00077 delete PS.Up; 00078 PS.Up = dom.copy(); 00079 }
PARTICLEDLL_API void pVelocity | ( | const pVec & | vel | ) |
Definition at line 81 of file other_api.cpp.
References _GetPState(), and ParticleState::Vel.
00082 { 00083 ParticleState &PS = _GetPState(); 00084 00085 delete PS.Vel; 00086 PS.Vel = new PDPoint(v); 00087 }
PARTICLEDLL_API void pVelocityD | ( | const pDomain & | dom | ) |
Definition at line 89 of file other_api.cpp.
References _GetPState(), pDomain::copy(), and ParticleState::Vel.
Referenced by gSpark::Timestep().
00090 { 00091 ParticleState &PS = _GetPState(); 00092 00093 delete PS.Vel; 00094 PS.Vel = dom.copy(); 00095 }
PARTICLEDLL_API void pVertex | ( | const pVec & | v, | |
long | data = 0 | |||
) |
Definition at line 445 of file action_api.cpp.
References _GetPState(), ParticleGroup::Add(), ParticleState::Age, ParticleState::Alpha, Particle::alpha, ParticleState::Color, pDomain::Generate(), ParticleState::GetPGroup(), ParticleState::in_new_list, ParticleState::Mass, ParticleState::pgroup_id, Particle::posB, pSource(), ParticleState::RotVel, Particle::rvel, ParticleState::Size, ParticleState::Up, Particle::up, ParticleState::Vel, Particle::vel, ParticleState::VertexB, ParticleState::vertexB_tracks, and pVec::x().
00446 { 00447 ParticleState &PS = _GetPState(); 00448 00449 if(PS.in_new_list) { 00450 pSource(1, PDPoint(pos)); 00451 return; 00452 } 00453 00454 // Immediate mode. Quickly add the vertex. 00455 pVec siz, up, vel, rvel, col, alpha, posB; 00456 if(PS.vertexB_tracks) 00457 posB = pos; 00458 else 00459 posB = PS.VertexB->Generate(); 00460 siz = PS.Size->Generate(); 00461 up = PS.Up->Generate(); 00462 vel = PS.Vel->Generate(); 00463 rvel = PS.RotVel->Generate(); 00464 col = PS.Color->Generate(); 00465 alpha = PS.Alpha->Generate(); 00466 PS.GetPGroup(PS.pgroup_id).Add(pos, posB, up, vel, rvel, siz, col, alpha.x(), PS.Age, PS.Mass, data); 00467 }
PARTICLEDLL_API void pVertexB | ( | const pVec & | v | ) |
Definition at line 113 of file other_api.cpp.
References _GetPState(), and ParticleState::VertexB.
00114 { 00115 ParticleState &PS = _GetPState(); 00116 00117 delete PS.VertexB; 00118 PS.VertexB = new PDPoint(v); 00119 }
PARTICLEDLL_API void pVertexBD | ( | const pDomain & | dom | ) |
Definition at line 121 of file other_api.cpp.
References _GetPState(), pDomain::copy(), and ParticleState::VertexB.
00122 { 00123 ParticleState &PS = _GetPState(); 00124 00125 delete PS.VertexB; 00126 PS.VertexB = dom.copy(); 00127 }
PARTICLEDLL_API void pVertexBTracks | ( | bool | track_vertex = true |
) |
Definition at line 130 of file other_api.cpp.
References _GetPState(), and ParticleState::vertexB_tracks.
00131 { 00132 ParticleState &PS = _GetPState(); 00133 00134 PS.vertexB_tracks = trackVertex; 00135 }
PARTICLEDLL_API void pVortex | ( | const pVec & | center, | |
const pVec & | axis, | |||
float | magnitude = 1.0f , |
|||
float | tightnessExponent = 1.0f , |
|||
float | rotSpeed = 1.0f , |
|||
float | epsilon = P_EPS , |
|||
float | max_radius = P_MAXFLOAT | |||
) |
Definition at line 469 of file action_api.cpp.
References _GetPState(), PAVortex::axis, PAVortex::epsilon, PAVortex::magnitude, PAVortex::max_radius, PAVortex::rotSpeed, ParticleState::SendAction(), PActionBase::SetDoNotSegment(), PActionBase::SetKillsParticles(), PAVortex::tightnessExponent, and PAVortex::tip.
00472 { 00473 PAVortex *S = new PAVortex; 00474 00475 S->tip = tip; 00476 S->axis = axis; 00477 S->magnitude = magnitude; 00478 S->tightnessExponent = tightnessExponent; 00479 S->rotSpeed = rotSpeed; 00480 S->epsilon = epsilon; 00481 S->max_radius = max_radius; 00482 00483 S->SetKillsParticles(false); 00484 S->SetDoNotSegment(false); 00485 00486 _GetPState().SendAction(S); 00487 }