RigsofRods
Soft-body Physics Simulation
TurboJet.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 #include "AeroEngine.h"
25 #include "RigDef_File.h"
26 #include "SimData.h"
27 
28 namespace RoR {
29 
31 {
32 public:
34  void SetupVisuals(RigDef::Turbojet & def, int num, std::string const& propname, Ogre::Entity* nozzle, Ogre::Entity* afterburner_flame);
35  void SetNodes(NodeNum_t front, NodeNum_t back, NodeNum_t ref);
36  void UpdateVisuals(RoR::GfxActor* gfx_actor);
37  void SetVisible(bool visible);
38  bool IsVisible() const { return m_visible; }
39 
40 private:
41  Ogre::SceneNode* m_smoke_scenenode;
42  Ogre::ParticleSystem* m_smoke_particle;
43  Ogre::Entity* m_flame_entity;
44  Ogre::SceneNode* m_flame_scenenode;
45  Ogre::Entity* m_nozzle_entity;
46  Ogre::SceneNode* m_nozzle_scenenode;
47 
48  bool m_visible = false; // Needed for flames which are hidden by default.
49  int m_number;
50  float m_radius;
54 };
55 
58 
61 
62 class Turbojet: public AeroEngine
63 {
64 
65 public:
66 
67  Turbojet(ActorPtr actor, NodeNum_t tnodefront, NodeNum_t tnodeback, NodeNum_t tnoderef, RigDef::Turbojet & def);
68  ~Turbojet();
69 
70  void flipStart();
71  void reset();
72  void setRPM(float _rpm);
73  void setThrottle(float val);
74  void toggleReverse();
75  void setReverse(bool val);
76  bool getReverse() { return m_reverse; };
77  void updateForces(float dt, int doUpdate);
78 
79  Ogre::Vector3 getAxis() { return m_axis; };
80 
81  bool getIgnition() { return m_ignition; };
82  void setIgnition(bool val) { m_ignition = val; };
83  bool getWarmup() { return m_warmup; };
84  bool isFailed() { return m_is_failed; };
85  float getAfterburner() { return (float)m_afterburner_active; };
86  float getAfterburnThrust() const { return m_afterburn_thrust; }
87  float getExhaustVelocity() const { return m_exhaust_velocity; }
88  float getRPM() { return m_rpm_percent; }; // FIXME - bad func name
89  float getRPMpc() { return m_rpm_percent; };
90  float getRadius() { return m_radius; };
91  float getThrottle();
92  float getpropwash() { return m_propwash; };
93  int getNoderef() { return m_node_back; };
95 
96  // AeroEngine visuals
97 
98  void updateVisuals(RoR::GfxActor* gfx_actor) override;
99  void setVisible(bool visible) override;
100 
103 
104 private:
105  Ogre::Vector3 m_axis;
110  bool m_reverse;
111  bool m_warmup;
113  float m_area;
115  float m_last_flip;
117  float m_propwash;
118  float m_radius;
119  float m_reflen;
121  float m_throtle;
122  float m_timer;
129 
130  // Attachment
135 };
136 
139 
140 } // namespace RoR
RoR::Turbojet::getExhaustVelocity
float getExhaustVelocity() const
Definition: TurboJet.h:87
RoR::Turbojet::m_sound_src
int m_sound_src
Definition: TurboJet.h:127
RoR::Turbojet::m_sound_ab
int m_sound_ab
Definition: TurboJet.h:125
RoR::Turbojet::updateVisuals
void updateVisuals(RoR::GfxActor *gfx_actor) override
Definition: TurboJet.cpp:142
RoR::Turbojet::m_sound_thr
int m_sound_thr
Definition: TurboJet.h:128
RoR::Turbojet::getRPM
float getRPM()
Definition: TurboJet.h:88
RoR::Turbojet::setThrottle
void setThrottle(float val)
Definition: TurboJet.cpp:285
RoR::Turbojet::m_axis
Ogre::Vector3 m_axis
Definition: TurboJet.h:105
RoR::Turbojet::getRPMpc
float getRPMpc()
Definition: TurboJet.h:89
RoR::TurbojetVisual::UpdateVisuals
void UpdateVisuals(RoR::GfxActor *gfx_actor)
Definition: TurboJet.cpp:153
RoR::Turbojet::m_sound_mod
int m_sound_mod
Definition: TurboJet.h:126
RoR::Turbojet::m_reverse
bool m_reverse
Definition: TurboJet.h:110
RoR::TurbojetVisual::m_nozzle_scenenode
Ogre::SceneNode * m_nozzle_scenenode
Definition: TurboJet.h:46
RoR::Turbojet::m_node_ref
NodeNum_t m_node_ref
Definition: TurboJet.h:134
RoR::Turbojet::reset
void reset()
Definition: TurboJet.cpp:307
RoR::Turbojet::setVisible
void setVisible(bool visible) override
Definition: TurboJet.cpp:148
RoR::NODENUM_INVALID
static const NodeNum_t NODENUM_INVALID
Definition: ForwardDeclarations.h:53
RoR::Turbojet::getRadius
float getRadius()
Definition: TurboJet.h:90
RoR::Turbojet::m_reflen
float m_reflen
Definition: TurboJet.h:119
RoR::Turbojet::m_radius
float m_radius
Definition: TurboJet.h:118
RoR::TurbojetVisual::m_flame_scenenode
Ogre::SceneNode * m_flame_scenenode
Definition: TurboJet.h:44
RoR::Turbojet::m_afterburn_thrust
float m_afterburn_thrust
in kN
Definition: TurboJet.h:112
RoR::AeroEngineType::AE_TURBOJET
@ AE_TURBOJET
RoR::TurbojetVisual::SetVisible
void SetVisible(bool visible)
Definition: TurboJet.cpp:214
RoR::TurbojetVisual::m_node_front
NodeNum_t m_node_front
Definition: TurboJet.h:52
RoR::Turbojet::setIgnition
void setIgnition(bool val)
Definition: TurboJet.h:82
RoR::TurbojetVisual::m_node_ref
NodeNum_t m_node_ref
Definition: TurboJet.h:53
RoR::Turbojet::getIgnition
bool getIgnition()
Definition: TurboJet.h:81
RoR::Turbojet::getAxis
Ogre::Vector3 getAxis()
Definition: TurboJet.h:79
RoR::Turbojet::flipStart
void flipStart()
Definition: TurboJet.cpp:330
RoR::AeroEngine
Definition: AeroEngine.h:36
RoR::TurbojetVisual::IsVisible
bool IsVisible() const
Definition: TurboJet.h:38
RoR::Turbojet::getAfterburner
float getAfterburner()
Definition: TurboJet.h:85
RoR::Turbojet::setReverse
void setReverse(bool val)
Definition: TurboJet.cpp:325
RefCountingObjectPtr< Actor >
RoR::Turbojet::isFailed
bool isFailed()
Definition: TurboJet.h:84
RoR::TurbojetVisual::m_flame_entity
Ogre::Entity * m_flame_entity
Definition: TurboJet.h:43
RoR::TurbojetVisual::m_number
int m_number
Definition: TurboJet.h:49
RoR::Turbojet::m_exhaust_velocity
float m_exhaust_velocity
in m/s
Definition: TurboJet.h:114
RoR::TurbojetVisual::m_smoke_scenenode
Ogre::SceneNode * m_smoke_scenenode
Definition: TurboJet.h:41
RoR::Turbojet::getType
AeroEngineType getType()
Definition: TurboJet.h:94
RoR::NodeNum_t
uint16_t NodeNum_t
Node position within Actor::ar_nodes; use RoR::NODENUM_INVALID as empty value.
Definition: ForwardDeclarations.h:52
RoR::TurbojetVisual::m_nozzle_entity
Ogre::Entity * m_nozzle_entity
Definition: TurboJet.h:45
RoR::TurbojetVisual::m_smoke_particle
Ogre::ParticleSystem * m_smoke_particle
Definition: TurboJet.h:42
SimData.h
Core data structures for simulation; Everything affected by by either physics, network or user intera...
RoR::Turbojet::m_last_flip
float m_last_flip
Definition: TurboJet.h:115
RoR::TurbojetVisual::m_visible
bool m_visible
Definition: TurboJet.h:48
RoR::Turbojet::m_afterburner_active
bool m_afterburner_active
Definition: TurboJet.h:106
RoR::Turbojet::m_rpm_percent
float m_rpm_percent
in percent!
Definition: TurboJet.h:120
RoR::AeroEngineType
AeroEngineType
Definition: SimData.h:275
RoR::Turbojet::m_is_failed
bool m_is_failed
Definition: TurboJet.h:107
RoR::Turbojet::m_ignition
bool m_ignition
Definition: TurboJet.h:108
RoR::Turbojet::m_warmup
bool m_warmup
Definition: TurboJet.h:111
RoR::TurbojetVisual::SetNodes
void SetNodes(NodeNum_t front, NodeNum_t back, NodeNum_t ref)
Definition: TurboJet.cpp:104
RoR::Turbojet::getpropwash
float getpropwash()
Definition: TurboJet.h:92
Application.h
Central state/object manager and communications hub.
RoR::Turbojet::m_max_dry_thrust
float m_max_dry_thrust
in kN
Definition: TurboJet.h:116
RoR::Turbojet::Turbojet
Turbojet(ActorPtr actor, NodeNum_t tnodefront, NodeNum_t tnodeback, NodeNum_t tnoderef, RigDef::Turbojet &def)
Definition: TurboJet.cpp:36
RoR::Turbojet::getNoderef
int getNoderef()
Definition: TurboJet.h:93
RoR::Turbojet::m_node_front
NodeNum_t m_node_front
Definition: TurboJet.h:133
RoR::Turbojet::tjet_afterburnable
bool tjet_afterburnable
Definition: TurboJet.h:101
RoR::Turbojet::updateForces
void updateForces(float dt, int doUpdate)
Definition: TurboJet.cpp:226
RoR::Turbojet::m_throtle
float m_throtle
Definition: TurboJet.h:121
RoR::Turbojet::m_propwash
float m_propwash
Definition: TurboJet.h:117
RoR::Turbojet::m_area
float m_area
Definition: TurboJet.h:113
RoR::Turbojet::m_warmup_time
float m_warmup_time
Definition: TurboJet.h:124
RoR::Turbojet::m_warmup_start
float m_warmup_start
Definition: TurboJet.h:123
RoR::TurbojetVisual
Definition: TurboJet.h:30
RoR::Turbojet::setRPM
void setRPM(float _rpm)
Definition: TurboJet.cpp:302
RoR::Turbojet::m_node_back
NodeNum_t m_node_back
Definition: TurboJet.h:132
RoR::Turbojet::toggleReverse
void toggleReverse()
Definition: TurboJet.cpp:317
RoR::Turbojet::~Turbojet
~Turbojet()
Definition: TurboJet.cpp:114
RoR::Turbojet::m_timer
float m_timer
Definition: TurboJet.h:122
RoR::Turbojet::getWarmup
bool getWarmup()
Definition: TurboJet.h:83
AeroEngine.h
RoR::GfxActor
Definition: GfxActor.h:52
RoR::Turbojet::tjet_visual
TurbojetVisual tjet_visual
Definition: TurboJet.h:102
RoR::Turbojet
Definition: TurboJet.h:62
RigDef::Turbojet
Definition: RigDef_File.h:1394
RoR::Turbojet::getReverse
bool getReverse()
Definition: TurboJet.h:76
RoR::TurbojetVisual::m_radius
float m_radius
Definition: TurboJet.h:50
RigDef_File.h
Data structures representing 'truck' file format, see https://docs.rigsofrods.org/vehicle-creation/fi...
RoR
Definition: AppContext.h:36
RoR::Turbojet::getAfterburnThrust
float getAfterburnThrust() const
Definition: TurboJet.h:86
RoR::TurbojetVisual::m_node_back
NodeNum_t m_node_back
Definition: TurboJet.h:51
RoR::TurbojetVisual::~TurbojetVisual
~TurbojetVisual()
Definition: TurboJet.cpp:124
RoR::Turbojet::m_actor
ActorPtr m_actor
Definition: TurboJet.h:131
RoR::TurbojetVisual::SetupVisuals
void SetupVisuals(RigDef::Turbojet &def, int num, std::string const &propname, Ogre::Entity *nozzle, Ogre::Entity *afterburner_flame)
Definition: TurboJet.cpp:73
RoR::Turbojet::getThrottle
float getThrottle()
Definition: TurboJet.cpp:297
RoR::Turbojet::m_reversable
bool m_reversable
Definition: TurboJet.h:109