Contents

ImmersivePreviewRenderer

An object that renders an immersive video frame into a texture and exposes the command buffer for presentation.

Declaration

@MainActor class ImmersivePreviewRenderer

Overview

ImmersivePreviewRenderer provides a high-level interface for rendering immersive video content with support for stereoscopic rendering, presentation commands, and venue-specific camera models. It manages the rendering pipeline including geometry setup, texture management, and frame processing.

The renderer supports two rendering modes:

macOS

Rendering directly to a specified texture with manual camera control via rotation and field of view parameters.

visionOS

Rendering to LayerRenderer.Drawable instances with automatic head tracking and view management.

Create a renderer with a venue descriptor that defines the camera models and rendering geometry:

let venueDescriptor = try VenueDescriptor(aimeFileURL: aimeURL)
let renderer = ImmersivePreviewRenderer(venueDescriptor: venueDescriptor)

On macOS, render frames directly to a texture:

await renderer.process(
    frame,
    for: .left,
    rotation: currentRotation,
    fieldOfView: 90,
    presentationDescriptor: descriptor,
    renderTexture: drawable.texture
)

On visionOS, integrate with CompositorServices for immersive rendering:

await renderer.process(
    frame,
    presentationDescriptor: descriptor,
    drawable: drawable
)

Finally, present and commit command buffer:

if let commandBuffer = renderer.commandBuffer {
    commandBuffer.present(drawable)
    commandBuffer.commit()
}

Topics

Initializers

Instance Properties

Instance Methods

Enumerations

See Also

Preview