OGRE  1.9
Object-Oriented Graphics Rendering Engine
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Ogre::ControllerManager Class Reference

Class for managing Controller instances. More...

#include <OgreControllerManager.h>

+ Inheritance diagram for Ogre::ControllerManager:
+ Collaboration diagram for Ogre::ControllerManager:

Public Member Functions

 ControllerManager ()
 
 ~ControllerManager ()
 
void clearControllers (void)
 Destroys all the controllers in existence. More...
 
Controller< Real > * createController (const ControllerValueRealPtr &src, const ControllerValueRealPtr &dest, const ControllerFunctionRealPtr &func)
 Creates a new controller and registers it with the manager. More...
 
Controller< Real > * createFrameTimePassthroughController (const ControllerValueRealPtr &dest)
 Creates a new controller use frame time source and passthrough controller function. More...
 
Controller< Real > * createGpuProgramTimerParam (GpuProgramParametersSharedPtr params, size_t paramIndex, Real timeFactor=1.0f)
 Creates a controller for passing a frame time value through to a vertex / fragment program parameter. More...
 
Controller< Real > * createTextureAnimator (TextureUnitState *layer, Real sequenceTime)
 Creates a texture layer animator controller. More...
 
Controller< Real > * createTextureRotater (TextureUnitState *layer, Real speed)
 Creates a basic time-based texture coordinate modifier designed for creating rotating textures. More...
 
Controller< Real > * createTextureUScroller (TextureUnitState *layer, Real uSpeed)
 Creates a basic time-based texture u coordinate modifier designed for creating scrolling textures. More...
 
Controller< Real > * createTextureUVScroller (TextureUnitState *layer, Real speed)
 Creates a basic time-based texture uv coordinate modifier designed for creating scrolling textures. More...
 
Controller< Real > * createTextureVScroller (TextureUnitState *layer, Real vSpeed)
 Creates a basic time-based texture v coordinate modifier designed for creating scrolling textures. More...
 
Controller< Real > * createTextureWaveTransformer (TextureUnitState *layer, TextureUnitState::TextureTransformType ttype, WaveformType waveType, Real base=0, Real frequency=1, Real phase=0, Real amplitude=1)
 Creates a very flexible time-based texture transformation which can alter the scale, position or rotation of a texture based on a wave function. More...
 
void destroyController (Controller< Real > *controller)
 Removes & destroys the controller passed in as a pointer. More...
 
Real getElapsedTime (void) const
 Return the elapsed time. More...
 
Real getFrameDelay (void) const
 Gets the constant that is added to time lapsed between each frame. More...
 
const ControllerValueRealPtrgetFrameTimeSource (void) const
 Returns a ControllerValue which provides the time since the last frame as a control value source. More...
 
const ControllerFunctionRealPtrgetPassthroughControllerFunction (void) const
 Retrieve a simple passthrough controller function. More...
 
Real getTimeFactor (void) const
 Return relative speed of time as perceived by time based controllers. More...
 
void operator delete (void *ptr)
 
void operator delete (void *ptr, void *)
 
void operator delete (void *ptr, const char *, int, const char *)
 
void operator delete[] (void *ptr)
 
void operator delete[] (void *ptr, const char *, int, const char *)
 
void * operator new (size_t sz, const char *file, int line, const char *func)
 operator new, with debug line info More...
 
void * operator new (size_t sz)
 
void * operator new (size_t sz, void *ptr)
 placement operator new More...
 
void * operator new[] (size_t sz, const char *file, int line, const char *func)
 array operator new, with debug line info More...
 
void * operator new[] (size_t sz)
 
void setElapsedTime (Real elapsedTime)
 Set the elapsed time. More...
 
void setFrameDelay (Real fd)
 Sets a constant frame rate. More...
 
void setTimeFactor (Real tf)
 Set the relative speed to update frame time based controllers. More...
 
void updateAllControllers (void)
 Updates all the registered controllers. More...
 

Static Public Member Functions

static ControllerManagergetSingleton (void)
 Override standard Singleton retrieval. More...
 
static ControllerManagergetSingletonPtr (void)
 Override standard Singleton retrieval. More...
 

Protected Types

