38 #include "Coherent/UI/ViewListener.h"
45 FORCEINLINE uint32 GetTypeHash(
const Coherent::UI::CoherentHandle& handle)
47 return FCrc::MemCrc32(&handle.HandleValue,
sizeof(handle.HandleValue));
53 class CoUISystemWrapper;
54 typedef TSharedPtr<CoUISystemWrapper, ESPMode::ThreadSafe> SystemWrapperSharedPtr;
56 class COHERENTUIPLUGIN_API FCoherentUIViewListener
57 :
public Coherent::UI::ViewListener
60 FCoherentUIViewListener();
61 virtual ~FCoherentUIViewListener();
63 Coherent::UI::View* GetView()
const;
64 bool IsReadyToCreateView()
const;
66 void CreateSystemIfNecessary(UWorld* world);
70 void DoResize(uint32 width, uint32 height);
72 virtual void OnViewCreated(Coherent::UI::View* view)
override;
73 virtual void Release()
override;
74 virtual void OnDraw(Coherent::UI::CoherentHandle handle,
75 bool usesSharedMemory,
79 virtual void CreateSurface(
bool sharedMemory,
82 Coherent::UI::SurfaceResponse* response)
override;
83 virtual void DestroySurface(Coherent::UI::CoherentHandle surface,
84 bool usesSharedMemory)
override;
86 virtual void OnError(
const Coherent::UI::ViewError& error)
override;
88 virtual void TickListener();
90 class COHERENTUIPLUGIN_API MappedMemory
93 explicit MappedMemory(Coherent::UI::CoherentHandle handle,
size_t size);
94 MappedMemory(
const MappedMemory& other);
96 MappedMemory& operator=(
const MappedMemory& other);
98 void* GetMemory()
const;
102 FThreadSafeCounter* RefCount;
110 SystemWrapperSharedPtr System;
114 MappedMemory MapMemory(Coherent::UI::CoherentHandle handle);
116 void DestroyCurrentTexture();
117 void RecreateTexture(uint32 width, uint32 height);
119 Coherent::UI::View* View;
121 TMap<Coherent::UI::CoherentHandle, MappedMemory> MemoryHandles;
123 TMap<Coherent::UI::CoherentHandle, FTexture2DRHIRef> SharedTextureHandles;
124 struct FCreateSurfaceTask
126 FCreateSurfaceTask();
130 Coherent::UI::SurfaceResponse* Response;
131 FTexture2DRHIRef Texture;
132 Coherent::UI::CoherentHandle Handle;
134 FCriticalSection CreateSurfaceCS;
135 typedef TArray<TSharedPtr<FCreateSurfaceTask>> CreateSurfaceTaskArray;
136 CreateSurfaceTaskArray CreateSurfaceTasksComplete;
138 void DoCreateSurfaceOnRenderThread(
const TSharedPtr<FCreateSurfaceTask>& task);
Definition: CoherentUISystem.h:62