sculpto
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"
13
14namespace scl
15{
17 enum class texture_type
18 {
19 COLOR,
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 */
79 };
80}
static shared< texture_2d > Create(const image &Image, texture_type Type=texture_type::COLOR)
Definition: texture.cpp:14
int GetWidth() const
Definition: texture.h:32
int GetHeight() const
Definition: texture.h:34
virtual void Free()=0
virtual image GetImage()=0
virtual void Bind(u32 Slot) const =0
virtual ~texture_2d()=default
virtual void Unbind() const =0
Image container class implementation module.
Definition: base.h:33
std::shared_ptr< T > shared
Definition: smart_ptr.h:15
uint32_t u32
Definition: math_common.h:21
texture_type
Definition: texture.h:18
Render primitive abstract class definition module.