mirror of
https://github.com/Laupetin/OpenAssetTools.git
synced 2025-04-20 16:15:43 +00:00
ObjCommon: Add Id to ImageFormats to be able to identify predefined formats without comparing pointers
This commit is contained in:
parent
7d809faf07
commit
6b59fcb5fe
@ -1,12 +1,29 @@
|
|||||||
#include "ImageFormat.h"
|
#include "ImageFormat.h"
|
||||||
|
|
||||||
ImageFormatUnsigned::ImageFormatUnsigned(const unsigned bitPerPixel, const unsigned rOffset, const unsigned rSize,
|
|
||||||
|
ImageFormat::ImageFormat(const ImageFormatId id, const DXGI_FORMAT dxgiFormat)
|
||||||
|
{
|
||||||
|
m_id = id;
|
||||||
|
m_dxgi_format = dxgiFormat;
|
||||||
|
}
|
||||||
|
|
||||||
|
ImageFormatId ImageFormat::GetId() const
|
||||||
|
{
|
||||||
|
return m_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
DXGI_FORMAT ImageFormat::GetDxgiFormat() const
|
||||||
|
{
|
||||||
|
return m_dxgi_format;
|
||||||
|
}
|
||||||
|
|
||||||
|
ImageFormatUnsigned::ImageFormatUnsigned(const ImageFormatId id, const DXGI_FORMAT dxgiFormat,
|
||||||
|
const unsigned bitPerPixel, const unsigned rOffset, const unsigned rSize,
|
||||||
const unsigned gOffset, const unsigned gSize, const unsigned bOffset,
|
const unsigned gOffset, const unsigned gSize, const unsigned bOffset,
|
||||||
const unsigned bSize, const unsigned aOffset, const unsigned aSize,
|
const unsigned bSize, const unsigned aOffset, const unsigned aSize)
|
||||||
DXGI_FORMAT dxgiFormat)
|
: ImageFormat(id, dxgiFormat)
|
||||||
{
|
{
|
||||||
m_bit_per_pixel = bitPerPixel;
|
m_bit_per_pixel = bitPerPixel;
|
||||||
m_dxgi_format = dxgiFormat;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ImageFormatType ImageFormatUnsigned::GetType() const
|
ImageFormatType ImageFormatUnsigned::GetType() const
|
||||||
@ -14,11 +31,6 @@ ImageFormatType ImageFormatUnsigned::GetType() const
|
|||||||
return ImageFormatType::UNSIGNED;
|
return ImageFormatType::UNSIGNED;
|
||||||
}
|
}
|
||||||
|
|
||||||
DXGI_FORMAT ImageFormatUnsigned::GetDXGIFormat() const
|
|
||||||
{
|
|
||||||
return m_dxgi_format;
|
|
||||||
}
|
|
||||||
|
|
||||||
size_t ImageFormatUnsigned::GetSizeOfMipLevel(const unsigned mipLevel, const unsigned width, const unsigned height,
|
size_t ImageFormatUnsigned::GetSizeOfMipLevel(const unsigned mipLevel, const unsigned width, const unsigned height,
|
||||||
const unsigned depth) const
|
const unsigned depth) const
|
||||||
{
|
{
|
||||||
@ -36,12 +48,12 @@ size_t ImageFormatUnsigned::GetSizeOfMipLevel(const unsigned mipLevel, const uns
|
|||||||
return mipWidth * mipHeight * mipDepth * m_bit_per_pixel / 8;
|
return mipWidth * mipHeight * mipDepth * m_bit_per_pixel / 8;
|
||||||
}
|
}
|
||||||
|
|
||||||
ImageFormatBlockCompressed::ImageFormatBlockCompressed(const unsigned blockSize, const unsigned bitsPerBlock,
|
ImageFormatBlockCompressed::ImageFormatBlockCompressed(const ImageFormatId id, const DXGI_FORMAT dxgiFormat,
|
||||||
DXGI_FORMAT dxgiFormat)
|
const unsigned blockSize, const unsigned bitsPerBlock)
|
||||||
|
: ImageFormat(id, dxgiFormat)
|
||||||
{
|
{
|
||||||
m_block_size = blockSize;
|
m_block_size = blockSize;
|
||||||
m_bits_per_block = bitsPerBlock;
|
m_bits_per_block = bitsPerBlock;
|
||||||
m_dxgi_format = dxgiFormat;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ImageFormatType ImageFormatBlockCompressed::GetType() const
|
ImageFormatType ImageFormatBlockCompressed::GetType() const
|
||||||
@ -49,11 +61,6 @@ ImageFormatType ImageFormatBlockCompressed::GetType() const
|
|||||||
return ImageFormatType::BLOCK_COMPRESSED;
|
return ImageFormatType::BLOCK_COMPRESSED;
|
||||||
}
|
}
|
||||||
|
|
||||||
DXGI_FORMAT ImageFormatBlockCompressed::GetDXGIFormat() const
|
|
||||||
{
|
|
||||||
return m_dxgi_format;
|
|
||||||
}
|
|
||||||
|
|
||||||
size_t ImageFormatBlockCompressed::GetSizeOfMipLevel(const unsigned mipLevel, const unsigned width,
|
size_t ImageFormatBlockCompressed::GetSizeOfMipLevel(const unsigned mipLevel, const unsigned width,
|
||||||
const unsigned height, const unsigned depth) const
|
const unsigned height, const unsigned depth) const
|
||||||
{
|
{
|
||||||
@ -75,12 +82,17 @@ size_t ImageFormatBlockCompressed::GetSizeOfMipLevel(const unsigned mipLevel, co
|
|||||||
return blockCount * m_bits_per_block / 8;
|
return blockCount * m_bits_per_block / 8;
|
||||||
}
|
}
|
||||||
|
|
||||||
const ImageFormatUnsigned ImageFormat::FORMAT_R8G8B8(24, 0, 8, 8, 8, 16, 8, 0, 0, DXGI_FORMAT_UNKNOWN);
|
const ImageFormatUnsigned ImageFormat::FORMAT_R8_G8_B8(ImageFormatId::R8_G8_B8, DXGI_FORMAT_UNKNOWN,
|
||||||
const ImageFormatUnsigned ImageFormat::FORMAT_R8G8B8A8(32, 0, 8, 8, 8, 16, 8, 24, 8, DXGI_FORMAT_R8G8B8A8_UNORM);
|
24, 0, 8, 8, 8, 16, 8, 0, 0);
|
||||||
const ImageFormatUnsigned ImageFormat::FORMAT_A8(8, 0, 0, 0, 0, 0, 0, 0, 8, DXGI_FORMAT_A8_UNORM);
|
const ImageFormatUnsigned ImageFormat::FORMAT_R8_G8_B8_A8(ImageFormatId::R8_G8_B8_A8, DXGI_FORMAT_R8G8B8A8_UNORM,
|
||||||
const ImageFormatUnsigned ImageFormat::FORMAT_R16G16B16A16_FLOAT(128, 0, 0, 0, 0, 0, 0, 0, 8, DXGI_FORMAT_R16G16B16A16_FLOAT);
|
32, 0, 8, 8, 8, 16, 8, 24, 8);
|
||||||
const ImageFormatBlockCompressed ImageFormat::FORMAT_BC1(4, 64, DXGI_FORMAT_BC1_UNORM);
|
const ImageFormatUnsigned ImageFormat::FORMAT_A8(ImageFormatId::A8, DXGI_FORMAT_A8_UNORM,
|
||||||
const ImageFormatBlockCompressed ImageFormat::FORMAT_BC2(4, 128, DXGI_FORMAT_BC2_UNORM);
|
8, 0, 0, 0, 0, 0, 0, 0, 8);
|
||||||
const ImageFormatBlockCompressed ImageFormat::FORMAT_BC3(4, 128, DXGI_FORMAT_BC3_UNORM);
|
const ImageFormatUnsigned ImageFormat::FORMAT_R16_G16_B16_A16_FLOAT(ImageFormatId::R16_G16_B16_A16_FLOAT,
|
||||||
const ImageFormatBlockCompressed ImageFormat::FORMAT_BC4(4, 64, DXGI_FORMAT_BC4_UNORM);
|
DXGI_FORMAT_R16G16B16A16_FLOAT,
|
||||||
const ImageFormatBlockCompressed ImageFormat::FORMAT_BC5(4, 128, DXGI_FORMAT_BC5_UNORM);
|
128, 0, 0, 0, 0, 0, 0, 0, 8);
|
||||||
|
const ImageFormatBlockCompressed ImageFormat::FORMAT_BC1(ImageFormatId::BC1, DXGI_FORMAT_BC1_UNORM, 4, 64);
|
||||||
|
const ImageFormatBlockCompressed ImageFormat::FORMAT_BC2(ImageFormatId::BC2, DXGI_FORMAT_BC2_UNORM, 4, 128);
|
||||||
|
const ImageFormatBlockCompressed ImageFormat::FORMAT_BC3(ImageFormatId::BC3, DXGI_FORMAT_BC3_UNORM, 4, 128);
|
||||||
|
const ImageFormatBlockCompressed ImageFormat::FORMAT_BC4(ImageFormatId::BC4, DXGI_FORMAT_BC4_UNORM, 4, 64);
|
||||||
|
const ImageFormatBlockCompressed ImageFormat::FORMAT_BC5(ImageFormatId::BC5, DXGI_FORMAT_BC5_UNORM, 4, 128);
|
||||||
|
@ -2,6 +2,20 @@
|
|||||||
|
|
||||||
#include <dxgiformat.h>
|
#include <dxgiformat.h>
|
||||||
|
|
||||||
|
enum class ImageFormatId
|
||||||
|
{
|
||||||
|
UNKNOWN,
|
||||||
|
R8_G8_B8,
|
||||||
|
R8_G8_B8_A8,
|
||||||
|
A8,
|
||||||
|
R16_G16_B16_A16_FLOAT,
|
||||||
|
BC1,
|
||||||
|
BC2,
|
||||||
|
BC3,
|
||||||
|
BC4,
|
||||||
|
BC5
|
||||||
|
};
|
||||||
|
|
||||||
enum class ImageFormatType
|
enum class ImageFormatType
|
||||||
{
|
{
|
||||||
UNKNOWN,
|
UNKNOWN,
|
||||||
@ -9,56 +23,58 @@ enum class ImageFormatType
|
|||||||
BLOCK_COMPRESSED
|
BLOCK_COMPRESSED
|
||||||
};
|
};
|
||||||
|
|
||||||
class IImageFormat
|
class ImageFormatUnsigned;
|
||||||
{
|
class ImageFormatBlockCompressed;
|
||||||
public:
|
|
||||||
virtual ~IImageFormat() = default;
|
|
||||||
|
|
||||||
virtual ImageFormatType GetType() const = 0;
|
|
||||||
virtual DXGI_FORMAT GetDXGIFormat() const = 0;
|
|
||||||
virtual size_t GetSizeOfMipLevel(unsigned mipLevel, unsigned width, unsigned height, unsigned depth) const = 0;
|
|
||||||
};
|
|
||||||
|
|
||||||
class ImageFormatUnsigned final : public IImageFormat
|
|
||||||
{
|
|
||||||
unsigned m_bit_per_pixel;
|
|
||||||
DXGI_FORMAT m_dxgi_format;
|
|
||||||
|
|
||||||
public:
|
|
||||||
ImageFormatUnsigned(unsigned bitPerPixel, unsigned rOffset, unsigned rSize, unsigned gOffset, unsigned gSize,
|
|
||||||
unsigned bOffset, unsigned bSize, unsigned aOffset, unsigned aSize, DXGI_FORMAT dxgiFormat);
|
|
||||||
|
|
||||||
ImageFormatType GetType() const override;
|
|
||||||
DXGI_FORMAT GetDXGIFormat() const override;
|
|
||||||
size_t GetSizeOfMipLevel(unsigned mipLevel, unsigned width, unsigned height, unsigned depth) const override;
|
|
||||||
};
|
|
||||||
|
|
||||||
class ImageFormatBlockCompressed final : public IImageFormat
|
|
||||||
{
|
|
||||||
unsigned m_block_size;
|
|
||||||
unsigned m_bits_per_block;
|
|
||||||
DXGI_FORMAT m_dxgi_format;
|
|
||||||
|
|
||||||
public:
|
|
||||||
ImageFormatBlockCompressed(unsigned blockSize, unsigned bitsPerBlock, DXGI_FORMAT dxgiFormat);
|
|
||||||
|
|
||||||
ImageFormatType GetType() const override;
|
|
||||||
DXGI_FORMAT GetDXGIFormat() const override;
|
|
||||||
size_t GetSizeOfMipLevel(unsigned mipLevel, unsigned width, unsigned height, unsigned depth) const override;
|
|
||||||
};
|
|
||||||
|
|
||||||
class ImageFormat
|
class ImageFormat
|
||||||
{
|
{
|
||||||
public:
|
ImageFormatId m_id;
|
||||||
ImageFormat() = delete;
|
DXGI_FORMAT m_dxgi_format;
|
||||||
|
|
||||||
static const ImageFormatUnsigned FORMAT_R8G8B8;
|
protected:
|
||||||
static const ImageFormatUnsigned FORMAT_R8G8B8A8;
|
ImageFormat(ImageFormatId id, DXGI_FORMAT dxgiFormat);
|
||||||
|
|
||||||
|
public:
|
||||||
|
virtual ~ImageFormat() = default;
|
||||||
|
|
||||||
|
ImageFormatId GetId() const;
|
||||||
|
DXGI_FORMAT GetDxgiFormat() const;
|
||||||
|
|
||||||
|
virtual ImageFormatType GetType() const = 0;
|
||||||
|
virtual size_t GetSizeOfMipLevel(unsigned mipLevel, unsigned width, unsigned height, unsigned depth) const = 0;
|
||||||
|
|
||||||
|
static const ImageFormatUnsigned FORMAT_R8_G8_B8;
|
||||||
|
static const ImageFormatUnsigned FORMAT_R8_G8_B8_A8;
|
||||||
static const ImageFormatUnsigned FORMAT_A8;
|
static const ImageFormatUnsigned FORMAT_A8;
|
||||||
static const ImageFormatUnsigned FORMAT_R16G16B16A16_FLOAT; //TODO: Float not unsigned
|
static const ImageFormatUnsigned FORMAT_R16_G16_B16_A16_FLOAT; //TODO: Float not unsigned
|
||||||
static const ImageFormatBlockCompressed FORMAT_BC1;
|
static const ImageFormatBlockCompressed FORMAT_BC1;
|
||||||
static const ImageFormatBlockCompressed FORMAT_BC2;
|
static const ImageFormatBlockCompressed FORMAT_BC2;
|
||||||
static const ImageFormatBlockCompressed FORMAT_BC3;
|
static const ImageFormatBlockCompressed FORMAT_BC3;
|
||||||
static const ImageFormatBlockCompressed FORMAT_BC4;
|
static const ImageFormatBlockCompressed FORMAT_BC4;
|
||||||
static const ImageFormatBlockCompressed FORMAT_BC5;
|
static const ImageFormatBlockCompressed FORMAT_BC5;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class ImageFormatUnsigned final : public ImageFormat
|
||||||
|
{
|
||||||
|
unsigned m_bit_per_pixel;
|
||||||
|
|
||||||
|
public:
|
||||||
|
ImageFormatUnsigned(ImageFormatId id, DXGI_FORMAT dxgiFormat, unsigned bitPerPixel, unsigned rOffset,
|
||||||
|
unsigned rSize, unsigned gOffset, unsigned gSize, unsigned bOffset, unsigned bSize,
|
||||||
|
unsigned aOffset, unsigned aSize);
|
||||||
|
|
||||||
|
ImageFormatType GetType() const override;
|
||||||
|
size_t GetSizeOfMipLevel(unsigned mipLevel, unsigned width, unsigned height, unsigned depth) const override;
|
||||||
|
};
|
||||||
|
|
||||||
|
class ImageFormatBlockCompressed final : public ImageFormat
|
||||||
|
{
|
||||||
|
unsigned m_block_size;
|
||||||
|
unsigned m_bits_per_block;
|
||||||
|
|
||||||
|
public:
|
||||||
|
ImageFormatBlockCompressed(ImageFormatId id, DXGI_FORMAT dxgiFormat, unsigned blockSize, unsigned bitsPerBlock);
|
||||||
|
|
||||||
|
ImageFormatType GetType() const override;
|
||||||
|
size_t GetSizeOfMipLevel(unsigned mipLevel, unsigned width, unsigned height, unsigned depth) const override;
|
||||||
|
};
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
// ==============================================
|
// ==============================================
|
||||||
// ================= Texture ====================
|
// ================= Texture ====================
|
||||||
// ==============================================
|
// ==============================================
|
||||||
Texture::Texture(const IImageFormat* format, const bool mipMaps)
|
Texture::Texture(const ImageFormat* format, const bool mipMaps)
|
||||||
{
|
{
|
||||||
m_format = format;
|
m_format = format;
|
||||||
m_has_mip_maps = mipMaps;
|
m_has_mip_maps = mipMaps;
|
||||||
@ -38,7 +38,7 @@ Texture::~Texture()
|
|||||||
m_data = nullptr;
|
m_data = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
const IImageFormat* Texture::GetFormat() const
|
const ImageFormat* Texture::GetFormat() const
|
||||||
{
|
{
|
||||||
return m_format;
|
return m_format;
|
||||||
}
|
}
|
||||||
@ -73,12 +73,12 @@ bool Texture::HasMipMaps() const
|
|||||||
// ==============================================
|
// ==============================================
|
||||||
// ================ Texture2D ===================
|
// ================ Texture2D ===================
|
||||||
// ==============================================
|
// ==============================================
|
||||||
Texture2D::Texture2D(const IImageFormat* format, const unsigned width, const unsigned height)
|
Texture2D::Texture2D(const ImageFormat* format, const unsigned width, const unsigned height)
|
||||||
: Texture2D(format, width, height, false)
|
: Texture2D(format, width, height, false)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
Texture2D::Texture2D(const IImageFormat* format, const unsigned width, const unsigned height, const bool mipMaps)
|
Texture2D::Texture2D(const ImageFormat* format, const unsigned width, const unsigned height, const bool mipMaps)
|
||||||
: Texture(format, mipMaps)
|
: Texture(format, mipMaps)
|
||||||
{
|
{
|
||||||
m_width = width;
|
m_width = width;
|
||||||
@ -162,12 +162,12 @@ uint8_t* Texture2D::GetBufferForMipLevel(const int mipLevel)
|
|||||||
// ==============================================
|
// ==============================================
|
||||||
const int TextureCube::FACE_COUNT = 6;
|
const int TextureCube::FACE_COUNT = 6;
|
||||||
|
|
||||||
TextureCube::TextureCube(const IImageFormat* format, const unsigned width, const unsigned height)
|
TextureCube::TextureCube(const ImageFormat* format, const unsigned width, const unsigned height)
|
||||||
: Texture2D(format, width, height)
|
: Texture2D(format, width, height)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
TextureCube::TextureCube(const IImageFormat* format, const unsigned width, const unsigned height, const bool mipMaps)
|
TextureCube::TextureCube(const ImageFormat* format, const unsigned width, const unsigned height, const bool mipMaps)
|
||||||
: Texture2D(format, width, height, mipMaps)
|
: Texture2D(format, width, height, mipMaps)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@ -198,12 +198,12 @@ size_t TextureCube::GetSizeOfMipLevel(const int mipLevel) const
|
|||||||
// ================ Texture3D ===================
|
// ================ Texture3D ===================
|
||||||
// ==============================================
|
// ==============================================
|
||||||
|
|
||||||
Texture3D::Texture3D(const IImageFormat* format, const unsigned width, const unsigned height, const unsigned depth)
|
Texture3D::Texture3D(const ImageFormat* format, const unsigned width, const unsigned height, const unsigned depth)
|
||||||
: Texture3D(format, width, height, depth, false)
|
: Texture3D(format, width, height, depth, false)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
Texture3D::Texture3D(const IImageFormat* format, const unsigned width, const unsigned height, const unsigned depth,
|
Texture3D::Texture3D(const ImageFormat* format, const unsigned width, const unsigned height, const unsigned depth,
|
||||||
const bool mipMaps)
|
const bool mipMaps)
|
||||||
: Texture(format, mipMaps)
|
: Texture(format, mipMaps)
|
||||||
{
|
{
|
||||||
|
@ -5,11 +5,11 @@
|
|||||||
class Texture
|
class Texture
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
const IImageFormat* m_format;
|
const ImageFormat* m_format;
|
||||||
bool m_has_mip_maps;
|
bool m_has_mip_maps;
|
||||||
uint8_t* m_data;
|
uint8_t* m_data;
|
||||||
|
|
||||||
Texture(const IImageFormat* format, bool mipMaps);
|
Texture(const ImageFormat* format, bool mipMaps);
|
||||||
Texture(Texture&& other) noexcept;
|
Texture(Texture&& other) noexcept;
|
||||||
|
|
||||||
Texture& operator=(Texture&& other) noexcept;
|
Texture& operator=(Texture&& other) noexcept;
|
||||||
@ -20,7 +20,7 @@ public:
|
|||||||
|
|
||||||
Texture& operator=(const Texture& other) = delete;
|
Texture& operator=(const Texture& other) = delete;
|
||||||
|
|
||||||
const IImageFormat* GetFormat() const;
|
const ImageFormat* GetFormat() const;
|
||||||
|
|
||||||
void Allocate();
|
void Allocate();
|
||||||
bool Empty() const;
|
bool Empty() const;
|
||||||
@ -39,8 +39,8 @@ protected:
|
|||||||
unsigned m_height;
|
unsigned m_height;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Texture2D(const IImageFormat* format, unsigned width, unsigned height);
|
Texture2D(const ImageFormat* format, unsigned width, unsigned height);
|
||||||
Texture2D(const IImageFormat* format, unsigned width, unsigned height, bool mipMaps);
|
Texture2D(const ImageFormat* format, unsigned width, unsigned height, bool mipMaps);
|
||||||
Texture2D(const Texture2D& other) = delete;
|
Texture2D(const Texture2D& other) = delete;
|
||||||
Texture2D(Texture2D&& other) noexcept;
|
Texture2D(Texture2D&& other) noexcept;
|
||||||
~Texture2D() override;
|
~Texture2D() override;
|
||||||
@ -62,8 +62,8 @@ class TextureCube final : public Texture2D
|
|||||||
static const int FACE_COUNT;
|
static const int FACE_COUNT;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
TextureCube(const IImageFormat* format, unsigned width, unsigned height);
|
TextureCube(const ImageFormat* format, unsigned width, unsigned height);
|
||||||
TextureCube(const IImageFormat* format, unsigned width, unsigned height, bool mipMaps);
|
TextureCube(const ImageFormat* format, unsigned width, unsigned height, bool mipMaps);
|
||||||
TextureCube(const TextureCube& other) = delete;
|
TextureCube(const TextureCube& other) = delete;
|
||||||
TextureCube(TextureCube&& other) noexcept;
|
TextureCube(TextureCube&& other) noexcept;
|
||||||
~TextureCube() override;
|
~TextureCube() override;
|
||||||
@ -81,8 +81,8 @@ class Texture3D final : public Texture
|
|||||||
unsigned m_depth;
|
unsigned m_depth;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Texture3D(const IImageFormat* format, unsigned width, unsigned height, unsigned depth);
|
Texture3D(const ImageFormat* format, unsigned width, unsigned height, unsigned depth);
|
||||||
Texture3D(const IImageFormat* format, unsigned width, unsigned height, unsigned depth, bool mipMaps);
|
Texture3D(const ImageFormat* format, unsigned width, unsigned height, unsigned depth, bool mipMaps);
|
||||||
Texture3D(const Texture3D& other) = delete;
|
Texture3D(const Texture3D& other) = delete;
|
||||||
Texture3D(Texture3D&& other) noexcept;
|
Texture3D(Texture3D&& other) noexcept;
|
||||||
~Texture3D() override;
|
~Texture3D() override;
|
||||||
|
@ -7,12 +7,12 @@ IwiLoader::IwiLoader(MemoryManager* memoryManager)
|
|||||||
m_memory_manager = memoryManager;
|
m_memory_manager = memoryManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
const IImageFormat* IwiLoader::GetFormat27(int8_t format)
|
const ImageFormat* IwiLoader::GetFormat27(int8_t format)
|
||||||
{
|
{
|
||||||
switch (static_cast<iwi27::IwiFormat>(format))
|
switch (static_cast<iwi27::IwiFormat>(format))
|
||||||
{
|
{
|
||||||
case iwi27::IwiFormat::IMG_FORMAT_BITMAP_RGBA:
|
case iwi27::IwiFormat::IMG_FORMAT_BITMAP_RGBA:
|
||||||
return &ImageFormat::FORMAT_R8G8B8A8;
|
return &ImageFormat::FORMAT_R8_G8_B8_A8;
|
||||||
case iwi27::IwiFormat::IMG_FORMAT_BITMAP_ALPHA:
|
case iwi27::IwiFormat::IMG_FORMAT_BITMAP_ALPHA:
|
||||||
return &ImageFormat::FORMAT_A8;
|
return &ImageFormat::FORMAT_A8;
|
||||||
case iwi27::IwiFormat::IMG_FORMAT_DXT1:
|
case iwi27::IwiFormat::IMG_FORMAT_DXT1:
|
||||||
@ -25,7 +25,7 @@ const IImageFormat* IwiLoader::GetFormat27(int8_t format)
|
|||||||
return &ImageFormat::FORMAT_BC5;
|
return &ImageFormat::FORMAT_BC5;
|
||||||
case iwi27::IwiFormat::IMG_FORMAT_A16B16G16R16F:
|
case iwi27::IwiFormat::IMG_FORMAT_A16B16G16R16F:
|
||||||
assert(false); // Unsupported yet
|
assert(false); // Unsupported yet
|
||||||
return &ImageFormat::FORMAT_R16G16B16A16_FLOAT;
|
return &ImageFormat::FORMAT_R16_G16_B16_A16_FLOAT;
|
||||||
case iwi27::IwiFormat::IMG_FORMAT_BITMAP_RGB:
|
case iwi27::IwiFormat::IMG_FORMAT_BITMAP_RGB:
|
||||||
case iwi27::IwiFormat::IMG_FORMAT_BITMAP_LUMINANCE_ALPHA:
|
case iwi27::IwiFormat::IMG_FORMAT_BITMAP_LUMINANCE_ALPHA:
|
||||||
case iwi27::IwiFormat::IMG_FORMAT_BITMAP_LUMINANCE:
|
case iwi27::IwiFormat::IMG_FORMAT_BITMAP_LUMINANCE:
|
||||||
@ -55,7 +55,7 @@ Texture* IwiLoader::LoadIwi27(FileAPI::IFile* file)
|
|||||||
if (file->Read(&header, sizeof header, 1) != 1)
|
if (file->Read(&header, sizeof header, 1) != 1)
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
const IImageFormat* format = GetFormat27(header.format);
|
const ImageFormat* format = GetFormat27(header.format);
|
||||||
if (format == nullptr)
|
if (format == nullptr)
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@ class IwiLoader
|
|||||||
{
|
{
|
||||||
MemoryManager* m_memory_manager;
|
MemoryManager* m_memory_manager;
|
||||||
|
|
||||||
const IImageFormat* GetFormat27(int8_t format);
|
static const ImageFormat* GetFormat27(int8_t format);
|
||||||
Texture* LoadIwi27(FileAPI::IFile* file);
|
Texture* LoadIwi27(FileAPI::IFile* file);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user