32 #include <OgreException.h>
41 std::string file_basename, file_ext;
42 Ogre::StringUtil::splitBaseFilename(filename, file_basename, file_ext);
46 cfg.load(ds,
"\t:=",
false);
49 m_def->disable_cache = cfg.
getBool (
"disableCaching",
false);
50 m_def->world_size_x = cfg.
getInt (
"WorldSizeX", 1024);
51 m_def->world_size_y = cfg.
getInt (
"WorldSizeY", 50);
52 m_def->world_size_z = cfg.
getInt (
"WorldSizeZ", 1024);
53 m_def->page_size = cfg.
getInt (
"PageSize", 1025);
54 m_def->pages_max_x = cfg.
getInt (
"PagesX", 0);
55 m_def->pages_max_z = cfg.
getInt (
"PagesZ", 0);
56 m_def->page_filename_format = cfg.
getString(
"PageFileFormat", Ogre::BLANKSTRING, file_basename +
"-page-{X}-{Z}.otc");
57 m_def->is_flat = cfg.
getBool (
"Flat",
false);
58 m_def->max_pixel_error = cfg.
getInt (
"MaxPixelError", 5);
59 m_def->batch_size_min = cfg.
getInt (
"minBatchSize", 33);
60 m_def->batch_size_max = cfg.
getInt (
"maxBatchSize", 65);
61 m_def->lightmap_enabled = cfg.
getBool (
"LightmapEnabled",
false);
62 m_def->norm_map_enabled = cfg.
getBool (
"NormalMappingEnabled",
false);
63 m_def->spec_map_enabled = cfg.
getBool (
"SpecularMappingEnabled",
false);
64 m_def->parallax_enabled = cfg.
getBool (
"ParallaxMappingEnabled",
false);
65 m_def->blendmap_dbg_enabled = cfg.
getBool (
"DebugBlendMaps",
false);
66 m_def->global_colormap_enabled = cfg.
getBool (
"GlobalColourMapEnabled",
false);
67 m_def->recv_dyn_shadows_depth = cfg.
getBool (
"ReceiveDynamicShadowsDepth",
false);
68 m_def->composite_map_distance = cfg.
getInt (
"CompositeMapDistance", 4000);
69 m_def->layer_blendmap_size = cfg.
getInt (
"LayerBlendMapSize", 1024);
70 m_def->composite_map_size = cfg.
getInt (
"CompositeMapSize", 1024);
71 m_def->lightmap_size = cfg.
getInt (
"LightMapSize", 1024);
72 m_def->skirt_size = cfg.
getInt (
"SkirtSize", 30);
74 m_def->world_size = std::max(m_def->world_size_x, m_def->world_size_z);
75 m_def->origin_pos = Ogre::Vector3(m_def->world_size_x / 2.0f, 0.0f, m_def->world_size_z / 2.0f);
76 m_def->cache_filename_base = file_basename;
78 for (
int x = 0;
x <= m_def->pages_max_x; ++
x)
80 for (
int z = 0;
z <= m_def->pages_max_z; ++
z)
82 std::string filename = m_def->page_filename_format;
83 filename = Ogre::StringUtil::replaceAll(filename,
"{X}",
TOSTRING(
x));
84 filename = Ogre::StringUtil::replaceAll(filename,
"{Z}",
TOSTRING(
z));
86 char base[50], key[75];
87 snprintf(base, 50,
"Heightmap.%d.%d",
x,
z);
89 snprintf(key, 75,
"%s.raw.size", base);
int raw_size = cfg.
getInt(key, 1025);
90 snprintf(key, 75,
"%s.raw.bpp", base);
int raw_bpp = cfg.
getInt(key, 2);
91 snprintf(key, 75,
"%s.flipX", base);
bool flip_x = cfg.
getBool(key,
false);
92 snprintf(key, 75,
"%s.flipY", base);
bool flip_y = cfg.
getBool(key,
false);
94 m_def->pages.emplace_back(
x,
z, filename, flip_x, flip_y, raw_size, raw_bpp);
118 if (line_sane.empty() || line_sane[0] ==
';' || line_sane[0] ==
'/')
123 Ogre::StringVector args = Ogre::StringUtil::split(line_sane,
",");
126 LOG(std::string(
"[RoR|Terrain] Invalid OTC page config: [") + filename +
"]");
153 page.
layers.push_back(layer);
161 int actual_num_layers =
static_cast<int>(page.
layers.size());
164 LogFormat(
"[RoR|Terrain] Warning: File \"%s\" declares %d layers but defines %d. Correcting declared layer count to %d",
165 filename, page.
num_layers, actual_num_layers, actual_num_layers);
178 world_size_x(0), world_size_y(0), world_size_z(0), world_size(0),
179 page_size(0), pages_max_x(0), pages_max_z(0),
180 origin_pos(
Ogre::Vector3::ZERO),
181 batch_size_min(0), batch_size_max(0),
182 layer_blendmap_size(0), max_pixel_error(0), composite_map_size(0), composite_map_distance(0),
183 skirt_size(0), lightmap_size(0),
184 lightmap_enabled(false), norm_map_enabled(false), spec_map_enabled(false), parallax_enabled(false),
185 global_colormap_enabled(false), recv_dyn_shadows_depth(false), disable_cache(false), is_flat(true)
189 RoR::OTCPage::OTCPage(
int x_pos,
int z_pos, std::string
const & conf_filename,
bool flipX,
bool flipY,
int rawsize,
int rawbpp):
190 pageconf_filename(conf_filename),
191 pos_x(x_pos), pos_z(z_pos),
192 is_heightmap_raw(false), raw_flip_x(flipX), raw_flip_y(flipY),
193 raw_size(rawsize), raw_bpp(rawbpp),
199 alpha(static_cast<float>(
'R'))