RigsofRods
Soft-body Physics Simulation
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
RigDef_File.cpp
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  Copyright 2013-2021 Petr Ohlidal
6 
7  For more information, see http://www.rigsofrods.org/
8 
9  Rigs of Rods is free software: you can redistribute it and/or modify
10  it under the terms of the GNU General Public RoR::WheelSide version 3, as
11  published by the Free Software Foundation.
12 
13  Rigs of Rods is distributed in the hope that it will be useful,
14  but WITHOUT ANY WARRANTY; without even the implied warranty of
15  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  GNU General Public RoR::WheelSide for more details.
17 
18  You should have received a copy of the GNU General Public RoR::WheelSide
19  along with Rigs of Rods. If not, see <http://www.gnu.org/licenses/>.
20 */
21 
25 
26 #include "RigDef_File.h"
27 
28 #include "Actor.h"
29 #include "CacheSystem.h"
30 #include "SimConstants.h"
31 
32 namespace RigDef
33 {
34 
35 const char* ROOT_MODULE_NAME = "_Root_"; // Static
36 
37 /* -------------------------------------------------------------------------- */
38 /* Sections */
39 /* */
40 /* This is the place to set defaults. */
41 /* -------------------------------------------------------------------------- */
42 
44  offset(Ogre::Vector3::ZERO),
45  width(0),
46  height(0),
47  max_inclination_angle(0),
48  texcoord_x1(0),
49  texcoord_x2(0),
50  texcoord_y1(0),
51  texcoord_y2(0),
52  lift_coefficient(1.f) // This is default
53 {}
54 
56  regulation_force(0),
57  min_speed(0),
58  pulse_per_sec(0),
59  attr_is_on(true),
60  attr_no_dashboard(false),
61  attr_no_toggle(false)
62 {}
63 
65 tinertiaFactor(1),
66 nturbos(1),
67 param1(9999), //used for default values
68 param2(9999),
69 param3(9999),
70 param4(9999),
71 param5(9999),
72 param6(9999),
73 param7(9999),
74 param8(9999),
75 param9(9999),
76 param10(9999),
77 param11(9999)
78 {}
79 
81  autocalc(false),
82  approximate_width(0),
83  area_coefficient(1.f), // Default
84  airfoil_name("NACA0009.afl")
85 {}
86 
88  flag_self_lock (false),
89  flag_auto_lock (false),
90  flag_no_disable(false),
91  flag_no_rope (false),
92  flag_visible (false),
93  option_hook_range(HOOK_RANGE_DEFAULT),
94  option_speed_coef(1.0f),
95  option_max_force(HOOK_FORCE_DEFAULT),
96  option_hookgroup(-1),
97  option_lockgroup(NODE_LOCKGROUP_DEFAULT),
98  option_timer(HOOK_LOCK_TIMER_DEFAULT),
99  option_min_range_meters(0.f)
100 {}
101 
103  load_weight(-1.f),
104  friction(1),
105  volume(1),
106  surface(1),
107  options(0)
108 {}
109 
111  spring_in(0),
112  damp_in(0),
113  progress_factor_spring_in(0),
114  progress_factor_damp_in(0),
115  spring_out(0),
116  damp_out(0),
117  progress_factor_spring_out(0),
118  progress_factor_damp_out(0),
119  short_bound(0),
120  long_bound(0),
121  precompression(0),
122  options(0),
123  detacher_group(0)
124 {}
125 
127  spring_in(0),
128  damp_in(0),
129  damp_in_slow(0),
130  split_vel_in(0),
131  damp_in_fast(0),
132  spring_out(0),
133  damp_out(0),
134  damp_out_slow(0),
135  split_vel_out(0),
136  damp_out_fast(0),
137  short_bound(0),
138  long_bound(0),
139  precompression(0),
140  options(0),
141  detacher_group(0)
142 {}
143 
145  regulation_force(0),
146  wheel_slip(0),
147  fade_speed(0),
148  pulse_per_sec(0),
149  attr_is_on(false),
150  attr_no_dashboard(false),
151  attr_no_toggle(false)
152 {}
153 
154 void Animation::AddMotorSource(unsigned int source, unsigned int motor)
155 {
156  Animation::MotorSource motor_source;
157  motor_source.source = source;
158  motor_source.motor = motor;
159  this->motor_sources.push_back(motor_source);
160 }
161 
163 {
164  switch (type)
165  {
166  case ManagedMaterialType::FLEXMESH_STANDARD: return "flexmesh_standard";
167  case ManagedMaterialType::FLEXMESH_TRANSPARENT: return "flexmesh_transparent";
168  case ManagedMaterialType::MESH_STANDARD: return "mesh_standard";
169  case ManagedMaterialType::MESH_TRANSPARENT: return "mesh_transparent";
170  default: return "";
171  }
172 }
173 
174 Document::Module::Module(Ogre::String const & name):
175  name(name)
176 {}
177 
179  hide_in_chooser(false),
181  rollon(false),
182  forward_commands(false),
183  import_commands(false),
185  rescuer(false),
186  disable_default_sounds(false),
188 {
189  root_module = std::make_shared<Document::Module>(ROOT_MODULE_NAME); // Required to exist.
190 }
191 
192 } /* namespace RigDef */
RigDef::Shock3::Shock3
Shock3()
Definition: RigDef_File.cpp:126
RigDef::Animation::MotorSource
Definition: RigDef_File.h:343
RigDef::Fusedrag::Fusedrag
Fusedrag()
Definition: RigDef_File.cpp:80
RigDef::Animation::MotorSource::motor
unsigned int motor
Definition: RigDef_File.h:355
RigDef::ManagedMaterialType::MESH_STANDARD
@ MESH_STANDARD
RigDef::Document::rescuer
bool rescuer
Definition: RigDef_File.h:1464
RigDef::Animation::AddMotorSource
void AddMotorSource(BitMask_t source, unsigned int motor)
Definition: RigDef_File.cpp:154
RigDef::Document::forward_commands
bool forward_commands
Definition: RigDef_File.h:1461
SimConstants.h
RigDef::Document::rollon
bool rollon
Definition: RigDef_File.h:1460
RigDef::ManagedMaterialType::MESH_TRANSPARENT
@ MESH_TRANSPARENT
RigDef::AntiLockBrakes::AntiLockBrakes
AntiLockBrakes()
Definition: RigDef_File.cpp:55
RigDef::ManagedMaterialType
ManagedMaterialType
Definition: RigDef_File.h:78
RigDef::TractionControl::TractionControl
TractionControl()
Definition: RigDef_File.cpp:144
Actor.h
RigDef::Document::disable_default_sounds
bool disable_default_sounds
Definition: RigDef_File.h:1465
RigDef::ManagedMaterial::type
ManagedMaterialType type
Definition: RigDef_File.h:906
RigDef::ManagedMaterialType::FLEXMESH_STANDARD
@ FLEXMESH_STANDARD
RigDef::Document::import_commands
bool import_commands
Definition: RigDef_File.h:1462
HOOK_FORCE_DEFAULT
static const float HOOK_FORCE_DEFAULT
Definition: SimConstants.h:74
CacheSystem.h
A database of user-installed content alias 'mods' (vehicles, terrains...)
RigDef
Definition: Application.cpp:676
RigDef::Document::enable_advanced_deformation
bool enable_advanced_deformation
Definition: RigDef_File.h:1458
RigDef::Document::Module::Module
Module(Ogre::String const &name)
Definition: RigDef_File.cpp:174
RigDef::Engturbo::Engturbo
Engturbo()
Definition: RigDef_File.cpp:64
RigDef::Airbrake::Airbrake
Airbrake()
Definition: RigDef_File.cpp:43
HOOK_RANGE_DEFAULT
static const float HOOK_RANGE_DEFAULT
Definition: SimConstants.h:75
RigDef::Document::hide_in_chooser
bool hide_in_chooser
Definition: RigDef_File.h:1457
NODE_LOCKGROUP_DEFAULT
static const int NODE_LOCKGROUP_DEFAULT
Definition: SimConstants.h:78
RigDef::ManagedMaterial::TypeToStr
static const char * TypeToStr(ManagedMaterialType type)
Definition: RigDef_File.cpp:162
HOOK_LOCK_TIMER_DEFAULT
static const float HOOK_LOCK_TIMER_DEFAULT
Definition: SimConstants.h:77
RigDef::NodeDefaults::NodeDefaults
NodeDefaults()
Definition: RigDef_File.cpp:102
RigDef::ManagedMaterialType::FLEXMESH_TRANSPARENT
@ FLEXMESH_TRANSPARENT
RigDef::Document::Document
Document()
Definition: RigDef_File.cpp:178
RigDef::Document::lockgroup_default_nolock
bool lockgroup_default_nolock
Definition: RigDef_File.h:1463
RigDef::Animation::source
BitMask64_t source
Definition: RigDef_File.h:412
RigDef::Document::slide_nodes_connect_instantly
bool slide_nodes_connect_instantly
Definition: RigDef_File.h:1459
RigDef::Animation::motor_sources
std::list< MotorSource > motor_sources
Definition: RigDef_File.h:413
Ogre
Definition: ExtinguishableFireAffector.cpp:35
RigDef::Document::root_module
std::shared_ptr< Module > root_module
Required to exist. shared_ptr is used for unified handling with other modules.
Definition: RigDef_File.h:1472
RigDef::Hook::Hook
Hook()
Definition: RigDef_File.cpp:87
RigDef::ROOT_MODULE_NAME
const char * ROOT_MODULE_NAME
Definition: RigDef_File.cpp:35
RigDef_File.h
Data structures representing 'truck' file format, see https://docs.rigsofrods.org/vehicle-creation/fi...
RigDef::Shock2::Shock2
Shock2()
Definition: RigDef_File.cpp:110
RigDef::Animation::MotorSource::source
BitMask_t source
Definition: RigDef_File.h:354