Merge branch 'master' into vulkan
Former-commit-id: f91a339c32e2ab8f0ef3fd2cfc5c038ceccdc401
This commit is contained in:
commit
d2c372247f
|
|
@ -255,14 +255,14 @@ namespace Nz
|
|||
|
||||
inline unsigned int LuaImplQueryArg(const LuaInstance& instance, int index, Ndk::EntityHandle* handle, TypeTag<Ndk::EntityHandle>)
|
||||
{
|
||||
*handle = std::move(*static_cast<Ndk::EntityHandle*>(instance.CheckUserdata(index, "Entity")));
|
||||
*handle = *static_cast<Ndk::EntityHandle*>(instance.CheckUserdata(index, "Entity"));
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
inline unsigned int LuaImplQueryArg(const LuaInstance& instance, int index, Ndk::WorldHandle* handle, TypeTag<Ndk::WorldHandle>)
|
||||
{
|
||||
*handle = std::move(*static_cast<Ndk::WorldHandle*>(instance.CheckUserdata(index, "World")));
|
||||
*handle = *static_cast<Ndk::WorldHandle*>(instance.CheckUserdata(index, "World"));
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -188,6 +188,11 @@ function NazaraBuild:Execute()
|
|||
libdirs("../lib/" .. makeLibDir .. "/x64")
|
||||
targetdir("../lib/" .. makeLibDir .. "/x64")
|
||||
|
||||
-- Copy the module binaries to the example folder
|
||||
if (os.is("windows")) then
|
||||
self:MakeCopyAfterBuild(moduleTable)
|
||||
end
|
||||
|
||||
configuration({"vs*", "x32"})
|
||||
libdirs("../extlibs/lib/msvc/x86")
|
||||
libdirs("../lib/msvc/x86")
|
||||
|
|
@ -300,10 +305,7 @@ function NazaraBuild:Execute()
|
|||
|
||||
-- Copy the module binaries to the example folder
|
||||
if (toolTable.CopyTargetToExampleDir) then
|
||||
if (os.is("windows")) then
|
||||
configuration({})
|
||||
postbuildcommands({[[xcopy "%{path.translate(cfg.linktarget.relpath):sub(1, -5) .. ".dll"}" "..\..\..\examples\bin\" /E /Y]]})
|
||||
end
|
||||
self:MakeCopyAfterBuild(toolTable)
|
||||
end
|
||||
|
||||
configuration({"vs*", "x32"})
|
||||
|
|
@ -844,6 +846,34 @@ function NazaraBuild:Process(infoTable)
|
|||
end
|
||||
end
|
||||
|
||||
function NazaraBuild:MakeCopyAfterBuild(infoTable)
|
||||
if (os.is("windows")) then
|
||||
configuration({})
|
||||
postbuildcommands({[[xcopy "%{path.translate(cfg.linktarget.relpath):sub(1, -5) .. ".dll"}" "..\..\..\examples\bin\" /E /Y]]})
|
||||
|
||||
for k,v in pairs(table.join(infoTable.Libraries, infoTable.DynLib)) do
|
||||
local paths = {}
|
||||
table.insert(paths, {"x32", "../extlibs/lib/common/x86/" .. v .. ".dll"})
|
||||
table.insert(paths, {"x32", "../extlibs/lib/common/x86/lib" .. v .. ".dll"})
|
||||
table.insert(paths, {"x64", "../extlibs/lib/common/x64/" .. v .. ".dll"})
|
||||
table.insert(paths, {"x64", "../extlibs/lib/common/x64/lib" .. v .. ".dll"})
|
||||
|
||||
for k,v in pairs(paths) do
|
||||
local config = v[1]
|
||||
local path = v[2]
|
||||
if (os.isfile(path)) then
|
||||
if (infoTable.Kind == "plugin") then
|
||||
path = "../../" .. path
|
||||
end
|
||||
|
||||
configuration(config)
|
||||
postbuildcommands({[[xcopy "%{path.translate(cfg.linktarget.relpath:sub(1, -#cfg.linktarget.name - 1) .. "../../]] .. path .. [[")}" "..\..\..\examples\bin\" /E /Y]]})
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function NazaraBuild:SetupInfoTable(infoTable)
|
||||
infoTable.ConfigurationLibraries = {}
|
||||
infoTable.ConfigurationLibraries.DebugStatic = {}
|
||||
|
|
@ -851,7 +881,7 @@ function NazaraBuild:SetupInfoTable(infoTable)
|
|||
infoTable.ConfigurationLibraries.DebugDynamic = {}
|
||||
infoTable.ConfigurationLibraries.ReleaseDynamic = {}
|
||||
|
||||
local infos = {"Defines", "Files", "FilesExcluded", "Flags", "Includes", "Libraries"}
|
||||
local infos = {"Defines", "DynLib", "Files", "FilesExcluded", "Flags", "Includes", "Libraries"}
|
||||
for k,v in ipairs(infos) do
|
||||
infoTable[v] = {}
|
||||
infoTable["Os" .. v] = {}
|
||||
|
|
|
|||
|
|
@ -14,6 +14,10 @@ MODULE.OsFiles.Windows = {
|
|||
"../src/Nazara/Audio/Win32/**.cpp"
|
||||
}
|
||||
|
||||
MODULE.OsDynLib.Windows = {
|
||||
"soft_oal"
|
||||
}
|
||||
|
||||
MODULE.OsFiles.Posix = {
|
||||
"../src/Nazara/Audio/Posix/**.hpp",
|
||||
"../src/Nazara/Audio/Posix/**.cpp"
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
TOOL.Name = "SDK"
|
||||
|
||||
TOOL.CopyTargetToExampleDir = true
|
||||
|
||||
TOOL.Directory = "../SDK/lib"
|
||||
TOOL.Kind = "Library"
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
TOOL.Name = "SDKServer"
|
||||
|
||||
TOOL.CopyTargetToExampleDir = true
|
||||
|
||||
TOOL.Directory = "../SDK/lib"
|
||||
TOOL.Kind = "Library"
|
||||
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@ namespace Nz
|
|||
template<typename T, std::size_t N> constexpr std::size_t CountOf(T(&name)[N]) noexcept;
|
||||
template<typename T> std::size_t CountOf(const T& c);
|
||||
template<typename T> void HashCombine(std::size_t& seed, const T& v);
|
||||
template<typename T> T ReverseBits(T integer);
|
||||
|
||||
template<typename T>
|
||||
struct PointedType
|
||||
|
|
|
|||
|
|
@ -28,6 +28,8 @@ namespace Nz
|
|||
{
|
||||
return (object .* std::forward<F>(fn))(std::get<S>(std::forward<Tuple>(t))...);
|
||||
}
|
||||
|
||||
NAZARA_CORE_API extern const UInt8 BitReverseTable256[256];
|
||||
}
|
||||
|
||||
/*!
|
||||
|
|
@ -164,6 +166,23 @@ namespace Nz
|
|||
seed = static_cast<std::size_t>(b * kMul);
|
||||
}
|
||||
|
||||
/*!
|
||||
* \ingroup core
|
||||
* \brief Reverse the bit order of the integer
|
||||
* \return integer with reversed bits
|
||||
*
|
||||
* \param integer Integer whose bits are to be reversed
|
||||
*/
|
||||
template<typename T>
|
||||
T ReverseBits(T integer)
|
||||
{
|
||||
T reversed = 0;
|
||||
for (std::size_t i = 0; i < sizeof(T); ++i)
|
||||
reversed |= T(Detail::BitReverseTable256[(integer >> i * 8) & 0xFF]) << sizeof(T) * 8 - (i + 1) * 8;
|
||||
|
||||
return reversed;
|
||||
}
|
||||
|
||||
template<typename T> struct PointedType<T*> {typedef T type;};
|
||||
template<typename T> struct PointedType<T* const> {typedef T type;};
|
||||
template<typename T> struct PointedType<T* volatile> {typedef T type;};
|
||||
|
|
|
|||
|
|
@ -329,8 +329,8 @@ namespace Nz
|
|||
template<typename Block, class Allocator>
|
||||
void Bitset<Block, Allocator>::PerformsOR(const Bitset& a, const Bitset& b)
|
||||
{
|
||||
const Bitset& greater = (a.GetBlockCount() > b.GetBlockCount()) ? a : b;
|
||||
const Bitset& lesser = (a.GetBlockCount() > b.GetBlockCount()) ? b : a;
|
||||
const Bitset& greater = (a.GetSize() > b.GetSize()) ? a : b;
|
||||
const Bitset& lesser = (a.GetSize() > b.GetSize()) ? b : a;
|
||||
|
||||
unsigned int maxBlockCount = greater.GetBlockCount();
|
||||
unsigned int minBlockCount = lesser.GetBlockCount();
|
||||
|
|
@ -358,8 +358,8 @@ namespace Nz
|
|||
template<typename Block, class Allocator>
|
||||
void Bitset<Block, Allocator>::PerformsXOR(const Bitset& a, const Bitset& b)
|
||||
{
|
||||
const Bitset& greater = (a.GetBlockCount() > b.GetBlockCount()) ? a : b;
|
||||
const Bitset& lesser = (a.GetBlockCount() > b.GetBlockCount()) ? b : a;
|
||||
const Bitset& greater = (a.GetSize() > b.GetSize()) ? a : b;
|
||||
const Bitset& lesser = (a.GetSize() > b.GetSize()) ? b : a;
|
||||
|
||||
unsigned int maxBlockCount = greater.GetBlockCount();
|
||||
unsigned int minBlockCount = lesser.GetBlockCount();
|
||||
|
|
|
|||
|
|
@ -178,7 +178,7 @@ namespace Nz
|
|||
|
||||
inline void Light::SetShadowMapFormat(PixelFormatType shadowFormat)
|
||||
{
|
||||
NazaraAssert(PixelFormat::GetType(shadowFormat) == PixelFormatTypeType_Depth, "Shadow format type is not a depth format");
|
||||
NazaraAssert(PixelFormat::GetContent(shadowFormat) == PixelFormatContent_DepthStencil, "Shadow format type is not a depth format");
|
||||
|
||||
m_shadowMapFormat = shadowFormat;
|
||||
|
||||
|
|
|
|||
|
|
@ -142,6 +142,17 @@ namespace Nz
|
|||
NodeType_Max = NodeType_Skeletal
|
||||
};
|
||||
|
||||
enum PixelFormatContent
|
||||
{
|
||||
PixelFormatContent_Undefined = -1,
|
||||
|
||||
PixelFormatContent_ColorRGBA,
|
||||
PixelFormatContent_DepthStencil,
|
||||
PixelFormatContent_Stencil,
|
||||
|
||||
PixelFormatContent_Max = PixelFormatContent_Stencil
|
||||
};
|
||||
|
||||
enum PixelFormatType
|
||||
{
|
||||
PixelFormatType_Undefined = -1,
|
||||
|
|
@ -204,27 +215,16 @@ namespace Nz
|
|||
|
||||
enum PixelFormatSubType
|
||||
{
|
||||
PixelFormatSubType_Double, // F64
|
||||
PixelFormatSubType_Float, // F32
|
||||
PixelFormatSubType_Half, // F16
|
||||
PixelFormatSubType_Int, // I32
|
||||
PixelFormatSubType_Unsigned, // U32
|
||||
PixelFormatSubType_Compressed, // Opaque
|
||||
PixelFormatSubType_Double, // F64
|
||||
PixelFormatSubType_Float, // F32
|
||||
PixelFormatSubType_Half, // F16
|
||||
PixelFormatSubType_Int, // Signed integer
|
||||
PixelFormatSubType_Unsigned, // Unsigned integer
|
||||
|
||||
PixelFormatSubType_Max = PixelFormatSubType_Unsigned
|
||||
};
|
||||
|
||||
enum PixelFormatTypeType
|
||||
{
|
||||
PixelFormatTypeType_Undefined = -1,
|
||||
|
||||
PixelFormatTypeType_Color,
|
||||
PixelFormatTypeType_Depth,
|
||||
PixelFormatTypeType_DepthStencil,
|
||||
PixelFormatTypeType_Stencil,
|
||||
|
||||
PixelFormatTypeType_Max = PixelFormatTypeType_Stencil
|
||||
};
|
||||
|
||||
enum PixelFlipping
|
||||
{
|
||||
PixelFlipping_Horizontally,
|
||||
|
|
|
|||
|
|
@ -23,33 +23,36 @@ namespace Nz
|
|||
{
|
||||
struct PixelFormatInfo
|
||||
{
|
||||
PixelFormatInfo() :
|
||||
bitsPerPixel(0)
|
||||
{
|
||||
}
|
||||
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);
|
||||
|
||||
PixelFormatInfo(UInt8 bpp, PixelFormatSubType subType) :
|
||||
bitsPerPixel(bpp),
|
||||
redType(subType),
|
||||
greenType(subType),
|
||||
blueType(subType),
|
||||
alphaType(subType)
|
||||
{
|
||||
}
|
||||
inline void Clear();
|
||||
|
||||
// Warning: Bit Endian
|
||||
inline bool IsCompressed() const;
|
||||
inline bool IsValid() const;
|
||||
|
||||
inline void RecomputeBitsPerPixel();
|
||||
|
||||
inline bool Validate() const;
|
||||
|
||||
// Warning: Masks bit order is reversed
|
||||
Bitset<> redMask;
|
||||
Bitset<> greenMask;
|
||||
Bitset<> blueMask;
|
||||
Bitset<> alphaMask;
|
||||
PixelFormatContent content;
|
||||
PixelFormatSubType redType;
|
||||
PixelFormatSubType greenType;
|
||||
PixelFormatSubType blueType;
|
||||
PixelFormatSubType alphaType;
|
||||
String name;
|
||||
UInt8 bitsPerPixel;
|
||||
};
|
||||
|
||||
class PixelFormat
|
||||
class NAZARA_UTILITY_API PixelFormat
|
||||
{
|
||||
friend class Utility;
|
||||
|
||||
|
|
@ -59,34 +62,35 @@ namespace Nz
|
|||
|
||||
static inline std::size_t ComputeSize(PixelFormatType format, unsigned int width, unsigned int height, unsigned int depth);
|
||||
|
||||
static bool Convert(PixelFormatType srcFormat, PixelFormatType dstFormat, const void* src, void* dst);
|
||||
static bool Convert(PixelFormatType srcFormat, PixelFormatType dstFormat, const void* start, const void* end, void* dst);
|
||||
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 bool Flip(PixelFlipping flipping, PixelFormatType format, unsigned int width, unsigned int height, unsigned int depth, const void* src, void* dst);
|
||||
static inline bool Flip(PixelFlipping flipping, PixelFormatType format, unsigned int width, unsigned int height, unsigned int depth, const void* src, void* dst);
|
||||
|
||||
static UInt8 GetBitsPerPixel(PixelFormatType format);
|
||||
static UInt8 GetBytesPerPixel(PixelFormatType format);
|
||||
static PixelFormatTypeType GetType(PixelFormatType format);
|
||||
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 bool HasAlpha(PixelFormatType format);
|
||||
static inline bool HasAlpha(PixelFormatType format);
|
||||
|
||||
static PixelFormatType IdentifyFormat(const PixelFormatInfo& info);
|
||||
|
||||
static bool IsCompressed(PixelFormatType format);
|
||||
static bool IsConversionSupported(PixelFormatType srcFormat, PixelFormatType dstFormat);
|
||||
static bool IsValid(PixelFormatType format);
|
||||
static inline bool IsCompressed(PixelFormatType format);
|
||||
static inline bool IsConversionSupported(PixelFormatType srcFormat, PixelFormatType dstFormat);
|
||||
static inline bool IsValid(PixelFormatType format);
|
||||
|
||||
static void SetConvertFunction(PixelFormatType srcFormat, PixelFormatType dstFormat, ConvertFunction func);
|
||||
static void SetFlipFunction(PixelFlipping flipping, PixelFormatType format, FlipFunction func);
|
||||
|
||||
static String ToString(PixelFormatType format);
|
||||
static inline void SetConvertFunction(PixelFormatType srcFormat, PixelFormatType dstFormat, ConvertFunction func);
|
||||
static inline void SetFlipFunction(PixelFlipping flipping, PixelFormatType format, FlipFunction func);
|
||||
|
||||
private:
|
||||
static bool Initialize();
|
||||
static void Uninitialize();
|
||||
|
||||
static NAZARA_UTILITY_API ConvertFunction s_convertFunctions[PixelFormatType_Max+1][PixelFormatType_Max+1];
|
||||
static NAZARA_UTILITY_API std::map<PixelFormatType, FlipFunction> s_flipFunctions[PixelFlipping_Max+1];
|
||||
static PixelFormatInfo s_pixelFormatInfos[PixelFormatType_Max + 1];
|
||||
static ConvertFunction s_convertFunctions[PixelFormatType_Max+1][PixelFormatType_Max+1];
|
||||
static std::map<PixelFormatType, FlipFunction> s_flipFunctions[PixelFlipping_Max+1];
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2,13 +2,151 @@
|
|||
// This file is part of the "Nazara Engine - Utility module"
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
|
||||
#include <Nazara/Utility/PixelFormat.hpp>
|
||||
#include <Nazara/Core/Error.hpp>
|
||||
#include <algorithm>
|
||||
#include <array>
|
||||
#include <cstring>
|
||||
#include <Nazara/Utility/Debug.hpp>
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
inline PixelFormatInfo::PixelFormatInfo() :
|
||||
bitsPerPixel(0),
|
||||
content(PixelFormatContent_Undefined)
|
||||
{
|
||||
}
|
||||
|
||||
inline PixelFormatInfo::PixelFormatInfo(PixelFormatContent formatContent, UInt8 bpp, PixelFormatSubType subType) :
|
||||
bitsPerPixel(bpp),
|
||||
content(formatContent),
|
||||
redType(subType),
|
||||
greenType(subType),
|
||||
blueType(subType),
|
||||
alphaType(subType)
|
||||
{
|
||||
}
|
||||
|
||||
inline PixelFormatInfo::PixelFormatInfo(const String& formatName, PixelFormatContent formatContent, UInt8 bpp, PixelFormatSubType subType) :
|
||||
bitsPerPixel(bpp),
|
||||
content(formatContent),
|
||||
redType(subType),
|
||||
greenType(subType),
|
||||
blueType(subType),
|
||||
alphaType(subType),
|
||||
name(formatName)
|
||||
{
|
||||
}
|
||||
|
||||
inline PixelFormatInfo::PixelFormatInfo(const String& formatName, PixelFormatContent formatContent, Bitset<> rMask, Bitset<> gMask, Bitset<> bMask, Bitset<> aMask, PixelFormatSubType subType) :
|
||||
redMask(rMask),
|
||||
greenMask(gMask),
|
||||
blueMask(bMask),
|
||||
alphaMask(aMask),
|
||||
content(formatContent),
|
||||
redType(subType),
|
||||
greenType(subType),
|
||||
blueType(subType),
|
||||
alphaType(subType),
|
||||
name(formatName)
|
||||
{
|
||||
RecomputeBitsPerPixel();
|
||||
}
|
||||
|
||||
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) :
|
||||
redMask(rMask),
|
||||
greenMask(gMask),
|
||||
blueMask(bMask),
|
||||
alphaMask(aMask),
|
||||
content(formatContent),
|
||||
redType(rType),
|
||||
greenType(gType),
|
||||
blueType(bType),
|
||||
alphaType(aType),
|
||||
name(formatName)
|
||||
{
|
||||
if (bpp == 0)
|
||||
RecomputeBitsPerPixel();
|
||||
}
|
||||
|
||||
inline void PixelFormatInfo::Clear()
|
||||
{
|
||||
bitsPerPixel = 0;
|
||||
alphaMask.Clear();
|
||||
blueMask.Clear();
|
||||
greenMask.Clear();
|
||||
redMask.Clear();
|
||||
name.Clear();
|
||||
}
|
||||
|
||||
inline bool PixelFormatInfo::IsCompressed() const
|
||||
{
|
||||
return redType == PixelFormatSubType_Compressed ||
|
||||
greenType == PixelFormatSubType_Compressed ||
|
||||
blueType == PixelFormatSubType_Compressed ||
|
||||
alphaType == PixelFormatSubType_Compressed;
|
||||
}
|
||||
|
||||
inline bool PixelFormatInfo::IsValid() const
|
||||
{
|
||||
return bitsPerPixel != 0;
|
||||
}
|
||||
|
||||
inline void PixelFormatInfo::RecomputeBitsPerPixel()
|
||||
{
|
||||
Bitset<> counter;
|
||||
counter |= redMask;
|
||||
counter |= greenMask;
|
||||
counter |= blueMask;
|
||||
counter |= alphaMask;
|
||||
|
||||
bitsPerPixel = counter.Count();
|
||||
}
|
||||
|
||||
inline bool PixelFormatInfo::Validate() const
|
||||
{
|
||||
if (!IsValid())
|
||||
return false;
|
||||
|
||||
if (content <= PixelFormatContent_Undefined || content > PixelFormatContent_Max)
|
||||
return false;
|
||||
|
||||
std::array<const Nz::Bitset<>*, 4> masks = {&redMask, &greenMask, &blueMask, &alphaMask};
|
||||
std::array<PixelFormatSubType, 4> types = {redType, greenType, blueType, alphaType};
|
||||
|
||||
for (unsigned int i = 0; i < 4; ++i)
|
||||
{
|
||||
unsigned int usedBits = masks[i]->Count();
|
||||
if (usedBits == 0)
|
||||
continue;
|
||||
|
||||
if (usedBits > bitsPerPixel)
|
||||
return false;
|
||||
|
||||
switch (types[i])
|
||||
{
|
||||
case PixelFormatSubType_Half:
|
||||
if (usedBits != 16)
|
||||
return false;
|
||||
|
||||
break;
|
||||
|
||||
case PixelFormatSubType_Float:
|
||||
if (usedBits != 32)
|
||||
return false;
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
inline std::size_t PixelFormat::ComputeSize(PixelFormatType format, unsigned int width, unsigned int height, unsigned int depth)
|
||||
{
|
||||
if (IsCompressed(format))
|
||||
|
|
@ -54,13 +192,13 @@ namespace Nz
|
|||
ConvertFunction func = s_convertFunctions[srcFormat][dstFormat];
|
||||
if (!func)
|
||||
{
|
||||
NazaraError("Pixel format conversion from " + ToString(srcFormat) + " to " + ToString(dstFormat) + " is not supported");
|
||||
NazaraError("Pixel format conversion from " + GetName(srcFormat) + " to " + GetName(dstFormat) + " is not supported");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!func(reinterpret_cast<const UInt8*>(src), reinterpret_cast<const UInt8*>(src) + GetBytesPerPixel(srcFormat), reinterpret_cast<UInt8*>(dst)))
|
||||
{
|
||||
NazaraError("Pixel format conversion from " + ToString(srcFormat) + " to " + ToString(dstFormat) + " failed");
|
||||
NazaraError("Pixel format conversion from " + GetName(srcFormat) + " to " + GetName(dstFormat) + " failed");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -78,13 +216,13 @@ namespace Nz
|
|||
ConvertFunction func = s_convertFunctions[srcFormat][dstFormat];
|
||||
if (!func)
|
||||
{
|
||||
NazaraError("Pixel format conversion from " + ToString(srcFormat) + " to " + ToString(dstFormat) + " is not supported");
|
||||
NazaraError("Pixel format conversion from " + GetName(srcFormat) + " to " + GetName(dstFormat) + " is not supported");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!func(reinterpret_cast<const UInt8*>(start), reinterpret_cast<const UInt8*>(end), reinterpret_cast<UInt8*>(dst)))
|
||||
{
|
||||
NazaraError("Pixel format conversion from " + ToString(srcFormat) + " to " + ToString(dstFormat) + " failed");
|
||||
NazaraError("Pixel format conversion from " + GetName(srcFormat) + " to " + GetName(dstFormat) + " failed");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -189,126 +327,7 @@ namespace Nz
|
|||
|
||||
inline UInt8 PixelFormat::GetBitsPerPixel(PixelFormatType format)
|
||||
{
|
||||
switch (format)
|
||||
{
|
||||
case PixelFormatType_A8:
|
||||
return 8;
|
||||
|
||||
case PixelFormatType_BGR8:
|
||||
return 24;
|
||||
|
||||
case PixelFormatType_BGRA8:
|
||||
return 32;
|
||||
|
||||
case PixelFormatType_DXT1:
|
||||
return 8;
|
||||
|
||||
case PixelFormatType_DXT3:
|
||||
return 16;
|
||||
|
||||
case PixelFormatType_DXT5:
|
||||
return 16;
|
||||
|
||||
case PixelFormatType_L8:
|
||||
return 8;
|
||||
|
||||
case PixelFormatType_LA8:
|
||||
return 16;
|
||||
|
||||
case PixelFormatType_R8:
|
||||
case PixelFormatType_R8I:
|
||||
case PixelFormatType_R8UI:
|
||||
return 8;
|
||||
|
||||
case PixelFormatType_R16:
|
||||
case PixelFormatType_R16F:
|
||||
case PixelFormatType_R16I:
|
||||
case PixelFormatType_R16UI:
|
||||
return 16;
|
||||
|
||||
case PixelFormatType_R32F:
|
||||
case PixelFormatType_R32I:
|
||||
case PixelFormatType_R32UI:
|
||||
return 32;
|
||||
|
||||
case PixelFormatType_RG8:
|
||||
case PixelFormatType_RG8I:
|
||||
case PixelFormatType_RG8UI:
|
||||
return 16;
|
||||
|
||||
case PixelFormatType_RG16:
|
||||
case PixelFormatType_RG16F:
|
||||
case PixelFormatType_RG16I:
|
||||
case PixelFormatType_RG16UI:
|
||||
return 32;
|
||||
|
||||
case PixelFormatType_RG32F:
|
||||
case PixelFormatType_RG32I:
|
||||
case PixelFormatType_RG32UI:
|
||||
return 64;
|
||||
|
||||
case PixelFormatType_RGB16F:
|
||||
case PixelFormatType_RGB16I:
|
||||
case PixelFormatType_RGB16UI:
|
||||
return 48;
|
||||
|
||||
case PixelFormatType_RGB32F:
|
||||
case PixelFormatType_RGB32I:
|
||||
case PixelFormatType_RGB32UI:
|
||||
return 96;
|
||||
|
||||
case PixelFormatType_RGBA16F:
|
||||
case PixelFormatType_RGBA16I:
|
||||
case PixelFormatType_RGBA16UI:
|
||||
return 64;
|
||||
|
||||
case PixelFormatType_RGBA32F:
|
||||
case PixelFormatType_RGBA32I:
|
||||
case PixelFormatType_RGBA32UI:
|
||||
return 128;
|
||||
|
||||
case PixelFormatType_RGBA4:
|
||||
return 16;
|
||||
|
||||
case PixelFormatType_RGB5A1:
|
||||
return 16;
|
||||
|
||||
case PixelFormatType_RGB8:
|
||||
return 24;
|
||||
|
||||
case PixelFormatType_RGBA8:
|
||||
return 32;
|
||||
|
||||
case PixelFormatType_Depth16:
|
||||
return 16;
|
||||
|
||||
case PixelFormatType_Depth24:
|
||||
return 24;
|
||||
|
||||
case PixelFormatType_Depth24Stencil8:
|
||||
return 32;
|
||||
|
||||
case PixelFormatType_Depth32:
|
||||
return 32;
|
||||
|
||||
case PixelFormatType_Stencil1:
|
||||
return 1;
|
||||
|
||||
case PixelFormatType_Stencil4:
|
||||
return 2;
|
||||
|
||||
case PixelFormatType_Stencil8:
|
||||
return 8;
|
||||
|
||||
case PixelFormatType_Stencil16:
|
||||
return 16;
|
||||
|
||||
case PixelFormatType_Undefined:
|
||||
break;
|
||||
}
|
||||
|
||||
NazaraError("Invalid pixel format");
|
||||
return 0;
|
||||
return s_pixelFormatInfos[format].bitsPerPixel;
|
||||
}
|
||||
|
||||
inline UInt8 PixelFormat::GetBytesPerPixel(PixelFormatType format)
|
||||
|
|
@ -316,212 +335,29 @@ namespace Nz
|
|||
return GetBitsPerPixel(format)/8;
|
||||
}
|
||||
|
||||
inline PixelFormatTypeType PixelFormat::GetType(PixelFormatType format)
|
||||
inline PixelFormatContent PixelFormat::GetContent(PixelFormatType format)
|
||||
{
|
||||
switch (format)
|
||||
{
|
||||
case PixelFormatType_A8:
|
||||
case PixelFormatType_BGR8:
|
||||
case PixelFormatType_BGRA8:
|
||||
case PixelFormatType_DXT1:
|
||||
case PixelFormatType_DXT3:
|
||||
case PixelFormatType_DXT5:
|
||||
case PixelFormatType_L8:
|
||||
case PixelFormatType_LA8:
|
||||
case PixelFormatType_R8:
|
||||
case PixelFormatType_R8I:
|
||||
case PixelFormatType_R8UI:
|
||||
case PixelFormatType_R16:
|
||||
case PixelFormatType_R16F:
|
||||
case PixelFormatType_R16I:
|
||||
case PixelFormatType_R16UI:
|
||||
case PixelFormatType_R32F:
|
||||
case PixelFormatType_R32I:
|
||||
case PixelFormatType_R32UI:
|
||||
case PixelFormatType_RG8:
|
||||
case PixelFormatType_RG8I:
|
||||
case PixelFormatType_RG8UI:
|
||||
case PixelFormatType_RG16:
|
||||
case PixelFormatType_RG16F:
|
||||
case PixelFormatType_RG16I:
|
||||
case PixelFormatType_RG16UI:
|
||||
case PixelFormatType_RG32F:
|
||||
case PixelFormatType_RG32I:
|
||||
case PixelFormatType_RG32UI:
|
||||
case PixelFormatType_RGB5A1:
|
||||
case PixelFormatType_RGB8:
|
||||
case PixelFormatType_RGB16F:
|
||||
case PixelFormatType_RGB16I:
|
||||
case PixelFormatType_RGB16UI:
|
||||
case PixelFormatType_RGB32F:
|
||||
case PixelFormatType_RGB32I:
|
||||
case PixelFormatType_RGB32UI:
|
||||
case PixelFormatType_RGBA4:
|
||||
case PixelFormatType_RGBA8:
|
||||
case PixelFormatType_RGBA16F:
|
||||
case PixelFormatType_RGBA16I:
|
||||
case PixelFormatType_RGBA16UI:
|
||||
case PixelFormatType_RGBA32F:
|
||||
case PixelFormatType_RGBA32I:
|
||||
case PixelFormatType_RGBA32UI:
|
||||
return PixelFormatTypeType_Color;
|
||||
return s_pixelFormatInfos[format].content;
|
||||
}
|
||||
|
||||
case PixelFormatType_Depth16:
|
||||
case PixelFormatType_Depth24:
|
||||
case PixelFormatType_Depth32:
|
||||
return PixelFormatTypeType_Depth;
|
||||
inline const PixelFormatInfo& PixelFormat::GetInfo(PixelFormatType format)
|
||||
{
|
||||
return s_pixelFormatInfos[format];
|
||||
}
|
||||
|
||||
case PixelFormatType_Depth24Stencil8:
|
||||
return PixelFormatTypeType_DepthStencil;
|
||||
|
||||
case PixelFormatType_Stencil1:
|
||||
case PixelFormatType_Stencil4:
|
||||
case PixelFormatType_Stencil8:
|
||||
case PixelFormatType_Stencil16:
|
||||
return PixelFormatTypeType_Stencil;
|
||||
|
||||
case PixelFormatType_Undefined:
|
||||
break;
|
||||
}
|
||||
|
||||
NazaraError("Invalid pixel format");
|
||||
return PixelFormatTypeType_Undefined;
|
||||
inline const String& PixelFormat::GetName(PixelFormatType format)
|
||||
{
|
||||
return s_pixelFormatInfos[format].name;
|
||||
}
|
||||
|
||||
inline bool PixelFormat::HasAlpha(PixelFormatType format)
|
||||
{
|
||||
switch (format)
|
||||
{
|
||||
case PixelFormatType_A8:
|
||||
case PixelFormatType_BGRA8:
|
||||
case PixelFormatType_DXT3:
|
||||
case PixelFormatType_DXT5:
|
||||
case PixelFormatType_LA8:
|
||||
case PixelFormatType_RGB5A1:
|
||||
case PixelFormatType_RGBA16F:
|
||||
case PixelFormatType_RGBA16I:
|
||||
case PixelFormatType_RGBA16UI:
|
||||
case PixelFormatType_RGBA32F:
|
||||
case PixelFormatType_RGBA32I:
|
||||
case PixelFormatType_RGBA32UI:
|
||||
case PixelFormatType_RGBA4:
|
||||
case PixelFormatType_RGBA8:
|
||||
return true;
|
||||
|
||||
case PixelFormatType_BGR8:
|
||||
case PixelFormatType_DXT1:
|
||||
case PixelFormatType_L8:
|
||||
case PixelFormatType_R8:
|
||||
case PixelFormatType_R8I:
|
||||
case PixelFormatType_R8UI:
|
||||
case PixelFormatType_R16:
|
||||
case PixelFormatType_R16F:
|
||||
case PixelFormatType_R16I:
|
||||
case PixelFormatType_R16UI:
|
||||
case PixelFormatType_R32F:
|
||||
case PixelFormatType_R32I:
|
||||
case PixelFormatType_R32UI:
|
||||
case PixelFormatType_RG8:
|
||||
case PixelFormatType_RG8I:
|
||||
case PixelFormatType_RG8UI:
|
||||
case PixelFormatType_RG16:
|
||||
case PixelFormatType_RG16F:
|
||||
case PixelFormatType_RG16I:
|
||||
case PixelFormatType_RG16UI:
|
||||
case PixelFormatType_RG32F:
|
||||
case PixelFormatType_RG32I:
|
||||
case PixelFormatType_RG32UI:
|
||||
case PixelFormatType_RGB8:
|
||||
case PixelFormatType_RGB16F:
|
||||
case PixelFormatType_RGB16I:
|
||||
case PixelFormatType_RGB16UI:
|
||||
case PixelFormatType_RGB32F:
|
||||
case PixelFormatType_RGB32I:
|
||||
case PixelFormatType_RGB32UI:
|
||||
case PixelFormatType_Depth16:
|
||||
case PixelFormatType_Depth24:
|
||||
case PixelFormatType_Depth24Stencil8:
|
||||
case PixelFormatType_Depth32:
|
||||
case PixelFormatType_Stencil1:
|
||||
case PixelFormatType_Stencil4:
|
||||
case PixelFormatType_Stencil8:
|
||||
case PixelFormatType_Stencil16:
|
||||
return false;
|
||||
|
||||
case PixelFormatType_Undefined:
|
||||
break;
|
||||
}
|
||||
|
||||
NazaraError("Invalid pixel format");
|
||||
return false;
|
||||
return s_pixelFormatInfos[format].alphaMask.TestAny();
|
||||
}
|
||||
|
||||
inline bool PixelFormat::IsCompressed(PixelFormatType format)
|
||||
{
|
||||
switch (format)
|
||||
{
|
||||
case PixelFormatType_DXT1:
|
||||
case PixelFormatType_DXT3:
|
||||
case PixelFormatType_DXT5:
|
||||
return true;
|
||||
|
||||
case PixelFormatType_A8:
|
||||
case PixelFormatType_BGR8:
|
||||
case PixelFormatType_BGRA8:
|
||||
case PixelFormatType_L8:
|
||||
case PixelFormatType_LA8:
|
||||
case PixelFormatType_R8:
|
||||
case PixelFormatType_R8I:
|
||||
case PixelFormatType_R8UI:
|
||||
case PixelFormatType_R16:
|
||||
case PixelFormatType_R16F:
|
||||
case PixelFormatType_R16I:
|
||||
case PixelFormatType_R16UI:
|
||||
case PixelFormatType_R32F:
|
||||
case PixelFormatType_R32I:
|
||||
case PixelFormatType_R32UI:
|
||||
case PixelFormatType_RG8:
|
||||
case PixelFormatType_RG8I:
|
||||
case PixelFormatType_RG8UI:
|
||||
case PixelFormatType_RG16:
|
||||
case PixelFormatType_RG16F:
|
||||
case PixelFormatType_RG16I:
|
||||
case PixelFormatType_RG16UI:
|
||||
case PixelFormatType_RG32F:
|
||||
case PixelFormatType_RG32I:
|
||||
case PixelFormatType_RG32UI:
|
||||
case PixelFormatType_RGB5A1:
|
||||
case PixelFormatType_RGB8:
|
||||
case PixelFormatType_RGB16F:
|
||||
case PixelFormatType_RGB16I:
|
||||
case PixelFormatType_RGB16UI:
|
||||
case PixelFormatType_RGB32F:
|
||||
case PixelFormatType_RGB32I:
|
||||
case PixelFormatType_RGB32UI:
|
||||
case PixelFormatType_RGBA4:
|
||||
case PixelFormatType_RGBA8:
|
||||
case PixelFormatType_RGBA16F:
|
||||
case PixelFormatType_RGBA16I:
|
||||
case PixelFormatType_RGBA16UI:
|
||||
case PixelFormatType_RGBA32F:
|
||||
case PixelFormatType_RGBA32I:
|
||||
case PixelFormatType_RGBA32UI:
|
||||
case PixelFormatType_Depth16:
|
||||
case PixelFormatType_Depth24:
|
||||
case PixelFormatType_Depth24Stencil8:
|
||||
case PixelFormatType_Depth32:
|
||||
case PixelFormatType_Stencil1:
|
||||
case PixelFormatType_Stencil4:
|
||||
case PixelFormatType_Stencil8:
|
||||
case PixelFormatType_Stencil16:
|
||||
return false;
|
||||
|
||||
case PixelFormatType_Undefined:
|
||||
break;
|
||||
}
|
||||
|
||||
NazaraError("Invalid pixel format");
|
||||
return false;
|
||||
return s_pixelFormatInfos[format].IsCompressed();
|
||||
}
|
||||
|
||||
inline bool PixelFormat::IsConversionSupported(PixelFormatType srcFormat, PixelFormatType dstFormat)
|
||||
|
|
@ -546,174 +382,6 @@ namespace Nz
|
|||
{
|
||||
s_flipFunctions[flipping][format] = func;
|
||||
}
|
||||
|
||||
inline String PixelFormat::ToString(PixelFormatType format)
|
||||
{
|
||||
switch (format)
|
||||
{
|
||||
case PixelFormatType_A8:
|
||||
return "A8";
|
||||
|
||||
case PixelFormatType_BGR8:
|
||||
return "BGR8";
|
||||
|
||||
case PixelFormatType_BGRA8:
|
||||
return "BGRA8";
|
||||
|
||||
case PixelFormatType_DXT1:
|
||||
return "DXT1";
|
||||
|
||||
case PixelFormatType_DXT3:
|
||||
return "DXT3";
|
||||
|
||||
case PixelFormatType_DXT5:
|
||||
return "DXT5";
|
||||
|
||||
case PixelFormatType_L8:
|
||||
return "L8";
|
||||
|
||||
case PixelFormatType_LA8:
|
||||
return "LA8";
|
||||
|
||||
case PixelFormatType_R8:
|
||||
return "R8";
|
||||
|
||||
case PixelFormatType_R8I:
|
||||
return "R8I";
|
||||
|
||||
case PixelFormatType_R8UI:
|
||||
return "R8UI";
|
||||
|
||||
case PixelFormatType_R16:
|
||||
return "R16";
|
||||
|
||||
case PixelFormatType_R16F:
|
||||
return "R16F";
|
||||
|
||||
case PixelFormatType_R16I:
|
||||
return "R16I";
|
||||
|
||||
case PixelFormatType_R16UI:
|
||||
return "R16UI";
|
||||
|
||||
case PixelFormatType_R32F:
|
||||
return "R32F";
|
||||
|
||||
case PixelFormatType_R32I:
|
||||
return "R32I";
|
||||
|
||||
case PixelFormatType_R32UI:
|
||||
return "R32UI";
|
||||
|
||||
case PixelFormatType_RG8:
|
||||
return "RG8";
|
||||
|
||||
case PixelFormatType_RG8I:
|
||||
return "RG8I";
|
||||
|
||||
case PixelFormatType_RG8UI:
|
||||
return "RG8UI";
|
||||
|
||||
case PixelFormatType_RG16:
|
||||
return "RG16";
|
||||
|
||||
case PixelFormatType_RG16F:
|
||||
return "RG16F";
|
||||
|
||||
case PixelFormatType_RG16I:
|
||||
return "RG16I";
|
||||
|
||||
case PixelFormatType_RG16UI:
|
||||
return "RG16UI";
|
||||
|
||||
case PixelFormatType_RG32F:
|
||||
return "RG32F";
|
||||
|
||||
case PixelFormatType_RG32I:
|
||||
return "RG32I";
|
||||
|
||||
case PixelFormatType_RG32UI:
|
||||
return "RG32UI";
|
||||
|
||||
case PixelFormatType_RGB5A1:
|
||||
return "RGB5A1";
|
||||
|
||||
case PixelFormatType_RGB8:
|
||||
return "RGB8";
|
||||
|
||||
case PixelFormatType_RGB16F:
|
||||
return "RGB16F";
|
||||
|
||||
case PixelFormatType_RGB16I:
|
||||
return "RGB16I";
|
||||
|
||||
case PixelFormatType_RGB16UI:
|
||||
return "RGB16UI";
|
||||
|
||||
case PixelFormatType_RGB32F:
|
||||
return "RGB32F";
|
||||
|
||||
case PixelFormatType_RGB32I:
|
||||
return "RGB32I";
|
||||
|
||||
case PixelFormatType_RGB32UI:
|
||||
return "RGB32UI";
|
||||
|
||||
case PixelFormatType_RGBA4:
|
||||
return "RGBA4";
|
||||
|
||||
case PixelFormatType_RGBA8:
|
||||
return "RGBA8";
|
||||
|
||||
case PixelFormatType_RGBA16F:
|
||||
return "RGBA16F";
|
||||
|
||||
case PixelFormatType_RGBA16I:
|
||||
return "RGBA16I";
|
||||
|
||||
case PixelFormatType_RGBA16UI:
|
||||
return "RGBA16UI";
|
||||
|
||||
case PixelFormatType_RGBA32F:
|
||||
return "RGBA32F";
|
||||
|
||||
case PixelFormatType_RGBA32I:
|
||||
return "RGBA32I";
|
||||
|
||||
case PixelFormatType_RGBA32UI:
|
||||
return "RGBA32UI";
|
||||
|
||||
case PixelFormatType_Depth16:
|
||||
return "Depth16";
|
||||
|
||||
case PixelFormatType_Depth24:
|
||||
return "Depth24";
|
||||
|
||||
case PixelFormatType_Depth24Stencil8:
|
||||
return "Depth24Stencil8";
|
||||
|
||||
case PixelFormatType_Depth32:
|
||||
return "Depth32";
|
||||
|
||||
case PixelFormatType_Stencil1:
|
||||
return "Stencil1";
|
||||
|
||||
case PixelFormatType_Stencil4:
|
||||
return "Stencil4";
|
||||
|
||||
case PixelFormatType_Stencil8:
|
||||
return "Stencil8";
|
||||
|
||||
case PixelFormatType_Stencil16:
|
||||
return "Stencil16";
|
||||
|
||||
case PixelFormatType_Undefined:
|
||||
return "Undefined";
|
||||
}
|
||||
|
||||
NazaraError("Invalid pixel format");
|
||||
return "Invalid format";
|
||||
}
|
||||
}
|
||||
|
||||
#include <Nazara/Utility/DebugOff.hpp>
|
||||
|
|
|
|||
|
|
@ -104,7 +104,7 @@ bool Load(Mesh* mesh, Stream& stream, const MeshParams& parameters)
|
|||
| aiProcess_OptimizeGraph | aiProcess_FlipWindingOrder
|
||||
| aiProcess_Debone;
|
||||
|
||||
if (!parameters.flipUVs)
|
||||
if (parameters.flipUVs)
|
||||
postProcess |= aiProcess_FlipUVs;
|
||||
|
||||
if (parameters.optimizeIndexBuffers)
|
||||
|
|
|
|||
|
|
@ -0,0 +1,34 @@
|
|||
// Copyright (C) 2016 Jérôme Leclercq
|
||||
// This file is part of the "Nazara Engine - Core module"
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
|
||||
#include <Nazara/Core/Algorithm.hpp>
|
||||
#include <Nazara/Core/Debug.hpp>
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
namespace Detail
|
||||
{
|
||||
const UInt8 BitReverseTable256[256] =
|
||||
{
|
||||
0x00, 0x80, 0x40, 0xC0, 0x20, 0xA0, 0x60, 0xE0, 0x10, 0x90, 0x50, 0xD0, 0x30, 0xB0, 0x70, 0xF0,
|
||||
0x08, 0x88, 0x48, 0xC8, 0x28, 0xA8, 0x68, 0xE8, 0x18, 0x98, 0x58, 0xD8, 0x38, 0xB8, 0x78, 0xF8,
|
||||
0x04, 0x84, 0x44, 0xC4, 0x24, 0xA4, 0x64, 0xE4, 0x14, 0x94, 0x54, 0xD4, 0x34, 0xB4, 0x74, 0xF4,
|
||||
0x0C, 0x8C, 0x4C, 0xCC, 0x2C, 0xAC, 0x6C, 0xEC, 0x1C, 0x9C, 0x5C, 0xDC, 0x3C, 0xBC, 0x7C, 0xFC,
|
||||
0x02, 0x82, 0x42, 0xC2, 0x22, 0xA2, 0x62, 0xE2, 0x12, 0x92, 0x52, 0xD2, 0x32, 0xB2, 0x72, 0xF2,
|
||||
0x0A, 0x8A, 0x4A, 0xCA, 0x2A, 0xAA, 0x6A, 0xEA, 0x1A, 0x9A, 0x5A, 0xDA, 0x3A, 0xBA, 0x7A, 0xFA,
|
||||
0x06, 0x86, 0x46, 0xC6, 0x26, 0xA6, 0x66, 0xE6, 0x16, 0x96, 0x56, 0xD6, 0x36, 0xB6, 0x76, 0xF6,
|
||||
0x0E, 0x8E, 0x4E, 0xCE, 0x2E, 0xAE, 0x6E, 0xEE, 0x1E, 0x9E, 0x5E, 0xDE, 0x3E, 0xBE, 0x7E, 0xFE,
|
||||
0x01, 0x81, 0x41, 0xC1, 0x21, 0xA1, 0x61, 0xE1, 0x11, 0x91, 0x51, 0xD1, 0x31, 0xB1, 0x71, 0xF1,
|
||||
0x09, 0x89, 0x49, 0xC9, 0x29, 0xA9, 0x69, 0xE9, 0x19, 0x99, 0x59, 0xD9, 0x39, 0xB9, 0x79, 0xF9,
|
||||
0x05, 0x85, 0x45, 0xC5, 0x25, 0xA5, 0x65, 0xE5, 0x15, 0x95, 0x55, 0xD5, 0x35, 0xB5, 0x75, 0xF5,
|
||||
0x0D, 0x8D, 0x4D, 0xCD, 0x2D, 0xAD, 0x6D, 0xED, 0x1D, 0x9D, 0x5D, 0xDD, 0x3D, 0xBD, 0x7D, 0xFD,
|
||||
0x03, 0x83, 0x43, 0xC3, 0x23, 0xA3, 0x63, 0xE3, 0x13, 0x93, 0x53, 0xD3, 0x33, 0xB3, 0x73, 0xF3,
|
||||
0x0B, 0x8B, 0x4B, 0xCB, 0x2B, 0xAB, 0x6B, 0xEB, 0x1B, 0x9B, 0x5B, 0xDB, 0x3B, 0xBB, 0x7B, 0xFB,
|
||||
0x07, 0x87, 0x47, 0xC7, 0x27, 0xA7, 0x67, 0xE7, 0x17, 0x97, 0x57, 0xD7, 0x37, 0xB7, 0x77, 0xF7,
|
||||
0x0F, 0x8F, 0x4F, 0xCF, 0x2F, 0xAF, 0x6F, 0xEF, 0x1F, 0x9F, 0x5F, 0xDF, 0x3F, 0xBF, 0x7F, 0xFF
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
#include <Nazara/Core/DebugOff.hpp>
|
||||
|
|
@ -44,7 +44,7 @@ namespace Nz
|
|||
OpenGL::Format openglFormat;
|
||||
if (!OpenGL::TranslateFormat(format, &openglFormat, OpenGL::FormatType_RenderBuffer))
|
||||
{
|
||||
NazaraError("Failed to translate pixel format \"" + PixelFormat::ToString(format) + "\" into OpenGL format");
|
||||
NazaraError("Failed to translate pixel format \"" + PixelFormat::GetName(format) + "\" into OpenGL format");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -44,12 +44,23 @@ namespace Nz
|
|||
2 // AttachmentPoint_Stencil
|
||||
};
|
||||
|
||||
AttachmentPoint formatTypeToAttachment[PixelFormatTypeType_Max+1] =
|
||||
AttachmentPoint FormatTypeToAttachment(PixelFormatType format)
|
||||
{
|
||||
AttachmentPoint_Color, // PixelFormatTypeType_Color
|
||||
AttachmentPoint_Depth, // PixelFormatTypeType_Depth
|
||||
AttachmentPoint_DepthStencil, // PixelFormatTypeType_DepthStencil
|
||||
AttachmentPoint_Stencil // PixelFormatTypeType_Stencil
|
||||
const PixelFormatInfo& info = PixelFormat::GetInfo(format);
|
||||
switch (info.content)
|
||||
{
|
||||
case PixelFormatContent_ColorRGBA:
|
||||
return AttachmentPoint_Color;
|
||||
|
||||
case PixelFormatContent_DepthStencil:
|
||||
return (!info.greenMask.TestAny()) ? AttachmentPoint_Depth : AttachmentPoint_DepthStencil;
|
||||
|
||||
case PixelFormatContent_Stencil:
|
||||
return AttachmentPoint_Stencil;
|
||||
}
|
||||
|
||||
NazaraInternalError("Unexpected pixel format content: 0x" + String::Number(info.content, 16));
|
||||
return AttachmentPoint_Max;
|
||||
};
|
||||
|
||||
GLuint lockedPrevious = 0;
|
||||
|
|
@ -118,9 +129,9 @@ namespace Nz
|
|||
}
|
||||
}
|
||||
|
||||
AttachmentPoint targetAttachmentPoint = formatTypeToAttachment[PixelFormat::GetType(buffer->GetFormat())];
|
||||
AttachmentPoint targetAttachmentPoint = FormatTypeToAttachment(buffer->GetFormat());
|
||||
if (targetAttachmentPoint != attachmentPoint && targetAttachmentPoint != AttachmentPoint_DepthStencil &&
|
||||
attachmentPoint != AttachmentPoint_Depth && attachmentPoint != AttachmentPoint_Stencil)
|
||||
attachmentPoint != AttachmentPoint_Depth && attachmentPoint != AttachmentPoint_Stencil)
|
||||
{
|
||||
NazaraError("Pixel format type does not match attachment point type");
|
||||
return false;
|
||||
|
|
@ -230,7 +241,7 @@ namespace Nz
|
|||
return false;
|
||||
}
|
||||
|
||||
AttachmentPoint targetAttachmentPoint = formatTypeToAttachment[PixelFormat::GetType(texture->GetFormat())];
|
||||
AttachmentPoint targetAttachmentPoint = FormatTypeToAttachment(texture->GetFormat());
|
||||
if (targetAttachmentPoint != attachmentPoint && targetAttachmentPoint != AttachmentPoint_DepthStencil &&
|
||||
attachmentPoint != AttachmentPoint_Depth && attachmentPoint != AttachmentPoint_Stencil)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -521,7 +521,7 @@ namespace Nz
|
|||
{
|
||||
///TODO: Sélectionner le format le plus adapté selon les composantes présentes dans le premier format
|
||||
PixelFormatType newFormat = (PixelFormat::HasAlpha(format)) ? PixelFormatType_BGRA8 : PixelFormatType_BGR8;
|
||||
NazaraWarning("Format " + PixelFormat::ToString(format) + " not supported, trying to convert it to " + PixelFormat::ToString(newFormat) + "...");
|
||||
NazaraWarning("Format " + PixelFormat::GetName(format) + " not supported, trying to convert it to " + PixelFormat::GetName(newFormat) + "...");
|
||||
|
||||
if (PixelFormat::IsConversionSupported(format, newFormat))
|
||||
{
|
||||
|
|
@ -1197,7 +1197,7 @@ namespace Nz
|
|||
OpenGL::Format openGLFormat;
|
||||
if (!OpenGL::TranslateFormat(m_impl->format, &openGLFormat, OpenGL::FormatType_Texture))
|
||||
{
|
||||
NazaraError("Format " + PixelFormat::ToString(m_impl->format) + " not supported by OpenGL");
|
||||
NazaraError("Format " + PixelFormat::GetName(m_impl->format) + " not supported by OpenGL");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -1306,7 +1306,7 @@ namespace Nz
|
|||
glTexParameteri(target, GL_TEXTURE_SWIZZLE_A, openGLFormat.swizzle[3]);
|
||||
}
|
||||
|
||||
if (!proxy && PixelFormat::GetType(m_impl->format) == PixelFormatTypeType_Depth)
|
||||
if (!proxy && PixelFormat::GetContent(m_impl->format) == PixelFormatContent_DepthStencil)
|
||||
{
|
||||
glTexParameteri(target, GL_TEXTURE_COMPARE_MODE, GL_COMPARE_REF_TO_TEXTURE);
|
||||
glTexParameteri(target, GL_TEXTURE_COMPARE_FUNC, GL_LEQUAL);
|
||||
|
|
|
|||
|
|
@ -169,20 +169,20 @@ namespace Nz
|
|||
{
|
||||
if (header.format.flags & (DDPF_RGB | DDPF_ALPHA | DDPF_ALPHAPIXELS | DDPF_LUMINANCE))
|
||||
{
|
||||
PixelFormatInfo info(header.format.bpp, PixelFormatSubType_Unsigned);
|
||||
PixelFormatInfo info(PixelFormatContent_ColorRGBA, header.format.bpp, PixelFormatSubType_Unsigned);
|
||||
|
||||
if (header.format.flags & DDPF_RGB)
|
||||
{
|
||||
// DDS Masks are in little endian
|
||||
info.redMask = SwapBytes(header.format.redMask);
|
||||
info.greenMask = SwapBytes(header.format.greenMask);
|
||||
info.blueMask = SwapBytes(header.format.blueMask);
|
||||
// Reverse bits for our masks
|
||||
info.redMask = ReverseBits(header.format.redMask);
|
||||
info.greenMask = ReverseBits(header.format.greenMask);
|
||||
info.blueMask = ReverseBits(header.format.blueMask);
|
||||
}
|
||||
else if (header.format.flags & DDPF_LUMINANCE)
|
||||
info.redMask = SwapBytes(header.format.redMask);
|
||||
info.redMask = ReverseBits(header.format.redMask);
|
||||
|
||||
if (header.format.flags & (DDPF_ALPHA | DDPF_ALPHAPIXELS))
|
||||
info.alphaMask = SwapBytes(header.format.alphaMask);
|
||||
info.alphaMask = ReverseBits(header.format.alphaMask);
|
||||
|
||||
*format = PixelFormat::IdentifyFormat(info);
|
||||
if (!PixelFormat::IsValid(*format))
|
||||
|
|
|
|||
|
|
@ -89,7 +89,7 @@ namespace Nz
|
|||
|
||||
if (!PixelFormat::IsConversionSupported(m_sharedImage->format, newFormat))
|
||||
{
|
||||
NazaraError("Conversion from " + PixelFormat::ToString(m_sharedImage->format) + " to " + PixelFormat::ToString(newFormat) + " is not supported");
|
||||
NazaraError("Conversion from " + PixelFormat::GetName(m_sharedImage->format) + " to " + PixelFormat::GetName(newFormat) + " is not supported");
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
|
@ -327,7 +327,7 @@ namespace Nz
|
|||
std::unique_ptr<UInt8[]> colorBuffer(new UInt8[bpp]);
|
||||
if (!PixelFormat::Convert(PixelFormatType_RGBA8, m_sharedImage->format, &color.r, colorBuffer.get()))
|
||||
{
|
||||
NazaraError("Failed to convert RGBA8 to " + PixelFormat::ToString(m_sharedImage->format));
|
||||
NazaraError("Failed to convert RGBA8 to " + PixelFormat::GetName(m_sharedImage->format));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -405,7 +405,7 @@ namespace Nz
|
|||
std::unique_ptr<UInt8[]> colorBuffer(new UInt8[bpp]);
|
||||
if (!PixelFormat::Convert(PixelFormatType_RGBA8, m_sharedImage->format, &color.r, colorBuffer.get()))
|
||||
{
|
||||
NazaraError("Failed to convert RGBA8 to " + PixelFormat::ToString(m_sharedImage->format));
|
||||
NazaraError("Failed to convert RGBA8 to " + PixelFormat::GetName(m_sharedImage->format));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -477,7 +477,7 @@ namespace Nz
|
|||
std::unique_ptr<UInt8[]> colorBuffer(new UInt8[bpp]);
|
||||
if (!PixelFormat::Convert(PixelFormatType_RGBA8, m_sharedImage->format, &color.r, colorBuffer.get()))
|
||||
{
|
||||
NazaraError("Failed to convert RGBA8 to " + PixelFormat::ToString(m_sharedImage->format));
|
||||
NazaraError("Failed to convert RGBA8 to " + PixelFormat::GetName(m_sharedImage->format));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ namespace Nz
|
|||
NazaraUnused(dst);
|
||||
NazaraUnused(end);
|
||||
|
||||
NazaraInternalError("Conversion from " + PixelFormat::ToString(from) + " to " + PixelFormat::ToString(to) + " is not supported");
|
||||
NazaraInternalError("Conversion from " + PixelFormat::GetName(from) + " to " + PixelFormat::GetName(to) + " is not supported");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
|
@ -1270,15 +1270,13 @@ namespace Nz
|
|||
|
||||
PixelFormatType PixelFormat::IdentifyFormat(const PixelFormatInfo& info)
|
||||
{
|
||||
switch (info.bitsPerPixel)
|
||||
for (unsigned int i = 0; i <= PixelFormatType_Max; ++i)
|
||||
{
|
||||
case 32:
|
||||
if (info.redMask == Bitset<>(0xFF000000) &&
|
||||
info.greenMask == Bitset<>(0x00FF0000) &&
|
||||
info.blueMask == Bitset<>(0x0000FF00) &&
|
||||
info.alphaMask == Bitset<>(0x000000FF))
|
||||
return PixelFormatType_RGBA8;
|
||||
break;
|
||||
PixelFormatInfo& 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<PixelFormatType>(i);
|
||||
}
|
||||
|
||||
return PixelFormatType_Undefined;
|
||||
|
|
@ -1286,7 +1284,67 @@ namespace Nz
|
|||
|
||||
bool PixelFormat::Initialize()
|
||||
{
|
||||
// Réinitialisation
|
||||
// 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, 0, 0, 0, 0, PixelFormatSubType_Half);
|
||||
s_pixelFormatInfos[PixelFormatType_RGB32I] = PixelFormatInfo("RGB32I", PixelFormatContent_ColorRGBA, 0, 0, 0, 0, PixelFormatSubType_Int);
|
||||
s_pixelFormatInfos[PixelFormatType_RGB32UI] = PixelFormatInfo("RGB32UI", PixelFormatContent_ColorRGBA, 0, 0, 0, 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, 0, 0, 0, 0, PixelFormatSubType_Half);
|
||||
s_pixelFormatInfos[PixelFormatType_RGBA32I] = PixelFormatInfo("RGBA32I", PixelFormatContent_ColorRGBA, 0, 0, 0, 0, PixelFormatSubType_Int);
|
||||
s_pixelFormatInfos[PixelFormatType_RGBA32UI] = PixelFormatInfo("RGBA32UI", PixelFormatContent_ColorRGBA, 0, 0, 0, 0, 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);
|
||||
|
||||
for (unsigned int i = 0; i <= PixelFormatType_Max; ++i)
|
||||
{
|
||||
if (!s_pixelFormatInfos[i].Validate())
|
||||
NazaraWarning("Pixel format 0x" + String::Number(i, 16) + " (" + GetName(static_cast<Nz::PixelFormatType>(i)) + ") failed validation tests");
|
||||
}
|
||||
|
||||
// Reset functions
|
||||
std::memset(s_convertFunctions, 0, (PixelFormatType_Max+1)*(PixelFormatType_Max+1)*sizeof(PixelFormat::ConvertFunction));
|
||||
|
||||
/***********************************A8************************************/
|
||||
|
|
@ -1511,12 +1569,16 @@ namespace Nz
|
|||
|
||||
void PixelFormat::Uninitialize()
|
||||
{
|
||||
for (unsigned int i = 0; i <= PixelFormatType_Max; ++i)
|
||||
s_pixelFormatInfos[i].Clear();
|
||||
|
||||
std::memset(s_convertFunctions, 0, (PixelFormatType_Max+1)*(PixelFormatType_Max+1)*sizeof(PixelFormat::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<PixelFormatType, PixelFormat::FlipFunction> PixelFormat::s_flipFunctions[PixelFlipping_Max+1];
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue