载入中...
搜索中...
未找到
eve::procgen::TerrainSampler类 参考

Deterministic terrain height sampling (Red Blob Games / Perlin fBm recipe). 更多...

#include <TerrainSampler.h>

Public 成员函数

 TerrainSampler ()=default
 
float sample (float x, float y) const
 
float sampleTile (int tileX, int tileY) const
 Height at the center of map tile (tileX, tileY).
 
std::function< float(float, float)> asFunction () const
 
void setSeed (uint32_t seed)
 
uint32_t getSeed () const
 
void setScale (float scale)
 Cycles per world unit (alias of frequency). Default 1/32.
 
float getScale () const
 
void setFrequency (float frequency)
 
float getFrequency () const
 
void setWavelength (float wavelength)
 Distance per large oscillation. Sets frequency = 1/wavelength.
 
float getWavelength () const
 
void setOctaves (int octaves)
 
int getOctaves () const
 
void setLacunarity (float lacunarity)
 
float getLacunarity () const
 
void setGain (float gain)
 
float getGain () const
 
void setRidge (float ridge)
 
float getRidge () const
 
void setWarp (float warp)
 
float getWarp () const
 
void setExponent (float exponent)
 
float getExponent () const
 
void setContinent (float continent)
 
float getContinent () const
 
void setIsland (float island)
 
float getIsland () const
 
void setCoastSoftness (float softness)
 Shore width of the land mask smoothstep. Smaller = cleaner, harder coast.
 
float getCoastSoftness () const
 
void setWorldSize (int width, int height)
 
int getWorldWidth () const
 
int getWorldHeight () const
 
void setBase (float base)
 
float getBase () const
 
void setAmplitude (float amplitude)
 
float getAmplitude () const
 
void setClamp (bool enabled, float minHeight, float maxHeight)
 
bool isClamped () const
 
float getClampMin () const
 
float getClampMax () const
 

静态 Public 成员函数

static TerrainSampler fromParams (const Params &params)
 

详细描述

Deterministic terrain height sampling (Red Blob Games / Perlin fBm recipe).

sample(x, y) maps any continuous map coordinate (tile/world units) to a height in [0, 1] by default. Same coordinate + same config ⇒ same height.

Frequency is cycles per world unit. A wavelength of 32 (frequency 1/32) means one large hill every 32 tiles/pixels — this is what makes coherent terrain instead of white noise. scale is an alias for frequency.

Pipeline:

  1. 2-octave Perlin continent (low frequency) — this is the land shape
  2. low-frequency domain warp of that field (bays / peninsulas)
  3. optional multiplicative island falloff (kills map corners, not the shape)
  4. smoothstep → solid coastline; hills / ridges only inland

在文件 TerrainSampler.h27 行定义.

构造及析构函数说明

◆ TerrainSampler()

eve::procgen::TerrainSampler::TerrainSampler ( )
default

成员函数说明

◆ asFunction()

std::function< float(float, float)> eve::procgen::TerrainSampler::asFunction ( ) const

在文件 TerrainSampler.cpp124 行定义.

引用了 x , 以及 y.

被这些函数引用 eve::procgen::Heightmap::generate().

◆ fromParams()

◆ getAmplitude()

float eve::procgen::TerrainSampler::getAmplitude ( ) const

在文件 TerrainSampler.cpp47 行定义.

◆ getBase()

float eve::procgen::TerrainSampler::getBase ( ) const

在文件 TerrainSampler.cpp45 行定义.

◆ getClampMax()

float eve::procgen::TerrainSampler::getClampMax ( ) const

在文件 TerrainSampler.cpp55 行定义.

◆ getClampMin()

float eve::procgen::TerrainSampler::getClampMin ( ) const

在文件 TerrainSampler.cpp54 行定义.

◆ getCoastSoftness()

float eve::procgen::TerrainSampler::getCoastSoftness ( ) const

在文件 TerrainSampler.cpp37 行定义.

◆ getContinent()

float eve::procgen::TerrainSampler::getContinent ( ) const

在文件 TerrainSampler.cpp33 行定义.

◆ getExponent()

float eve::procgen::TerrainSampler::getExponent ( ) const

在文件 TerrainSampler.cpp31 行定义.

◆ getFrequency()

float eve::procgen::TerrainSampler::getFrequency ( ) const

在文件 TerrainSampler.cpp15 行定义.

◆ getGain()

float eve::procgen::TerrainSampler::getGain ( ) const

在文件 TerrainSampler.cpp25 行定义.

◆ getIsland()

float eve::procgen::TerrainSampler::getIsland ( ) const

在文件 TerrainSampler.cpp35 行定义.

◆ getLacunarity()

float eve::procgen::TerrainSampler::getLacunarity ( ) const

在文件 TerrainSampler.cpp23 行定义.

◆ getOctaves()

int eve::procgen::TerrainSampler::getOctaves ( ) const

在文件 TerrainSampler.cpp21 行定义.

◆ getRidge()

