OgrePredefinedControllers.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-2006 Torus Knot Software Ltd
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 You may alternatively use this source under the terms of a specific version of
00025 the OGRE Unrestricted License provided you have obtained such a license from
00026 Torus Knot Software Ltd.
00027 -----------------------------------------------------------------------------
00028 */
00029 #ifndef __PredefinedControllers_H__
00030 #define __PredefinedControllers_H__
00031 
00032 #include "OgrePrerequisites.h"
00033 
00034 #include "OgreCommon.h"
00035 #include "OgreController.h"
00036 #include "OgreFrameListener.h"
00037 #include "OgreGpuProgram.h"
00038 
00039 namespace Ogre {
00040 
00041     //-----------------------------------------------------------------------
00042     // Controller Values
00043     //-----------------------------------------------------------------------
00046     class _OgreExport FrameTimeControllerValue : public ControllerValue<Real>, public FrameListener
00047     {
00048     protected:
00049         Real mFrameTime;
00050         Real mTimeFactor;
00051         Real mElapsedTime;
00052         Real mFrameDelay;
00053 
00054     public:
00055         FrameTimeControllerValue();
00056         bool frameEnded(const FrameEvent &evt);
00057         bool frameStarted(const FrameEvent &evt);
00058         Real getValue(void) const;
00059         void setValue(Real value);
00060         Real getTimeFactor(void) const;
00061         void setTimeFactor(Real tf);
00062         Real getFrameDelay(void) const;
00063         void setFrameDelay(Real fd);
00064         Real getElapsedTime(void) const;
00065         void setElapsedTime(Real elapsedTime);
00066     };
00067 
00068     //-----------------------------------------------------------------------
00071     class _OgreExport TextureFrameControllerValue : public ControllerValue<Real>
00072     {
00073     protected:
00074         TextureUnitState* mTextureLayer;
00075     public:
00076         TextureFrameControllerValue(TextureUnitState* t);
00077 
00080         Real getValue(void) const;
00083         void setValue(Real value);
00084 
00085     };
00086     //-----------------------------------------------------------------------
00095     class _OgreExport TexCoordModifierControllerValue : public ControllerValue<Real>
00096     {
00097     protected:
00098         bool mTransU, mTransV;
00099         bool mScaleU, mScaleV;
00100         bool mRotate;
00101         TextureUnitState* mTextureLayer;
00102     public:
00117         TexCoordModifierControllerValue(TextureUnitState* t, bool translateU = false, bool translateV = false,
00118             bool scaleU = false, bool scaleV = false, bool rotate = false );
00119 
00120         Real getValue(void) const;
00121         void setValue(Real value);
00122 
00123     };
00124 
00125     //-----------------------------------------------------------------------
00138     class _OgreExport FloatGpuParameterControllerValue : public ControllerValue<Real>
00139     {
00140     protected:
00142         GpuProgramParameters* mParams;
00144         size_t mParamIndex;
00145     public:
00152         FloatGpuParameterControllerValue(GpuProgramParameters* params,
00153                 size_t index );
00154 
00155         ~FloatGpuParameterControllerValue() {}
00156 
00157         Real getValue(void) const;
00158         void setValue(Real value);
00159 
00160     };
00161     //-----------------------------------------------------------------------
00162     // Controller functions
00163     //-----------------------------------------------------------------------
00164 
00168     class _OgreExport PassthroughControllerFunction : public ControllerFunction<Real>
00169     {
00170     public:
00177         PassthroughControllerFunction(bool deltaInput = false);
00178 
00181         Real calculate(Real source);
00182     };
00183 
00186     class _OgreExport AnimationControllerFunction : public ControllerFunction<Real>
00187     {
00188     protected:
00189         Real mSeqTime;
00190         Real mTime;
00191     public:
00198         AnimationControllerFunction(Real sequenceTime, Real timeOffset = 0.0f);
00199 
00202         Real calculate(Real source);
00203 
00205         void setTime(Real timeVal);
00207         void setSequenceTime(Real seqVal);
00208     };
00209 
00210     //-----------------------------------------------------------------------
00213     class _OgreExport ScaleControllerFunction : public ControllerFunction<Real>
00214     {
00215     protected:
00216         Real mScale;
00217     public:
00225         ScaleControllerFunction(Real scalefactor, bool deltaInput);
00226 
00229         Real calculate(Real source);
00230 
00231     };
00232 
00233     //-----------------------------------------------------------------------
00253     class _OgreExport WaveformControllerFunction : public ControllerFunction<Real>
00254     {
00255     protected:
00256         WaveformType mWaveType;
00257         Real mBase;
00258         Real mFrequency;
00259         Real mPhase;
00260         Real mAmplitude;
00261         Real mDutyCycle;
00262 
00264         Real getAdjustedInput(Real input);
00265 
00266     public:
00274         WaveformControllerFunction(WaveformType wType, Real base = 0, Real frequency = 1, Real phase = 0, Real amplitude = 1, bool deltaInput = true, Real dutyCycle = 0.5);
00275 
00278         Real calculate(Real source);
00279 
00280     };
00281     //-----------------------------------------------------------------------
00282 
00283 }
00284 
00285 #endif

Copyright © 2008 Torus Knot Software Ltd
Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 2.5 License.
Last modified Sun Sep 27 22:02:24 2009