In-memory terrain heightmap: a dense float grid (row-major, index = y * width + x) materialized from a TerrainSampler or filled by hand. 更多...
#include <Heightmap.h>
Public 成员函数 | |
| Heightmap ()=default | |
| Heightmap (int width, int height) | |
| void | resize (int width, int height) |
| int | getWidth () const |
| int | getHeight () const |
| bool | inBounds (int x, int y) const |
| void | setHeight (int x, int y, float h) |
| float | height (int x, int y) const |
| float | sampleBilinear (float x, float y) const |
| Bilinear height at continuous coordinate within [0, w) x [0, h). | |
| float | sampleBilinearSeamless (float x, float y) const |
| Bilinear height with wrap-around (seamless tiling). | |
| const std::vector< float > & | data () const |
| bool | toGrid (Grid2D &out, const TerrainBands &bands) const |
| Classify heights into a semantic Grid2D (source for tilemap generation). | |
静态 Public 成员函数 | |
| static Heightmap | generate (const TerrainSampler &sampler, int width, int height) |
Materialize a Heightmap by sampling sampler at every pixel center. | |
详细描述
In-memory terrain heightmap: a dense float grid (row-major, index = y * width + x) materialized from a TerrainSampler or filled by hand.
Use generate() to sample a TerrainSampler per-pixel, height(x, y) / sampleBilinear(x, y) to read values back, and toGrid() to classify the heights into a semantic Grid2D ready for tilemap generation.
在文件 Heightmap.h 第 19 行定义.
构造及析构函数说明
◆ Heightmap() [1/2]
|
default |
◆ Heightmap() [2/2]
| eve::procgen::Heightmap::Heightmap | ( | int | width, |
| int | height | ||
| ) |
在文件 Heightmap.cpp 第 8 行定义.
成员函数说明
◆ data()
|
inline |
在文件 Heightmap.h 第 37 行定义.
◆ generate()
|
static |
Materialize a Heightmap by sampling sampler at every pixel center.
在文件 Heightmap.cpp 第 69 行定义.
引用了 eve::procgen::TerrainSampler::asFunction(), fn, eve::procgen::TerrainSampler::getWorldHeight(), eve::procgen::TerrainSampler::getWorldWidth(), height, setHeight(), eve::procgen::TerrainSampler::setWorldSize(), width, x , 以及 y.
◆ getHeight()
| int eve::procgen::Heightmap::getHeight | ( | ) | const |
在文件 Heightmap.cpp 第 17 行定义.
◆ getWidth()
| int eve::procgen::Heightmap::getWidth | ( | ) | const |
在文件 Heightmap.cpp 第 16 行定义.
◆ height()
| float eve::procgen::Heightmap::height | ( | int | x, |
| int | y | ||
| ) | const |
在文件 Heightmap.cpp 第 28 行定义.
引用了 inBounds(), x , 以及 y.
◆ inBounds()
| bool eve::procgen::Heightmap::inBounds | ( | int | x, |
| int | y | ||
| ) | const |
◆ resize()
| void eve::procgen::Heightmap::resize | ( | int | width, |
| int | height | ||
| ) |
◆ sampleBilinear()
| float eve::procgen::Heightmap::sampleBilinear | ( | float | x, |
| float | y | ||
| ) | const |
Bilinear height at continuous coordinate within [0, w) x [0, h).
在文件 Heightmap.cpp 第 37 行定义.
◆ sampleBilinearSeamless()
| float eve::procgen::Heightmap::sampleBilinearSeamless | ( | float | x, |
| float | y | ||
| ) | const |
◆ setHeight()
| void eve::procgen::Heightmap::setHeight | ( | int | x, |
| int | y, | ||
| float | h | ||
| ) |
◆ toGrid()
| bool eve::procgen::Heightmap::toGrid | ( | Grid2D & | out, |
| const TerrainBands & | bands | ||
| ) | const |
Classify heights into a semantic Grid2D (source for tilemap generation).
在文件 Heightmap.cpp 第 84 行定义.
引用了 eve::procgen::Grid2D::resize(), eve::procgen::TerrainBands::semanticAt(), eve::procgen::Grid2D::setCell(), x , 以及 y.
该类的文档由以下文件生成:
- src/modules/procgen/heightmap/Heightmap.h
- src/modules/procgen/heightmap/Heightmap.cpp