summary refs log tree commit diff
path: root/src/Util/Sampler.hpp
diff options
context:
space:
mode:
authorMel <einebeere@gmail.com>2023-07-07 23:05:14 +0200
committerMel <einebeere@gmail.com>2023-07-07 23:14:59 +0200
commit129f2e421e16bd008cdca8713cc91f67d103d94e (patch)
treea4d3e1005c57591b44fd57be4c1b00441512e36d /src/Util/Sampler.hpp
parentf1fc192ddc4c739fa8b4b376c759b7d3218a34eb (diff)
downloadmeowcraft-129f2e421e16bd008cdca8713cc91f67d103d94e.tar.zst
meowcraft-129f2e421e16bd008cdca8713cc91f67d103d94e.zip
Fix minor quality issues
Diffstat (limited to 'src/Util/Sampler.hpp')
-rw-r--r--src/Util/Sampler.hpp36
1 files changed, 0 insertions, 36 deletions
diff --git a/src/Util/Sampler.hpp b/src/Util/Sampler.hpp
deleted file mode 100644
index 3a4ff4f..0000000
--- a/src/Util/Sampler.hpp
+++ /dev/null
@@ -1,36 +0,0 @@
-#pragma once
-
-#include <functional>
-#include "../Math/Vector.hpp"
-#include "../Math/Grid.hpp"
-
-namespace MC::Util {
-
-template<size_t D, typename T>
-class Sampler {
-    using Pos = Vector<D>;
-    using Sample = std::function<T(Pos)>;
-    using Interpolate = std::function<T(Pos, Sample)>;
-public:
-    Sampler(
-        Sample sample,
-        Pos offset = {},
-        float scale = 1.0f,
-        Interpolate interpolate = nearest_interpolation
-    ) : m_sample([=](Sampler::Pos pos) -> T {
-        return interpolate(pos, [=](Sampler::Pos p) -> T { return sample(p * scale + offset); });
-    }) {}
-
-    T sample(Pos at) {
-        return m_sample(at);
-    }
-
-    static T nearest_interpolation(Pos pos, Sample sample) {
-        return sample(pos);
-    }
-
-private:
-    Sample m_sample;
-};
-
-}
\ No newline at end of file