typedef set< Controller< Real >
* >::type 
ControllerList
 

Protected Attributes

ControllerList mControllers
 
ControllerValueRealPtr mFrameTimeController
 Global predefined controller. More...
 
unsigned long mLastFrameNumber
 Last frame number updated. More...
 
ControllerFunctionRealPtr mPassthroughFunction
 Global predefined controller. More...
 

Static Protected Attributes

static ControllerManagermsSingleton
 

Detailed Description

Class for managing Controller instances.

Remarks
This class is responsible to keeping tabs on all the Controller instances registered and updating them when requested. It also provides a number of convenience methods for creating commonly used controllers (such as texture animators).

Definition at line 58 of file OgreControllerManager.h.

Member Typedef Documentation

Definition at line 61 of file OgreControllerManager.h.

Constructor & Destructor Documentation

Ogre::ControllerManager::ControllerManager ( )
Ogre::ControllerManager::~ControllerManager ( )

Member Function Documentation

void Ogre::ControllerManager::clearControllers ( void  )

Destroys all the controllers in existence.

Controller<Real>* Ogre::ControllerManager::createController ( const ControllerValueRealPtr src,
const ControllerValueRealPtr dest,
const ControllerFunctionRealPtr func 
)

Creates a new controller and registers it with the manager.

Controller<Real>* Ogre::ControllerManager::createFrameTimePassthroughController ( const ControllerValueRealPtr dest)

Creates a new controller use frame time source and passthrough controller function.

Controller<Real>* Ogre::ControllerManager::createGpuProgramTimerParam ( GpuProgramParametersSharedPtr  params,
size_t  paramIndex,
Real  timeFactor = 1.0f 
)

Creates a controller for passing a frame time value through to a vertex / fragment program parameter.

Remarks
The destination parameter is expected to be a float, and the '.x' attribute will be populated with the appropriately scaled time value.
Parameters
paramsThe parameters to update.
paramIndexThe index of the parameter to update; if you want a named parameter, then retrieve the index beforehand using GpuProgramParameters::getParamIndex.
timeFactorThe factor by which to adjust the time elapsed by before passing it to the program.
Controller<Real>* Ogre::ControllerManager::createTextureAnimator ( TextureUnitState layer,
Real  sequenceTime 
)

Creates a texture layer animator controller.

Remarks
This helper method creates the Controller, ControllerValue and ControllerFunction classes required to animate a texture.
Parameters
layerTextureUnitState object to animate
sequenceTimeThe amount of time in seconds it will take to loop through all the frames.
Controller<Real>* Ogre::ControllerManager::createTextureRotater ( TextureUnitState layer,
Real  speed 
)

Creates a basic time-based texture coordinate modifier designed for creating rotating textures.

Returns
This simple method allows you to easily create constant-speed rotating textures. If you want more control, look up the ControllerManager::createTextureWaveTransformer for more complex wave-based scrollers / stretchers / rotators.
Parameters
layerThe texture layer to rotate.
speedSpeed of rotation, in complete anticlockwise revolutions per second.
Controller<Real>* Ogre::ControllerManager::createTextureUScroller ( TextureUnitState layer,
Real  uSpeed 
)

Creates a basic time-based texture u coordinate modifier designed for creating scrolling textures.

Remarks
This simple method allows you to easily create constant-speed u scrolling textures. If you want more control, look up the ControllerManager::createTextureWaveTransformer for more complex wave-based scrollers / stretchers / rotators.
Parameters
layerThe texture layer to animate.
uSpeedSpeed of horizontal (u-coord) scroll, in complete wraps per second.
Controller<Real>* Ogre::ControllerManager::createTextureUVScroller ( TextureUnitState layer,
Real  speed 
)

Creates a basic time-based texture uv coordinate modifier designed for creating scrolling textures.

Remarks
This simple method allows you to easily create constant-speed uv scrolling textures. If you want to specify different speed values for horizontal and vertical scroll, use the specific methods ControllerManager::createTextureUScroller and ControllerManager::createTextureVScroller. If you want more control, look up the ControllerManager::createTextureWaveTransformer for more complex wave-based scrollers / stretchers / rotators.
Parameters
layerThe texture layer to animate.
speedSpeed of horizontal (u-coord) and vertical (v-coord) scroll, in complete wraps per second.
Controller<Real>* Ogre::ControllerManager::createTextureVScroller ( TextureUnitState layer,
Real  vSpeed 
)

