diff options
Diffstat (limited to 'src/voxel.h')
-rw-r--r-- | src/voxel.h | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/src/voxel.h b/src/voxel.h index ff5d534cb..89333159c 100644 --- a/src/voxel.h +++ b/src/voxel.h @@ -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 |