33#ifndef DVD_UTILITY_IMAGETOOLS_H
34#define DVD_UTILITY_IMAGETOOLS_H
56 const size_t totalSizeTest =
to_size(width) * height * depth * numComponents;
57 const size_t actualSize = std::max(len, totalSizeTest);
59 _data.resize(actualSize, T{ 0u });
63 if (
data !=
nullptr )
65 std::memcpy(
_data.data(),
data, len == 0u ? totalSizeTest : len *
sizeof( T ) );
69 std::memset(
_data.data(), 0u, len == 0u ? totalSizeTest : len * sizeof ( T ));
88 _mips.emplace_back(std::make_unique<
ImageMip<T>>(
data, len, width, height, depth, numComponents));
89 return static_cast<T*
>(
_mips.back()->data());
93 [[nodiscard]] T*
allocateMip(
const size_t len,
const U16 width,
const U16 height,
const U16 depth,
const U8 numComponents) {
94 return allocateMip<T>(
nullptr, len, width, height, depth, numComponents);
98 if (
_mips.size() <= mip) {
102 return _mips[mip]->data();
106 if (mip <
_mips.size()) {
107 return _mips[mip].get();
130 return _layers[layer].data(mipLevel);
143 assert(layer <
_layers.size());
145 return _layers[layer].getMip(mipLevel)->_dimensions;
155 [[nodiscard]]
const std::string_view
name() const noexcept {
return _name; }
void set(const T *v) noexcept
set the 3 components of the vector manually using a source pointer to a (large enough) array
Handle console commands that start with a forward slash.
constexpr U16 to_U16(const T value)
eastl::vector< Type > vector
constexpr U8 to_U8(const T value)
constexpr size_t to_size(const T value)