windEmitter.h

Engine/source/T3D/fx/windEmitter.h

More...

Classes:

Public Typedefs

WindEmitterList 

A vector of WindEmitter pointers.

Detailed Description

Public Typedefs

typedef Vector< WindEmitter * > WindEmitterList 

A vector of WindEmitter pointers.

 1
 2//-----------------------------------------------------------------------------
 3// Copyright (c) 2012 GarageGames, LLC
 4//
 5// Permission is hereby granted, free of charge, to any person obtaining a copy
 6// of this software and associated documentation files (the "Software"), to
 7// deal in the Software without restriction, including without limitation the
 8// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
 9// sell copies of the Software, and to permit persons to whom the Software is
10// furnished to do so, subject to the following conditions:
11//
12// The above copyright notice and this permission notice shall be included in
13// all copies or substantial portions of the Software.
14//
15// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
21// IN THE SOFTWARE.
22//-----------------------------------------------------------------------------
23
24#ifndef _WINDEMITTER_H_
25#define _WINDEMITTER_H_
26
27#ifndef _MPOINT3_H_
28   #include "math/mPoint3.h"
29#endif
30#ifndef _MSPHERE_H_
31   #include "math/mSphere.h"
32#endif
33#ifndef _TVECTOR_H_
34   #include "core/util/tVector.h"
35#endif
36
37class WindEmitter;
38
39/// A vector of WindEmitter pointers.
40typedef Vector<WindEmitter*> WindEmitterList;
41
42
43class WindEmitter
44{
45public:
46   WindEmitter();
47   ~WindEmitter();
48
49   operator const SphereF&() const { return mSphere; }
50
51   void update( const Point3F& pos, const VectorF& velocity );
52
53   void setPosition( const Point3F& pos );
54
55   void setRadius( F32 radius );
56
57   void setStrength( F32 strength );
58
59   void setTurbulency( F32 frequency, F32 strength );
60
61   const Point3F& getCenter() const { return mSphere.center; }
62
63   F32 getRadius() const { return mSphere.radius; }
64
65   F32 getStrength() const { return mStrength; }
66
67   F32 getTurbulenceFrequency() const { return mTurbulenceFrequency; }
68
69   F32 getTurbulenceStrength() const { return mTurbulenceStrength; }
70
71   const VectorF& getVelocity() const { return mVelocity; }
72
73
74   static bool findBest( const Point3F& cameraPos, 
75                         const VectorF& cameraDir,
76                         F32 viewDistance,
77                         U32 maxResults,
78                         WindEmitterList* results );
79
80protected:
81   SphereF mSphere;
82
83   VectorF mVelocity;
84
85   F32 mStrength;
86   F32 mTurbulenceFrequency;
87   F32 mTurbulenceStrength;
88   F32 mScore;
89
90   bool mEnabled;
91
92   static WindEmitterList smAllEmitters;
93
94   static S32 QSORT_CALLBACK _sortByScore( const void* a, const void* b );
95};
96
97#endif // _WINDEMITTER_H_
98