mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-07 03:51:50 +00:00
add 'heights-interpolation', 'biomes-interpolation'
This commit is contained in:
parent
99d9533453
commit
d8c3940451
5 changed files with 33 additions and 3 deletions
|
|
@ -5,6 +5,17 @@
|
|||
#include <stdexcept>
|
||||
#include <glm/glm.hpp>
|
||||
|
||||
std::optional<InterpolationType> InterpolationType_from(std::string_view str) {
|
||||
if (str == "nearest") {
|
||||
return InterpolationType::NEAREST;
|
||||
} else if (str == "linear") {
|
||||
return InterpolationType::LINEAR;
|
||||
} else if (str == "cubic") {
|
||||
return InterpolationType::CUBIC;
|
||||
}
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
static inline float sample_at(
|
||||
const float* buffer,
|
||||
uint width,
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
#include <vector>
|
||||
#include <string>
|
||||
#include <optional>
|
||||
|
||||
#include "typedefs.hpp"
|
||||
#include "maths/Heightmap.hpp"
|
||||
|
|
@ -12,6 +13,8 @@ enum class InterpolationType {
|
|||
CUBIC,
|
||||
};
|
||||
|
||||
std::optional<InterpolationType> InterpolationType_from(std::string_view str);
|
||||
|
||||
class Heightmap {
|
||||
std::vector<float> buffer;
|
||||
uint width, height;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue