20 #ifndef ANTKEEPER_GL_IMAGE_HPP
21 #define ANTKEEPER_GL_IMAGE_HPP
65 std::uint32_t mip_level,
66 std::uint32_t offset_x,
67 std::uint32_t offset_y,
68 std::uint32_t offset_z,
73 std::span<std::byte> data
95 std::uint32_t mip_level,
96 std::uint32_t offset_x,
97 std::uint32_t offset_y,
98 std::uint32_t offset_z,
100 std::uint32_t height,
103 std::span<const std::byte> data
124 std::uint32_t src_mip_level,
129 std::uint32_t dst_mip_level,
134 std::uint32_t height,
146 return m_dimensionality;
150 [[nodiscard]]
inline constexpr
bool is_1d() const noexcept
152 return m_dimensionality == 1;
156 [[nodiscard]]
inline constexpr
bool is_2d() const noexcept
158 return m_dimensionality == 2;
162 [[nodiscard]]
inline constexpr
bool is_3d() const noexcept
164 return m_dimensionality == 3;
174 [[nodiscard]]
inline constexpr
const std::array<std::uint32_t, 3>&
get_dimensions() const noexcept
188 return m_array_layers;
192 [[nodiscard]]
inline constexpr std::uint8_t
get_flags() const noexcept
230 std::uint8_t dimensionality,
233 std::uint32_t height,
235 std::uint32_t mip_levels,
236 std::uint32_t array_layers,
241 unsigned int m_gl_texture_target{0};
242 unsigned int m_gl_texture_name{0};
243 std::uint8_t m_dimensionality{0};
245 std::array<std::uint32_t, 3> m_dimensions{0, 0, 0};
246 std::uint32_t m_mip_levels{0};
247 std::uint32_t m_array_layers{0};
248 std::uint8_t m_flags{0};
264 std::uint32_t mip_levels = 1,
265 std::uint32_t array_layers = 1,
266 std::uint32_t flags = 0
281 std::uint32_t height,
282 std::uint32_t mip_levels = 1,
283 std::uint32_t array_layers = 1,
284 std::uint32_t flags = 0
299 std::uint32_t height,
301 std::uint32_t mip_levels = 1,
302 std::uint32_t flags = 0
317 std::uint32_t mip_levels = 1,
318 std::uint32_t array_layers = 6
image_1d(gl::format format, std::uint32_t width, std::uint32_t mip_levels=1, std::uint32_t array_layers=1, std::uint32_t flags=0)
image_2d(gl::format format, std::uint32_t width, std::uint32_t height, std::uint32_t mip_levels=1, std::uint32_t array_layers=1, std::uint32_t flags=0)
image_3d(gl::format format, std::uint32_t width, std::uint32_t height, std::uint32_t depth, std::uint32_t mip_levels=1, std::uint32_t flags=0)
Cube-compatible 2D image.
image_cube(gl::format format, std::uint32_t width, std::uint32_t mip_levels=1, std::uint32_t array_layers=6)
constexpr bool is_cube_compatible() const noexcept
Returns true if the image is cube map compatible, false otherwise.
constexpr const std::array< std::uint32_t, 3 > & get_dimensions() const noexcept
Returns the dimensions of the image.
void read(std::uint32_t mip_level, std::uint32_t offset_x, std::uint32_t offset_y, std::uint32_t offset_z, std::uint32_t width, std::uint32_t height, std::uint32_t depth, gl::format format, std::span< std::byte > data) const
Reads pixel data from the image.
constexpr bool is_2d() const noexcept
Returns true if the image is 2D, false otherwise.
void generate_mipmaps()
Generates mip subimages.
constexpr std::uint8_t get_dimensionality() const noexcept
Returns the dimensionality of the image.
void write(std::uint32_t mip_level, std::uint32_t offset_x, std::uint32_t offset_y, std::uint32_t offset_z, std::uint32_t width, std::uint32_t height, std::uint32_t depth, gl::format format, std::span< const std::byte > data)
Writes pixel data to the image.
virtual ~image()=0
Destructs an image.
constexpr std::uint8_t get_flags() const noexcept
Returns the image flags.
constexpr std::uint32_t get_mip_levels() const noexcept
Returns the number of levels of detail available for minified sampling of the image.
void copy(std::uint32_t src_mip_level, std::uint32_t src_x, std::uint32_t src_y, std::uint32_t src_z, image &dst_image, std::uint32_t dst_mip_level, std::uint32_t dst_x, std::uint32_t dst_y, std::uint32_t dst_z, std::uint32_t width, std::uint32_t height, std::uint32_t depth) const
Copies pixel data from this image into another the image.
image & operator=(const image &)=delete
constexpr bool is_3d() const noexcept
Returns true if the image is 3D, false otherwise.
image & operator=(image &&)=delete
constexpr format get_format() const noexcept
Returns the format and type of the texel blocks contained in the image.
constexpr std::uint32_t get_array_layers() const noexcept
Returns the number of layers in the image.
image(const image &)=delete
constexpr bool is_1d() const noexcept
Returns true if the image is 1D, false otherwise.
Graphics library interface.
@ cube_compatible
Cube map view compatible image.
format
Image and vertex formats.