evan 2026.1.4
Evan
Loading...
Searching...
No Matches
evan::ViewSet Class Reference

Describes a set of views to render, independent of the swapchain image sets. More...

#include <headers/evan/ViewSet.hpp>

Classes

struct  View
 A single view together with the swapchain it targets. More...
 

Public Member Functions

void addView (const utility::graphic::ViewF &view, std::size_t swapchainIndex)
 Appends a view bound to the given swapchain.
 
void setView (std::size_t index, const utility::graphic::ViewF &view)
 Sets the view state at the given index, growing the set if necessary.
 
void setSwapchainIndex (std::size_t index, std::size_t swapchainIndex)
 Sets the swapchain index of the view at the given index, growing the set if necessary.
 
void resize (std::size_t count)
 Resizes the view set to contain exactly count views.
 
void clear ()
 Removes all views from the set.
 
std::size_t size () const
 
bool empty () const
 
View & operator[] (std::size_t index)
 Accesses the view at the given index (unchecked).
 
const View & operator[] (std::size_t index) const
 Accesses the view at the given index (unchecked, const).
 
View & at (std::size_t index)
 Accesses the view at the given index with bounds checking.
 
const View & at (std::size_t index) const
 Accesses the view at the given index with bounds checking (const).
 
utility::graphic::ViewF getView (std::size_t index) const
 Retrieves the view state for the given index.
 
glm::mat4 getProjection (std::size_t index) const
 Retrieves the projection matrix for the given index.
 

Detailed Description

Describes a set of views to render, independent of the swapchain image sets.

A ViewSet is an ordered list of views (camera poses + projections). Each view is associated with the index of the swapchain image set it renders into. This decouples the concept of "how many views must be rendered" from "how many swapchains / images exist":

  • Desktop: one view rendering into swapchain set 0.
  • OpenXR: one view per eye, each rendering into its own swapchain set.
  • Desktop multi-view (future): several views sharing swapchain set 0.

The Renderer iterates over a ViewSet to know which view matrices to upload (one uniform buffer update per view) and which swapchain image to render each view into.

Definition at line 36 of file ViewSet.hpp.

Member Function Documentation

◆ addView()

void evan::ViewSet::addView ( const utility::graphic::ViewF &  view,
std::size_t  swapchainIndex 
)

Appends a view bound to the given swapchain.

Parameters
viewThe view state to append.
swapchainIndexIndex of the swapchain image set to target.

◆ at() [1/2]

View & evan::ViewSet::at ( std::size_t  index)
inline

Accesses the view at the given index with bounds checking.

Parameters
indexIndex of the view to access.
Returns
The view entry.

Definition at line 134 of file ViewSet.hpp.

◆ at() [2/2]

const View & evan::ViewSet::at ( std::size_t  index) const
inline

Accesses the view at the given index with bounds checking (const).

Parameters
indexIndex of the view to access.
Returns
The view entry.

Definition at line 146 of file ViewSet.hpp.

◆ empty()

bool evan::ViewSet::empty ( ) const
Returns
True when the set contains no view.

◆ getProjection()

glm::mat4 evan::ViewSet::getProjection ( std::size_t  index) const

Retrieves the projection matrix for the given index.

Parameters
indexIndex of the view.
Returns
The projection matrix.

◆ getView()

utility::graphic::ViewF evan::ViewSet::getView ( std::size_t  index) const

Retrieves the view state for the given index.

Parameters
indexIndex of the view.
Returns
The view state.

◆ operator[]() [1/2]

View & evan::ViewSet::operator[] ( std::size_t  index)
inline

Accesses the view at the given index (unchecked).

Parameters
indexIndex of the view to access.
Returns
The view entry.

Definition at line 112 of file ViewSet.hpp.

◆ operator[]() [2/2]

const View & evan::ViewSet::operator[] ( std::size_t  index) const
inline

Accesses the view at the given index (unchecked, const).

Parameters
indexIndex of the view to access.
Returns
The view entry.

Definition at line 123 of file ViewSet.hpp.

◆ resize()

void evan::ViewSet::resize ( std::size_t  count)

Resizes the view set to contain exactly count views.

Parameters
countThe new number of views.
Here is the caller graph for this function:

◆ setSwapchainIndex()

void evan::ViewSet::setSwapchainIndex ( std::size_t  index,
std::size_t  swapchainIndex 
)

Sets the swapchain index of the view at the given index, growing the set if necessary.

Parameters
indexIndex of the view to update.
swapchainIndexIndex of the swapchain image set to target.

◆ setView()

void evan::ViewSet::setView ( std::size_t  index,
const utility::graphic::ViewF &  view 
)

Sets the view state at the given index, growing the set if necessary.

The existing swapchain index is preserved when the view already exists; new entries default to swapchain index 0.

Parameters
indexIndex of the view to set.
viewThe view state to store.

◆ size()

std::size_t evan::ViewSet::size ( ) const
Returns
The number of views in the set.
Here is the caller graph for this function:

The documentation for this class was generated from the following file: