载入中...
搜索中...
未找到
NoiseField.h
浏览该文件的文档.
1#pragma once
2#include "common/Export.h"
3
4
5#include <cstdint>
6
7namespace eve::procgen {
8
10enum class WorleyMetric : uint8_t { Euclidean = 0, Manhattan = 1, Chebyshev = 2 };
11
25 uint32_t seed = 1;
26 int periodX = 0; // 0 = non-tiling
27 int periodY = 0;
28
30 float hash01(int ix, int iy) const;
31
33 float whiteNoise(int ix, int iy) const;
34
36 float valueNoise(float x, float y) const;
37
39 float perlinNoise(float x, float y) const;
40
45 float simplexNoise(float x, float y) const;
46
52 float worleyF1(float x, float y, float jitter = 1.f, WorleyMetric metric = WorleyMetric::Euclidean) const;
53
55 float worleyF2(float x, float y, float jitter = 1.f, WorleyMetric metric = WorleyMetric::Euclidean) const;
56
61 float worleyNoise(float x, float y, float jitter = 1.f, WorleyMetric metric = WorleyMetric::Euclidean) const;
62
64 float worleyEdge(float x, float y, float jitter = 1.f, WorleyMetric metric = WorleyMetric::Euclidean) const;
65
67 float worleyCombine(float x, float y, float jitter = 1.f, WorleyMetric metric = WorleyMetric::Euclidean) const;
68
73 float worleySmooth(float x, float y, float smoothness = 0.25f, float jitter = 1.f) const;
74
76 float fbm(float x, float y, int octaves = 4, float lacunarity = 2.f, float gain = 0.5f) const;
77
79 float fbmPerlin(float x, float y, int octaves = 4, float lacunarity = 2.f, float gain = 0.5f) const;
80
82 float fbmSimplex(float x, float y, int octaves = 4, float lacunarity = 2.f, float gain = 0.5f) const;
83
88 float fbmRotated(float x, float y, int octaves = 4, float lacunarity = 2.f, float gain = 0.5f) const;
89
91 float ridged(float x, float y, int octaves = 4, float lacunarity = 2.f, float gain = 0.5f) const;
92
94 float ridgedPerlin(float x, float y, int octaves = 4, float lacunarity = 2.f, float gain = 0.5f) const;
95
100 float billow(float x, float y, int octaves = 4, float lacunarity = 2.f, float gain = 0.5f) const;
101
103 float billowPerlin(float x, float y, int octaves = 4, float lacunarity = 2.f, float gain = 0.5f) const;
104
109 float swiss(float x, float y, int octaves = 4, float lacunarity = 2.f, float gain = 0.5f,
110 float warpStrength = 0.15f) const;
111
116 float hybrid(float x, float y, int octaves = 4, float lacunarity = 2.f, float gain = 0.5f,
117 float offset = 0.7f) const;
118
123 float jordan(float x, float y, int octaves = 4, float lacunarity = 2.f, float gain = 0.5f,
124 float warpStrength = 0.35f) const;
125
131 float gabor(float x, float y, float dirX = 0.f, float dirY = 0.f, float frequency = 6.2831853f) const;
132
134 float gaborFbm(float x, float y, int octaves = 4, float dirX = 0.f, float dirY = 0.f) const;
135
140 float perlinWorley(float x, float y, int octaves = 3, float jitter = 1.f) const;
141
146 float valueDx(float x, float y, float eps = 1e-3f) const;
148 float valueDy(float x, float y, float eps = 1e-3f) const;
150 float valueSlope(float x, float y, float eps = 1e-3f) const;
151
157 float isoLine(float x, float y, int levels = 8, float width = 0.04f) const;
158
163 float banding(float x, float y, int bands = 5) const;
164
169 float fbmColor(float x, float y, int channel, int octaves = 4, float lacunarity = 2.f, float gain = 0.5f) const;
170
172 float warp(float x, float y, float amp, int octaves = 3) const;
173
178 float warpDeep(float x, float y, float amp, int octaves = 3) const;
179
184 float curlNoiseX(float x, float y, float eps = 1e-3f) const;
186 float curlNoiseY(float x, float y, float eps = 1e-3f) const;
187
192 float hexDistance(float x, float y) const;
193
195 float hexValue(float x, float y) const;
196
201 float hexEdge(float x, float y, float width = 0.05f, float soft = 0.02f) const;
202
206 float gyroid(float x, float y, float z) const;
207
209 float gyroidFbm(float x, float y, float z, int octaves = 4) const;
210};
211
217 uint32_t seed = 1;
218 int periodX = 0;
219 int periodY = 0;
220 int periodZ = 0;
221
222 float hash01(int ix, int iy, int iz) const;
223 float whiteNoise(int ix, int iy, int iz) const;
224 float valueNoise(float x, float y, float z) const;
225 float perlinNoise(float x, float y, float z) const;
226 float simplexNoise(float x, float y, float z) const;
227 float worleyF1(float x, float y, float z, float jitter = 1.f, WorleyMetric metric = WorleyMetric::Euclidean) const;
228 float worleyNoise(float x, float y, float z, float jitter = 1.f,
229 WorleyMetric metric = WorleyMetric::Euclidean) const;
230 float fbm(float x, float y, float z, int octaves = 4, float lacunarity = 2.f, float gain = 0.5f) const;
231 float fbmPerlin(float x, float y, float z, int octaves = 4, float lacunarity = 2.f, float gain = 0.5f) const;
232 float ridged(float x, float y, float z, int octaves = 4, float lacunarity = 2.f, float gain = 0.5f) const;
233 float billow(float x, float y, float z, int octaves = 4, float lacunarity = 2.f, float gain = 0.5f) const;
234 float gyroid(float x, float y, float z) const;
235 float gyroidFbm(float x, float y, float z, int octaves = 4) const;
236 float perlinWorley(float x, float y, float z, int octaves = 3, float jitter = 1.f) const;
237};
238
239} // namespace eve::procgen
double z
double y
double x
#define EVENGINE_API_DOMAINS
Definition Export.h:110
float warp
float soft[4]
std::uint32_t width
size_t offset
uint32_t seed
Definition TreeMesh.cpp:276
double gain
WorleyMetric
Distance metric for Worley / cellular noise.
Definition NoiseField.h:10
Deterministic 3D noise helpers for volumes / density fields. When period* > 0, lattice indices wrap f...
Definition NoiseField.h:216
Deterministic 2D noise helpers for pixel textures and masks.
Definition NoiseField.h:24