diff --git a/src/ObjCommon/Image/IImageData.h b/src/ObjCommon/Image/IImageData.h new file mode 100644 index 00000000..8c1c1464 --- /dev/null +++ b/src/ObjCommon/Image/IImageData.h @@ -0,0 +1,23 @@ +#pragma once +#include "ImageFormat.h" +#include + +class IImageData +{ +public: + virtual ~IImageData() = default; + + virtual unsigned GetWidth() = 0; + virtual unsigned GetHeight() = 0; + virtual unsigned GetDepth() = 0; + + virtual ImageFormat* GetFormat() = 0; + + virtual size_t GetSizeOfMipLevel(unsigned mipLevel) = 0; + virtual uint8_t* GetDataForMipLevel(unsigned mipLevel) = 0; + + virtual bool HasMipMaps() = 0; + virtual int GetMipMapCount() = 0; + virtual void GenerateMipMaps() = 0; + virtual void DiscardMipMaps() = 0; +}; diff --git a/src/ObjCommon/Image/ImageDataIWI.cpp b/src/ObjCommon/Image/ImageDataIWI.cpp new file mode 100644 index 00000000..e69de29b diff --git a/src/ObjCommon/Image/ImageDataIWI.h b/src/ObjCommon/Image/ImageDataIWI.h new file mode 100644 index 00000000..e5e70a23 --- /dev/null +++ b/src/ObjCommon/Image/ImageDataIWI.h @@ -0,0 +1,16 @@ +#pragma once +#include "IImageData.h" + +class ImageDataIWI final : public IImageData +{ +public: + ImageFormat* GetFormat() override; + + size_t GetSizeOfMipLevel(unsigned mipLevel) override; + uint8_t* GetDataForMipLevel(unsigned mipLevel) override; + + bool HasMipMaps() override; + int GetMipMapCount() override; + void GenerateMipMaps() override; + void DiscardMipMaps() override; +}; diff --git a/src/ObjCommon/Image/ImageFormat.cpp b/src/ObjCommon/Image/ImageFormat.cpp new file mode 100644 index 00000000..e69de29b diff --git a/src/ObjCommon/Image/ImageFormat.h b/src/ObjCommon/Image/ImageFormat.h new file mode 100644 index 00000000..38742145 --- /dev/null +++ b/src/ObjCommon/Image/ImageFormat.h @@ -0,0 +1,19 @@ +#pragma once + +#include + +class IImageFormat +{ +public: + virtual DXGI_FORMAT GetDXGIFormat() = 0; + virtual size_t GetSizeForMipLevel(unsigned mipLevel, unsigned width, unsigned height, unsigned depth); +}; + +class ImageFormat +{ +public: + ImageFormat(unsigned bitPerPixel, unsigned rOffset, unsigned rSize, unsigned gOffset, unsigned gSize, unsigned bOffset, unsigned bSize, unsigned aOffset, unsigned aSize); + + DXGI_FORMAT GetDXGIFormat(); + size_t GetSizeForMipLevel(unsigned mipLevel, unsigned width, unsigned height, unsigned depth); +}; \ No newline at end of file