summaryrefslogtreecommitdiffstats
path: root/src/Generating/CompositedHeiGen.h
diff options
context:
space:
mode:
authorTiger Wang <ziwei.tiger@hotmail.co.uk>2014-12-13 13:11:01 +0100
committerTiger Wang <ziwei.tiger@hotmail.co.uk>2014-12-13 13:11:01 +0100
commit4b20a615192baeb5ef0a04a10161a03428cda8cd (patch)
treec6f25102267b0cc4a444f6e746679405948142b0 /src/Generating/CompositedHeiGen.h
parentFixed compilation? (diff)
parentMerge pull request #1660 from Seadragon91/master (diff)
downloadcuberite-4b20a615192baeb5ef0a04a10161a03428cda8cd.tar
cuberite-4b20a615192baeb5ef0a04a10161a03428cda8cd.tar.gz
cuberite-4b20a615192baeb5ef0a04a10161a03428cda8cd.tar.bz2
cuberite-4b20a615192baeb5ef0a04a10161a03428cda8cd.tar.lz
cuberite-4b20a615192baeb5ef0a04a10161a03428cda8cd.tar.xz
cuberite-4b20a615192baeb5ef0a04a10161a03428cda8cd.tar.zst
cuberite-4b20a615192baeb5ef0a04a10161a03428cda8cd.zip
Diffstat (limited to 'src/Generating/CompositedHeiGen.h')
-rw-r--r--src/Generating/CompositedHeiGen.h49
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;
+};
+
+
+
+