diff options
author | Mattes D <github@xoft.cz> | 2014-11-13 21:28:50 +0100 |
---|---|---|
committer | Mattes D <github@xoft.cz> | 2014-11-13 21:28:50 +0100 |
commit | 7a3b3aeb3c28b7ba899d6dff2b5e160a95529f40 (patch) | |
tree | ffb4c4568b3a0d17ace705d1f8e8683935c80511 /src/Generating/CompositedHeiGen.h | |
parent | Generator: Shape initial refactoring. (diff) | |
download | cuberite-7a3b3aeb3c28b7ba899d6dff2b5e160a95529f40.tar cuberite-7a3b3aeb3c28b7ba899d6dff2b5e160a95529f40.tar.gz cuberite-7a3b3aeb3c28b7ba899d6dff2b5e160a95529f40.tar.bz2 cuberite-7a3b3aeb3c28b7ba899d6dff2b5e160a95529f40.tar.lz cuberite-7a3b3aeb3c28b7ba899d6dff2b5e160a95529f40.tar.xz cuberite-7a3b3aeb3c28b7ba899d6dff2b5e160a95529f40.tar.zst cuberite-7a3b3aeb3c28b7ba899d6dff2b5e160a95529f40.zip |
Diffstat (limited to '')
-rw-r--r-- | src/Generating/CompositedHeiGen.h | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/src/Generating/CompositedHeiGen.h b/src/Generating/CompositedHeiGen.h new file mode 100644 index 000000000..fa33a7861 --- /dev/null +++ b/src/Generating/CompositedHeiGen.h @@ -0,0 +1,49 @@ + +// CompositedHeiGen.h + +// Declares the cCompositedHeiGen class representing a cTerrainHeightGen descendant that calculates heightmap of the composited terrain +// This is used to further cache heightmaps for chunks already generated for finishers that require only heightmap information + + + + + +#pragma once + +#include "ComposableGenerator.h" + + + + + +class cCompositedHeiGen: + public cTerrainHeightGen +{ +public: + cCompositedHeiGen(cTerrainShapeGenPtr a_ShapeGen, cTerrainCompositionGenPtr a_CompositionGen): + m_ShapeGen(a_ShapeGen), + m_CompositionGen(a_CompositionGen) + { + } + + + + // cTerrainheightGen overrides: + virtual void GenHeightMap(int a_ChunkX, int a_ChunkZ, cChunkDef::HeightMap & a_HeightMap) override + { + cChunkDesc::Shape shape; + m_ShapeGen->GenShape(a_ChunkX, a_ChunkZ, shape); + cChunkDesc desc(a_ChunkX, a_ChunkZ); + desc.SetHeightFromShape(shape); + m_CompositionGen->ComposeTerrain(desc, shape); + memcpy(a_HeightMap, desc.GetHeightMap(), sizeof(a_HeightMap)); + } + +protected: + cTerrainShapeGenPtr m_ShapeGen; + cTerrainCompositionGenPtr m_CompositionGen; +}; + + + + |