RealtimeStyleTransferRuntime/Source/LyraGame/Camera/LyraCameraComponent.h

73 lines
2.1 KiB
C
Raw Permalink Normal View History

2022-05-23 18:41:30 +00:00
// Copyright Epic Games, Inc. All Rights Reserved.
#pragma once
#include "Camera/CameraComponent.h"
2022-09-13 07:18:28 +00:00
#include "Delegates/Delegate.h"
2022-05-23 18:41:30 +00:00
#include "GameFramework/Actor.h"
2022-09-13 07:18:28 +00:00
#include "UObject/UObjectGlobals.h"
2022-05-23 18:41:30 +00:00
2022-09-13 07:18:28 +00:00
#include "LyraCameraComponent.generated.h"
2022-05-23 18:41:30 +00:00
2022-09-13 07:18:28 +00:00
class UCanvas;
2022-05-23 18:41:30 +00:00
class ULyraCameraMode;
class ULyraCameraModeStack;
2022-09-13 07:18:28 +00:00
class UObject;
struct FFrame;
2022-05-23 18:41:30 +00:00
struct FGameplayTag;
2022-09-13 07:18:28 +00:00
struct FMinimalViewInfo;
template <class TClass> class TSubclassOf;
2022-05-23 18:41:30 +00:00
DECLARE_DELEGATE_RetVal(TSubclassOf<ULyraCameraMode>, FLyraCameraModeDelegate);
/**
* ULyraCameraComponent
*
* The base camera component class used by this project.
*/
UCLASS()
class ULyraCameraComponent : public UCameraComponent
{
GENERATED_BODY()
public:
ULyraCameraComponent(const FObjectInitializer& ObjectInitializer);
// Returns the camera component if one exists on the specified actor.
UFUNCTION(BlueprintPure, Category = "Lyra|Camera")
static ULyraCameraComponent* FindCameraComponent(const AActor* Actor) { return (Actor ? Actor->FindComponentByClass<ULyraCameraComponent>() : nullptr); }
// Returns the target actor that the camera is looking at.
virtual AActor* GetTargetActor() const { return GetOwner(); }
// Delegate used to query for the best camera mode.
FLyraCameraModeDelegate DetermineCameraModeDelegate;
// Add an offset to the field of view. The offset is only for one frame, it gets cleared once it is applied.
void AddFieldOfViewOffset(float FovOffset) { FieldOfViewOffset += FovOffset; }
virtual void DrawDebug(UCanvas* Canvas) const;
// Gets the tag associated with the top layer and the blend weight of it
void GetBlendInfo(float& OutWeightOfTopLayer, FGameplayTag& OutTagOfTopLayer) const;
protected:
virtual void OnRegister() override;
virtual void GetCameraView(float DeltaTime, FMinimalViewInfo& DesiredView) override;
virtual void UpdateCameraModes();
protected:
// Stack used to blend the camera modes.
UPROPERTY()
2022-09-13 07:18:28 +00:00
TObjectPtr<ULyraCameraModeStack> CameraModeStack;
2022-05-23 18:41:30 +00:00
// Offset applied to the field of view. The offset is only for one frame, it gets cleared once it is applied.
float FieldOfViewOffset;
};