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 Real mFrameDelay; 00049 00050 public: 00051 FrameTimeControllerValue(); 00052 bool frameEnded(const FrameEvent &evt); 00053 bool frameStarted(const FrameEvent &evt); 00054 Real getValue(void) const; 00055 void setValue(Real value); 00056 Real getTimeFactor(void) const; 00057 void setTimeFactor(Real tf); 00058 Real getFrameDelay(void) const; 00059 void setFrameDelay(Real fd); 00060 Real getElapsedTime(void) const; 00061 void setElapsedTime(Real elapsedTime); 00062 }; 00063 00064 //----------------------------------------------------------------------- 00067 class _OgreExport TextureFrameControllerValue : public ControllerValue<Real> 00068 { 00069 protected: 00070 TextureUnitState* mTextureLayer; 00071 public: 00072 TextureFrameControllerValue(TextureUnitState* t); 00073 00076 Real getValue(void) const; 00079 void setValue(Real value); 00080 00081 }; 00082 //----------------------------------------------------------------------- 00091 class _OgreExport TexCoordModifierControllerValue : public ControllerValue<Real> 00092 { 00093 protected: 00094 bool mTransU, mTransV; 00095 bool mScaleU, mScaleV; 00096 bool mRotate; 00097 TextureUnitState* mTextureLayer; 00098 public: 00113 TexCoordModifierControllerValue(TextureUnitState* t, bool translateU = false, bool translateV = false, 00114 bool scaleU = false, bool scaleV = false, bool rotate = false ); 00115 00116 Real getValue(void) const; 00117 void setValue(Real value); 00118 00119 }; 00120 00121 //----------------------------------------------------------------------- 00134 class _OgreExport FloatGpuParameterControllerValue : public ControllerValue<Real> 00135 { 00136 protected: 00138 GpuProgramParameters* mParams; 00140 size_t mParamIndex; 00141 public: 00148 FloatGpuParameterControllerValue(GpuProgramParameters* params, 00149 size_t index ); 00150 00151 ~FloatGpuParameterControllerValue() {} 00152 00153 Real getValue(void) const; 00154 void setValue(Real value); 00155 00156 }; 00157 //----------------------------------------------------------------------- 00158 // Controller functions 00159 //----------------------------------------------------------------------- 00160 00164 class _OgreExport PassthroughControllerFunction : public ControllerFunction<Real> 00165 { 00166 public: 00173 PassthroughControllerFunction(bool deltaInput = false); 00174 00177 Real calculate(Real source); 00178 }; 00179 00182 class _OgreExport AnimationControllerFunction : public ControllerFunction<Real> 00183 { 00184 protected: 00185 Real mSeqTime; 00186 Real mTime; 00187 public: 00194 AnimationControllerFunction(Real sequenceTime, Real timeOffset = 0.0f); 00195 00198 Real calculate(Real source); 00199 }; 00200 00201 //----------------------------------------------------------------------- 00204 class _OgreExport ScaleControllerFunction : public ControllerFunction<Real> 00205 { 00206 protected: 00207 Real mScale; 00208 public: 00216 ScaleControllerFunction(Real scalefactor, bool deltaInput); 00217 00220 Real calculate(Real source); 00221 00222 }; 00223 00224 //----------------------------------------------------------------------- 00244 class _OgreExport WaveformControllerFunction : public ControllerFunction<Real> 00245 { 00246 protected: 00247 WaveformType mWaveType; 00248 Real mBase; 00249 Real mFrequency; 00250 Real mPhase; 00251 Real mAmplitude; 00252 Real mDutyCycle; 00253 00255 Real getAdjustedInput(Real input); 00256 00257 public: 00265 WaveformControllerFunction(WaveformType wType, Real base = 0, Real frequency = 1, Real phase = 0, Real amplitude = 1, bool deltaInput = true, Real dutyCycle = 0.5); 00266 00269 Real calculate(Real source); 00270 00271 }; 00272 //----------------------------------------------------------------------- 00273 00274 } 00275 00276 #endif
Copyright © 2000-2005 by The OGRE Team
This work is licensed under a Creative Commons Attribution-ShareAlike 2.5 License.
Last modified Sun Mar 12 14:37:46 2006