/src/ogre/PlugIns/ParticleFX/include/OgreAreaEmitter.h
Line | Count | Source |
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-2014 Torus Knot Software Ltd |
8 | | |
9 | | Permission is hereby granted, free of charge, to any person obtaining a copy |
10 | | of this software and associated documentation files (the "Software"), to deal |
11 | | in the Software without restriction, including without limitation the rights |
12 | | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
13 | | copies of the Software, and to permit persons to whom the Software is |
14 | | furnished to do so, subject to the following conditions: |
15 | | |
16 | | The above copyright notice and this permission notice shall be included in |
17 | | all copies or substantial portions of the Software. |
18 | | |
19 | | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
20 | | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
21 | | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
22 | | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
23 | | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
24 | | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
25 | | THE SOFTWARE. |
26 | | ----------------------------------------------------------------------------- |
27 | | */ |
28 | | #ifndef __AreaEmitter_H__ |
29 | | #define __AreaEmitter_H__ |
30 | | |
31 | | #include "OgreParticleFXPrerequisites.h" |
32 | | #include "OgreParticleEmitter.h" |
33 | | |
34 | | namespace Ogre { |
35 | | |
36 | | /** \addtogroup Plugins Plugins |
37 | | * @{ |
38 | | */ |
39 | | /** \defgroup ParticleFX ParticleFX |
40 | | * Provides Emmiter and Affector implementations for ParticleSystem |
41 | | * @{ |
42 | | */ |
43 | | |
44 | | /** Particle emitter which emits particles randomly from points inside |
45 | | an area (box, sphere, ellipsoid whatever subclasses choose to be). |
46 | | |
47 | | This is an empty superclass and needs to be subclassed. Basic particle |
48 | | emitter emits particles from/in an (unspecified) area. The |
49 | | initial direction of these particles can either be a single direction |
50 | | (i.e. a line), a random scattering inside a cone, or a random |
51 | | scattering in all directions, depending the 'angle' parameter, which |
52 | | is the angle across which to scatter the particles either side of the |
53 | | base direction of the emitter. |
54 | | */ |
55 | | class AreaEmitter : public ParticleEmitter |
56 | | { |
57 | | public: |
58 | | /** Command object for area emitter size (see ParamCommand).*/ |
59 | | class CmdWidth : public ParamCommand |
60 | | { |
61 | | public: |
62 | | String doGet(const void* target) const override; |
63 | | void doSet(void* target, const String& val) override; |
64 | | }; |
65 | | /** Command object for area emitter size (see ParamCommand).*/ |
66 | | class CmdHeight : public ParamCommand |
67 | | { |
68 | | public: |
69 | | String doGet(const void* target) const override; |
70 | | void doSet(void* target, const String& val) override; |
71 | | }; |
72 | | /** Command object for area emitter size (see ParamCommand).*/ |
73 | | class CmdDepth : public ParamCommand |
74 | | { |
75 | | public: |
76 | | String doGet(const void* target) const override; |
77 | | void doSet(void* target, const String& val) override; |
78 | | }; |
79 | | |
80 | | |
81 | 0 | AreaEmitter(ParticleSystem* psys) : ParticleEmitter(psys) {} |
82 | | |
83 | | /** Overloaded to update the trans. matrix */ |
84 | | void setDirection( const Vector3& direction ) override; |
85 | | |
86 | | /** Sets the size of the area from which particles are emitted. |
87 | | @param |
88 | | size Vector describing the size of the area. The area extends |
89 | | around the center point by half the x, y and z components of |
90 | | this vector. The box is aligned such that it's local Z axis points |
91 | | along it's direction (see setDirection) |
92 | | */ |
93 | | void setSize(const Vector3& size); |
94 | | |
95 | | /** Sets the size of the area from which particles are emitted. |
96 | | @param x,y,z |
97 | | Individual axis lengths describing the size of the area. The area |
98 | | extends around the center point by half the x, y and z components |
99 | | of this vector. The box is aligned such that it's local Z axis |
100 | | points along it's direction (see setDirection) |
101 | | */ |
102 | | void setSize(Real x, Real y, Real z); |
103 | | |
104 | | /** Sets the width (local x size) of the emitter. */ |
105 | | void setWidth(Real width); |
106 | | /** Gets the width (local x size) of the emitter. */ |
107 | | Real getWidth(void) const; |
108 | | /** Sets the height (local y size) of the emitter. */ |
109 | | void setHeight(Real Height); |
110 | | /** Gets the height (local y size) of the emitter. */ |
111 | | Real getHeight(void) const; |
112 | | /** Sets the depth (local y size) of the emitter. */ |
113 | | void setDepth(Real Depth); |
114 | | /** Gets the depth (local y size) of the emitter. */ |
115 | | Real getDepth(void) const; |
116 | | |
117 | | protected: |
118 | | /// Size of the area |
119 | | Vector3 mSize; |
120 | | |
121 | | /// Local axes, not normalised, their magnitude reflects area size |
122 | | Vector3 mXRange, mYRange, mZRange; |
123 | | |
124 | | /// Internal method for generating the area axes |
125 | | void genAreaAxes(void); |
126 | | /** Internal for initializing some defaults and parameters |
127 | | @return True if custom parameters need initialising |
128 | | */ |
129 | | bool initDefaults(const String& mType); |
130 | | |
131 | | /// Command objects |
132 | | static CmdWidth msWidthCmd; |
133 | | static CmdHeight msHeightCmd; |
134 | | static CmdDepth msDepthCmd; |
135 | | |
136 | | |
137 | | |
138 | | }; |
139 | | /** @} */ |
140 | | /** @} */ |
141 | | } |
142 | | |
143 | | #endif |
144 | | |