#pragma once #include "CoreMinimal.h" class UDescentTerrainSubsystem; namespace Descent::World { /** One waypoint of a carrier route (DESIGN_UE.md section 2.10). */ struct FRouteWaypoint { FVector P = FVector::ZeroVector; double Speed = 1.0; bool bHasYaw = false; double YawDeg = 0.0; // Unreal yaw: 0 = +X, positive toward +Y bool bHold = false; FString Tag; }; /** The carrier's pose at one step of a route sweep. */ struct FRoutePose { FVector P = FVector::ZeroVector; double YawRad = 0.0; double PitchRad = 0.0; // positive = nose up }; /** A choke on a route: where it is, and how far from it a pose still counts as "at the choke". */ struct FRouteChoke { FName Id; FVector P = FVector::ZeroVector; double Reach = 60.0; }; /** * The three carrier routes to the goal and the carrier's hull sample points (section 2.10, port of 06_routes.js). * Used by the CarrierFit test and by `Descent.World.ClearRoute`, which does what the player does with a Tender. */ struct THEDESCENT_API FDescentRoutes { static constexpr int32 NumRoutes = 3; static const TArray& Waypoints(int32 Route); static FString RouteName(int32 Route); /** The chokes the route has to dig through. */ static TArray Chokes(int32 Route); /** Poses every Step metres along the route (the carrier turns in place at same-position waypoints). */ static TArray Poses(int32 Route, double Step = 5.0); /** Hull radius at carrier-local X (section 3.3). */ static double HullRadius(double X); /** Carrier-local sample points that must stay out of rock (v2 HULL_PTS, converted to +X bow, +Y starboard). */ static const TArray& HullPoints(); /** The larger set (hull + 1.6 m) that ClearRoute sweeps. */ static const TArray& SweepPoints(); static FVector LocalToWorld(const FRoutePose& Pose, const FVector& Local); /** Smallest clearance (metres, = -density, so positive = in water) of the hull points over the given poses. */ static double MinClearance(UDescentTerrainSubsystem& Terrain, TConstArrayView Poses, FVector* OutWhere = nullptr); /** Carves the swept volume along a route; returns the number of carve calls. */ static int32 ClearRoute(UDescentTerrainSubsystem& Terrain, int32 Route); }; }