You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
========================== MAJOR FEATURES + CHANGES ========================== Change 2835191 on 2016/01/19 by Nick.Whiting Invert the y-axis on the SteamVR controllers to match the convention of the engine and the rest of the gamepads #jira UE-22705 Change 2835686 on 2016/01/20 by Gareth.Martin Fixed landscape material instances not being updated if holes are painted on a landscape that doesn't have the landscape visibility mask node in the material and then the visibility mask node is added to the material later. #jira UE-18187 Change 2835767 on 2016/01/20 by Richard.Hinckley #jira UE-25499 Added a cursor to TopDown template (C++ version) to match the BP version. Change 2835772 on 2016/01/20 by Richard.Hinckley #jira UE-25499 Adding the material asset for the C++ TopDown template's cursor. Change 2835811 on 2016/01/20 by Taizyd.Korambayil #jira UE-25699 Added Validity Checks in BP logic, unchecked CDO for Pixel Ship, to Fix Log Warnings #jira UE-25704 Adjusted Matinee to happen at Box Location #jira UE-25688 Adjusted Player Starts #jira UE-25693 Adjusted Player Starts Change 2835863 on 2016/01/20 by Gareth.Martin Fixed crash in the landscape ramp and mirror tools if the streaming level containing the landscape is hidden (or possibly if the landscape actor is deleted) #jira UE-24883 Change 2835889 on 2016/01/20 by Taizyd.Korambayil #jira UE-25698 Enabled V-sync, also fixed up player Respawn Issue Change 2835995 on 2016/01/20 by Jamie.Dale The output log now hard-wraps lines to prevent long lines causing performance issues #jira UE-24187 Change 2836052 on 2016/01/20 by Taizyd.Korambayil #jira UE-25675 Added Blocking Volume to prevent Player from Falling off map #jira UE-25676 Added Blocking Volumes so that the Player doesn't get stucl at awkward corners under the Bridge Change 2836137 on 2016/01/20 by Chad.Taylor Vehicle and VehicleAdv template content fixes for new VR camera #jira UE-25507 Change 2836166 on 2016/01/20 by Gareth.Martin Fixed hiding a streaming level containing a landscape causing the landscape editor to switch to the "New Landscape" tool instead of exiting #jira UE-25093 Change 2836174 on 2016/01/20 by Chad.Taylor IHeadMountedDisplay crash fix associated with accessing a dangling pointer. #jira UE-25272 Change 2836179 on 2016/01/20 by Jamie.Dale Optimized FShapedGlyphSequence reverse look-up There's now a reverse look-up map of cluster indices to their glyph data in order to avoid brute force looping #jira UE-24187 Change 2836286 on 2016/01/20 by Chris.Babcock Update Qualcomm TextureConverter for OSX #jira UE-22092 #ue4 #android Change 2836328 on 2016/01/20 by Nick.Darnell Fixing a problem with widget components crashing on destruction with the render commands to pre/post render for window render commands needing access to the policy, but it potentially being deleted. Inserting a NoOp command that keeps the shared ptr alive through the RHI render process. #jira UE-25752 Change 2836342 on 2016/01/20 by Nick.Darnell Depending on shutdown order, the Slate Renderer may go away, and then render data handles may not be collected correctly because they are trying to reference a pointer that's no longer valid and cause a crash on exit. The correct approach would be to have render handles actually have a pointer back to who owns them, in this case the RHI Resource Manager, which is still alive and well at this point in the pipeline. Then if the resource manager is collected, it forces all handles to get cleaned up correctly, or if the handles are collected first, they can be sure they've got a valid pointer back to the resource manager. #jira UE-25753 Change 2836358 on 2016/01/20 by Taizyd.Korambayil #jira UE-25710 Replaced Deprecated Nodes Change 2836510 on 2016/01/20 by Taizyd.Korambayil #jira UE-25718 Adjsuted BP to make pointer decal rotate in the direction of surface Change 2836564 on 2016/01/20 by Taizyd.Korambayil #jira UE-25716 Added bool to store last Moved Direction Change 2836697 on 2016/01/20 by Taizyd.Korambayil #jira UE-25740 Removed unused VR Nodes to remove Log errors on Mac Change 2836725 on 2016/01/20 by Peter.Sauerbrei workaround for thread race when trying to release the TargetDeviceService endpoint after an unclaim message is sent #jira UE-25123 Change 2836782 on 2016/01/20 by Jamie.Dale Added FTextLayout::AddLines This is similar to AddLine, however it allows you to add multiple lines in a single call, thus avoiding the re-justification cost associated with each call to AddLine. AddLine has also been changed to take the same structure type as AddLines (which takes an array of these structures), and the existing version of AddLine has been deprecated. #jira UE-24187 Change 2836801 on 2016/01/20 by Jeff.Campeau [CL 2857187 by Matthew Griffin in Main branch]
401 lines
13 KiB
C++
401 lines
13 KiB
C++
// Copyright 1998-2016 Epic Games, Inc. All Rights Reserved.
|
|
|
|
/*=============================================================================
|
|
SceneCore.cpp: Core scene implementation.
|
|
=============================================================================*/
|
|
|
|
#include "RendererPrivate.h"
|
|
#include "ScenePrivate.h"
|
|
#include "AllocatorFixedSizeFreeList.h"
|
|
|
|
/**
|
|
* Fixed Size pool allocator for FLightPrimitiveInteractions
|
|
*/
|
|
#define FREE_LIST_GROW_SIZE ( 16384 / sizeof(FLightPrimitiveInteraction) )
|
|
TAllocatorFixedSizeFreeList<sizeof(FLightPrimitiveInteraction), FREE_LIST_GROW_SIZE> GLightPrimitiveInteractionAllocator;
|
|
|
|
uint32 FRendererModule::GetNumDynamicLightsAffectingPrimitive(const FPrimitiveSceneInfo* PrimitiveSceneInfo,const FLightCacheInterface* LCI)
|
|
{
|
|
uint32 NumDynamicLights = 0;
|
|
|
|
FLightPrimitiveInteraction *LightList = PrimitiveSceneInfo->LightList;
|
|
while ( LightList )
|
|
{
|
|
const FLightSceneInfo* LightSceneInfo = LightList->GetLight();
|
|
|
|
// Determine the interaction type between the mesh and the light.
|
|
FLightInteraction LightInteraction = FLightInteraction::Dynamic();
|
|
if(LCI)
|
|
{
|
|
LightInteraction = LCI->GetInteraction(LightSceneInfo->Proxy);
|
|
}
|
|
|
|
// Don't count light-mapped or irrelevant lights.
|
|
if(LightInteraction.GetType() != LIT_CachedIrrelevant && LightInteraction.GetType() != LIT_CachedLightMap)
|
|
{
|
|
++NumDynamicLights;
|
|
}
|
|
|
|
LightList = LightList->GetNextLight();
|
|
}
|
|
|
|
return NumDynamicLights;
|
|
}
|
|
|
|
/*-----------------------------------------------------------------------------
|
|
FLightPrimitiveInteraction
|
|
-----------------------------------------------------------------------------*/
|
|
|
|
/**
|
|
* Custom new
|
|
*/
|
|
void* FLightPrimitiveInteraction::operator new(size_t Size)
|
|
{
|
|
// doesn't support derived classes with a different size
|
|
checkSlow(Size == sizeof(FLightPrimitiveInteraction));
|
|
return GLightPrimitiveInteractionAllocator.Allocate();
|
|
//return FMemory::Malloc(Size);
|
|
}
|
|
|
|
/**
|
|
* Custom delete
|
|
*/
|
|
void FLightPrimitiveInteraction::operator delete(void *RawMemory)
|
|
{
|
|
GLightPrimitiveInteractionAllocator.Free(RawMemory);
|
|
//FMemory::Free(RawMemory);
|
|
}
|
|
|
|
/**
|
|
* Initialize the memory pool with a default size from the ini file.
|
|
* Called at render thread startup. Since the render thread is potentially
|
|
* created/destroyed multiple times, must make sure we only do it once.
|
|
*/
|
|
void FLightPrimitiveInteraction::InitializeMemoryPool()
|
|
{
|
|
static bool bAlreadyInitialized = false;
|
|
if (!bAlreadyInitialized)
|
|
{
|
|
bAlreadyInitialized = true;
|
|
int32 InitialBlockSize = 0;
|
|
GConfig->GetInt(TEXT("MemoryPools"), TEXT("FLightPrimitiveInteractionInitialBlockSize"), InitialBlockSize, GEngineIni);
|
|
GLightPrimitiveInteractionAllocator.Grow(InitialBlockSize);
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Returns current size of memory pool
|
|
*/
|
|
uint32 FLightPrimitiveInteraction::GetMemoryPoolSize()
|
|
{
|
|
return GLightPrimitiveInteractionAllocator.GetAllocatedSize();
|
|
}
|
|
|
|
void FLightPrimitiveInteraction::Create(FLightSceneInfo* LightSceneInfo,FPrimitiveSceneInfo* PrimitiveSceneInfo)
|
|
{
|
|
// Attach the light to the primitive's static meshes.
|
|
bool bDynamic = true;
|
|
bool bRelevant = false;
|
|
bool bLightMapped = true;
|
|
bool bShadowMapped = false;
|
|
|
|
// Determine the light's relevance to the primitive.
|
|
check(PrimitiveSceneInfo->Proxy && LightSceneInfo->Proxy);
|
|
PrimitiveSceneInfo->Proxy->GetLightRelevance(LightSceneInfo->Proxy, bDynamic, bRelevant, bLightMapped, bShadowMapped);
|
|
|
|
if (bRelevant && bDynamic
|
|
// Don't let lights with static shadowing or static lighting affect primitives that should use static lighting, but don't have valid settings (lightmap res 0, etc)
|
|
// This prevents those components with invalid lightmap settings from causing lighting to remain unbuilt after a build
|
|
&& !(LightSceneInfo->Proxy->HasStaticShadowing() && PrimitiveSceneInfo->Proxy->HasStaticLighting() && !PrimitiveSceneInfo->Proxy->HasValidSettingsForStaticLighting()))
|
|
{
|
|
const bool bTranslucentObjectShadow = LightSceneInfo->Proxy->CastsTranslucentShadows() && PrimitiveSceneInfo->Proxy->CastsVolumetricTranslucentShadow();
|
|
const bool bInsetObjectShadow =
|
|
// Currently only supporting inset shadows on directional lights, but could be made to work with any whole scene shadows
|
|
LightSceneInfo->Proxy->GetLightType() == LightType_Directional
|
|
&& PrimitiveSceneInfo->Proxy->CastsInsetShadow();
|
|
|
|
// Movable directional lights determine shadow relevance dynamically based on the view and CSM settings. Interactions are only required for per-object cases.
|
|
if (LightSceneInfo->Proxy->GetLightType() != LightType_Directional || LightSceneInfo->Proxy->HasStaticShadowing() || bTranslucentObjectShadow || bInsetObjectShadow)
|
|
{
|
|
// Create the light interaction.
|
|
FLightPrimitiveInteraction* Interaction = new FLightPrimitiveInteraction(LightSceneInfo, PrimitiveSceneInfo, bDynamic, bLightMapped, bShadowMapped, bTranslucentObjectShadow, bInsetObjectShadow);
|
|
}
|
|
}
|
|
}
|
|
|
|
void FLightPrimitiveInteraction::Destroy(FLightPrimitiveInteraction* LightPrimitiveInteraction)
|
|
{
|
|
delete LightPrimitiveInteraction;
|
|
}
|
|
|
|
FLightPrimitiveInteraction::FLightPrimitiveInteraction(
|
|
FLightSceneInfo* InLightSceneInfo,
|
|
FPrimitiveSceneInfo* InPrimitiveSceneInfo,
|
|
bool bInIsDynamic,
|
|
bool bInLightMapped,
|
|
bool bInIsShadowMapped,
|
|
bool bInHasTranslucentObjectShadow,
|
|
bool bInHasInsetObjectShadow
|
|
) :
|
|
LightSceneInfo(InLightSceneInfo),
|
|
PrimitiveSceneInfo(InPrimitiveSceneInfo),
|
|
LightId(InLightSceneInfo->Id),
|
|
bLightMapped(bInLightMapped),
|
|
bIsDynamic(bInIsDynamic),
|
|
bIsShadowMapped(bInIsShadowMapped),
|
|
bUncachedStaticLighting(false),
|
|
bHasTranslucentObjectShadow(bInHasTranslucentObjectShadow),
|
|
bHasInsetObjectShadow(bInHasInsetObjectShadow),
|
|
bSelfShadowOnly(false),
|
|
bES2DynamicPointLight(false)
|
|
{
|
|
// Determine whether this light-primitive interaction produces a shadow.
|
|
if(PrimitiveSceneInfo->Proxy->HasStaticLighting())
|
|
{
|
|
const bool bHasStaticShadow =
|
|
LightSceneInfo->Proxy->HasStaticShadowing() &&
|
|
LightSceneInfo->Proxy->CastsStaticShadow() &&
|
|
PrimitiveSceneInfo->Proxy->CastsStaticShadow();
|
|
const bool bHasDynamicShadow =
|
|
!LightSceneInfo->Proxy->HasStaticLighting() &&
|
|
LightSceneInfo->Proxy->CastsDynamicShadow() &&
|
|
PrimitiveSceneInfo->Proxy->CastsDynamicShadow();
|
|
bCastShadow = bHasStaticShadow || bHasDynamicShadow;
|
|
}
|
|
else
|
|
{
|
|
bCastShadow = LightSceneInfo->Proxy->CastsDynamicShadow() && PrimitiveSceneInfo->Proxy->CastsDynamicShadow();
|
|
}
|
|
|
|
#if !(UE_BUILD_SHIPPING || UE_BUILD_TEST)
|
|
if(bCastShadow && bIsDynamic)
|
|
{
|
|
// Determine the type of dynamic shadow produced by this light.
|
|
if (PrimitiveSceneInfo->Proxy->HasStaticLighting()
|
|
&& PrimitiveSceneInfo->Proxy->CastsStaticShadow()
|
|
// Don't mark unbuilt for movable primitives which were built with lightmaps but moved into a new light's influence
|
|
&& !PrimitiveSceneInfo->Proxy->LightAsIfStatic()
|
|
&& (LightSceneInfo->Proxy->HasStaticLighting() || (LightSceneInfo->Proxy->HasStaticShadowing() && !bInIsShadowMapped)))
|
|
{
|
|
// Update the game thread's counter of number of uncached static lighting interactions.
|
|
bUncachedStaticLighting = true;
|
|
LightSceneInfo->NumUnbuiltInteractions++;
|
|
|
|
FPlatformAtomics::InterlockedIncrement(&PrimitiveSceneInfo->Scene->NumUncachedStaticLightingInteractions);
|
|
|
|
#if WITH_EDITOR
|
|
PrimitiveSceneInfo->Proxy->NumUncachedStaticLightingInteractions++;
|
|
#endif
|
|
}
|
|
}
|
|
#endif
|
|
|
|
bSelfShadowOnly = PrimitiveSceneInfo->Proxy->CastsSelfShadowOnly();
|
|
|
|
if (bIsDynamic)
|
|
{
|
|
// Add the interaction to the light's interaction list.
|
|
PrevPrimitiveLink = &LightSceneInfo->DynamicPrimitiveList;
|
|
|
|
// ES2 dynamic point lights
|
|
if (PrimitiveSceneInfo->Scene->GetFeatureLevel() < ERHIFeatureLevel::SM4 && LightSceneInfo->Proxy->GetLightType() == LightType_Point && LightSceneInfo->Proxy->IsMovable())
|
|
{
|
|
bES2DynamicPointLight = true;
|
|
PrimitiveSceneInfo->NumES2DynamicPointLights++;
|
|
// The forward renderer renders dynamic point lights as part of the base pass using the dynamic path only.
|
|
PrimitiveSceneInfo->Proxy->bDisableStaticPath = true;
|
|
}
|
|
}
|
|
|
|
NextPrimitive = *PrevPrimitiveLink;
|
|
if(*PrevPrimitiveLink)
|
|
{
|
|
(*PrevPrimitiveLink)->PrevPrimitiveLink = &NextPrimitive;
|
|
}
|
|
*PrevPrimitiveLink = this;
|
|
|
|
// Add the interaction to the primitive's interaction list.
|
|
PrevLightLink = &PrimitiveSceneInfo->LightList;
|
|
NextLight = *PrevLightLink;
|
|
if(*PrevLightLink)
|
|
{
|
|
(*PrevLightLink)->PrevLightLink = &NextLight;
|
|
}
|
|
*PrevLightLink = this;
|
|
}
|
|
|
|
FLightPrimitiveInteraction::~FLightPrimitiveInteraction()
|
|
{
|
|
check(IsInRenderingThread());
|
|
|
|
#if !(UE_BUILD_SHIPPING || UE_BUILD_TEST)
|
|
// Update the game thread's counter of number of uncached static lighting interactions.
|
|
if(bUncachedStaticLighting)
|
|
{
|
|
LightSceneInfo->NumUnbuiltInteractions--;
|
|
FPlatformAtomics::InterlockedDecrement(&PrimitiveSceneInfo->Scene->NumUncachedStaticLightingInteractions);
|
|
#if WITH_EDITOR
|
|
PrimitiveSceneInfo->Proxy->NumUncachedStaticLightingInteractions--;
|
|
#endif
|
|
}
|
|
#endif
|
|
|
|
// Track ES2 dynamic point light count
|
|
if (bES2DynamicPointLight)
|
|
{
|
|
PrimitiveSceneInfo->NumES2DynamicPointLights--;
|
|
if (PrimitiveSceneInfo->NumES2DynamicPointLights == 0)
|
|
{
|
|
PrimitiveSceneInfo->Proxy->bDisableStaticPath = false;
|
|
}
|
|
}
|
|
|
|
// Remove the interaction from the light's interaction list.
|
|
if(NextPrimitive)
|
|
{
|
|
NextPrimitive->PrevPrimitiveLink = PrevPrimitiveLink;
|
|
}
|
|
*PrevPrimitiveLink = NextPrimitive;
|
|
|
|
// Remove the interaction from the primitive's interaction list.
|
|
if(NextLight)
|
|
{
|
|
NextLight->PrevLightLink = PrevLightLink;
|
|
}
|
|
*PrevLightLink = NextLight;
|
|
}
|
|
|
|
/*-----------------------------------------------------------------------------
|
|
FStaticMesh
|
|
-----------------------------------------------------------------------------*/
|
|
|
|
void FStaticMesh::LinkDrawList(FStaticMesh::FDrawListElementLink* Link)
|
|
{
|
|
check(IsInRenderingThread());
|
|
check(!DrawListLinks.Contains(Link));
|
|
DrawListLinks.Add(Link);
|
|
}
|
|
|
|
void FStaticMesh::UnlinkDrawList(FStaticMesh::FDrawListElementLink* Link)
|
|
{
|
|
check(IsInRenderingThread());
|
|
verify(DrawListLinks.RemoveSingleSwap(Link) == 1);
|
|
}
|
|
|
|
void FStaticMesh::AddToDrawLists(FRHICommandListImmediate& RHICmdList, FScene* Scene)
|
|
{
|
|
const auto FeatureLevel = Scene->GetFeatureLevel();
|
|
|
|
if (CastShadow)
|
|
{
|
|
FShadowDepthDrawingPolicyFactory::AddStaticMesh(Scene, this);
|
|
}
|
|
|
|
if (!PrimitiveSceneInfo->Proxy->ShouldRenderInMainPass())
|
|
{
|
|
return;
|
|
}
|
|
|
|
if (bUseForMaterial && Scene->RequiresHitProxies() && PrimitiveSceneInfo->Proxy->IsSelectable())
|
|
{
|
|
// Add the static mesh to the DPG's hit proxy draw list.
|
|
FHitProxyDrawingPolicyFactory::AddStaticMesh(Scene, this);
|
|
}
|
|
|
|
if (IsTranslucent(FeatureLevel))
|
|
{
|
|
return;
|
|
}
|
|
|
|
if (Scene->ShouldUseDeferredRenderer())
|
|
{
|
|
if (bUseAsOccluder)
|
|
{
|
|
// Render non-masked materials in the depth only pass
|
|
extern TAutoConsoleVariable<int32> CVarEarlyZPass;
|
|
int32 EarlyZPass = CVarEarlyZPass.GetValueOnRenderThread();
|
|
|
|
extern int32 GEarlyZPassMovable;
|
|
|
|
// WARNING : If you change this condition, also change the logic in FStaticMeshSceneProxy::DrawStaticElements.
|
|
if (PrimitiveSceneInfo->Proxy->ShouldUseAsOccluder()
|
|
&& (!IsMasked(FeatureLevel) || EarlyZPass == 2)
|
|
&& (!PrimitiveSceneInfo->Proxy->IsMovable() || GEarlyZPassMovable))
|
|
{
|
|
FDepthDrawingPolicyFactory::AddStaticMesh(Scene,this);
|
|
}
|
|
}
|
|
|
|
if (bUseForMaterial)
|
|
{
|
|
// Add the static mesh to the DPG's base pass draw list.
|
|
FBasePassOpaqueDrawingPolicyFactory::AddStaticMesh(RHICmdList, Scene, this);
|
|
FVelocityDrawingPolicyFactory::AddStaticMesh(Scene, this);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
if (bUseForMaterial)
|
|
{
|
|
// Add the static mesh to the DPG's base pass draw list.
|
|
FBasePassForwardOpaqueDrawingPolicyFactory::AddStaticMesh(RHICmdList, Scene, this);
|
|
}
|
|
}
|
|
}
|
|
|
|
void FStaticMesh::RemoveFromDrawLists()
|
|
{
|
|
// Remove the mesh from all draw lists.
|
|
while(DrawListLinks.Num())
|
|
{
|
|
FStaticMesh::FDrawListElementLink* Link = DrawListLinks[0];
|
|
const int32 OriginalNumLinks = DrawListLinks.Num();
|
|
// This will call UnlinkDrawList.
|
|
Link->Remove();
|
|
check(DrawListLinks.Num() == OriginalNumLinks - 1);
|
|
if(DrawListLinks.Num())
|
|
{
|
|
check(DrawListLinks[0] != Link);
|
|
}
|
|
}
|
|
}
|
|
|
|
/** Returns true if the mesh is linked to the given draw list. */
|
|
bool FStaticMesh::IsLinkedToDrawList(const FStaticMeshDrawListBase* DrawList) const
|
|
{
|
|
for (int32 i = 0; i < DrawListLinks.Num(); i++)
|
|
{
|
|
if (DrawListLinks[i]->IsInDrawList(DrawList))
|
|
{
|
|
return true;
|
|
}
|
|
}
|
|
return false;
|
|
}
|
|
|
|
FStaticMesh::~FStaticMesh()
|
|
{
|
|
// Remove this static mesh from the scene's list.
|
|
PrimitiveSceneInfo->Scene->StaticMeshes.RemoveAt(Id);
|
|
|
|
RemoveFromDrawLists();
|
|
}
|
|
|
|
/** Initialization constructor. */
|
|
FExponentialHeightFogSceneInfo::FExponentialHeightFogSceneInfo(const UExponentialHeightFogComponent* InComponent):
|
|
Component(InComponent),
|
|
FogHeight(InComponent->GetComponentLocation().Z),
|
|
// Scale the densities back down to their real scale
|
|
// Artists edit the densities scaled up so they aren't entering in minuscule floating point numbers
|
|
FogDensity(InComponent->FogDensity / 1000.0f),
|
|
FogHeightFalloff(InComponent->FogHeightFalloff / 1000.0f),
|
|
FogMaxOpacity(InComponent->FogMaxOpacity),
|
|
StartDistance(InComponent->StartDistance),
|
|
LightTerminatorAngle(0),
|
|
DirectionalInscatteringExponent(InComponent->DirectionalInscatteringExponent),
|
|
DirectionalInscatteringStartDistance(InComponent->DirectionalInscatteringStartDistance),
|
|
DirectionalInscatteringColor(InComponent->DirectionalInscatteringColor)
|
|
{
|
|
FogColor = InComponent->FogInscatteringColor;
|
|
}
|