float eve::procgen::TerrainSampler::getRidge ( ) const

在文件 TerrainSampler.cpp27 行定义.

◆ getScale()

float eve::procgen::TerrainSampler::getScale ( ) const

在文件 TerrainSampler.cpp13 行定义.

◆ getSeed()

uint32_t eve::procgen::TerrainSampler::getSeed ( ) const

在文件 TerrainSampler.cpp11 行定义.

引用了 eve::procgen::NoiseField::seed.

◆ getWarp()

float eve::procgen::TerrainSampler::getWarp ( ) const

在文件 TerrainSampler.cpp29 行定义.

◆ getWavelength()

float eve::procgen::TerrainSampler::getWavelength ( ) const

在文件 TerrainSampler.cpp19 行定义.

◆ getWorldHeight()

int eve::procgen::TerrainSampler::getWorldHeight ( ) const

在文件 TerrainSampler.cpp43 行定义.

被这些函数引用 eve::procgen::Heightmap::generate().

◆ getWorldWidth()

int eve::procgen::TerrainSampler::getWorldWidth ( ) const

在文件 TerrainSampler.cpp42 行定义.

被这些函数引用 eve::procgen::Heightmap::generate().

◆ isClamped()

bool eve::procgen::TerrainSampler::isClamped ( ) const

在文件 TerrainSampler.cpp53 行定义.

◆ sample()

float eve::procgen::TerrainSampler::sample ( float  x,
float  y 
) const

◆ sampleTile()

float eve::procgen::TerrainSampler::sampleTile ( int  tileX,
int  tileY 
) const

Height at the center of map tile (tileX, tileY).

在文件 TerrainSampler.cpp120 行定义.

引用了 sample().

◆ setAmplitude()

void eve::procgen::TerrainSampler::setAmplitude ( float  amplitude)

在文件 TerrainSampler.cpp46 行定义.

◆ setBase()

void eve::procgen::TerrainSampler::setBase ( float  base)

在文件 TerrainSampler.cpp44 行定义.

◆ setClamp()

void eve::procgen::TerrainSampler::setClamp ( bool  enabled,
float  minHeight,
float  maxHeight 
)

在文件 TerrainSampler.cpp48 行定义.

引用了 enabled.

◆ setCoastSoftness()

void eve::procgen::TerrainSampler::setCoastSoftness ( float  softness)

Shore width of the land mask smoothstep. Smaller = cleaner, harder coast.

在文件 TerrainSampler.cpp36 行定义.

◆ setContinent()

void eve::procgen::TerrainSampler::setContinent ( float  continent)

在文件 TerrainSampler.cpp32 行定义.

◆ setExponent()

void eve::procgen::TerrainSampler::setExponent ( float  exponent)

在文件 TerrainSampler.cpp30 行定义.

◆ setFrequency()

void eve::procgen::TerrainSampler::setFrequency ( float  frequency)

在文件 TerrainSampler.cpp14 行定义.

引用了 setScale().

被这些函数引用 setWavelength().

◆ setGain()

void eve::procgen::TerrainSampler::setGain ( float  gain)

在文件 TerrainSampler.cpp24 行定义.

◆ setIsland()

void eve::procgen::TerrainSampler::setIsland ( float  island)

在文件 TerrainSampler.cpp34 行定义.

◆ setLacunarity()

void eve::procgen::TerrainSampler::setLacunarity ( float  lacunarity)

在文件 TerrainSampler.cpp22 行定义.

◆ setOctaves()

void eve::procgen::TerrainSampler::setOctaves ( int  octaves)

在文件 TerrainSampler.cpp20 行定义.

◆ setRidge()

void eve::procgen::TerrainSampler::setRidge ( float  ridge)

在文件 TerrainSampler.cpp26 行定义.

◆ setScale()

void eve::procgen::TerrainSampler::setScale ( float  scale)

Cycles per world unit (alias of frequency). Default 1/32.

在文件 TerrainSampler.cpp12 行定义.

引用了 scale.

被这些函数引用 setFrequency().

◆ setSeed()

void eve::procgen::TerrainSampler::setSeed ( uint32_t  seed)

在文件 TerrainSampler.cpp10 行定义.

引用了 seed , 以及 eve::procgen::NoiseField::seed.

被这些函数引用 fromParams().

◆ setWarp()

void eve::procgen::TerrainSampler::setWarp ( float  warp)

在文件 TerrainSampler.cpp28 行定义.

◆ setWavelength()

void eve::procgen::TerrainSampler::setWavelength ( float  wavelength)

Distance per large oscillation. Sets frequency = 1/wavelength.

在文件 TerrainSampler.cpp16 行定义.

引用了 setFrequency().

◆ setWorldSize()

void eve::procgen::TerrainSampler::setWorldSize ( int  width,
int  height 
)

在文件 TerrainSampler.cpp38 行定义.

引用了 height , 以及 width.

被这些函数引用 eve::procgen::Heightmap::generate().


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