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 (c) 2000-2006 Torus Knot Software Ltd |
---|
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 __AreaEmitter_H__ |
---|
30 | #define __AreaEmitter_H__ |
---|
31 | |
---|
32 | #include "OgreParticleFXPrerequisites.h" |
---|
33 | #include "OgreParticleEmitter.h" |
---|
34 | |
---|
35 | namespace Ogre { |
---|
36 | |
---|
37 | /** Particle emitter which emits particles randomly from points inside |
---|
38 | an area (box, sphere, ellipsoid whatever subclasses choose to be). |
---|
39 | @remarks |
---|
40 | This is an empty superclass and needs to be subclassed. Basic particle |
---|
41 | emitter emits particles from/in an (unspecified) area. The |
---|
42 | initial direction of these particles can either be a single direction |
---|
43 | (i.e. a line), a random scattering inside a cone, or a random |
---|
44 | scattering in all directions, depending the 'angle' parameter, which |
---|
45 | is the angle across which to scatter the particles either side of the |
---|
46 | base direction of the emitter. |
---|
47 | */ |
---|
48 | class _OgreParticleFXExport AreaEmitter : public ParticleEmitter |
---|
49 | { |
---|
50 | public: |
---|
51 | /** Command object for area emitter size (see ParamCommand).*/ |
---|
52 | class CmdWidth : 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 area emitter size (see ParamCommand).*/ |
---|
59 | class CmdHeight : public ParamCommand |
---|
60 | { |
---|
61 | public: |
---|
62 | String doGet(const void* target) const; |
---|
63 | void doSet(void* target, const String& val); |
---|
64 | }; |
---|
65 | /** Command object for area emitter size (see ParamCommand).*/ |
---|
66 | class CmdDepth : public ParamCommand |
---|
67 | { |
---|
68 | public: |
---|
69 | String doGet(const void* target) const; |
---|
70 | void doSet(void* target, const String& val); |
---|
71 | }; |
---|
72 | |
---|
73 | |
---|
74 | AreaEmitter(ParticleSystem* psys) : ParticleEmitter(psys) {} |
---|
75 | |
---|
76 | |
---|
77 | /** See ParticleEmitter. */ |
---|
78 | unsigned short _getEmissionCount(Real timeElapsed); |
---|
79 | |
---|
80 | /** Overloaded to update the trans. matrix */ |
---|
81 | void setDirection( const Vector3& direction ); |
---|
82 | |
---|
83 | /** Sets the size of the area from which particles are emitted. |
---|
84 | @param |
---|
85 | size Vector describing the size of the area. The area extends |
---|
86 | around the center point by half the x, y and z components of |
---|
87 | this vector. The box is aligned such that it's local Z axis points |
---|
88 | along it's direction (see setDirection) |
---|
89 | */ |
---|
90 | void setSize(const Vector3& size); |
---|
91 | |
---|
92 | /** Sets the size of the area from which particles are emitted. |
---|
93 | @param x,y,z |
---|
94 | Individual axis lengths describing the size of the area. The area |
---|
95 | extends around the center point by half the x, y and z components |
---|
96 | of this vector. The box is aligned such that it's local Z axis |
---|
97 | points along it's direction (see setDirection) |
---|
98 | */ |
---|
99 | void setSize(Real x, Real y, Real z); |
---|
100 | /** Sets the size of the clear space inside the area from where NO particles are emitted. |
---|
101 | @param x,y,z |
---|
102 | Individual axis lengths describing the size of the clear space. |
---|
103 | The clear space is aligned like the outer area. |
---|
104 | (see setDirection and setSize) |
---|
105 | */ |
---|
106 | // void setClearSpace(Real x, Real y, Real z); |
---|
107 | |
---|
108 | /** Sets the width (local x size) of the emitter. */ |
---|
109 | void setWidth(Real width); |
---|
110 | /** Gets the width (local x size) of the emitter. */ |
---|
111 | Real getWidth(void) const; |
---|
112 | /** Sets the height (local y size) of the emitter. */ |
---|
113 | void setHeight(Real Height); |
---|
114 | /** Gets the height (local y size) of the emitter. */ |
---|
115 | Real getHeight(void) const; |
---|
116 | /** Sets the depth (local y size) of the emitter. */ |
---|
117 | void setDepth(Real Depth); |
---|
118 | /** Gets the depth (local y size) of the emitter. */ |
---|
119 | Real getDepth(void) const; |
---|
120 | |
---|
121 | protected: |
---|
122 | /// Size of the area |
---|
123 | Vector3 mSize; |
---|
124 | |
---|
125 | /// Local axes, not normalised, their magnitude reflects area size |
---|
126 | Vector3 mXRange, mYRange, mZRange; |
---|
127 | |
---|
128 | /// Internal method for generating the area axes |
---|
129 | void genAreaAxes(void); |
---|
130 | /** Internal for initializing some defaults and parameters |
---|
131 | @returns True if custom parameters need initialising |
---|
132 | */ |
---|
133 | bool initDefaults(const String& mType); |
---|
134 | |
---|
135 | /// Command objects |
---|
136 | static CmdWidth msWidthCmd; |
---|
137 | static CmdHeight msHeightCmd; |
---|
138 | static CmdDepth msDepthCmd; |
---|
139 | |
---|
140 | |
---|
141 | |
---|
142 | }; |
---|
143 | |
---|
144 | } |
---|
145 | |
---|
146 | #endif |
---|
147 | |
---|