载入中...
搜索中...
未找到
HexMapMesh.cpp
浏览该文件的文档.
1#include "hexmap/HexMapMesh.h"
2
3namespace eve::hexmap {
4
5void buildChunkSurfaceMesh(const HexMap& map, std::int32_t chunkIndex, HexSurface surface, HexMeshData& out) {
6 switch (surface) {
7 case HexSurface::Terrain: buildTerrainMesh(map, chunkIndex, out); return;
8 case HexSurface::Water: buildWaterMesh(map, chunkIndex, out); return;
9 case HexSurface::River: buildRiverMesh(map, chunkIndex, out); return;
10 case HexSurface::Road: buildRoadMesh(map, chunkIndex, out); return;
11 case HexSurface::Fog:
12 // The fog overlay also depends on the visibility counters, which a grid-only
13 // helper cannot see; `HexMapModule::rebuildChunk` dispatches it to `buildFogMesh`.
14 break;
17 // Both are declared by `HexFeatures.h` and dispatched by
18 // `HexMapModule::rebuildChunk`; `HexMapMesh` stays free of that header.
19 break;
20 }
21 out.clear();
22 out.finalize();
23}
24
25} // namespace eve::hexmap
Per-chunk mesh generation for every hex map surface.
An editable, chunked, pointy-top hex map.
Definition HexMap.h:72
CPU-side triangle soup for one hex chunk surface.
Definition HexMeshData.h:24
void finalize() noexcept
Computes flat per-face normals. Must be called before upload.
void clear() noexcept
Removes every vertex and index, keeping the allocated capacity.
void buildRoadMesh(const HexMap &map, std::int32_t chunkIndex, HexMeshData &out)
Builds the road surface of one chunk.
HexSurface
Surface streams a chunk mesh is generated for.
Definition HexMap.h:19
@ Feature
Urban, farm, plant and special decorations; built by buildFeatureMesh.
@ Wall
City/farm walls, wall towers and bridges; built by buildWallMesh.
@ Fog
Fog-of-war overlay of a chunk.
void buildChunkSurfaceMesh(const HexMap &map, std::int32_t chunkIndex, HexSurface surface, HexMeshData &out)
Builds one chunk surface by dispatching on surface.
Definition HexMapMesh.cpp:5
EVENGINE_API_WORLD void buildTerrainMesh(const HexMap &map, std::int32_t chunkIndex, HexMeshData &out)
Builds the ground, terrace and cliff surface of one chunk.
void buildRiverMesh(const HexMap &map, std::int32_t chunkIndex, HexMeshData &out)
Builds the river channel surface of one chunk.
EVENGINE_API_WORLD void buildWaterMesh(const HexMap &map, std::int32_t chunkIndex, HexMeshData &out)
Builds the water surface and shore band of one chunk.