Navigation
API > API/Plugins > API/Plugins/XRBase
Inheritance Hierarchy
- IStereoLayers
- TStereoLayerManager
- FSimpleLayerManager
- FDefaultStereoLayers
References
Module | XRBase |
Header | /Engine/Plugins/Runtime/XRBase/Source/XRBase/Public/StereoLayerManager.h |
Include | #include "StereoLayerManager.h" |
Syntax
template<typename LayerType>
class TStereoLayerManager : public IStereoLayers
Remarks
Partial implementation of the Layer management code for the IStereoLayers interface. Implements adding, deleting and updating layers regardless of how they are rendered.
A class that wishes to implement the IStereoLayer interface can extend this class instead. The template argument should be a type for storing layer data. It should have a constructor matching the following: LayerType(const FLayerDesc& InLayerDesc); ... and implement the following function overloads: void SetLayerId(uint32 InId), uint32 GetLayerId() const, bool GetLayerDescMember(LayerType& Layer, FLayerDesc& OutLayerDesc), void SetLayerDescMember(LayerType& Layer, const FLayerDesc& Desc), and void MarkLayerTextureForUpdate(LayerType& Layer)
To perform additional bookkeeping each time individual layers are changed, you can override the following protected method: UpdateLayer(LayerType& Layer, uint32 LayerId, bool bIsValid) It is called whenever CreateLayer, DestroyLayer, SetLayerDesc and MarkTextureForUpdate are called.
Simple implementations that do not to track additional data per layer may use FLayerDesc directly. The FSimpleLayerManager subclass can be used in that case and it implements all the required glue functions listed above.
To access the layer data from your subclass, you have the following protected interface: bool GetStereoLayersDirty() Returns true if layer data have changed since the status was last cleared ForEachLayer(...) pass in a lambda to iterate through each existing layer. CopyLayers(TArray
Thread safety: Updates and the two protected access methods use a critical section to ensure atomic access to the layer structures. Therefore, it is probably better to copy layers before performing time consuming operations using CopyLayers and reserve ForEachLayer for simple processing or operations where you need to know the user-facing layer id. The WithLayer method is useful if you already know the id of a layer you need to access in a thread safe manner.
Constructors
Type | Name | Description | |
---|---|---|---|
![]() |
Destructors
Type | Name | Description | |
---|---|---|---|
![]() ![]() |
Functions
Type | Name | Description | |
---|---|---|---|
![]() |
void | CopyLayers
(
TArray< LayerType >& OutArray, |
|
![]() |
void | CopySortedLayers
(
TArray< LayerType >& OutArray, |
|
![]() |
void | ForEachLayer
(
TFunction< void(uint32, LayerType&)> Func, |
|
![]() |
bool | ||
![]() ![]() |
void | UpdateLayer
(
LayerType& Layer, |
|
![]() |
void |
Overridden from IStereoLayers
Type | Name | Description | |
---|---|---|---|
![]() ![]() |
uint32 | CreateLayer
(
const FLayerDesc& InLayerDesc |
Creates a new layer from a given texture resource, which is projected on top of the world as a quad. |
![]() ![]() |
void | DestroyLayer
(
uint32 LayerId |
Destroys the specified layer, stopping it from rendering over the world. |
![]() ![]() |
void | GetAllocatedTexture
(
uint32 LayerId, |
Get texture reference to HMD swapchain to avoid the copy path, useful for continuous update layers |
![]() ![]() |
bool | GetLayerDesc
(
uint32 LayerId, |
Get the currently set layer description |
![]() ![]() |
void | Optional method to hide the 3D scene and only render the stereo overlays. | |
![]() ![]() ![]() |
bool | Tell if the background layer is visible. | |
![]() ![]() |
void | MarkTextureForUpdate
(
uint32 LayerId |
Marks this layers texture for update |
![]() ![]() |
void | Restores the stereo layer state from the last save state. | |
![]() ![]() |
void | PushLayerState
(
bool bPreserve |
Saves the current stereo layer state on a stack to later restore them. |
![]() ![]() |
void | SetLayerDesc
(
uint32 LayerId, |
Set the a new layer description |
![]() ![]() |
void | Optional method to undo the effect of hiding the 3D scene. No-op if not supported by the platform. | |
![]() ![]() |
bool | Returns true if the StereoLayers implementation supports saving and restoring state using Push/PopLayerState() | |
![]() ![]() |
void | Update splash screens from current state |