Rigs of Rods 2023.09
Soft-body Physics Simulation
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Loading...
Searching...
No Matches
TorqueCurve.h
Go to the documentation of this file.
1/*
2 This source file is part of Rigs of Rods
3 Copyright 2005-2012 Pierre-Michel Ricordel
4 Copyright 2007-2012 Thomas Fischer
5
6 For more information, see http://www.rigsofrods.org/
7
8 Rigs of Rods is free software: you can redistribute it and/or modify
9 it under the terms of the GNU General Public License version 3, as
10 published by the Free Software Foundation.
11
12 Rigs of Rods is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with Rigs of Rods. If not, see <http://www.gnu.org/licenses/>.
19*/
20
21#pragma once
22
23#include "Application.h"
24
30
31namespace RoR {
32
35
38
43{
44public:
45 const static Ogre::String customModel;
46
47 TorqueCurve();
48 ~TorqueCurve();
49
55 Ogre::Real getEngineTorque(Ogre::Real rpm);
56
62 int setTorqueModel(Ogre::String name);
63
68 bool CreateNewCurve(Ogre::String const& name = customModel);
69
75 void AddCurveSample(float rpm, float progress, Ogre::String const& model = customModel);
76
81 Ogre::SimpleSpline* getUsedSpline() { return usedSpline; };
82
87 Ogre::String getTorqueModel() { return usedModel; };
88
94 int spaceCurveEvenly(Ogre::SimpleSpline* spline);
95
96protected:
97
103
111 int processLine(Ogre::StringVector args, Ogre::String model);
112
113 Ogre::SimpleSpline* usedSpline;
114 Ogre::String usedModel;
115 std::map<Ogre::String, Ogre::SimpleSpline> splines;
116};
117
120
121} // namespace RoR
Central state/object manager and communications hub.
This class loads and processes a torque curve for a vehicle.
Definition TorqueCurve.h:43
Ogre::SimpleSpline * getUsedSpline()
Returns the used spline.
Definition TorqueCurve.h:81
Ogre::String usedModel
name of the torque model used by the truck.
void AddCurveSample(float rpm, float progress, Ogre::String const &model=customModel)
Adds a point to the torque curve graph.
Ogre::String getTorqueModel()
Returns the name of the torque model used by the vehicle.
Definition TorqueCurve.h:87
TorqueCurve()
Constructor.
int loadDefaultTorqueModels()
Loads default torque models from the 'torque_models.cfg' file.
static const Ogre::String customModel
Definition TorqueCurve.h:45
int spaceCurveEvenly(Ogre::SimpleSpline *spline)
Spaces the points of a spline evenly; this is needed for the correct calculation of the Ogre simple s...
int processLine(Ogre::StringVector args, Ogre::String model)
Processes the given vector.
Ogre::SimpleSpline * usedSpline
spline which is used for calculating the torque, set by setTorqueModel().
int setTorqueModel(Ogre::String name)
Sets the torque model which is used for the vehicle.
Ogre::Real getEngineTorque(Ogre::Real rpm)
Returns the calculated engine torque based on the given RPM, interpolating the torque curve spline.
std::map< Ogre::String, Ogre::SimpleSpline > splines
container were all torque curve splines are stored in.
bool CreateNewCurve(Ogre::String const &name=customModel)
Creates new torque curve.
~TorqueCurve()
Destructor.