sculpto
Main Page
Namespaces
Classes
Files
File List
File Members
platform
opengl
gl_frame_buffer.h
Go to the documentation of this file.
1
/*!****************************************************************/
/*!*
2
* \file gl_frame_buffer.h
3
* \brief OpenGL frame buffer class definition class.
4
*
5
* \author Sabitov Kirill
6
* \date 30 June 2022
7
*********************************************************************/
8
9
#pragma once
10
11
#include "
gl.h
"
12
#include "
gl_texture.h
"
13
#include "
core/render/primitives/frame_buffer.h
"
14
15
namespace
scl
16
{
18
class
gl_frame_buffer
:
public
frame_buffer
19
{
20
private
:
21
frame_buffer_props
Props {};
22
GLuint Id {};
23
std::vector<shared<texture_2d>> ColorAttachments {};
24
shared<texture_2d>
DepthAttachment {};
25
u32
ClearConfig {};
26
27
public
:
29
void
SetFrameBufferProps
(
const
frame_buffer_props
&Props);
31
const
frame_buffer_props
&
GetFrameBufferProps
()
const
;
33
const
shared<texture_2d>
&
GetColorAttachment
(
int
Index)
const override
;
35
const
shared<texture_2d>
&
GetDepthAttachment
(
int
Index)
const override
;
36
37
private
:
38
/*!*
39
* Recreate frame buffer according to new frame buffer properties function.
40
*
41
* \param None.
42
* \return None.
43
*/
44
void
Invalidate();
45
46
public
:
48
render_primitive::handle
GetHandle
()
const override
{
return
Id; }
49
50
/*!*
51
* OpenGL frame buffer constructor.
52
*
53
* \param Props - frame buffer properties.
54
*/
55
gl_frame_buffer
(
const
frame_buffer_props
&Props);
56
58
~gl_frame_buffer
()
override
;
59
60
/*!*
61
* Bind frame buffer to current render stage function.
62
*
63
* \param None.
64
* \return None.
65
*/
66
void
Bind
()
const override
;
67
68
/*!*
69
* Unbind frame buffer from current render stage function.
70
*
71
* \param None.
72
* \return None.
73
*/
74
void
Unbind
()
const override
;
75
76
/*!*
77
* Resize frame buffer (resize also could be called by setting frame buffer props).
78
*
79
* \param Width - new frame buffer width.
80
* \param Height - new frame buffer height.
81
* \return None.
82
*/
83
void
Resize
(
int
Width,
int
Height)
override
;
84
85
/*!*
86
* Unload frame buffer render target texture from GPU memory function.
87
*
88
* \param None.
89
* \return None.
90
*/
91
void
Free
()
override
;
92
93
/*!*
94
* Clear frame buffer funcrion.
95
*
96
* \param None.
97
* \return None.
98
*/
99
void
Clear
()
override
;
100
};
101
}
scl::frame_buffer
Definition:
frame_buffer.h:48
scl::gl_frame_buffer
Definition:
gl_frame_buffer.h:19
scl::gl_frame_buffer::Clear
void Clear() override
Definition:
gl_frame_buffer.cpp:128
scl::gl_frame_buffer::GetColorAttachment
const shared< texture_2d > & GetColorAttachment(int Index) const override
Definition:
gl_frame_buffer.cpp:25
scl::gl_frame_buffer::SetFrameBufferProps
void SetFrameBufferProps(const frame_buffer_props &Props)
Definition:
gl_frame_buffer.cpp:13
scl::gl_frame_buffer::Bind
void Bind() const override
Definition:
gl_frame_buffer.cpp:97
scl::gl_frame_buffer::gl_frame_buffer
gl_frame_buffer(const frame_buffer_props &Props)
Definition:
gl_frame_buffer.cpp:85
scl::gl_frame_buffer::Resize
void Resize(int Width, int Height) override
Definition:
gl_frame_buffer.cpp:108
scl::gl_frame_buffer::GetFrameBufferProps
const frame_buffer_props & GetFrameBufferProps() const
Definition:
gl_frame_buffer.cpp:20
scl::gl_frame_buffer::Unbind
void Unbind() const override
Definition:
gl_frame_buffer.cpp:103
scl::gl_frame_buffer::GetDepthAttachment
const shared< texture_2d > & GetDepthAttachment(int Index) const override
Definition:
gl_frame_buffer.cpp:30
scl::gl_frame_buffer::GetHandle
render_primitive::handle GetHandle() const override
Definition:
gl_frame_buffer.h:48
scl::gl_frame_buffer::~gl_frame_buffer
~gl_frame_buffer() override
Definition:
gl_frame_buffer.cpp:92
scl::gl_frame_buffer::Free
void Free() override
Definition:
gl_frame_buffer.cpp:115
frame_buffer.h
Frame buffer interface implementation module.
gl.h
gl_texture.h
OpenGL texture class definition module.
scl
Definition:
base.h:33
scl::shared
std::shared_ptr< T > shared
Definition:
smart_ptr.h:15
scl::u32
uint32_t u32
Definition:
math_common.h:21
scl::frame_buffer_props
Definition:
frame_buffer.h:20
Generated by
1.9.4