Magnum::OvrIntegration::Compositor class

Compositor.

Wraps compositing related functions of LibOVR.

Usage

The compositor handles distortion, chromatic abberation, timewarp and sending images to a HMD's display.

The compositor may contain a set of layers with different sizes and different properties. See LayerEyeFov and LayerQuad.

Setup of a distortion layer may look as follows:

// setup TextureSwapChains etc
Context context;
Session& session = // ...
std::unique_ptr<TextureSwapChain> textureChain[2] = // ...
Vector2i textureSize[2] = // ...

// setup compositor layers
LayerEyeFov& layer = Context::get().compositor().addLayerEyeFov();
layer.setFov(session.get());
layer.setHighQuality(true);

for(Int eye = 0; eye < 2; ++eye) {
    layer.setColorTexture(eye, *textureChain[eye]);
    layer.setViewport(eye, {{}, textureSize[eye]});
}

After that you need to render every frame by first rendering to the texture swap chains and then submitting the compositor frame via Compositor::submitFrame().

layer.setRenderPoses(session);

Context::get().compositor().submitFrame(session);

Constructors, destructors, conversion operators

Compositor(const Compositor&) deleted
Copying is not allowed.
Compositor(Compositor&&) deleted
Moving is not allowed.

Public functions

auto operator=(const Compositor&) -> Compositor& deleted
Copying is not allowed.
auto operator=(Compositor&&) -> Compositor& deleted
Moving is not allowed.
auto addLayer(LayerType type) -> Layer&
Add a layer of specific type.
auto addLayerEyeFov() -> LayerEyeFov&
Create a LayerEyeFov.
auto addLayerQuad() -> LayerQuad&
Create a LayerQuad.
auto submitFrame(Session& session) -> Compositor&
Submit the frame to the compositor.

Function documentation

Layer& Magnum::OvrIntegration::Compositor::addLayer(LayerType type)

Add a layer of specific type.

LayerEyeFov& Magnum::OvrIntegration::Compositor::addLayerEyeFov()

Create a LayerEyeFov.

LayerQuad& Magnum::OvrIntegration::Compositor::addLayerQuad()

Create a LayerQuad.

Compositor& Magnum::OvrIntegration::Compositor::submitFrame(Session& session)

Submit the frame to the compositor.

Parameters
session Session of the HMD to render to
Returns Reference to self (for method chaining)