# 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-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 __PredefinedControllers_H__
    00026 #define __PredefinedControllers_H__
    00027
    00028 #include "OgrePrerequisites.h"
    00029
    00030 #include "OgreCommon.h"
    00031 #include "OgreController.h"
    00032 #include "OgreFrameListener.h"
    00033 #include "OgreGpuProgram.h"
    00034
    00035 namespace Ogre {
    00036
    00037     //-----------------------------------------------------------------------
    00038     // Controller Values
    00039     //-----------------------------------------------------------------------
    00042     class _OgreExport FrameTimeControllerValue : public ControllerValue<Real>, public FrameListener
    00043     {
    00044     protected:
    00045         Real mFrameTime;
    00046         Real mTimeFactor;
    00047         Real mElapsedTime;
    00048
    00049     public:
    00050         FrameTimeControllerValue();
    00051         bool frameEnded(const FrameEvent &evt);
    00052         bool frameStarted(const FrameEvent &evt);
    00053         Real getValue(void) const;
    00054         void setValue(Real value);
    00055         Real getTimeFactor(void) const;
    00056         void setTimeFactor(Real tf);
    00057         Real getElapsedTime(void) const;
    00058         void setElapsedTime(Real elapsedTime);
    00059     };
    00060
    00061     //-----------------------------------------------------------------------
    00064     class _OgreExport TextureFrameControllerValue : public ControllerValue<Real>
    00065     {
    00066     protected:
    00067         TextureUnitState* mTextureLayer;
    00068     public:
    00069         TextureFrameControllerValue(TextureUnitState* t);
    00070
    00073         Real getValue(void) const;
    00076         void setValue(Real value);
    00077
    00078     };
    00079     //-----------------------------------------------------------------------
    00088     class _OgreExport TexCoordModifierControllerValue : public ControllerValue<Real>
    00089     {
    00090     protected:
    00091         bool mTransU, mTransV;
    00092         bool mScaleU, mScaleV;
    00093         bool mRotate;
    00094         TextureUnitState* mTextureLayer;
    00095     public:
    00110         TexCoordModifierControllerValue(TextureUnitState* t, bool translateU = false, bool translateV = false,
    00111             bool scaleU = false, bool scaleV = false, bool rotate = false );
    00112
    00113         Real getValue(void) const;
    00114         void setValue(Real value);
    00115
    00116     };
    00117
    00118     //-----------------------------------------------------------------------
    00131     class _OgreExport FloatGpuParameterControllerValue : public ControllerValue<Real>
    00132     {
    00133     protected:
    00135         GpuProgramParameters* mParams;
    00137         size_t mParamIndex;
    00138     public:
    00145         FloatGpuParameterControllerValue(GpuProgramParameters* params,
    00146                 size_t index );
    00147
    00148         ~FloatGpuParameterControllerValue() {}
    00149
    00150         Real getValue(void) const;
    00151         void setValue(Real value);
    00152
    00153     };
    00154     //-----------------------------------------------------------------------
    00155     // Controller functions
    00156     //-----------------------------------------------------------------------
    00157
    00160     class _OgreExport AnimationControllerFunction : public ControllerFunction<Real>
    00161     {
    00162     protected:
    00163         Real mSeqTime;
    00164         Real mTime;
    00165     public:
    00172         AnimationControllerFunction(Real sequenceTime, Real timeOffset = 0.0f);
    00173
    00176         Real calculate(Real source);
    00177     };
    00178
    00179     //-----------------------------------------------------------------------
    00182     class _OgreExport ScaleControllerFunction : public ControllerFunction<Real>
    00183     {
    00184     protected:
    00185         Real mScale;
    00186     public:
    00194         ScaleControllerFunction(Real scalefactor, bool deltaInput);
    00195
    00198         Real calculate(Real source);
    00199
    00200     };
    00201
    00202     //-----------------------------------------------------------------------
    00221     class _OgreExport WaveformControllerFunction : public ControllerFunction<Real>
    00222     {
    00223     protected:
    00224         WaveformType mWaveType;
    00225         Real mBase;
    00226         Real mFrequency;
    00227         Real mPhase;
    00228         Real mAmplitude;
    00229
    00231         Real getAdjustedInput(Real input);
    00232
    00233     public:
    00239         WaveformControllerFunction(WaveformType wType, Real base = 0, Real frequency = 1, Real phase = 0, Real amplitude = 1, bool deltaInput = true);
    00240
    00243         Real calculate(Real source);
    00244
    00245     };
    00246     //-----------------------------------------------------------------------
    00247
    00248 }
    00249
    00250 #endif

Copyright © 2000-2005 by The OGRE Team
Last modified Sun Nov 20 12:36:04 2005