cgv
Loading...
Searching...
No Matches
managed_frame_buffer.h
1
#pragma once
2
3
#include <unordered_map>
4
5
#include <cgv/render/frame_buffer.h>
6
7
#include "lib_begin.h"
8
9
namespace
cgv
{
10
namespace
render {
11
13
class
CGV_API
managed_frame_buffer
14
{
15
private
:
16
ivec2
get_actual_size(
context
& ctx);
17
18
bool
create_and_validate(
context
& ctx,
const
ivec2
& size);
19
20
protected
:
21
struct
attachment
{
22
unsigned
index;
23
bool
attach;
24
std::string format;
25
TextureFilter
tf;
26
TextureWrap
tw;
27
texture
tex;
28
29
bool
is_depth_attachment() {
30
return
31
format ==
"[D]"
||
32
format ==
"uint16[D]"
||
33
format ==
"uint32[D:24]"
||
34
format ==
"uint32[D]"
;
35
}
36
};
37
38
frame_buffer
fb;
39
unsigned
index_counter = 0;
40
std::unordered_map<std::string, attachment> attachments;
41
ivec2
size;
42
43
public
:
44
managed_frame_buffer
();
45
46
~managed_frame_buffer
();
47
48
void
destruct(
const
context
& ctx);
49
50
ivec2
get_size();
51
57
bool
set_size(
const
ivec2
& size);
58
59
void
add_attachment(
const
std::string& name,
const
std::string& format =
"uint8[R,G,B]"
,
TextureFilter
tf = TF_NEAREST,
TextureWrap
tw = TW_CLAMP_TO_EDGE,
bool
attach =
true
);
60
61
bool
enable_attachment(
context
& ctx,
const
std::string& name,
int
tex_unit = -1);
62
63
bool
disable_attachment(
context
& ctx,
const
std::string& name);
64
65
texture
* attachment_texture_ptr(
const
std::string& name);
66
67
bool
ensure(
context
& ctx);
68
69
bool
enable(
context
& ctx);
70
71
bool
disable(
context
& ctx);
72
73
frame_buffer
& ref_frame_buffer() {
return
fb; }
74
};
75
76
}
77
}
78
79
#include <cgv/config/lib_end.h>
cgv::math::fvec< int32_t, 2 >
cgv::render::context
base class for all drawables, which is independent of the used rendering API.
Definition
context.h:621
cgv::render::frame_buffer
this class encapsulate frame buffers that live on the GPU and can be used as destination for the rend...
Definition
frame_buffer.h:17
cgv::render::managed_frame_buffer
provides a class that manages a frame buffer along with its attachments
Definition
managed_frame_buffer.h:14
cgv::render::texture
the texture class encapsulates all functionality independent of the rendering api.
Definition
texture.h:15
cgv::render::TextureFilter
TextureFilter
different texture filter
Definition
context.h:189
cgv::render::TextureWrap
TextureWrap
different texture wrap modes
Definition
context.h:173
cgv
the cgv namespace
Definition
print.h:11
cgv::render::managed_frame_buffer::attachment
Definition
managed_frame_buffer.h:21
cgv
render
managed_frame_buffer.h
Generated by
1.9.8