![]() |
Rigs of Rods 2023.09
Soft-body Physics Simulation
|
This class loads and processes a torque curve for a vehicle. More...
#include <TorqueCurve.h>
Public Member Functions | |
| TorqueCurve () | |
| Constructor. | |
| ~TorqueCurve () | |
| Destructor. | |
| Ogre::Real | getEngineTorque (Ogre::Real rpm) |
| Returns the calculated engine torque based on the given RPM, interpolating the torque curve spline. | |
| int | setTorqueModel (Ogre::String name) |
| Sets the torque model which is used for the vehicle. | |
| bool | CreateNewCurve (Ogre::String const &name=customModel) |
| Creates new torque curve. | |
| void | AddCurveSample (float rpm, float progress, Ogre::String const &model=customModel) |
| Adds a point to the torque curve graph. | |
| Ogre::SimpleSpline * | getUsedSpline () |
| Returns the used spline. | |
| Ogre::String | getTorqueModel () |
| Returns the name of the torque model used by the vehicle. | |
| int | spaceCurveEvenly (Ogre::SimpleSpline *spline) |
| Spaces the points of a spline evenly; this is needed for the correct calculation of the Ogre simple spline. | |
Static Public Attributes | |
| static const Ogre::String | customModel = "CustomModel" |
Protected Member Functions | |
| int | loadDefaultTorqueModels () |
| Loads default torque models from the 'torque_models.cfg' file. | |
| int | processLine (Ogre::StringVector args, Ogre::String model) |
| Processes the given vector. | |
Protected Attributes | |
| Ogre::SimpleSpline * | usedSpline |
| spline which is used for calculating the torque, set by setTorqueModel(). | |
| Ogre::String | usedModel |
| name of the torque model used by the truck. | |
| std::map< Ogre::String, Ogre::SimpleSpline > | splines |
| container were all torque curve splines are stored in. | |
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.