RigsofRods
Soft-body Physics Simulation
OTCFileFormat.h
Go to the documentation of this file.
1 /*
2  This source file is part of Rigs of Rods
3  Copyright 2016-2020 Petr Ohlidal
4 
5  For more information, see http://www.rigsofrods.org/
6 
7  Rigs of Rods is free software: you can redistribute it and/or modify
8  it under the terms of the GNU General Public License version 3, as
9  published by the Free Software Foundation.
10 
11  Rigs of Rods is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  GNU General Public License for more details.
15 
16  You should have received a copy of the GNU General Public License
17  along with Rigs of Rods. If not, see <http://www.gnu.org/licenses/>.
18 */
19 
20 #pragma once
21 
24 
25 #include <OgreColourValue.h>
26 #include <OgreDataStream.h>
27 #include <OgreVector3.h>
28 
29 #include <string>
30 #include <list>
31 #include <memory>
32 
33 namespace RoR {
34 
35 struct OTCLayer
36 {
37  OTCLayer();
38 
39  std::string blendmap_filename;
41  std::string normalheight_filename;
42  char blend_mode;
43  float alpha;
44  float world_size;
45 };
46 
47 struct OTCPage
48 {
49  OTCPage(int pos_x, int pos_z, std::string const & conf_filename, bool flipX, bool flipY, int rawsize, int rawbpp);
50 
51  std::string pageconf_filename;
52  std::string heightmap_filename;
54  int pos_x, pos_z;
57 
58  std::list<OTCLayer> layers;
59 };
60 
62 struct OTCFile
63 {
64  OTCFile();
65 
66  std::string page_filename_format;
67  std::string cache_filename_base;
68  std::list<OTCPage> pages;
69  Ogre::Vector3 origin_pos;
70 
72  int page_size;
90  bool is_flat;
91 };
92 
93 class OTCParser
94 {
95 public:
96  OTCParser();
97 
98  bool LoadMasterConfig(Ogre::DataStreamPtr &ds, const char* filename);
99  bool LoadPageConfig(Ogre::DataStreamPtr &ds, OTCPage& page, const char* filename);
100  std::shared_ptr<OTCFile> GetDefinition() { return m_def; };
101 
102 private:
103 
104  std::shared_ptr<OTCFile> m_def;
105 };
106 
107 } // namespace RoR
RoR::OTCFile::pages_max_z
int pages_max_z
Highest page index.
Definition: OTCFileFormat.h:74
RoR::OTCLayer::world_size
float world_size
Definition: OTCFileFormat.h:44
RoR::OTCLayer::diffusespecular_filename
std::string diffusespecular_filename
Definition: OTCFileFormat.h:40
RoR::OTCFile::lightmap_enabled
bool lightmap_enabled
Definition: OTCFileFormat.h:82
RoR::OTCLayer
Definition: OTCFileFormat.h:35
RoR::OTCFile::parallax_enabled
bool parallax_enabled
Definition: OTCFileFormat.h:85
RoR::OTCFile::page_size
int page_size
Definition: OTCFileFormat.h:72
RoR::OTCFile::layer_blendmap_size
int layer_blendmap_size
Definition: OTCFileFormat.h:77
RoR::OTCPage::pos_z
int pos_z
Definition: OTCFileFormat.h:54
RoR::OTCFile::batch_size_max
int batch_size_max
Definition: OTCFileFormat.h:76
RoR::OTCPage::raw_size
int raw_size
Definition: OTCFileFormat.h:56
RoR::OTCPage::num_layers
int num_layers
Definition: OTCFileFormat.h:53
RoR::OTCParser
Definition: OTCFileFormat.h:93
RoR::OTCPage::heightmap_filename
std::string heightmap_filename
Definition: OTCFileFormat.h:52
RoR::OTCPage::pageconf_filename
std::string pageconf_filename
Definition: OTCFileFormat.h:51
RoR::OTCFile::origin_pos
Ogre::Vector3 origin_pos
Definition: OTCFileFormat.h:69
RoR::OTCLayer::blendmap_filename
std::string blendmap_filename
Definition: OTCFileFormat.h:39
RoR::OTCFile::skirt_size
int skirt_size
Definition: OTCFileFormat.h:80
RoR::OTCFile::norm_map_enabled
bool norm_map_enabled
Definition: OTCFileFormat.h:83
RoR::OTCLayer::OTCLayer
OTCLayer()
Definition: OTCFileFormat.cpp:197
RoR::OTCLayer::alpha
float alpha
Definition: OTCFileFormat.h:43
RoR::OTCLayer::blend_mode
char blend_mode
Definition: OTCFileFormat.h:42
RoR::OTCFile::world_size_y
int world_size_y
Definition: OTCFileFormat.h:71
RoR::OTCFile::pages
std::list< OTCPage > pages
Definition: OTCFileFormat.h:68
RoR::OTCPage::OTCPage
OTCPage(int pos_x, int pos_z, std::string const &conf_filename, bool flipX, bool flipY, int rawsize, int rawbpp)
Definition: OTCFileFormat.cpp:189
RoR::OTCFile::batch_size_min
int batch_size_min
Definition: OTCFileFormat.h:76
RoR::OTCFile::recv_dyn_shadows_depth
bool recv_dyn_shadows_depth
Definition: OTCFileFormat.h:87
RoR::OTCFile::world_size_x
int world_size_x
Definition: OTCFileFormat.h:71
RoR::OTCParser::LoadPageConfig
bool LoadPageConfig(Ogre::DataStreamPtr &ds, OTCPage &page, const char *filename)
Definition: OTCFileFormat.cpp:106
RoR::OTCPage
Definition: OTCFileFormat.h:47
RoR::OTCFile::lightmap_size
int lightmap_size
Definition: OTCFileFormat.h:81
RoR::OTCFile::is_flat
bool is_flat
Definition: OTCFileFormat.h:90
RoR::OTCLayer::normalheight_filename
std::string normalheight_filename
Definition: OTCFileFormat.h:41
RoR::OTCParser::m_def
std::shared_ptr< OTCFile > m_def
Definition: OTCFileFormat.h:100
RoR::OTCPage::is_heightmap_raw
bool is_heightmap_raw
Definition: OTCFileFormat.h:55
RoR::OTCFile::OTCFile
OTCFile()
Definition: OTCFileFormat.cpp:177
RoR::OTCParser::LoadMasterConfig
bool LoadMasterConfig(Ogre::DataStreamPtr &ds, const char *filename)
Definition: OTCFileFormat.cpp:39
RoR::OTCPage::raw_flip_y
bool raw_flip_y
Definition: OTCFileFormat.h:55
RoR::OTCPage::raw_flip_x
bool raw_flip_x
Definition: OTCFileFormat.h:55
RoR::OTCParser::GetDefinition
std::shared_ptr< OTCFile > GetDefinition()
Definition: OTCFileFormat.h:100
RoR::OTCFile::pages_max_x
int pages_max_x
Definition: OTCFileFormat.h:74
RoR::OTCParser::OTCParser
OTCParser()
Definition: OTCFileFormat.cpp:34
RoR::OTCFile::global_colormap_enabled
bool global_colormap_enabled
Definition: OTCFileFormat.h:86
RoR::OTCFile::max_pixel_error
int max_pixel_error
Definition: OTCFileFormat.h:75
RoR::OTCFile::composite_map_distance
int composite_map_distance
Definition: OTCFileFormat.h:79
RoR::OTCFile::page_filename_format
std::string page_filename_format
Definition: OTCFileFormat.h:66
RoR::OTCFile::blendmap_dbg_enabled
bool blendmap_dbg_enabled
Definition: OTCFileFormat.h:88
RoR::OTCFile::disable_cache
bool disable_cache
Definition: OTCFileFormat.h:89
RoR::OTCFile
Rembember OGRE coordinates are {X = right/left, Y = up/down, Z = front/back}.
Definition: OTCFileFormat.h:62
RoR::OTCPage::raw_bpp
int raw_bpp
Definition: OTCFileFormat.h:56
RoR::OTCPage::pos_x
int pos_x
Definition: OTCFileFormat.h:54
RoR::OTCFile::spec_map_enabled
bool spec_map_enabled
Definition: OTCFileFormat.h:84
RoR::OTCPage::layers
std::list< OTCLayer > layers
Definition: OTCFileFormat.h:58
RoR
Definition: AppContext.h:36
RoR::OTCFile::composite_map_size
int composite_map_size
Definition: OTCFileFormat.h:78
RoR::OTCFile::world_size
int world_size
Definition: OTCFileFormat.h:73
RoR::OTCFile::cache_filename_base
std::string cache_filename_base
Definition: OTCFileFormat.h:67
RoR::OTCFile::world_size_z
int world_size_z
Definition: OTCFileFormat.h:71