Files
UnrealEngineUWP/Engine/Source/Editor/AdvancedPreviewScene/Public/AdvancedPreviewScene.h
ryan durand 627baf970a Updating copyright for Engine Editor.
#rnx
#rb none


#ROBOMERGE-SOURCE: CL 10869241 via CL 10869527 via CL 10869904
#ROBOMERGE-BOT: (v613-10869866)

[CL 10870586 by ryan durand in Main branch]
2019-12-26 15:33:43 -05:00

96 lines
3.4 KiB
C++

// Copyright Epic Games, Inc. All Rights Reserved.
/*=============================================================================
PrettyPreviewScene.h: Pretty preview scene definitions.
=============================================================================*/
#pragma once
#include "CoreMinimal.h"
#include "Stats/Stats.h"
#include "InputCoreTypes.h"
#include "PreviewScene.h"
#include "TickableEditorObject.h"
class FViewport;
class UAssetViewerSettings;
class UMaterialInstanceConstant;
class UPostProcessComponent;
class USkyLightComponent;
class UStaticMeshComponent;
class USphereReflectionCaptureComponent;
struct FPreviewSceneProfile;
class FUICommandList;
class ADVANCEDPREVIEWSCENE_API FAdvancedPreviewScene : public FPreviewScene, public FTickableEditorObject
{
public:
FAdvancedPreviewScene(ConstructionValues CVS, float InFloorOffset = 0.0f);
~FAdvancedPreviewScene();
void UpdateScene(FPreviewSceneProfile& Profile, bool bUpdateSkyLight = true, bool bUpdateEnvironment = true, bool bUpdatePostProcessing = true, bool bUpdateDirectionalLight = true);
/** Begin FPreviewScene */
virtual FLinearColor GetBackgroundColor() const override;
/** End FPreviewScene */
/* Begin FTickableEditorObject */
virtual void Tick(float DeltaTime) override;
virtual ETickableTickType GetTickableTickType() const override { return ETickableTickType::Always; }
virtual TStatId GetStatId() const override;
/* End FTickableEditorObject */
const bool HandleViewportInput(FViewport* InViewport, int32 ControllerId, FKey Key, float Delta, float DeltaTime, int32 NumSamples, bool bGamepad);
const bool HandleInputKey(FViewport* InViewport, int32 ControllerId, FKey Key, EInputEvent Event, float AmountDepressed, bool Gamepad);
void SetSkyRotation(const float SkyRotation);
/* Sets the visiblity state for the floor/environment by storing it in the scene profile and refreshing the scene, in case bDirect is true it sets the visibility directly and leaves the profile untouched. */
void SetFloorVisibility(const bool bVisible, const bool bDirect = false);
void SetEnvironmentVisibility(const bool bVisible, const bool bDirect = false);
void SetFloorOffset(const float InFloorOffset);
void SetProfileIndex(const int32 InProfileIndex);
const UStaticMeshComponent* GetFloorMeshComponent() const;
const float GetSkyRotation() const;
const int32 GetCurrentProfileIndex() const;
const bool IsUsingPostProcessing() const;
protected:
/** Bind our command bindings to handlers */
void BindCommands();
/** Toggle the sky sphere on and off */
void HandleToggleEnvironment();
/** Toggle the floor mesh on and off */
void HandleToggleFloor();
/** Toggle post processing on and off */
void HandleTogglePostProcessing();
/** Handle refreshing the scene when settings change */
void OnAssetViewerSettingsRefresh(const FName& InPropertyName);
protected:
UStaticMeshComponent* SkyComponent;
UMaterialInstanceConstant* InstancedSkyMaterial;
UPostProcessComponent* PostProcessComponent;
UStaticMeshComponent* FloorMeshComponent;
UAssetViewerSettings* DefaultSettings;
bool bRotateLighting;
float CurrentRotationSpeed;
float PreviousRotation;
bool bSkyChanged;
bool bPostProcessing;
int32 CurrentProfileIndex;
/** Command list for input handling */
TSharedPtr<FUICommandList> UICommandList;
/** Delegate handle used to refresh the scene when settings change */
FDelegateHandle RefreshDelegate;
};