ralpha-assets/Plugins/RalphaPlugin/Source/RalphaCore/Public/RalphaParameterBridge.h

91 lines
3.2 KiB
C++

// Copyright Ralpha Team. All Rights Reserved.
#pragma once
#include "CoreMinimal.h"
#include "UObject/NoExportTypes.h"
#include "Dom/JsonObject.h"
#include "Dom/JsonValue.h"
#include "RalphaParameterBridge.generated.h"
class APostProcessVolume;
class ADirectionalLight;
class ASkyLight;
class AExponentialHeightFog;
class ACineCameraActor;
/**
* Bridge between MCP commands and UE5 rendering systems.
* Handles getting/setting parameters on post-process volumes, lights, fog, cameras, etc.
*/
UCLASS(BlueprintType)
class RALPHACORE_API URalphaParameterBridge : public UObject
{
GENERATED_BODY()
public:
URalphaParameterBridge();
// Get all current rendering parameters
TSharedPtr<FJsonObject> GetAllParameters();
// Post-Process Volume
bool SetPostProcessParameters(const TSharedPtr<FJsonObject>& Params);
TSharedPtr<FJsonObject> GetPostProcessParameters();
// Directional Light (Sun)
bool SetDirectionalLightParameters(const TSharedPtr<FJsonObject>& Params);
TSharedPtr<FJsonObject> GetDirectionalLightParameters();
// Sky Light
bool SetSkyLightParameters(const TSharedPtr<FJsonObject>& Params);
TSharedPtr<FJsonObject> GetSkyLightParameters();
// Exponential Height Fog
bool SetFogParameters(const TSharedPtr<FJsonObject>& Params);
TSharedPtr<FJsonObject> GetFogParameters();
// Camera
bool SetCameraParameters(const TSharedPtr<FJsonObject>& Params);
TSharedPtr<FJsonObject> GetCameraParameters();
// Render Quality
bool SetRenderQuality(const TSharedPtr<FJsonObject>& Settings);
// Asset Search
TArray<TSharedPtr<FJsonValue>> SearchAssets(const FString& Query, const FString& AssetType, int32 MaxResults);
TArray<TSharedPtr<FJsonValue>> ListAssets(const FString& FolderPath, const FString& AssetType, bool bRecursive);
// Actor Management
bool SpawnActor(const FString& AssetPath, const FVector& Location, const FRotator& Rotation, float Scale, const FString& ActorLabel, FString& OutActorId);
bool DeleteActor(const FString& ActorId);
TArray<TSharedPtr<FJsonValue>> ListActors(const FString& ClassFilter, const FString& NameFilter, bool bIncludeTransforms);
bool SetActorTransform(const FString& ActorId, const FVector* Location, const FRotator* Rotation, const float* Scale, bool bRelative);
TSharedPtr<FJsonObject> GetActorDetails(const FString& ActorId, bool bIncludeComponents, bool bIncludeMaterials);
bool SetActorMaterial(const FString& ActorId, const FString& MaterialPath, int32 MaterialIndex);
// Create a simple material with specified properties and apply to actor
bool SetActorSimpleMaterial(const FString& ActorId, const FLinearColor& BaseColor, float Metallic, float Roughness, float Opacity);
// Scene Setup - creates required actors for rendering control
TSharedPtr<FJsonObject> SetupScene();
private:
// Find actors of specific types in the world
APostProcessVolume* FindPostProcessVolume();
ADirectionalLight* FindDirectionalLight();
ASkyLight* FindSkyLight();
AExponentialHeightFog* FindExponentialHeightFog();
ACineCameraActor* FindCineCamera();
// Get the current world
UWorld* GetCurrentWorld();
// Parse hex color string to FLinearColor
FLinearColor ParseHexColor(const FString& HexColor);
FString ColorToHex(const FLinearColor& Color);
// Refresh BP_Sky_Sphere when sun position changes
void RefreshSkySphere();
};