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-2012 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 00038 namespace Ogre { 00039 00046 //----------------------------------------------------------------------- 00047 // Controller Values 00048 //----------------------------------------------------------------------- 00051 class _OgreExport FrameTimeControllerValue : public ControllerValue<Real>, public FrameListener 00052 { 00053 protected: 00054 Real mFrameTime; 00055 Real mTimeFactor; 00056 Real mElapsedTime; 00057 Real mFrameDelay; 00058 00059 public: 00060 FrameTimeControllerValue(); 00061 bool frameEnded(const FrameEvent &evt); 00062 bool frameStarted(const FrameEvent &evt); 00063 Real getValue(void) const; 00064 void setValue(Real value); 00065 Real getTimeFactor(void) const; 00066 void setTimeFactor(Real tf); 00067 Real getFrameDelay(void) const; 00068 void setFrameDelay(Real fd); 00069 Real getElapsedTime(void) const; 00070 void setElapsedTime(Real elapsedTime); 00071 }; 00072 00073 //----------------------------------------------------------------------- 00076 class _OgreExport TextureFrameControllerValue : public ControllerValue<Real> 00077 { 00078 protected: 00079 TextureUnitState* mTextureLayer; 00080 public: 00081 TextureFrameControllerValue(TextureUnitState* t); 00082 00085 Real getValue(void) const; 00088 void setValue(Real value); 00089 00090 }; 00091 //----------------------------------------------------------------------- 00100 class _OgreExport TexCoordModifierControllerValue : public ControllerValue<Real> 00101 { 00102 protected: 00103 bool mTransU, mTransV; 00104 bool mScaleU, mScaleV; 00105 bool mRotate; 00106 TextureUnitState* mTextureLayer; 00107 public: 00122 TexCoordModifierControllerValue(TextureUnitState* t, bool translateU = false, bool translateV = false, 00123 bool scaleU = false, bool scaleV = false, bool rotate = false ); 00124 00125 Real getValue(void) const; 00126 void setValue(Real value); 00127 00128 }; 00129 00130 //----------------------------------------------------------------------- 00143 class _OgreExport FloatGpuParameterControllerValue : public ControllerValue<Real> 00144 { 00145 protected: 00147 GpuProgramParametersSharedPtr mParams; 00149 size_t mParamIndex; 00150 public: 00157 FloatGpuParameterControllerValue(GpuProgramParametersSharedPtr params, 00158 size_t index ); 00159 00160 ~FloatGpuParameterControllerValue() {} 00161 00162 Real getValue(void) const; 00163 void setValue(Real value); 00164 00165 }; 00166 //----------------------------------------------------------------------- 00167 // Controller functions 00168 //----------------------------------------------------------------------- 00169 00173 class _OgreExport PassthroughControllerFunction : public ControllerFunction<Real> 00174 { 00175 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 #endif
Copyright © 2012 Torus Knot Software Ltd
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.
Last modified Fri May 25 23:36:25 2012