Rigs of Rods 2026.01
Soft-body Physics Simulation
Loading...
Searching...
No Matches
TurboProp.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
25#include "AeroEngine.h"
26#include "SimData.h"
27
28#include <Ogre.h>
29
30namespace RoR {
31
34
37
38class Turboprop: public AeroEngine
39{
40public:
41
43 float pitch;
46
48 ActorPtr a,
49 const char* propname,
50 NodeNum_t nr,
51 NodeNum_t nb,
52 NodeNum_t np1,
53 NodeNum_t np2,
54 NodeNum_t np3,
55 NodeNum_t np4,
56 NodeNum_t tqn,
57 float power,
58 Ogre::String const& propfoilname,
59 bool disable_smoke,
60 bool ispiston,
61 float fpitch
62 );
63 virtual ~Turboprop() override;
64
65 void updateForces(float dt, int doUpdate);
66
67 void setThrottle(float val);
68
69 float getThrottle();
70
71 void reset();
72
73 void toggleReverse();
74 void setReverse(bool val);
75 bool getReverse() { return reverse; };
76
77 void flipStart();
78
79 float getRPM() { return rpm; };
80 float getRPMpc() { return rpm / 10.0f; };
81 void setRPM(float _rpm);
82 float getpropwash() { return propwash; };
83 Ogre::Vector3 getAxis() { return axis; };
84 bool isFailed() { return failed; };
86 bool getIgnition() { return ignition; };
87 void setIgnition(bool val) { ignition = val; };
88 int getNoderef() { return noderef; };
89 NodeNum_t GetFrontNode() const override { return RoR::NODENUM_INVALID; }; // turboprops have no front node
90 NodeNum_t GetBackNode() const override { return nodeback; };
91 bool getWarmup() { return warmup; };
92 float getRadius() { return radius; };
93 float getMaxPower() const { return fullpower; };
94 void setMaxPower(float power);
95
96 // For AngelScript binding
97 float getPropellerPitch() { return pitch; };
99 float getPropellerMaxTorque() { return max_torque; };
100 bool isPistonProp() { return is_piston; };
101
102 // Visuals
103 void updateVisuals(RoR::GfxActor* gfx_actor) override;
104 void setVisible(bool visible) override;
105
106private:
107
110 float fullpower;
111 float proparea;
113 float timer;
114 float lastflip;
121 float regspeed;
122 Ogre::ParticleSystem* smokePS;
123 Ogre::SceneNode* smokeNode;
124 float twistmap[5];
125 double rotenergy;
127
129 bool warmup;
131 float radius;
132 bool failed;
134 float rpm;
135 float throtle;
136 char debug[256];
137 float propwash;
138 Ogre::Vector3 axis;
142
143 // Attachment
149};
150
153
154} // namespace RoR
Central state/object manager and communications hub.
Core data structures for simulation; Everything affected by by either physics, network or user intera...
Represents an airfoil http://en.wikipedia.org/wiki/Airfoil.
Definition Airfoil.h:32
NodeNum_t torquenode
Definition TurboProp.h:148
float fixed_pitch
Definition TurboProp.h:126
void setIgnition(bool val)
Definition TurboProp.h:87
Ogre::SceneNode * smokeNode
Definition TurboProp.h:123
float max_torque
Definition TurboProp.h:45
bool isFailed()
Definition TurboProp.h:84
Airfoil * airfoil
Definition TurboProp.h:109
float getpropwash()
Definition TurboProp.h:82
NodeNum_t nodep[4]
Definition TurboProp.h:147
NodeNum_t noderef
Definition TurboProp.h:146
float twistmap[5]
Definition TurboProp.h:124
Ogre::Vector3 axis
Definition TurboProp.h:138
void setReverse(bool val)
Ogre::ParticleSystem * smokePS
Definition TurboProp.h:122
bool getWarmup()
Definition TurboProp.h:91
NodeNum_t GetFrontNode() const override
Definition TurboProp.h:89
float getThrottle()
void setMaxPower(float power)
AeroEngineType getType()
Definition TurboProp.h:85
void toggleReverse()
char debug[256]
Definition TurboProp.h:136
virtual ~Turboprop() override
void updateForces(float dt, int doUpdate)
double rotenergy
Definition TurboProp.h:125
float getPropellerIndicatedTorque()
Definition TurboProp.h:98
bool getReverse()
Definition TurboProp.h:75
float getRPM()
Definition TurboProp.h:79
float indicated_torque
Definition TurboProp.h:44
float maxrevpitch
Definition TurboProp.h:120
bool getIgnition()
Definition TurboProp.h:86
void setVisible(bool visible) override
float fullpower
in kW
Definition TurboProp.h:110
NodeNum_t GetBackNode() const override
Definition TurboProp.h:90
Ogre::Vector3 getAxis()
Definition TurboProp.h:83
bool isPistonProp()
Definition TurboProp.h:100
void setThrottle(float val)
float warmupstart
Definition TurboProp.h:115
float getPropellerPitch()
Definition TurboProp.h:97
NodeNum_t nodeback
Definition TurboProp.h:145
float getMaxPower() const
Definition TurboProp.h:93
float getRadius()
Definition TurboProp.h:92
float getPropellerMaxTorque()
Definition TurboProp.h:99
ActorPtr m_actor
Definition TurboProp.h:144
void updateVisuals(RoR::GfxActor *gfx_actor) override
void setRPM(float _rpm)
int getNoderef()
Definition TurboProp.h:88
float getRPMpc()
Definition TurboProp.h:80
AeroEngineType
Definition SimData.h:249
static const NodeNum_t NODENUM_INVALID
uint16_t NodeNum_t
Node position within Actor::ar_nodes; use RoR::NODENUM_INVALID as empty value.