RigsofRods
Soft-body Physics Simulation
|
This class loads and processes a torque curve for a vehicle. More...
#include <TorqueCurve.h>
Public Member Functions | |
TorqueCurve () | |
Constructor. More... | |
~TorqueCurve () | |
Destructor. More... | |
Ogre::Real | getEngineTorque (Ogre::Real rpm) |
Returns the calculated engine torque based on the given RPM, interpolating the torque curve spline. More... | |
int | setTorqueModel (Ogre::String name) |
Sets the torque model which is used for the vehicle. More... | |
bool | CreateNewCurve (Ogre::String const &name=customModel) |
Creates new torque curve. More... | |
void | AddCurveSample (float rpm, float progress, Ogre::String const &model=customModel) |
Adds a point to the torque curve graph. More... | |
Ogre::SimpleSpline * | getUsedSpline () |
Returns the used spline. More... | |
Ogre::String | getTorqueModel () |
Returns the name of the torque model used by the vehicle. More... | |
int | spaceCurveEvenly (Ogre::SimpleSpline *spline) |
Spaces the points of a spline evenly; this is needed for the correct calculation of the Ogre simple spline. More... | |
Static Public Attributes | |
const static Ogre::String | customModel = "CustomModel" |
Protected Member Functions | |
int | loadDefaultTorqueModels () |
Loads default torque models from the 'torque_models.cfg' file. More... | |
int | processLine (Ogre::StringVector args, Ogre::String model) |
Processes the given vector. More... | |
Protected Attributes | |
Ogre::SimpleSpline * | usedSpline |
spline which is used for calculating the torque, set by setTorqueModel(). More... | |
Ogre::String | usedModel |
name of the torque model used by the truck. More... | |
std::map< Ogre::String, Ogre::SimpleSpline > | splines |
container were all torque curve splines are stored in. More... | |
This class loads and processes a torque curve for a vehicle.
Definition at line 42 of file TorqueCurve.h.
TorqueCurve::TorqueCurve | ( | ) |
Constructor.
Definition at line 33 of file TorqueCurve.cpp.
TorqueCurve::~TorqueCurve | ( | ) |
Destructor.
Definition at line 39 of file TorqueCurve.cpp.
void TorqueCurve::AddCurveSample | ( | float | rpm, |
float | progress, | ||
Ogre::String const & | model = customModel |
||
) |
Adds a point to the torque curve graph.
progress | 0 - 1 |
model | Torque model name (i.e. 'turbodiesel'). |
Definition at line 151 of file TorqueCurve.cpp.
bool TorqueCurve::CreateNewCurve | ( | Ogre::String const & | name = customModel | ) |
Creates new torque curve.
Definition at line 135 of file TorqueCurve.cpp.
Real TorqueCurve::getEngineTorque | ( | Ogre::Real | rpm | ) |
Returns the calculated engine torque based on the given RPM, interpolating the torque curve spline.
The | current engine RPM. |
Definition at line 44 of file TorqueCurve.cpp.
|
inline |
Returns the name of the torque model used by the vehicle.
Definition at line 87 of file TorqueCurve.h.
|
inline |
Returns the used spline.
Definition at line 81 of file TorqueCurve.h.
|
protected |
Loads default torque models from the 'torque_models.cfg' file.
Definition at line 58 of file TorqueCurve.cpp.
|
protected |
Processes the given vector.
Adds points to a torque curve spline; or if a new model is found, generating a new spline.
args | Vector of arguments of the line which should be processed. |
model | Torque model name (i.e. 'turbodiesel') |
Definition at line 105 of file TorqueCurve.cpp.
int TorqueCurve::setTorqueModel | ( | Ogre::String | name | ) |
Sets the torque model which is used for the vehicle.
name | name of the torque model which should be used. |
Definition at line 157 of file TorqueCurve.cpp.
int TorqueCurve::spaceCurveEvenly | ( | Ogre::SimpleSpline * | spline | ) |
Spaces the points of a spline evenly; this is needed for the correct calculation of the Ogre simple spline.
spline | Pointer to the spline which should be processed. |
Definition at line 172 of file TorqueCurve.cpp.
|
static |
Definition at line 45 of file TorqueCurve.h.
|
protected |
container were all torque curve splines are stored in.
Definition at line 115 of file TorqueCurve.h.
|
protected |
name of the torque model used by the truck.
Definition at line 114 of file TorqueCurve.h.
|
protected |
spline which is used for calculating the torque, set by setTorqueModel().
Definition at line 113 of file TorqueCurve.h.