mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-07 20:11:50 +00:00
refactor enums: CursorShape, InterpolationType, ParticleSpawnShape
This commit is contained in:
parent
7749675a61
commit
3be8546bf4
9 changed files with 44 additions and 91 deletions
|
|
@ -5,17 +5,6 @@
|
|||
#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,
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@
|
|||
|
||||
#include "typedefs.hpp"
|
||||
#include "maths/Heightmap.hpp"
|
||||
#include "util/EnumMetadata.hpp"
|
||||
|
||||
enum class InterpolationType {
|
||||
NEAREST,
|
||||
|
|
@ -13,7 +14,11 @@ enum class InterpolationType {
|
|||
CUBIC,
|
||||
};
|
||||
|
||||
std::optional<InterpolationType> InterpolationType_from(std::string_view str);
|
||||
VC_ENUM_METADATA(InterpolationType)
|
||||
{"nearest", InterpolationType::NEAREST},
|
||||
{"linear", InterpolationType::LINEAR},
|
||||
{"cubic", InterpolationType::CUBIC},
|
||||
VC_ENUM_END
|
||||
|
||||
class Heightmap {
|
||||
uint width, height;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue