mirror of
https://github.com/zhenyan121/Cubed.git
synced 2026-04-10 06:14:07 +08:00
feat: add perlin noise
This commit is contained in:
16
include/Cubed/tools/perlin_noise.hpp
Normal file
16
include/Cubed/tools/perlin_noise.hpp
Normal file
@@ -0,0 +1,16 @@
|
||||
#pragma once
|
||||
|
||||
#include <vector>
|
||||
|
||||
class PerlinNoise {
|
||||
public:
|
||||
static void init();
|
||||
static float noise(float x, float y, float z);
|
||||
private:
|
||||
static inline bool is_init = false;
|
||||
static inline std::vector<int> p;
|
||||
|
||||
static float fade(float t);
|
||||
static float lerp(float t, float a, float b);
|
||||
static float grad(int hash, float x, float y, float z);
|
||||
};
|
||||
Reference in New Issue
Block a user