Generate biomes when pregenerating heights through CompositedHeiGen.
Fixes #2283.
This commit is contained in:
parent
532c80b6db
commit
6cd71a1e73
@ -274,7 +274,7 @@ void cComposableGenerator::InitCompositionGen(cIniFile & a_IniFile)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Create a cache of the composited heightmaps, so that finishers may use it:
|
// Create a cache of the composited heightmaps, so that finishers may use it:
|
||||||
m_CompositedHeightCache = std::make_shared<cHeiGenMultiCache>(std::make_shared<cCompositedHeiGen>(m_ShapeGen, m_CompositionGen), 16, 24);
|
m_CompositedHeightCache = std::make_shared<cHeiGenMultiCache>(std::make_shared<cCompositedHeiGen>(m_BiomeGen, m_ShapeGen, m_CompositionGen), 16, 24);
|
||||||
// 24 subcaches of depth 16 each = 96 KiB of RAM. Acceptable, for the amount of work this saves.
|
// 24 subcaches of depth 16 each = 96 KiB of RAM. Acceptable, for the amount of work this saves.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -20,7 +20,8 @@ class cCompositedHeiGen:
|
|||||||
public cTerrainHeightGen
|
public cTerrainHeightGen
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
cCompositedHeiGen(cTerrainShapeGenPtr a_ShapeGen, cTerrainCompositionGenPtr a_CompositionGen):
|
cCompositedHeiGen(cBiomeGenPtr a_BiomeGen, cTerrainShapeGenPtr a_ShapeGen, cTerrainCompositionGenPtr a_CompositionGen):
|
||||||
|
m_BiomeGen(a_BiomeGen),
|
||||||
m_ShapeGen(a_ShapeGen),
|
m_ShapeGen(a_ShapeGen),
|
||||||
m_CompositionGen(a_CompositionGen)
|
m_CompositionGen(a_CompositionGen)
|
||||||
{
|
{
|
||||||
@ -28,18 +29,20 @@ public:
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
// cTerrainheightGen overrides:
|
// cTerrainHeightGen overrides:
|
||||||
virtual void GenHeightMap(int a_ChunkX, int a_ChunkZ, cChunkDef::HeightMap & a_HeightMap) override
|
virtual void GenHeightMap(int a_ChunkX, int a_ChunkZ, cChunkDef::HeightMap & a_HeightMap) override
|
||||||
{
|
{
|
||||||
cChunkDesc::Shape shape;
|
cChunkDesc::Shape shape;
|
||||||
m_ShapeGen->GenShape(a_ChunkX, a_ChunkZ, shape);
|
m_ShapeGen->GenShape(a_ChunkX, a_ChunkZ, shape);
|
||||||
cChunkDesc desc(a_ChunkX, a_ChunkZ);
|
cChunkDesc desc(a_ChunkX, a_ChunkZ);
|
||||||
|
m_BiomeGen->GenBiomes(a_ChunkX, a_ChunkZ, desc.GetBiomeMap()); // Need to initialize biomes for the composition gen
|
||||||
desc.SetHeightFromShape(shape);
|
desc.SetHeightFromShape(shape);
|
||||||
m_CompositionGen->ComposeTerrain(desc, shape);
|
m_CompositionGen->ComposeTerrain(desc, shape);
|
||||||
memcpy(a_HeightMap, desc.GetHeightMap(), sizeof(a_HeightMap));
|
memcpy(a_HeightMap, desc.GetHeightMap(), sizeof(a_HeightMap));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
cBiomeGenPtr m_BiomeGen;
|
||||||
cTerrainShapeGenPtr m_ShapeGen;
|
cTerrainShapeGenPtr m_ShapeGen;
|
||||||
cTerrainCompositionGenPtr m_CompositionGen;
|
cTerrainCompositionGenPtr m_CompositionGen;
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user