00001 #ifndef _ANTI_PARTICLE_ 00002 #define _ANTI_PARTICLE_ 00003 00004 #include "antistd.h" 00005 #include "antiglobals.h" 00006 #include "texture.h" 00007 00008 typedef struct aeParticle 00009 { 00010 vec2 size; 00011 vec3 pos; 00012 vec3 vel; 00013 vec3 acc; 00014 int ttl; 00015 00016 aeTexture* tex; 00017 vec4 color; 00018 00019 struct aeParticle* prev; 00020 struct aeParticle* next; 00021 } aeParticle; 00022 00023 typedef struct aeParticleEmitter 00024 { 00025 vec2 size; 00026 vec3 pos; 00027 vec3 vel; 00028 float arc; // max angle deflection from vel 00029 vec3 acc; 00030 int ttl; 00031 float rate; // how many per second to emit (on average) 00032 00033 vec4 color; 00034 aeTexture* tex; 00035 00036 int (*spawn_func)(void); // how many to emit 00037 void (*init_func)(aeParticle*,struct aeParticleEmitter*); // initialize particle 00038 void (*size_func)(vec2*); // particle size 00039 void (*pos_func)(vec3*); // decide initial position 00040 void (*vel_func)(vec3*); // decide initial velocity 00041 void (*acc_func)(vec3*); // decide initial acceleration 00042 int (*ttl_func)(void); // decide time to live 00043 void (*color_func)(vec4*); 00044 aeTexture* (*tex_func)(void); 00045 00046 void (*frame_func)(aeParticle*); 00047 int frame_override; 00048 00049 aeParticle* root; 00050 aeParticle* end; 00051 } aeParticleEmitter; 00052 00053 aeParticleEmitter* aeCreateParticleEmitter(void); 00054 void aeDestroyParticleEmitter(aeParticleEmitter*); 00055 void aeRenderParticles(aeParticleEmitter*); 00056 void __aeDestroyParticle(aeParticleEmitter*, aeParticle*); 00057 00058 #endif