fixes
This commit is contained in:
77
include/assets/dynamic_read_buffers/dynamic_texture_buffer.hpp
Executable file
77
include/assets/dynamic_read_buffers/dynamic_texture_buffer.hpp
Executable file
@@ -0,0 +1,77 @@
|
||||
#pragma once
|
||||
|
||||
#include <cinttypes>
|
||||
#include <bit>
|
||||
#include <memory>
|
||||
#include <algorithm>
|
||||
#include "assets/components/texture_components.hpp"
|
||||
|
||||
class dynamic_texture_buffer {
|
||||
public:
|
||||
using value_type = std::uint8_t;
|
||||
using dim_type = std::int32_t;
|
||||
using size_type = std::make_signed_t<std::size_t>;
|
||||
using difference_type = size_type;
|
||||
using reference = value_type&;
|
||||
using const_reference = const value_type&;
|
||||
using pointer = std::uint8_t*;
|
||||
using const_pointer = const std::uint8_t*;
|
||||
using iterator = pointer;
|
||||
using const_iterator = const_pointer;
|
||||
|
||||
dynamic_texture_buffer() = default;
|
||||
|
||||
dynamic_texture_buffer(
|
||||
std::unique_ptr<value_type>&& data,
|
||||
dim_type width,
|
||||
dim_type height,
|
||||
components::texture::flags components
|
||||
);
|
||||
|
||||
dynamic_texture_buffer(const dynamic_texture_buffer&);
|
||||
|
||||
dynamic_texture_buffer(dynamic_texture_buffer&&) noexcept;
|
||||
|
||||
[[nodiscard]] dynamic_texture_buffer& operator=(const dynamic_texture_buffer&);
|
||||
|
||||
[[nodiscard]] dynamic_texture_buffer& operator=(dynamic_texture_buffer&&) noexcept;
|
||||
|
||||
[[nodiscard]] components::texture::flags components() const;
|
||||
|
||||
[[nodiscard]] dim_type width() const;
|
||||
|
||||
[[nodiscard]] dim_type height() const;
|
||||
|
||||
[[nodiscard]] std::pair<dim_type, dim_type> dimensions() const;
|
||||
|
||||
[[nodiscard]] size_type pixel_count() const;
|
||||
|
||||
[[nodiscard]] size_type component_count() const;
|
||||
|
||||
[[nodiscard]] size_type size() const;
|
||||
|
||||
[[nodiscard]] const_iterator begin() const;
|
||||
|
||||
[[nodiscard]] iterator begin();
|
||||
|
||||
[[nodiscard]] const_iterator end() const;
|
||||
|
||||
[[nodiscard]] iterator end();
|
||||
|
||||
[[nodiscard]] const_iterator cbegin() const;
|
||||
|
||||
[[nodiscard]] const_iterator cend() const;
|
||||
|
||||
[[nodiscard]] const_pointer data() const;
|
||||
|
||||
[[nodiscard]] pointer data();
|
||||
|
||||
private:
|
||||
std::unique_ptr<value_type[]> m_data{ nullptr };
|
||||
dim_type m_width{ 0 }, m_height{ 0 };
|
||||
components::texture::flags m_components{ components::texture::flags::none };
|
||||
};
|
||||
|
||||
#define INCLUDE_DYNAMIC_TEXTURE_DATA_IMPLEMENTATION
|
||||
#include "assets/dynamic_read_buffers/dynamic_texture_buffer.ipp"
|
||||
#undef INCLUDE_DYNAMIC_TEXTURE_DATA_IMPLEMENTATION
|
||||
Reference in New Issue
Block a user