evan 2026.1.4
Evan
Loading...
Searching...
No Matches
ViewSet.hpp
1/*
2** ETIB PROJECT, 2026
3** evan
4** File description:
5** ViewSet
6*/
7
8#pragma once
9
10#include "evan/EvanPlatform.hpp"
11
12#include <utility/graphic/view.hpp>
13
14#include <cstddef>
15#include <vector>
16
17namespace evan
18{
36 class ViewSet
37 {
38 public:
42 struct View {
47 utility::graphic::ViewF view;
48
52 std::size_t swapchainIndex = 0;
53 };
54
61 void addView(const utility::graphic::ViewF &view,
62 std::size_t swapchainIndex);
73 void setView(std::size_t index, const utility::graphic::ViewF &view);
74
82 void setSwapchainIndex(std::size_t index, std::size_t swapchainIndex);
83
89 void resize(std::size_t count);
90
94 void clear();
95
99 std::size_t size() const;
100
104 bool empty() const;
105
112 View &operator[](std::size_t index)
113 {
114 return _views[index];
115 }
116
123 const View &operator[](std::size_t index) const
124 {
125 return _views[index];
126 }
127
134 View &at(std::size_t index)
135 {
136 return _views.at(index);
137 }
138
146 const View &at(std::size_t index) const
147 {
148 return _views.at(index);
149 }
150
157 utility::graphic::ViewF getView(std::size_t index) const;
158
165 glm::mat4 getProjection(std::size_t index) const;
166
167 private:
171 std::vector<View> _views;
172 };
173} // namespace evan
Describes a set of views to render, independent of the swapchain image sets.
Definition ViewSet.hpp:37
View & at(std::size_t index)
Accesses the view at the given index with bounds checking.
Definition ViewSet.hpp:134
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 clear()
Removes all views from the set.
void resize(std::size_t count)
Resizes the view set to contain exactly count views.
View & operator[](std::size_t index)
Accesses the view at the given index (unchecked).
Definition ViewSet.hpp:112
bool empty() const
void setView(std::size_t index, const utility::graphic::ViewF &view)
Sets the view state at the given index, growing the set if necessary.
const View & operator[](std::size_t index) const
Accesses the view at the given index (unchecked, const).
Definition ViewSet.hpp:123
utility::graphic::ViewF getView(std::size_t index) const
Retrieves the view state for the given index.
const View & at(std::size_t index) const
Accesses the view at the given index with bounds checking (const).
Definition ViewSet.hpp:146
std::size_t size() const
glm::mat4 getProjection(std::size_t index) const
Retrieves the projection matrix for the given index.
void addView(const utility::graphic::ViewF &view, std::size_t swapchainIndex)
Appends a view bound to the given swapchain.
Small result wrapper used by helpers that must return both a status and a value (e....
Definition Error.hpp:89
A single view together with the swapchain it targets.
Definition ViewSet.hpp:42
utility::graphic::ViewF view
The view state: pose, field of view, clipping planes and viewport. Used to build the view and project...
Definition ViewSet.hpp:47
std::size_t swapchainIndex
Index of the swapchain image set this view renders into.
Definition ViewSet.hpp:52