#include <OgreHapticsForceEffect.h>
Public Types | |
typedef VectorIterator < ForceEffectAlgorithmList > | AlgorithmIterator |
Public Member Functions | |
ForceEffect (const String &name) | |
Constructor - use ForceEffectManager's create method rather than this. | |
virtual | ~ForceEffect () |
Virtual destructor. | |
ForceEffect & | operator= (const ForceEffect &rhs) |
Assignment operator to allow easy copying between force effects. | |
const String & | getName (void) const |
Returns the name of the force effect. | |
const String & | getOrigin (void) const |
Get the origin of this force effect, e.g. | |
void | _notifyOrigin (const String &origin) |
Notify this force effect of it's origin. | |
void | start (Device *device) |
Starts the ForceEffect to be rendered by the specified Device. | |
void | restart (void) |
Restarts the force effect for the device specified at ForceEffect::start. | |
void | stop (bool immediate=false) |
Stops the force effect from rendering. | |
bool | isActive (void) const |
Returns whether or not the force effect is actively rendered or will be rendered the next time Device::update is called on the device the force effect was started for. | |
ForceEffectState | getState (void) const |
Returns the current state the force effect is in. | |
void | _notifyDeviceDisabled (void) |
Notify this force effect the device it is rendering force to has been disabled. | |
void | setSustainMode (ForceEffectSustainMode mode) |
Sets the ForceEffectMode that the sustaining state of the force effect will be in. | |
ForceEffectSustainMode | getSustainMode (void) const |
Returns the ForceEffectMode of the sustaining state. | |
void | setSustainDuration (long duration) |
Sets the duration of the sustaining state in milliseconds. | |
long | getSustainDuration (void) const |
Returns the number of milliseconds for the ForceEffect to be in sustaining state. | |
void | setFadeInDuration (long duration) |
Sets the duration of the fading in state. | |
long | getFadeInDuration (void) const |
Returns the number of milliseconds for the ForceEffect to be in fading in state. | |
void | setFadeOutDuration (long duration) |
Sets the duration of the fading out state. | |
long | getFadeOutDuration (void) const |
Returns the number of milliseconds for the ForceEffect to be in fading out state. | |
long | getRemainingTime (ForceEffectTimeType type=FETT_TOTAL) const |
Returns the remaining time of the ForceEffect to render forces. | |
void | setListener (Listener *listener) |
Sets a listener for the force effect. | |
Listener * | getListener (void) const |
Gets the current listener of the force effect. | |
void | setAlgorithmParameter (unsigned short index, const String &name, const String &value) |
Method to set the value of a parameter on the indexed algorithm in an internally thread safe manner. | |
void | setAlgorithmParameterList (unsigned short index, const NameValuePairList ¶mList) |
Method to set multiple parameters on the indexed algorithm in an internally thread safe manner. | |
void | setAllAlgorithmsParameter (const String &name, const String &value) |
Convenience method to set the value of a parameter on all added algorithms in an internally thread safe manner. | |
void | setAllAlgorithmsParameterList (const NameValuePairList ¶mList) |
Convenience method to set multiple parameters on all added algorithms in an internally thread safe manner. | |
ForceEffectAlgorithm * | addAlgorithm (const String &algorithmType) |
Adds a ForceEffectAlgorithm to the list of algorithms used by the force effect to render forces. | |
ForceEffectAlgorithm * | getAlgorithm (unsigned short index) const |
Retrieves an algorithm by it's index (zero-based). | |
void | removeAlgorithm (unsigned short index) |
Removes an algorithm for the force effect. | |
void | removeAllAlgorithms (void) |
Removes all algorithms registerd with the force effect. | |
unsigned short | getNumAlgorithms (void) const |
Returns the number of algorithms for the force effect. | |
AlgorithmIterator | getAlgorithmIterator (void) |
Returns an iterator over the list of registered algorithms. | |
void | _applyAlgorithmParameters (void) |
Applies the parameters set to the algorithms through setAlgorithmParameter and setAlgorithmsParameter. | |
void | _setState (ForceEffectState state, double currentTime) |
Sets the state of the force effect (internal use only). | |
void | _resetAlgorithms (void) |
Resets all registered algorithms (internal use only). | |
const ForceOutput & | _calculateForces (const Vector3 &position, const Quaternion &orientation, const Vector3 &linearVelocity, const Vector3 &angularVelocity, double timeElapsed) |
Calculates the forces the effect will apply to the device the effect has been started for (internal use only). | |
Real | _getLerpFraction (double currentTime, bool fadingIn) |
Returns the linear interpolation fraction for fading the force effect (internal use only). | |
Protected Types | |
typedef std::map< unsigned short, NameValuePairList > | AlgorithmsParameterMap |
Protected Member Functions | |
void | updateRemainingTime (double timeElapsed) |
Updates the remaining time the force effect will actively render output. | |
Protected Attributes | |
Device * | mDevice |
Pointer to the device for which the force effect was started. | |
Listener * | mListener |
Pointer to the listener of events. | |
bool | mhtIsMaxLerpFractionSet |
Has the maximum linear interpolation fraction been set? | |
long | mhtCurrentStateDuration |
The duration of the current state, in milliseconds. | |
double | mhtCurrentStateStartTime |
The time at which the current state was started. | |
Real | mhtMaxLerpFraction |
The maximum linear interpolation fraction used for fading. | |
ForceEffectSustainMode | mSustainMode |
The mode the force effect will remain in in the sustain state. | |
String | mName |
Name of the force effect. | |
String | mOrigin |
Optional origin of this force effect (e.g. script name). | |
AtomicScalar< ForceEffectState > | mState |
Is the force effect being used for rendering? | |
AtomicScalar< long > | mSustainDuration |
The time of the sustaining state of the effect, in milliseconds. | |
AtomicScalar< long > | mFadeInDuration |
The time to fade the effect in after it has been started, in milliseconds. | |
AtomicScalar< long > | mFadeOutDuration |
The time to fade the effect out after it has been stopped, in milliseconds. | |
AtomicScalar< int > | mDurationChanged |
Has the any duration been changed? | |
AtomicScalar< long > | mCurrentStateRemainingTime |
The time in milliseconds the effect remains in in its current state. | |
AtomicScalar< long > | mTotalRemainingTime |
The time in milliseconds the effect remains active. | |
ForceOutput | mOutput |
The force output by the force effect. | |
ForceEffectAlgorithmList | mAlgorithms |
A list of all algorithms used. | |
AlgorithmsParameterMap | mAlgorithmsParameterMap |
Used to store name/value pairs to update algoritm parameters. | |
Static Protected Attributes | |
static CmdSustainMode | msSustainModeCmd |
static CmdSustainDuration | msSustainDurationCmd |
static CmdFadeInDuration | msFadeInDurationCmd |
static CmdFadeOutDuration | msFadeOutDurationCmd |
Friends | |
class | ForceEffectManager |
Classes | |
class | CmdFadeInDuration |
Command object for fade_in_duration (see Ogre::ParamCommand). More... | |
class | CmdFadeOutDuration |
Command object for fade_out_duration (see Ogre::ParamCommand). More... | |
class | CmdSustainDuration |
Command object for sustain_duration (see Ogre::ParamCommand). More... | |
class | CmdSustainMode |
Command object for sustain_mode (see Ogre::ParamCommand). More... | |
class | Listener |
Force effects are typically used to generate ambient sensations, like drag, inertia or gravity. These sensations are ambient because they apply throughout the touch space. Force effects can also be used to generate transient sensations, like an impulse.
Definition at line 100 of file OgreHapticsForceEffect.h.
typedef VectorIterator<ForceEffectAlgorithmList> OgreHaptics::ForceEffect::AlgorithmIterator |
Definition at line 441 of file OgreHapticsForceEffect.h.
typedef std::map<unsigned short, NameValuePairList> OgreHaptics::ForceEffect::AlgorithmsParameterMap [protected] |
Definition at line 530 of file OgreHapticsForceEffect.h.
OgreHaptics::ForceEffect::ForceEffect | ( | const String & | name | ) |
Constructor - use ForceEffectManager's create method rather than this.
virtual OgreHaptics::ForceEffect::~ForceEffect | ( | ) | [virtual] |
Virtual destructor.
ForceEffect& OgreHaptics::ForceEffect::operator= | ( | const ForceEffect & | rhs | ) |
Assignment operator to allow easy copying between force effects.
const String& OgreHaptics::ForceEffect::getName | ( | void | ) | const |
const String& OgreHaptics::ForceEffect::getOrigin | ( | void | ) | const |
Get the origin of this force effect, e.g.
a script file name.
Definition at line 180 of file OgreHapticsForceEffect.h.
void OgreHaptics::ForceEffect::_notifyOrigin | ( | const String & | origin | ) |
void OgreHaptics::ForceEffect::start | ( | Device * | device | ) |
Starts the ForceEffect to be rendered by the specified Device.
device | The Device through which the effect will be rendered. |
InvalidOperationException | if the effect is already actively rendering on another device. |
void OgreHaptics::ForceEffect::restart | ( | void | ) |
Restarts the force effect for the device specified at ForceEffect::start.
InvalidOperationException | if the effect has not been started before. |
void OgreHaptics::ForceEffect::stop | ( | bool | immediate = false |
) |
Stops the force effect from rendering.
true
. immediate | Specifies whether or not the force effect will be stopped immediately. |
bool OgreHaptics::ForceEffect::isActive | ( | void | ) | const |
Returns whether or not the force effect is actively rendered or will be rendered the next time Device::update is called on the device the force effect was started for.
ForceEffectState OgreHaptics::ForceEffect::getState | ( | void | ) | const |
Returns the current state the force effect is in.
void OgreHaptics::ForceEffect::_notifyDeviceDisabled | ( | void | ) |
Notify this force effect the device it is rendering force to has been disabled.
Internal use only.
void OgreHaptics::ForceEffect::setSustainMode | ( | ForceEffectSustainMode | mode | ) |
Sets the ForceEffectMode that the sustaining state of the force effect will be in.
mode | The new mode of the force effect. |
ForceEffectSustainMode OgreHaptics::ForceEffect::getSustainMode | ( | void | ) | const |
Returns the ForceEffectMode of the sustaining state.
Definition at line 248 of file OgreHapticsForceEffect.h.
void OgreHaptics::ForceEffect::setSustainDuration | ( | long | duration | ) |
Sets the duration of the sustaining state in milliseconds.
duration | The duration in milliseconds for the sustaining state. |
long OgreHaptics::ForceEffect::getSustainDuration | ( | void | ) | const |
Returns the number of milliseconds for the ForceEffect to be in sustaining state.
long
. void OgreHaptics::ForceEffect::setFadeInDuration | ( | long | duration | ) |
Sets the duration of the fading in state.
duration | The duration in milliseconds for the fading in state. |
long OgreHaptics::ForceEffect::getFadeInDuration | ( | void | ) | const |
Returns the number of milliseconds for the ForceEffect to be in fading in state.
void OgreHaptics::ForceEffect::setFadeOutDuration | ( | long | duration | ) |
Sets the duration of the fading out state.
duration | The duration in milliseconds for the fading out state. |
long OgreHaptics::ForceEffect::getFadeOutDuration | ( | void | ) | const |
Returns the number of milliseconds for the ForceEffect to be in fading out state.
long OgreHaptics::ForceEffect::getRemainingTime | ( | ForceEffectTimeType | type = FETT_TOTAL |
) | const |
Returns the remaining time of the ForceEffect to render forces.
type | Specifies whether the total remaining time or the remaining time of the current state is returned. |
void OgreHaptics::ForceEffect::setListener | ( | Listener * | listener | ) |
Sets a listener for the force effect.
Definition at line 305 of file OgreHapticsForceEffect.h.
Listener* OgreHaptics::ForceEffect::getListener | ( | void | ) | const |
Gets the current listener of the force effect.
Definition at line 307 of file OgreHapticsForceEffect.h.
void OgreHaptics::ForceEffect::setAlgorithmParameter | ( | unsigned short | index, | |
const String & | name, | |||
const String & | value | |||
) |
Method to set the value of a parameter on the indexed algorithm in an internally thread safe manner.
index | Zero-based index of the algorithm to set the parameter on. | |
name | The name of the parameter to update. | |
value | The Ogre::String value of the parameter. Must be in the right format for the type specified in the parameter definition. |
void OgreHaptics::ForceEffect::setAlgorithmParameterList | ( | unsigned short | index, | |
const NameValuePairList & | paramList | |||
) |
Method to set multiple parameters on the indexed algorithm in an internally thread safe manner.
index | Zero-based index of the algorithm to set the parameter on. | |
paramList | An name/value pair list. |
void OgreHaptics::ForceEffect::setAllAlgorithmsParameter | ( | const String & | name, | |
const String & | value | |||
) |
Convenience method to set the value of a parameter on all added algorithms in an internally thread safe manner.
name | The name of the parameter to update. | |
value | The Ogre::String value of the parameter. Must be in the right format for the type specified in the parameter definition. |
void OgreHaptics::ForceEffect::setAllAlgorithmsParameterList | ( | const NameValuePairList & | paramList | ) |
Convenience method to set multiple parameters on all added algorithms in an internally thread safe manner.
paramList | A name/value pair list. |
ForceEffectAlgorithm* OgreHaptics::ForceEffect::addAlgorithm | ( | const String & | algorithmType | ) |
Adds a ForceEffectAlgorithm to the list of algorithms used by the force effect to render forces.
InvalidOperationException | if the force effect is active. |
ForceEffectAlgorithm* OgreHaptics::ForceEffect::getAlgorithm | ( | unsigned short | index | ) | const |
Retrieves an algorithm by it's index (zero-based).
index | Zero-based index of the algorithm to retrieve. |
void OgreHaptics::ForceEffect::removeAlgorithm | ( | unsigned short | index | ) |
Removes an algorithm for the force effect.
index | Zero-based index of the algorithm to remove. |
InvalidOperationException | if the force effect is active. |
void OgreHaptics::ForceEffect::removeAllAlgorithms | ( | void | ) |
Removes all algorithms registerd with the force effect.
InvalidOperationException | if the force effect is active. |
unsigned short OgreHaptics::ForceEffect::getNumAlgorithms | ( | void | ) | const |
Returns the number of algorithms for the force effect.
AlgorithmIterator OgreHaptics::ForceEffect::getAlgorithmIterator | ( | void | ) |
Returns an iterator over the list of registered algorithms.
void OgreHaptics::ForceEffect::_applyAlgorithmParameters | ( | void | ) |
Applies the parameters set to the algorithms through setAlgorithmParameter and setAlgorithmsParameter.
Internal use only.
void OgreHaptics::ForceEffect::_setState | ( | ForceEffectState | state, | |
double | currentTime | |||
) |
Sets the state of the force effect (internal use only).
state | The new state. | |
currentTime | The time the state is set in seconds. |
void OgreHaptics::ForceEffect::_resetAlgorithms | ( | void | ) |
Resets all registered algorithms (internal use only).
const ForceOutput& OgreHaptics::ForceEffect::_calculateForces | ( | const Vector3 & | position, | |
const Quaternion & | orientation, | |||
const Vector3 & | linearVelocity, | |||
const Vector3 & | angularVelocity, | |||
double | timeElapsed | |||
) |
Calculates the forces the effect will apply to the device the effect has been started for (internal use only).
Real OgreHaptics::ForceEffect::_getLerpFraction | ( | double | currentTime, | |
bool | fadingIn | |||
) |
Returns the linear interpolation fraction for fading the force effect (internal use only).
void OgreHaptics::ForceEffect::updateRemainingTime | ( | double | timeElapsed | ) | [protected] |
Updates the remaining time the force effect will actively render output.
timeElapsed | The time elapsed since the last call in milliseconds. |
friend class ForceEffectManager [friend] |
Definition at line 103 of file OgreHapticsForceEffect.h.
CmdSustainMode OgreHaptics::ForceEffect::msSustainModeCmd [static, protected] |
Definition at line 485 of file OgreHapticsForceEffect.h.
CmdSustainDuration OgreHaptics::ForceEffect::msSustainDurationCmd [static, protected] |
Definition at line 486 of file OgreHapticsForceEffect.h.
CmdFadeInDuration OgreHaptics::ForceEffect::msFadeInDurationCmd [static, protected] |
Definition at line 487 of file OgreHapticsForceEffect.h.
CmdFadeOutDuration OgreHaptics::ForceEffect::msFadeOutDurationCmd [static, protected] |
Definition at line 488 of file OgreHapticsForceEffect.h.
Device* OgreHaptics::ForceEffect::mDevice [protected] |
Pointer to the device for which the force effect was started.
Definition at line 491 of file OgreHapticsForceEffect.h.
Listener* OgreHaptics::ForceEffect::mListener [protected] |
bool OgreHaptics::ForceEffect::mhtIsMaxLerpFractionSet [protected] |
Has the maximum linear interpolation fraction been set?
Definition at line 495 of file OgreHapticsForceEffect.h.
long OgreHaptics::ForceEffect::mhtCurrentStateDuration [protected] |
The duration of the current state, in milliseconds.
Definition at line 497 of file OgreHapticsForceEffect.h.
double OgreHaptics::ForceEffect::mhtCurrentStateStartTime [protected] |
The time at which the current state was started.
Definition at line 499 of file OgreHapticsForceEffect.h.
Real OgreHaptics::ForceEffect::mhtMaxLerpFraction [protected] |
The maximum linear interpolation fraction used for fading.
If the fading in process was not completed, this is used to cap the fading out.
Definition at line 503 of file OgreHapticsForceEffect.h.
The mode the force effect will remain in in the sustain state.
Definition at line 505 of file OgreHapticsForceEffect.h.
String OgreHaptics::ForceEffect::mName [protected] |
String OgreHaptics::ForceEffect::mOrigin [protected] |
Optional origin of this force effect (e.g. script name).
Definition at line 509 of file OgreHapticsForceEffect.h.
AtomicScalar<ForceEffectState> OgreHaptics::ForceEffect::mState [protected] |
Is the force effect being used for rendering?
Definition at line 511 of file OgreHapticsForceEffect.h.
AtomicScalar<long> OgreHaptics::ForceEffect::mSustainDuration [protected] |
The time of the sustaining state of the effect, in milliseconds.
Definition at line 513 of file OgreHapticsForceEffect.h.
AtomicScalar<long> OgreHaptics::ForceEffect::mFadeInDuration [protected] |
The time to fade the effect in after it has been started, in milliseconds.
Definition at line 516 of file OgreHapticsForceEffect.h.
AtomicScalar<long> OgreHaptics::ForceEffect::mFadeOutDuration [protected] |
The time to fade the effect out after it has been stopped, in milliseconds.
Definition at line 519 of file OgreHapticsForceEffect.h.
AtomicScalar<int> OgreHaptics::ForceEffect::mDurationChanged [protected] |
AtomicScalar<long> OgreHaptics::ForceEffect::mCurrentStateRemainingTime [protected] |
The time in milliseconds the effect remains in in its current state.
Definition at line 523 of file OgreHapticsForceEffect.h.
AtomicScalar<long> OgreHaptics::ForceEffect::mTotalRemainingTime [protected] |
The time in milliseconds the effect remains active.
Definition at line 525 of file OgreHapticsForceEffect.h.
ForceOutput OgreHaptics::ForceEffect::mOutput [protected] |
Used to store name/value pairs to update algoritm parameters.
Definition at line 532 of file OgreHapticsForceEffect.h.
Last modified Tue Jan 6 22:31:26 2009