00001
00002
00003
00004
00005
00006
00007
00008 #ifndef _particle_api_h
00009 #define _particle_api_h
00010
00011 #include "./pDomain.h"
00012
00013
00014 #include <stdlib.h>
00015
00016
00017 #define P_VERSION 200
00018
00019 #ifdef WIN32
00020
00021 #ifdef PARTICLE_MAKE_DLL
00022 #include <windows.h>
00023
00024 #ifdef PARTICLEDLL_EXPORTS
00025 #define PARTICLEDLL_API __declspec(dllexport)
00026 #else
00027 #define PARTICLEDLL_API __declspec(dllimport)
00028 #endif
00029
00030 #else
00031 #define PARTICLEDLL_API
00032 #endif
00033 #else
00034 #define PARTICLEDLL_API
00035 #endif
00036
00037
00038 #define P_MAXFLOAT 1.0e16f
00039
00040 #ifdef MAXINT
00041 #define P_MAXINT MAXINT
00042 #else
00043 #define P_MAXINT 0x7fffffff
00044 #endif
00045
00046 #define P_EPS 1e-3f
00047
00048
00049
00050 PARTICLEDLL_API void pColor(float red, float green, float blue, float alpha = 1.0f);
00051
00052 PARTICLEDLL_API void pColorD(const pDomain &cdom);
00053 PARTICLEDLL_API void pColorD(const pDomain &cdom, const pDomain &adom);
00054
00055 PARTICLEDLL_API void pSize(const pVec &size);
00056
00057 PARTICLEDLL_API void pSizeD(const pDomain &dom);
00058
00059 PARTICLEDLL_API void pMass(float mass);
00060
00061 PARTICLEDLL_API void pStartingAge(float age, float sigma = 1.0f);
00062
00063 PARTICLEDLL_API void pTimeStep(float new_dt);
00064
00065 PARTICLEDLL_API void pUpVec(const pVec &v);
00066
00067 PARTICLEDLL_API void pUpVecD(const pDomain &dom);
00068
00069 PARTICLEDLL_API void pVelocity(const pVec &vel);
00070
00071 PARTICLEDLL_API void pVelocityD(const pDomain &dom);
00072
00073 PARTICLEDLL_API void pRotVelocity(const pVec &v);
00074
00075 PARTICLEDLL_API void pRotVelocityD(const pDomain &dom);
00076
00077 PARTICLEDLL_API void pVertexB(const pVec &v);
00078
00079 PARTICLEDLL_API void pVertexBD(const pDomain &dom);
00080
00081 PARTICLEDLL_API void pVertexBTracks(bool track_vertex = true);
00082
00083
00084
00085
00086 PARTICLEDLL_API void pCallActionList(int action_list_num);
00087
00088 PARTICLEDLL_API void pDeleteActionLists(int action_list_num, int action_list_count = 1);
00089
00090 PARTICLEDLL_API void pEndActionList();
00091
00092 PARTICLEDLL_API int pGenActionLists(int action_list_count = 1);
00093
00094 PARTICLEDLL_API void pNewActionList(int action_list_num);
00095
00096
00097
00098
00099 PARTICLEDLL_API void pCopyGroup(int p_src_group_num, size_t index = 0, size_t copy_count = P_MAXINT);
00100
00101 PARTICLEDLL_API void pCurrentGroup(int p_group_num);
00102
00103 PARTICLEDLL_API void pDeleteParticleGroups(int p_group_num, int p_group_count = 1);
00104
00105 PARTICLEDLL_API int pGenParticleGroups(int p_group_count = 1, size_t max_particles = 0);
00106
00107 PARTICLEDLL_API size_t pGetGroupCount();
00108
00109 PARTICLEDLL_API size_t pGetParticles(size_t index, size_t count, float *position = NULL, float *color = NULL,
00110 float *vel = NULL, float *size = NULL, float *age = NULL);
00111
00112 PARTICLEDLL_API size_t pGetParticlePointer(float *&ptr, size_t &stride, size_t &pos3Ofs, size_t &posB3Ofs,
00113 size_t &size3Ofs, size_t &vel3Ofs, size_t &velB3Ofs,
00114 size_t &color3Ofs, size_t &alpha1Ofs, size_t &age1Ofs);
00115
00116 PARTICLEDLL_API size_t pSetMaxParticles(size_t max_count);
00117
00118 PARTICLEDLL_API size_t pGetMaxParticles();
00119
00120
00121
00122
00123 PARTICLEDLL_API void pAvoid(float magnitude, float epsilon, float look_ahead, const pDomain &dom);
00124
00125 PARTICLEDLL_API void pBounce(float friction, float resilience, float cutoff, const pDomain &dom);
00126
00127 PARTICLEDLL_API void pCopyVertexB(bool copy_pos = true, bool copy_vel = false);
00128
00129 PARTICLEDLL_API void pDamping(const pVec &damping, float vlow = 0.0f, float vhigh = P_MAXFLOAT);
00130
00131 PARTICLEDLL_API void pRotDamping(const pVec &damping, float vlow = 0.0f, float vhigh = P_MAXFLOAT);
00132
00133 PARTICLEDLL_API void pExplosion(const pVec ¢er, float velocity,
00134 float magnitude, float stdev, float epsilon = P_EPS, float age = 0.0f);
00135
00136 PARTICLEDLL_API void pFollow(float magnitude = 1.0f, float epsilon = P_EPS, float max_radius = P_MAXFLOAT);
00137
00138 PARTICLEDLL_API void pFountain();
00139
00140 PARTICLEDLL_API void pGravitate(float magnitude = 1.0f, float epsilon = P_EPS, float max_radius = P_MAXFLOAT);
00141
00142 PARTICLEDLL_API void pGravity(const pVec &dir);
00143
00144 PARTICLEDLL_API void pJet(const pDomain &dom, const pDomain &acc);
00145
00146 PARTICLEDLL_API void pKillOld(float age_limit, bool kill_less_than = false);
00147
00148 PARTICLEDLL_API void pMatchVelocity(float magnitude = 1.0f, float epsilon = P_EPS,
00149 float max_radius = P_MAXFLOAT);
00150
00151 PARTICLEDLL_API void pMatchRotVelocity(float magnitude = 1.0f, float epsilon = P_EPS,
00152 float max_radius = P_MAXFLOAT);
00153
00154 PARTICLEDLL_API void pMove();
00155
00156 PARTICLEDLL_API void pOrbitLine(const pVec &p, const pVec &axis, float magnitude = 1.0f,
00157 float epsilon = P_EPS, float max_radius = P_MAXFLOAT);
00158
00159 PARTICLEDLL_API void pOrbitPoint(const pVec ¢er, float magnitude = 1.0f, float epsilon = P_EPS,
00160 float max_radius = P_MAXFLOAT);
00161
00162 PARTICLEDLL_API void pRandomAccel(const pDomain &dom);
00163
00164 PARTICLEDLL_API void pRandomDisplace(const pDomain &dom);
00165
00166 PARTICLEDLL_API void pRandomVelocity(const pDomain &dom);
00167
00168 PARTICLEDLL_API void pRandomRotVelocity(const pDomain &dom);
00169
00170 PARTICLEDLL_API void pRestore(float time, bool vel = true, bool rvel = true);
00171
00172 PARTICLEDLL_API void pSink(bool kill_inside, const pDomain &dom);
00173
00174 PARTICLEDLL_API void pSinkVelocity(bool kill_inside, const pDomain &dom);
00175
00176 PARTICLEDLL_API void pSort(const pVec &eye, const pVec &look);
00177
00178 PARTICLEDLL_API void pSource(float particle_rate, const pDomain &dom);
00179
00180 PARTICLEDLL_API void pSpeedLimit(float min_speed, float max_speed = P_MAXFLOAT);
00181
00182 PARTICLEDLL_API void pTargetColor(const pVec &color, float alpha, float scale);
00183
00184 PARTICLEDLL_API void pTargetSize(const pVec &size, const pVec &scale);
00185
00186 PARTICLEDLL_API void pTargetVelocity(const pVec &vel, float scale);
00187
00188 PARTICLEDLL_API void pTargetRotVelocity(const pVec &vel, float scale);
00189
00190 PARTICLEDLL_API void pVertex(const pVec &v, long data = 0);
00191
00192 PARTICLEDLL_API void pVortex(const pVec ¢er, const pVec &axis, float magnitude = 1.0f,
00193 float tightnessExponent = 1.0f, float rotSpeed = 1.0f,
00194 float epsilon = P_EPS, float max_radius = P_MAXFLOAT);
00195
00197
00198
00199 typedef void (*P_PARTICLE_CALLBACK)(struct Particle &particle, void *data);
00200
00201 PARTICLEDLL_API void pBirthCallback(P_PARTICLE_CALLBACK callback, void *data = NULL);
00202 PARTICLEDLL_API void pDeathCallback(P_PARTICLE_CALLBACK callback, void *data = NULL);
00203
00204 PARTICLEDLL_API void pReset();
00205 PARTICLEDLL_API void pSeed(unsigned int seed);
00206
00207 enum ErrorCodes {
00208 PERR_NO_ERROR = 0,
00209 PERR_NOT_IMPLEMENTED = 1,
00210 PERR_INTERNAL_ERROR = 2
00211 };
00212
00213
00214 PARTICLEDLL_API int pGetError();
00215
00216 #endif