osb/source/game/terrain/StarFlatSurfaceSelector.cpp
2023-06-20 14:33:09 +10:00

19 lines
522 B
C++

#include "StarFlatSurfaceSelector.hpp"
namespace Star {
char const* const FlatSurfaceSelector::Name = "flatSurface";
FlatSurfaceSelector::FlatSurfaceSelector(Json const& config, TerrainSelectorParameters const& parameters)
: TerrainSelector(Name, config, parameters) {
surfaceLevel = parameters.baseHeight;
adjustment = config.getFloat("adjustment", 0);
flip = config.getBool("flip", false) ? -1 : 1;
}
float FlatSurfaceSelector::get(int, int y) const {
return flip * (surfaceLevel - (y - adjustment));
}
}