source: OGRE/trunk/ogrenew/PlugIns/ParticleFX/include/OgreAreaEmitter.h @ 657

Revision 657, 5.5 KB checked in by mattausch, 18 years ago (diff)

added ogre dependencies and patched ogre sources

Line 
1/*
2-----------------------------------------------------------------------------
3This source file is part of OGRE
4    (Object-oriented Graphics Rendering Engine)
5For the latest info, see http://www.ogre3d.org/
6
7Copyright (c) 2000-2005 The OGRE Team
8Also see acknowledgements in Readme.html
9
10This program is free software; you can redistribute it and/or modify it under
11the terms of the GNU Lesser General Public License as published by the Free Software
12Foundation; either version 2 of the License, or (at your option) any later
13version.
14
15This program is distributed in the hope that it will be useful, but WITHOUT
16ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
17FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
18
19You should have received a copy of the GNU Lesser General Public License along with
20this program; if not, write to the Free Software Foundation, Inc., 59 Temple
21Place - Suite 330, Boston, MA 02111-1307, USA, or go to
22http://www.gnu.org/copyleft/lesser.txt.
23-----------------------------------------------------------------------------
24*/
25#ifndef __AreaEmitter_H__
26#define __AreaEmitter_H__
27
28#include "OgreParticleFXPrerequisites.h"
29#include "OgreParticleEmitter.h"
30
31namespace Ogre {
32
33    /** Particle emitter which emits particles randomly from points inside
34        an area (box, sphere, ellipsoid whatever subclasses choose to be).
35    @remarks
36        This is an empty superclass and needs to be subclassed. Basic particle
37        emitter emits particles from/in an (unspecified) area. The
38        initial direction of these particles can either be a single direction
39        (i.e. a line), a random scattering inside a cone, or a random
40        scattering in all directions, depending the 'angle' parameter, which
41        is the angle across which to scatter the particles either side of the
42        base direction of the emitter.
43    */
44    class _OgreParticleFXExport AreaEmitter : public ParticleEmitter
45    {
46    public:
47        /** Command object for area emitter size (see ParamCommand).*/
48        class CmdWidth : public ParamCommand
49        {
50        public:
51            String doGet(const void* target) const;
52            void doSet(void* target, const String& val);
53        };
54        /** Command object for area emitter size (see ParamCommand).*/
55        class CmdHeight : public ParamCommand
56        {
57        public:
58            String doGet(const void* target) const;
59            void doSet(void* target, const String& val);
60        };
61        /** Command object for area emitter size (see ParamCommand).*/
62        class CmdDepth : public ParamCommand
63        {
64        public:
65            String doGet(const void* target) const;
66            void doSet(void* target, const String& val);
67        };
68
69
70        AreaEmitter(ParticleSystem* psys) : ParticleEmitter(psys) {}
71
72
73        /** See ParticleEmitter. */
74        unsigned short _getEmissionCount(Real timeElapsed);
75
76        /** Overloaded to update the trans. matrix */
77        void setDirection( const Vector3& direction );
78
79        /** Sets the size of the area from which particles are emitted.
80        @param
81            size Vector describing the size of the area. The area extends
82            around the center point by half the x, y and z components of
83            this vector. The box is aligned such that it's local Z axis points
84            along it's direction (see setDirection)
85        */
86        void setSize(const Vector3& size);
87
88        /** Sets the size of the area from which particles are emitted.
89        @param x,y,z
90            Individual axis lengths describing the size of the area. The area
91            extends around the center point by half the x, y and z components
92            of this vector. The box is aligned such that it's local Z axis
93            points along it's direction (see setDirection)
94        */
95        void setSize(Real x, Real y, Real z);
96        /** Sets the size of the clear space inside the area from where NO particles are emitted.
97        @param x,y,z
98            Individual axis lengths describing the size of the clear space.
99            The clear space is aligned like the outer area.
100            (see setDirection and setSize)
101        */
102//        void setClearSpace(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        @returns 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#endif
143
Note: See TracBrowser for help on using the repository browser.