载入中...
搜索中...
未找到
RoadTypes.h
浏览该文件的文档.
1#pragma once
2
3#include "common/Result.h"
4
5#include <cstdint>
6#include <string>
7#include <vector>
8
9namespace eve::procgen::road {
10
13 float x = 0.f;
14 float y = 0.f;
15 float z = 0.f;
16};
17
19struct RoadStyle {
20 float laneWidth = 3.5f;
21 float curbWidth = 0.45f;
22 float curbHeight = 0.55f;
23 float sidewalkWidth = 1.5f;
24 float sidewalkHeight = 0.14f;
25 float deckThickness = 0.70f;
26 float pierWidth = 1.35f;
27 float pierDepth = 1.35f;
28 float pierSpacing = 11.f;
29 float pierClearance = 1.5f;
30 float markingWidth = 0.22f;
31 float dashLength = 3.5f;
32 float dashGap = 3.f;
33 float uvMeters = 8.f;
34 float speedLimitMps = 13.8889f;
37 float sideObjectEndOffset = 0.f;
38 bool sideObjectsLeft = true;
39 bool sideObjectsRight = true;
40};
41
43enum class RoadJunctionControl : std::uint8_t {
44 Uncontrolled = 0,
45 Yield,
46 Stop,
47 Signal,
48};
49
51struct RoadNode {
52 std::uint32_t id = 0;
53 float x = 0.f;
54 float y = 0.f;
55 float z = 0.f;
56 float junctionRadius = 6.f;
58};
59
61struct RoadEdge {
62 std::uint32_t id = 0;
63 std::uint32_t from = 0;
64 std::uint32_t to = 0;
65 std::vector<RoadControlPoint> controlPoints;
66 int lanesForward = 2;
69};
70
73 std::uint32_t nodeId = 0;
74 std::uint32_t firstEdgeId = 0;
75 std::uint32_t secondEdgeId = 0;
76};
77
79enum class RoadLaneDirection : std::uint8_t {
80 Forward = 0,
81 Backward,
82};
83
98
101 std::vector<float> xyz;
102 float r = 0.2f, g = 0.85f, b = 1.f, a = 1.f;
103 float width = 0.08f;
104 bool closed = false;
105 std::uint32_t inEdge = 0;
106 std::uint32_t outEdge = 0;
107 int inLane = -1;
108 int outLane = -1;
111 float speedLimitMps = 0.f;
113};
114
117 std::vector<RoadPolyline> lanes;
118 std::vector<RoadPolyline> turns;
119};
120
122enum class RoadMaterial : std::uint8_t {
123 Asphalt = 0,
124 Curb,
125 Sidewalk,
126 Deck,
127 Pier,
128 Marking,
130 Nav,
131};
132
139
142 std::vector<RoadProfilePoint> points;
143 float halfWidth = 0.f;
144};
145
154[[nodiscard]] EVENGINE_API_DOMAINS Result<RoadProfile> makeRoadProfile(const RoadStyle& style, int lanesForward,
155 int lanesBackward);
156
162[[nodiscard]] EVENGINE_API_DOMAINS const char* roadMaterialGroup(RoadMaterial material) noexcept;
163
164} // namespace eve::procgen::road
#define EVENGINE_API_DOMAINS
Definition Export.h:110
Material * material
Move-only, checked operation results for the common layer.
Move-only operation result carrying either a value or Status.
Definition Result.h:155
Result< RoadProfile > makeRoadProfile(const RoadStyle &style, int lanesForward, int lanesBackward)
Build a mathematical road cross-section for the given lane counts.
RoadJunctionControl
Authoritative traffic-control policy applied to every approach of one junction node.
Definition RoadTypes.h:43
@ Signal
Every incoming approach is controlled by a traffic signal.
@ Stop
Every incoming approach receives a stop control.
@ Uncontrolled
Edge trafficPriority resolves right-of-way without a mandatory stop.
@ Yield
Lower-priority approaches yield; equal-priority approaches all yield.
const char * roadMaterialGroup(RoadMaterial material) noexcept
Map a material tag to the MeshBuild group name used by the baker. @ownership borrowed — returns a poi...
RoadLaneDirection
Travel direction of a lane relative to the authored edge centerline.
Definition RoadTypes.h:79
@ Forward
Travels from RoadEdge::from to RoadEdge::to.
@ Backward
Travels from RoadEdge::to to RoadEdge::from.
RoadMaterial
Profile material tags used when lofting a road cross-section.
Definition RoadTypes.h:122
One authored control point on a road centerline (world space, Y-up).
Definition RoadTypes.h:12
Stable identities produced by one atomic edge split.
Definition RoadTypes.h:72
std::uint32_t firstEdgeId
Original edge identity retained by the first half.
Definition RoadTypes.h:74
std::uint32_t secondEdgeId
Newly allocated continuation edge.
Definition RoadTypes.h:75
Directed centerline edge with optional reverse lanes.
Definition RoadTypes.h:61
std::vector< RoadControlPoint > controlPoints
Definition RoadTypes.h:65
One legal lane-to-lane connection inside a junction.
Definition RoadTypes.h:90
Junction node owned by a road network.
Definition RoadTypes.h:51
RoadJunctionControl junctionControl
Definition RoadTypes.h:57
Owning bake-time overlay snapshot (no pointers into the network).
Definition RoadTypes.h:116
std::vector< RoadPolyline > turns
Definition RoadTypes.h:118
std::vector< RoadPolyline > lanes
Definition RoadTypes.h:117
One renderer-neutral polyline chunk for navigation / marking overlays.
Definition RoadTypes.h:100
std::vector< float > xyz
Packed xyz samples.
Definition RoadTypes.h:101
RoadLaneDirection outDirection
Definition RoadTypes.h:110
RoadLaneDirection inDirection
Definition RoadTypes.h:109
One 2D profile sample in the edge local (side, up) plane.
Definition RoadTypes.h:134
Owning open profile polyline for one edge style and lane layout.
Definition RoadTypes.h:141
std::vector< RoadProfilePoint > points
Definition RoadTypes.h:142
Cross-section and structural style for one road edge.
Definition RoadTypes.h:19
bool sideObjectsRight
Emit anchors on the authored centerline's right side.
Definition RoadTypes.h:39
float sideObjectEndOffset
Empty distance after the last side-object anchor.
Definition RoadTypes.h:37
float speedLimitMps
Navigation speed limit in metres per second.
Definition RoadTypes.h:34
float uvMeters
World-space metres per texture repeat.
Definition RoadTypes.h:33
float curbWidth
Jersey-barrier thickness.
Definition RoadTypes.h:21
bool sideObjectsLeft
Emit anchors on the authored centerline's left side.
Definition RoadTypes.h:38
float curbHeight
Raised barrier height (readable asphalt channel).
Definition RoadTypes.h:22
float sideObjectStartOffset
Empty distance before the first side-object anchor.
Definition RoadTypes.h:36
int trafficPriority
Higher incoming-road values win uncontrolled junction priority.
Definition RoadTypes.h:35