载入中...
搜索中...
未找到
Heightmap.h
浏览该文件的文档.
1#pragma once
2#include "common/Export.h"
3
4
5#include "procgen/Grid2D.h"
7
8#include <cstdint>
9#include <vector>
10
11namespace eve::procgen {
12
22public:
24 Heightmap() = default;
26 Heightmap(int width, int height);
27
29 void resize(int width, int height);
31 int getWidth() const;
33 int getHeight() const;
35 bool inBounds(int x, int y) const;
36
38 void setHeight(int x, int y, float h);
40 float height(int x, int y) const;
41
43 float sampleBilinear(float x, float y) const;
45 float sampleBilinearSeamless(float x, float y) const;
46
48 const std::vector<float> &data() const { return data_; }
50 std::vector<float> &data() { return data_; }
51
53 static Heightmap generate(const TerrainSampler &sampler, int width, int height);
54
56 bool toGrid(Grid2D &out, const TerrainBands &bands) const;
57
58private:
59 int width_ = 0;
60 int height_ = 0;
61 std::vector<float> data_;
62};
63
64} // namespace eve::procgen
float y
Definition AnimClip.cpp:738
float x
Definition AnimClip.cpp:738
#define EVENGINE_API_DOMAINS
Definition Export.h:110
vk::UniqueSampler sampler
int h
std::uint32_t height
std::uint32_t width
Intermediate 2D generation result. cells store semantic ids (see Semantic.h), not tile GIDs — convert...
Definition Grid2D.h:36
In-memory terrain heightmap: a dense float grid (row-major, index = y * width + x) materialized from ...
Definition Heightmap.h:21
const std::vector< float > & data() const
Data.
Definition Heightmap.h:48
Heightmap()=default
Heightmap.
std::vector< float > & data()
Mutable row-major samples for terrain processing and asset import.
Definition Heightmap.h:50
Deterministic terrain height sampling (Red Blob Games / Perlin fBm recipe).
TerrainBands public API.