13144a08e4
* Avoid inefficient AString -> c_str() -> AString round trip * Avoid redundant string init expressions * Avoid unnecessary return, continue, etc. * Add .clang-format to help with clang-tidy fix-its * Avoid unnecessary passing by value * Avoid unnecessary local copying * Avoid copying in range-for loops * Avoid over-complicated boolean expressions * Some violations missed by my local clang-tidy * Allow unnecessary continue statements * Add brackets * Another expression missed locally * Move BindingsProcessor call into clang-tidy.sh and add space * Fix pushd not found error * Different grouping of CheckBlockInteractionRate
53 lines
1.3 KiB
C++
53 lines
1.3 KiB
C++
|
|
// 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(cBiomeGenPtr a_BiomeGen, cTerrainShapeGenPtr a_ShapeGen, cTerrainCompositionGenPtr a_CompositionGen):
|
|
m_BiomeGen(std::move(a_BiomeGen)),
|
|
m_ShapeGen(std::move(a_ShapeGen)),
|
|
m_CompositionGen(std::move(a_CompositionGen))
|
|
{
|
|
}
|
|
|
|
|
|
|
|
// cTerrainHeightGen overrides:
|
|
virtual void GenHeightMap(cChunkCoords a_ChunkCoords, cChunkDef::HeightMap & a_HeightMap) override
|
|
{
|
|
cChunkDesc::Shape shape;
|
|
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
|
|
desc.SetHeightFromShape(shape);
|
|
m_CompositionGen->ComposeTerrain(desc, shape);
|
|
memcpy(a_HeightMap, desc.GetHeightMap(), sizeof(a_HeightMap));
|
|
}
|
|
|
|
protected:
|
|
cBiomeGenPtr m_BiomeGen;
|
|
cTerrainShapeGenPtr m_ShapeGen;
|
|
cTerrainCompositionGenPtr m_CompositionGen;
|
|
};
|
|
|
|
|
|
|
|
|