Files
Marc Audy 68150e0be7 Merge UE5/Release-Engine-Staging to UE5/Main @ 14611496
This represents UE4/Main @ 14594913

[CL 14612291 by Marc Audy in ue5-main branch]
2020-10-29 13:38:15 -04:00

60 lines
1.0 KiB
C++

// Copyright Epic Games, Inc. All Rights Reserved.
#include "DirectLinkStreamSource.h"
#include "DirectLinkMisc.h"
#include "DirectLinkSceneSnapshot.h"
#include "DirectLinkStreamCommunicationInterface.h"
#include "Misc/ScopeRWLock.h"
namespace DirectLink
{
void FStreamSource::SetRoot(ISceneGraphNode* InRoot)
{
Root = InRoot;
}
void FStreamSource::Snapshot()
{
TSharedPtr<FSceneSnapshot> NewSnapshot = SnapshotScene(Root);
DumpSceneSnapshot(*NewSnapshot.Get(), TEXT("source"));
{
FRWScopeLock _(CurrentSnapshotLock, SLT_Write);
CurrentSnapshot = NewSnapshot;
}
{
FRWScopeLock _(SendersLock, SLT_ReadOnly);
for (TSharedPtr<IStreamSender>& Sender : Senders)
{
Sender->SetSceneSnapshot(NewSnapshot);
}
}
}
void FStreamSource::LinkSender(const TSharedPtr<IStreamSender>& Sender)
{
if (ensure(Sender))
{
{
FRWScopeLock _(SendersLock, SLT_Write);
Senders.Add(Sender);
}
{
FRWScopeLock _(CurrentSnapshotLock, SLT_ReadOnly);
Sender->SetSceneSnapshot(CurrentSnapshot);
}
}
}
} // namespace DirectLink