TStereoLayerManager

Partial implementation of the Layer management code for the [IStereoLayers](API\Runtime\Engine\IStereoLayers) interface.

Windows
MacOS
Linux

Inheritance Hierarchy

References

Module

HeadMountedDisplay

Header

/Engine/Source/Runtime/HeadMountedDisplay/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<LayerType>& OutArray, bool bMarkClean = true) Copies the layers into OutArray. The last two methods will clear the layer dirty flag unless you pass in false as the optional final argument.

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.

Constructors

Name Description

Public function

TStereoLayerManager()

Destructors

Name Description

Public function Virtual

~TStereoLayerManager()

Functions

Name Description

Protected function

void

 

CopyLayers

(
    TArray< LayerType >& OutArray,
    bool bMarkClean
)

Protected function

void

 

ForEachLayer

(
    TFunction< void(uint32, LayerType&...,
    bool bMarkClean
)

Protected function

bool

 

GetStereoLayersDirty()

Protected function Virtual Const

void

 

UpdateLayer

(
    LayerType& Layer,
    uint32 LayerId,
    bool bIsValid
)

Protected function

void

 

WithLayer

(
    uint32 LayerId,
    TFunction< void(LayerType*)> F...
)

Overridden from IStereoLayers

Name Description

Public function Virtual

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

Public function Virtual

void

 

DestroyLayer

(
    uint32 LayerId
)

Destroys the specified layer, stopping it from rendering over the world

Public function Virtual

bool

 

GetLayerDesc

(
    uint32 LayerId,
    FLayerDesc& OutLayerDesc
)

Get the currently set layer description

Public function Virtual

void

 

MarkTextureForUpdate

(
    uint32 LayerId
)

Marks this layers texture for update

Public function Virtual

void

 

SetLayerDesc

(
    uint32 LayerId,
    const FLayerDesc& InLayerDesc
)

Set the a new layer description

Select Skin
Light
Dark

Welcome to the new Unreal Engine 4 Documentation site!

We're working on lots of new features including a feedback system so you can tell us how we are doing. It's not quite ready for use in the wild yet, so head over to the Documentation Feedback forum to tell us about this page or call out any issues you are encountering in the meantime.

We'll be sure to let you know when the new system is up and running.

Post Feedback