RigsofRods
Soft-body Physics Simulation
RigDef_Serializer.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  Copyright 2013-2020 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 License 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 License for more details.
17 
18  You should have received a copy of the GNU General Public License
19  along with Rigs of Rods. If not, see <http://www.gnu.org/licenses/>.
20 */
21 
25 
26 #pragma once
27 
28 #include "RigDef_File.h"
29 
30 namespace RigDef
31 {
32 
40 {
41 
42 public:
43 
44  Serializer(RigDef::DocumentPtr rig_def, Ogre::String const & file_path);
45 
46  virtual ~Serializer();
47 
48  void Serialize();
49 
50 protected:
51 
52  void ProcessAuthors(Document::Module* module);
53  void ProcessGlobals(Document::Module* module);
55  void ProcessGuid(Document::Module* module);
56  void ProcessFileinfo(Document::Module* module);
57  void WriteFlags();
58  void ProcessHelp(Document::Module* module);
59 
60  // Audio video
62 
63  // Structure
65  void ProcessNode(Node & node);
66  void ProcessNodeDefaults(NodeDefaults* node_defaults);
67  void ProcessNodeOptions(unsigned int options);
68 
70  void ProcessBeamDefaults(BeamDefaults* beam_defaults, const char* prefix = "");
71  void ProcessBeam(Beam & beam);
72 
76  void ProcessShock(Shock & def);
77  void ProcessShock2(Shock2 & def);
78  void ProcessShock3(Shock3 & def);
79 
81  void ProcessHydro(Hydro & def);
82  void ProcessRotators(Document::Module* module);
83  void ProcessRotators2(Document::Module* module);
84 
86  void ProcessCommand2(Command2 & def);
87  void ProcessSlideNodes(Document::Module* module);
88  void ProcessRopes(Document::Module* module);
89  void ProcessFixes(Document::Module* module);
90  void ProcessTies(Document::Module* module);
91 
92  // Land vehicle
93  void ProcessEngine(Document::Module* module);
94  void ProcessEngoption(Document::Module* module);
95  void ProcessBrakes(Document::Module* module);
101  void ProcessAxles(Document::Module* module);
103  void ProcessInterAxles(Document::Module* module);
104 
105  // Wheels
106  void ProcessMeshWheels(Document::Module* module);
107  void ProcessMeshWheels2(Document::Module* module);
108  void ProcessWheels(Document::Module* module);
109  void ProcessWheels2(Document::Module* module);
111 
112  // Features
113  void ProcessAnimators(Document::Module* module);
114  void ProcessContacters(Document::Module* module);
115  void ProcessTriggers(Document::Module* module);
116  void ProcessLockgroups(Document::Module* module);
117  void ProcessHooks(Document::Module* module);
118  void ProcessRailGroups(Document::Module* module);
119  void ProcessRopables(Document::Module* module);
120  void ProcessParticles(Document::Module* module);
123  void ProcessFlares2(Document::Module* module);
126  void ProcessFlexbodies(Document::Module* module);
128  /* TODO:
129  5.5.17 Camerarail
130  5.5.8 Flexbodies
131  5.5.8.3 (sub-directive) disable_flexbody_shadow
132  5.5.8.4 (sub-directive) flexbody_camera_mode
133  */
134 
135  void ProcessSubmesh(Document::Module* module);
136  void ProcessSubmeshGroundmodel(Document::Module* module); // STUB!!!
137  void ProcessExhausts(Document::Module* module);
138  void ProcessGuiSettings(Document::Module* module);
140  void ProcessVideocamera(Document::Module* module);
141  void ProcessExtCamera(Document::Module* module);
144 
145  // Aerial
146  void ProcessWings(Document::Module* module);
147  void ProcessAirbrakes(Document::Module* module);
148  void ProcessTurboprops(Document::Module* module);
149  void ProcessFusedrag(Document::Module* module); // STUB!!!
150  void ProcessTurbojets(Document::Module* module);
151  void ProcessPistonprops(Document::Module* module);
152 
153  // Marine
154  void ProcessScrewprops(Document::Module* module);
155 
156 protected:
157 
159 
160  std::ofstream m_stream;
161  Ogre::String m_file_path;
169 
170 };
171 
172 } // namespace RigDef
RigDef::Serializer::m_file_path
Ogre::String m_file_path
Definition: RigDef_Serializer.h:161
RigDef::Serializer::ProcessWings
void ProcessWings(Document::Module *module)
Definition: RigDef_Serializer.cpp:294
RigDef::Serializer::ProcessBrakes
void ProcessBrakes(Document::Module *module)
Definition: RigDef_Serializer.cpp:1469
RigDef::Serializer::ProcessFileinfo
void ProcessFileinfo(Document::Module *module)
Definition: RigDef_Serializer.cpp:2551
RigDef::Serializer::ProcessMeshWheels2
void ProcessMeshWheels2(Document::Module *module)
Definition: RigDef_Serializer.cpp:1677
RigDef::Serializer::ProcessFlexBodyWheels
void ProcessFlexBodyWheels(Document::Module *module)
Definition: RigDef_Serializer.cpp:1420
RigDef::Serializer::ProcessNodes
void ProcessNodes(Document::Module *)
Definition: RigDef_Serializer.cpp:2326
RigDef::Serializer::ProcessRotators2
void ProcessRotators2(Document::Module *module)
Definition: RigDef_Serializer.cpp:1370
RigDef::Serializer::ProcessVideocamera
void ProcessVideocamera(Document::Module *module)
Definition: RigDef_Serializer.cpp:393
RigDef::Serializer::m_inertia_function_width
int m_inertia_function_width
Definition: RigDef_Serializer.h:168
RigDef::Serializer::ProcessTurboprops
void ProcessTurboprops(Document::Module *module)
Definition: RigDef_Serializer.cpp:239
RigDef::Serializer::ProcessGuiSettings
void ProcessGuiSettings(Document::Module *module)
Definition: RigDef_Serializer.cpp:438
RigDef::Serializer::ProcessShocks3
void ProcessShocks3(Document::Module *)
Definition: RigDef_Serializer.cpp:1888
RigDef::Serializer::ProcessTurbojets
void ProcessTurbojets(Document::Module *module)
Definition: RigDef_Serializer.cpp:186
RigDef::Animation
Definition: RigDef_File.h:476
RigDef::Serializer::m_float_precision
int m_float_precision
Definition: RigDef_Serializer.h:163
RigDef::Serializer::ProcessCommands2
void ProcessCommands2(Document::Module *)
Definition: RigDef_Serializer.cpp:1998
RigDef::Serializer::ProcessCollisionBoxes
void ProcessCollisionBoxes(Document::Module *module)
Definition: RigDef_Serializer.cpp:800
RigDef::Hydro
Definition: RigDef_File.h:972
RigDef::Serializer::ProcessRopables
void ProcessRopables(Document::Module *module)
Definition: RigDef_Serializer.cpp:972
RigDef::Serializer::ProcessBeamDefaults
void ProcessBeamDefaults(BeamDefaults *beam_defaults, const char *prefix="")
Definition: RigDef_Serializer.cpp:2266
RigDef::Serializer::ProcessHydro
void ProcessHydro(Hydro &def)
Definition: RigDef_Serializer.cpp:2091
RigDef::Serializer::ExportBaseMeshWheel
void ExportBaseMeshWheel(BaseMeshWheel &def)
Definition: RigDef_Serializer.cpp:1641
RigDef::BeamDefaults
Definition: RigDef_File.h:655
RigDef::Document::Module
Definition: RigDef_File.h:1479
RigDef::Serializer::ProcessShock2
void ProcessShock2(Shock2 &def)
Definition: RigDef_Serializer.cpp:2170
RigDef::Serializer::ProcessAuthors
void ProcessAuthors(Document::Module *module)
Definition: RigDef_Serializer.cpp:2588
RigDef::Serializer::ProcessShock
void ProcessShock(Shock &def)
Definition: RigDef_Serializer.cpp:2130
RigDef::Serializer::ProcessEngine
void ProcessEngine(Document::Module *module)
Definition: RigDef_Serializer.cpp:1493
RigDef::Serializer::ProcessNodeOptions
void ProcessNodeOptions(unsigned int options)
Definition: RigDef_Serializer.cpp:2449
RigDef::NodeDefaults
Definition: RigDef_File.h:1049
RigDef::Serializer::ProcessManagedMaterialsAndOptions
void ProcessManagedMaterialsAndOptions(Document::Module *module)
Definition: RigDef_Serializer.cpp:746
RigDef::Serializer::ProcessFusedrag
void ProcessFusedrag(Document::Module *module)
Definition: RigDef_Serializer.cpp:231
RigDef::Command2
Definition: RigDef_File.h:763
RigDef::Serializer::ProcessSlideNodes
void ProcessSlideNodes(Document::Module *module)
Definition: RigDef_Serializer.cpp:1088
RigDef::Serializer::ProcessTriggers
void ProcessTriggers(Document::Module *module)
Definition: RigDef_Serializer.cpp:1193
RigDef::Serializer::WriteFlags
void WriteFlags()
Definition: RigDef_Serializer.cpp:2511
RigDef::Serializer::ProcessEngoption
void ProcessEngoption(Document::Module *module)
Definition: RigDef_Serializer.cpp:1527
RigDef::Serializer::ProcessRopes
void ProcessRopes(Document::Module *module)
Definition: RigDef_Serializer.cpp:1031
RigDef::Serializer::m_float_width
int m_float_width
Definition: RigDef_Serializer.h:164
RigDef::Serializer::ProcessCinecam
void ProcessCinecam(Document::Module *)
Definition: RigDef_Serializer.cpp:1691
RigDef::Serializer::ProcessNodeDefaults
void ProcessNodeDefaults(NodeDefaults *node_defaults)
Definition: RigDef_Serializer.cpp:2429
RigDef::Shock2
Definition: RigDef_File.h:1198
RigDef::Serializer::ProcessPropsAndAnimations
void ProcessPropsAndAnimations(Document::Module *module)
Definition: RigDef_Serializer.cpp:648
RigDef::Serializer::ProcessContacters
void ProcessContacters(Document::Module *module)
Definition: RigDef_Serializer.cpp:1312
RigDef::Serializer::ProcessTorqueCurve
void ProcessTorqueCurve(Document::Module *module)
Definition: RigDef_Serializer.cpp:929
RigDef::Serializer::Serialize
void Serialize()
Definition: RigDef_Serializer.cpp:53
RigDef::Serializer::ProcessAnimators
void ProcessAnimators(Document::Module *module)
Definition: RigDef_Serializer.cpp:1251
RigDef
Definition: RigDef_File.cpp:32
RigDef::Serializer::ProcessExtCamera
void ProcessExtCamera(Document::Module *module)
Definition: RigDef_Serializer.cpp:368
RigDef::Serializer::ProcessWheels2
void ProcessWheels2(Document::Module *module)
Definition: RigDef_Serializer.cpp:1574
RigDef::Serializer::ProcessFlares2
void ProcessFlares2(Document::Module *module)
Definition: RigDef_Serializer.cpp:720
RigDef::Serializer::ProcessPistonprops
void ProcessPistonprops(Document::Module *module)
Definition: RigDef_Serializer.cpp:160
RigDef::Serializer::ProcessGuid
void ProcessGuid(Document::Module *module)
Definition: RigDef_Serializer.cpp:2566
RigDef::Serializer::m_command_key_width
int m_command_key_width
Definition: RigDef_Serializer.h:167
RigDef::Serializer::ProcessAntiLockBrakes
void ProcessAntiLockBrakes(Document::Module *module)
Definition: RigDef_Serializer.cpp:1478
RigDef::Serializer::ProcessMeshWheels
void ProcessMeshWheels(Document::Module *module)
Definition: RigDef_Serializer.cpp:1663
RigDef::Serializer::ProcessBeams
void ProcessBeams(Document::Module *)
Definition: RigDef_Serializer.cpp:1723
RigDef::Serializer::ProcessLockgroups
void ProcessLockgroups(Document::Module *module)
Definition: RigDef_Serializer.cpp:1171
RigDef::Serializer::ProcessSoundsources2
void ProcessSoundsources2(Document::Module *module)
Definition: RigDef_Serializer.cpp:349
RigDef::Shock
Definition: RigDef_File.h:1180
RigDef::BaseMeshWheel
Definition: RigDef_File.h:422
RigDef::Serializer::ProcessScrewprops
void ProcessScrewprops(Document::Module *module)
Definition: RigDef_Serializer.cpp:211
RigDef::Serializer::ProcessRotators
void ProcessRotators(Document::Module *module)
Definition: RigDef_Serializer.cpp:1326
RigDef::Serializer::ProcessSoundsources
void ProcessSoundsources(Document::Module *module)
Definition: RigDef_Serializer.cpp:332
RigDef::Serializer::ProcessHooks
void ProcessHooks(Document::Module *module)
Definition: RigDef_Serializer.cpp:1137
RigDef::Serializer::ProcessWheels
void ProcessWheels(Document::Module *module)
Definition: RigDef_Serializer.cpp:1609
RigDef::Serializer
Serializes the RigDef::Document data structure to file.
Definition: RigDef_Serializer.h:39
RigDef::Serializer::ProcessCommand2
void ProcessCommand2(Command2 &def)
Definition: RigDef_Serializer.cpp:2053
RigDef::Serializer::ProcessSubmeshGroundmodel
void ProcessSubmeshGroundmodel(Document::Module *module)
Definition: RigDef_Serializer.cpp:471
RigDef::Serializer::m_rig_def
RigDef::DocumentPtr m_rig_def
Definition: RigDef_Serializer.h:162
RigDef::Serializer::ProcessFlexbodies
void ProcessFlexbodies(Document::Module *module)
Definition: RigDef_Serializer.cpp:599
RigDef::Serializer::ProcessAirbrakes
void ProcessAirbrakes(Document::Module *module)
Definition: RigDef_Serializer.cpp:263
RigDef::Serializer::ProcessShocks2
void ProcessShocks2(Document::Module *)
Definition: RigDef_Serializer.cpp:1833
RigDef::Serializer::ProcessTies
void ProcessTies(Document::Module *module)
Definition: RigDef_Serializer.cpp:991
RigDef::Serializer::ProcessExhausts
void ProcessExhausts(Document::Module *module)
Definition: RigDef_Serializer.cpp:452
RigDef::Serializer::ProcessAxles
void ProcessAxles(Document::Module *module)
Definition: RigDef_Serializer.cpp:824
RigDef::Serializer::ProcessSetSkeletonSettings
void ProcessSetSkeletonSettings(Document::Module *module)
Definition: RigDef_Serializer.cpp:432
RigDef::Serializer::ProcessHelp
void ProcessHelp(Document::Module *module)
Definition: RigDef_Serializer.cpp:1565
RigDef::Serializer::ProcessBeam
void ProcessBeam(Beam &beam)
Definition: RigDef_Serializer.cpp:2291
RigDef::Serializer::ProcessDirectiveAddAnimation
void ProcessDirectiveAddAnimation(RigDef::Animation &anim)
Definition: RigDef_Serializer.cpp:536
RigDef::Serializer::ProcessSpeedLimiter
void ProcessSpeedLimiter(Document::Module *module)
Definition: RigDef_Serializer.cpp:918
RigDef::Serializer::Serializer
Serializer(RigDef::DocumentPtr rig_def, Ogre::String const &file_path)
Definition: RigDef_Serializer.cpp:39
RigDef::Serializer::ProcessSubmesh
void ProcessSubmesh(Document::Module *module)
Definition: RigDef_Serializer.cpp:477
RigDef::Serializer::ProcessTransferCase
void ProcessTransferCase(Document::Module *module)
Definition: RigDef_Serializer.cpp:882
RigDef::Serializer::m_node_id_width
int m_node_id_width
Definition: RigDef_Serializer.h:166
RigDef::Shock3
Definition: RigDef_File.h:1224
RigDef::Serializer::ProcessHydros
void ProcessHydros(Document::Module *)
Definition: RigDef_Serializer.cpp:1943
RigDef::Serializer::ProcessShock3
void ProcessShock3(Shock3 &def)
Definition: RigDef_Serializer.cpp:2219
RigDef::Node
Definition: RigDef_Node.h:39
RigDef::DocumentPtr
std::shared_ptr< Document > DocumentPtr
Definition: RigDef_Prerequisites.h:38
RigDef::Serializer::m_stream
std::ofstream m_stream
Definition: RigDef_Serializer.h:160
RigDef::Serializer::ProcessTractionControl
void ProcessTractionControl(Document::Module *module)
Definition: RigDef_Serializer.cpp:1453
RigDef::Serializer::m_bool_width
int m_bool_width
Definition: RigDef_Serializer.h:165
RigDef::Serializer::ProcessParticles
void ProcessParticles(Document::Module *module)
Definition: RigDef_Serializer.cpp:952
RigDef::Serializer::ProcessMaterialFlareBindings
void ProcessMaterialFlareBindings(Document::Module *module)
Definition: RigDef_Serializer.cpp:704
RigDef::Serializer::ProcessRailGroups
void ProcessRailGroups(Document::Module *module)
Definition: RigDef_Serializer.cpp:1062
RigDef::Serializer::ProcessDescription
void ProcessDescription(Document::Module *module)
Definition: RigDef_Serializer.cpp:2574
RigDef::Serializer::ProcessCruiseControl
void ProcessCruiseControl(Document::Module *module)
Definition: RigDef_Serializer.cpp:902
RigDef::Beam
Definition: RigDef_File.h:626
RigDef::Serializer::ProcessFixes
void ProcessFixes(Document::Module *module)
Definition: RigDef_Serializer.cpp:1016
RigDef::Serializer::ProcessNode
void ProcessNode(Node &node)
Definition: RigDef_Serializer.cpp:2492
RigDef::Serializer::ProcessInterAxles
void ProcessInterAxles(Document::Module *module)
Definition: RigDef_Serializer.cpp:853
RigDef::Serializer::~Serializer
virtual ~Serializer()
Definition: RigDef_Serializer.cpp:50
RigDef_File.h
Data structures representing 'truck' file format, see https://docs.rigsofrods.org/vehicle-creation/fi...
RigDef::Serializer::ProcessGlobals
void ProcessGlobals(Document::Module *module)
Definition: RigDef_Serializer.cpp:2607
RigDef::Serializer::ProcessShocks
void ProcessShocks(Document::Module *)
Definition: RigDef_Serializer.cpp:1778