载入中...
搜索中...
未找到
HexRoadMesh.cpp
浏览该文件的文档.
30 const HexVec3 normal{ab.y * ac.z - ab.z * ac.y, ab.z * ac.x - ab.x * ac.z, ab.x * ac.y - ab.y * ac.x};
43void emitTriangle(HexMeshData& out, const SurfaceVertex& a, const SurfaceVertex& b, const SurfaceVertex& c,
49 out.addTriangle(out.addVertex(pa, a.u, a.v), out.addVertex(pb, b.u, b.v), out.addVertex(pc, c.u, c.v));
58void emitQuad(HexMeshData& out, const SurfaceVertex& r0, const SurfaceVertex& r1, const SurfaceVertex& r2,
92void emitSegment(HexMeshData& out, const StripStation& from, const StripStation& to, const HexNoise& noise) {
Packed per-cell state records of the hex map.
Per-chunk mesh generation for every hex map surface.
CPU vertex/index container shared by the hex surface builders.
Pointy-top hex metrics, directions and vertex helpers.
Deterministic asset-free noise for hex perturbation and generation.
HexVec3 cellPosition(HexCoordinates coordinates) const noexcept
Cell centre including elevation and vertical perturbation.
Definition HexMap.cpp:170
const HexNoise & noise() const noexcept
Deterministic noise field shared by this map's mesh builders.
Definition HexMap.h:110
bool getNeighbor(HexCoordinates coordinates, HexDirection direction, HexCoordinates &out) const noexcept
Neighbour of coordinates in direction; false when it is off-grid.
Definition HexMap.cpp:87
const HexCellData * cell(HexCoordinates coordinates) const noexcept
Cell record, or null when outside the grid. @ownership Borrowed; the map owns the record....
Definition HexMap.cpp:79
HexVec3 cellGroundPosition(HexCoordinates coordinates) const noexcept
Cell centre at y = 0 (no elevation, no perturbation).
Definition HexMap.h:198
HexCoordinates chunkCell(std::int32_t chunkIndex, std::int32_t column, std::int32_t row) const noexcept
Coordinates of the cell at (column, row) inside a chunk.
Definition HexMap.cpp:115
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.
Definition HexMeshData.cpp:35
void clear() noexcept
Removes every vertex and index, keeping the allocated capacity.
Definition HexMeshData.cpp:7
static HexVec3 solidEdgeMiddle(HexDirection d) noexcept
Midpoint of the solid edge of direction.
Definition HexMetrics.h:206
static constexpr float kSolidFactor
Factor of the solid, uniform-colour hex inscribed in a cell.
Definition HexMetrics.h:130
Deterministic four-channel value noise over the XZ plane.
Definition HexNoise.h:23
std::vector< double > forward(const Policy &p, const Observation &o)
Forward.
Definition Learning.h:65
Definition HexCell.h:9
void buildRoadMesh(const HexMap &map, std::int32_t chunkIndex, HexMeshData &out)
Builds the road surface of one chunk.
Definition HexRoadMesh.cpp:102
One cell of the hex map: packed values plus packed flags.
Definition HexCell.h:244
Minimal 3-component float vector used by the hex mesh builders.
Definition HexMetrics.h:18