RigsofRods
Soft-body Physics Simulation
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 
30 namespace RoR {
31 
34 
37 
38 class Turboprop: public AeroEngine
39 {
40 public:
41 
42  bool is_piston;
43  float pitch;
45  float max_torque;
46 
47  Turboprop(
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  ~Turboprop();
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  bool getWarmup() { return warmup; };
90  float getRadius() { return radius; };
91 
92  // Visuals
93  void updateVisuals(RoR::GfxActor* gfx_actor) override;
94  void setVisible(bool visible) override;
95 
96 private:
97 
98  float torquedist;
100  float fullpower;
101  float proparea;
102  float airdensity;
103  float timer;
104  float lastflip;
105  float warmupstart;
106  float warmuptime;
108  float bladewidth;
109  float pitchspeed;
110  float maxrevpitch;
111  float regspeed;
112  Ogre::ParticleSystem* smokePS;
113  Ogre::SceneNode* smokeNode;
114  float twistmap[5];
115  double rotenergy;
116  float fixed_pitch;
117 
118  bool reverse;
119  bool warmup;
120  bool ignition;
121  float radius;
122  bool failed;
123  bool failedold;
124  float rpm;
125  float throtle;
126  char debug[256];
127  float propwash;
128  Ogre::Vector3 axis;
129  int mod_id;
130  int src_id;
131  int thr_id;
132 
133  // Attachment
139 };
140 
143 
144 } // namespace RoR
RoR::Turboprop::fullpower
float fullpower
in kW
Definition: TurboProp.h:100
RoR::Turboprop::reset
void reset()
Definition: TurboProp.cpp:458
RoR::Turboprop::setRPM
void setRPM(float _rpm)
Definition: TurboProp.cpp:453
RoR::Turboprop::torquedist
float torquedist
Definition: TurboProp.h:98
RoR::Turboprop::getType
AeroEngineType getType()
Definition: TurboProp.h:85
RoR::Turboprop::~Turboprop
~Turboprop()
Definition: TurboProp.cpp:152
RoR::Turboprop::torquenode
NodeNum_t torquenode
Definition: TurboProp.h:138
RoR::Turboprop::getRPMpc
float getRPMpc()
Definition: TurboProp.h:80
RoR::Turboprop::smokePS
Ogre::ParticleSystem * smokePS
Definition: TurboProp.h:112
RoR::Turboprop::pitchspeed
float pitchspeed
Definition: TurboProp.h:109
RoR::Turboprop::setReverse
void setReverse(bool val)
Definition: TurboProp.cpp:476
RoR::Turboprop::warmuptime
float warmuptime
Definition: TurboProp.h:106
RoR::Turboprop::pitch
float pitch
Definition: TurboProp.h:43
RoR::AeroEngine
Definition: AeroEngine.h:36
RoR::Turboprop::smokeNode
Ogre::SceneNode * smokeNode
Definition: TurboProp.h:113
RoR::Turboprop::is_piston
bool is_piston
Definition: TurboProp.h:42
RoR::Turboprop::numblades
int numblades
Definition: TurboProp.h:107
RoR::Turboprop::getNoderef
int getNoderef()
Definition: TurboProp.h:88
RefCountingObjectPtr< Actor >
RoR::Turboprop::flipStart
void flipStart()
Definition: TurboProp.cpp:481
RoR::Turboprop::radius
float radius
Definition: TurboProp.h:121
RoR::Turboprop::getRadius
float getRadius()
Definition: TurboProp.h:90
RoR::Turboprop::indicated_torque
float indicated_torque
Definition: TurboProp.h:44
RoR::Turboprop::debug
char debug[256]
Definition: TurboProp.h:126
RoR::Turboprop::src_id
int src_id
Definition: TurboProp.h:130
RoR::NodeNum_t
uint16_t NodeNum_t
Node position within Actor::ar_nodes; use RoR::NODENUM_INVALID as empty value.
Definition: ForwardDeclarations.h:52
SimData.h
Core data structures for simulation; Everything affected by by either physics, network or user intera...
RoR::Turboprop
Definition: TurboProp.h:38
RoR::Turboprop::ignition
bool ignition
Definition: TurboProp.h:120
RoR::Turboprop::getThrottle
float getThrottle()
Definition: TurboProp.cpp:448
RoR::AeroEngineType
AeroEngineType
Definition: SimData.h:275
RoR::Turboprop::airdensity
float airdensity
Definition: TurboProp.h:102
RoR::Turboprop::setThrottle
void setThrottle(float val)
Definition: TurboProp.cpp:438
RoR::Turboprop::getIgnition
bool getIgnition()
Definition: TurboProp.h:86
RoR::Turboprop::max_torque
float max_torque
Definition: TurboProp.h:45
RoR::Turboprop::Turboprop
Turboprop(ActorPtr a, const char *propname, NodeNum_t nr, NodeNum_t nb, NodeNum_t np1, NodeNum_t np2, NodeNum_t np3, NodeNum_t np4, NodeNum_t tqn, float power, Ogre::String const &propfoilname, bool disable_smoke, bool ispiston, float fpitch)
Definition: TurboProp.cpp:37
RoR::Turboprop::propwash
float propwash
Definition: TurboProp.h:127
Application.h
Central state/object manager and communications hub.
RoR::Turboprop::isFailed
bool isFailed()
Definition: TurboProp.h:84
RoR::Turboprop::thr_id
int thr_id
Definition: TurboProp.h:131
RoR::Turboprop::setVisible
void setVisible(bool visible) override
Definition: TurboProp.cpp:215
RoR::Turboprop::getReverse
bool getReverse()
Definition: TurboProp.h:75
RoR::Turboprop::regspeed
float regspeed
Definition: TurboProp.h:111
RoR::Turboprop::timer
float timer
Definition: TurboProp.h:103
RoR::Turboprop::failedold
bool failedold
Definition: TurboProp.h:123
RoR::Turboprop::getAxis
Ogre::Vector3 getAxis()
Definition: TurboProp.h:83
RoR::Turboprop::bladewidth
float bladewidth
Definition: TurboProp.h:108
RoR::Turboprop::twistmap
float twistmap[5]
Definition: TurboProp.h:114
RoR::Turboprop::getRPM
float getRPM()
Definition: TurboProp.h:79
RoR::Turboprop::nodeback
NodeNum_t nodeback
Definition: TurboProp.h:135
RoR::Turboprop::rotenergy
double rotenergy
Definition: TurboProp.h:115
RoR::Turboprop::getpropwash
float getpropwash()
Definition: TurboProp.h:82
RoR::Turboprop::nodep
NodeNum_t nodep[4]
Definition: TurboProp.h:137
RoR::Turboprop::m_actor
ActorPtr m_actor
Definition: TurboProp.h:134
RoR::Turboprop::rpm
float rpm
Definition: TurboProp.h:124
RoR::Turboprop::updateForces
void updateForces(float dt, int doUpdate)
Definition: TurboProp.cpp:221
RoR::Turboprop::airfoil
Airfoil * airfoil
Definition: TurboProp.h:99
RoR::Turboprop::getWarmup
bool getWarmup()
Definition: TurboProp.h:89
RoR::Turboprop::warmupstart
float warmupstart
Definition: TurboProp.h:105
RoR::AeroEngineType::AE_XPROP
@ AE_XPROP
RoR::Turboprop::mod_id
int mod_id
Definition: TurboProp.h:129
RoR::Turboprop::fixed_pitch
float fixed_pitch
Definition: TurboProp.h:116
AeroEngine.h
RoR::Airfoil
Represents an airfoil http://en.wikipedia.org/wiki/Airfoil.
Definition: Airfoil.h:31
RoR::GfxActor
Definition: GfxActor.h:52
RoR::Turboprop::lastflip
float lastflip
Definition: TurboProp.h:104
RoR::Turboprop::updateVisuals
void updateVisuals(RoR::GfxActor *gfx_actor) override
Definition: TurboProp.cpp:171
RoR::Turboprop::noderef
NodeNum_t noderef
Definition: TurboProp.h:136
RoR::Turboprop::setIgnition
void setIgnition(bool val)
Definition: TurboProp.h:87
RoR::Turboprop::throtle
float throtle
Definition: TurboProp.h:125
RoR::Turboprop::reverse
bool reverse
Definition: TurboProp.h:118
RoR::Turboprop::toggleReverse
void toggleReverse()
Definition: TurboProp.cpp:469
RoR::Turboprop::axis
Ogre::Vector3 axis
Definition: TurboProp.h:128
RoR::Turboprop::warmup
bool warmup
Definition: TurboProp.h:119
RoR::Turboprop::maxrevpitch
float maxrevpitch
Definition: TurboProp.h:110
RoR::Turboprop::failed
bool failed
Definition: TurboProp.h:122
RoR
Definition: AppContext.h:36
RoR::Turboprop::proparea
float proparea
Definition: TurboProp.h:101