sculpto
Main Page
Namespaces
Classes
Files
File List
File Members
core
render
primitives
texture.h
Go to the documentation of this file.
1
/*!****************************************************************/
/*!*
2
* \file texture.h
3
* \brief Texture interface definition module.
4
*
5
* \author Sabitov Kirill
6
* \date 28 June 2022
7
*********************************************************************/
8
9
#pragma once
10
11
#include "
render_primitive.h
"
12
#include "
utilities/image/image.h
"
13
14
namespace
scl
15
{
17
enum class
texture_type
18
{
19
COLOR
,
20
COLOR_FLOATING_POINT
,
21
DEPTH
,
22
};
23
25
class
texture_2d
:
public
render_primitive
26
{
27
protected
:
28
int
Width
{},
Height
{};
29
30
public
:
32
int
GetWidth
()
const
{
return
Width
; }
34
int
GetHeight
()
const
{
return
Height
; }
35
36
public
:
38
virtual
~texture_2d
() =
default
;
39
40
/*!*
41
* Bind texture to current render stage function.
42
*
43
* \param Slot - texture slot to bind it in.
44
* \return None.
45
*/
46
virtual
void
Bind
(
u32
Slot)
const
= 0;
47
48
/*!*
49
* Unbind texture from current render stage function.
50
*
51
* \param Slot - texture slot to unbind it from.
52
* \return None.
53
*/
54
virtual
void
Unbind
()
const
= 0;
55
56
/*!*
57
* Load texture image from GPU memory function.
58
*
59
* \param None.
60
* \return texture image.
61
*/
62
virtual
image
GetImage
() = 0;
63
64
/*!*
65
* Unload texture from GPU memory function.
66
*
67
* \param None.
68
* \return None.
69
*/
70
virtual
void
Free
() = 0;
71
72
/*!*
73
* Create texture from image container function.
74
*
75
* \param Image - image container to get data from.
76
* \return created texture pointer.
77
*/
78
static
shared<texture_2d>
Create
(
const
image
&Image,
texture_type
Type =
texture_type::COLOR
);
79
};
80
}
scl::image
Definition:
image.h:19
scl::texture_2d
Definition:
texture.h:26
scl::texture_2d::Create
static shared< texture_2d > Create(const image &Image, texture_type Type=texture_type::COLOR)
Definition:
texture.cpp:14
scl::texture_2d::GetWidth
int GetWidth() const
Definition:
texture.h:32
scl::texture_2d::GetHeight
int GetHeight() const
Definition:
texture.h:34
scl::texture_2d::Free
virtual void Free()=0
scl::texture_2d::Width
int Width
Definition:
texture.h:28
scl::texture_2d::Height
int Height
Definition:
texture.h:28
scl::texture_2d::GetImage
virtual image GetImage()=0
scl::texture_2d::Bind
virtual void Bind(u32 Slot) const =0
scl::texture_2d::~texture_2d
virtual ~texture_2d()=default
scl::texture_2d::Unbind
virtual void Unbind() const =0
image.h
Image container class implementation 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::texture_type
texture_type
Definition:
texture.h:18
scl::texture_type::COLOR
@ COLOR
scl::texture_type::COLOR_FLOATING_POINT
@ COLOR_FLOATING_POINT
scl::texture_type::DEPTH
@ DEPTH
render_primitive.h
Render primitive abstract class definition module.
Generated by
1.9.4