LuckyWorldV2/Source/LuckyWorldV2/Public/LRRenderUtilLibrary.h
Filip Iliescu 5cc5b232cb Clean up and document code
2025-04-29 16:00:18 -07:00

58 lines
2.0 KiB
C++

// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "Kismet/BlueprintFunctionLibrary.h"
#include "LRRenderUtilLibrary.generated.h"
class USceneCaptureComponent2D;
class UTextureRenderTarget2D;
class UStaticMeshComponent;
/**
* Utility library for capturing and rendering objects in the Lucky Robots system
*/
UCLASS(BlueprintType, Blueprintable)
class LUCKYWORLDV2_API ULRRenderUtilLibrary : public UBlueprintFunctionLibrary
{
GENERATED_BODY()
public:
/**
* Captures a static mesh component to a render target texture
* @param MeshComp The static mesh component to capture
* @param ImageSize The size of the output image
* @param WorldContextObject The world context
* @param CaptureSource The type of data to capture (default is BaseColor)
* @return The rendered texture
*/
UFUNCTION(BlueprintCallable, Category = "Lucky Robots|Render Utilities")
static UTextureRenderTarget2D* CaptureMeshToRenderTarget(
UStaticMeshComponent* MeshComp,
const FVector2D& ImageSize,
UObject* WorldContextObject,
TEnumAsByte<enum ESceneCaptureSource> CaptureSource = ESceneCaptureSource::SCS_BaseColor);
/**
* Sets up a scene capture component to focus on a specific mesh
* @param SceneCapture The scene capture component to set up
* @param MeshComp The static mesh component to focus on
* @param CaptureSource The type of data to capture (default is BaseColor)
*/
UFUNCTION(BlueprintCallable, Category = "Lucky Robots|Render Utilities")
static void SetupSceneCaptureForMesh(
USceneCaptureComponent2D* SceneCapture,
UStaticMeshComponent* MeshComp,
TEnumAsByte<enum ESceneCaptureSource> CaptureSource = ESceneCaptureSource::SCS_BaseColor);
/**
* Captures the current view of a scene capture component to its render target
* @param SceneCapture The scene capture component to trigger
* @return Success status
*/
UFUNCTION(BlueprintCallable, Category = "Lucky Robots|Render Utilities")
static bool CaptureSceneNow(USceneCaptureComponent2D* SceneCapture);
};