1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-06-27 16:36:03 +00:00

partly working chunk-based map generator (doesn't save properly, spawn is pretty random)

This commit is contained in:
Perttu Ahola 2011-02-01 03:06:02 +02:00
parent be851871cd
commit 6e196c2ce4
13 changed files with 1370 additions and 126 deletions

View file

@ -262,7 +262,31 @@ public:
{
return index(p.X, p.Y, p.Z);
}
// Translate index in the X coordinate
void add_x(const v3s16 &extent, u32 &i, s16 a)
{
i += a;
}
// Translate index in the Y coordinate
void add_y(const v3s16 &extent, u32 &i, s16 a)
{
i += a * extent.X;
}
// Translate index in the Z coordinate
void add_z(const v3s16 &extent, u32 &i, s16 a)
{
i += a * extent.X*extent.Y;
}
// Translate index in space
void add_p(const v3s16 &extent, u32 &i, v3s16 a)
{
i += a.Z*extent.X*extent.Y + a.Y*extent.X + a.X;
}
/*
Print method for debugging
*/
void print(std::ostream &o) const
{
v3s16 e = getExtent();
@ -394,6 +418,10 @@ public:
*/
void copyFrom(MapNode *src, VoxelArea src_area,
v3s16 from_pos, v3s16 to_pos, v3s16 size);
// Copy data
void copyTo(MapNode *dst, VoxelArea dst_area,
v3s16 dst_pos, v3s16 from_pos, v3s16 size);
/*
Algorithms