Backend: - Add /api/v1/ue/* endpoints (compute-points, cables, landing-points, satellites, status) returning flat JSON optimised for UE5 C++ parsing UE5 client (ue_client/): - PlanetDataManager: HTTP fetch + local mock JSON loader, spawns ComputePointActors - ComputePointActor / InteractiveObjectBase: hover/select state, material switching - GlobeInteractionComponent: drag-to-rotate via CesiumGeoreference origin shift, inertia, zoom - StereoRenderingManager: runtime SbS/TbB stereo toggle, IPD control (format TBD) - MotionCaptureInterface: protocol-agnostic gesture/rotate/zoom delegate interface (impl TBD) - PlanetPlayerController: unified mouse + motion-capture input routing - PlanetGameMode, Build.cs, Config, mock data Docs: - ue5_mvp_fused_plan.md updated to v3.0 for LED display context - ue_client_setup_guide.md: step-by-step editor setup guide - ue_todo.md: pending items blocked on vendor answers (stereo format + mocap protocol) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
98 lines
3.5 KiB
C++
98 lines
3.5 KiB
C++
#pragma once
|
|
|
|
#include "CoreMinimal.h"
|
|
#include "GameFramework/Actor.h"
|
|
#include "Interfaces/IHttpRequest.h"
|
|
#include "PlanetDataTypes.h"
|
|
#include "PlanetDataManager.generated.h"
|
|
|
|
class AComputePointActor;
|
|
|
|
// Fired once all compute points have been spawned into the world
|
|
DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnComputePointsLoaded, int32, Count);
|
|
|
|
/**
|
|
* APlanetDataManager
|
|
*
|
|
* Place one of these in your level. On BeginPlay it fetches data from the
|
|
* Planet backend and spawns AComputePointActor instances at the correct
|
|
* Cesium globe positions.
|
|
*
|
|
* Phase A (local): Set bUseLocalMockData = true and point MockDataPath to
|
|
* Content/Data/mock_compute_points.json.
|
|
* Phase B (live): Set bUseLocalMockData = false and fill BackendBaseUrl.
|
|
*/
|
|
UCLASS(BlueprintType, Blueprintable)
|
|
class PLANETCLIENT_API APlanetDataManager : public AActor
|
|
{
|
|
GENERATED_BODY()
|
|
|
|
public:
|
|
APlanetDataManager();
|
|
|
|
// -----------------------------------------------------------------------
|
|
// Inspector-editable properties
|
|
// -----------------------------------------------------------------------
|
|
|
|
// Base URL of the Planet backend, e.g. "http://localhost:8000"
|
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Planet|Config")
|
|
FString BackendBaseUrl = TEXT("http://localhost:8000");
|
|
|
|
// When true, loads mock_compute_points.json from disk instead of the API.
|
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Planet|Config")
|
|
bool bUseLocalMockData = true;
|
|
|
|
// Absolute path to the mock JSON file (Phase A).
|
|
// Default points to <ProjectDir>/Content/Data/mock_compute_points.json
|
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Planet|Config",
|
|
meta=(EditCondition="bUseLocalMockData"))
|
|
FString MockDataPath;
|
|
|
|
// The Blueprint subclass of AComputePointActor to spawn.
|
|
// Set this in the Details Panel to your BP_ComputePointActor.
|
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Planet|Config")
|
|
TSubclassOf<AComputePointActor> ComputePointClass;
|
|
|
|
// Height above sea level (metres) at which to place data points.
|
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Planet|Config")
|
|
double PointAltitudeMeters = 50000.0;
|
|
|
|
// -----------------------------------------------------------------------
|
|
// Events
|
|
// -----------------------------------------------------------------------
|
|
UPROPERTY(BlueprintAssignable, Category="Planet|Events")
|
|
FOnComputePointsLoaded OnComputePointsLoaded;
|
|
|
|
// -----------------------------------------------------------------------
|
|
// Public API
|
|
// -----------------------------------------------------------------------
|
|
|
|
// Call this to re-fetch and rebuild all points.
|
|
UFUNCTION(BlueprintCallable, Category="Planet")
|
|
void FetchAllData();
|
|
|
|
UFUNCTION(BlueprintCallable, Category="Planet")
|
|
TArray<AComputePointActor*> GetAllComputePoints() const { return SpawnedPoints; }
|
|
|
|
protected:
|
|
virtual void BeginPlay() override;
|
|
|
|
private:
|
|
TArray<AComputePointActor*> SpawnedPoints;
|
|
|
|
// HTTP handlers
|
|
void FetchComputePoints();
|
|
void OnComputePointsResponse(FHttpRequestPtr Request,
|
|
FHttpResponsePtr Response,
|
|
bool bSuccess);
|
|
|
|
// Local mock data loader (Phase A)
|
|
void LoadMockComputePoints();
|
|
|
|
// Shared spawn logic
|
|
void SpawnComputePoints(const TArray<FComputePoint>& Points);
|
|
|
|
// JSON → FComputePoint array
|
|
static TArray<FComputePoint> ParseComputePointsJson(const FString& JsonStr);
|
|
};
|