载入中...
搜索中...
未找到
eve::hexmap::HexNoise类 参考

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()

eve::hexmap::HexNoise::HexNoise ( std::uint32_t  seed = 0u)
inlineexplicitnoexcept

Creates a noise field for seed.

参数
seedDeterministic seed; the same seed always yields the same field.

在文件 HexNoise.h 第 32 行定义.

成员函数说明

◆ elevationPerturb()

float eve::hexmap::HexNoise::elevationPerturb ( float  worldX,
float  worldZ 
) const
noexcept

Vertical perturbation applied to a cell's elevation, ±kElevationPerturbStrength.

参数
worldXWorld X coordinate.
worldZWorld Z coordinate.

在文件 HexNoise.cpp 第 63 行定义.

引用了 eve::hexmap::HexMetrics::kElevationPerturbStrength , 以及 n.

◆ perturb()

HexVec3 eve::hexmap::HexNoise::perturb ( HexVec3  position) const
noexcept

Perturbs a position in XZ by ±kCellPerturbStrength.

参数
positionInput position; Y is preserved.
返回
Perturbed position.

在文件 HexNoise.cpp 第 56 行定义.

引用了 eve::hexmap::HexMetrics::kCellPerturbStrength, n , 以及 position.

◆ reset()

void eve::hexmap::HexNoise::reset ( std::uint32_t  seed)
inlinenoexcept

Reseeds the field.

在文件 HexNoise.h 第 35 行定义.

引用了 seed().

被这些函数引用 eve::hexmap::HexMap::reset() , 以及 eve::hexmap::HexSphereMap::reset().

◆ sample()

HexVec4 eve::hexmap::HexNoise::sample ( float  worldX,
float  worldZ 
) const
noexcept

Samples the four noise channels at a world XZ position.

参数
worldXWorld X coordinate.
worldZWorld Z coordinate.
返回
Channel values in [0, 1]; .x/.z drive XZ perturbation and .y drives 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()

std::uint32_t eve::hexmap::HexNoise::seed ( ) const
inlinenoexcept

The seed this field was created with.

在文件 HexNoise.h 第 37 行定义.

被这些函数引用 reset().

类成员变量说明

◆ kCellScale

constexpr float eve::hexmap::HexNoise::kCellScale = 43.3f
staticconstexpr

Scale of the noise relative to one hex cell (world units per noise unit).

在文件 HexNoise.h 第 26 行定义.


该类的文档由以下文件生成: