Files
UnrealEngineUWP/Engine/Source/Editor/AdvancedPreviewScene/Public/AdvancedPreviewScene.h
sebastien hillaire 6a76d6f66c Fixed sky diffuse being invisible in project with movable skylight and r.SupportStationarySkylight is false.
Behavior was changed in 4691984.

SupportStationarySkylight should not be used to conditionally create a sky or not. Sky is always used for default environment diffuse (just can be rendered in non base pass but environment pass depending on whether lighting/sky is static/stationary of movable).
A SphereReflectionCapture is not enough to get diffuse light (it can only be used for specular). Which is what we see in this JIRA bug.

Fix is to always create the sky and just make it visible or not (the new behavior added in 4691984 and that is correct)

#rb Jurre.deBaare

#ROBOMERGE-OWNER: ben.marsh
#ROBOMERGE-AUTHOR: sebastien.hillaire
#ROBOMERGE-SOURCE: CL 5683666 via CL 5683884 via CL 5683886
#ROBOMERGE-BOT: BUILD (Main -> Dev-Build)

[CL 5684785 by sebastien hillaire in Dev-Build branch]
2019-04-02 09:03:26 -04:00

96 lines
3.4 KiB
C++

// Copyright 1998-2019 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;
};