Go to the documentation of this file.
9 #ifndef OGLPLUS_UTILS_IMAGE_SPEC_HPP
10 #define OGLPLUS_UTILS_IMAGE_SPEC_HPP
12 #include "../gl_api/enum_types.hpp"
17 namespace eagine::oglp {
19 class image_dimensions {
36 EAGINE_ASSERT(_width > 0 && _height > 0 && _depth > 0);
39 auto is_1d() const noexcept ->
bool {
40 return _width > 1 && _height == 1 && _depth == 1;
43 auto is_2d() const noexcept ->
bool {
44 return _width > 1 && _height > 1 && _depth == 1;
47 auto is_3d() const noexcept ->
bool {
48 return _width > 1 && _height > 1 && _depth > 1;
51 auto width() const noexcept -> gl_types::sizei_type {
55 auto height() const noexcept -> gl_types::sizei_type {
59 auto depth() const noexcept -> gl_types::sizei_type {
63 auto channels() const noexcept -> gl_types::sizei_type {
68 class image_pixel_format {
71 pixel_internal_format _internal_format;
74 image_pixel_format(pixel_format fmt, pixel_internal_format ifmt) noexcept
76 , _internal_format(ifmt) {}
78 image_pixel_format(pixel_format fmt) noexcept
80 , _internal_format(pixel_internal_format(GLenum(fmt))) {}
82 auto format() const noexcept -> pixel_format {
86 auto internal_format() const noexcept -> pixel_internal_format {
87 return _internal_format;
91 class image_pixel_data {
93 pixel_data_type _type;
99 pixel_data_type pix_type,
105 EAGINE_ASSERT(_elem_size > 0);
108 auto type() const noexcept -> pixel_data_type {
112 auto data() const noexcept -> memory::
const_block {
122 :
public image_dimensions
123 ,
public image_pixel_format
124 ,
public image_pixel_data {
127 const image_dimensions& dims,
128 const image_pixel_format& fmt,
129 const image_pixel_data& pix_data) noexcept
130 : image_dimensions(dims)
131 , image_pixel_format(fmt)
132 , image_pixel_data(pix_data) {}
137 #endif // OGLPLUS_UTILS_IMAGE_SPEC_HPP
GLsizei sizei_type
Signed integer size type.
Definition: config.hpp:88
std::ptrdiff_t span_size_t
Signed span size type used by eagine.
Definition: types.hpp:36
@ depth
Depth buffer data.
basic_block< true > const_block
Alias for const byte memory span.
Definition: block.hpp:32
static auto format(std::string &&fmt_str) noexcept -> format_string_and_list< 0 >
Function taking a format string, returning an object for variable specification.
Definition: str_format.hpp:118
auto type_size(const basic_gl_api< A > &, shapes::attrib_data_type) noexcept -> span_size_t
Returns the byte size of a shape attribute data type.