Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

OgreColourFaderAffector.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 __ColourFaderAffector_H__
00026 #define __ColourFaderAffector_H__
00027 
00028 #include "OgreParticleFXPrerequisites.h"
00029 #include "OgreParticleAffector.h"
00030 #include "OgreStringInterface.h"
00031 
00032 namespace Ogre {
00033 
00034 
00040     class _OgreParticleFXExport ColourFaderAffector : public ParticleAffector
00041     {
00042     public:
00043 
00045         class CmdRedAdjust : public ParamCommand
00046         {
00047         public:
00048             String doGet(const void* target) const;
00049             void doSet(void* target, const String& val);
00050         };
00051 
00053         class CmdGreenAdjust : public ParamCommand
00054         {
00055         public:
00056             String doGet(const void* target) const;
00057             void doSet(void* target, const String& val);
00058         };
00059 
00061         class CmdBlueAdjust : public ParamCommand
00062         {
00063         public:
00064             String doGet(const void* target) const;
00065             void doSet(void* target, const String& val);
00066         };
00067 
00069         class CmdAlphaAdjust : public ParamCommand
00070         {
00071         public:
00072             String doGet(const void* target) const;
00073             void doSet(void* target, const String& val);
00074         };
00075 
00076 
00078         ColourFaderAffector(ParticleSystem* psys);
00079 
00081         void _affectParticles(ParticleSystem* pSystem, Real timeElapsed);
00082 
00089         void setAdjust(float red, float green, float blue, float alpha = 0.0);
00096         void setRedAdjust(float red);
00097 
00099         float getRedAdjust(void) const;
00100 
00107         void setGreenAdjust(float green);
00109         float getGreenAdjust(void) const;
00116         void setBlueAdjust(float blue);
00118         float getBlueAdjust(void) const;
00119 
00126         void setAlphaAdjust(float alpha);
00128         float getAlphaAdjust(void) const;
00129 
00130         static CmdRedAdjust msRedCmd;
00131         static CmdGreenAdjust msGreenCmd;
00132         static CmdBlueAdjust msBlueCmd;
00133         static CmdAlphaAdjust msAlphaCmd;
00134 
00135     protected:
00136         float mRedAdj;
00137         float mGreenAdj;
00138         float mBlueAdj;
00139         float mAlphaAdj;
00140 
00142         inline void applyAdjustWithClamp(float* pComponent, float adjust)
00143         {
00144             *pComponent += adjust;
00145             // Limit to 0
00146             if (*pComponent < 0.0)
00147             {
00148                 *pComponent = 0.0f;
00149             }
00150             // Limit to 1
00151             else if (*pComponent > 1.0)
00152             {
00153                 *pComponent = 1.0f;
00154             }
00155         }
00156 
00157     };
00158 
00159 
00160 }
00161 
00162 
00163 #endif
00164 

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