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-2013 Torus Knot Software Ltd
00008 
00009 Permission is hereby granted, free of charge, to any person obtaining a copy
00010 of this software and associated documentation files (the "Software"), to deal
00011 in the Software without restriction, including without limitation the rights
00012 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
00013 copies of the Software, and to permit persons to whom the Software is
00014 furnished to do so, subject to the following conditions:
00015 
00016 The above copyright notice and this permission notice shall be included in
00017 all copies or substantial portions of the Software.
00018 
00019 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
00020 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
00021 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
00022 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
00023 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
00024 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
00025 THE SOFTWARE.
00026 -----------------------------------------------------------------------------
00027 */
00028 #ifndef __PredefinedControllers_H__
00029 #define __PredefinedControllers_H__
00030 
00031 #include "OgrePrerequisites.h"
00032 
00033 #include "OgreCommon.h"
00034 #include "OgreController.h"
00035 #include "OgreFrameListener.h"
00036 #include "OgreGpuProgram.h"
00037 #include "OgreHeaderPrefix.h"
00038 
00039 namespace Ogre {
00040 
00047     //-----------------------------------------------------------------------
00048     // Controller Values
00049     //-----------------------------------------------------------------------
00052     class _OgreExport FrameTimeControllerValue : public ControllerValue<Real>, public FrameListener
00053     {
00054     protected:
00055         Real mFrameTime;
00056         Real mTimeFactor;
00057         Real mElapsedTime;
00058         Real mFrameDelay;
00059 
00060     public:
00061         FrameTimeControllerValue();
00062         bool frameEnded(const FrameEvent &evt);
00063         bool frameStarted(const FrameEvent &evt);
00064         Real getValue(void) const;
00065         void setValue(Real value);
00066         Real getTimeFactor(void) const;
00067         void setTimeFactor(Real tf);
00068         Real getFrameDelay(void) const;
00069         void setFrameDelay(Real fd);
00070         Real getElapsedTime(void) const;
00071         void setElapsedTime(Real elapsedTime);
00072     };
00073 
00074     //-----------------------------------------------------------------------
00077     class _OgreExport TextureFrameControllerValue : public ControllerValue<Real>
00078     {
00079     protected:
00080         TextureUnitState* mTextureLayer;
00081     public:
00082         TextureFrameControllerValue(TextureUnitState* t);
00083 
00086         Real getValue(void) const;
00089         void setValue(Real value);
00090 
00091     };
00092     //-----------------------------------------------------------------------
00101     class _OgreExport TexCoordModifierControllerValue : public ControllerValue<Real>
00102     {
00103     protected:
00104         bool mTransU, mTransV;
00105         bool mScaleU, mScaleV;
00106         bool mRotate;
00107         TextureUnitState* mTextureLayer;
00108     public:
00123         TexCoordModifierControllerValue(TextureUnitState* t, bool translateU = false, bool translateV = false,
00124             bool scaleU = false, bool scaleV = false, bool rotate = false );
00125 
00126         Real getValue(void) const;
00127         void setValue(Real value);
00128 
00129     };
00130 
00131     //-----------------------------------------------------------------------
00144     class _OgreExport FloatGpuParameterControllerValue : public ControllerValue<Real>
00145     {
00146     protected:
00148         GpuProgramParametersSharedPtr mParams;
00150         size_t mParamIndex;
00151     public:
00158         FloatGpuParameterControllerValue(GpuProgramParametersSharedPtr params,
00159                 size_t index );
00160 
00161         ~FloatGpuParameterControllerValue() {}
00162 
00163         Real getValue(void) const;
00164         void setValue(Real value);
00165 
00166     };
00167     //-----------------------------------------------------------------------
00168     // Controller functions
00169     //-----------------------------------------------------------------------
00170 
00174     class _OgreExport PassthroughControllerFunction : public ControllerFunction<Real>
00175     {
00176     public:
00182         PassthroughControllerFunction(bool deltaInput = false);
00183 
00186         Real calculate(Real source);
00187     };
00188 
00191     class _OgreExport AnimationControllerFunction : public ControllerFunction<Real>
00192     {
00193     protected:
00194         Real mSeqTime;
00195         Real mTime;
00196     public:
00203         AnimationControllerFunction(Real sequenceTime, Real timeOffset = 0.0f);
00204 
00207         Real calculate(Real source);
00208 
00210         void setTime(Real timeVal);
00212         void setSequenceTime(Real seqVal);
00213     };
00214 
00215     //-----------------------------------------------------------------------
00218     class _OgreExport ScaleControllerFunction : public ControllerFunction<Real>
00219     {
00220     protected:
00221         Real mScale;
00222     public:
00230         ScaleControllerFunction(Real scalefactor, bool deltaInput);
00231 
00234         Real calculate(Real source);
00235 
00236     };
00237 
00238     //-----------------------------------------------------------------------
00258     class _OgreExport WaveformControllerFunction : public ControllerFunction<Real>
00259     {
00260     protected:
00261         WaveformType mWaveType;
00262         Real mBase;
00263         Real mFrequency;
00264         Real mPhase;
00265         Real mAmplitude;
00266         Real mDutyCycle;
00267 
00269         Real getAdjustedInput(Real input);
00270 
00271     public:
00279         WaveformControllerFunction(WaveformType wType, Real base = 0, Real frequency = 1, Real phase = 0, Real amplitude = 1, bool deltaInput = true, Real dutyCycle = 0.5);
00280 
00283         Real calculate(Real source);
00284 
00285     };
00286     //-----------------------------------------------------------------------
00290 }
00291 
00292 #include "OgreHeaderSuffix.h"
00293 
00294 #endif

Copyright © 2012 Torus Knot Software Ltd
Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.
Last modified Mon Jul 27 2020 13:40:44