diff options
author | Niels Breuker <niels.breuker@hotmail.nl> | 2024-03-22 12:46:11 +0100 |
---|---|---|
committer | Niels Breuker <niels.breuker@hotmail.nl> | 2024-03-22 12:46:11 +0100 |
commit | f9f73ca5d5beb59d59c18b02562b96f7db515806 (patch) | |
tree | 9f4eb8f84364dfde3308be9ac2460efc15aea3a0 /src/Generating/ChunkDesc.h | |
parent | Moved end generator back to 3d perlin noise (diff) | |
download | cuberite-f9f73ca5d5beb59d59c18b02562b96f7db515806.tar cuberite-f9f73ca5d5beb59d59c18b02562b96f7db515806.tar.gz cuberite-f9f73ca5d5beb59d59c18b02562b96f7db515806.tar.bz2 cuberite-f9f73ca5d5beb59d59c18b02562b96f7db515806.tar.lz cuberite-f9f73ca5d5beb59d59c18b02562b96f7db515806.tar.xz cuberite-f9f73ca5d5beb59d59c18b02562b96f7db515806.tar.zst cuberite-f9f73ca5d5beb59d59c18b02562b96f7db515806.zip |
Diffstat (limited to 'src/Generating/ChunkDesc.h')
-rw-r--r-- | src/Generating/ChunkDesc.h | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/Generating/ChunkDesc.h b/src/Generating/ChunkDesc.h index d10159dc9..d066660f1 100644 --- a/src/Generating/ChunkDesc.h +++ b/src/Generating/ChunkDesc.h @@ -87,6 +87,24 @@ public: /** Sets the shape in a_Shape to match the heightmap stored currently in m_HeightMap. */ void GetShapeFromHeight(Shape & a_Shape) const; + /** Returns the index into the internal shape array for the specified coords */ + inline static size_t MakeShapeIndex(int a_X, int a_Y, int a_Z) + { + return static_cast<size_t>(a_Y + a_X * cChunkDef::Height + a_Z * cChunkDef::Height * cChunkDef::Width); + } + + inline static void SetShapeIsSolidAt(Shape & a_Shape, int a_X, int a_Y, int a_Z, bool a_IsSolid) + { + auto index = MakeShapeIndex(a_X, a_Y, a_Z); + a_Shape[index] = a_IsSolid ? 1 : 0; + } + + inline static bool GetShapeIsSolidAt(const Shape & a_Shape, int a_X, int a_Y, int a_Z) + { + auto index = MakeShapeIndex(a_X, a_Y, a_Z); + return a_Shape[index]; + } + // tolua_begin // Default generation: |