载入中...
搜索中...
未找到
RoadBakeFacilityLinks.cpp
浏览该文件的文档.
18 if (a.assetId != b.assetId || std::fabs(a.length - b.length) > 1e-4f || a.vertices.size() != b.vertices.size() ||
24 const float av[]{x.x, x.y, x.z, x.nx, x.ny, x.nz, x.u, x.v}, bv[]{y.x, y.y, y.z, y.nx, y.ny, y.nz, y.u, y.v};
31 if (x.a != y.a || x.b != y.b || x.c != y.c || x.material != y.material || x.smoothingGroup != y.smoothingGroup)
38 if (a.prefab.vertices.empty() != b.prefab.vertices.empty() || a.prefab.assetId != b.prefab.assetId) return false;
39 const float firstSign = first.to == nodeId ? 1.f : -1.f, secondSign = second.from == nodeId ? 1.f : -1.f;
45 (!x.averageSpacing && x.reverseRepeatSequence != y.reverseRepeatSequence) || !samePrefabMesh(x, y) ||
50 std::fabs(a.verticalOffset - b.verticalOffset) > 1e-4f || std::fabs(a.uvMeters - b.uvMeters) > 1e-4f ||
58 std::fabs(profileA[i].up - profileB[i].up) > 1e-4f || profileA[i].material != profileB[i].material)
64 if ((edge.from == nodeId && facility.start > 1e-5f) || (edge.to == nodeId && facility.end < 1.f - 1e-5f))
94 if ((other->from == nodeId && candidate.start > 1e-5f) || (other->to == nodeId && candidate.end < 1.f - 1e-5f))
101V3 shifted(const SplineFrameSample& frame, const RoadEdge& edge, const RoadContinuousFacility& facility) {
102 const float lateral = scaledProfileSide(facility.lateralOffset, asphaltHalfWidth(edge), frame.sample.scaleX);
103 return V3{frame.sample.x, frame.sample.y, frame.sample.z} + V3{frame.sideX, frame.sideY, frame.sideZ} * lateral +
109 return bakeFail<void>(DiagnosticCode::InvalidArgument, "too many facility routes", "facilityRoutes");
137Result<void> bakeFacilityContinuations(MeshBuild& mesh, const RoadNetwork& network, const RoadBakeOptions& options,
154 const float secondDistance = junctionSocketDistance(network, node, *other->edge, secondLength.value());
158 other->edge->from == node.id ? secondDistance : secondLength.value() - secondDistance, "clamp", 24);
172 const V3 f1 = V3{b.forwardX, b.forwardY, b.forwardZ} * (other->edge->from == node.id ? 1.f : -1.f);
177 const V3 position = p0 * (u * u * u) + control0 * (3.f * u * u * t) + control1 * (3.f * u * t * t) +
179 const V3 forward = normalize((control0 - p0) * (u * u) + (control1 - control0) * (2.f * u * t) +
234 auto loft = loftProfileClean(mesh, frames, profile, span, facility.uvMeters, RoadMaterial::Curb,
static Result failure(Status status)
Construct a failed result from a structured status.
Definition Result.h:196
CPU triangle mesh from procedural mesh recipes (e.g. marching cubes). Positions/normals are xyz-packe...
Definition MeshBuild.h:20
Owning directed road graph with lane connectivity.
Definition RoadNetwork.h:19
Result< void > bakeFacilityPrefab(MeshBuild &mesh, const RoadFacilityPrefab &prefab, const std::vector< SplineFrameSample > &frames, float sourceLow, float sourceHigh, float fullSourceLength, std::size_t budget)
Clip source triangles into frame slabs and deform their positions and inverse-transpose normals.
Definition RoadFacilityPrefab.cpp:93
float asphaltHalfWidth(const RoadEdge &edge)
Module-private road bake implementation helper.
Definition RoadBake.cpp:100
float scaledProfileSide(float side, float asphaltHalf, float scale)
Module-private transverse width transform preserving fixed-width shoulders.
Definition RoadBake.cpp:114
void reverseFacilityPrefab(RoadFacilityPrefab &prefab)
Reflect an owned prefab into reverse traversal coordinates, including its segment sequence/window.
Definition RoadAuthoring.cpp:193
Result< void > bakeFacilityContinuations(MeshBuild &mesh, const RoadNetwork &network, const RoadBakeOptions &options, const std::unordered_set< std::uint32_t > &activeNodes)
Fill compatible continuous-facility gaps across active degree-two junction sockets.
Definition RoadBakeFacilityLinks.cpp:137
void reverseSectionGeometry(std::vector< RoadProfilePoint > §ion, bool closed)
Reflect an owning section and preserve outgoing segment semantics.
Definition RoadAuthoring.cpp:65
Result< SplinePath > edgeToSpline(const RoadEdge &edge)
Module-private road bake implementation helper.
Definition RoadBake.cpp:62
void blendFrameToJunctionPlane(SplineFrameSample &frame, const JunctionPlane &plane, float weight)
Module-private road bake implementation helper.
Definition RoadBake.cpp:298
float junctionSocketDistance(const RoadNetwork &network, const RoadNode &node, const RoadEdge &edge, float pathLength)
Module-private road bake implementation helper.
Definition RoadBake.cpp:146
Result< void > validateFacilityRoutes(const RoadNetwork &network, const RoadNode &node)
Validate explicit one-to-one routes, compatible sections and live incident endpoint ownership.
Definition RoadBakeFacilityLinks.cpp:107
JunctionPlane fitJunctionPlane(const RoadNetwork &network, const RoadNode &node)
Module-private road bake implementation helper.
Definition RoadBake.cpp:197
Result< void > loftProfileClean(MeshBuild &mesh, const std::vector< SplineFrameSample > &frames, const RoadProfile &profile, float pathLength, float uvMeters, RoadMaterial asphaltMaterial, std::size_t budget, int subdivisions=1)
Module-private road bake implementation helper.
Definition RoadBakeProfiles.cpp:18
bool isFacilityContinued(const RoadNetwork &network, std::uint32_t nodeId, const RoadEdge &edge, const RoadContinuousFacility &facility)
Query compatible degree-two facility continuation; no retained peer pointer.
Definition RoadBakeFacilityLinks.cpp:133
@ InvalidArgument
@ PreconditionViolation
Owning section frame; sample position includes roll-pivot displacement, unlike the author centerline ...
Definition SplinePath.h:63
Options for baking a road network into mesh + navigation overlays.
Definition RoadBake.h:50
Continuous facility over an authored edge interval; all profiles and prefab meshes are owned values.
Definition RoadTypes.h:112
Directed centerline edge with optional reverse lanes.
Definition RoadTypes.h:286
Owning open profile polyline for one edge style and lane layout.
Definition RoadTypes.h:347
std::vector< RoadProfilePoint > points
Definition RoadTypes.h:348