Files
planet/ue_client/Source/PlanetClient/InteractiveObjectBase.h
linkong 1e6f4b338b feat: add UE5 LED display client — backend API, C++ source, stereo framework
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>
2026-04-14 18:39:05 +08:00

94 lines
3.5 KiB
C++
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#pragma once
#include "CoreMinimal.h"
#include "GameFramework/Actor.h"
#include "InteractiveObjectBase.generated.h"
UENUM(BlueprintType)
enum class EInteractiveObjectState : uint8
{
Normal UMETA(DisplayName="正常"),
Hovered UMETA(DisplayName="悬停高亮"),
Selected UMETA(DisplayName="已选中"),
Disabled UMETA(DisplayName="不可交互"),
};
DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnObjectStateChanged,
EInteractiveObjectState, NewState);
/**
* AInteractiveObjectBase
*
* 所有可交互 3D 物件的基类。
* 当前场景中的可交互物件包括:
* - AComputePointActor超算数据点—— 已实现
* - 其他演示物件TODO: 根据需求添加子类)
*
* 子类需要:
* 1. 重写 OnHovered / OnSelected / OnDeselected或响应 OnStateChanged 委托)
* 2. 将根 Component 设置为可被射线检测SetCollisionResponseToChannel
* 3. 可选:重写 GetInfoTitle / GetInfoBody 供信息卡使用
*/
UCLASS(Abstract, BlueprintType, Blueprintable)
class PLANETCLIENT_API AInteractiveObjectBase : public AActor
{
GENERATED_BODY()
public:
AInteractiveObjectBase();
// -----------------------------------------------------------------------
// 状态变更委托
// -----------------------------------------------------------------------
UPROPERTY(BlueprintAssignable, Category="Planet|Interactive")
FOnObjectStateChanged OnStateChanged;
// -----------------------------------------------------------------------
// 状态 API由 PlanetPlayerController 调用)
// -----------------------------------------------------------------------
UFUNCTION(BlueprintCallable, Category="Planet|Interactive")
void SetInteractiveState(EInteractiveObjectState NewState);
UFUNCTION(BlueprintPure, Category="Planet|Interactive")
EInteractiveObjectState GetInteractiveState() const { return CurrentState; }
UFUNCTION(BlueprintPure, Category="Planet|Interactive")
bool IsSelected() const { return CurrentState == EInteractiveObjectState::Selected; }
UFUNCTION(BlueprintPure, Category="Planet|Interactive")
bool IsHovered() const { return CurrentState == EInteractiveObjectState::Hovered; }
// -----------------------------------------------------------------------
// 信息卡内容(子类可重写提供具体文本)
// -----------------------------------------------------------------------
// 信息卡标题,默认返回 Actor 名
UFUNCTION(BlueprintNativeEvent, BlueprintPure, Category="Planet|Interactive")
FText GetInfoTitle() const;
// 信息卡正文,返回富文本格式的详情
UFUNCTION(BlueprintNativeEvent, BlueprintPure, Category="Planet|Interactive")
FText GetInfoBody() const;
// 信息卡图标(可选,返回空则不显示图标)
UFUNCTION(BlueprintNativeEvent, BlueprintPure, Category="Planet|Interactive")
UTexture2D* GetInfoIcon() const;
protected:
// 子类重写这三个函数来处理视觉状态变化
UFUNCTION(BlueprintNativeEvent, Category="Planet|Interactive")
void OnHovered();
UFUNCTION(BlueprintNativeEvent, Category="Planet|Interactive")
void OnSelected();
UFUNCTION(BlueprintNativeEvent, Category="Planet|Interactive")
void OnDeselected();
UFUNCTION(BlueprintNativeEvent, Category="Planet|Interactive")
void OnRestored(); // 从任何状态回到 Normal
private:
EInteractiveObjectState CurrentState = EInteractiveObjectState::Normal;
};