# OgreColourFaderAffector2.h

Go to the documentation of this file.

    00001 /*
    00002 -----------------------------------------------------------------------------
    00003 This source file is part of OGRE
    00004     (Object-oriented Graphics Rendering Engine)
    00005 For the latest info, see http://www.ogre3d.org/
    00006
    00007 Copyright (c) 2000-2005 The OGRE Team
    00008 Also see acknowledgements in Readme.html
    00009
    00010 This program is free software; you can redistribute it and/or modify it under
    00011 the terms of the GNU Lesser General Public License as published by the Free Software
    00012 Foundation; either version 2 of the License, or (at your option) any later
    00013 version.
    00014
    00015 This program is distributed in the hope that it will be useful, but WITHOUT
    00016 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
    00017 FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
    00018
    00019 You should have received a copy of the GNU Lesser General Public License along with
    00020 this program; if not, write to the Free Software Foundation, Inc., 59 Temple
    00021 Place - Suite 330, Boston, MA 02111-1307, USA, or go to
    00022 http://www.gnu.org/copyleft/lesser.txt.
    00023 -----------------------------------------------------------------------------
    00024 */
    00025 #ifndef __ColourFaderAffector2_H__
    00026 #define __ColourFaderAffector2_H__
    00027
    00028 #include "OgreParticleFXPrerequisites.h"
    00029 #include "OgreParticleAffector.h"
    00030 #include "OgreStringInterface.h"
    00031
    00032 namespace Ogre {
    00033
    00034
    00040     class _OgreParticleFXExport ColourFaderAffector2 : public ParticleAffector
    00041     {
    00042     public:
    00043
    00045         class CmdRedAdjust1 : public ParamCommand
    00046         {
    00047         public:
    00048             String doGet(const void* target) const;
    00049             void doSet(void* target, const String& val);
    00050         };
    00051
    00053         class CmdGreenAdjust1 : public ParamCommand
    00054         {
    00055         public:
    00056             String doGet(const void* target) const;
    00057             void doSet(void* target, const String& val);
    00058         };
    00059
    00061         class CmdBlueAdjust1 : public ParamCommand
    00062         {
    00063         public:
    00064             String doGet(const void* target) const;
    00065             void doSet(void* target, const String& val);
    00066         };
    00067
    00069         class CmdAlphaAdjust1 : public ParamCommand
    00070         {
    00071         public:
    00072             String doGet(const void* target) const;
    00073             void doSet(void* target, const String& val);
    00074         };
    00075
    00077         class CmdRedAdjust2 : public ParamCommand
    00078         {
    00079         public:
    00080             String doGet(const void* target) const;
    00081             void doSet(void* target, const String& val);
    00082         };
    00083
    00085         class CmdGreenAdjust2 : public ParamCommand
    00086         {
    00087         public:
    00088             String doGet(const void* target) const;
    00089             void doSet(void* target, const String& val);
    00090         };
    00091
    00093         class CmdBlueAdjust2 : public ParamCommand
    00094         {
    00095         public:
    00096             String doGet(const void* target) const;
    00097             void doSet(void* target, const String& val);
    00098         };
    00099
    00101         class CmdAlphaAdjust2 : public ParamCommand
    00102         {
    00103         public:
    00104             String doGet(const void* target) const;
    00105             void doSet(void* target, const String& val);
    00106         };
    00107
    00109         class CmdStateChange : public ParamCommand
    00110         {
    00111         public:
    00112             String doGet(const void* target) const;
    00113             void doSet(void* target, const String& val);
    00114         };
    00115
    00116
    00118         ColourFaderAffector2(ParticleSystem* psys);
    00119
    00121         void _affectParticles(ParticleSystem* pSystem, Real timeElapsed);
    00122
    00129         void setAdjust1(float red, float green, float blue, float alpha = 0.0);
    00130         void setAdjust2(float red, float green, float blue, float alpha = 0.0);
    00137         void setRedAdjust1(float red);
    00138         void setRedAdjust2(float red);
    00139
    00141         float getRedAdjust1(void) const;
    00142         float getRedAdjust2(void) const;
    00143
    00150         void setGreenAdjust1(float green);
    00151         void setGreenAdjust2(float green);
    00153         float getGreenAdjust1(void) const;
    00154         float getGreenAdjust2(void) const;
    00161         void setBlueAdjust1(float blue);
    00162         void setBlueAdjust2(float blue);
    00164         float getBlueAdjust1(void) const;
    00165         float getBlueAdjust2(void) const;
    00166
    00173         void setAlphaAdjust1(float alpha);
    00174         void setAlphaAdjust2(float alpha);
    00176         float getAlphaAdjust1(void) const;
    00177         float getAlphaAdjust2(void) const;
    00178
    00179
    00180         void setStateChange(Real NewValue );
    00181         Real getStateChange(void) const;
    00182
    00183         static CmdRedAdjust1 msRedCmd1;
    00184         static CmdRedAdjust2 msRedCmd2;
    00185         static CmdGreenAdjust1 msGreenCmd1;
    00186         static CmdGreenAdjust2 msGreenCmd2;
    00187         static CmdBlueAdjust1 msBlueCmd1;
    00188         static CmdBlueAdjust2 msBlueCmd2;
    00189         static CmdAlphaAdjust1 msAlphaCmd1;
    00190         static CmdAlphaAdjust2 msAlphaCmd2;
    00191         static CmdStateChange msStateCmd;
    00192
    00193     protected:
    00194         float mRedAdj1, mRedAdj2;
    00195         float mGreenAdj1,  mGreenAdj2;
    00196         float mBlueAdj1, mBlueAdj2;
    00197         float mAlphaAdj1, mAlphaAdj2;
    00198         Real StateChangeVal;
    00199
    00201         inline void applyAdjustWithClamp(float* pComponent, float adjust)
    00202         {
    00203             *pComponent += adjust;
    00204             // Limit to 0
    00205             if (*pComponent < 0.0)
    00206             {
    00207                 *pComponent = 0.0f;
    00208             }
    00209             // Limit to 1
    00210             else if (*pComponent > 1.0)
    00211             {
    00212                 *pComponent = 1.0f;
    00213             }
    00214         }
    00215
    00216     };
    00217
    00218
    00219 }
    00220
    00221
    00222 #endif
    00223

Copyright © 2000-2005 by The OGRE Team
This work is licensed under a Creative Commons Attribution-ShareAlike 2.5 License.
Last modified Sun Feb 12 12:59:42 2006