Ogre Procedural  0.3.0 unstable
Procedural Geometry & Textures for Ogre3D
Public Types | Public Member Functions | Protected Attributes | List of all members
Procedural::Track Class Reference

Represents a curve by interpolating between a list of key/values. More...

#include <ProceduralTrack.h>

Public Types

enum  AddressingMode { AM_ABSOLUTE_LINEIC, AM_RELATIVE_LINEIC, AM_POINT }
 Defines addressing mode for the track ABSOLUTE_LINEIC : use the distance from the start of the principal curve RELATIVE_LINEIC : use the relative distance from the start of the principal curve, considering the total length of main curve is 1. More...
 

Public Member Functions

 Track (AddressingMode addressingMode=AM_RELATIVE_LINEIC, bool insertPoint=true)
 Default constructor. More...
 
AddressingMode getAddressingMode () const
 Gets addressing mode of the curve. More...
 
TrackaddKeyFrame (Ogre::Real pos, Ogre::Real value)
 Inserts a new Key/Value couple anywhere on the track (it is auto-sorted anyway) More...
 
bool isInsertPoint () const
 Tells whether we should add new points to principal curve if a key is defined here but not on principal curve. More...
 
Ogre::Real getValue (Ogre::Real absPos, Ogre::Real relPos, unsigned int index) const
 Gets the value on the current point, taking into account the addressing mode. More...
 
Ogre::Real getValue (Ogre::Real pos) const
 Gets the value on the current point. More...
 
std::map< Ogre::Real, Ogre::Real >::const_iterator _getKeyValueBefore (Ogre::Real absPos, Ogre::Real relPos, unsigned int index) const
 Get the key value couple before current point, taking into account addressing mode. More...
 
std::map< Ogre::Real, Ogre::Real >::const_iterator _getKeyValueBefore (Ogre::Real pos) const
 Get the key value couple before current point. More...
 
std::map< Ogre::Real, Ogre::Real >::const_iterator _getKeyValueAfter (Ogre::Real absPos, Ogre::Real relPos, unsigned int index) const
 Get the key value couple after current point, taking into account addressing mode. More...
 
std::map< Ogre::Real, Ogre::Real >::const_iterator _getKeyValueAfter (Ogre::Real pos) const
 Get the key value couple after current point. More...
 
Ogre::Real getFirstValue () const
 Gets the first value in the track. More...
 
Ogre::Real getLastValue () const
 Gets the last value in the track. More...
 

Protected Attributes

AddressingMode mAddressingMode
 Adressing mode of the track (see the enum definition for more details) More...
 
bool mInsertPoint
 Tells whether we should add new points to principal curve if a key is defined here but not on principal curve. More...
 
std::map< Ogre::Real, Ogre::RealmKeyFrames
 Key frames. More...
 

Detailed Description

Represents a curve by interpolating between a list of key/values.

It always refers to a "principal" curve (a path, atm), so the keys to either its point index or lineic position.

Member Enumeration Documentation

◆ AddressingMode

Defines addressing mode for the track ABSOLUTE_LINEIC : use the distance from the start of the principal curve RELATIVE_LINEIC : use the relative distance from the start of the principal curve, considering the total length of main curve is 1.

POINT : right on the principal curve's key

Enumerator
AM_ABSOLUTE_LINEIC 
AM_RELATIVE_LINEIC 
AM_POINT 

Constructor & Destructor Documentation

◆ Track()

Procedural::Track::Track ( AddressingMode  addressingMode = AM_RELATIVE_LINEIC,
bool  insertPoint = true 
)

Default constructor.

Point insertion default to true, and addressing to relative lineic

Member Function Documentation

◆ _getKeyValueAfter() [1/2]

std::map<Ogre::Real, Ogre::Real>::const_iterator Procedural::Track::_getKeyValueAfter ( Ogre::Real  absPos,
Ogre::Real  relPos,
unsigned int  index 
) const

Get the key value couple after current point, taking into account addressing mode.

If current point is above maximum key, issues maximum key/value

◆ _getKeyValueAfter() [2/2]

std::map<Ogre::Real, Ogre::Real>::const_iterator Procedural::Track::_getKeyValueAfter ( Ogre::Real  pos) const

Get the key value couple after current point.

If current point is above maximum key, issues maximum key/value

◆ _getKeyValueBefore() [1/2]

std::map<Ogre::Real, Ogre::Real>::const_iterator Procedural::Track::_getKeyValueBefore ( Ogre::Real  absPos,
Ogre::Real  relPos,
unsigned int  index 
) const

Get the key value couple before current point, taking into account addressing mode.

If current point is below minimum key, issues minimum key

◆ _getKeyValueBefore() [2/2]

std::map<Ogre::Real, Ogre::Real>::const_iterator Procedural::Track::_getKeyValueBefore ( Ogre::Real  pos) const

Get the key value couple before current point.

If current point is below minimum key, issues minimum key/value

◆ addKeyFrame()

Track& Procedural::Track::addKeyFrame ( Ogre::Real  pos,
Ogre::Real  value 
)

Inserts a new Key/Value couple anywhere on the track (it is auto-sorted anyway)

References value.

◆ getAddressingMode()

AddressingMode Procedural::Track::getAddressingMode ( ) const

Gets addressing mode of the curve.

◆ getFirstValue()

Ogre::Real Procedural::Track::getFirstValue ( ) const

Gets the first value in the track.

◆ getLastValue()

Ogre::Real Procedural::Track::getLastValue ( ) const

Gets the last value in the track.

◆ getValue() [1/2]

Ogre::Real Procedural::Track::getValue ( Ogre::Real  absPos,
Ogre::Real  relPos,
unsigned int  index 
) const

Gets the value on the current point, taking into account the addressing mode.

◆ getValue() [2/2]

Ogre::Real Procedural::Track::getValue ( Ogre::Real  pos) const

Gets the value on the current point.

◆ isInsertPoint()

bool Procedural::Track::isInsertPoint ( ) const

Tells whether we should add new points to principal curve if a key is defined here but not on principal curve.

Member Data Documentation

◆ mAddressingMode

AddressingMode Procedural::Track::mAddressingMode
protected

Adressing mode of the track (see the enum definition for more details)

◆ mInsertPoint

bool Procedural::Track::mInsertPoint
protected

Tells whether we should add new points to principal curve if a key is defined here but not on principal curve.

◆ mKeyFrames

std::map<Ogre::Real, Ogre::Real> Procedural::Track::mKeyFrames
protected

Key frames.


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