OGRE  2.0
Object-Oriented Graphics Rendering Engine
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
OgreColourFaderAffector2.h
Go to the documentation of this file.
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 __ColourFaderAffector2_H__
29 #define __ColourFaderAffector2_H__
30 
32 #include "OgreParticleAffector.h"
33 #include "OgreStringInterface.h"
34 
35 namespace Ogre {
36 
37 
44  {
45  public:
46 
48  class CmdRedAdjust1 : public ParamCommand
49  {
50  public:
51  String doGet(const void* target) const;
52  void doSet(void* target, const String& val);
53  };
54 
57  {
58  public:
59  String doGet(const void* target) const;
60  void doSet(void* target, const String& val);
61  };
62 
65  {
66  public:
67  String doGet(const void* target) const;
68  void doSet(void* target, const String& val);
69  };
70 
73  {
74  public:
75  String doGet(const void* target) const;
76  void doSet(void* target, const String& val);
77  };
78 
80  class CmdRedAdjust2 : public ParamCommand
81  {
82  public:
83  String doGet(const void* target) const;
84  void doSet(void* target, const String& val);
85  };
86 
89  {
90  public:
91  String doGet(const void* target) const;
92  void doSet(void* target, const String& val);
93  };
94 
97  {
98  public:
99  String doGet(const void* target) const;
100  void doSet(void* target, const String& val);
101  };
102 
105  {
106  public:
107  String doGet(const void* target) const;
108  void doSet(void* target, const String& val);
109  };
110 
113  {
114  public:
115  String doGet(const void* target) const;
116  void doSet(void* target, const String& val);
117  };
118 
119 
122 
124  void _affectParticles(ParticleSystem* pSystem, Real timeElapsed);
125 
132  void setAdjust1(float red, float green, float blue, float alpha = 0.0);
133  void setAdjust2(float red, float green, float blue, float alpha = 0.0);
140  void setRedAdjust1(float red);
141  void setRedAdjust2(float red);
142 
144  float getRedAdjust1(void) const;
145  float getRedAdjust2(void) const;
146 
153  void setGreenAdjust1(float green);
154  void setGreenAdjust2(float green);
156  float getGreenAdjust1(void) const;
157  float getGreenAdjust2(void) const;
164  void setBlueAdjust1(float blue);
165  void setBlueAdjust2(float blue);
167  float getBlueAdjust1(void) const;
168  float getBlueAdjust2(void) const;
169 
176  void setAlphaAdjust1(float alpha);
177  void setAlphaAdjust2(float alpha);
179  float getAlphaAdjust1(void) const;
180  float getAlphaAdjust2(void) const;
181 
182 
183  void setStateChange(Real NewValue );
184  Real getStateChange(void) const;
185 
195 
196  protected:
197  float mRedAdj1, mRedAdj2;
198  float mGreenAdj1, mGreenAdj2;
199  float mBlueAdj1, mBlueAdj2;
200  float mAlphaAdj1, mAlphaAdj2;
202 
204  inline void applyAdjustWithClamp(float* pComponent, float adjust)
205  {
206  *pComponent += adjust;
207  // Limit to 0
208  if (*pComponent < 0.0)
209  {
210  *pComponent = 0.0f;
211  }
212  // Limit to 1
213  else if (*pComponent > 1.0)
214  {
215  *pComponent = 1.0f;
216  }
217  }
218 
219  };
220 
221 
222 }
223 
224 
225 #endif
226 
Class defining particle system based special effects.
float Real
Software floating point type.
This plugin subclass of ParticleAffector allows you to alter the colour of particles.
Command object for alpha adjust (see ParamCommand).
static CmdAlphaAdjust2 msAlphaCmd2
Command object for red adjust (see ParamCommand).
Command object for blue adjust (see ParamCommand).
static CmdGreenAdjust1 msGreenCmd1
void applyAdjustWithClamp(float *pComponent, float adjust)
Internal method for adjusting while clamping to [0,1].
Command object for red adjust (see ParamCommand).
#define _OgreParticleFXExport
Command object for alpha adjust (see ParamCommand).
Command object for blue adjust (see ParamCommand).
Abstract class defining the interface to be implemented by particle affectors.
Command object for green adjust (see ParamCommand).
static CmdAlphaAdjust1 msAlphaCmd1
static CmdGreenAdjust2 msGreenCmd2
_StringBase String
Definition: OgreCommon.h:53
Command object for alpha adjust (see ParamCommand).
Command object for green adjust (see ParamCommand).
Abstract class which is command object which gets/sets parameters.