Creates a basic time-based texture v coordinate modifier designed for creating scrolling textures.

Remarks
This simple method allows you to easily create constant-speed v scrolling textures. If you want more control, look up the ControllerManager::createTextureWaveTransformer for more complex wave-based scrollers / stretchers / rotators.
Parameters
layerThe texture layer to animate.
vSpeedSpeed of vertical (v-coord) scroll, in complete wraps per second.
Controller<Real>* Ogre::ControllerManager::createTextureWaveTransformer ( TextureUnitState layer,
TextureUnitState::TextureTransformType  ttype,
WaveformType  waveType,
Real  base = 0,
Real  frequency = 1,
Real  phase = 0,
Real  amplitude = 1 
)

Creates a very flexible time-based texture transformation which can alter the scale, position or rotation of a texture based on a wave function.

Parameters
layerThe texture layer to affect.
ttypeThe type of transform, either translate (scroll), scale (stretch) or rotate (spin).
waveTypeThe shape of the wave, see WaveformType enum for details.
baseThe base value of the output.
frequencyThe speed of the wave in cycles per second.
phaseThe offset of the start of the wave, e.g. 0.5 to start half-way through the wave.
amplitudeScales the output so that instead of lying within 0..1 it lies within 0..1*amplitude for exaggerated effects.
void Ogre::ControllerManager::destroyController ( Controller< Real > *  controller)

Removes & destroys the controller passed in as a pointer.

Real Ogre::ControllerManager::getElapsedTime ( void  ) const

Return the elapsed time.

Remarks
See setElapsedTime for full information on the meaning of this value.
Real Ogre::ControllerManager::getFrameDelay ( void  ) const

Gets the constant that is added to time lapsed between each frame.

Remarks
See setFrameDelay for full information on the meaning of this value.
const ControllerValueRealPtr& Ogre::ControllerManager::getFrameTimeSource ( void  ) const

Returns a ControllerValue which provides the time since the last frame as a control value source.

Remarks
A common source value to use to feed into a controller is the time since the last frame. This method returns a pointer to a common source value which provides this information.
Remember the value will only be up to date after the RenderSystem::beginFrame method is called.
See also
RenderSystem::beginFrame
const ControllerFunctionRealPtr& Ogre::ControllerManager::getPassthroughControllerFunction ( void  ) const

Retrieve a simple passthrough controller function.

static ControllerManager& Ogre::ControllerManager::getSingleton ( void  )
static

Override standard Singleton retrieval.

Remarks
Why do we do this? Well, it's because the Singleton implementation is in a .h file, which means it gets compiled into anybody who includes it. This is needed for the Singleton template to work, but we actually only want it compiled into the implementation of the class based on the Singleton, not all of them. If we don't change this, we get link errors when trying to use the Singleton-based class from an outside dll.
This method just delegates to the template version anyway, but the implementation stays in this single compilation unit, preventing link errors.
static ControllerManager* Ogre::ControllerManager::getSingletonPtr ( void  )
static

Override standard Singleton retrieval.

Remarks
Why do we do this? Well, it's because the Singleton implementation is in a .h file, which means it gets compiled into anybody who includes it. This is needed for the Singleton template to work, but we actually only want it compiled into the implementation of the class based on the Singleton, not all of them. If we don't change this, we get link errors when trying to use the Singleton-based class from an outside dll.
This method just delegates to the template version anyway, but the implementation stays in this single compilation unit, preventing link errors.
Real Ogre::ControllerManager::getTimeFactor ( void  ) const

Return relative speed of time as perceived by time based controllers.

Remarks
See setTimeFactor for full information on the meaning of this value.
template<class Alloc >
void Ogre::AllocatedObject< Alloc >::operator delete ( void *  ptr)
inlineinherited

Definition at line 96 of file OgreMemoryAllocatedObject.h.

