1 | /**********************************************************************
|
---|
2 | *<
|
---|
3 | FILE: particle.h
|
---|
4 |
|
---|
5 | DESCRIPTION: Particle system object
|
---|
6 |
|
---|
7 | CREATED BY: Rolf Berteig
|
---|
8 |
|
---|
9 | HISTORY: 10-18-95
|
---|
10 |
|
---|
11 | *> Copyright (c) 1994, All Rights Reserved.
|
---|
12 | **********************************************************************/
|
---|
13 |
|
---|
14 | #ifndef __PARTICLE__
|
---|
15 | #define __PARTICLE__
|
---|
16 |
|
---|
17 | #include "export.h"
|
---|
18 |
|
---|
19 | class ParticleSys;
|
---|
20 |
|
---|
21 | // Custom particle drawing callback
|
---|
22 | class CustomParticleDisplay {
|
---|
23 | public:
|
---|
24 | virtual void DrawParticle(GraphicsWindow *gw,ParticleSys &parts,int i)=0;
|
---|
25 | };
|
---|
26 |
|
---|
27 | class ParticleSys {
|
---|
28 | private:
|
---|
29 | CustomParticleDisplay *draw;
|
---|
30 |
|
---|
31 | void DrawGW(GraphicsWindow *gw,DWORD flags,MarkerType type);
|
---|
32 |
|
---|
33 | public:
|
---|
34 | Tab<Point3> points; // The particles themselves
|
---|
35 | Tab<Point3> vels; // Velocities of each particle (optional)
|
---|
36 | Tab<TimeValue> ages; // Age of each particle (optional)
|
---|
37 | float size; // World space radius of a particle
|
---|
38 |
|
---|
39 |
|
---|
40 | // Draws the particle system into the GW
|
---|
41 | DllExport void Render(GraphicsWindow *gw,MarkerType type=POINT_MRKR);
|
---|
42 |
|
---|
43 | // Hit tests the particle system. Returns TRUE if a particle is hit.
|
---|
44 | DllExport BOOL HitTest(GraphicsWindow *gw, HitRegion *hr,
|
---|
45 | int abortOnHit=FALSE,MarkerType type=POINT_MRKR);
|
---|
46 |
|
---|
47 | // Gets bounding box
|
---|
48 | DllExport Box3 BoundBox(Matrix3 *tm=NULL);
|
---|
49 |
|
---|
50 | // Sets all counts to 0
|
---|
51 | DllExport void FreeAll();
|
---|
52 |
|
---|
53 | // Sets the size. Flags indicate if optional params should be allocated
|
---|
54 | DllExport void SetCount(int c,DWORD flags);
|
---|
55 |
|
---|
56 | int Count() {return points.Count();}
|
---|
57 | Point3& operator[](int i) {return points[i];}
|
---|
58 |
|
---|
59 | // Is particle i alive?
|
---|
60 | BOOL Alive(int i) {return ages[i]>=0;}
|
---|
61 |
|
---|
62 | // Sets custom draw callback
|
---|
63 | void SetCustomDraw(CustomParticleDisplay *d) {draw=d;}
|
---|
64 | };
|
---|
65 |
|
---|
66 | // Flags for SetCount()
|
---|
67 | #define PARTICLE_VELS (1<<0)
|
---|
68 | #define PARTICLE_AGES (1<<1)
|
---|
69 |
|
---|
70 |
|
---|
71 | #endif // __PARTICLE__
|
---|