# Ogre::WaveformControllerFunction Class Reference

Predefined controller function based on a waveform. More...

`#include <OgrePredefinedControllers.h>`

Inheritance diagram for Ogre::WaveformControllerFunction:
[legend]

List of all members.

## Public Member Functions

| WaveformControllerFunction (WaveformType wType, Real base=0, Real frequency=1, Real phase=0, Real amplitude=1, bool deltaInput=true, Real dutyCycle=0.5)
| Default contructor, requires at least a wave type, other parameters can be defaulted unless required.
Real | calculate (Real source)
| Overriden function.
virtual T | calculate (T sourceValue)=0

## Protected Member Functions

Real | getAdjustedInput (Real input)
| Overridden from ControllerFunction.
T | getAdjustedInput (T input)
| Gets the input value as adjusted by any delta.

## Protected Attributes

WaveformType | mWaveType
Real | mBase
Real | mFrequency
Real | mPhase
Real | mAmplitude
Real | mDutyCycle
bool | mDeltaInput
| If true, function will add imput values together and wrap at 1.0 before evaluating.
T | mDeltaCount

## Detailed Description

Predefined controller function based on a waveform.

Remarks:
  A waveform function translates parametric intput to parametric output based on a wave. The factors affecting the function are:
  - wave type - the shape of the wave
  - base - the base value of the output from the wave
  - frequency - the speed of the wave in cycles per second
  - phase - the offset of the start of the wave, e.g. 0.5 to start half-way through the wave
  - amplitude - scales the output so that instead of lying within [0,1] it lies within [0,1] * amplitude
  - duty cycle - the active width of a PWM signal

  Note that for simplicity of integration with the rest of the controller insfrastructure, the output of the wave is parametric i.e. 0..1, rather than the typical wave output of [-1,1]. To compensate for this, the traditional output of the wave is scaled by the following function before output:

  output = (waveoutput + 1) * 0.5

  Hence a wave output of -1 becomes 0, a wave ouput of 1 becomes 1, and a wave output of 0 becomes 0.5.

Definition at line 253 of file OgrePredefinedControllers.h.

## Constructor & Destructor Documentation

Ogre::WaveformControllerFunction::WaveformControllerFunction | ( | WaveformType | wType,
|  | Real | base = `0`,
|  | Real | frequency = `1`,
|  | Real | phase = `0`,
|  | Real | amplitude = `1`,
|  | bool | deltaInput = `true`,
|  | Real | dutyCycle = `0.5` |
| ) |  |  |

Default contructor, requires at least a wave type, other parameters can be defaulted unless required.

Parameters:

  | deltaInput | If true, signifies that the input will be a delta value such that the function should add it to an internal counter before calculating the output.
  | dutyCycle | Used in PWM mode to specify the pulse width.

## Member Function Documentation

Real Ogre::WaveformControllerFunction::getAdjustedInput | ( | Real | input | ) | `[protected]`

Overridden from ControllerFunction.

Real Ogre::WaveformControllerFunction::calculate | ( | Real | source | ) |

Overriden function.

template<typename T>

T Ogre::ControllerFunction< T >::getAdjustedInput | ( | T | input | ) | `[protected, inherited]`

Gets the input value as adjusted by any delta.

Definition at line 60 of file OgreController.h.

template<typename T>

virtual T Ogre::ControllerFunction< T >::calculate | ( | T | sourceValue | ) | `[pure virtual, inherited]`

## Member Data Documentation

WaveformType Ogre::WaveformControllerFunction::mWaveType`[protected]`

Definition at line 256 of file OgrePredefinedControllers.h.

Real Ogre::WaveformControllerFunction::mBase`[protected]`

Definition at line 257 of file OgrePredefinedControllers.h.

Real Ogre::WaveformControllerFunction::mFrequency`[protected]`

Definition at line 258 of file OgrePredefinedControllers.h.

Real Ogre::WaveformControllerFunction::mPhase`[protected]`

Definition at line 259 of file OgrePredefinedControllers.h.

Real Ogre::WaveformControllerFunction::mAmplitude`[protected]`

Definition at line 260 of file OgrePredefinedControllers.h.

Real Ogre::WaveformControllerFunction::mDutyCycle`[protected]`

Definition at line 261 of file OgrePredefinedControllers.h.

template<typename T>

bool Ogre::ControllerFunction< T >::mDeltaInput`[protected, inherited]`

If true, function will add imput values together and wrap at 1.0 before evaluating.

Definition at line 55 of file OgreController.h.

Referenced by Ogre::ControllerFunction< float >::ControllerFunction(), and Ogre::ControllerFunction< float >::getAdjustedInput().

template<typename T>

T Ogre::ControllerFunction< T >::mDeltaCount`[protected, inherited]`

Definition at line 56 of file OgreController.h.

Referenced by Ogre::ControllerFunction< float >::ControllerFunction(), and Ogre::ControllerFunction< float >::getAdjustedInput().

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

- OgrePredefinedControllers.h

Copyright © 2000-2005 by The OGRE Team
This work is licensed under a Creative Commons Attribution-ShareAlike 2.5 License.
Last modified Sat May 10 16:28:00 2008