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
FlexAirfoil.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 <Ogre.h>
24
25#include "Application.h"
26#include "SimData.h" // For MAX_AEROENGINES
27
28namespace RoR {
29
32
34{
35public:
36 FlexAirfoil(Ogre::String const& wname, ActorPtr actor,
37 NodeNum_t pnfld, NodeNum_t pnfrd, NodeNum_t pnflu, NodeNum_t pnfru, NodeNum_t pnbld, NodeNum_t pnbrd, NodeNum_t pnblu, NodeNum_t pnbru,
38 std::string const & texname,
39 Ogre::Vector2 texlf, Ogre::Vector2 texrf, Ogre::Vector2 texlb, Ogre::Vector2 texrb,
40 char mtype, float controlratio, float mind, float maxd, Ogre::String const& afname, float lift_coef, bool break_able);
41
43
44 // DEV NOTE: original `updateVertices()` updated both physics state + visuals.
46 Ogre::Vector3 updateVerticesGfx(RoR::GfxActor* gfx_actor);
47 void uploadVertices();
48
49 void setControlDeflection(float val);
50
51 void enableInducedDrag(float span, float area, bool l);
52
53 void addwash(int propid, float ratio);
54
55 void updateForces();
56
57 float aoa;
58 char type;
67
68 bool broken;
70 float liftcoef;
71
72private:
73
74 float airfoilpos[90];
75
76 typedef struct
77 {
78 Ogre::Vector3 vertex;
79 Ogre::Vector3 normal;
80 // Ogre::Vector3 color;
81 Ogre::Vector2 texcoord;
83
84 Ogre::MeshPtr msh;
85 Ogre::SubMesh* subface;
86 Ogre::SubMesh* subband;
87
88 Ogre::SubMesh* subcup;
89 Ogre::SubMesh* subcdn;
90
91 Ogre::VertexDeclaration* decl;
92 Ogre::HardwareVertexBufferSharedPtr vbuf;
93
94 size_t nVertices;
95 size_t vbufCount;
96
97 union
98 {
99 float* vertices;
101 };
102
107 unsigned short* facefaces;
108 unsigned short* bandfaces;
109 unsigned short* cupfaces;
110 unsigned short* cdnfaces;
112
113 float sref;
114
120 float lratio;
121 float rratio;
122 float mindef;
123 float maxdef;
126 float idSpan;
127 float idArea;
128 bool idLeft;
129
135};
136
138
139} // namespace RoRs
Central state/object manager and communications hub.
static const int MAX_AEROENGINES
maximum number of aero engines per actor
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
unsigned short * cdnfaces
void updateVerticesPhysics()
int washpropnum[MAX_AEROENGINES]
Ogre::SubMesh * subface
Definition FlexAirfoil.h:85
Ogre::MeshPtr msh
Definition FlexAirfoil.h:84
Airfoil * airfoil
unsigned short * bandfaces
void enableInducedDrag(float span, float area, bool l)
CoVertice_t * covertices
Ogre::VertexDeclaration * decl
Definition FlexAirfoil.h:91
AeroEnginePtr * aeroengines
Ogre::SubMesh * subcup
Definition FlexAirfoil.h:88
unsigned short * facefaces
Ogre::HardwareVertexBufferSharedPtr vbuf
Definition FlexAirfoil.h:92
void setControlDeflection(float val)
float washpropratio[MAX_AEROENGINES]
float airfoilpos[90]
Definition FlexAirfoil.h:74
Ogre::Vector3 updateVerticesGfx(RoR::GfxActor *gfx_actor)
Ogre::SubMesh * subband
Definition FlexAirfoil.h:86
Ogre::SubMesh * subcdn
Definition FlexAirfoil.h:89
void addwash(int propid, float ratio)
unsigned short * cupfaces
uint16_t NodeNum_t
Node position within Actor::ar_nodes; use RoR::NODENUM_INVALID as empty value.
Physics: A vertex in the softbody structure.
Definition SimData.h:260