Unravel Engine C++ Reference
Loading...
Searching...
No Matches
render_view.cpp
Go to the documentation of this file.
1#include "render_view.h"
2#include <cassert>
3
4namespace gfx
5{
6
7auto render_view::tex_get_or_emplace(const hpp::string_view& id) -> texture::ptr&
8{
9 auto it = textures_.find(id);
10 if(it != textures_.end())
11 {
12 return it->second;
13 }
14
15 return textures_[std::string(id)];
16}
17
18auto render_view::tex_get(const hpp::string_view& id) const -> const texture::ptr&
19{
20 const auto& tex = tex_safe_get(id);
21 assert(tex != nullptr && "Trying to get non existent element");
22 return tex;
23}
24
25
26auto render_view::tex_safe_get(const hpp::string_view& id) const -> const texture::ptr&
27{
28 auto it = textures_.find(id);
29 if(it != textures_.end())
30 {
31 return it->second;
32 }
33
34 static const texture::ptr empty;
35 return empty;
36}
37
38
39auto render_view::fbo_get_or_emplace(const hpp::string_view& id) -> frame_buffer::ptr&
40{
41 auto it = fbos_.find(id);
42 if(it != fbos_.end())
43 {
44 return it->second;
45 }
46
47 return fbos_[std::string(id)];
48}
49
50auto render_view::fbo_get(const hpp::string_view& id) const -> const frame_buffer::ptr&
51{
52 const auto& fbo = fbo_safe_get(id);
53 assert(fbo != nullptr && "Trying to get non existent element");
54 return fbo;
55}
56
57auto render_view::fbo_safe_get(const hpp::string_view& id) const -> const frame_buffer::ptr&
58{
59 auto it = fbos_.find(id);
60 if(it != fbos_.end())
61 {
62 return it->second;
63 }
64
65 static const frame_buffer::ptr empty;
66 return empty;
67}
68
69} // namespace gfx
auto fbo_safe_get(const hpp::string_view &id) const -> const frame_buffer::ptr &
auto fbo_get_or_emplace(const hpp::string_view &id) -> frame_buffer::ptr &
auto fbo_get(const hpp::string_view &id) const -> const frame_buffer::ptr &
auto tex_get(const hpp::string_view &id) const -> const texture::ptr &
auto tex_safe_get(const hpp::string_view &id) const -> const texture::ptr &
auto tex_get_or_emplace(const hpp::string_view &id) -> texture::ptr &