载入中...
搜索中...
未找到
HexFeatures.h
浏览该文件的文档.
1#pragma once
2#include "common/Export.h"
3
4
7#include "hexmap/HexMap.h"
9#include "hexmap/HexMetrics.h"
10
11#include <cstdint>
12
13namespace eve::hexmap {
14
16struct HexHash {
17 float a = 0.f;
18 float b = 0.f;
19 float c = 0.f;
20 float d = 0.f;
21 float e = 0.f;
22};
23
36public:
38 static constexpr float kScale = 0.25f;
40 static constexpr std::int32_t kSize = 256;
41
46 explicit HexHashGrid(std::uint32_t seed = 0u) noexcept : seed_(seed) {}
47
49 [[nodiscard]] HexHash sample(HexVec3 position) const noexcept;
50
51private:
52 std::uint32_t seed_ = 0u;
53};
54
61[[nodiscard]] EVENGINE_API_WORLD float featureThreshold(std::int32_t level, std::int32_t index) noexcept;
62
64inline constexpr std::int32_t kFeatureThresholdCount = 3;
65
67inline constexpr float kWallTowerThreshold = 0.5f;
69inline constexpr float kBridgeDesignLength = 7.f;
70
87EVENGINE_API_WORLD void buildWallMesh(const HexMap& map, std::int32_t chunkIndex, HexMeshData& out);
88
105EVENGINE_API_WORLD void buildFeatureMesh(const HexMap& map, std::int32_t chunkIndex, HexMeshData& out);
106
107} // namespace eve::hexmap
#define EVENGINE_API_WORLD
Definition Export.h:109
float u
Definition Grass.cpp:233
Editable hex cell grid: topology, queries, picking and authoring.
CPU vertex/index container shared by the hex surface builders.
Pointy-top hex metrics, directions and vertex helpers.
std::array< float, 3 > position
int level
std::uint32_t seed
Definition PointSet.cpp:807
uint32_t index
Deterministic replacement for the reference project's hash grid.
Definition HexFeatures.h:35
HexHashGrid(std::uint32_t seed=0u) noexcept
Creates a hash field for seed.
Definition HexFeatures.h:46
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 buildFeatureMesh(const HexMap &map, std::int32_t chunkIndex, HexMeshData &out)
Builds the urban, farm, plant and special decorations of one chunk.
constexpr float kWallTowerThreshold
Height of a city/farm wall, matching HexMetrics::kWallHeight.
Definition HexFeatures.h:67
float featureThreshold(std::int32_t level, std::int32_t index) noexcept
Feature-placement thresholds of the reference project.
constexpr float kBridgeDesignLength
Edge length the reference bridge model is designed for.
Definition HexFeatures.h:69
void buildWallMesh(const HexMap &map, std::int32_t chunkIndex, HexMeshData &out)
Builds the wall and bridge geometry of one chunk.
constexpr std::int32_t kFeatureThresholdCount
Number of threshold entries per feature level.
Definition HexFeatures.h:64
Five-component pseudo-random value used to pick and orient one feature.
Definition HexFeatures.h:16
Minimal 3-component float vector used by the hex mesh builders.
Definition HexMetrics.h:18