1 | /* |
---|
2 | ----------------------------------------------------------------------------- |
---|
3 | This source file is part of OGRE |
---|
4 | (Object-oriented Graphics Rendering Engine) |
---|
5 | For the latest info, see http://www.ogre3d.org/ |
---|
6 | |
---|
7 | Copyright ) 2002 Tels <http://bloodgate.com> based on BoxEmitter |
---|
8 | Also see acknowledgements in Readme.html |
---|
9 | |
---|
10 | This program is free software; you can redistribute it and/or modify it under |
---|
11 | the terms of the GNU Lesser General Public License as published by the Free Software |
---|
12 | Foundation; either version 2 of the License, or (at your option) any later |
---|
13 | version. |
---|
14 | |
---|
15 | This program is distributed in the hope that it will be useful, but WITHOUT |
---|
16 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
---|
17 | FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. |
---|
18 | |
---|
19 | You should have received a copy of the GNU Lesser General Public License along with |
---|
20 | this program; if not, write to the Free Software Foundation, Inc., 59 Temple |
---|
21 | Place - Suite 330, Boston, MA 02111-1307, USA, or go to |
---|
22 | http://www.gnu.org/copyleft/lesser.txt. |
---|
23 | |
---|
24 | You may alternatively use this source under the terms of a specific version of |
---|
25 | the OGRE Unrestricted License provided you have obtained such a license from |
---|
26 | Torus Knot Software Ltd. |
---|
27 | ----------------------------------------------------------------------------- |
---|
28 | */ |
---|
29 | #ifndef __RingEmitter_H__ |
---|
30 | #define __RingEmitter_H__ |
---|
31 | |
---|
32 | #include "OgreParticleFXPrerequisites.h" |
---|
33 | #include "OgreAreaEmitter.h" |
---|
34 | #include "OgreMath.h" |
---|
35 | |
---|
36 | namespace Ogre { |
---|
37 | |
---|
38 | /** Particle emitter which emits particles randomly from points inside a ring (e.g. a tube). |
---|
39 | @remarks |
---|
40 | This particle emitter emits particles from a ring-shaped area. |
---|
41 | The initial direction of these particles can either be a single |
---|
42 | direction (i.e. a line), a random scattering inside a cone, or a random |
---|
43 | scattering in all directions, depending the 'angle' parameter, which |
---|
44 | is the angle across which to scatter the particles either side of the |
---|
45 | base direction of the emitter. |
---|
46 | */ |
---|
47 | class _OgreParticleFXExport RingEmitter : public AreaEmitter |
---|
48 | { |
---|
49 | public: |
---|
50 | // See AreaEmitter |
---|
51 | /** Command object for inner size (see ParamCommand).*/ |
---|
52 | class CmdInnerX : public ParamCommand |
---|
53 | { |
---|
54 | public: |
---|
55 | String doGet(const void* target) const; |
---|
56 | void doSet(void* target, const String& val); |
---|
57 | }; |
---|
58 | /** Command object for inner size (see ParamCommand).*/ |
---|
59 | class CmdInnerY : public ParamCommand |
---|
60 | { |
---|
61 | public: |
---|
62 | String doGet(const void* target) const; |
---|
63 | void doSet(void* target, const String& val); |
---|
64 | }; |
---|
65 | |
---|
66 | RingEmitter(ParticleSystem* psys); |
---|
67 | |
---|
68 | /** See ParticleEmitter. */ |
---|
69 | void _initParticle(Particle* pParticle); |
---|
70 | |
---|
71 | /** Sets the size of the clear space inside the area from where NO particles are emitted. |
---|
72 | @param x,y,z |
---|
73 | Parametric values describing the proportion of the shape which is hollow in each direction. |
---|
74 | E.g. 0 is solid, 0.5 is half-hollow etc |
---|
75 | */ |
---|
76 | void setInnerSize(Real x, Real y); |
---|
77 | |
---|
78 | /** Sets the x component of the area inside the ellipsoid which doesn't emit particles. |
---|
79 | @param x |
---|
80 | Parametric value describing the proportion of the shape which is hollow in this direction. |
---|
81 | E.g. 0 is solid, 0.5 is half-hollow etc |
---|
82 | */ |
---|
83 | void setInnerSizeX(Real x); |
---|
84 | /** Sets the y component of the area inside the ellipsoid which doesn't emit particles. |
---|
85 | @param y |
---|
86 | Parametric value describing the proportion of the shape which is hollow in this direction. |
---|
87 | E.g. 0 is solid, 0.5 is half-hollow etc |
---|
88 | */ |
---|
89 | void setInnerSizeY(Real y); |
---|
90 | /** Gets the x component of the area inside the ellipsoid which doesn't emit particles. */ |
---|
91 | Real getInnerSizeX(void) const; |
---|
92 | /** Gets the y component of the area inside the ellipsoid which doesn't emit particles. */ |
---|
93 | Real getInnerSizeY(void) const; |
---|
94 | |
---|
95 | protected: |
---|
96 | // See ParticleEmitter |
---|
97 | static CmdInnerX msCmdInnerX; |
---|
98 | static CmdInnerY msCmdInnerY; |
---|
99 | |
---|
100 | /// Size of 'clear' center area (> 0 and < 1.0) |
---|
101 | Real mInnerSizex; |
---|
102 | Real mInnerSizey; |
---|
103 | |
---|
104 | |
---|
105 | |
---|
106 | }; |
---|
107 | |
---|
108 | } |
---|
109 | |
---|
110 | #endif |
---|
111 | |
---|