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

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

#include <TerrainSampler.h>

Public 成员函数

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

静态 Public 成员函数

static TerrainSampler fromParams (const Params &params)
 From 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.h 第 29 行定义.

构造及析构函数说明

◆ TerrainSampler()

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

Terrain sampler.

引用了 eve::procgen::raster_detail::sample().

成员函数说明

◆ asFunction()

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

Float.

在文件 TerrainSampler.cpp 第 124 行定义.

引用了 x , 以及 y.

◆ fromParams()

TerrainSampler eve::procgen::TerrainSampler::fromParams ( const Params &  params)
static

From params.

在文件 TerrainSampler.cpp 第 128 行定义.

引用了 params, s , 以及 setSeed().

被这些函数引用 eve::procgen::Procgen::generateHeightmapHandle().

◆ getAmplitude()

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

Returns the amplitude.

在文件 TerrainSampler.cpp 第 47 行定义.

◆ getBase()

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

Returns the base.

在文件 TerrainSampler.cpp 第 45 行定义.

◆ getClampMax()

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

Returns the clamp max.

在文件 TerrainSampler.cpp 第 55 行定义.

◆ getClampMin()

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

Returns the clamp min.

在文件 TerrainSampler.cpp 第 54 行定义.

◆ getCoastSoftness()

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

Returns the coast softness.

在文件 TerrainSampler.cpp 第 37 行定义.

◆ getContinent()

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

Returns the continent.

在文件 TerrainSampler.cpp 第 33 行定义.

◆ getExponent()

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

Returns the exponent.

在文件 TerrainSampler.cpp 第 31 行定义.

◆ getFrequency()

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

Returns the frequency.

在文件 TerrainSampler.cpp 第 15 行定义.

◆ getGain()

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

Returns the gain.

在文件 TerrainSampler.cpp 第 25 行定义.

◆ getIsland()

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

Returns the island.

在文件 TerrainSampler.cpp 第 35 行定义.

◆ getLacunarity()

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

Returns the lacunarity.

在文件 TerrainSampler.cpp 第 23 行定义.

◆ getOctaves()

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

Returns the octaves.

在文件 TerrainSampler.cpp 第 21 行定义.

◆ getRidge()

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

Returns the ridge.

在文件 TerrainSampler.cpp 第 27 行定义.

◆ getScale()

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

Returns the scale.

在文件 TerrainSampler.cpp 第 13 行定义.

◆ getSeed()

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

Returns the seed.

在文件 TerrainSampler.cpp 第 11 行定义.

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

◆ getWarp()

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

Returns the warp.

在文件 TerrainSampler.cpp 第 29 行定义.

◆ getWavelength()

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

Returns the wavelength.

在文件 TerrainSampler.cpp 第 19 行定义.

◆ getWorldHeight()

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

Returns the world height.

在文件 TerrainSampler.cpp 第 43 行定义.

◆ getWorldWidth()

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

Returns the world width.

在文件 TerrainSampler.cpp 第 42 行定义.

◆ isClamped()

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

True when clamped.

在文件 TerrainSampler.cpp 第 53 行定义.

◆ 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.cpp 第 120 行定义.

引用了 sample().

◆ setAmplitude()

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

Sets the amplitude.

在文件 TerrainSampler.cpp 第 46 行定义.

◆ setBase()

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

Sets the base.

在文件 TerrainSampler.cpp 第 44 行定义.

◆ setClamp()

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

Sets the clamp.

在文件 TerrainSampler.cpp 第 48 行定义.

引用了 enabled.

◆ setCoastSoftness()

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

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

在文件 TerrainSampler.cpp 第 36 行定义.

◆ setContinent()

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

Sets the continent.

在文件 TerrainSampler.cpp 第 32 行定义.

◆ setExponent()

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

Sets the exponent.

在文件 TerrainSampler.cpp 第 30 行定义.

◆ setFrequency()

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

Sets the frequency.

在文件 TerrainSampler.cpp 第 14 行定义.

引用了 setScale().

被这些函数引用 setWavelength().

◆ setGain()

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

Sets the gain.

在文件 TerrainSampler.cpp 第 24 行定义.

◆ setIsland()

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

Sets the island.

在文件 TerrainSampler.cpp 第 34 行定义.

引用了 island.

◆ setLacunarity()

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

Sets the lacunarity.

在文件 TerrainSampler.cpp 第 22 行定义.

◆ setOctaves()

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

Sets the octaves.

在文件 TerrainSampler.cpp 第 20 行定义.

◆ setRidge()

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

Sets the ridge.

在文件 TerrainSampler.cpp 第 26 行定义.

◆ setScale()

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

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

在文件 TerrainSampler.cpp 第 12 行定义.

引用了 scale.

被这些函数引用 setFrequency().

◆ setSeed()

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

Sets the seed.

在文件 TerrainSampler.cpp 第 10 行定义.

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

被这些函数引用 fromParams().

◆ setWarp()

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

Sets the warp.

在文件 TerrainSampler.cpp 第 28 行定义.

引用了 warp.

◆ setWavelength()

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

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

在文件 TerrainSampler.cpp 第 16 行定义.

引用了 setFrequency().

◆ setWorldSize()

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

Sets the world size.

在文件 TerrainSampler.cpp 第 38 行定义.

引用了 height , 以及 width.

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


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