source: OGRE/trunk/ogrenew/PlugIns/ParticleFX/include/OgreDeflectorPlaneAffector.h @ 692

Revision 692, 3.9 KB checked in by mattausch, 18 years ago (diff)

adding ogre 1.2 and dependencies

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 __DeflectorPlaneAffector_H__
26#define __DeflectorPlaneAffector_H__
27
28#include "OgreParticleFXPrerequisites.h"
29#include "OgreParticleAffector.h"
30#include "OgreVector3.h"
31
32
33namespace Ogre {
34
35    /** This class defines a ParticleAffector which deflects particles.
36    @remarks
37        This affector (see ParticleAffector) offers a simple (and inaccurate) physical deflection.
38        All particles which hit the plane are reflected.
39    @par
40        The plane is defined by a point (plane_point) and the normal (plane_normal).
41        In addition it is possible to change the strenght of the recoil by using the bounce parameter.
42    */
43    class _OgreParticleFXExport DeflectorPlaneAffector : public ParticleAffector
44    {
45    public:
46        /** Command object for plane point (see ParamCommand).*/
47        class CmdPlanePoint : public ParamCommand
48        {
49        public:
50            String doGet(const void* target) const;
51            void doSet(void* target, const String& val);
52        };
53
54        /** Command object for plane normal (see ParamCommand).*/
55        class CmdPlaneNormal : public ParamCommand
56        {
57        public:
58            String doGet(const void* target) const;
59            void doSet(void* target, const String& val);
60        };
61
62        /** Command object for bounce (see ParamCommand).*/
63        class CmdBounce : public ParamCommand
64        {
65        public:
66            String doGet(const void* target) const;
67            void doSet(void* target, const String& val);
68        };
69
70        /// Default constructor
71        DeflectorPlaneAffector(ParticleSystem* psys);
72
73        /** See ParticleAffector. */
74        void _affectParticles(ParticleSystem* pSystem, Real timeElapsed);
75
76        /** Sets the plane point of the deflector plane. */
77        void setPlanePoint(const Vector3& pos);
78
79        /** Gets the plane point of the deflector plane. */
80        Vector3 getPlanePoint(void) const;
81
82        /** Sets the plane normal of the deflector plane. */
83        void setPlaneNormal(const Vector3& normal);
84
85        /** Gets the plane normal of the deflector plane. */
86        Vector3 getPlaneNormal(void) const;
87
88        /** Sets the bounce value of the deflection. */
89        void setBounce(Real bounce);
90
91        /** Gets the bounce value of the deflection. */
92        Real getBounce(void) const;
93
94        /// Command objects
95        static CmdPlanePoint msPlanePointCmd;
96        static CmdPlaneNormal msPlaneNormalCmd;
97        static CmdBounce msBounceCmd;
98
99    protected:
100        /// deflector plane point
101        Vector3 mPlanePoint;
102        /// deflector plane normal vector
103        Vector3 mPlaneNormal;
104
105        /// bounce factor (0.5 means 50 percent)
106        Real mBounce;
107    };
108
109}
110
111#endif
Note: See TracBrowser for help on using the repository browser.