mirror of
https://github.com/aimrebirth/tools.git
synced 2026-04-15 01:43:25 +00:00
Rename height to length.
This commit is contained in:
parent
6d8cbc5a39
commit
539c5dde83
4 changed files with 35 additions and 38 deletions
|
|
@ -54,7 +54,7 @@ void weather_group::load(const buffer &b)
|
||||||
{
|
{
|
||||||
READ(b, n_segs);
|
READ(b, n_segs);
|
||||||
segments.resize(n_segs);
|
segments.resize(n_segs);
|
||||||
READ(b, name);
|
READ_STRING_N(b, name, 0xA0);
|
||||||
for (auto &s : segments)
|
for (auto &s : segments)
|
||||||
s.load(b);
|
s.load(b);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -107,7 +107,7 @@ struct weather
|
||||||
struct weather_group
|
struct weather_group
|
||||||
{
|
{
|
||||||
uint32_t n_segs;
|
uint32_t n_segs;
|
||||||
char name[0xA0];
|
std::string name;
|
||||||
std::vector<weather> segments;
|
std::vector<weather> segments;
|
||||||
|
|
||||||
void load(const buffer &b);
|
void load(const buffer &b);
|
||||||
|
|
|
||||||
|
|
@ -69,7 +69,7 @@ void header::load(const buffer &b)
|
||||||
READ_WSTRING(b, name1);
|
READ_WSTRING(b, name1);
|
||||||
READ_WSTRING(b, name2);
|
READ_WSTRING(b, name2);
|
||||||
READ(b, width);
|
READ(b, width);
|
||||||
READ(b, height);
|
READ(b, length);
|
||||||
READ(b, n_header_segs);
|
READ(b, n_header_segs);
|
||||||
segments.resize(n_header_segs);
|
segments.resize(n_header_segs);
|
||||||
READ_STRING_N(b, name, 0xA0);
|
READ_STRING_N(b, name, 0xA0);
|
||||||
|
|
@ -96,8 +96,8 @@ void mmp::load(const buffer &b)
|
||||||
xsegs = (h.width - 1) / 64;
|
xsegs = (h.width - 1) / 64;
|
||||||
if ((h.width - 1) % 64 != 0)
|
if ((h.width - 1) % 64 != 0)
|
||||||
xsegs++;
|
xsegs++;
|
||||||
ysegs = (h.height - 1) / 64;
|
ysegs = (h.length - 1) / 64;
|
||||||
if ((h.height - 1) % 64 != 0)
|
if ((h.length - 1) % 64 != 0)
|
||||||
ysegs++;
|
ysegs++;
|
||||||
int n_segs = xsegs * ysegs;
|
int n_segs = xsegs * ysegs;
|
||||||
segments.resize(n_segs);
|
segments.resize(n_segs);
|
||||||
|
|
@ -159,38 +159,38 @@ void mmp::process()
|
||||||
c2.g = 255 - i * color_step;
|
c2.g = 255 - i * color_step;
|
||||||
textures_map[iter->first] = c2;
|
textures_map[iter->first] = c2;
|
||||||
}
|
}
|
||||||
alpha_maps[0] = mat<uint32_t>(h.width, h.height);
|
alpha_maps[0] = mat<uint32_t>(h.width, h.length);
|
||||||
for (auto &t : textures_map)
|
for (auto &t : textures_map)
|
||||||
{
|
{
|
||||||
alpha_maps[t.second.g] = mat<uint32_t>(h.width, h.height);
|
alpha_maps[t.second.g] = mat<uint32_t>(h.width, h.length);
|
||||||
}
|
}
|
||||||
|
|
||||||
// merge
|
// merge
|
||||||
heightmap = decltype(heightmap)(h.width, h.height);
|
heightmap = decltype(heightmap)(h.width, h.length);
|
||||||
texmap = decltype(texmap)(h.width, h.height);
|
texmap = decltype(texmap)(h.width, h.length);
|
||||||
texmap_colored = decltype(texmap_colored)(h.width, h.height);
|
texmap_colored = decltype(texmap_colored)(h.width, h.length);
|
||||||
colormap = decltype(colormap)(h.width, h.height);
|
colormap = decltype(colormap)(h.width, h.length);
|
||||||
|
|
||||||
h_min = std::numeric_limits<Height>::max();
|
h_min = std::numeric_limits<Height>::max();
|
||||||
h_max = std::numeric_limits<Height>::min();
|
h_max = std::numeric_limits<Height>::min();
|
||||||
for (auto &s : segments)
|
for (auto &s : segments)
|
||||||
{
|
{
|
||||||
const auto &data = s.d;
|
const auto &data = s.d;
|
||||||
int y1 = s.desc.Ymin / 10;
|
int y1 = s.desc.min.y / 10;
|
||||||
int y2 = s.desc.Ymax / 10;
|
int y2 = s.desc.max.y / 10;
|
||||||
if (y2 > h.height)
|
if (y2 > h.length)
|
||||||
y2 = h.height;
|
y2 = h.length;
|
||||||
for (int y = 0; y1 < y2; y1++, y++)
|
for (int y = 0; y1 < y2; y1++, y++)
|
||||||
{
|
{
|
||||||
int x1 = s.desc.Xmin / 10;
|
int x1 = s.desc.min.x / 10;
|
||||||
int x2 = s.desc.Xmax / 10;
|
int x2 = s.desc.max.x / 10;
|
||||||
auto dx = x2 - x1;
|
auto dx = x2 - x1;
|
||||||
if (x2 > h.width)
|
if (x2 > h.width)
|
||||||
x2 = h.width;
|
x2 = h.width;
|
||||||
for (int x = 0; x1 < x2; x1++, x++)
|
for (int x = 0; x1 < x2; x1++, x++)
|
||||||
{
|
{
|
||||||
auto p = y * dx + x;
|
auto p = y * dx + x;
|
||||||
auto y_rev = h.height - y1 - 1; // for bmp reversion
|
auto y_rev = h.length - y1 - 1; // for bmp reversion
|
||||||
//auto y_rev = y1;
|
//auto y_rev = y1;
|
||||||
|
|
||||||
auto t = data.Infomap[p].getTexture();
|
auto t = data.Infomap[p].getTexture();
|
||||||
|
|
@ -204,9 +204,9 @@ void mmp::process()
|
||||||
texmap_colored(y_rev, x1) = textures_map_colored[t];
|
texmap_colored(y_rev, x1) = textures_map_colored[t];
|
||||||
colormap(y_rev, x1) = data.Colormap[p];
|
colormap(y_rev, x1) = data.Colormap[p];
|
||||||
|
|
||||||
auto height = data.Heightmap[p];
|
auto length = data.Heightmap[p];
|
||||||
h_min = std::min(h_min, height);
|
h_min = std::min(h_min, length);
|
||||||
h_max = std::max(h_max, height);
|
h_max = std::max(h_max, length);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -220,14 +220,14 @@ void mmp::process()
|
||||||
|
|
||||||
for (auto &s : segments)
|
for (auto &s : segments)
|
||||||
{
|
{
|
||||||
int y1 = s.desc.Ymin / 10;
|
int y1 = s.desc.min.y / 10;
|
||||||
int y2 = s.desc.Ymax / 10;
|
int y2 = s.desc.max.y / 10;
|
||||||
if (y2 > h.height)
|
if (y2 > h.length)
|
||||||
y2 = h.height;
|
y2 = h.length;
|
||||||
for (int y = 0; y1 < y2; y1++, y++)
|
for (int y = 0; y1 < y2; y1++, y++)
|
||||||
{
|
{
|
||||||
int x1 = s.desc.Xmin / 10;
|
int x1 = s.desc.min.x / 10;
|
||||||
int x2 = s.desc.Xmax / 10;
|
int x2 = s.desc.max.x / 10;
|
||||||
auto dx = x2 - x1;
|
auto dx = x2 - x1;
|
||||||
if (x2 > h.width)
|
if (x2 > h.width)
|
||||||
x2 = h.width;
|
x2 = h.width;
|
||||||
|
|
@ -248,7 +248,7 @@ void mmp::writeFileInfo()
|
||||||
if (!ofile)
|
if (!ofile)
|
||||||
return;
|
return;
|
||||||
ofile << "width: " << h.width << "\n";
|
ofile << "width: " << h.width << "\n";
|
||||||
ofile << "height: " << h.height << "\n";
|
ofile << "length: " << h.length << "\n";
|
||||||
ofile << "x segments: " << xsegs << "\n";
|
ofile << "x segments: " << xsegs << "\n";
|
||||||
ofile << "y segments: " << ysegs << "\n";
|
ofile << "y segments: " << ysegs << "\n";
|
||||||
ofile << "h_min: " << h_min << "\n";
|
ofile << "h_min: " << h_min << "\n";
|
||||||
|
|
|
||||||
|
|
@ -64,9 +64,9 @@ struct header
|
||||||
std::wstring name1;
|
std::wstring name1;
|
||||||
std::wstring name2;
|
std::wstring name2;
|
||||||
uint32_t width;
|
uint32_t width;
|
||||||
uint32_t height;
|
uint32_t length;
|
||||||
uint32_t n_header_segs;
|
uint32_t n_header_segs;
|
||||||
std::string name;
|
std::string name; // default horizont name?
|
||||||
std::vector<header_segment*> segments;
|
std::vector<header_segment*> segments;
|
||||||
|
|
||||||
void load(const buffer &b);
|
void load(const buffer &b);
|
||||||
|
|
@ -75,6 +75,7 @@ private:
|
||||||
header_segment *create_segment(const buffer &b);
|
header_segment *create_segment(const buffer &b);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// see https://docs.unrealengine.com/latest/INT/Engine/Landscape/TechnicalGuide/index.html
|
||||||
struct segment
|
struct segment
|
||||||
{
|
{
|
||||||
static const int len = 65;
|
static const int len = 65;
|
||||||
|
|
@ -83,12 +84,8 @@ struct segment
|
||||||
struct description
|
struct description
|
||||||
{
|
{
|
||||||
uint32_t offset;
|
uint32_t offset;
|
||||||
float Xmin;
|
vector3 min;
|
||||||
float Ymin;
|
vector3 max;
|
||||||
float Zmin;
|
|
||||||
float Xmax;
|
|
||||||
float Ymax;
|
|
||||||
float Zmax;
|
|
||||||
float unk0[5];
|
float unk0[5];
|
||||||
uint32_t unk1[7];
|
uint32_t unk1[7];
|
||||||
};
|
};
|
||||||
|
|
@ -156,8 +153,8 @@ struct mmp
|
||||||
std::map<int, mat<uint32_t>> alpha_maps;
|
std::map<int, mat<uint32_t>> alpha_maps;
|
||||||
std::map<int, color> textures_map_colored;
|
std::map<int, color> textures_map_colored;
|
||||||
std::map<int, std::string> textures_names;
|
std::map<int, std::string> textures_names;
|
||||||
Height h_min;
|
Height h_min = 0;
|
||||||
Height h_max;
|
Height h_max = 0;
|
||||||
double scale16 = 0;
|
double scale16 = 0;
|
||||||
double scale = 0;
|
double scale = 0;
|
||||||
mat<uint16_t> heightmap;
|
mat<uint16_t> heightmap;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue