# OgreControllerManager.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 __ControllerManager_H__
    00026 #define __ControllerManager_H__
    00027
    00028 #include "OgrePrerequisites.h"
    00029
    00030 #include "OgreCommon.h"
    00031 #include "OgreSingleton.h"
    00032 #include "OgreController.h"
    00033 #include "OgrePredefinedControllers.h"
    00034 #include "OgreTextureUnitState.h"
    00035 #include "OgreSharedPtr.h"
    00036
    00037 namespace Ogre {
    00038
    00039     typedef SharedPtr< ControllerValue<Real> > ControllerValueRealPtr;
    00040     typedef SharedPtr< ControllerFunction<Real> > ControllerFunctionRealPtr;
    00041
    00048     class _OgreExport ControllerManager : public Singleton<ControllerManager>
    00049     {
    00050     protected:
    00051         typedef std::set<Controller<Real>*> ControllerList;
    00052         ControllerList mControllers;
    00053
    00055         ControllerValueRealPtr mFrameTimeController;
    00056
    00058         ControllerFunctionRealPtr mPassthroughFunction;
    00059
    00060         // Last frame number updated
    00061         unsigned long mLastFrameNumber;
    00062
    00063     public:
    00064         ControllerManager();
    00065         ~ControllerManager();
    00066
    00069         Controller<Real>* createController(const ControllerValueRealPtr& src,
    00070             const ControllerValueRealPtr& dest, const ControllerFunctionRealPtr& func);
    00071
    00074         Controller<Real>* createFrameTimePassthroughController(
    00075             const ControllerValueRealPtr& dest);
    00076
    00079         void clearControllers(void);
    00080
    00083         void updateAllControllers(void);
    00084
    00085
    00095         const ControllerValueRealPtr& getFrameTimeSource(void) const;
    00096
    00098         const ControllerFunctionRealPtr& getPassthroughControllerFunction(void) const;
    00099
    00109         Controller<Real>* createTextureAnimator(TextureUnitState* layer, Real sequenceTime);
    00110
    00123         Controller<Real>* createTextureUVScroller(TextureUnitState* layer, Real speed);
    00124
    00135         Controller<Real>* createTextureUScroller(TextureUnitState* layer, Real uSpeed);
    00136
    00147         Controller<Real>* createTextureVScroller(TextureUnitState* layer, Real vSpeed);
    00148
    00159         Controller<Real>* createTextureRotater(TextureUnitState* layer, Real speed);
    00160
    00178         Controller<Real>* createTextureWaveTransformer(TextureUnitState* layer, TextureUnitState::TextureTransformType ttype,
    00179             WaveformType waveType, Real base = 0, Real frequency = 1, Real phase = 0, Real amplitude = 1);
    00180
    00190         Controller<Real>* createGpuProgramTimerParam(GpuProgramParameters* params, size_t paramIndex,
    00191             Real timeFactor = 1.0f);
    00192
    00195         void destroyController(Controller<Real>* controller);
    00196
    00201         Real getTimeFactor(void) const;
    00202
    00211         void setTimeFactor(Real tf);
    00212
    00217         Real getFrameDelay(void) const;
    00218
    00230         void setFrameDelay(Real fd);
    00231
    00236         Real getElapsedTime(void) const;
    00237
    00245         void setElapsedTime(Real elapsedTime);
    00246
    00262         static ControllerManager& getSingleton(void);
    00278         static ControllerManager* getSingletonPtr(void);
    00279     };
    00280
    00281
    00282 }
    00283 #endif

Copyright © 2000-2005 by The OGRE Team
This work is licensed under a Creative Commons Attribution-ShareAlike 2.5 License.
Last modified Sun Sep 17 15:39:08 2006