RigsofRods
Soft-body Physics Simulation
AirBrake.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 <Ogre.h>
26 
27 namespace RoR {
28 
31 
34 
35 class Airbrake
36 {
37  friend class RoR::ActorSpawner; // Creates AirbrakeGfx
38 
39 private:
40 
41  struct CoVertice_t
42  {
43  Ogre::Vector3 vertex;
44  Ogre::Vector3 normal;
45  Ogre::Vector2 texcoord;
46  };
47 
48  Ogre::MeshPtr msh;
49  Ogre::SceneNode* snode;
54  Ogre::Vector3 offset;
55  float ratio;
56  float maxangle;
57  float area;
58 
59  Ogre::Entity* ec;
60 
61 public:
62  Airbrake(ActorPtr actor, const char* basename, int num, node_t* ndref, node_t* ndx, node_t* ndy, node_t* nda, Ogre::Vector3 pos, float width, float length, float maxang, std::string const & texname, float tx1, float tx2, float tx3, float tx4, float lift_coef);
63  ~Airbrake() {} // Cleanup of visuals is done by GfxActor
64 
65  void updatePosition(float amount);
66  void applyForce();
67  float getRatio() const { return ratio; }
68  float getMaxAngle() const { return maxangle; }
69 };
70 
73 
74 } // namespace RoR
RoR::Airbrake::CoVertice_t::vertex
Ogre::Vector3 vertex
Definition: AirBrake.h:43
RoR::Airbrake::CoVertice_t::normal
Ogre::Vector3 normal
Definition: AirBrake.h:44
RoR::Airbrake::nodex
node_t * nodex
Definition: AirBrake.h:51
RoR::Airbrake::snode
Ogre::SceneNode * snode
Definition: AirBrake.h:49
RoR::Airbrake::ec
Ogre::Entity * ec
Definition: AirBrake.h:59
RoR::Airbrake::~Airbrake
~Airbrake()
Definition: AirBrake.h:63
RoR::Airbrake::area
float area
Attribute set at spawn.
Definition: AirBrake.h:57
RefCountingObjectPtr< Actor >
RoR::ActorSpawner
Processes a RigDef::Document (parsed from 'truck' file format) into a simulated gameplay object (Acto...
Definition: ActorSpawner.h:70
RoR::Airbrake::updatePosition
void updatePosition(float amount)
Definition: AirBrake.cpp:165
RoR::Airbrake::CoVertice_t
Definition: AirBrake.h:41
RoR::Airbrake::Airbrake
Airbrake(ActorPtr actor, const char *basename, int num, node_t *ndref, node_t *ndx, node_t *ndy, node_t *nda, Ogre::Vector3 pos, float width, float length, float maxang, std::string const &texname, float tx1, float tx2, float tx3, float tx4, float lift_coef)
Definition: AirBrake.cpp:34
RoR::Airbrake::offset
Ogre::Vector3 offset
gfx attribute
Definition: AirBrake.h:54
RoR::Airbrake::getMaxAngle
float getMaxAngle() const
Definition: AirBrake.h:68
RoR::Airbrake::nodea
node_t * nodea
Definition: AirBrake.h:53
Application.h
Central state/object manager and communications hub.
RoR::Airbrake::nodey
node_t * nodey
Definition: AirBrake.h:52
RoR::node_t
Physics: A vertex in the softbody structure.
Definition: SimData.h:286
RoR::Airbrake::ratio
float ratio
Current state.
Definition: AirBrake.h:55
RoR::Airbrake::msh
Ogre::MeshPtr msh
Definition: AirBrake.h:48
RoR::Airbrake::getRatio
float getRatio() const
Definition: AirBrake.h:67
RoR::Airbrake::applyForce
void applyForce()
Definition: AirBrake.cpp:171
RoR::Airbrake::maxangle
float maxangle
attribute from truckfile
Definition: AirBrake.h:56
RoR::Airbrake::noderef
node_t * noderef
Definition: AirBrake.h:50
RoR::Airbrake::CoVertice_t::texcoord
Ogre::Vector2 texcoord
Definition: AirBrake.h:45
RoR
Definition: AppContext.h:36
RoR::Airbrake
Definition: AirBrake.h:35