mirror of
https://github.com/zhenyan121/Cubed.git
synced 2026-06-18 00:27:02 +08:00
* feat: add BlockType * refactor: use fBM for heightmap generation * feat: improve mountain realism * refactor: adjust mountain spawn probability * feat: add biome boundary blending * refactor: remove resolve_biome_adjacency_conflict function * feat: add snowy plain * perf: speed up world generation * refactor: lower overall terrain height
36 lines
880 B
C++
36 lines
880 B
C++
#pragma once
|
|
#include <atomic>
|
|
#include <vector>
|
|
|
|
namespace Cubed {
|
|
|
|
class PerlinNoise3D {
|
|
public:
|
|
static void init(unsigned seed);
|
|
static float noise(float x, float y, float z);
|
|
static void reload(unsigned seed);
|
|
|
|
private:
|
|
static inline std::atomic<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);
|
|
};
|
|
|
|
class PerlinNoise2D {
|
|
public:
|
|
static void init(unsigned seed);
|
|
static float noise(float x, float y);
|
|
static void reload(unsigned seed);
|
|
|
|
private:
|
|
static inline std::atomic<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);
|
|
};
|
|
|
|
} // namespace Cubed
|