diff --git a/examples/Particles/LogoDemo.cpp b/examples/Particles/LogoDemo.cpp index cb2509500..23698cd66 100644 --- a/examples/Particles/LogoDemo.cpp +++ b/examples/Particles/LogoDemo.cpp @@ -124,7 +124,7 @@ LogoExample::LogoExample(ExampleShared& sharedData) : ParticleDemo("Logo", sharedData) { Nz::ImageParams params; - params.loadFormat = Nz::PixelFormatType_RGBA8; + params.loadFormat = Nz::PixelFormat_RGBA8; m_logo = Nz::Image::LoadFromFile("E:/Twitch/avatar_interested.png", params); if (!m_logo) diff --git a/examples/Particles/SpacebattleDemo.cpp b/examples/Particles/SpacebattleDemo.cpp index d0c9e2749..2607c649e 100644 --- a/examples/Particles/SpacebattleDemo.cpp +++ b/examples/Particles/SpacebattleDemo.cpp @@ -294,7 +294,7 @@ ParticleDemo("Space battle", sharedData) } Nz::TextureRef skyboxCubemap = Nz::Texture::New(); - if (skyboxCubemap->Create(Nz::ImageType_Cubemap, Nz::PixelFormatType_RGBA8, 2048, 2048)) + if (skyboxCubemap->Create(Nz::ImageType_Cubemap, Nz::PixelFormat_RGBA8, 2048, 2048)) { skyboxCubemap->LoadFaceFromFile(Nz::CubemapFace_PositiveX, "resources/purple_nebula_skybox/purple_nebula_skybox_right1.png"); skyboxCubemap->LoadFaceFromFile(Nz::CubemapFace_PositiveY, "resources/purple_nebula_skybox/purple_nebula_skybox_top3.png"); diff --git a/examples/Particles/main.cpp b/examples/Particles/main.cpp index e31bfeb88..ea49c4abf 100644 --- a/examples/Particles/main.cpp +++ b/examples/Particles/main.cpp @@ -169,7 +169,7 @@ int main() case Nz::Keyboard::F5: { Nz::Image screenshot; - screenshot.Create(Nz::ImageType_2D, Nz::PixelFormatType_RGBA8, 1920, 1080); + screenshot.Create(Nz::ImageType_2D, Nz::PixelFormat_RGBA8, 1920, 1080); window.CopyToImage(&screenshot); static unsigned int counter = 1; diff --git a/examples/VulkanTest/main.cpp b/examples/VulkanTest/main.cpp index 14d124da4..1e910ec81 100644 --- a/examples/VulkanTest/main.cpp +++ b/examples/VulkanTest/main.cpp @@ -116,7 +116,7 @@ int main() // Texture Nz::ImageRef drfreakImage = Nz::Image::LoadFromFile("resources/Spaceship/Texture/diffuse.png"); - if (!drfreakImage || !drfreakImage->Convert(Nz::PixelFormatType_RGBA8)) + if (!drfreakImage || !drfreakImage->Convert(Nz::PixelFormat_RGBA8)) { NazaraError("Failed to load image"); return __LINE__; diff --git a/include/Nazara/Graphics/Light.hpp b/include/Nazara/Graphics/Light.hpp index 8c9410d96..a7b26ab17 100644 --- a/include/Nazara/Graphics/Light.hpp +++ b/include/Nazara/Graphics/Light.hpp @@ -47,7 +47,7 @@ namespace Nz inline float GetOuterAngleTangent() const; inline float GetRadius() const; inline TextureRef GetShadowMap() const; - inline PixelFormatType GetShadowMapFormat() const; + inline PixelFormat GetShadowMapFormat() const; inline const Vector2ui& GetShadowMapSize() const; inline bool IsShadowCastingEnabled() const; @@ -60,7 +60,7 @@ namespace Nz inline void SetLightType(LightType type); inline void SetOuterAngle(float outerAngle); inline void SetRadius(float radius); - inline void SetShadowMapFormat(PixelFormatType shadowFormat); + inline void SetShadowMapFormat(PixelFormat shadowFormat); inline void SetShadowMapSize(const Vector2ui& size); void UpdateBoundingVolume(const Matrix4f& transformMatrix) override; @@ -75,7 +75,7 @@ namespace Nz Color m_color; LightType m_type; - PixelFormatType m_shadowMapFormat; + PixelFormat m_shadowMapFormat; Vector2ui m_shadowMapSize; mutable TextureRef m_shadowMap; bool m_shadowCastingEnabled; diff --git a/include/Nazara/Graphics/Light.inl b/include/Nazara/Graphics/Light.inl index e3fb3f78f..103445958 100644 --- a/include/Nazara/Graphics/Light.inl +++ b/include/Nazara/Graphics/Light.inl @@ -194,7 +194,7 @@ namespace Nz * \return Shadow map format */ - inline PixelFormatType Light::GetShadowMapFormat() const + inline PixelFormat Light::GetShadowMapFormat() const { return m_shadowMapFormat; } @@ -331,9 +331,9 @@ namespace Nz * \remark Produces a NazaraAssert if format is not a depth type */ - inline void Light::SetShadowMapFormat(PixelFormatType shadowFormat) + inline void Light::SetShadowMapFormat(PixelFormat shadowFormat) { - NazaraAssert(PixelFormat::GetContent(shadowFormat) == PixelFormatContent_DepthStencil, "Shadow format type is not a depth format"); + NazaraAssert(PixelFormatInfo::GetContent(shadowFormat) == PixelFormatContent_DepthStencil, "Shadow format type is not a depth format"); m_shadowMapFormat = shadowFormat; diff --git a/include/Nazara/Renderer/RenderWindowParameters.hpp b/include/Nazara/Renderer/RenderWindowParameters.hpp index 4a32196c6..9c7fcb576 100644 --- a/include/Nazara/Renderer/RenderWindowParameters.hpp +++ b/include/Nazara/Renderer/RenderWindowParameters.hpp @@ -15,7 +15,7 @@ namespace Nz { struct RenderWindowParameters { - std::vector depthFormats = {Nz::PixelFormatType_Depth32, Nz::PixelFormatType_Depth24}; //< By order of preference + std::vector depthFormats = {Nz::PixelFormat_Depth32, Nz::PixelFormat_Depth24}; //< By order of preference bool verticalSync = false; }; } diff --git a/include/Nazara/Renderer/Texture.hpp b/include/Nazara/Renderer/Texture.hpp index 4d9776879..6aa8502b8 100644 --- a/include/Nazara/Renderer/Texture.hpp +++ b/include/Nazara/Renderer/Texture.hpp @@ -17,7 +17,7 @@ namespace Nz { struct TextureInfo { - PixelFormatType pixelFormat; + PixelFormat pixelFormat; ImageType type; unsigned int depth = 1; unsigned int height; @@ -33,7 +33,7 @@ namespace Nz Texture(Texture&&) = delete; virtual ~Texture(); - virtual PixelFormatType GetFormat() const = 0; + virtual PixelFormat GetFormat() const = 0; virtual UInt8 GetLevelCount() const = 0; virtual Vector3ui GetSize(UInt8 level = 0) const = 0; virtual ImageType GetType() const = 0; diff --git a/include/Nazara/Utility/AbstractImage.hpp b/include/Nazara/Utility/AbstractImage.hpp index d325f660f..44ee7d4f8 100644 --- a/include/Nazara/Utility/AbstractImage.hpp +++ b/include/Nazara/Utility/AbstractImage.hpp @@ -31,7 +31,7 @@ namespace Nz UInt8 GetBytesPerPixel() const; virtual unsigned int GetDepth(UInt8 level = 0) const = 0; - virtual PixelFormatType GetFormat() const = 0; + virtual PixelFormat GetFormat() const = 0; virtual unsigned int GetHeight(UInt8 level = 0) const = 0; virtual UInt8 GetLevelCount() const = 0; virtual UInt8 GetMaxLevel() const = 0; diff --git a/include/Nazara/Utility/Enums.hpp b/include/Nazara/Utility/Enums.hpp index 602c60f0f..7ac18a697 100644 --- a/include/Nazara/Utility/Enums.hpp +++ b/include/Nazara/Utility/Enums.hpp @@ -165,64 +165,64 @@ namespace Nz PixelFormatContent_Max = PixelFormatContent_Stencil }; - enum PixelFormatType + enum PixelFormat { - PixelFormatType_Undefined = -1, + PixelFormat_Undefined = -1, - PixelFormatType_A8, // 1*uint8 - PixelFormatType_BGR8, // 3*uint8 - PixelFormatType_BGRA8, // 4*uint8 - PixelFormatType_DXT1, - PixelFormatType_DXT3, - PixelFormatType_DXT5, - PixelFormatType_L8, // 1*uint8 - PixelFormatType_LA8, // 2*uint8 - PixelFormatType_R8, // 1*uint8 - PixelFormatType_R8I, // 1*int8 - PixelFormatType_R8UI, // 1*uint8 - PixelFormatType_R16, // 1*uint16 - PixelFormatType_R16F, // 1*half - PixelFormatType_R16I, // 1*int16 - PixelFormatType_R16UI, // 1*uint16 - PixelFormatType_R32F, // 1*float - PixelFormatType_R32I, // 1*uint16 - PixelFormatType_R32UI, // 1*uint32 - PixelFormatType_RG8, // 2*int8 - PixelFormatType_RG8I, // 2*int8 - PixelFormatType_RG8UI, // 2*uint8 - PixelFormatType_RG16, // 2*uint16 - PixelFormatType_RG16F, // 2*half - PixelFormatType_RG16I, // 2*int16 - PixelFormatType_RG16UI, // 2*uint16 - PixelFormatType_RG32F, // 2*float - PixelFormatType_RG32I, // 2*uint16 - PixelFormatType_RG32UI, // 2*uint32 - PixelFormatType_RGB5A1, // 3*uint5 + alpha bit - PixelFormatType_RGB8, // 3*uint8 - PixelFormatType_RGB16F, // 3*half - PixelFormatType_RGB16I, // 4*int16 - PixelFormatType_RGB16UI, // 4*uint16 - PixelFormatType_RGB32F, // 3*float - PixelFormatType_RGB32I, // 4*int32 - PixelFormatType_RGB32UI, // 4*uint32 - PixelFormatType_RGBA4, // 4*uint4 - PixelFormatType_RGBA8, // 4*uint8 - PixelFormatType_RGBA16F, // 4*half - PixelFormatType_RGBA16I, // 4*int16 - PixelFormatType_RGBA16UI, // 4*uint16 - PixelFormatType_RGBA32F, // 4*float - PixelFormatType_RGBA32I, // 4*int32 - PixelFormatType_RGBA32UI, // 4*uint32 - PixelFormatType_Depth16, - PixelFormatType_Depth24, - PixelFormatType_Depth24Stencil8, - PixelFormatType_Depth32, - PixelFormatType_Stencil1, - PixelFormatType_Stencil4, - PixelFormatType_Stencil8, - PixelFormatType_Stencil16, + PixelFormat_A8, // 1*uint8 + PixelFormat_BGR8, // 3*uint8 + PixelFormat_BGRA8, // 4*uint8 + PixelFormat_DXT1, + PixelFormat_DXT3, + PixelFormat_DXT5, + PixelFormat_L8, // 1*uint8 + PixelFormat_LA8, // 2*uint8 + PixelFormat_R8, // 1*uint8 + PixelFormat_R8I, // 1*int8 + PixelFormat_R8UI, // 1*uint8 + PixelFormat_R16, // 1*uint16 + PixelFormat_R16F, // 1*half + PixelFormat_R16I, // 1*int16 + PixelFormat_R16UI, // 1*uint16 + PixelFormat_R32F, // 1*float + PixelFormat_R32I, // 1*uint16 + PixelFormat_R32UI, // 1*uint32 + PixelFormat_RG8, // 2*int8 + PixelFormat_RG8I, // 2*int8 + PixelFormat_RG8UI, // 2*uint8 + PixelFormat_RG16, // 2*uint16 + PixelFormat_RG16F, // 2*half + PixelFormat_RG16I, // 2*int16 + PixelFormat_RG16UI, // 2*uint16 + PixelFormat_RG32F, // 2*float + PixelFormat_RG32I, // 2*uint16 + PixelFormat_RG32UI, // 2*uint32 + PixelFormat_RGB5A1, // 3*uint5 + alpha bit + PixelFormat_RGB8, // 3*uint8 + PixelFormat_RGB16F, // 3*half + PixelFormat_RGB16I, // 4*int16 + PixelFormat_RGB16UI, // 4*uint16 + PixelFormat_RGB32F, // 3*float + PixelFormat_RGB32I, // 4*int32 + PixelFormat_RGB32UI, // 4*uint32 + PixelFormat_RGBA4, // 4*uint4 + PixelFormat_RGBA8, // 4*uint8 + PixelFormat_RGBA16F, // 4*half + PixelFormat_RGBA16I, // 4*int16 + PixelFormat_RGBA16UI, // 4*uint16 + PixelFormat_RGBA32F, // 4*float + PixelFormat_RGBA32I, // 4*int32 + PixelFormat_RGBA32UI, // 4*uint32 + PixelFormat_Depth16, + PixelFormat_Depth24, + PixelFormat_Depth24Stencil8, + PixelFormat_Depth32, + PixelFormat_Stencil1, + PixelFormat_Stencil4, + PixelFormat_Stencil8, + PixelFormat_Stencil16, - PixelFormatType_Max = PixelFormatType_Stencil16 + PixelFormat_Max = PixelFormat_Stencil16 }; enum PixelFormatSubType diff --git a/include/Nazara/Utility/Image.hpp b/include/Nazara/Utility/Image.hpp index a07b805a4..6355dc60f 100644 --- a/include/Nazara/Utility/Image.hpp +++ b/include/Nazara/Utility/Image.hpp @@ -27,7 +27,7 @@ namespace Nz struct NAZARA_UTILITY_API ImageParams : ResourceParameters { // Le format dans lequel l'image doit être chargée (Undefined pour le format le plus proche de l'original) - PixelFormatType loadFormat = PixelFormatType_Undefined; + PixelFormat loadFormat = PixelFormat_Undefined; // Le nombre de niveaux de mipmaps maximum devant être créé UInt8 levelCount = 0; @@ -56,16 +56,16 @@ namespace Nz struct SharedImage; Image(); - Image(ImageType type, PixelFormatType format, unsigned int width, unsigned int height, unsigned int depth = 1, UInt8 levelCount = 1); + Image(ImageType type, PixelFormat format, unsigned int width, unsigned int height, unsigned int depth = 1, UInt8 levelCount = 1); Image(const Image& image); Image(SharedImage* sharedImage); ~Image(); - bool Convert(PixelFormatType format); + bool Convert(PixelFormat format); void Copy(const Image* source, const Boxui& srcBox, const Vector3ui& dstPos); - bool Create(ImageType type, PixelFormatType format, unsigned int width, unsigned int height, unsigned int depth = 1, UInt8 levelCount = 1); + bool Create(ImageType type, PixelFormat format, unsigned int width, unsigned int height, unsigned int depth = 1, UInt8 levelCount = 1); void Destroy(); bool Fill(const Color& color); @@ -77,7 +77,7 @@ namespace Nz const UInt8* GetConstPixels(unsigned int x = 0, unsigned int y = 0, unsigned int z = 0, UInt8 level = 0) const; unsigned int GetDepth(UInt8 level = 0) const override; - PixelFormatType GetFormat() const override; + PixelFormat GetFormat() const override; unsigned int GetHeight(UInt8 level = 0) const override; UInt8 GetLevelCount() const override; UInt8 GetMaxLevel() const override; @@ -113,7 +113,7 @@ namespace Nz Image& operator=(const Image& image); - static void Copy(UInt8* destination, const UInt8* source, PixelFormatType format, unsigned int width, unsigned int height, unsigned int depth = 1, unsigned int dstWidth = 0, unsigned int dstHeight = 0, unsigned int srcWidth = 0, unsigned int srcHeight = 0); + static void Copy(UInt8* destination, const UInt8* source, PixelFormat format, unsigned int width, unsigned int height, unsigned int depth = 1, unsigned int dstWidth = 0, unsigned int dstHeight = 0, unsigned int srcWidth = 0, unsigned int srcHeight = 0); static UInt8 GetMaxLevel(unsigned int width, unsigned int height, unsigned int depth = 1); static UInt8 GetMaxLevel(ImageType type, unsigned int width, unsigned int height, unsigned int depth = 1); @@ -140,7 +140,7 @@ namespace Nz { using PixelContainer = std::vector>; - SharedImage(unsigned short RefCount, ImageType Type, PixelFormatType Format, PixelContainer&& Levels, unsigned int Width, unsigned int Height, unsigned int Depth) : + SharedImage(unsigned short RefCount, ImageType Type, PixelFormat Format, PixelContainer&& Levels, unsigned int Width, unsigned int Height, unsigned int Depth) : type(Type), format(Format), levels(std::move(Levels)), @@ -152,7 +152,7 @@ namespace Nz } ImageType type; - PixelFormatType format; + PixelFormat format; PixelContainer levels; unsigned int depth; unsigned int height; diff --git a/include/Nazara/Utility/PixelFormat.hpp b/include/Nazara/Utility/PixelFormat.hpp index 1375a1eb1..bb150680a 100644 --- a/include/Nazara/Utility/PixelFormat.hpp +++ b/include/Nazara/Utility/PixelFormat.hpp @@ -21,13 +21,13 @@ namespace Nz { - struct PixelFormatInfo + struct PixelFormatDescription { - inline PixelFormatInfo(); - inline PixelFormatInfo(PixelFormatContent formatContent, UInt8 bpp, PixelFormatSubType subType); - inline PixelFormatInfo(const String& formatName, PixelFormatContent formatContent, UInt8 bpp, PixelFormatSubType subType); - inline PixelFormatInfo(const String& formatName, PixelFormatContent formatContent, Bitset<> rMask, Bitset<> gMask, Bitset<> bMask, Bitset<> aMask, PixelFormatSubType subType); - inline PixelFormatInfo(const String& formatName, PixelFormatContent formatContent, PixelFormatSubType rType, Bitset<> rMask, PixelFormatSubType gType, Bitset<> gMask, PixelFormatSubType bType, Bitset<> bMask, PixelFormatSubType aType, Bitset<> aMask, UInt8 bpp = 0); + inline PixelFormatDescription(); + inline PixelFormatDescription(PixelFormatContent formatContent, UInt8 bpp, PixelFormatSubType subType); + inline PixelFormatDescription(const String& formatName, PixelFormatContent formatContent, UInt8 bpp, PixelFormatSubType subType); + inline PixelFormatDescription(const String& formatName, PixelFormatContent formatContent, Bitset<> rMask, Bitset<> gMask, Bitset<> bMask, Bitset<> aMask, PixelFormatSubType subType); + inline PixelFormatDescription(const String& formatName, PixelFormatContent formatContent, PixelFormatSubType rType, Bitset<> rMask, PixelFormatSubType gType, Bitset<> gMask, PixelFormatSubType bType, Bitset<> bMask, PixelFormatSubType aType, Bitset<> aMask, UInt8 bpp = 0); inline void Clear(); @@ -52,7 +52,7 @@ namespace Nz UInt8 bitsPerPixel; }; - class NAZARA_UTILITY_API PixelFormat + class NAZARA_UTILITY_API PixelFormatInfo { friend class Utility; @@ -60,37 +60,37 @@ namespace Nz using ConvertFunction = std::function; using FlipFunction = std::function; - static inline std::size_t ComputeSize(PixelFormatType format, unsigned int width, unsigned int height, unsigned int depth); + static inline std::size_t ComputeSize(PixelFormat format, unsigned int width, unsigned int height, unsigned int depth); - static inline bool Convert(PixelFormatType srcFormat, PixelFormatType dstFormat, const void* src, void* dst); - static inline bool Convert(PixelFormatType srcFormat, PixelFormatType dstFormat, const void* start, const void* end, void* dst); + static inline bool Convert(PixelFormat srcFormat, PixelFormat dstFormat, const void* src, void* dst); + static inline bool Convert(PixelFormat srcFormat, PixelFormat dstFormat, const void* start, const void* end, void* dst); - static bool Flip(PixelFlipping flipping, PixelFormatType format, unsigned int width, unsigned int height, unsigned int depth, const void* src, void* dst); + static bool Flip(PixelFlipping flipping, PixelFormat format, unsigned int width, unsigned int height, unsigned int depth, const void* src, void* dst); - static inline UInt8 GetBitsPerPixel(PixelFormatType format); - static inline PixelFormatContent GetContent(PixelFormatType format); - static inline UInt8 GetBytesPerPixel(PixelFormatType format); - static inline const PixelFormatInfo& GetInfo(PixelFormatType format); - static inline const String& GetName(PixelFormatType format); + static inline UInt8 GetBitsPerPixel(PixelFormat format); + static inline PixelFormatContent GetContent(PixelFormat format); + static inline UInt8 GetBytesPerPixel(PixelFormat format); + static inline const PixelFormatDescription& GetInfo(PixelFormat format); + static inline const String& GetName(PixelFormat format); - static inline bool HasAlpha(PixelFormatType format); + static inline bool HasAlpha(PixelFormat format); - static PixelFormatType IdentifyFormat(const PixelFormatInfo& info); + static PixelFormat IdentifyFormat(const PixelFormatDescription& info); - static inline bool IsCompressed(PixelFormatType format); - static inline bool IsConversionSupported(PixelFormatType srcFormat, PixelFormatType dstFormat); - static inline bool IsValid(PixelFormatType format); + static inline bool IsCompressed(PixelFormat format); + static inline bool IsConversionSupported(PixelFormat srcFormat, PixelFormat dstFormat); + static inline bool IsValid(PixelFormat format); - static inline void SetConvertFunction(PixelFormatType srcFormat, PixelFormatType dstFormat, ConvertFunction func); - static inline void SetFlipFunction(PixelFlipping flipping, PixelFormatType format, FlipFunction func); + static inline void SetConvertFunction(PixelFormat srcFormat, PixelFormat dstFormat, ConvertFunction func); + static inline void SetFlipFunction(PixelFlipping flipping, PixelFormat format, FlipFunction func); private: static bool Initialize(); static void Uninitialize(); - static PixelFormatInfo s_pixelFormatInfos[PixelFormatType_Max + 1]; - static ConvertFunction s_convertFunctions[PixelFormatType_Max+1][PixelFormatType_Max+1]; - static std::map s_flipFunctions[PixelFlipping_Max+1]; + static PixelFormatDescription s_pixelFormatInfos[PixelFormat_Max + 1]; + static ConvertFunction s_convertFunctions[PixelFormat_Max+1][PixelFormat_Max+1]; + static std::map s_flipFunctions[PixelFlipping_Max+1]; }; } diff --git a/include/Nazara/Utility/PixelFormat.inl b/include/Nazara/Utility/PixelFormat.inl index b1dfdfb0a..82bc3cb91 100644 --- a/include/Nazara/Utility/PixelFormat.inl +++ b/include/Nazara/Utility/PixelFormat.inl @@ -9,13 +9,13 @@ namespace Nz { - inline PixelFormatInfo::PixelFormatInfo() : + inline PixelFormatDescription::PixelFormatDescription() : content(PixelFormatContent_Undefined), bitsPerPixel(0) { } - inline PixelFormatInfo::PixelFormatInfo(PixelFormatContent formatContent, UInt8 bpp, PixelFormatSubType subType) : + inline PixelFormatDescription::PixelFormatDescription(PixelFormatContent formatContent, UInt8 bpp, PixelFormatSubType subType) : content(formatContent), redType(subType), greenType(subType), @@ -25,7 +25,7 @@ namespace Nz { } - inline PixelFormatInfo::PixelFormatInfo(const String& formatName, PixelFormatContent formatContent, UInt8 bpp, PixelFormatSubType subType) : + inline PixelFormatDescription::PixelFormatDescription(const String& formatName, PixelFormatContent formatContent, UInt8 bpp, PixelFormatSubType subType) : content(formatContent), redType(subType), greenType(subType), @@ -36,12 +36,12 @@ namespace Nz { } - inline PixelFormatInfo::PixelFormatInfo(const String& formatName, PixelFormatContent formatContent, Bitset<> rMask, Bitset<> gMask, Bitset<> bMask, Bitset<> aMask, PixelFormatSubType subType) : - PixelFormatInfo(formatName, formatContent, subType, rMask, subType, gMask, subType, bMask, subType, aMask) + inline PixelFormatDescription::PixelFormatDescription(const String& formatName, PixelFormatContent formatContent, Bitset<> rMask, Bitset<> gMask, Bitset<> bMask, Bitset<> aMask, PixelFormatSubType subType) : + PixelFormatDescription(formatName, formatContent, subType, rMask, subType, gMask, subType, bMask, subType, aMask) { } - inline PixelFormatInfo::PixelFormatInfo(const String& formatName, PixelFormatContent formatContent, PixelFormatSubType rType, Bitset<> rMask, PixelFormatSubType gType, Bitset<> gMask, PixelFormatSubType bType, Bitset<> bMask, PixelFormatSubType aType, Bitset<> aMask, UInt8 bpp) : + inline PixelFormatDescription::PixelFormatDescription(const String& formatName, PixelFormatContent formatContent, PixelFormatSubType rType, Bitset<> rMask, PixelFormatSubType gType, Bitset<> gMask, PixelFormatSubType bType, Bitset<> bMask, PixelFormatSubType aType, Bitset<> aMask, UInt8 bpp) : redMask(rMask), greenMask(gMask), blueMask(bMask), @@ -62,7 +62,7 @@ namespace Nz RecomputeBitsPerPixel(); } - inline void PixelFormatInfo::Clear() + inline void PixelFormatDescription::Clear() { bitsPerPixel = 0; alphaMask.Clear(); @@ -72,7 +72,7 @@ namespace Nz name.Clear(); } - inline bool PixelFormatInfo::IsCompressed() const + inline bool PixelFormatDescription::IsCompressed() const { return redType == PixelFormatSubType_Compressed || greenType == PixelFormatSubType_Compressed || @@ -80,12 +80,12 @@ namespace Nz alphaType == PixelFormatSubType_Compressed; } - inline bool PixelFormatInfo::IsValid() const + inline bool PixelFormatDescription::IsValid() const { return bitsPerPixel != 0; } - inline void PixelFormatInfo::RecomputeBitsPerPixel() + inline void PixelFormatDescription::RecomputeBitsPerPixel() { Bitset<> counter; counter |= redMask; @@ -96,7 +96,7 @@ namespace Nz bitsPerPixel = static_cast(counter.Count()); } - inline bool PixelFormatInfo::Validate() const + inline bool PixelFormatDescription::Validate() const { if (!IsValid()) return false; @@ -143,16 +143,16 @@ namespace Nz - inline std::size_t PixelFormat::ComputeSize(PixelFormatType format, unsigned int width, unsigned int height, unsigned int depth) + inline std::size_t PixelFormatInfo::ComputeSize(PixelFormat format, unsigned int width, unsigned int height, unsigned int depth) { if (IsCompressed(format)) { switch (format) { - case PixelFormatType_DXT1: - case PixelFormatType_DXT3: - case PixelFormatType_DXT5: - return (((width + 3) / 4) * ((height + 3) / 4) * ((format == PixelFormatType_DXT1) ? 8 : 16)) * depth; + case PixelFormat_DXT1: + case PixelFormat_DXT3: + case PixelFormat_DXT5: + return (((width + 3) / 4) * ((height + 3) / 4) * ((format == PixelFormat_DXT1) ? 8 : 16)) * depth; default: NazaraError("Unsupported format"); @@ -163,7 +163,7 @@ namespace Nz return width * height * depth * GetBytesPerPixel(format); } - inline bool PixelFormat::Convert(PixelFormatType srcFormat, PixelFormatType dstFormat, const void* src, void* dst) + inline bool PixelFormatInfo::Convert(PixelFormat srcFormat, PixelFormat dstFormat, const void* src, void* dst) { if (srcFormat == dstFormat) { @@ -201,7 +201,7 @@ namespace Nz return true; } - inline bool PixelFormat::Convert(PixelFormatType srcFormat, PixelFormatType dstFormat, const void* start, const void* end, void* dst) + inline bool PixelFormatInfo::Convert(PixelFormat srcFormat, PixelFormat dstFormat, const void* start, const void* end, void* dst) { if (srcFormat == dstFormat) { @@ -225,42 +225,42 @@ namespace Nz return true; } - inline UInt8 PixelFormat::GetBitsPerPixel(PixelFormatType format) + inline UInt8 PixelFormatInfo::GetBitsPerPixel(PixelFormat format) { return s_pixelFormatInfos[format].bitsPerPixel; } - inline UInt8 PixelFormat::GetBytesPerPixel(PixelFormatType format) + inline UInt8 PixelFormatInfo::GetBytesPerPixel(PixelFormat format) { return GetBitsPerPixel(format)/8; } - inline PixelFormatContent PixelFormat::GetContent(PixelFormatType format) + inline PixelFormatContent PixelFormatInfo::GetContent(PixelFormat format) { return s_pixelFormatInfos[format].content; } - inline const PixelFormatInfo& PixelFormat::GetInfo(PixelFormatType format) + inline const PixelFormatDescription& PixelFormatInfo::GetInfo(PixelFormat format) { return s_pixelFormatInfos[format]; } - inline const String& PixelFormat::GetName(PixelFormatType format) + inline const String& PixelFormatInfo::GetName(PixelFormat format) { return s_pixelFormatInfos[format].name; } - inline bool PixelFormat::HasAlpha(PixelFormatType format) + inline bool PixelFormatInfo::HasAlpha(PixelFormat format) { return s_pixelFormatInfos[format].alphaMask.TestAny(); } - inline bool PixelFormat::IsCompressed(PixelFormatType format) + inline bool PixelFormatInfo::IsCompressed(PixelFormat format) { return s_pixelFormatInfos[format].IsCompressed(); } - inline bool PixelFormat::IsConversionSupported(PixelFormatType srcFormat, PixelFormatType dstFormat) + inline bool PixelFormatInfo::IsConversionSupported(PixelFormat srcFormat, PixelFormat dstFormat) { if (srcFormat == dstFormat) return true; @@ -268,17 +268,17 @@ namespace Nz return s_convertFunctions[srcFormat][dstFormat] != nullptr; } - inline bool PixelFormat::IsValid(PixelFormatType format) + inline bool PixelFormatInfo::IsValid(PixelFormat format) { - return format != PixelFormatType_Undefined; + return format != PixelFormat_Undefined; } - inline void PixelFormat::SetConvertFunction(PixelFormatType srcFormat, PixelFormatType dstFormat, ConvertFunction func) + inline void PixelFormatInfo::SetConvertFunction(PixelFormat srcFormat, PixelFormat dstFormat, ConvertFunction func) { s_convertFunctions[srcFormat][dstFormat] = func; } - inline void PixelFormat::SetFlipFunction(PixelFlipping flipping, PixelFormatType format, FlipFunction func) + inline void PixelFormatInfo::SetFlipFunction(PixelFlipping flipping, PixelFormat format, FlipFunction func) { s_flipFunctions[flipping][format] = func; } diff --git a/include/Nazara/VulkanRenderer/VulkanTexture.hpp b/include/Nazara/VulkanRenderer/VulkanTexture.hpp index e5fc61426..1a255aa75 100644 --- a/include/Nazara/VulkanRenderer/VulkanTexture.hpp +++ b/include/Nazara/VulkanRenderer/VulkanTexture.hpp @@ -23,7 +23,7 @@ namespace Nz VulkanTexture(VulkanTexture&&) noexcept = default; ~VulkanTexture(); - PixelFormatType GetFormat() const override; + PixelFormat GetFormat() const override; inline VkImage GetImage() const; inline VkImageView GetImageView() const; UInt8 GetLevelCount() const override; @@ -36,7 +36,7 @@ namespace Nz VulkanTexture& operator=(VulkanTexture&&) = delete; private: - static void InitForFormat(PixelFormatType pixelFormat, VkImageCreateInfo& createImage, VkImageViewCreateInfo& createImageView); + static void InitForFormat(PixelFormat pixelFormat, VkImageCreateInfo& createImage, VkImageViewCreateInfo& createImageView); VkImage m_image; VmaAllocation m_allocation; diff --git a/src/Nazara/Graphics/DeferredBloomPass.cpp b/src/Nazara/Graphics/DeferredBloomPass.cpp index 0ce2985f1..5dc34d3d2 100644 --- a/src/Nazara/Graphics/DeferredBloomPass.cpp +++ b/src/Nazara/Graphics/DeferredBloomPass.cpp @@ -185,7 +185,7 @@ namespace Nz m_bloomRTT.Create(true); for (unsigned int i = 0; i < 2; ++i) { - m_bloomTextures[i]->Create(ImageType_2D, PixelFormatType_RGBA8, dimensions.x / 8, dimensions.y / 8); + m_bloomTextures[i]->Create(ImageType_2D, PixelFormat_RGBA8, dimensions.x / 8, dimensions.y / 8); m_bloomRTT.AttachTexture(AttachmentPoint_Color, i, m_bloomTextures[i]); } m_bloomRTT.Unlock(); diff --git a/src/Nazara/Graphics/DeferredDOFPass.cpp b/src/Nazara/Graphics/DeferredDOFPass.cpp index a13eb31f4..9cf138d2b 100644 --- a/src/Nazara/Graphics/DeferredDOFPass.cpp +++ b/src/Nazara/Graphics/DeferredDOFPass.cpp @@ -197,7 +197,7 @@ namespace Nz m_dofRTT.Create(true); for (unsigned int i = 0; i < 2; ++i) { - m_dofTextures[i]->Create(ImageType_2D, PixelFormatType_RGBA8, dimensions.x/4, dimensions.y/4); + m_dofTextures[i]->Create(ImageType_2D, PixelFormat_RGBA8, dimensions.x/4, dimensions.y/4); m_dofRTT.AttachTexture(AttachmentPoint_Color, i, m_dofTextures[i]); } m_dofRTT.Unlock(); diff --git a/src/Nazara/Graphics/DeferredGeometryPass.cpp b/src/Nazara/Graphics/DeferredGeometryPass.cpp index 18afe9236..3801963b4 100644 --- a/src/Nazara/Graphics/DeferredGeometryPass.cpp +++ b/src/Nazara/Graphics/DeferredGeometryPass.cpp @@ -147,11 +147,11 @@ namespace Nz unsigned int width = dimensions.x; unsigned int height = dimensions.y; - m_depthStencilTexture->Create(ImageType_2D, PixelFormatType_Depth24Stencil8, width, height); + m_depthStencilTexture->Create(ImageType_2D, PixelFormat_Depth24Stencil8, width, height); - m_GBuffer[0]->Create(ImageType_2D, PixelFormatType_RGBA8, width, height); // Texture 0 : Diffuse Color + Specular - m_GBuffer[1]->Create(ImageType_2D, PixelFormatType_RG16F, width, height); // Texture 1 : Encoded normal - m_GBuffer[2]->Create(ImageType_2D, PixelFormatType_RGBA8, width, height); // Texture 2 : Depth (24bits) + Shininess + m_GBuffer[0]->Create(ImageType_2D, PixelFormat_RGBA8, width, height); // Texture 0 : Diffuse Color + Specular + m_GBuffer[1]->Create(ImageType_2D, PixelFormat_RG16F, width, height); // Texture 1 : Encoded normal + m_GBuffer[2]->Create(ImageType_2D, PixelFormat_RGBA8, width, height); // Texture 2 : Depth (24bits) + Shininess m_GBufferRTT->Create(true); @@ -169,7 +169,7 @@ namespace Nz for (unsigned int i = 0; i < 2; ++i) { - m_workTextures[i]->Create(ImageType_2D, PixelFormatType_RGBA8, width, height); + m_workTextures[i]->Create(ImageType_2D, PixelFormat_RGBA8, width, height); m_workRTT->AttachTexture(AttachmentPoint_Color, i, m_workTextures[i]); } diff --git a/src/Nazara/Graphics/Graphics.cpp b/src/Nazara/Graphics/Graphics.cpp index 9757d661b..7120d33cd 100644 --- a/src/Nazara/Graphics/Graphics.cpp +++ b/src/Nazara/Graphics/Graphics.cpp @@ -160,13 +160,13 @@ namespace Nz std::array whitePixels = { { 255, 255, 255, 255, 255, 255 } }; Nz::TextureRef whiteTexture = Nz::Texture::New(); - whiteTexture->Create(ImageType_2D, PixelFormatType_L8, 1, 1); + whiteTexture->Create(ImageType_2D, PixelFormat_L8, 1, 1); whiteTexture->Update(whitePixels.data()); TextureLibrary::Register("White2D", std::move(whiteTexture)); Nz::TextureRef whiteCubemap = Nz::Texture::New(); - whiteCubemap->Create(ImageType_Cubemap, PixelFormatType_L8, 1, 1); + whiteCubemap->Create(ImageType_Cubemap, PixelFormat_L8, 1, 1); whiteCubemap->Update(whitePixels.data()); TextureLibrary::Register("WhiteCubemap", std::move(whiteCubemap)); diff --git a/src/Nazara/Graphics/GuillotineTextureAtlas.cpp b/src/Nazara/Graphics/GuillotineTextureAtlas.cpp index b413ed76a..83ac85be2 100644 --- a/src/Nazara/Graphics/GuillotineTextureAtlas.cpp +++ b/src/Nazara/Graphics/GuillotineTextureAtlas.cpp @@ -37,7 +37,7 @@ namespace Nz AbstractImage* GuillotineTextureAtlas::ResizeImage(AbstractImage* oldImage, const Vector2ui& size) const { std::unique_ptr newTexture(new Texture); - if (newTexture->Create(ImageType_2D, PixelFormatType_A8, size.x, size.y, 1)) + if (newTexture->Create(ImageType_2D, PixelFormat_A8, size.x, size.y, 1)) { if (oldImage) { diff --git a/src/Nazara/Graphics/Light.cpp b/src/Nazara/Graphics/Light.cpp index 4156ee77d..be356fa85 100644 --- a/src/Nazara/Graphics/Light.cpp +++ b/src/Nazara/Graphics/Light.cpp @@ -29,7 +29,7 @@ namespace Nz Light::Light(LightType type) : m_type(type), - m_shadowMapFormat(PixelFormatType_Depth16), + m_shadowMapFormat(PixelFormat_Depth16), m_shadowMapSize(512, 512), m_shadowCastingEnabled(false), m_shadowMapUpdated(false) diff --git a/src/Nazara/Platform/Win32/CursorImpl.cpp b/src/Nazara/Platform/Win32/CursorImpl.cpp index 8af6502fe..8a78917ba 100644 --- a/src/Nazara/Platform/Win32/CursorImpl.cpp +++ b/src/Nazara/Platform/Win32/CursorImpl.cpp @@ -13,7 +13,7 @@ namespace Nz bool CursorImpl::Create(const Image& cursor, int hotSpotX, int hotSpotY) { Image windowsCursor(cursor); - if (!windowsCursor.Convert(PixelFormatType_BGRA8)) + if (!windowsCursor.Convert(PixelFormat_BGRA8)) { NazaraError("Failed to convert cursor to BGRA8"); return false; diff --git a/src/Nazara/Platform/Win32/IconImpl.cpp b/src/Nazara/Platform/Win32/IconImpl.cpp index 47839be16..1ca2c878e 100644 --- a/src/Nazara/Platform/Win32/IconImpl.cpp +++ b/src/Nazara/Platform/Win32/IconImpl.cpp @@ -12,7 +12,7 @@ namespace Nz bool IconImpl::Create(const Image& icon) { Image windowsIcon(icon); // Vive le COW - if (!windowsIcon.Convert(PixelFormatType_BGRA8)) + if (!windowsIcon.Convert(PixelFormat_BGRA8)) { NazaraError("Failed to convert icon to BGRA8"); return false; diff --git a/src/Nazara/Utility/AbstractImage.cpp b/src/Nazara/Utility/AbstractImage.cpp index a5605acd8..72a0f7335 100644 --- a/src/Nazara/Utility/AbstractImage.cpp +++ b/src/Nazara/Utility/AbstractImage.cpp @@ -12,12 +12,12 @@ namespace Nz UInt8 AbstractImage::GetBytesPerPixel() const { - return PixelFormat::GetBytesPerPixel(GetFormat()); + return PixelFormatInfo::GetBytesPerPixel(GetFormat()); } bool AbstractImage::IsCompressed() const { - return PixelFormat::IsCompressed(GetFormat()); + return PixelFormatInfo::IsCompressed(GetFormat()); } bool AbstractImage::IsCubemap() const diff --git a/src/Nazara/Utility/Formats/DDSLoader.cpp b/src/Nazara/Utility/Formats/DDSLoader.cpp index b6d50ce2b..4d2edf50e 100644 --- a/src/Nazara/Utility/Formats/DDSLoader.cpp +++ b/src/Nazara/Utility/Formats/DDSLoader.cpp @@ -84,7 +84,7 @@ namespace Nz return nullptr; // Then the format - PixelFormatType format; + PixelFormat format; if (!IdentifyPixelFormat(header, headerDX10, &format)) return nullptr; @@ -93,7 +93,7 @@ namespace Nz // Read all mipmap levels for (unsigned int i = 0; i < image->GetLevelCount(); i++) { - std::size_t byteCount = PixelFormat::ComputeSize(format, width, height, depth); + std::size_t byteCount = PixelFormatInfo::ComputeSize(format, width, height, depth); UInt8* ptr = image->GetPixels(0, 0, 0, i); @@ -114,7 +114,7 @@ namespace Nz } - if (parameters.loadFormat != PixelFormatType_Undefined) + if (parameters.loadFormat != PixelFormat_Undefined) image->Convert(parameters.loadFormat); return image; @@ -163,11 +163,11 @@ namespace Nz return true; } - static bool IdentifyPixelFormat(const DDSHeader& header, const DDSHeaderDX10Ext& headerExt, PixelFormatType* format) + static bool IdentifyPixelFormat(const DDSHeader& header, const DDSHeaderDX10Ext& headerExt, PixelFormat* format) { if (header.format.flags & (DDPF_RGB | DDPF_ALPHA | DDPF_ALPHAPIXELS | DDPF_LUMINANCE)) { - PixelFormatInfo info(PixelFormatContent_ColorRGBA, header.format.bpp, PixelFormatSubType_Unsigned); + PixelFormatDescription info(PixelFormatContent_ColorRGBA, header.format.bpp, PixelFormatSubType_Unsigned); if (header.format.flags & DDPF_RGB) { @@ -182,8 +182,8 @@ namespace Nz if (header.format.flags & (DDPF_ALPHA | DDPF_ALPHAPIXELS)) info.alphaMask = header.format.alphaMask; - *format = PixelFormat::IdentifyFormat(info); - if (!PixelFormat::IsValid(*format)) + *format = PixelFormatInfo::IdentifyFormat(info); + if (!PixelFormatInfo::IsValid(*format)) return false; } else if (header.format.flags & DDPF_FOURCC) @@ -191,15 +191,15 @@ namespace Nz switch (header.format.fourCC) { case D3DFMT_DXT1: - *format = PixelFormatType_DXT1; + *format = PixelFormat_DXT1; break; case D3DFMT_DXT3: - *format = PixelFormatType_DXT3; + *format = PixelFormat_DXT3; break; case D3DFMT_DXT5: - *format = PixelFormatType_DXT3; + *format = PixelFormat_DXT3; break; case D3DFMT_DX10: @@ -207,30 +207,30 @@ namespace Nz switch (headerExt.dxgiFormat) { case DXGI_FORMAT_R32G32B32A32_FLOAT: - *format = PixelFormatType_RGBA32F; + *format = PixelFormat_RGBA32F; break; case DXGI_FORMAT_R32G32B32A32_UINT: - *format = PixelFormatType_RGBA32UI; + *format = PixelFormat_RGBA32UI; break; case DXGI_FORMAT_R32G32B32A32_SINT: - *format = PixelFormatType_RGBA32I; + *format = PixelFormat_RGBA32I; break; case DXGI_FORMAT_R32G32B32_FLOAT: - *format = PixelFormatType_RGB32F; + *format = PixelFormat_RGB32F; break; case DXGI_FORMAT_R32G32B32_UINT: - //*format = PixelFormatType_RGB32U; + //*format = PixelFormat_RGB32U; return false; case DXGI_FORMAT_R32G32B32_SINT: - *format = PixelFormatType_RGB32I; + *format = PixelFormat_RGB32I; break; case DXGI_FORMAT_R16G16B16A16_SNORM: case DXGI_FORMAT_R16G16B16A16_SINT: case DXGI_FORMAT_R16G16B16A16_UINT: - *format = PixelFormatType_RGBA16I; + *format = PixelFormat_RGBA16I; break; case DXGI_FORMAT_R16G16B16A16_UNORM: - *format = PixelFormatType_RGBA16UI; + *format = PixelFormat_RGBA16UI; break; } break; diff --git a/src/Nazara/Utility/Formats/FreeTypeLoader.cpp b/src/Nazara/Utility/Formats/FreeTypeLoader.cpp index 601f16031..aaba0dc87 100644 --- a/src/Nazara/Utility/Formats/FreeTypeLoader.cpp +++ b/src/Nazara/Utility/Formats/FreeTypeLoader.cpp @@ -201,7 +201,7 @@ namespace Nz if (width > 0 && height > 0) { - dst->image.Create(ImageType_2D, PixelFormatType_A8, width, height); + dst->image.Create(ImageType_2D, PixelFormat_A8, width, height); UInt8* pixels = dst->image.GetPixels(); const UInt8* data = bitmap.buffer; diff --git a/src/Nazara/Utility/Formats/PCXLoader.cpp b/src/Nazara/Utility/Formats/PCXLoader.cpp index 7e9ff82f5..61a0e1d28 100644 --- a/src/Nazara/Utility/Formats/PCXLoader.cpp +++ b/src/Nazara/Utility/Formats/PCXLoader.cpp @@ -92,7 +92,7 @@ namespace Nz unsigned int height = header.ymax - header.ymin+1; ImageRef image = Image::New(); - if (!image->Create(ImageType_2D, PixelFormatType_RGB8, width, height, 1, (parameters.levelCount > 0) ? parameters.levelCount : 1)) + if (!image->Create(ImageType_2D, PixelFormat_RGB8, width, height, 1, (parameters.levelCount > 0) ? parameters.levelCount : 1)) { NazaraError("Failed to create image"); return nullptr; @@ -333,7 +333,7 @@ namespace Nz return nullptr; } - if (parameters.loadFormat != PixelFormatType_Undefined) + if (parameters.loadFormat != PixelFormat_Undefined) image->Convert(parameters.loadFormat); return image; diff --git a/src/Nazara/Utility/Formats/STBLoader.cpp b/src/Nazara/Utility/Formats/STBLoader.cpp index 9e2132906..01f1bd0f4 100644 --- a/src/Nazara/Utility/Formats/STBLoader.cpp +++ b/src/Nazara/Utility/Formats/STBLoader.cpp @@ -74,7 +74,7 @@ namespace Nz }); ImageRef image = Image::New(); - if (!image->Create(ImageType_2D, PixelFormatType_RGBA8, width, height, 1, (parameters.levelCount > 0) ? parameters.levelCount : 1)) + if (!image->Create(ImageType_2D, PixelFormat_RGBA8, width, height, 1, (parameters.levelCount > 0) ? parameters.levelCount : 1)) { NazaraError("Failed to create image"); return nullptr; @@ -84,7 +84,7 @@ namespace Nz freeStbiImage.CallAndReset(); - if (parameters.loadFormat != PixelFormatType_Undefined) + if (parameters.loadFormat != PixelFormat_Undefined) image->Convert(parameters.loadFormat); return image; diff --git a/src/Nazara/Utility/Formats/STBSaver.cpp b/src/Nazara/Utility/Formats/STBSaver.cpp index 77a71b64d..e4af33fb7 100644 --- a/src/Nazara/Utility/Formats/STBSaver.cpp +++ b/src/Nazara/Utility/Formats/STBSaver.cpp @@ -21,30 +21,30 @@ namespace Nz { switch (image.GetFormat()) { - case PixelFormatType_R32F: + case PixelFormat_R32F: return 1; - case PixelFormatType_RG32F: + case PixelFormat_RG32F: return 2; - case PixelFormatType_RGB32F: + case PixelFormat_RGB32F: return 3; - case PixelFormatType_RGBA32F: + case PixelFormat_RGBA32F: return 4; default: { - if (PixelFormat::HasAlpha(image.GetFormat())) + if (PixelFormatInfo::HasAlpha(image.GetFormat())) { - if (!image.Convert(PixelFormatType_RGBA32F)) + if (!image.Convert(PixelFormat_RGBA32F)) break; return 4; } else { - if (!image.Convert(PixelFormatType_RGB32F)) + if (!image.Convert(PixelFormat_RGB32F)) break; return 3; @@ -59,32 +59,32 @@ namespace Nz { switch (image.GetFormat()) { - case PixelFormatType_L8: - case PixelFormatType_R8: + case PixelFormat_L8: + case PixelFormat_R8: return 1; - case PixelFormatType_LA8: - case PixelFormatType_RG8: + case PixelFormat_LA8: + case PixelFormat_RG8: return 2; - case PixelFormatType_RGB8: + case PixelFormat_RGB8: return 3; - case PixelFormatType_RGBA8: + case PixelFormat_RGBA8: return 4; default: { - if (PixelFormat::HasAlpha(image.GetFormat())) + if (PixelFormatInfo::HasAlpha(image.GetFormat())) { - if (!image.Convert(PixelFormatType_RGBA8)) + if (!image.Convert(PixelFormat_RGBA8)) break; return 4; } else { - if (!image.Convert(PixelFormatType_RGB8)) + if (!image.Convert(PixelFormat_RGB8)) break; return 3; diff --git a/src/Nazara/Utility/GuillotineImageAtlas.cpp b/src/Nazara/Utility/GuillotineImageAtlas.cpp index 54dfb813b..2a39e7475 100644 --- a/src/Nazara/Utility/GuillotineImageAtlas.cpp +++ b/src/Nazara/Utility/GuillotineImageAtlas.cpp @@ -161,7 +161,7 @@ namespace Nz AbstractImage* GuillotineImageAtlas::ResizeImage(AbstractImage* oldImage, const Vector2ui& size) const { - std::unique_ptr newImage(new Image(ImageType_2D, PixelFormatType_A8, size.x, size.y)); + std::unique_ptr newImage(new Image(ImageType_2D, PixelFormat_A8, size.x, size.y)); if (oldImage) { newImage->Copy(static_cast(oldImage), Rectui(size), Vector2ui(0, 0)); // Copie des anciennes données diff --git a/src/Nazara/Utility/Image.cpp b/src/Nazara/Utility/Image.cpp index 189acb484..b45c96a2e 100644 --- a/src/Nazara/Utility/Image.cpp +++ b/src/Nazara/Utility/Image.cpp @@ -42,7 +42,7 @@ namespace Nz { } - Image::Image(ImageType type, PixelFormatType format, unsigned int width, unsigned int height, unsigned int depth, UInt8 levelCount) : + Image::Image(ImageType type, PixelFormat format, unsigned int width, unsigned int height, unsigned int depth, UInt8 levelCount) : m_sharedImage(&emptyImage) { ErrorFlags flags(ErrorFlag_ThrowException); @@ -70,7 +70,7 @@ namespace Nz Destroy(); } - bool Image::Convert(PixelFormatType newFormat) + bool Image::Convert(PixelFormat newFormat) { #if NAZARA_UTILITY_SAFE if (m_sharedImage == &emptyImage) @@ -79,15 +79,15 @@ namespace Nz return false; } - if (!PixelFormat::IsValid(newFormat)) + if (!PixelFormatInfo::IsValid(newFormat)) { NazaraError("Invalid pixel format"); return false; } - if (!PixelFormat::IsConversionSupported(m_sharedImage->format, newFormat)) + if (!PixelFormatInfo::IsConversionSupported(m_sharedImage->format, newFormat)) { - NazaraError("Conversion from " + PixelFormat::GetName(m_sharedImage->format) + " to " + PixelFormat::GetName(newFormat) + " is not supported"); + NazaraError("Conversion from " + PixelFormatInfo::GetName(m_sharedImage->format) + " to " + PixelFormatInfo::GetName(newFormat) + " is not supported"); return false; } #endif @@ -106,16 +106,16 @@ namespace Nz for (unsigned int i = 0; i < levels.size(); ++i) { unsigned int pixelsPerFace = width * height; - levels[i] = std::make_unique(pixelsPerFace * depth * PixelFormat::GetBytesPerPixel(newFormat)); + levels[i] = std::make_unique(pixelsPerFace * depth * PixelFormatInfo::GetBytesPerPixel(newFormat)); UInt8* dst = levels[i].get(); UInt8* src = m_sharedImage->levels[i].get(); - unsigned int srcStride = pixelsPerFace * PixelFormat::GetBytesPerPixel(m_sharedImage->format); - unsigned int dstStride = pixelsPerFace * PixelFormat::GetBytesPerPixel(newFormat); + unsigned int srcStride = pixelsPerFace * PixelFormatInfo::GetBytesPerPixel(m_sharedImage->format); + unsigned int dstStride = pixelsPerFace * PixelFormatInfo::GetBytesPerPixel(newFormat); for (unsigned int d = 0; d < depth; ++d) { - if (!PixelFormat::Convert(m_sharedImage->format, newFormat, src, &src[srcStride], dst)) + if (!PixelFormatInfo::Convert(m_sharedImage->format, newFormat, src, &src[srcStride], dst)) { NazaraError("Failed to convert image"); return false; @@ -158,18 +158,18 @@ namespace Nz } #endif - UInt8 bpp = PixelFormat::GetBytesPerPixel(m_sharedImage->format); + UInt8 bpp = PixelFormatInfo::GetBytesPerPixel(m_sharedImage->format); UInt8* dstPtr = GetPixelPtr(m_sharedImage->levels[0].get(), bpp, dstPos.x, dstPos.y, dstPos.z, m_sharedImage->width, m_sharedImage->height); Copy(dstPtr, srcPtr, m_sharedImage->format, srcBox.width, srcBox.height, srcBox.depth, m_sharedImage->width, m_sharedImage->height, source->GetWidth(), source->GetHeight()); } - bool Image::Create(ImageType type, PixelFormatType format, unsigned int width, unsigned int height, unsigned int depth, UInt8 levelCount) + bool Image::Create(ImageType type, PixelFormat format, unsigned int width, unsigned int height, unsigned int depth, UInt8 levelCount) { Destroy(); #if NAZARA_UTILITY_SAFE - if (!PixelFormat::IsValid(format)) + if (!PixelFormatInfo::IsValid(format)) { NazaraError("Invalid pixel format"); return false; @@ -255,7 +255,7 @@ namespace Nz // Cette allocation est protégée car sa taille dépend directement de paramètres utilisateurs try { - levels[i] = std::make_unique(PixelFormat::ComputeSize(format, w, h, d)); + levels[i] = std::make_unique(PixelFormatInfo::ComputeSize(format, w, h, d)); if (w > 1) w >>= 1; @@ -298,18 +298,18 @@ namespace Nz return false; } - if (PixelFormat::IsCompressed(m_sharedImage->format)) + if (PixelFormatInfo::IsCompressed(m_sharedImage->format)) { NazaraError("Cannot access pixels from compressed image"); return false; } #endif - UInt8 bpp = PixelFormat::GetBytesPerPixel(m_sharedImage->format); + UInt8 bpp = PixelFormatInfo::GetBytesPerPixel(m_sharedImage->format); std::unique_ptr colorBuffer(new UInt8[bpp]); - if (!PixelFormat::Convert(PixelFormatType_RGBA8, m_sharedImage->format, &color.r, colorBuffer.get())) + if (!PixelFormatInfo::Convert(PixelFormat_RGBA8, m_sharedImage->format, &color.r, colorBuffer.get())) { - NazaraError("Failed to convert RGBA8 to " + PixelFormat::GetName(m_sharedImage->format)); + NazaraError("Failed to convert RGBA8 to " + PixelFormatInfo::GetName(m_sharedImage->format)); return false; } @@ -323,7 +323,7 @@ namespace Nz for (auto & level : levels) { - std::size_t size = PixelFormat::ComputeSize(m_sharedImage->format, width, height, depth); + std::size_t size = PixelFormatInfo::ComputeSize(m_sharedImage->format, width, height, depth); level = std::make_unique(size); UInt8* ptr = level.get(); @@ -362,7 +362,7 @@ namespace Nz return false; } - if (PixelFormat::IsCompressed(m_sharedImage->format)) + if (PixelFormatInfo::IsCompressed(m_sharedImage->format)) { NazaraError("Cannot access pixels from compressed image"); return false; @@ -383,11 +383,11 @@ namespace Nz EnsureOwnership(); - UInt8 bpp = PixelFormat::GetBytesPerPixel(m_sharedImage->format); + UInt8 bpp = PixelFormatInfo::GetBytesPerPixel(m_sharedImage->format); std::unique_ptr colorBuffer(new UInt8[bpp]); - if (!PixelFormat::Convert(PixelFormatType_RGBA8, m_sharedImage->format, &color.r, colorBuffer.get())) + if (!PixelFormatInfo::Convert(PixelFormat_RGBA8, m_sharedImage->format, &color.r, colorBuffer.get())) { - NazaraError("Failed to convert RGBA8 to " + PixelFormat::GetName(m_sharedImage->format)); + NazaraError("Failed to convert RGBA8 to " + PixelFormatInfo::GetName(m_sharedImage->format)); return false; } @@ -427,7 +427,7 @@ namespace Nz return false; } - if (PixelFormat::IsCompressed(m_sharedImage->format)) + if (PixelFormatInfo::IsCompressed(m_sharedImage->format)) { NazaraError("Cannot access pixels from compressed image"); return false; @@ -455,11 +455,11 @@ namespace Nz EnsureOwnership(); - UInt8 bpp = PixelFormat::GetBytesPerPixel(m_sharedImage->format); + UInt8 bpp = PixelFormatInfo::GetBytesPerPixel(m_sharedImage->format); std::unique_ptr colorBuffer(new UInt8[bpp]); - if (!PixelFormat::Convert(PixelFormatType_RGBA8, m_sharedImage->format, &color.r, colorBuffer.get())) + if (!PixelFormatInfo::Convert(PixelFormat_RGBA8, m_sharedImage->format, &color.r, colorBuffer.get())) { - NazaraError("Failed to convert RGBA8 to " + PixelFormat::GetName(m_sharedImage->format)); + NazaraError("Failed to convert RGBA8 to " + PixelFormatInfo::GetName(m_sharedImage->format)); return false; } @@ -501,7 +501,7 @@ namespace Nz for (auto& level : m_sharedImage->levels) { UInt8* ptr = level.get(); - if (!PixelFormat::Flip(PixelFlipping_Horizontally, m_sharedImage->format, width, height, depth, ptr, ptr)) + if (!PixelFormatInfo::Flip(PixelFlipping_Horizontally, m_sharedImage->format, width, height, depth, ptr, ptr)) { NazaraError("Failed to flip image"); return false; @@ -529,7 +529,7 @@ namespace Nz return false; } - if (PixelFormat::IsCompressed(m_sharedImage->format)) + if (PixelFormatInfo::IsCompressed(m_sharedImage->format)) { NazaraError("Cannot flip compressed image"); return false; @@ -544,7 +544,7 @@ namespace Nz for (auto& level : m_sharedImage->levels) { UInt8* ptr = level.get(); - if (!PixelFormat::Flip(PixelFlipping_Vertically, m_sharedImage->format, width, height, depth, ptr, ptr)) + if (!PixelFormatInfo::Flip(PixelFlipping_Vertically, m_sharedImage->format, width, height, depth, ptr, ptr)) { NazaraError("Failed to flip image"); return false; @@ -604,7 +604,7 @@ namespace Nz } #endif - return GetPixelPtr(m_sharedImage->levels[level].get(), PixelFormat::GetBytesPerPixel(m_sharedImage->format), x, y, z, width, height); + return GetPixelPtr(m_sharedImage->levels[level].get(), PixelFormatInfo::GetBytesPerPixel(m_sharedImage->format), x, y, z, width, height); } unsigned int Image::GetDepth(UInt8 level) const @@ -620,7 +620,7 @@ namespace Nz return GetLevelSize(m_sharedImage->depth, level); } - PixelFormatType Image::GetFormat() const + PixelFormat Image::GetFormat() const { return m_sharedImage->format; } @@ -672,12 +672,12 @@ namespace Nz if (m_sharedImage->type == ImageType_Cubemap) size *= 6; - return size * PixelFormat::GetBytesPerPixel(m_sharedImage->format); + return size * PixelFormatInfo::GetBytesPerPixel(m_sharedImage->format); } std::size_t Image::GetMemoryUsage(UInt8 level) const { - return PixelFormat::ComputeSize(m_sharedImage->format, GetLevelSize(m_sharedImage->width, level), GetLevelSize(m_sharedImage->height, level), ((m_sharedImage->type == ImageType_Cubemap) ? 6 : GetLevelSize(m_sharedImage->depth, level))); + return PixelFormatInfo::ComputeSize(m_sharedImage->format, GetLevelSize(m_sharedImage->width, level), GetLevelSize(m_sharedImage->height, level), ((m_sharedImage->type == ImageType_Cubemap) ? 6 : GetLevelSize(m_sharedImage->depth, level))); } Color Image::GetPixelColor(unsigned int x, unsigned int y, unsigned int z) const @@ -689,7 +689,7 @@ namespace Nz return Color(); } - if (PixelFormat::IsCompressed(m_sharedImage->format)) + if (PixelFormatInfo::IsCompressed(m_sharedImage->format)) { NazaraError("Cannot access pixels from compressed image"); return Color(); @@ -715,10 +715,10 @@ namespace Nz } #endif - const UInt8* pixel = GetPixelPtr(m_sharedImage->levels[0].get(), PixelFormat::GetBytesPerPixel(m_sharedImage->format), x, y, z, m_sharedImage->width, m_sharedImage->height); + const UInt8* pixel = GetPixelPtr(m_sharedImage->levels[0].get(), PixelFormatInfo::GetBytesPerPixel(m_sharedImage->format), x, y, z, m_sharedImage->width, m_sharedImage->height); Color color; - if (!PixelFormat::Convert(m_sharedImage->format, PixelFormatType_RGBA8, pixel, &color.r)) + if (!PixelFormatInfo::Convert(m_sharedImage->format, PixelFormat_RGBA8, pixel, &color.r)) NazaraError("Failed to convert image's format to RGBA8"); return color; @@ -773,7 +773,7 @@ namespace Nz EnsureOwnership(); - return GetPixelPtr(m_sharedImage->levels[level].get(), PixelFormat::GetBytesPerPixel(m_sharedImage->format), x, y, z, width, height); + return GetPixelPtr(m_sharedImage->levels[level].get(), PixelFormatInfo::GetBytesPerPixel(m_sharedImage->format), x, y, z, width, height); } Vector3ui Image::GetSize(UInt8 level) const @@ -811,12 +811,12 @@ namespace Nz { NazaraAssert(m_sharedImage != &emptyImage, "Image must be valid"); - if (!PixelFormat::HasAlpha(m_sharedImage->format)) + if (!PixelFormatInfo::HasAlpha(m_sharedImage->format)) return false; - if (!PixelFormat::IsCompressed(m_sharedImage->format)) + if (!PixelFormatInfo::IsCompressed(m_sharedImage->format)) { - const PixelFormatInfo& info = PixelFormat::GetInfo(m_sharedImage->format); + const PixelFormatDescription& info = PixelFormatInfo::GetInfo(m_sharedImage->format); Bitset<> workingBitset; std::size_t pixelCount = m_sharedImage->width * m_sharedImage->height * ((m_sharedImage->type == ImageType_Cubemap) ? 6 : m_sharedImage->depth); @@ -1208,7 +1208,7 @@ namespace Nz return false; } - if (PixelFormat::IsCompressed(m_sharedImage->format)) + if (PixelFormatInfo::IsCompressed(m_sharedImage->format)) { NazaraError("Cannot access pixels from compressed image"); return false; @@ -1234,9 +1234,9 @@ namespace Nz } #endif - UInt8* pixel = GetPixelPtr(m_sharedImage->levels[0].get(), PixelFormat::GetBytesPerPixel(m_sharedImage->format), x, y, z, m_sharedImage->width, m_sharedImage->height); + UInt8* pixel = GetPixelPtr(m_sharedImage->levels[0].get(), PixelFormatInfo::GetBytesPerPixel(m_sharedImage->format), x, y, z, m_sharedImage->width, m_sharedImage->height); - if (!PixelFormat::Convert(PixelFormatType_RGBA8, m_sharedImage->format, &color.r, pixel)) + if (!PixelFormatInfo::Convert(PixelFormat_RGBA8, m_sharedImage->format, &color.r, pixel)) { NazaraError("Failed to convert RGBA8 to image's format"); return false; @@ -1322,7 +1322,7 @@ namespace Nz EnsureOwnership(); - UInt8 bpp = PixelFormat::GetBytesPerPixel(m_sharedImage->format); + UInt8 bpp = PixelFormatInfo::GetBytesPerPixel(m_sharedImage->format); UInt8* dstPixels = GetPixelPtr(m_sharedImage->levels[level].get(), bpp, box.x, box.y, box.z, width, height); Copy(dstPixels, pixels, m_sharedImage->format, @@ -1349,7 +1349,7 @@ namespace Nz return *this; } - void Image::Copy(UInt8* destination, const UInt8* source, PixelFormatType format, unsigned int width, unsigned int height, unsigned int depth, unsigned int dstWidth, unsigned int dstHeight, unsigned int srcWidth, unsigned int srcHeight) + void Image::Copy(UInt8* destination, const UInt8* source, PixelFormat format, unsigned int width, unsigned int height, unsigned int depth, unsigned int dstWidth, unsigned int dstHeight, unsigned int srcWidth, unsigned int srcHeight) { #if NAZARA_UTILITY_SAFE if (width == 0) @@ -1373,10 +1373,10 @@ namespace Nz srcHeight = height; if ((height == 1 || (dstWidth == width && srcWidth == width)) && (depth == 1 || (dstHeight == height && srcHeight == height))) - std::memcpy(destination, source, PixelFormat::ComputeSize(format, width, height, depth)); + std::memcpy(destination, source, PixelFormatInfo::ComputeSize(format, width, height, depth)); else { - unsigned int bpp = PixelFormat::GetBytesPerPixel(format); + unsigned int bpp = PixelFormatInfo::GetBytesPerPixel(format); unsigned int lineStride = width * bpp; unsigned int dstLineStride = dstWidth * bpp; unsigned int dstFaceStride = dstLineStride * dstHeight; @@ -1498,7 +1498,7 @@ namespace Nz ImageLibrary::Uninitialize(); } - Image::SharedImage Image::emptyImage(0, ImageType_2D, PixelFormatType_Undefined, Image::SharedImage::PixelContainer(), 0, 0, 0); + Image::SharedImage Image::emptyImage(0, ImageType_2D, PixelFormat_Undefined, Image::SharedImage::PixelContainer(), 0, 0, 0); ImageLibrary::LibraryMap Image::s_library; ImageLoader::LoaderList Image::s_loaders; ImageManager::ManagerMap Image::s_managerMap; diff --git a/src/Nazara/Utility/PixelFormat.cpp b/src/Nazara/Utility/PixelFormat.cpp index f19d19276..649e1a27b 100644 --- a/src/Nazara/Utility/PixelFormat.cpp +++ b/src/Nazara/Utility/PixelFormat.cpp @@ -41,20 +41,20 @@ namespace Nz return static_cast(c * (31.f/255.f)); } - template + template UInt8* ConvertPixels(const UInt8* start, const UInt8* end, UInt8* dst) { NazaraUnused(start); NazaraUnused(dst); NazaraUnused(end); - NazaraInternalError("Conversion from " + PixelFormat::GetName(from) + " to " + PixelFormat::GetName(to) + " is not supported"); + NazaraInternalError("Conversion from " + PixelFormatInfo::GetName(from) + " to " + PixelFormatInfo::GetName(to) + " is not supported"); return nullptr; } /**********************************A8***********************************/ template<> - UInt8* ConvertPixels(const UInt8* start, const UInt8* end, UInt8* dst) + UInt8* ConvertPixels(const UInt8* start, const UInt8* end, UInt8* dst) { while (start < end) { @@ -70,7 +70,7 @@ namespace Nz } template<> - UInt8* ConvertPixels(const UInt8* start, const UInt8* end, UInt8* dst) + UInt8* ConvertPixels(const UInt8* start, const UInt8* end, UInt8* dst) { while (start < end) { @@ -84,7 +84,7 @@ namespace Nz } template<> - UInt8* ConvertPixels(const UInt8* start, const UInt8* end, UInt8* dst) + UInt8* ConvertPixels(const UInt8* start, const UInt8* end, UInt8* dst) { UInt16* ptr = reinterpret_cast(dst); while (start < end) @@ -106,7 +106,7 @@ namespace Nz } template<> - UInt8* ConvertPixels(const UInt8* start, const UInt8* end, UInt8* dst) + UInt8* ConvertPixels(const UInt8* start, const UInt8* end, UInt8* dst) { UInt16* ptr = reinterpret_cast(dst); while (start < end) @@ -125,7 +125,7 @@ namespace Nz } template<> - UInt8* ConvertPixels(const UInt8* start, const UInt8* end, UInt8* dst) + UInt8* ConvertPixels(const UInt8* start, const UInt8* end, UInt8* dst) { while (start < end) { @@ -142,7 +142,7 @@ namespace Nz /**********************************BGR8***********************************/ template<> - UInt8* ConvertPixels(const UInt8* start, const UInt8* end, UInt8* dst) + UInt8* ConvertPixels(const UInt8* start, const UInt8* end, UInt8* dst) { while (start < end) { @@ -158,7 +158,7 @@ namespace Nz } template<> - UInt8* ConvertPixels(const UInt8* start, const UInt8* end, UInt8* dst) + UInt8* ConvertPixels(const UInt8* start, const UInt8* end, UInt8* dst) { while (start < end) { @@ -171,7 +171,7 @@ namespace Nz } template<> - UInt8* ConvertPixels(const UInt8* start, const UInt8* end, UInt8* dst) + UInt8* ConvertPixels(const UInt8* start, const UInt8* end, UInt8* dst) { while (start < end) { @@ -185,7 +185,7 @@ namespace Nz } template<> - UInt8* ConvertPixels(const UInt8* start, const UInt8* end, UInt8* dst) + UInt8* ConvertPixels(const UInt8* start, const UInt8* end, UInt8* dst) { UInt16* ptr = reinterpret_cast(dst); while (start < end) @@ -207,7 +207,7 @@ namespace Nz } template<> - UInt8* ConvertPixels(const UInt8* start, const UInt8* end, UInt8* dst) + UInt8* ConvertPixels(const UInt8* start, const UInt8* end, UInt8* dst) { while (start < end) { @@ -222,7 +222,7 @@ namespace Nz } template<> - UInt8* ConvertPixels(const UInt8* start, const UInt8* end, UInt8* dst) + UInt8* ConvertPixels(const UInt8* start, const UInt8* end, UInt8* dst) { UInt16* ptr = reinterpret_cast(dst); while (start < end) @@ -244,7 +244,7 @@ namespace Nz } template<> - UInt8* ConvertPixels(const UInt8* start, const UInt8* end, UInt8* dst) + UInt8* ConvertPixels(const UInt8* start, const UInt8* end, UInt8* dst) { while (start < end) { @@ -261,7 +261,7 @@ namespace Nz /**********************************BGRA8**********************************/ template<> - UInt8* ConvertPixels(const UInt8* start, const UInt8* end, UInt8* dst) + UInt8* ConvertPixels(const UInt8* start, const UInt8* end, UInt8* dst) { while (start < end) { @@ -274,7 +274,7 @@ namespace Nz } template<> - UInt8* ConvertPixels(const UInt8* start, const UInt8* end, UInt8* dst) + UInt8* ConvertPixels(const UInt8* start, const UInt8* end, UInt8* dst) { while (start < end) { @@ -289,7 +289,7 @@ namespace Nz } template<> - UInt8* ConvertPixels(const UInt8* start, const UInt8* end, UInt8* dst) + UInt8* ConvertPixels(const UInt8* start, const UInt8* end, UInt8* dst) { while (start < end) { @@ -302,7 +302,7 @@ namespace Nz } template<> - UInt8* ConvertPixels(const UInt8* start, const UInt8* end, UInt8* dst) + UInt8* ConvertPixels(const UInt8* start, const UInt8* end, UInt8* dst) { while (start < end) { @@ -316,7 +316,7 @@ namespace Nz } template<> - UInt8* ConvertPixels(const UInt8* start, const UInt8* end, UInt8* dst) + UInt8* ConvertPixels(const UInt8* start, const UInt8* end, UInt8* dst) { UInt16* ptr = reinterpret_cast(dst); while (start < end) @@ -338,7 +338,7 @@ namespace Nz } template<> - UInt8* ConvertPixels(const UInt8* start, const UInt8* end, UInt8* dst) + UInt8* ConvertPixels(const UInt8* start, const UInt8* end, UInt8* dst) { UInt16* ptr = reinterpret_cast(dst); while (start < end) @@ -360,7 +360,7 @@ namespace Nz } template<> - UInt8* ConvertPixels(const UInt8* start, const UInt8* end, UInt8* dst) + UInt8* ConvertPixels(const UInt8* start, const UInt8* end, UInt8* dst) { while (start < end) { @@ -375,7 +375,7 @@ namespace Nz } template<> - UInt8* ConvertPixels(const UInt8* start, const UInt8* end, UInt8* dst) + UInt8* ConvertPixels(const UInt8* start, const UInt8* end, UInt8* dst) { while (start < end) { @@ -392,7 +392,7 @@ namespace Nz /***********************************L8************************************/ template<> - UInt8* ConvertPixels(const UInt8* start, const UInt8* end, UInt8* dst) + UInt8* ConvertPixels(const UInt8* start, const UInt8* end, UInt8* dst) { while (start < end) { @@ -407,7 +407,7 @@ namespace Nz } template<> - UInt8* ConvertPixels(const UInt8* start, const UInt8* end, UInt8* dst) + UInt8* ConvertPixels(const UInt8* start, const UInt8* end, UInt8* dst) { while (start < end) { @@ -423,7 +423,7 @@ namespace Nz } template<> - UInt8* ConvertPixels(const UInt8* start, const UInt8* end, UInt8* dst) + UInt8* ConvertPixels(const UInt8* start, const UInt8* end, UInt8* dst) { while (start < end) { @@ -437,7 +437,7 @@ namespace Nz } template<> - UInt8* ConvertPixels(const UInt8* start, const UInt8* end, UInt8* dst) + UInt8* ConvertPixels(const UInt8* start, const UInt8* end, UInt8* dst) { UInt16* ptr = reinterpret_cast(dst); while (start < end) @@ -461,7 +461,7 @@ namespace Nz } template<> - UInt8* ConvertPixels(const UInt8* start, const UInt8* end, UInt8* dst) + UInt8* ConvertPixels(const UInt8* start, const UInt8* end, UInt8* dst) { while (start < end) { @@ -476,7 +476,7 @@ namespace Nz } template<> - UInt8* ConvertPixels(const UInt8* start, const UInt8* end, UInt8* dst) + UInt8* ConvertPixels(const UInt8* start, const UInt8* end, UInt8* dst) { UInt16* ptr = reinterpret_cast(dst); while (start < end) @@ -500,7 +500,7 @@ namespace Nz } template<> - UInt8* ConvertPixels(const UInt8* start, const UInt8* end, UInt8* dst) + UInt8* ConvertPixels(const UInt8* start, const UInt8* end, UInt8* dst) { while (start < end) { @@ -517,7 +517,7 @@ namespace Nz /***********************************LA8***********************************/ template<> - UInt8* ConvertPixels(const UInt8* start, const UInt8* end, UInt8* dst) + UInt8* ConvertPixels(const UInt8* start, const UInt8* end, UInt8* dst) { while (start < end) { @@ -530,7 +530,7 @@ namespace Nz } template<> - UInt8* ConvertPixels(const UInt8* start, const UInt8* end, UInt8* dst) + UInt8* ConvertPixels(const UInt8* start, const UInt8* end, UInt8* dst) { while (start < end) { @@ -545,7 +545,7 @@ namespace Nz } template<> - UInt8* ConvertPixels(const UInt8* start, const UInt8* end, UInt8* dst) + UInt8* ConvertPixels(const UInt8* start, const UInt8* end, UInt8* dst) { while (start < end) { @@ -561,7 +561,7 @@ namespace Nz } template<> - UInt8* ConvertPixels(const UInt8* start, const UInt8* end, UInt8* dst) + UInt8* ConvertPixels(const UInt8* start, const UInt8* end, UInt8* dst) { while (start < end) { @@ -574,7 +574,7 @@ namespace Nz } template<> - UInt8* ConvertPixels(const UInt8* start, const UInt8* end, UInt8* dst) + UInt8* ConvertPixels(const UInt8* start, const UInt8* end, UInt8* dst) { UInt16* ptr = reinterpret_cast(dst); while (start < end) @@ -595,7 +595,7 @@ namespace Nz } template<> - UInt8* ConvertPixels(const UInt8* start, const UInt8* end, UInt8* dst) + UInt8* ConvertPixels(const UInt8* start, const UInt8* end, UInt8* dst) { while (start < end) { @@ -610,7 +610,7 @@ namespace Nz } template<> - UInt8* ConvertPixels(const UInt8* start, const UInt8* end, UInt8* dst) + UInt8* ConvertPixels(const UInt8* start, const UInt8* end, UInt8* dst) { UInt16* ptr = reinterpret_cast(dst); while (start < end) @@ -631,7 +631,7 @@ namespace Nz } template<> - UInt8* ConvertPixels(const UInt8* start, const UInt8* end, UInt8* dst) + UInt8* ConvertPixels(const UInt8* start, const UInt8* end, UInt8* dst) { while (start < end) { @@ -648,7 +648,7 @@ namespace Nz /*********************************RGBA4***********************************/ template<> - UInt8* ConvertPixels(const UInt8* start, const UInt8* end, UInt8* dst) + UInt8* ConvertPixels(const UInt8* start, const UInt8* end, UInt8* dst) { while (start < end) { @@ -667,7 +667,7 @@ namespace Nz } template<> - UInt8* ConvertPixels(const UInt8* start, const UInt8* end, UInt8* dst) + UInt8* ConvertPixels(const UInt8* start, const UInt8* end, UInt8* dst) { while (start < end) { @@ -688,7 +688,7 @@ namespace Nz } template<> - UInt8* ConvertPixels(const UInt8* start, const UInt8* end, UInt8* dst) + UInt8* ConvertPixels(const UInt8* start, const UInt8* end, UInt8* dst) { while (start < end) { @@ -710,7 +710,7 @@ namespace Nz } template<> - UInt8* ConvertPixels(const UInt8* start, const UInt8* end, UInt8* dst) + UInt8* ConvertPixels(const UInt8* start, const UInt8* end, UInt8* dst) { while (start < end) { @@ -733,7 +733,7 @@ namespace Nz } template<> - UInt8* ConvertPixels(const UInt8* start, const UInt8* end, UInt8* dst) + UInt8* ConvertPixels(const UInt8* start, const UInt8* end, UInt8* dst) { while (start < end) { @@ -757,7 +757,7 @@ namespace Nz } template<> - UInt8* ConvertPixels(const UInt8* start, const UInt8* end, UInt8* dst) + UInt8* ConvertPixels(const UInt8* start, const UInt8* end, UInt8* dst) { UInt16* ptr = reinterpret_cast(dst); while (start < end) @@ -787,7 +787,7 @@ namespace Nz } template<> - UInt8* ConvertPixels(const UInt8* start, const UInt8* end, UInt8* dst) + UInt8* ConvertPixels(const UInt8* start, const UInt8* end, UInt8* dst) { while (start < end) { @@ -808,7 +808,7 @@ namespace Nz } template<> - UInt8* ConvertPixels(const UInt8* start, const UInt8* end, UInt8* dst) + UInt8* ConvertPixels(const UInt8* start, const UInt8* end, UInt8* dst) { while (start < end) { @@ -831,7 +831,7 @@ namespace Nz /*********************************RGB5A1**********************************/ template<> - UInt8* ConvertPixels(const UInt8* start, const UInt8* end, UInt8* dst) + UInt8* ConvertPixels(const UInt8* start, const UInt8* end, UInt8* dst) { while (start < end) { @@ -850,7 +850,7 @@ namespace Nz } template<> - UInt8* ConvertPixels(const UInt8* start, const UInt8* end, UInt8* dst) + UInt8* ConvertPixels(const UInt8* start, const UInt8* end, UInt8* dst) { while (start < end) { @@ -871,7 +871,7 @@ namespace Nz } template<> - UInt8* ConvertPixels(const UInt8* start, const UInt8* end, UInt8* dst) + UInt8* ConvertPixels(const UInt8* start, const UInt8* end, UInt8* dst) { while (start < end) { @@ -893,7 +893,7 @@ namespace Nz } template<> - UInt8* ConvertPixels(const UInt8* start, const UInt8* end, UInt8* dst) + UInt8* ConvertPixels(const UInt8* start, const UInt8* end, UInt8* dst) { while (start < end) { @@ -916,7 +916,7 @@ namespace Nz } template<> - UInt8* ConvertPixels(const UInt8* start, const UInt8* end, UInt8* dst) + UInt8* ConvertPixels(const UInt8* start, const UInt8* end, UInt8* dst) { while (start < end) { @@ -940,7 +940,7 @@ namespace Nz } template<> - UInt8* ConvertPixels(const UInt8* start, const UInt8* end, UInt8* dst) + UInt8* ConvertPixels(const UInt8* start, const UInt8* end, UInt8* dst) { while (start < end) { @@ -961,7 +961,7 @@ namespace Nz } template<> - UInt8* ConvertPixels(const UInt8* start, const UInt8* end, UInt8* dst) + UInt8* ConvertPixels(const UInt8* start, const UInt8* end, UInt8* dst) { UInt16* ptr = reinterpret_cast(dst); while (start < end) @@ -990,7 +990,7 @@ namespace Nz } template<> - UInt8* ConvertPixels(const UInt8* start, const UInt8* end, UInt8* dst) + UInt8* ConvertPixels(const UInt8* start, const UInt8* end, UInt8* dst) { while (start < end) { @@ -1013,7 +1013,7 @@ namespace Nz /**********************************RGB8***********************************/ template<> - UInt8* ConvertPixels(const UInt8* start, const UInt8* end, UInt8* dst) + UInt8* ConvertPixels(const UInt8* start, const UInt8* end, UInt8* dst) { while (start < end) { @@ -1028,7 +1028,7 @@ namespace Nz } template<> - UInt8* ConvertPixels(const UInt8* start, const UInt8* end, UInt8* dst) + UInt8* ConvertPixels(const UInt8* start, const UInt8* end, UInt8* dst) { while (start < end) { @@ -1044,7 +1044,7 @@ namespace Nz } template<> - UInt8* ConvertPixels(const UInt8* start, const UInt8* end, UInt8* dst) + UInt8* ConvertPixels(const UInt8* start, const UInt8* end, UInt8* dst) { while (start < end) { @@ -1057,7 +1057,7 @@ namespace Nz } template<> - UInt8* ConvertPixels(const UInt8* start, const UInt8* end, UInt8* dst) + UInt8* ConvertPixels(const UInt8* start, const UInt8* end, UInt8* dst) { while (start < end) { @@ -1071,7 +1071,7 @@ namespace Nz } template<> - UInt8* ConvertPixels(const UInt8* start, const UInt8* end, UInt8* dst) + UInt8* ConvertPixels(const UInt8* start, const UInt8* end, UInt8* dst) { UInt16* ptr = reinterpret_cast(dst); while (start < end) @@ -1093,7 +1093,7 @@ namespace Nz } template<> - UInt8* ConvertPixels(const UInt8* start, const UInt8* end, UInt8* dst) + UInt8* ConvertPixels(const UInt8* start, const UInt8* end, UInt8* dst) { UInt16* ptr = reinterpret_cast(dst); while (start < end) @@ -1115,7 +1115,7 @@ namespace Nz } template<> - UInt8* ConvertPixels(const UInt8* start, const UInt8* end, UInt8* dst) + UInt8* ConvertPixels(const UInt8* start, const UInt8* end, UInt8* dst) { while (start < end) { @@ -1132,7 +1132,7 @@ namespace Nz /**********************************RGBA8**********************************/ template<> - UInt8* ConvertPixels(const UInt8* start, const UInt8* end, UInt8* dst) + UInt8* ConvertPixels(const UInt8* start, const UInt8* end, UInt8* dst) { while (start < end) { @@ -1145,7 +1145,7 @@ namespace Nz } template<> - UInt8* ConvertPixels(const UInt8* start, const UInt8* end, UInt8* dst) + UInt8* ConvertPixels(const UInt8* start, const UInt8* end, UInt8* dst) { while (start < end) { @@ -1160,7 +1160,7 @@ namespace Nz } template<> - UInt8* ConvertPixels(const UInt8* start, const UInt8* end, UInt8* dst) + UInt8* ConvertPixels(const UInt8* start, const UInt8* end, UInt8* dst) { while (start < end) { @@ -1176,7 +1176,7 @@ namespace Nz } template<> - UInt8* ConvertPixels(const UInt8* start, const UInt8* end, UInt8* dst) + UInt8* ConvertPixels(const UInt8* start, const UInt8* end, UInt8* dst) { while (start < end) { @@ -1189,7 +1189,7 @@ namespace Nz } template<> - UInt8* ConvertPixels(const UInt8* start, const UInt8* end, UInt8* dst) + UInt8* ConvertPixels(const UInt8* start, const UInt8* end, UInt8* dst) { while (start < end) { @@ -1203,7 +1203,7 @@ namespace Nz } template<> - UInt8* ConvertPixels(const UInt8* start, const UInt8* end, UInt8* dst) + UInt8* ConvertPixels(const UInt8* start, const UInt8* end, UInt8* dst) { UInt16* ptr = reinterpret_cast(dst); while (start < end) @@ -1225,7 +1225,7 @@ namespace Nz } template<> - UInt8* ConvertPixels(const UInt8* start, const UInt8* end, UInt8* dst) + UInt8* ConvertPixels(const UInt8* start, const UInt8* end, UInt8* dst) { while (start < end) { @@ -1240,7 +1240,7 @@ namespace Nz } template<> - UInt8* ConvertPixels(const UInt8* start, const UInt8* end, UInt8* dst) + UInt8* ConvertPixels(const UInt8* start, const UInt8* end, UInt8* dst) { UInt16* ptr = reinterpret_cast(dst); while (start < end) @@ -1261,14 +1261,14 @@ namespace Nz return dst; } - template + template void RegisterConverter() { - PixelFormat::SetConvertFunction(format1, format2, &ConvertPixels); + PixelFormatInfo::SetConvertFunction(format1, format2, &ConvertPixels); } } - bool PixelFormat::Flip(PixelFlipping flipping, PixelFormatType format, unsigned int width, unsigned int height, unsigned int depth, const void* src, void* dst) + bool PixelFormatInfo::Flip(PixelFlipping flipping, PixelFormat format, unsigned int width, unsigned int height, unsigned int depth, const void* src, void* dst) { #if NAZARA_UTILITY_SAFE if (!IsValid(format)) @@ -1364,320 +1364,320 @@ namespace Nz return true; } - PixelFormatType PixelFormat::IdentifyFormat(const PixelFormatInfo& info) + PixelFormat PixelFormatInfo::IdentifyFormat(const PixelFormatDescription& info) { - for (unsigned int i = 0; i <= PixelFormatType_Max; ++i) + for (unsigned int i = 0; i <= PixelFormat_Max; ++i) { - PixelFormatInfo& info2 = s_pixelFormatInfos[i]; + PixelFormatDescription& info2 = s_pixelFormatInfos[i]; if (info.bitsPerPixel == info2.bitsPerPixel && info.content == info2.content && info.redMask == info2.redMask && info.greenMask == info2.greenMask && info.blueMask == info2.blueMask && info.alphaMask == info2.alphaMask && info.redType == info2.redType && info.greenType == info2.greenType && info.blueType == info2.blueType && info.alphaType == info2.alphaType) - return static_cast(i); + return static_cast(i); } - return PixelFormatType_Undefined; + return PixelFormat_Undefined; } - bool PixelFormat::Initialize() + bool PixelFormatInfo::Initialize() { Bitset<> b32(0xFFFFFFFF); b32.Resize(128); // Setup informations about every pixel format - s_pixelFormatInfos[PixelFormatType_A8] = PixelFormatInfo("A8", PixelFormatContent_ColorRGBA, 0, 0, 0, 0xFF, PixelFormatSubType_Unsigned); - s_pixelFormatInfos[PixelFormatType_BGR8] = PixelFormatInfo("BGR8", PixelFormatContent_ColorRGBA, 0x0000FF, 0x00FF00, 0xFF0000, 0, PixelFormatSubType_Unsigned); - s_pixelFormatInfos[PixelFormatType_BGRA8] = PixelFormatInfo("BGRA8", PixelFormatContent_ColorRGBA, 0x0000FF00, 0x00FF0000, 0xFF000000, 0x000000FF, PixelFormatSubType_Unsigned); - s_pixelFormatInfos[PixelFormatType_DXT1] = PixelFormatInfo("DXT1", PixelFormatContent_ColorRGBA, 8, PixelFormatSubType_Compressed); - s_pixelFormatInfos[PixelFormatType_DXT3] = PixelFormatInfo("DXT3", PixelFormatContent_ColorRGBA, 16, PixelFormatSubType_Compressed); - s_pixelFormatInfos[PixelFormatType_DXT5] = PixelFormatInfo("DXT5", PixelFormatContent_ColorRGBA, 16, PixelFormatSubType_Compressed); - s_pixelFormatInfos[PixelFormatType_L8] = PixelFormatInfo("L8", PixelFormatContent_ColorRGBA, 0xFF, 0xFF, 0xFF, 0, PixelFormatSubType_Unsigned); - s_pixelFormatInfos[PixelFormatType_LA8] = PixelFormatInfo("LA8", PixelFormatContent_ColorRGBA, 0xFF00, 0xFF00, 0xFF00, 0x00FF, PixelFormatSubType_Unsigned); - s_pixelFormatInfos[PixelFormatType_R8] = PixelFormatInfo("R8", PixelFormatContent_ColorRGBA, 0xFF, 0, 0, 0, PixelFormatSubType_Unsigned); - s_pixelFormatInfos[PixelFormatType_R8I] = PixelFormatInfo("R8I", PixelFormatContent_ColorRGBA, 0xFF, 0, 0, 0, PixelFormatSubType_Int); - s_pixelFormatInfos[PixelFormatType_R8UI] = PixelFormatInfo("R8UI", PixelFormatContent_ColorRGBA, 0xFF, 0, 0, 0, PixelFormatSubType_Unsigned); - s_pixelFormatInfos[PixelFormatType_R16] = PixelFormatInfo("R16", PixelFormatContent_ColorRGBA, 0xFFFF, 0, 0, 0, PixelFormatSubType_Unsigned); - s_pixelFormatInfos[PixelFormatType_R16F] = PixelFormatInfo("R16F", PixelFormatContent_ColorRGBA, 0xFFFF, 0, 0, 0, PixelFormatSubType_Half); - s_pixelFormatInfos[PixelFormatType_R16I] = PixelFormatInfo("R16I", PixelFormatContent_ColorRGBA, 0xFFFF, 0, 0, 0, PixelFormatSubType_Int); - s_pixelFormatInfos[PixelFormatType_R16UI] = PixelFormatInfo("R16UI", PixelFormatContent_ColorRGBA, 0xFFFF, 0, 0, 0, PixelFormatSubType_Unsigned); - s_pixelFormatInfos[PixelFormatType_R32F] = PixelFormatInfo("R32F", PixelFormatContent_ColorRGBA, 0xFFFFFFFF, 0, 0, 0, PixelFormatSubType_Float); - s_pixelFormatInfos[PixelFormatType_R32I] = PixelFormatInfo("R32I", PixelFormatContent_ColorRGBA, 0xFFFFFFFF, 0, 0, 0, PixelFormatSubType_Int); - s_pixelFormatInfos[PixelFormatType_R32UI] = PixelFormatInfo("R32UI", PixelFormatContent_ColorRGBA, 0xFFFFFFFF, 0, 0, 0, PixelFormatSubType_Unsigned); - s_pixelFormatInfos[PixelFormatType_RG8] = PixelFormatInfo("RG8", PixelFormatContent_ColorRGBA, 0xFF00, 0x00FF, 0, 0, PixelFormatSubType_Unsigned); - s_pixelFormatInfos[PixelFormatType_RG8I] = PixelFormatInfo("RG8I", PixelFormatContent_ColorRGBA, 0xFF00, 0x00FF, 0, 0, PixelFormatSubType_Int); - s_pixelFormatInfos[PixelFormatType_RG8UI] = PixelFormatInfo("RG8UI", PixelFormatContent_ColorRGBA, 0xFF00, 0x00FF, 0, 0, PixelFormatSubType_Unsigned); - s_pixelFormatInfos[PixelFormatType_RG16] = PixelFormatInfo("RG16", PixelFormatContent_ColorRGBA, 0xFFFF0000, 0x0000FFFF, 0, 0, PixelFormatSubType_Unsigned); - s_pixelFormatInfos[PixelFormatType_RG16F] = PixelFormatInfo("RG16F", PixelFormatContent_ColorRGBA, 0xFFFF0000, 0x0000FFFF, 0, 0, PixelFormatSubType_Half); - s_pixelFormatInfos[PixelFormatType_RG16I] = PixelFormatInfo("RG16I", PixelFormatContent_ColorRGBA, 0xFFFF0000, 0x0000FFFF, 0, 0, PixelFormatSubType_Int); - s_pixelFormatInfos[PixelFormatType_RG16UI] = PixelFormatInfo("RG16UI", PixelFormatContent_ColorRGBA, 0xFFFF0000, 0x0000FFFF, 0, 0, PixelFormatSubType_Unsigned); - s_pixelFormatInfos[PixelFormatType_RG32F] = PixelFormatInfo("RG32F", PixelFormatContent_ColorRGBA, 0xFFFFFFFF00000000, 0x00000000FFFFFFFF, 0, 0, PixelFormatSubType_Float); - s_pixelFormatInfos[PixelFormatType_RG32I] = PixelFormatInfo("RG32I", PixelFormatContent_ColorRGBA, 0xFFFFFFFF00000000, 0x00000000FFFFFFFF, 0, 0, PixelFormatSubType_Int); - s_pixelFormatInfos[PixelFormatType_RG32UI] = PixelFormatInfo("RG32UI", PixelFormatContent_ColorRGBA, 0xFFFFFFFF00000000, 0x00000000FFFFFFFF, 0, 0, PixelFormatSubType_Unsigned); - s_pixelFormatInfos[PixelFormatType_RGB8] = PixelFormatInfo("RGB8", PixelFormatContent_ColorRGBA, 0xFF000000, 0x00FF0000, 0x0000FF00, 0, PixelFormatSubType_Unsigned); - s_pixelFormatInfos[PixelFormatType_RGB16F] = PixelFormatInfo("RGB16F", PixelFormatContent_ColorRGBA, 0xFFFF00000000, 0x0000FFFF0000, 0x00000000FFFF, 0, PixelFormatSubType_Half); - s_pixelFormatInfos[PixelFormatType_RGB16I] = PixelFormatInfo("RGB16I", PixelFormatContent_ColorRGBA, 0xFFFF00000000, 0x0000FFFF0000, 0x00000000FFFF, 0, PixelFormatSubType_Int); - s_pixelFormatInfos[PixelFormatType_RGB16UI] = PixelFormatInfo("RGB16UI", PixelFormatContent_ColorRGBA, 0xFFFF000000000000, 0x0000FFFF00000000, 0x00000000FFFF0000, 0, PixelFormatSubType_Unsigned); - s_pixelFormatInfos[PixelFormatType_RGB32F] = PixelFormatInfo("RGB32F", PixelFormatContent_ColorRGBA, b32, b32 >> 32, b32 >> 64, 0, PixelFormatSubType_Float); - s_pixelFormatInfos[PixelFormatType_RGB32I] = PixelFormatInfo("RGB32I", PixelFormatContent_ColorRGBA, b32, b32 >> 32, b32 >> 64, 0, PixelFormatSubType_Int); - s_pixelFormatInfos[PixelFormatType_RGB32UI] = PixelFormatInfo("RGB32UI", PixelFormatContent_ColorRGBA, b32, b32 >> 32, b32 >> 64, 0, PixelFormatSubType_Unsigned); - s_pixelFormatInfos[PixelFormatType_RGBA4] = PixelFormatInfo("RGBA4", PixelFormatContent_ColorRGBA, 0xF000, 0x0F00, 0x00F0, 0x000F, PixelFormatSubType_Unsigned); - s_pixelFormatInfos[PixelFormatType_RGB5A1] = PixelFormatInfo("RGB5A1", PixelFormatContent_ColorRGBA, 0xF800, 0x07C0, 0x003E, 0x0001, PixelFormatSubType_Unsigned); - s_pixelFormatInfos[PixelFormatType_RGBA8] = PixelFormatInfo("RGBA8", PixelFormatContent_ColorRGBA, 0xFF000000, 0x00FF0000, 0x0000FF00, 0x000000FF, PixelFormatSubType_Unsigned); - s_pixelFormatInfos[PixelFormatType_RGBA16F] = PixelFormatInfo("RGBA16F", PixelFormatContent_ColorRGBA, 0xFFFF000000000000, 0x0000FFFF00000000, 0x00000000FFFF0000, 0x000000000000FFFF, PixelFormatSubType_Half); - s_pixelFormatInfos[PixelFormatType_RGBA16I] = PixelFormatInfo("RGBA16I", PixelFormatContent_ColorRGBA, 0xFFFF000000000000, 0x0000FFFF00000000, 0x00000000FFFF0000, 0x000000000000FFFF, PixelFormatSubType_Int); - s_pixelFormatInfos[PixelFormatType_RGBA16UI] = PixelFormatInfo("RGBA16UI", PixelFormatContent_ColorRGBA, 0xFFFF000000000000, 0x0000FFFF00000000, 0x00000000FFFF0000, 0x000000000000FFFF, PixelFormatSubType_Unsigned); - s_pixelFormatInfos[PixelFormatType_RGBA32F] = PixelFormatInfo("RGBA32F", PixelFormatContent_ColorRGBA, b32, b32 >> 32, b32 >> 64, b32 >> 96, PixelFormatSubType_Float); - s_pixelFormatInfos[PixelFormatType_RGBA32I] = PixelFormatInfo("RGBA32I", PixelFormatContent_ColorRGBA, b32, b32 >> 32, b32 >> 64, b32 >> 96, PixelFormatSubType_Int); - s_pixelFormatInfos[PixelFormatType_RGBA32UI] = PixelFormatInfo("RGBA32UI", PixelFormatContent_ColorRGBA, b32, b32 >> 32, b32 >> 64, b32 >> 96, PixelFormatSubType_Unsigned); - s_pixelFormatInfos[PixelFormatType_Depth16] = PixelFormatInfo("Depth16", PixelFormatContent_DepthStencil, 0xFFFF, 0, 0, 0, PixelFormatSubType_Unsigned); - s_pixelFormatInfos[PixelFormatType_Depth24] = PixelFormatInfo("Depth24", PixelFormatContent_DepthStencil, 0xFFFFFF, 0, 0, 0, PixelFormatSubType_Unsigned); - s_pixelFormatInfos[PixelFormatType_Depth24Stencil8] = PixelFormatInfo("Depth24Stencil8", PixelFormatContent_DepthStencil, 0xFFFFFF00, 0x000000FF, 0, 0, PixelFormatSubType_Unsigned); - s_pixelFormatInfos[PixelFormatType_Depth32] = PixelFormatInfo("Depth32", PixelFormatContent_DepthStencil, 0xFFFFFFFF, 0, 0, 0, PixelFormatSubType_Unsigned); - s_pixelFormatInfos[PixelFormatType_Stencil1] = PixelFormatInfo("Stencil1", PixelFormatContent_Stencil, 0x1, 0, 0, 0, PixelFormatSubType_Unsigned); - s_pixelFormatInfos[PixelFormatType_Stencil4] = PixelFormatInfo("Stencil4", PixelFormatContent_Stencil, 0xF, 0, 0, 0, PixelFormatSubType_Unsigned); - s_pixelFormatInfos[PixelFormatType_Stencil8] = PixelFormatInfo("Stencil8", PixelFormatContent_Stencil, 0xFF, 0, 0, 0, PixelFormatSubType_Unsigned); - s_pixelFormatInfos[PixelFormatType_Stencil16] = PixelFormatInfo("Stencil16", PixelFormatContent_Stencil, 0xFFFF, 0, 0, 0, PixelFormatSubType_Unsigned); + s_pixelFormatInfos[PixelFormat_A8] = PixelFormatDescription("A8", PixelFormatContent_ColorRGBA, 0, 0, 0, 0xFF, PixelFormatSubType_Unsigned); + s_pixelFormatInfos[PixelFormat_BGR8] = PixelFormatDescription("BGR8", PixelFormatContent_ColorRGBA, 0x0000FF, 0x00FF00, 0xFF0000, 0, PixelFormatSubType_Unsigned); + s_pixelFormatInfos[PixelFormat_BGRA8] = PixelFormatDescription("BGRA8", PixelFormatContent_ColorRGBA, 0x0000FF00, 0x00FF0000, 0xFF000000, 0x000000FF, PixelFormatSubType_Unsigned); + s_pixelFormatInfos[PixelFormat_DXT1] = PixelFormatDescription("DXT1", PixelFormatContent_ColorRGBA, 8, PixelFormatSubType_Compressed); + s_pixelFormatInfos[PixelFormat_DXT3] = PixelFormatDescription("DXT3", PixelFormatContent_ColorRGBA, 16, PixelFormatSubType_Compressed); + s_pixelFormatInfos[PixelFormat_DXT5] = PixelFormatDescription("DXT5", PixelFormatContent_ColorRGBA, 16, PixelFormatSubType_Compressed); + s_pixelFormatInfos[PixelFormat_L8] = PixelFormatDescription("L8", PixelFormatContent_ColorRGBA, 0xFF, 0xFF, 0xFF, 0, PixelFormatSubType_Unsigned); + s_pixelFormatInfos[PixelFormat_LA8] = PixelFormatDescription("LA8", PixelFormatContent_ColorRGBA, 0xFF00, 0xFF00, 0xFF00, 0x00FF, PixelFormatSubType_Unsigned); + s_pixelFormatInfos[PixelFormat_R8] = PixelFormatDescription("R8", PixelFormatContent_ColorRGBA, 0xFF, 0, 0, 0, PixelFormatSubType_Unsigned); + s_pixelFormatInfos[PixelFormat_R8I] = PixelFormatDescription("R8I", PixelFormatContent_ColorRGBA, 0xFF, 0, 0, 0, PixelFormatSubType_Int); + s_pixelFormatInfos[PixelFormat_R8UI] = PixelFormatDescription("R8UI", PixelFormatContent_ColorRGBA, 0xFF, 0, 0, 0, PixelFormatSubType_Unsigned); + s_pixelFormatInfos[PixelFormat_R16] = PixelFormatDescription("R16", PixelFormatContent_ColorRGBA, 0xFFFF, 0, 0, 0, PixelFormatSubType_Unsigned); + s_pixelFormatInfos[PixelFormat_R16F] = PixelFormatDescription("R16F", PixelFormatContent_ColorRGBA, 0xFFFF, 0, 0, 0, PixelFormatSubType_Half); + s_pixelFormatInfos[PixelFormat_R16I] = PixelFormatDescription("R16I", PixelFormatContent_ColorRGBA, 0xFFFF, 0, 0, 0, PixelFormatSubType_Int); + s_pixelFormatInfos[PixelFormat_R16UI] = PixelFormatDescription("R16UI", PixelFormatContent_ColorRGBA, 0xFFFF, 0, 0, 0, PixelFormatSubType_Unsigned); + s_pixelFormatInfos[PixelFormat_R32F] = PixelFormatDescription("R32F", PixelFormatContent_ColorRGBA, 0xFFFFFFFF, 0, 0, 0, PixelFormatSubType_Float); + s_pixelFormatInfos[PixelFormat_R32I] = PixelFormatDescription("R32I", PixelFormatContent_ColorRGBA, 0xFFFFFFFF, 0, 0, 0, PixelFormatSubType_Int); + s_pixelFormatInfos[PixelFormat_R32UI] = PixelFormatDescription("R32UI", PixelFormatContent_ColorRGBA, 0xFFFFFFFF, 0, 0, 0, PixelFormatSubType_Unsigned); + s_pixelFormatInfos[PixelFormat_RG8] = PixelFormatDescription("RG8", PixelFormatContent_ColorRGBA, 0xFF00, 0x00FF, 0, 0, PixelFormatSubType_Unsigned); + s_pixelFormatInfos[PixelFormat_RG8I] = PixelFormatDescription("RG8I", PixelFormatContent_ColorRGBA, 0xFF00, 0x00FF, 0, 0, PixelFormatSubType_Int); + s_pixelFormatInfos[PixelFormat_RG8UI] = PixelFormatDescription("RG8UI", PixelFormatContent_ColorRGBA, 0xFF00, 0x00FF, 0, 0, PixelFormatSubType_Unsigned); + s_pixelFormatInfos[PixelFormat_RG16] = PixelFormatDescription("RG16", PixelFormatContent_ColorRGBA, 0xFFFF0000, 0x0000FFFF, 0, 0, PixelFormatSubType_Unsigned); + s_pixelFormatInfos[PixelFormat_RG16F] = PixelFormatDescription("RG16F", PixelFormatContent_ColorRGBA, 0xFFFF0000, 0x0000FFFF, 0, 0, PixelFormatSubType_Half); + s_pixelFormatInfos[PixelFormat_RG16I] = PixelFormatDescription("RG16I", PixelFormatContent_ColorRGBA, 0xFFFF0000, 0x0000FFFF, 0, 0, PixelFormatSubType_Int); + s_pixelFormatInfos[PixelFormat_RG16UI] = PixelFormatDescription("RG16UI", PixelFormatContent_ColorRGBA, 0xFFFF0000, 0x0000FFFF, 0, 0, PixelFormatSubType_Unsigned); + s_pixelFormatInfos[PixelFormat_RG32F] = PixelFormatDescription("RG32F", PixelFormatContent_ColorRGBA, 0xFFFFFFFF00000000, 0x00000000FFFFFFFF, 0, 0, PixelFormatSubType_Float); + s_pixelFormatInfos[PixelFormat_RG32I] = PixelFormatDescription("RG32I", PixelFormatContent_ColorRGBA, 0xFFFFFFFF00000000, 0x00000000FFFFFFFF, 0, 0, PixelFormatSubType_Int); + s_pixelFormatInfos[PixelFormat_RG32UI] = PixelFormatDescription("RG32UI", PixelFormatContent_ColorRGBA, 0xFFFFFFFF00000000, 0x00000000FFFFFFFF, 0, 0, PixelFormatSubType_Unsigned); + s_pixelFormatInfos[PixelFormat_RGB8] = PixelFormatDescription("RGB8", PixelFormatContent_ColorRGBA, 0xFF000000, 0x00FF0000, 0x0000FF00, 0, PixelFormatSubType_Unsigned); + s_pixelFormatInfos[PixelFormat_RGB16F] = PixelFormatDescription("RGB16F", PixelFormatContent_ColorRGBA, 0xFFFF00000000, 0x0000FFFF0000, 0x00000000FFFF, 0, PixelFormatSubType_Half); + s_pixelFormatInfos[PixelFormat_RGB16I] = PixelFormatDescription("RGB16I", PixelFormatContent_ColorRGBA, 0xFFFF00000000, 0x0000FFFF0000, 0x00000000FFFF, 0, PixelFormatSubType_Int); + s_pixelFormatInfos[PixelFormat_RGB16UI] = PixelFormatDescription("RGB16UI", PixelFormatContent_ColorRGBA, 0xFFFF000000000000, 0x0000FFFF00000000, 0x00000000FFFF0000, 0, PixelFormatSubType_Unsigned); + s_pixelFormatInfos[PixelFormat_RGB32F] = PixelFormatDescription("RGB32F", PixelFormatContent_ColorRGBA, b32, b32 >> 32, b32 >> 64, 0, PixelFormatSubType_Float); + s_pixelFormatInfos[PixelFormat_RGB32I] = PixelFormatDescription("RGB32I", PixelFormatContent_ColorRGBA, b32, b32 >> 32, b32 >> 64, 0, PixelFormatSubType_Int); + s_pixelFormatInfos[PixelFormat_RGB32UI] = PixelFormatDescription("RGB32UI", PixelFormatContent_ColorRGBA, b32, b32 >> 32, b32 >> 64, 0, PixelFormatSubType_Unsigned); + s_pixelFormatInfos[PixelFormat_RGBA4] = PixelFormatDescription("RGBA4", PixelFormatContent_ColorRGBA, 0xF000, 0x0F00, 0x00F0, 0x000F, PixelFormatSubType_Unsigned); + s_pixelFormatInfos[PixelFormat_RGB5A1] = PixelFormatDescription("RGB5A1", PixelFormatContent_ColorRGBA, 0xF800, 0x07C0, 0x003E, 0x0001, PixelFormatSubType_Unsigned); + s_pixelFormatInfos[PixelFormat_RGBA8] = PixelFormatDescription("RGBA8", PixelFormatContent_ColorRGBA, 0xFF000000, 0x00FF0000, 0x0000FF00, 0x000000FF, PixelFormatSubType_Unsigned); + s_pixelFormatInfos[PixelFormat_RGBA16F] = PixelFormatDescription("RGBA16F", PixelFormatContent_ColorRGBA, 0xFFFF000000000000, 0x0000FFFF00000000, 0x00000000FFFF0000, 0x000000000000FFFF, PixelFormatSubType_Half); + s_pixelFormatInfos[PixelFormat_RGBA16I] = PixelFormatDescription("RGBA16I", PixelFormatContent_ColorRGBA, 0xFFFF000000000000, 0x0000FFFF00000000, 0x00000000FFFF0000, 0x000000000000FFFF, PixelFormatSubType_Int); + s_pixelFormatInfos[PixelFormat_RGBA16UI] = PixelFormatDescription("RGBA16UI", PixelFormatContent_ColorRGBA, 0xFFFF000000000000, 0x0000FFFF00000000, 0x00000000FFFF0000, 0x000000000000FFFF, PixelFormatSubType_Unsigned); + s_pixelFormatInfos[PixelFormat_RGBA32F] = PixelFormatDescription("RGBA32F", PixelFormatContent_ColorRGBA, b32, b32 >> 32, b32 >> 64, b32 >> 96, PixelFormatSubType_Float); + s_pixelFormatInfos[PixelFormat_RGBA32I] = PixelFormatDescription("RGBA32I", PixelFormatContent_ColorRGBA, b32, b32 >> 32, b32 >> 64, b32 >> 96, PixelFormatSubType_Int); + s_pixelFormatInfos[PixelFormat_RGBA32UI] = PixelFormatDescription("RGBA32UI", PixelFormatContent_ColorRGBA, b32, b32 >> 32, b32 >> 64, b32 >> 96, PixelFormatSubType_Unsigned); + s_pixelFormatInfos[PixelFormat_Depth16] = PixelFormatDescription("Depth16", PixelFormatContent_DepthStencil, 0xFFFF, 0, 0, 0, PixelFormatSubType_Unsigned); + s_pixelFormatInfos[PixelFormat_Depth24] = PixelFormatDescription("Depth24", PixelFormatContent_DepthStencil, 0xFFFFFF, 0, 0, 0, PixelFormatSubType_Unsigned); + s_pixelFormatInfos[PixelFormat_Depth24Stencil8] = PixelFormatDescription("Depth24Stencil8", PixelFormatContent_DepthStencil, 0xFFFFFF00, 0x000000FF, 0, 0, PixelFormatSubType_Unsigned); + s_pixelFormatInfos[PixelFormat_Depth32] = PixelFormatDescription("Depth32", PixelFormatContent_DepthStencil, 0xFFFFFFFF, 0, 0, 0, PixelFormatSubType_Unsigned); + s_pixelFormatInfos[PixelFormat_Stencil1] = PixelFormatDescription("Stencil1", PixelFormatContent_Stencil, 0x1, 0, 0, 0, PixelFormatSubType_Unsigned); + s_pixelFormatInfos[PixelFormat_Stencil4] = PixelFormatDescription("Stencil4", PixelFormatContent_Stencil, 0xF, 0, 0, 0, PixelFormatSubType_Unsigned); + s_pixelFormatInfos[PixelFormat_Stencil8] = PixelFormatDescription("Stencil8", PixelFormatContent_Stencil, 0xFF, 0, 0, 0, PixelFormatSubType_Unsigned); + s_pixelFormatInfos[PixelFormat_Stencil16] = PixelFormatDescription("Stencil16", PixelFormatContent_Stencil, 0xFFFF, 0, 0, 0, PixelFormatSubType_Unsigned); - for (unsigned int i = 0; i <= PixelFormatType_Max; ++i) + for (unsigned int i = 0; i <= PixelFormat_Max; ++i) { if (!s_pixelFormatInfos[i].Validate()) - NazaraWarning("Pixel format 0x" + String::Number(i, 16) + " (" + GetName(static_cast(i)) + ") failed validation tests"); + NazaraWarning("Pixel format 0x" + String::Number(i, 16) + " (" + GetName(static_cast(i)) + ") failed validation tests"); } // Reset functions - std::memset(s_convertFunctions, 0, (PixelFormatType_Max+1)*(PixelFormatType_Max+1)*sizeof(PixelFormat::ConvertFunction)); + std::memset(s_convertFunctions, 0, (PixelFormat_Max+1)*(PixelFormat_Max+1)*sizeof(PixelFormatInfo::ConvertFunction)); /***********************************A8************************************/ - RegisterConverter(); - RegisterConverter(); - RegisterConverter(); - RegisterConverter(); - RegisterConverter(); + RegisterConverter(); + RegisterConverter(); + RegisterConverter(); + RegisterConverter(); + RegisterConverter(); /**********************************BGR8***********************************/ - RegisterConverter(); - RegisterConverter(); - RegisterConverter();/* - RegisterConverter(); - RegisterConverter(); - RegisterConverter(); - RegisterConverter(); - RegisterConverter(); - RegisterConverter(); - RegisterConverter(); - RegisterConverter();*/ - RegisterConverter(); - RegisterConverter(); - RegisterConverter(); - RegisterConverter(); + RegisterConverter(); + RegisterConverter(); + RegisterConverter();/* + RegisterConverter(); + RegisterConverter(); + RegisterConverter(); + RegisterConverter(); + RegisterConverter(); + RegisterConverter(); + RegisterConverter(); + RegisterConverter();*/ + RegisterConverter(); + RegisterConverter(); + RegisterConverter(); + RegisterConverter(); /**********************************BGRA8**********************************/ - RegisterConverter(); - RegisterConverter(); - RegisterConverter(); - RegisterConverter();/* - RegisterConverter(); - RegisterConverter(); - RegisterConverter(); - RegisterConverter(); - RegisterConverter(); - RegisterConverter(); - RegisterConverter(); - RegisterConverter();*/ - RegisterConverter(); - RegisterConverter(); - RegisterConverter(); - RegisterConverter(); + RegisterConverter(); + RegisterConverter(); + RegisterConverter(); + RegisterConverter();/* + RegisterConverter(); + RegisterConverter(); + RegisterConverter(); + RegisterConverter(); + RegisterConverter(); + RegisterConverter(); + RegisterConverter(); + RegisterConverter();*/ + RegisterConverter(); + RegisterConverter(); + RegisterConverter(); + RegisterConverter(); /**********************************DXT1***********************************/ ///TODO: Décompresseur DXT1 /* - RegisterConverter(); - RegisterConverter(); - RegisterConverter(); - RegisterConverter(); - RegisterConverter(); - RegisterConverter(); - RegisterConverter(); - RegisterConverter(); - RegisterConverter(); - RegisterConverter(); - RegisterConverter(); - RegisterConverter(); - RegisterConverter(); - RegisterConverter(); - RegisterConverter(); - RegisterConverter(); - RegisterConverter(); - RegisterConverter(); + RegisterConverter(); + RegisterConverter(); + RegisterConverter(); + RegisterConverter(); + RegisterConverter(); + RegisterConverter(); + RegisterConverter(); + RegisterConverter(); + RegisterConverter(); + RegisterConverter(); + RegisterConverter(); + RegisterConverter(); + RegisterConverter(); + RegisterConverter(); + RegisterConverter(); + RegisterConverter(); + RegisterConverter(); + RegisterConverter(); */ /**********************************DXT3***********************************/ ///TODO: Décompresseur DXT3 /* - RegisterConverter(); - RegisterConverter(); - RegisterConverter(); - RegisterConverter(); - RegisterConverter(); - RegisterConverter(); - RegisterConverter(); - RegisterConverter(); - RegisterConverter(); - RegisterConverter(); - RegisterConverter(); - RegisterConverter(); - RegisterConverter(); - RegisterConverter(); - RegisterConverter(); - RegisterConverter(); - RegisterConverter(); - RegisterConverter(); + RegisterConverter(); + RegisterConverter(); + RegisterConverter(); + RegisterConverter(); + RegisterConverter(); + RegisterConverter(); + RegisterConverter(); + RegisterConverter(); + RegisterConverter(); + RegisterConverter(); + RegisterConverter(); + RegisterConverter(); + RegisterConverter(); + RegisterConverter(); + RegisterConverter(); + RegisterConverter(); + RegisterConverter(); + RegisterConverter(); */ /**********************************DXT5***********************************/ ///TODO: Décompresseur DXT5 /* - RegisterConverter(); - RegisterConverter(); - RegisterConverter(); - RegisterConverter(); - RegisterConverter(); - RegisterConverter(); - RegisterConverter(); - RegisterConverter(); - RegisterConverter(); - RegisterConverter(); - RegisterConverter(); - RegisterConverter(); - RegisterConverter(); - RegisterConverter(); - RegisterConverter(); - RegisterConverter(); - RegisterConverter(); - RegisterConverter(); + RegisterConverter(); + RegisterConverter(); + RegisterConverter(); + RegisterConverter(); + RegisterConverter(); + RegisterConverter(); + RegisterConverter(); + RegisterConverter(); + RegisterConverter(); + RegisterConverter(); + RegisterConverter(); + RegisterConverter(); + RegisterConverter(); + RegisterConverter(); + RegisterConverter(); + RegisterConverter(); + RegisterConverter(); + RegisterConverter(); */ /***********************************L8************************************/ - RegisterConverter(); - RegisterConverter(); - RegisterConverter();/* - RegisterConverter(); - RegisterConverter(); - RegisterConverter(); - RegisterConverter(); - RegisterConverter(); - RegisterConverter(); - RegisterConverter(); - RegisterConverter();*/ - RegisterConverter(); - RegisterConverter(); - RegisterConverter(); - RegisterConverter(); + RegisterConverter(); + RegisterConverter(); + RegisterConverter();/* + RegisterConverter(); + RegisterConverter(); + RegisterConverter(); + RegisterConverter(); + RegisterConverter(); + RegisterConverter(); + RegisterConverter(); + RegisterConverter();*/ + RegisterConverter(); + RegisterConverter(); + RegisterConverter(); + RegisterConverter(); /***********************************LA8***********************************/ - RegisterConverter(); - RegisterConverter(); - RegisterConverter(); - RegisterConverter();/* - RegisterConverter(); - RegisterConverter(); - RegisterConverter(); - RegisterConverter(); - RegisterConverter(); - RegisterConverter(); - RegisterConverter(); - RegisterConverter();*/ - RegisterConverter(); - RegisterConverter(); - RegisterConverter(); - RegisterConverter(); + RegisterConverter(); + RegisterConverter(); + RegisterConverter(); + RegisterConverter();/* + RegisterConverter(); + RegisterConverter(); + RegisterConverter(); + RegisterConverter(); + RegisterConverter(); + RegisterConverter(); + RegisterConverter(); + RegisterConverter();*/ + RegisterConverter(); + RegisterConverter(); + RegisterConverter(); + RegisterConverter(); /**********************************RGBA4**********************************/ - RegisterConverter(); - RegisterConverter(); - RegisterConverter(); - RegisterConverter(); - RegisterConverter();/* - RegisterConverter(); - RegisterConverter(); - RegisterConverter(); - RegisterConverter(); - RegisterConverter(); - RegisterConverter(); - RegisterConverter(); - RegisterConverter();*/ - RegisterConverter(); - RegisterConverter(); - RegisterConverter(); + RegisterConverter(); + RegisterConverter(); + RegisterConverter(); + RegisterConverter(); + RegisterConverter();/* + RegisterConverter(); + RegisterConverter(); + RegisterConverter(); + RegisterConverter(); + RegisterConverter(); + RegisterConverter(); + RegisterConverter(); + RegisterConverter();*/ + RegisterConverter(); + RegisterConverter(); + RegisterConverter(); /*********************************RGB5A1**********************************/ - RegisterConverter(); - RegisterConverter(); - RegisterConverter(); - RegisterConverter(); - RegisterConverter();/* - RegisterConverter(); - RegisterConverter(); - RegisterConverter(); - RegisterConverter(); - RegisterConverter(); - RegisterConverter(); - RegisterConverter(); - RegisterConverter();*/ - RegisterConverter(); - RegisterConverter(); - RegisterConverter(); + RegisterConverter(); + RegisterConverter(); + RegisterConverter(); + RegisterConverter(); + RegisterConverter();/* + RegisterConverter(); + RegisterConverter(); + RegisterConverter(); + RegisterConverter(); + RegisterConverter(); + RegisterConverter(); + RegisterConverter(); + RegisterConverter();*/ + RegisterConverter(); + RegisterConverter(); + RegisterConverter(); /**********************************RGB8***********************************/ - RegisterConverter(); - RegisterConverter(); - RegisterConverter(); - RegisterConverter();/* - RegisterConverter(); - RegisterConverter(); - RegisterConverter(); - RegisterConverter(); - RegisterConverter(); - RegisterConverter(); - RegisterConverter(); - RegisterConverter();*/ - RegisterConverter(); - RegisterConverter(); - RegisterConverter(); + RegisterConverter(); + RegisterConverter(); + RegisterConverter(); + RegisterConverter();/* + RegisterConverter(); + RegisterConverter(); + RegisterConverter(); + RegisterConverter(); + RegisterConverter(); + RegisterConverter(); + RegisterConverter(); + RegisterConverter();*/ + RegisterConverter(); + RegisterConverter(); + RegisterConverter(); /**********************************RGBA8**********************************/ - RegisterConverter(); - RegisterConverter(); - RegisterConverter(); - RegisterConverter(); - RegisterConverter();/* - RegisterConverter(); - RegisterConverter(); - RegisterConverter(); - RegisterConverter(); - RegisterConverter(); - RegisterConverter(); - RegisterConverter(); - RegisterConverter();*/ - RegisterConverter(); - RegisterConverter(); - RegisterConverter(); + RegisterConverter(); + RegisterConverter(); + RegisterConverter(); + RegisterConverter(); + RegisterConverter();/* + RegisterConverter(); + RegisterConverter(); + RegisterConverter(); + RegisterConverter(); + RegisterConverter(); + RegisterConverter(); + RegisterConverter(); + RegisterConverter();*/ + RegisterConverter(); + RegisterConverter(); + RegisterConverter(); return true; } - void PixelFormat::Uninitialize() + void PixelFormatInfo::Uninitialize() { - for (unsigned int i = 0; i <= PixelFormatType_Max; ++i) + for (unsigned int i = 0; i <= PixelFormat_Max; ++i) s_pixelFormatInfos[i].Clear(); - std::memset(s_convertFunctions, 0, (PixelFormatType_Max+1)*(PixelFormatType_Max+1)*sizeof(PixelFormat::ConvertFunction)); + std::memset(s_convertFunctions, 0, (PixelFormat_Max+1)*(PixelFormat_Max+1)*sizeof(PixelFormatInfo::ConvertFunction)); for (unsigned int i = 0; i <= PixelFlipping_Max; ++i) s_flipFunctions[i].clear(); } - PixelFormatInfo PixelFormat::s_pixelFormatInfos[PixelFormatType_Max + 1]; - PixelFormat::ConvertFunction PixelFormat::s_convertFunctions[PixelFormatType_Max+1][PixelFormatType_Max+1]; - std::map PixelFormat::s_flipFunctions[PixelFlipping_Max+1]; + PixelFormatDescription PixelFormatInfo::s_pixelFormatInfos[PixelFormat_Max + 1]; + PixelFormatInfo::ConvertFunction PixelFormatInfo::s_convertFunctions[PixelFormat_Max+1][PixelFormat_Max+1]; + std::map PixelFormatInfo::s_flipFunctions[PixelFlipping_Max+1]; } diff --git a/src/Nazara/Utility/Utility.cpp b/src/Nazara/Utility/Utility.cpp index 5feff8f33..8737a93e3 100644 --- a/src/Nazara/Utility/Utility.cpp +++ b/src/Nazara/Utility/Utility.cpp @@ -93,7 +93,7 @@ namespace Nz return false; } - if (!PixelFormat::Initialize()) + if (!PixelFormatInfo::Initialize()) { NazaraError("Failed to initialize pixel formats"); return false; @@ -176,7 +176,7 @@ namespace Nz VertexDeclaration::Uninitialize(); Skeleton::Uninitialize(); - PixelFormat::Uninitialize(); + PixelFormatInfo::Uninitialize(); Mesh::Uninitialize(); Image::Uninitialize(); Font::Uninitialize(); diff --git a/src/Nazara/VulkanRenderer/VkRenderWindow.cpp b/src/Nazara/VulkanRenderer/VkRenderWindow.cpp index 7e5ce6fff..3a6d43eee 100644 --- a/src/Nazara/VulkanRenderer/VkRenderWindow.cpp +++ b/src/Nazara/VulkanRenderer/VkRenderWindow.cpp @@ -94,38 +94,38 @@ namespace Nz if (!parameters.depthFormats.empty()) { - for (PixelFormatType format : parameters.depthFormats) + for (PixelFormat format : parameters.depthFormats) { switch (format) { - case PixelFormatType_Depth16: + case PixelFormat_Depth16: m_depthStencilFormat = VK_FORMAT_D16_UNORM; break; - case PixelFormatType_Depth24: - case PixelFormatType_Depth24Stencil8: + case PixelFormat_Depth24: + case PixelFormat_Depth24Stencil8: m_depthStencilFormat = VK_FORMAT_D24_UNORM_S8_UINT; break; - case PixelFormatType_Depth32: + case PixelFormat_Depth32: m_depthStencilFormat = VK_FORMAT_D32_SFLOAT; break; - case PixelFormatType_Stencil1: - case PixelFormatType_Stencil4: - case PixelFormatType_Stencil8: + case PixelFormat_Stencil1: + case PixelFormat_Stencil4: + case PixelFormat_Stencil8: m_depthStencilFormat = VK_FORMAT_S8_UINT; break; - case PixelFormatType_Stencil16: + case PixelFormat_Stencil16: m_depthStencilFormat = VK_FORMAT_MAX_ENUM; break; default: { - PixelFormatContent formatContent = PixelFormat::GetContent(format); + PixelFormatContent formatContent = PixelFormatInfo::GetContent(format); if (formatContent != PixelFormatContent_DepthStencil && formatContent != PixelFormatContent_Stencil) - NazaraWarning("Invalid format " + PixelFormat::GetName(format) + " for depth-stencil attachment"); + NazaraWarning("Invalid format " + PixelFormatInfo::GetName(format) + " for depth-stencil attachment"); m_depthStencilFormat = VK_FORMAT_MAX_ENUM; break; diff --git a/src/Nazara/VulkanRenderer/VulkanTexture.cpp b/src/Nazara/VulkanRenderer/VulkanTexture.cpp index 186bbebbb..3a83d1c8c 100644 --- a/src/Nazara/VulkanRenderer/VulkanTexture.cpp +++ b/src/Nazara/VulkanRenderer/VulkanTexture.cpp @@ -156,7 +156,7 @@ namespace Nz vmaDestroyImage(m_device.GetMemoryAllocator(), m_image, m_allocation); } - PixelFormatType VulkanTexture::GetFormat() const + PixelFormat VulkanTexture::GetFormat() const { return m_params.pixelFormat; } @@ -178,7 +178,7 @@ namespace Nz bool VulkanTexture::Update(const void* ptr) { - std::size_t textureSize = m_params.width * m_params.height * m_params.depth * PixelFormat::GetBytesPerPixel(m_params.pixelFormat); + std::size_t textureSize = m_params.width * m_params.height * m_params.depth * PixelFormatInfo::GetBytesPerPixel(m_params.pixelFormat); VkBufferCreateInfo createInfo = {}; createInfo.sType = VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO; @@ -229,7 +229,7 @@ namespace Nz return true; } - void VulkanTexture::InitForFormat(PixelFormatType pixelFormat, VkImageCreateInfo& createImage, VkImageViewCreateInfo& createImageView) + void VulkanTexture::InitForFormat(PixelFormat pixelFormat, VkImageCreateInfo& createImage, VkImageViewCreateInfo& createImageView) { createImageView.components = { VK_COMPONENT_SWIZZLE_R, @@ -240,7 +240,7 @@ namespace Nz switch (pixelFormat) { - case PixelFormatType_L8: + case PixelFormat_L8: { createImage.format = VK_FORMAT_R8_SRGB; createImageView.format = createImage.format; @@ -253,7 +253,7 @@ namespace Nz break; } - case PixelFormatType_LA8: + case PixelFormat_LA8: { createImage.format = VK_FORMAT_R8G8_SRGB; createImageView.format = createImage.format; @@ -266,14 +266,14 @@ namespace Nz break; } - case PixelFormatType_RGB8: + case PixelFormat_RGB8: { createImage.format = VK_FORMAT_R8G8B8_SRGB; createImageView.format = createImage.format; break; } - case PixelFormatType_RGBA8: + case PixelFormat_RGBA8: { createImage.format = VK_FORMAT_R8G8B8A8_SRGB; createImageView.format = createImage.format; @@ -281,7 +281,7 @@ namespace Nz } default: - throw std::runtime_error(("Unsupported pixel format " + PixelFormat::GetName(pixelFormat)).ToStdString()); + throw std::runtime_error(("Unsupported pixel format " + PixelFormatInfo::GetName(pixelFormat)).ToStdString()); } } } diff --git a/src/NazaraSDK/Components/GraphicsComponent.cpp b/src/NazaraSDK/Components/GraphicsComponent.cpp index b7251fd95..80ab3805b 100644 --- a/src/NazaraSDK/Components/GraphicsComponent.cpp +++ b/src/NazaraSDK/Components/GraphicsComponent.cpp @@ -137,7 +137,7 @@ namespace Ndk if (!m_reflectionMap) { m_reflectionMap = Nz::Texture::New(); - if (!m_reflectionMap->Create(Nz::ImageType_Cubemap, Nz::PixelFormatType_RGB8, m_reflectionMapSize, m_reflectionMapSize)) + if (!m_reflectionMap->Create(Nz::ImageType_Cubemap, Nz::PixelFormat_RGB8, m_reflectionMapSize, m_reflectionMapSize)) { NazaraWarning("Failed to create reflection map, reflections will be disabled for this entity"); return;