template<class Alloc >
void Ogre::AllocatedObject< Alloc >::operator delete ( void *  ptr,
void *   
)
inlineinherited

Definition at line 102 of file OgreMemoryAllocatedObject.h.

template<class Alloc >
void Ogre::AllocatedObject< Alloc >::operator delete ( void *  ptr,
const char *  ,
int  ,
const char *   
)
inlineinherited

Definition at line 108 of file OgreMemoryAllocatedObject.h.

template<class Alloc >
void Ogre::AllocatedObject< Alloc >::operator delete[] ( void *  ptr)
inlineinherited

Definition at line 113 of file OgreMemoryAllocatedObject.h.

template<class Alloc >
void Ogre::AllocatedObject< Alloc >::operator delete[] ( void *  ptr,
const char *  ,
int  ,
const char *   
)
inlineinherited

Definition at line 119 of file OgreMemoryAllocatedObject.h.

template<class Alloc >
void* Ogre::AllocatedObject< Alloc >::operator new ( size_t  sz,
const char *  file,
int  line,
const char *  func 
)
inlineinherited

operator new, with debug line info

Definition at line 68 of file OgreMemoryAllocatedObject.h.

template<class Alloc >
void* Ogre::AllocatedObject< Alloc >::operator new ( size_t  sz)
inlineinherited

Definition at line 73 of file OgreMemoryAllocatedObject.h.

template<class Alloc >
void* Ogre::AllocatedObject< Alloc >::operator new ( size_t  sz,
void *  ptr 
)
inlineinherited

placement operator new

Definition at line 79 of file OgreMemoryAllocatedObject.h.

template<class Alloc >
void* Ogre::AllocatedObject< Alloc >::operator new[] ( size_t  sz,
const char *  file,
int  line,
const char *  func 
)
inlineinherited

array operator new, with debug line info

Definition at line 86 of file OgreMemoryAllocatedObject.h.

template<class Alloc >
void* Ogre::AllocatedObject< Alloc >::operator new[] ( size_t  sz)
inlineinherited

Definition at line 91 of file OgreMemoryAllocatedObject.h.

void Ogre::ControllerManager::setElapsedTime ( Real  elapsedTime)

Set the elapsed time.

Remarks
Normally elapsed time accumulated all frames time (which speed relative to time factor) since the rendering loop started. This method allows your to change that to special time, so some elapsed-time-based globally effect is repeatable.
Parameters
elapsedTimeThe new elapsed time.
void Ogre::ControllerManager::setFrameDelay ( Real  fd)

Sets a constant frame rate.

Remarks
This function is useful when rendering a sequence to files that should create a film clip with constant frame rate. It will ensure that scrolling textures and animations move at a constant frame rate.
Parameters
fdThe delay in seconds wanted between each frame (1.0f / 25.0f means a seconds worth of animation is done in 25 frames).
void Ogre::ControllerManager::setTimeFactor ( Real  tf)

Set the relative speed to update frame time based controllers.

Remarks
Normally any controllers which use time as an input (FrameTimeController) are updated automatically in line with the real passage of time. This method allows you to change that, so that controllers are told that the time is passing slower or faster than it actually is. Use this to globally speed up / slow down the effect of time-based controllers.
Parameters
tfThe virtual speed of time (1.0 is real time).
void Ogre::ControllerManager::updateAllControllers ( void  )

Updates all the registered controllers.

Member Data Documentation

ControllerList Ogre::ControllerManager::mControllers
protected

Definition at line 62 of file OgreControllerManager.h.

ControllerValueRealPtr Ogre::ControllerManager::mFrameTimeController
protected

Global predefined controller.

Definition at line 65 of file OgreControllerManager.h.

unsigned long Ogre::ControllerManager::mLastFrameNumber
protected

Last frame number updated.

Definition at line 71 of file OgreControllerManager.h.

ControllerFunctionRealPtr Ogre::ControllerManager::mPassthroughFunction
protected

Global predefined controller.

Definition at line 68 of file OgreControllerManager.h.

ControllerManager * Ogre::Singleton< ControllerManager >::msSingleton
staticprotectedinherited

Definition at line 75 of file OgreSingleton.h.


The documentation for this class was generated from the following file: