Deterministic four-channel value noise over the XZ plane. 更多...
#include <HexNoise.h>
Public 成员函数 | |
| HexNoise (std::uint32_t seed=0u) noexcept | |
Creates a noise field for seed. | |
| void | reset (std::uint32_t seed) noexcept |
| Reseeds the field. | |
| std::uint32_t | seed () const noexcept |
| The seed this field was created with. | |
| HexVec4 | sample (float worldX, float worldZ) const noexcept |
| Samples the four noise channels at a world XZ position. | |
| HexVec3 | perturb (HexVec3 position) const noexcept |
Perturbs a position in XZ by ±kCellPerturbStrength. | |
| float | elevationPerturb (float worldX, float worldZ) const noexcept |
Vertical perturbation applied to a cell's elevation, ±kElevationPerturbStrength. | |
静态 Public 属性 | |
| static constexpr float | kCellScale = 43.3f |
| Scale of the noise relative to one hex cell (world units per noise unit). | |
详细描述
Deterministic four-channel value noise over the XZ plane.
The reference hex-map project samples a four-channel Noise.png texture. This implementation reproduces the same sampling contract (four independent channels, smooth bilinear interpolation, repeatable for a given seed) without shipping a texture asset, so generated maps stay reproducible from a seed alone.
- 注解
- Immutable after construction and safe to share across the map and its mesh builders; it holds no process-global state.
在文件 HexNoise.h 第 23 行定义.
构造及析构函数说明
◆ HexNoise()
|
inlineexplicitnoexcept |
Creates a noise field for seed.
- 参数
-
seed Deterministic seed; the same seed always yields the same field.
在文件 HexNoise.h 第 32 行定义.
成员函数说明
◆ elevationPerturb()
|
noexcept |
Vertical perturbation applied to a cell's elevation, ±kElevationPerturbStrength.
- 参数
-
worldX World X coordinate. worldZ World Z coordinate.
在文件 HexNoise.cpp 第 63 行定义.
引用了 eve::hexmap::HexMetrics::kElevationPerturbStrength , 以及 n.
◆ perturb()
Perturbs a position in XZ by ±kCellPerturbStrength.
- 参数
-
position Input position; Y is preserved.
- 返回
- Perturbed position.
在文件 HexNoise.cpp 第 56 行定义.
引用了 eve::hexmap::HexMetrics::kCellPerturbStrength, n , 以及 position.
◆ reset()
|
inlinenoexcept |
Reseeds the field.
在文件 HexNoise.h 第 35 行定义.
引用了 seed().
被这些函数引用 eve::hexmap::HexMap::reset() , 以及 eve::hexmap::HexSphereMap::reset().
◆ sample()
|
noexcept |
Samples the four noise channels at a world XZ position.
- 参数
-
worldX World X coordinate. worldZ World Z coordinate.
- 返回
- Channel values in
[0, 1];.x/.zdrive XZ perturbation and.ydrives vertical elevation perturbation.
在文件 HexNoise.cpp 第 32 行定义.
引用了 bottom, bx, bz, channels, top, eve::hexmap::HexVec4::w, eve::hexmap::HexVec4::x, eve::hexmap::HexVec4::y , 以及 eve::hexmap::HexVec4::z.
◆ seed()
|
inlinenoexcept |
类成员变量说明
◆ kCellScale
|
staticconstexpr |
Scale of the noise relative to one hex cell (world units per noise unit).
在文件 HexNoise.h 第 26 行定义.
该类的文档由以下文件生成:
- src/modules/hexmap/HexNoise.h
- src/modules/hexmap/HexNoise.cpp