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 __ControllerManager_H__ 00030 #define __ControllerManager_H__ 00031 00032 #include "OgrePrerequisites.h" 00033 00034 #include "OgreCommon.h" 00035 #include "OgreSingleton.h" 00036 #include "OgreController.h" 00037 #include "OgrePredefinedControllers.h" 00038 #include "OgreTextureUnitState.h" 00039 #include "OgreSharedPtr.h" 00040 00041 namespace Ogre { 00042 00043 typedef SharedPtr< ControllerValue<Real> > ControllerValueRealPtr; 00044 typedef SharedPtr< ControllerFunction<Real> > ControllerFunctionRealPtr; 00045 00052 class _OgreExport ControllerManager : public Singleton<ControllerManager>, public ControllerAlloc 00053 { 00054 protected: 00055 typedef std::set<Controller<Real>*> ControllerList; 00056 ControllerList mControllers; 00057 00059 ControllerValueRealPtr mFrameTimeController; 00060 00062 ControllerFunctionRealPtr mPassthroughFunction; 00063 00064 // Last frame number updated 00065 unsigned long mLastFrameNumber; 00066 00067 public: 00068 ControllerManager(); 00069 ~ControllerManager(); 00070 00073 Controller<Real>* createController(const ControllerValueRealPtr& src, 00074 const ControllerValueRealPtr& dest, const ControllerFunctionRealPtr& func); 00075 00078 Controller<Real>* createFrameTimePassthroughController( 00079 const ControllerValueRealPtr& dest); 00080 00083 void clearControllers(void); 00084 00087 void updateAllControllers(void); 00088 00089 00099 const ControllerValueRealPtr& getFrameTimeSource(void) const; 00100 00102 const ControllerFunctionRealPtr& getPassthroughControllerFunction(void) const; 00103 00113 Controller<Real>* createTextureAnimator(TextureUnitState* layer, Real sequenceTime); 00114 00127 Controller<Real>* createTextureUVScroller(TextureUnitState* layer, Real speed); 00128 00139 Controller<Real>* createTextureUScroller(TextureUnitState* layer, Real uSpeed); 00140 00151 Controller<Real>* createTextureVScroller(TextureUnitState* layer, Real vSpeed); 00152 00163 Controller<Real>* createTextureRotater(TextureUnitState* layer, Real speed); 00164 00182 Controller<Real>* createTextureWaveTransformer(TextureUnitState* layer, TextureUnitState::TextureTransformType ttype, 00183 WaveformType waveType, Real base = 0, Real frequency = 1, Real phase = 0, Real amplitude = 1); 00184 00194 Controller<Real>* createGpuProgramTimerParam(GpuProgramParameters* params, size_t paramIndex, 00195 Real timeFactor = 1.0f); 00196 00199 void destroyController(Controller<Real>* controller); 00200 00205 Real getTimeFactor(void) const; 00206 00215 void setTimeFactor(Real tf); 00216 00221 Real getFrameDelay(void) const; 00222 00234 void setFrameDelay(Real fd); 00235 00240 Real getElapsedTime(void) const; 00241 00249 void setElapsedTime(Real elapsedTime); 00250 00266 static ControllerManager& getSingleton(void); 00282 static ControllerManager* getSingletonPtr(void); 00283 }; 00284 00285 00286 } 00287 #endif
Copyright © 2008 Torus Knot Software Ltd
This work is licensed under a Creative Commons Attribution-ShareAlike 2.5 License.
Last modified Sun Sep 27 22:02:22 2009