载入中...
搜索中...
未找到
TerrainMesh.h
浏览该文件的文档.
1#pragma once
2
3#include "procgen/MeshBuild.h"
5
6#include <string>
7#include <vector>
8
9namespace eve::procgen {
10
13 int originX = 0, originY = 0;
14 int cellsX = 0, cellsY = 0;
15 int lod = 0;
16 float cellSize = 1.f;
17 float heightScale = 1.f;
18 float skirtDepth = 1.f;
19};
20
28public:
30 const MeshBuild &mesh() const { return mesh_; }
32 MeshBuild &mesh() { return mesh_; }
34 int getVertexCount() const { return mesh_.getVertexCount(); }
36 int getIndexCount() const { return mesh_.getIndexCount(); }
38 int getBaseVertexCount() const { return baseVertexCount_; }
40 int getLodStep() const { return lodStep_; }
42 int getOriginX() const { return originX_; }
44 int getOriginY() const { return originY_; }
46 int getSplatWidth() const { return splatWidth_; }
48 int getSplatHeight() const { return splatHeight_; }
50 float getGeometricError() const { return geometricError_; }
52 int getBiome(int vertex) const;
54 float getMaterialWeight(int vertex, int channel) const;
55
56private:
57 friend class TerrainMeshBuilder;
58 MeshBuild mesh_;
59 std::vector<float> weights_;
60 std::vector<uint8_t> biomes_;
61 int baseVertexCount_ = 0, lodStep_ = 1, originX_ = 0, originY_ = 0;
62 int splatWidth_ = 0, splatHeight_ = 0;
63 float geometricError_ = 0.f;
64};
65
68public:
70 static bool build(const Heightmap &heightmap, const TerrainLayers *layers,
72 std::string *error = nullptr);
74 static float estimateGeometricError(const Heightmap &heightmap,
76};
77
80public:
85 static int select(const Heightmap &heightmap, TerrainMeshSettings settings, int maxLod,
86 float distance, float viewportHeight, float verticalFovDegrees,
87 float targetPixelError);
88};
89
92 int originX = 0, originY = 0;
93 int cellsX = 0, cellsY = 0;
94 float cellSize = 1.f;
95 float heightScale = 1.f;
96 float minWidth = 0.12f;
97 float maxWidth = 0.6f;
98 float heightOffset = 0.03f;
100 float minSurfaceSlope = 0.f;
102 float maxSurfaceSlope = 0.30f;
103};
104
107public:
109 static bool build(const Heightmap &heightmap, const TerrainLayers &layers,
111 std::string *error = nullptr);
112};
113
116 int originX = 0, originY = 0;
117 int cellsX = 0, cellsY = 0;
118 float cellSize = 1.f;
119 float heightScale = 1.f;
120 float minimumDepth = 0.002f;
121 float heightOffset = 0.025f;
122};
123
126public:
128 static bool build(const Heightmap &heightmap, const TerrainLayers &layers,
130 std::string *error = nullptr);
131};
132
133} // namespace eve::procgen
#define EVENGINE_API_DOMAINS
Definition Export.h:110
float distance
std::string error
Definition Package.cpp:60
TerrainThermalSettings settings
In-memory terrain heightmap: a dense float grid (row-major, index = y * width + x) materialized from ...
Definition Heightmap.h:21
CPU triangle mesh from procedural mesh recipes (e.g. marching cubes). Positions/normals are xyz-packe...
Definition MeshBuild.h:19
Builds flat water-surface cells for Priority-Flood depressions.
Script-friendly ownership wrapper for baked hydrology and climate layers.
Screen-space-error LOD choice based on measured heightfield deviation.
Definition TerrainMesh.h:79
Builds LOD heightfield chunks with stable normals, skirts, and biome splat weights.
Definition TerrainMesh.h:67
One renderable heightfield chunk plus four ecological material weights.
Definition TerrainMesh.h:27
int getSplatHeight() const
Returns the splat height.
Definition TerrainMesh.h:48
float getGeometricError() const
Returns the geometric error.
Definition TerrainMesh.h:50
const MeshBuild & mesh() const
Mesh.
Definition TerrainMesh.h:30
int getLodStep() const
Returns the lod step.
Definition TerrainMesh.h:40
int getSplatWidth() const
Returns the splat width.
Definition TerrainMesh.h:46
int getOriginY() const
Returns the origin y.
Definition TerrainMesh.h:44
int getOriginX() const
Returns the origin x.
Definition TerrainMesh.h:42
int getBaseVertexCount() const
Returns the base vertex count.
Definition TerrainMesh.h:38
int getIndexCount() const
Returns the index count.
Definition TerrainMesh.h:36
int getVertexCount() const
Returns the vertex count.
Definition TerrainMesh.h:34
Builds overlapping flow-aligned water ribbons from a terrain river network.
TerrainLakeMeshSettings public API.
TerrainMeshSettings public API.
Definition TerrainMesh.h:12
TerrainRiverMeshSettings public API.
Definition TerrainMesh.h:91