2014-11-13 15:28:50 -05:00
|
|
|
|
|
|
|
// 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:
|
2015-06-23 08:45:35 -04:00
|
|
|
cCompositedHeiGen(cBiomeGenPtr a_BiomeGen, cTerrainShapeGenPtr a_ShapeGen, cTerrainCompositionGenPtr a_CompositionGen):
|
2020-05-14 18:15:35 -04:00
|
|
|
m_BiomeGen(std::move(a_BiomeGen)),
|
|
|
|
m_ShapeGen(std::move(a_ShapeGen)),
|
|
|
|
m_CompositionGen(std::move(a_CompositionGen))
|
2014-11-13 15:28:50 -05:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-06-23 08:45:35 -04:00
|
|
|
// cTerrainHeightGen overrides:
|
2019-09-08 09:40:12 -04:00
|
|
|
virtual void GenHeightMap(cChunkCoords a_ChunkCoords, cChunkDef::HeightMap & a_HeightMap) override
|
2014-11-13 15:28:50 -05:00
|
|
|
{
|
|
|
|
cChunkDesc::Shape shape;
|
2019-09-08 09:40:12 -04:00
|
|
|
m_ShapeGen->GenShape(a_ChunkCoords, shape);
|
|
|
|
cChunkDesc desc(a_ChunkCoords);
|
|
|
|
m_BiomeGen->GenBiomes(a_ChunkCoords, desc.GetBiomeMap()); // Need to initialize biomes for the composition gen
|
2014-11-13 15:28:50 -05:00
|
|
|
desc.SetHeightFromShape(shape);
|
|
|
|
m_CompositionGen->ComposeTerrain(desc, shape);
|
|
|
|
memcpy(a_HeightMap, desc.GetHeightMap(), sizeof(a_HeightMap));
|
|
|
|
}
|
|
|
|
|
|
|
|
protected:
|
2015-06-23 08:45:35 -04:00
|
|
|
cBiomeGenPtr m_BiomeGen;
|
2014-11-13 15:28:50 -05:00
|
|
|
cTerrainShapeGenPtr m_ShapeGen;
|
|
|
|
cTerrainCompositionGenPtr m_CompositionGen;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|