载入中...
搜索中...
未找到
UrbanGenerator.h
浏览该文件的文档.
1#pragma once
2#include "common/Export.h"
3
4
6
7#include <cstdint>
8#include <random>
9#include <string>
10#include <vector>
11
12namespace eve::procgen::urban {
13
25public:
27 explicit UrbanGenerator(UrbanOptions opts);
28
30 bool generate(std::string* error = nullptr);
31
33 const UrbanLayout& layout() const { return layout_; }
34
35 struct GenState;
36
37private:
38 bool buildBoundaryStreets(GenState& st);
39 bool generateLevel(GenState& st, int level, std::string* error);
40 void splitAllParcels(GenState& st, std::vector<Polygon>& nextParcels);
41 bool splitOneParcel(const GenState& st, const Polygon& poly, Polygon& outA, Polygon& outB) const;
42 void removeShortEdges(GenState& st);
43 void generateStreets(GenState& st, int level);
44 void connectAccessToNetwork(GenState& st, const std::vector<int>& accessVertices,
45 const std::vector<char>* excludeTargets = nullptr);
46 void reconnectStreetEnds(GenState& st, int level);
47 void decomposeStreets(GenState& st);
48 void finalizeStats(GenState& st);
49
50 UrbanOptions opts_;
51 UrbanLayout layout_;
52 std::mt19937 rng_;
53};
54
55} // namespace eve::procgen::urban
#define EVENGINE_API_DOMAINS
Definition Export.h:110
int level
std::string error
Definition Package.cpp:60
Hierarchical co-generation of parcels and streets (paper Section 4) plus the global geometric optimiz...
const UrbanLayout & layout() const
Layout.
std::vector< Vec2 > Polygon
Closed polygon ring, stored CCW, without repeating the first point.
Definition UrbanTypes.h:55
Structured urban layout produced by the hierarchical co-generation (paper Section 4) plus the geometr...
Definition UrbanTypes.h:84
All user-facing controls for the urban generator. Defaults follow the paper (λ=0.3/0....
Definition UrbanTypes.h:117