Rewritted ResourceLoader and moved it to core
Added creation constructor to NzImage Added member function functor Added option to build Nazara as one library (instead of many) Fixed some 2011 copyrights Made use of "using def = T" C++11 feature instead of some illigible typedefs Removed unused premake file
This commit is contained in:
parent
5619ddb0b1
commit
15afde86c8
|
|
@ -1,4 +1,6 @@
|
|||
project "NazaraModuleName"
|
||||
if (not _OPTIONS["one-library"]) then
|
||||
project "NazaraModuleName"
|
||||
end
|
||||
|
||||
files
|
||||
{
|
||||
|
|
@ -14,18 +16,22 @@ else
|
|||
excludes { "../src/Nazara/ModuleName/Win32/*.hpp", "../src/Nazara/ModuleName/Win32/*.cpp" }
|
||||
end
|
||||
|
||||
configuration "DebugStatic"
|
||||
links "NazaraCored-s"
|
||||
targetname "NazaraModuleNamed"
|
||||
if (_OPTIONS["one-library"]) then
|
||||
excludes "../src/Nazara/Audio/Debug/Leaks.cpp"
|
||||
else
|
||||
configuration "DebugStatic"
|
||||
links "NazaraCored-s"
|
||||
targetname "NazaraModuleNamed"
|
||||
|
||||
configuration "ReleaseStatic"
|
||||
links "NazaraCore-s"
|
||||
targetname "NazaraModuleName"
|
||||
configuration "ReleaseStatic"
|
||||
links "NazaraCore-s"
|
||||
targetname "NazaraModuleName"
|
||||
|
||||
configuration "DebugDLL"
|
||||
links "NazaraCored"
|
||||
targetname "NazaraModuleNamed"
|
||||
configuration "DebugDLL"
|
||||
links "NazaraCored"
|
||||
targetname "NazaraModuleNamed"
|
||||
|
||||
configuration "ReleaseDLL"
|
||||
links "NazaraCore"
|
||||
targetname "NazaraModuleName"
|
||||
configuration "ReleaseDLL"
|
||||
links "NazaraCore"
|
||||
targetname "NazaraModuleName"
|
||||
end
|
||||
|
|
@ -19,6 +19,13 @@ includedirs
|
|||
}
|
||||
|
||||
libdirs "../lib"
|
||||
|
||||
if (_OPTIONS["x64"]) then
|
||||
libdirs "../extlibs/lib/x64"
|
||||
end
|
||||
|
||||
libdirs "../extlibs/lib/x86"
|
||||
|
||||
targetdir "../lib"
|
||||
|
||||
configuration "Debug*"
|
||||
|
|
|
|||
|
|
@ -10,10 +10,7 @@ configurations
|
|||
language "C++"
|
||||
location("../examples/build/" .. _ACTION)
|
||||
|
||||
includedirs
|
||||
{
|
||||
"../include"
|
||||
}
|
||||
includedirs "../include"
|
||||
|
||||
debugdir "../examples/bin"
|
||||
libdirs "../lib"
|
||||
|
|
|
|||
|
|
@ -1,4 +1,6 @@
|
|||
project "NazaraCore"
|
||||
if (not _OPTIONS["one-library"]) then
|
||||
project "NazaraCore"
|
||||
end
|
||||
|
||||
files
|
||||
{
|
||||
|
|
@ -17,8 +19,10 @@ else
|
|||
excludes { "../src/Nazara/Core/Win32/**.hpp", "../src/Nazara/Core/Win32/**.cpp" }
|
||||
end
|
||||
|
||||
configuration "Debug*"
|
||||
targetname "NazaraCored"
|
||||
if (not _OPTIONS["one-library"]) then
|
||||
configuration "Debug*"
|
||||
targetname "NazaraCored"
|
||||
|
||||
configuration "Release*"
|
||||
targetname "NazaraCore"
|
||||
configuration "Release*"
|
||||
targetname "NazaraCore"
|
||||
end
|
||||
|
|
@ -1,11 +1,13 @@
|
|||
project "NazaraNoise"
|
||||
if (not _OPTIONS["one-library"]) then
|
||||
project "NazaraNoise"
|
||||
end
|
||||
|
||||
files
|
||||
{
|
||||
"../include/Nazara/Noise/**.hpp",
|
||||
"../include/Nazara/Noise/**.inl",
|
||||
"../src/Nazara/Noise/**.hpp",
|
||||
"../src/Nazara/Noise/**.cpp"
|
||||
"../include/Nazara/Noise/**.hpp",
|
||||
"../include/Nazara/Noise/**.inl",
|
||||
"../src/Nazara/Noise/**.hpp",
|
||||
"../src/Nazara/Noise/**.cpp"
|
||||
}
|
||||
|
||||
if (os.is("windows")) then
|
||||
|
|
@ -14,18 +16,22 @@ else
|
|||
excludes { "../src/Nazara/Noise/Win32/*.hpp", "../src/Nazara/Noise/Win32/*.cpp" }
|
||||
end
|
||||
|
||||
configuration "DebugStatic"
|
||||
links "NazaraCored-s"
|
||||
targetname "NazaraNoised"
|
||||
if (_OPTIONS["one-library"]) then
|
||||
excludes "../src/Nazara/Noise/Debug/Leaks.cpp"
|
||||
else
|
||||
configuration "DebugStatic"
|
||||
links "NazaraCored-s"
|
||||
targetname "NazaraNoised"
|
||||
|
||||
configuration "ReleaseStatic"
|
||||
links "NazaraCore-s"
|
||||
targetname "NazaraNoise"
|
||||
configuration "ReleaseStatic"
|
||||
links "NazaraCore-s"
|
||||
targetname "NazaraNoise"
|
||||
|
||||
configuration "DebugDLL"
|
||||
links "NazaraCored"
|
||||
targetname "NazaraNoised"
|
||||
configuration "DebugDLL"
|
||||
links "NazaraCored"
|
||||
targetname "NazaraNoised"
|
||||
|
||||
configuration "ReleaseDLL"
|
||||
links "NazaraCore"
|
||||
targetname "NazaraNoise"
|
||||
configuration "ReleaseDLL"
|
||||
links "NazaraCore"
|
||||
targetname "NazaraNoise"
|
||||
end
|
||||
|
|
@ -1,4 +1,6 @@
|
|||
project "NazaraRenderer"
|
||||
if (not _OPTIONS["one-library"]) then
|
||||
project "NazaraRenderer"
|
||||
end
|
||||
|
||||
files
|
||||
{
|
||||
|
|
@ -17,22 +19,26 @@ else
|
|||
excludes { "../src/Nazara/Renderer/Win32/*.hpp", "../src/Nazara/Renderer/Win32/*.cpp" }
|
||||
end
|
||||
|
||||
configuration "DebugStatic"
|
||||
links "NazaraCored-s"
|
||||
links "NazaraUtilityd-s"
|
||||
targetname "NazaraRendererd"
|
||||
if (_OPTIONS["one-library"]) then
|
||||
excludes "../src/Nazara/Renderer/Debug/Leaks.cpp"
|
||||
else
|
||||
configuration "DebugStatic"
|
||||
links "NazaraCored-s"
|
||||
links "NazaraUtilityd-s"
|
||||
targetname "NazaraRendererd"
|
||||
|
||||
configuration "ReleaseStatic"
|
||||
links "NazaraCore-s"
|
||||
links "NazaraUtility-s"
|
||||
targetname "NazaraRenderer"
|
||||
configuration "ReleaseStatic"
|
||||
links "NazaraCore-s"
|
||||
links "NazaraUtility-s"
|
||||
targetname "NazaraRenderer"
|
||||
|
||||
configuration "DebugDLL"
|
||||
links "NazaraCored"
|
||||
links "NazaraUtilityd"
|
||||
targetname "NazaraRendererd"
|
||||
configuration "DebugDLL"
|
||||
links "NazaraCored"
|
||||
links "NazaraUtilityd"
|
||||
targetname "NazaraRendererd"
|
||||
|
||||
configuration "ReleaseDLL"
|
||||
links "NazaraCore"
|
||||
links "NazaraUtility"
|
||||
targetname "NazaraRenderer"
|
||||
configuration "ReleaseDLL"
|
||||
links "NazaraCore"
|
||||
links "NazaraUtility"
|
||||
targetname "NazaraRenderer"
|
||||
end
|
||||
|
|
@ -1,4 +1,6 @@
|
|||
project "NazaraUtility"
|
||||
if (not _OPTIONS["one-library"]) then
|
||||
project "NazaraUtility"
|
||||
end
|
||||
|
||||
defines "STBI_NO_STDIO"
|
||||
|
||||
|
|
@ -18,18 +20,22 @@ else
|
|||
excludes { "../src/Nazara/Utility/Win32/*.hpp", "../src/Nazara/Utility/Win32/*.cpp" }
|
||||
end
|
||||
|
||||
configuration "DebugStatic"
|
||||
links "NazaraCored-s"
|
||||
targetname "NazaraUtilityd"
|
||||
if (_OPTIONS["one-library"]) then
|
||||
excludes "../src/Nazara/Utility/Debug/Leaks.cpp"
|
||||
else
|
||||
configuration "DebugStatic"
|
||||
links "NazaraCored-s"
|
||||
targetname "NazaraUtilityd"
|
||||
|
||||
configuration "ReleaseStatic"
|
||||
links "NazaraCore-s"
|
||||
targetname "NazaraUtility"
|
||||
configuration "ReleaseStatic"
|
||||
links "NazaraCore-s"
|
||||
targetname "NazaraUtility"
|
||||
|
||||
configuration "DebugDLL"
|
||||
links "NazaraCored"
|
||||
targetname "NazaraUtilityd"
|
||||
configuration "DebugDLL"
|
||||
links "NazaraCored"
|
||||
targetname "NazaraUtilityd"
|
||||
|
||||
configuration "ReleaseDLL"
|
||||
links "NazaraCore"
|
||||
targetname "NazaraUtility"
|
||||
configuration "ReleaseDLL"
|
||||
links "NazaraCore"
|
||||
targetname "NazaraUtility"
|
||||
end
|
||||
|
|
@ -2,22 +2,36 @@ kind "ConsoleApp"
|
|||
|
||||
files "main.cpp"
|
||||
|
||||
configuration "DebugStatic"
|
||||
links "NazaraCored-s"
|
||||
links "NazaraRendererd-s"
|
||||
links "NazaraUtilityd-s"
|
||||
if (_OPTIONS["one-library"]) then
|
||||
configuration "DebugStatic"
|
||||
links "Nazarad-s"
|
||||
|
||||
configuration "ReleaseStatic"
|
||||
links "NazaraCore-s"
|
||||
links "NazaraRenderer-s"
|
||||
links "NazaraUtility-s"
|
||||
configuration "ReleaseStatic"
|
||||
links "Nazara-s"
|
||||
|
||||
configuration "DebugDLL"
|
||||
links "NazaraCored"
|
||||
links "NazaraRendererd"
|
||||
links "NazaraUtilityd"
|
||||
configuration "DebugDLL"
|
||||
links "Nazarad"
|
||||
|
||||
configuration "ReleaseDLL"
|
||||
links "NazaraCore"
|
||||
links "NazaraRenderer"
|
||||
links "NazaraUtility"
|
||||
configuration "ReleaseDLL"
|
||||
links "Nazara"
|
||||
else
|
||||
configuration "DebugStatic"
|
||||
links "NazaraRendererd-s"
|
||||
links "NazaraUtilityd-s"
|
||||
links "NazaraCored-s"
|
||||
|
||||
configuration "ReleaseStatic"
|
||||
links "NazaraRenderer-s"
|
||||
links "NazaraUtility-s"
|
||||
links "NazaraCore-s"
|
||||
|
||||
configuration "DebugDLL"
|
||||
links "NazaraRendererd"
|
||||
links "NazaraCored"
|
||||
links "NazaraUtilityd"
|
||||
|
||||
configuration "ReleaseDLL"
|
||||
links "NazaraRenderer"
|
||||
links "NazaraUtility"
|
||||
links "NazaraCore"
|
||||
end
|
||||
|
|
|
|||
|
|
@ -2,18 +2,32 @@ kind "ConsoleApp"
|
|||
|
||||
files "main.cpp"
|
||||
|
||||
configuration "DebugStatic"
|
||||
links "NazaraCored-s"
|
||||
links "NazaraUtilityd-s"
|
||||
if (_OPTIONS["one-library"]) then
|
||||
configuration "DebugStatic"
|
||||
links "Nazarad-s"
|
||||
|
||||
configuration "ReleaseStatic"
|
||||
links "NazaraCore-s"
|
||||
links "NazaraUtility-s"
|
||||
configuration "ReleaseStatic"
|
||||
links "Nazara-s"
|
||||
|
||||
configuration "DebugDLL"
|
||||
links "NazaraCored"
|
||||
links "NazaraUtilityd"
|
||||
configuration "DebugDLL"
|
||||
links "Nazarad"
|
||||
|
||||
configuration "ReleaseDLL"
|
||||
links "NazaraCore"
|
||||
links "NazaraUtility"
|
||||
configuration "ReleaseDLL"
|
||||
links "Nazara"
|
||||
else
|
||||
configuration "DebugStatic"
|
||||
links "NazaraCored-s"
|
||||
links "NazaraUtilityd-s"
|
||||
|
||||
configuration "ReleaseStatic"
|
||||
links "NazaraCore-s"
|
||||
links "NazaraUtility-s"
|
||||
|
||||
configuration "DebugDLL"
|
||||
links "NazaraCored"
|
||||
links "NazaraUtilityd"
|
||||
|
||||
configuration "ReleaseDLL"
|
||||
links "NazaraCore"
|
||||
links "NazaraUtility"
|
||||
end
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ typedef int (*NzDynLibFunc)(); // Type "générique" de pointeur sur fonction
|
|||
|
||||
class NzDynLib : NzNonCopyable
|
||||
{
|
||||
friend class NzDynLibImpl;
|
||||
friend NzDynLibImpl;
|
||||
|
||||
public:
|
||||
NzDynLib(const NzString& libraryPath);
|
||||
|
|
|
|||
|
|
@ -9,9 +9,10 @@
|
|||
|
||||
enum nzEndianness
|
||||
{
|
||||
nzEndianness_Unknown = -1,
|
||||
|
||||
nzEndianness_BigEndian,
|
||||
nzEndianness_LittleEndian,
|
||||
nzEndianness_Unknown
|
||||
nzEndianness_LittleEndian
|
||||
};
|
||||
|
||||
enum nzErrorType
|
||||
|
|
|
|||
|
|
@ -38,11 +38,11 @@ class NAZARA_API NzFile : public NzHashable, public NzInputStream, NzNonCopyable
|
|||
{
|
||||
Current = 0x00, // Utilise le mode d'ouverture actuel
|
||||
|
||||
Append = 0x01, // Empêche l'écriture sur la partie déjà existante et met le curseur à la fin
|
||||
Lock = 0x02, // Empêche le fichier d'être modifié tant qu'il est ouvert
|
||||
Append = 0x01, // Empêche l'écriture sur la partie déjà existante et met le curseur à la fin
|
||||
Lock = 0x02, // Empêche le fichier d'être modifié tant qu'il est ouvert
|
||||
ReadOnly = 0x04, // Ouvre uniquement en lecture
|
||||
ReadWrite = 0x08, // Ouvre en lecture/écriture
|
||||
Text = 0x10, // Ouvre en mode texte
|
||||
Text = 0x10, // Ouvre en mode texte
|
||||
Truncate = 0x20, // Créé le fichier s'il n'existe pas et le vide s'il existe
|
||||
WriteOnly = 0x40 // Ouvre uniquement en écriture, créé le fichier s'il n'existe pas
|
||||
};
|
||||
|
|
|
|||
|
|
@ -18,27 +18,40 @@ struct NzFunctor
|
|||
virtual void Run() = 0;
|
||||
};
|
||||
|
||||
template<typename F> struct NzFunctorWithoutArgs : NzFunctor
|
||||
template<typename F>
|
||||
struct NzFunctorWithoutArgs : NzFunctor
|
||||
{
|
||||
NzFunctorWithoutArgs(F func);
|
||||
|
||||
void Run();
|
||||
|
||||
F function;
|
||||
private:
|
||||
F m_func;
|
||||
};
|
||||
|
||||
template<typename F, typename... Args> struct NzFunctorWithArgs : NzFunctor
|
||||
template<typename F, typename... Args>
|
||||
struct NzFunctorWithArgs : NzFunctor
|
||||
{
|
||||
NzFunctorWithArgs(F func, Args&... args);
|
||||
|
||||
void Run();
|
||||
|
||||
F function;
|
||||
std::tuple<Args...> arguments;
|
||||
private:
|
||||
F m_func;
|
||||
std::tuple<Args...> m_args;
|
||||
};
|
||||
|
||||
template<typename F> struct NzFunctorWithoutArgs;
|
||||
template<typename F, typename... Args> struct NzFunctorWithArgs;
|
||||
template<typename C>
|
||||
struct NzMemberWithoutArgs : NzFunctor
|
||||
{
|
||||
NzMemberWithoutArgs(void (C::*func)(), C* object);
|
||||
|
||||
void Run();
|
||||
|
||||
private:
|
||||
void (C::*m_func)();
|
||||
C* m_object;
|
||||
};
|
||||
|
||||
#include <Nazara/Core/Functor.inl>
|
||||
|
||||
|
|
|
|||
|
|
@ -2,23 +2,41 @@
|
|||
// This file is part of the "Nazara Engine - Core module"
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
|
||||
template<typename F> NzFunctorWithoutArgs<F>::NzFunctorWithoutArgs(F func) :
|
||||
function(func)
|
||||
template<typename F>
|
||||
NzFunctorWithoutArgs<F>::NzFunctorWithoutArgs(F func) :
|
||||
m_func(func)
|
||||
{
|
||||
}
|
||||
|
||||
template<typename F> void NzFunctorWithoutArgs<F>::Run()
|
||||
template<typename F>
|
||||
void NzFunctorWithoutArgs<F>::Run()
|
||||
{
|
||||
function();
|
||||
m_func();
|
||||
}
|
||||
|
||||
template<typename F, typename... Args> NzFunctorWithArgs<F, Args...>::NzFunctorWithArgs(F func, Args&... args) :
|
||||
function(func),
|
||||
arguments(args...)
|
||||
template<typename F, typename... Args>
|
||||
NzFunctorWithArgs<F, Args...>::NzFunctorWithArgs(F func, Args&... args) :
|
||||
m_func(func),
|
||||
m_args(args...)
|
||||
{
|
||||
}
|
||||
|
||||
template<typename F, typename... Args> void NzFunctorWithArgs<F, Args...>::Run()
|
||||
template<typename F, typename... Args>
|
||||
void NzFunctorWithArgs<F, Args...>::Run()
|
||||
{
|
||||
NzUnpackTuple(function, arguments);
|
||||
NzUnpackTuple(m_func, m_args);
|
||||
}
|
||||
|
||||
|
||||
template<typename C>
|
||||
NzMemberWithoutArgs<C>::NzMemberWithoutArgs(void (C::*func)(), C* object) :
|
||||
m_func(func),
|
||||
m_object(object)
|
||||
{
|
||||
}
|
||||
|
||||
template<typename C>
|
||||
void NzMemberWithoutArgs<C>::Run()
|
||||
{
|
||||
(m_object->*m_func)();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,7 +22,6 @@ enum nzHash
|
|||
nzHash_Whirlpool
|
||||
};
|
||||
|
||||
class NzHash;
|
||||
class NzHashDigest;
|
||||
class NzHashImpl;
|
||||
|
||||
|
|
|
|||
|
|
@ -11,7 +11,6 @@
|
|||
#include <Nazara/Core/NonCopyable.hpp>
|
||||
|
||||
class NzMutexImpl;
|
||||
class NzConditionVariable;
|
||||
|
||||
class NAZARA_API NzMutex : NzNonCopyable
|
||||
{
|
||||
|
|
|
|||
|
|
@ -0,0 +1,36 @@
|
|||
// Copyright (C) 2012 Jérôme Leclercq
|
||||
// This file is part of the "Nazara Engine - Utility module"
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef NAZARA_RESOURCELOADER_HPP
|
||||
#define NAZARA_RESOURCELOADER_HPP
|
||||
|
||||
#include <Nazara/Core/String.hpp>
|
||||
#include <set>
|
||||
#include <tuple>
|
||||
|
||||
class NzInputStream;
|
||||
|
||||
template<typename Type, typename Parameters>
|
||||
class NzResourceLoader
|
||||
{
|
||||
public:
|
||||
using CheckFunction = bool (*)(NzInputStream& stream, const Parameters& parameters);
|
||||
using LoadFunction = bool (*)(Type* resource, NzInputStream& stream, const Parameters& parameters);
|
||||
|
||||
static bool LoadFromFile(Type* resource, const NzString& filePath, const Parameters& parameters = Parameters());
|
||||
static bool LoadFromMemory(Type* resource, const void* data, unsigned int size, const Parameters& parameters = Parameters());
|
||||
static bool LoadFromStream(Type* resource, NzInputStream& stream, const Parameters& parameters = Parameters());
|
||||
|
||||
static void RegisterLoader(const NzString& fileExtensions, CheckFunction checkFunc, LoadFunction loadfunc);
|
||||
static void UnregisterLoader(const NzString& fileExtensions, CheckFunction checkFunc, LoadFunction loadfunc);
|
||||
|
||||
using Loader = std::tuple<std::set<NzString>, CheckFunction, LoadFunction>;
|
||||
using LoaderList = std::set<Loader>;
|
||||
};
|
||||
|
||||
#include <Nazara/Core/ResourceLoader.inl>
|
||||
|
||||
#endif // NAZARA_RESOURCELOADER_HPP
|
||||
|
|
@ -0,0 +1,142 @@
|
|||
// Copyright (C) 2012 Jérôme Leclercq
|
||||
// This file is part of the "Nazara Engine - Utility module"
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
|
||||
#include <Nazara/Core/Config.hpp>
|
||||
#include <Nazara/Core/Error.hpp>
|
||||
#include <Nazara/Core/File.hpp>
|
||||
#include <Nazara/Core/InputStream.hpp>
|
||||
#include <Nazara/Core/MemoryStream.hpp>
|
||||
#include <Nazara/Core/Debug.hpp>
|
||||
|
||||
template<typename Type, typename Parameters>
|
||||
bool NzResourceLoader<Type, Parameters>::LoadFromFile(Type* resource, const NzString& filePath, const Parameters& parameters)
|
||||
{
|
||||
#if NAZARA_CORE_SAFE
|
||||
if (!parameters.IsValid())
|
||||
{
|
||||
NazaraError("Invalid Parameters");
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
NzString path = NzFile::NormalizePath(filePath);
|
||||
NzString ext = path.SubstrFrom('.', -1, true);
|
||||
if (ext.IsEmpty())
|
||||
{
|
||||
NazaraError("Failed to get file extension");
|
||||
return false;
|
||||
}
|
||||
|
||||
NzFile file(path, NzFile::ReadOnly);
|
||||
if (!file.IsOpen())
|
||||
{
|
||||
NazaraError("Failed to open file");
|
||||
return false;
|
||||
}
|
||||
|
||||
for (auto loader = Type::s_loaders.begin(); loader != Type::s_loaders.end(); ++loader)
|
||||
{
|
||||
for (const NzString& loaderExt : std::get<0>(*loader))
|
||||
{
|
||||
int cmp = NzString::Compare(loaderExt, ext);
|
||||
if (cmp == 0)
|
||||
{
|
||||
if (!std::get<1>(*loader)(file, parameters))
|
||||
continue;
|
||||
|
||||
file.SetCursorPos(0);
|
||||
|
||||
// Chargement de la ressource
|
||||
if (std::get<2>(*loader)(resource, file, parameters))
|
||||
return true;
|
||||
|
||||
NazaraWarning("Loader failed");
|
||||
|
||||
file.SetCursorPos(0);
|
||||
}
|
||||
else if (cmp < 0) // S'il est encore possible que l'extension se situe après
|
||||
continue;
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
NazaraError("Failed to load file: no loader");
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
template<typename Type, typename Parameters>
|
||||
bool NzResourceLoader<Type, Parameters>::LoadFromMemory(Type* resource, const void* data, unsigned int size, const Parameters& parameters)
|
||||
{
|
||||
NzMemoryStream stream(data, size);
|
||||
|
||||
return LoadFromStream(resource, stream, parameters);
|
||||
}
|
||||
|
||||
template<typename Type, typename Parameters>
|
||||
bool NzResourceLoader<Type, Parameters>::LoadFromStream(Type* resource, NzInputStream& stream, const Parameters& parameters)
|
||||
{
|
||||
#if NAZARA_CORE_SAFE
|
||||
if (!parameters.IsValid())
|
||||
{
|
||||
NazaraError("Invalid Parameters");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (stream.GetSize() == 0 || stream.GetCursorPos() >= stream.GetSize())
|
||||
{
|
||||
NazaraError("No data to load");
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
nzUInt64 streamPos = stream.GetCursorPos();
|
||||
for (auto loader = Type::s_loaders.begin(); loader != Type::s_loaders.end(); ++loader)
|
||||
{
|
||||
// Le loader supporte-t-il les données ?
|
||||
if (!std::get<1>(*loader)(stream, parameters))
|
||||
continue;
|
||||
|
||||
// On repositionne le stream au début
|
||||
stream.SetCursorPos(streamPos);
|
||||
|
||||
// Chargement de la ressource
|
||||
if (std::get<2>(*loader)(resource, stream, parameters))
|
||||
return true;
|
||||
|
||||
NazaraWarning("Loader failed");
|
||||
stream.SetCursorPos(streamPos); // On repositionne au début
|
||||
}
|
||||
|
||||
NazaraError("Failed to load file: no loader");
|
||||
return false;
|
||||
}
|
||||
|
||||
template<typename Type, typename Parameters>
|
||||
void NzResourceLoader<Type, Parameters>::RegisterLoader(const NzString& fileExtensions, CheckFunction checkFunc, LoadFunction loadFunc)
|
||||
{
|
||||
/// Trouver une alternative à ce code monstrueux
|
||||
std::vector<NzString> exts;
|
||||
fileExtensions.SplitAny(exts, " /\\.,;|-_");
|
||||
|
||||
std::set<NzString> extensions;
|
||||
std::copy(exts.begin(), exts.end(), std::inserter(extensions, extensions.begin()));
|
||||
|
||||
Type::s_loaders.insert(std::make_tuple(std::move(extensions), checkFunc, loadFunc));
|
||||
}
|
||||
|
||||
template<typename Type, typename Parameters>
|
||||
void NzResourceLoader<Type, Parameters>::UnregisterLoader(const NzString& fileExtensions, CheckFunction checkFunc, LoadFunction loadFunc)
|
||||
{
|
||||
std::vector<NzString> exts;
|
||||
fileExtensions.SplitAny(exts, " /\\.,;|-_");
|
||||
|
||||
std::set<NzString> extensions;
|
||||
std::copy(exts.begin(), exts.end(), std::inserter(extensions, extensions.begin()));
|
||||
|
||||
Type::s_loaders.erase(std::make_tuple(std::move(extensions), checkFunc, loadFunc));
|
||||
}
|
||||
|
||||
#include <Nazara/Core/DebugOff.hpp>
|
||||
|
|
@ -17,13 +17,13 @@ class NzThreadImpl;
|
|||
|
||||
class NAZARA_API NzThread : NzNonCopyable
|
||||
{
|
||||
friend class NzThreadImpl;
|
||||
friend NzThreadImpl;
|
||||
|
||||
public:
|
||||
class NAZARA_API Id
|
||||
{
|
||||
friend class NzThread;
|
||||
friend class NzThreadImpl;
|
||||
friend NzThread;
|
||||
friend NzThreadImpl;
|
||||
|
||||
public:
|
||||
Id() = default;
|
||||
|
|
@ -43,6 +43,7 @@ class NAZARA_API NzThread : NzNonCopyable
|
|||
|
||||
template<typename F> NzThread(F function);
|
||||
template<typename F, typename... Args> NzThread(F function, Args... args);
|
||||
template<typename C> NzThread(void (C::*function)(), C* object);
|
||||
~NzThread();
|
||||
|
||||
Id GetId() const;
|
||||
|
|
@ -56,7 +57,7 @@ class NAZARA_API NzThread : NzNonCopyable
|
|||
|
||||
private:
|
||||
NzFunctor* m_func;
|
||||
NzThreadImpl* m_impl;
|
||||
NzThreadImpl* m_impl = nullptr;
|
||||
bool m_independent;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -4,15 +4,21 @@
|
|||
|
||||
#include <Nazara/Core/Debug.hpp>
|
||||
|
||||
template<typename F> NzThread::NzThread(F function) :
|
||||
m_func(new NzFunctorWithoutArgs<F>(function)),
|
||||
m_impl(nullptr)
|
||||
template<typename F>
|
||||
NzThread::NzThread(F function) :
|
||||
m_func(new NzFunctorWithoutArgs<F>(function))
|
||||
{
|
||||
}
|
||||
|
||||
template<typename F, typename... Args> NzThread::NzThread(F function, Args... args) :
|
||||
m_func(new NzFunctorWithArgs<F, Args...>(function, args...)),
|
||||
m_impl(nullptr)
|
||||
template<typename F, typename... Args>
|
||||
NzThread::NzThread(F function, Args... args) :
|
||||
m_func(new NzFunctorWithArgs<F, Args...>(function, args...))
|
||||
{
|
||||
}
|
||||
|
||||
template<typename C>
|
||||
NzThread::NzThread(void (C::*function)(), C* object) :
|
||||
m_func(new NzMemberWithoutArgs<C>(function, object))
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -8,7 +8,8 @@
|
|||
|
||||
#include <Nazara/Utility/Debug.hpp>
|
||||
|
||||
template<unsigned int N> struct NzTupleUnpack
|
||||
template<unsigned int N>
|
||||
struct NzTupleUnpack
|
||||
{
|
||||
template <typename F, typename... ArgsT, typename... Args>
|
||||
void operator()(F func, const std::tuple<ArgsT...>& t, Args&... args)
|
||||
|
|
@ -17,7 +18,8 @@ template<unsigned int N> struct NzTupleUnpack
|
|||
}
|
||||
};
|
||||
|
||||
template<> struct NzTupleUnpack<0>
|
||||
template<>
|
||||
struct NzTupleUnpack<0>
|
||||
{
|
||||
template <typename F, typename... ArgsT, typename... Args>
|
||||
void operator()(F func, const std::tuple<ArgsT...>&, Args&... args)
|
||||
|
|
@ -27,7 +29,7 @@ template<> struct NzTupleUnpack<0>
|
|||
};
|
||||
|
||||
template<typename F, typename... ArgsT>
|
||||
void NzUnpackTuple(F func, const std::tuple<ArgsT...>& t )
|
||||
void NzUnpackTuple(F func, const std::tuple<ArgsT...>& t)
|
||||
{
|
||||
NzTupleUnpack<sizeof...(ArgsT)>()(func, t);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ class NzContextImpl;
|
|||
|
||||
class NAZARA_API NzContext
|
||||
{
|
||||
friend class NzContextImpl;
|
||||
friend NzContextImpl;
|
||||
|
||||
public:
|
||||
NzContext();
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@
|
|||
#include <GL3/glxext.h>
|
||||
#endif
|
||||
|
||||
typedef void (*NzOpenGLFunc)();
|
||||
using NzOpenGLFunc = void (*)();
|
||||
|
||||
class NAZARA_API NzOpenGL
|
||||
{
|
||||
|
|
@ -77,9 +77,9 @@ NAZARA_API extern PFNGLCOLORMASKPROC glColorMask;
|
|||
NAZARA_API extern PFNGLCULLFACEPROC glCullFace;
|
||||
NAZARA_API extern PFNGLCOMPILESHADERPROC glCompileShader;
|
||||
NAZARA_API extern PFNGLCOPYTEXSUBIMAGE2DPROC glCopyTexSubImage2D;
|
||||
NAZARA_API extern PFNGLDEBUGMESSAGECALLBACKPROC glDebugMessageCallback;
|
||||
NAZARA_API extern PFNGLDEBUGMESSAGECONTROLPROC glDebugMessageControl;
|
||||
NAZARA_API extern PFNGLDEBUGMESSAGEINSERTPROC glDebugMessageInsert;
|
||||
NAZARA_API extern PFNGLDEBUGMESSAGECALLBACKPROC glDebugMessageCallback;
|
||||
NAZARA_API extern PFNGLDELETEBUFFERSPROC glDeleteBuffers;
|
||||
NAZARA_API extern PFNGLDELETEFRAMEBUFFERSPROC glDeleteFramebuffers;
|
||||
NAZARA_API extern PFNGLDELETEPROGRAMPROC glDeleteProgram;
|
||||
|
|
|
|||
|
|
@ -17,7 +17,6 @@
|
|||
#include <Nazara/Math/Vector4.hpp>
|
||||
#include <Nazara/Renderer/Enums.hpp>
|
||||
|
||||
class NzRenderer;
|
||||
class NzShaderImpl;
|
||||
class NzTexture;
|
||||
|
||||
|
|
@ -26,7 +25,7 @@ class NAZARA_API NzShader : public NzResource, NzNonCopyable
|
|||
friend class NzRenderer;
|
||||
|
||||
public:
|
||||
NzShader();
|
||||
NzShader() = default;
|
||||
NzShader(nzShaderLanguage language);
|
||||
~NzShader();
|
||||
|
||||
|
|
@ -70,8 +69,8 @@ class NAZARA_API NzShader : public NzResource, NzNonCopyable
|
|||
static bool IsTypeSupported(nzShaderType type);
|
||||
|
||||
private:
|
||||
NzShaderImpl* m_impl;
|
||||
bool m_compiled;
|
||||
NzShaderImpl* m_impl = nullptr;
|
||||
bool m_compiled = false;
|
||||
};
|
||||
|
||||
#endif // NAZARA_SHADER_HPP
|
||||
|
|
|
|||
|
|
@ -13,7 +13,6 @@
|
|||
#include <Nazara/Utility/Image.hpp>
|
||||
#include <Nazara/Utility/PixelFormat.hpp>
|
||||
|
||||
class NzShader;
|
||||
struct NzTextureImpl;
|
||||
|
||||
class NAZARA_API NzTexture : public NzResource, NzNonCopyable
|
||||
|
|
|
|||
|
|
@ -9,11 +9,9 @@
|
|||
|
||||
#include <Nazara/Prerequesites.hpp>
|
||||
#include <Nazara/Core/Resource.hpp>
|
||||
#include <Nazara/Core/ResourceLoader.hpp>
|
||||
#include <Nazara/Core/String.hpp>
|
||||
#include <Nazara/Utility/Enums.hpp>
|
||||
#include <Nazara/Utility/ResourceLoader.hpp>
|
||||
#include <list>
|
||||
#include <map>
|
||||
|
||||
struct NzAnimationParams
|
||||
{
|
||||
|
|
@ -33,13 +31,13 @@ struct NzSequence
|
|||
|
||||
class NzAnimation;
|
||||
|
||||
typedef NzResourceLoader<NzAnimation, NzAnimationParams> NzAnimationLoader;
|
||||
using NzAnimationLoader = NzResourceLoader<NzAnimation, NzAnimationParams>;
|
||||
|
||||
struct NzAnimationImpl;
|
||||
|
||||
class NAZARA_API NzAnimation : public NzResource
|
||||
{
|
||||
friend class NzResourceLoader<NzAnimation, NzAnimationParams>;
|
||||
friend NzAnimationLoader;
|
||||
|
||||
public:
|
||||
NzAnimation() = default;
|
||||
|
|
@ -73,9 +71,7 @@ class NAZARA_API NzAnimation : public NzResource
|
|||
private:
|
||||
NzAnimationImpl* m_impl = nullptr;
|
||||
|
||||
static std::list<NzAnimationLoader::MemoryLoader> s_memoryLoaders;
|
||||
static std::list<NzAnimationLoader::StreamLoader> s_streamLoaders;
|
||||
static std::multimap<NzString, NzAnimationLoader::LoadFileFunction> s_fileLoaders;
|
||||
static NzAnimationLoader::LoaderList s_loaders;
|
||||
};
|
||||
|
||||
#endif // NAZARA_ANIMATION_HPP
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (C) 2011 Jérôme Leclercq
|
||||
// Copyright (C) 2012 Jérôme Leclercq
|
||||
// This file is part of the "Nazara Engine - Utility module"
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
|
||||
|
|
|
|||
|
|
@ -13,16 +13,13 @@
|
|||
#include <Nazara/Utility/Enums.hpp>
|
||||
|
||||
class NzBufferImpl;
|
||||
class NzRenderer;
|
||||
class NzUtility;
|
||||
|
||||
class NAZARA_API NzBuffer : public NzResource, NzNonCopyable
|
||||
{
|
||||
friend class NzRenderer;
|
||||
friend class NzUtility;
|
||||
|
||||
public:
|
||||
typedef NzBufferImpl* (*BufferFunction)(NzBuffer* parent, nzBufferType type);
|
||||
using BufferFunction = NzBufferImpl* (*)(NzBuffer* parent, nzBufferType type);
|
||||
|
||||
NzBuffer(nzBufferType type);
|
||||
NzBuffer(nzBufferType type, unsigned int length, nzUInt8 typeSize, nzBufferStorage storage = nzBufferStorage_Software, nzBufferUsage usage = nzBufferUsage_Static);
|
||||
|
|
|
|||
|
|
@ -12,7 +12,6 @@
|
|||
|
||||
class NzCursorImpl;
|
||||
class NzImage;
|
||||
class NzWindowImpl;
|
||||
|
||||
class NAZARA_API NzCursor
|
||||
{
|
||||
|
|
|
|||
|
|
@ -127,7 +127,7 @@ enum nzImageType
|
|||
|
||||
enum nzPixelFormat
|
||||
{
|
||||
nzPixelFormat_Undefined,
|
||||
nzPixelFormat_Undefined = -1,
|
||||
|
||||
nzPixelFormat_BGR8, // 3*nzUInt8
|
||||
nzPixelFormat_BGRA8, // 4*nzUInt8
|
||||
|
|
|
|||
|
|
@ -12,7 +12,6 @@
|
|||
|
||||
class NzImage;
|
||||
class NzIconImpl;
|
||||
class NzWindowImpl;
|
||||
|
||||
class NAZARA_API NzIcon
|
||||
{
|
||||
|
|
|
|||
|
|
@ -11,14 +11,12 @@
|
|||
#include <Nazara/Core/Color.hpp>
|
||||
#include <Nazara/Core/InputStream.hpp>
|
||||
#include <Nazara/Core/Resource.hpp>
|
||||
#include <Nazara/Core/ResourceLoader.hpp>
|
||||
#include <Nazara/Math/Cube.hpp>
|
||||
#include <Nazara/Math/Rect.hpp>
|
||||
#include <Nazara/Math/Vector3.hpp>
|
||||
#include <Nazara/Utility/Enums.hpp>
|
||||
#include <Nazara/Utility/ResourceLoader.hpp>
|
||||
#include <Nazara/Utility/PixelFormat.hpp>
|
||||
#include <list>
|
||||
#include <map>
|
||||
|
||||
#if NAZARA_UTILITY_THREADSAFE && NAZARA_THREADSAFETY_IMAGE
|
||||
#include <Nazara/Core/ThreadSafety.hpp>
|
||||
|
|
@ -26,6 +24,8 @@
|
|||
#include <Nazara/Core/ThreadSafetyOff.hpp>
|
||||
#endif
|
||||
|
||||
///TODO: Filtres
|
||||
|
||||
struct NzImageParams
|
||||
{
|
||||
nzPixelFormat loadFormat = nzPixelFormat_Undefined;
|
||||
|
|
@ -34,20 +34,19 @@ struct NzImageParams
|
|||
bool IsValid() const;
|
||||
};
|
||||
|
||||
///TODO: Filtres
|
||||
|
||||
class NzImage;
|
||||
|
||||
typedef NzResourceLoader<NzImage, NzImageParams> NzImageLoader;
|
||||
using NzImageLoader = NzResourceLoader<NzImage, NzImageParams>;
|
||||
|
||||
class NAZARA_API NzImage : public NzResource
|
||||
{
|
||||
friend class NzResourceLoader<NzImage, NzImageParams>;
|
||||
friend NzImageLoader;
|
||||
|
||||
public:
|
||||
struct SharedImage;
|
||||
|
||||
NzImage();
|
||||
NzImage(nzImageType type, nzPixelFormat format, unsigned int width, unsigned int height, unsigned int depth = 1, nzUInt8 levelCount = 1);
|
||||
NzImage(const NzImage& image);
|
||||
NzImage(NzImage&& image) noexcept;
|
||||
NzImage(SharedImage* sharedImage);
|
||||
|
|
@ -135,9 +134,7 @@ class NAZARA_API NzImage : public NzResource
|
|||
|
||||
SharedImage* m_sharedImage;
|
||||
|
||||
static std::list<NzImageLoader::MemoryLoader> s_memoryLoaders;
|
||||
static std::list<NzImageLoader::StreamLoader> s_streamLoaders;
|
||||
static std::multimap<NzString, NzImageLoader::LoadFileFunction> s_fileLoaders;
|
||||
static NzImageLoader::LoaderList s_loaders;
|
||||
};
|
||||
|
||||
#endif // NAZARA_IMAGE_HPP
|
||||
|
|
|
|||
|
|
@ -10,13 +10,11 @@
|
|||
#include <Nazara/Prerequesites.hpp>
|
||||
#include <Nazara/Core/InputStream.hpp>
|
||||
#include <Nazara/Core/Resource.hpp>
|
||||
#include <Nazara/Core/ResourceLoader.hpp>
|
||||
#include <Nazara/Core/String.hpp>
|
||||
#include <Nazara/Utility/Animation.hpp>
|
||||
#include <Nazara/Utility/AxisAlignedBox.hpp>
|
||||
#include <Nazara/Utility/ResourceLoader.hpp>
|
||||
#include <Nazara/Utility/SubMesh.hpp>
|
||||
#include <list>
|
||||
#include <map>
|
||||
|
||||
class NzVertexDeclaration;
|
||||
|
||||
|
|
@ -32,13 +30,13 @@ struct NzMeshParams
|
|||
|
||||
class NzMesh;
|
||||
|
||||
typedef NzResourceLoader<NzMesh, NzMeshParams> NzMeshLoader;
|
||||
using NzMeshLoader = NzResourceLoader<NzMesh, NzMeshParams>;
|
||||
|
||||
struct NzMeshImpl;
|
||||
|
||||
class NAZARA_API NzMesh : public NzResource
|
||||
{
|
||||
friend class NzResourceLoader<NzMesh, NzMeshParams>;
|
||||
friend NzMeshLoader;
|
||||
|
||||
public:
|
||||
NzMesh() = default;
|
||||
|
|
@ -89,9 +87,7 @@ class NAZARA_API NzMesh : public NzResource
|
|||
private:
|
||||
NzMeshImpl* m_impl = nullptr;
|
||||
|
||||
static std::list<NzMeshLoader::MemoryLoader> s_memoryLoaders;
|
||||
static std::list<NzMeshLoader::StreamLoader> s_streamLoaders;
|
||||
static std::multimap<NzString, NzMeshLoader::LoadFileFunction> s_fileLoaders;
|
||||
static NzMeshLoader::LoaderList s_loaders;
|
||||
};
|
||||
|
||||
#endif // NAZARA_MESH_HPP
|
||||
|
|
|
|||
|
|
@ -19,8 +19,8 @@ class NzPixelFormat
|
|||
friend class NzUtility;
|
||||
|
||||
public:
|
||||
typedef nzUInt8* (*ConvertFunction)(const nzUInt8* start, const nzUInt8* end, nzUInt8* dst);
|
||||
typedef void (*FlipFunction)(unsigned int width, unsigned int height, unsigned int depth, const nzUInt8* src, nzUInt8* dst);
|
||||
using ConvertFunction = nzUInt8* (*)(const nzUInt8* start, const nzUInt8* end, nzUInt8* dst);
|
||||
using FlipFunction = void (*)(unsigned int width, unsigned int height, unsigned int depth, const nzUInt8* src, nzUInt8* dst);
|
||||
|
||||
static bool Convert(nzPixelFormat srcFormat, nzPixelFormat dstFormat, const void* src, void* dst);
|
||||
static bool Convert(nzPixelFormat srcFormat, nzPixelFormat dstFormat, const void* start, const void* end, void* dst);
|
||||
|
|
|
|||
|
|
@ -1,43 +0,0 @@
|
|||
// Copyright (C) 2012 Jérôme Leclercq
|
||||
// This file is part of the "Nazara Engine - Utility module"
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef NAZARA_RESOURCELOADER_HPP
|
||||
#define NAZARA_RESOURCELOADER_HPP
|
||||
|
||||
#include <Nazara/Core/String.hpp>
|
||||
#include <utility>
|
||||
|
||||
class NzInputStream;
|
||||
|
||||
template<typename Type, typename Parameters>
|
||||
class NzResourceLoader
|
||||
{
|
||||
public:
|
||||
using IdentifyMemoryFunction = bool (*)(const void* data, unsigned int size, const Parameters& parameters);
|
||||
using IdentifyStreamFunction = bool (*)(NzInputStream& stream, const Parameters& parameters);
|
||||
using LoadFileFunction = bool (*)(Type* resource, const NzString& filePath, const Parameters& parameters);
|
||||
using LoadMemoryFunction = bool (*)(Type* resource, const void* data, unsigned int size, const Parameters& parameters);
|
||||
using LoadStreamFunction = bool (*)(Type* resource, NzInputStream& stream, const Parameters& parameters);
|
||||
|
||||
static bool LoadFromFile(Type* resource, const NzString& filePath, const Parameters& parameters = Parameters());
|
||||
static bool LoadFromMemory(Type* resource, const void* data, unsigned int size, const Parameters& parameters = Parameters());
|
||||
static bool LoadFromStream(Type* resource, NzInputStream& stream, const Parameters& parameters = Parameters());
|
||||
|
||||
static void RegisterFileLoader(const NzString& extensions, LoadFileFunction loadFile);
|
||||
static void RegisterMemoryLoader(IdentifyMemoryFunction identifyMemory, LoadMemoryFunction loadMemory);
|
||||
static void RegisterStreamLoader(IdentifyStreamFunction identifyStream, LoadStreamFunction loadStream);
|
||||
|
||||
static void UnregisterFileLoader(const NzString& extensions, LoadFileFunction loadFile);
|
||||
static void UnregisterMemoryLoader(IdentifyMemoryFunction identifyMemory, LoadMemoryFunction loadMemory);
|
||||
static void UnregisterStreamLoader(IdentifyStreamFunction identifyStream, LoadStreamFunction loadStream);
|
||||
|
||||
typedef std::pair<IdentifyMemoryFunction, LoadMemoryFunction> MemoryLoader;
|
||||
typedef std::pair<IdentifyStreamFunction, LoadStreamFunction> StreamLoader;
|
||||
};
|
||||
|
||||
#include <Nazara/Utility/ResourceLoader.inl>
|
||||
|
||||
#endif // NAZARA_RESOURCELOADER_HPP
|
||||
|
|
@ -1,187 +0,0 @@
|
|||
// Copyright (C) 2012 Jérôme Leclercq
|
||||
// This file is part of the "Nazara Engine - Utility module"
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
|
||||
#include <Nazara/Core/Error.hpp>
|
||||
#include <Nazara/Core/File.hpp>
|
||||
#include <Nazara/Core/InputStream.hpp>
|
||||
#include <Nazara/Utility/Config.hpp>
|
||||
#include <Nazara/Utility/Debug.hpp>
|
||||
|
||||
template<typename Type, typename Parameters>
|
||||
bool NzResourceLoader<Type, Parameters>::LoadFromFile(Type* resource, const NzString& filePath, const Parameters& parameters)
|
||||
{
|
||||
#if NAZARA_UTILITY_SAFE
|
||||
if (!parameters.IsValid())
|
||||
{
|
||||
NazaraError("Invalid Parameters");
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
NzString path = NzFile::NormalizePath(filePath);
|
||||
NzString ext = path.SubstrFrom('.', -1, true);
|
||||
if (ext.IsEmpty())
|
||||
{
|
||||
NazaraError("Failed to get file extension");
|
||||
return false;
|
||||
}
|
||||
|
||||
// Récupération de tous les loaders de cette extension
|
||||
auto range = Type::s_fileLoaders.equal_range(ext);
|
||||
if (range.first == range.second)
|
||||
{
|
||||
NazaraError("No loader found for extension \"" + ext + '"');
|
||||
return false;
|
||||
}
|
||||
|
||||
// range.second est un itérateur vers l'élément après le dernier élémént du range
|
||||
auto it = range.second;
|
||||
|
||||
do
|
||||
{
|
||||
it--;
|
||||
|
||||
// Chargement de la ressource
|
||||
if (it->second(resource, filePath, parameters))
|
||||
return true;
|
||||
|
||||
NazaraWarning("Loader failed");
|
||||
}
|
||||
while (it != range.first);
|
||||
|
||||
NazaraError("Failed to load file: all loaders failed");
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
template<typename Type, typename Parameters>
|
||||
bool NzResourceLoader<Type, Parameters>::LoadFromMemory(Type* resource, const void* data, unsigned int size, const Parameters& parameters)
|
||||
{
|
||||
#if NAZARA_UTILITY_SAFE
|
||||
if (!parameters.IsValid())
|
||||
{
|
||||
NazaraError("Invalid Parameters");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!data || size == 0)
|
||||
{
|
||||
NazaraError("No data to load");
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
for (auto loader = Type::s_memoryLoaders.rbegin(); loader != Type::s_memoryLoaders.rend(); ++loader)
|
||||
{
|
||||
// Le loader supporte-t-il les données ?
|
||||
if (!loader->first(data, size, parameters))
|
||||
continue;
|
||||
|
||||
// Chargement de la ressource
|
||||
if (loader->second(resource, data, size, parameters))
|
||||
return true;
|
||||
|
||||
NazaraWarning("Loader failed");
|
||||
}
|
||||
|
||||
NazaraError("Failed to load file: all loaders failed");
|
||||
return false;
|
||||
}
|
||||
|
||||
template<typename Type, typename Parameters>
|
||||
bool NzResourceLoader<Type, Parameters>::LoadFromStream(Type* resource, NzInputStream& stream, const Parameters& parameters)
|
||||
{
|
||||
#if NAZARA_UTILITY_SAFE
|
||||
if (!parameters.IsValid())
|
||||
{
|
||||
NazaraError("Invalid Parameters");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (stream.GetSize() == 0 || stream.GetCursorPos() >= stream.GetSize())
|
||||
{
|
||||
NazaraError("No data to load");
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
nzUInt64 streamPos = stream.GetCursorPos();
|
||||
for (auto loader = Type::s_streamLoaders.rbegin(); loader != Type::s_streamLoaders.rend(); ++loader)
|
||||
{
|
||||
stream.SetCursorPos(streamPos);
|
||||
|
||||
// Le loader supporte-t-il les données ?
|
||||
if (!loader->first(stream, parameters))
|
||||
continue;
|
||||
|
||||
stream.SetCursorPos(streamPos);
|
||||
|
||||
// Chargement de la ressource
|
||||
if (loader->second(resource, stream, parameters))
|
||||
return true;
|
||||
|
||||
NazaraWarning("Loader failed");
|
||||
}
|
||||
|
||||
NazaraError("Failed to load file: all loaders failed");
|
||||
return false;
|
||||
}
|
||||
|
||||
template<typename Type, typename Parameters>
|
||||
void NzResourceLoader<Type, Parameters>::RegisterFileLoader(const NzString& extensions, LoadFileFunction loadFile)
|
||||
{
|
||||
std::vector<NzString> exts;
|
||||
extensions.SplitAny(exts, " /\\*.,;|-_");
|
||||
|
||||
for (const NzString& ext : exts)
|
||||
Type::s_fileLoaders.insert(std::make_pair(ext, loadFile));
|
||||
}
|
||||
|
||||
template<typename Type, typename Parameters>
|
||||
void NzResourceLoader<Type, Parameters>::RegisterMemoryLoader(IdentifyMemoryFunction identifyMemory, LoadMemoryFunction loadMemory)
|
||||
{
|
||||
Type::s_memoryLoaders.push_back(std::make_pair(identifyMemory, loadMemory));
|
||||
}
|
||||
|
||||
template<typename Type, typename Parameters>
|
||||
void NzResourceLoader<Type, Parameters>::RegisterStreamLoader(IdentifyStreamFunction identifyStream, LoadStreamFunction loadStream)
|
||||
{
|
||||
Type::s_streamLoaders.push_back(std::make_pair(identifyStream, loadStream));
|
||||
}
|
||||
|
||||
template<typename Type, typename Parameters>
|
||||
void NzResourceLoader<Type, Parameters>::UnregisterFileLoader(const NzString& extensions, LoadFileFunction loadFile)
|
||||
{
|
||||
std::vector<NzString> exts;
|
||||
extensions.SplitAny(exts, " /\\*.,;|-_");
|
||||
|
||||
for (const NzString& ext : exts)
|
||||
{
|
||||
// Récupération de tous les loaders de cette extension
|
||||
auto range = Type::s_fileLoaders.equal_range(ext);
|
||||
|
||||
for (auto it = range.first; it != range.second; ++it)
|
||||
{
|
||||
if (it->second == loadFile)
|
||||
{
|
||||
Type::s_fileLoaders.erase(it);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
template<typename Type, typename Parameters>
|
||||
void NzResourceLoader<Type, Parameters>::UnregisterMemoryLoader(IdentifyMemoryFunction identifyMemory, LoadMemoryFunction loadMemory)
|
||||
{
|
||||
Type::s_memoryLoaders.remove(std::make_pair(identifyMemory, loadMemory));
|
||||
}
|
||||
|
||||
template<typename Type, typename Parameters>
|
||||
void NzResourceLoader<Type, Parameters>::UnregisterStreamLoader(IdentifyStreamFunction identifyStream, LoadStreamFunction loadStream)
|
||||
{
|
||||
Type::s_streamLoaders.remove(std::make_pair(identifyStream, loadStream));
|
||||
}
|
||||
|
||||
#include <Nazara/Utility/DebugOff.hpp>
|
||||
|
|
@ -28,15 +28,13 @@
|
|||
class NzCursor;
|
||||
class NzImage;
|
||||
class NzIcon;
|
||||
class NzMouse;
|
||||
class NzUtility;
|
||||
class NzWindowImpl;
|
||||
|
||||
class NAZARA_API NzWindow : NzNonCopyable
|
||||
{
|
||||
friend NzWindowImpl;
|
||||
friend class NzMouse;
|
||||
friend class NzUtility;
|
||||
friend class NzWindowImpl;
|
||||
|
||||
public:
|
||||
NzWindow();
|
||||
|
|
|
|||
|
|
@ -9,8 +9,6 @@
|
|||
|
||||
#include <windows.h>
|
||||
|
||||
class NzConditionVariableImpl;
|
||||
|
||||
class NzMutexImpl
|
||||
{
|
||||
friend class NzConditionVariableImpl;
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ namespace
|
|||
GL_STATIC_DRAW // nzBufferUsage_Static
|
||||
};
|
||||
|
||||
typedef nzUInt8* (*LockRoutine)(nzBufferType type, nzBufferAccess access, unsigned int offset, unsigned int size);
|
||||
using LockRoutine = nzUInt8* (*)(nzBufferType type, nzBufferAccess access, unsigned int offset, unsigned int size);
|
||||
|
||||
nzUInt8* LockBuffer(nzBufferType type, nzBufferAccess access, unsigned int offset, unsigned int size)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -354,9 +354,9 @@ bool NzOpenGL::Initialize()
|
|||
{
|
||||
try
|
||||
{
|
||||
glDebugMessageCallback = reinterpret_cast<PFNGLDEBUGMESSAGECALLBACKPROC>(LoadEntry("glDebugMessageCallback"));
|
||||
glDebugMessageControl = reinterpret_cast<PFNGLDEBUGMESSAGECONTROLPROC>(LoadEntry("glDebugMessageControl"));
|
||||
glDebugMessageInsert = reinterpret_cast<PFNGLDEBUGMESSAGEINSERTPROC>(LoadEntry("glDebugMessageInsert"));
|
||||
glDebugMessageCallback = reinterpret_cast<PFNGLDEBUGMESSAGECALLBACKPROC>(LoadEntry("glDebugMessageCallback"));
|
||||
glGetDebugMessageLog = reinterpret_cast<PFNGLGETDEBUGMESSAGELOGPROC>(LoadEntry("glGetDebugMessageLog"));
|
||||
|
||||
openGLextensions[NzOpenGL::DebugOutput] = true;
|
||||
|
|
@ -371,9 +371,9 @@ bool NzOpenGL::Initialize()
|
|||
{
|
||||
try
|
||||
{
|
||||
glDebugMessageCallback = reinterpret_cast<PFNGLDEBUGMESSAGECALLBACKARBPROC>(LoadEntry("glDebugMessageCallbackARB"));
|
||||
glDebugMessageControl = reinterpret_cast<PFNGLDEBUGMESSAGECONTROLARBPROC>(LoadEntry("glDebugMessageControlARB"));
|
||||
glDebugMessageInsert = reinterpret_cast<PFNGLDEBUGMESSAGEINSERTARBPROC>(LoadEntry("glDebugMessageInsertARB"));
|
||||
glDebugMessageCallback = reinterpret_cast<PFNGLDEBUGMESSAGECALLBACKARBPROC>(LoadEntry("glDebugMessageCallbackARB"));
|
||||
glGetDebugMessageLog = reinterpret_cast<PFNGLGETDEBUGMESSAGELOGARBPROC>(LoadEntry("glGetDebugMessageLogARB"));
|
||||
|
||||
openGLextensions[NzOpenGL::DebugOutput] = true;
|
||||
|
|
@ -590,9 +590,9 @@ PFNGLCOLORMASKPROC glColorMask = nullptr;
|
|||
PFNGLCULLFACEPROC glCullFace = nullptr;
|
||||
PFNGLCOMPILESHADERPROC glCompileShader = nullptr;
|
||||
PFNGLCOPYTEXSUBIMAGE2DPROC glCopyTexSubImage2D = nullptr;
|
||||
PFNGLDEBUGMESSAGECALLBACKPROC glDebugMessageCallback = nullptr;
|
||||
PFNGLDEBUGMESSAGECONTROLPROC glDebugMessageControl = nullptr;
|
||||
PFNGLDEBUGMESSAGEINSERTPROC glDebugMessageInsert = nullptr;
|
||||
PFNGLDEBUGMESSAGECALLBACKPROC glDebugMessageCallback = nullptr;
|
||||
PFNGLDELETEBUFFERSPROC glDeleteBuffers = nullptr;
|
||||
PFNGLDELETEFRAMEBUFFERSPROC glDeleteFramebuffers = nullptr;
|
||||
PFNGLDELETEPROGRAMPROC glDeleteProgram = nullptr;
|
||||
|
|
|
|||
|
|
@ -147,10 +147,10 @@ namespace
|
|||
return new NzHardwareBuffer(parent, type);
|
||||
}
|
||||
|
||||
typedef std::tuple<const NzContext*, const NzIndexBuffer*, const NzVertexBuffer*, const NzVertexDeclaration*> VAO_Key;
|
||||
|
||||
constexpr unsigned int totalMatrixCount = nzMatrixCombination_Max+1;
|
||||
|
||||
using VAO_Key = std::tuple<const NzContext*, const NzIndexBuffer*, const NzVertexBuffer*, const NzVertexDeclaration*>;
|
||||
|
||||
std::map<VAO_Key, unsigned int> s_vaos;
|
||||
NzMatrix4f s_matrix[totalMatrixCount];
|
||||
int s_matrixLocation[totalMatrixCount];
|
||||
|
|
|
|||
|
|
@ -14,15 +14,7 @@
|
|||
#include <stdexcept>
|
||||
#include <Nazara/Renderer/Debug.hpp>
|
||||
|
||||
NzShader::NzShader() :
|
||||
m_impl(nullptr),
|
||||
m_compiled(false)
|
||||
{
|
||||
}
|
||||
|
||||
NzShader::NzShader(nzShaderLanguage language) :
|
||||
m_impl(nullptr),
|
||||
m_compiled(false)
|
||||
NzShader::NzShader(nzShaderLanguage language)
|
||||
{
|
||||
Create(language);
|
||||
|
||||
|
|
|
|||
|
|
@ -9,7 +9,6 @@
|
|||
|
||||
#include <Nazara/Renderer/Shader.hpp>
|
||||
|
||||
class NzRenderer;
|
||||
class NzTexture;
|
||||
class NzVertexBuffer;
|
||||
class NzVertexDeclaration;
|
||||
|
|
|
|||
|
|
@ -517,7 +517,7 @@ void NzTexture::Destroy()
|
|||
bool NzTexture::Download(NzImage* image) const
|
||||
{
|
||||
#if NAZARA_RENDERER_SAFE
|
||||
if (!IsValid())
|
||||
if (!m_impl)
|
||||
{
|
||||
NazaraError("Texture must be valid");
|
||||
return false;
|
||||
|
|
@ -576,7 +576,7 @@ bool NzTexture::Download(NzImage* image) const
|
|||
bool NzTexture::EnableMipmapping(bool enable)
|
||||
{
|
||||
#if NAZARA_RENDERER_SAFE
|
||||
if (!IsValid())
|
||||
if (!m_impl)
|
||||
{
|
||||
NazaraError("Texture must be valid");
|
||||
return false;
|
||||
|
|
@ -603,7 +603,7 @@ bool NzTexture::EnableMipmapping(bool enable)
|
|||
unsigned int NzTexture::GetAnisotropyLevel() const
|
||||
{
|
||||
#if NAZARA_RENDERER_SAFE
|
||||
if (!IsValid())
|
||||
if (!m_impl)
|
||||
{
|
||||
NazaraError("Texture must be valid");
|
||||
return 0;
|
||||
|
|
@ -626,7 +626,7 @@ unsigned int NzTexture::GetAnisotropyLevel() const
|
|||
nzUInt8 NzTexture::GetBPP() const
|
||||
{
|
||||
#if NAZARA_RENDERER_SAFE
|
||||
if (!IsValid())
|
||||
if (!m_impl)
|
||||
{
|
||||
NazaraError("Texture must be valid");
|
||||
return 0;
|
||||
|
|
@ -639,7 +639,7 @@ nzUInt8 NzTexture::GetBPP() const
|
|||
unsigned int NzTexture::GetDepth() const
|
||||
{
|
||||
#if NAZARA_RENDERER_SAFE
|
||||
if (!IsValid())
|
||||
if (!m_impl)
|
||||
{
|
||||
NazaraError("Texture must be valid");
|
||||
return 0;
|
||||
|
|
@ -652,7 +652,7 @@ unsigned int NzTexture::GetDepth() const
|
|||
nzTextureFilter NzTexture::GetFilterMode() const
|
||||
{
|
||||
#if NAZARA_RENDERER_SAFE
|
||||
if (!IsValid())
|
||||
if (!m_impl)
|
||||
{
|
||||
NazaraError("Texture must be valid");
|
||||
return nzTextureFilter_Unknown;
|
||||
|
|
@ -689,7 +689,7 @@ nzTextureFilter NzTexture::GetFilterMode() const
|
|||
nzPixelFormat NzTexture::GetFormat() const
|
||||
{
|
||||
#if NAZARA_RENDERER_SAFE
|
||||
if (!IsValid())
|
||||
if (!m_impl)
|
||||
{
|
||||
NazaraError("Texture must be valid");
|
||||
return nzPixelFormat_Undefined;
|
||||
|
|
@ -702,7 +702,7 @@ nzPixelFormat NzTexture::GetFormat() const
|
|||
unsigned int NzTexture::GetHeight() const
|
||||
{
|
||||
#if NAZARA_RENDERER_SAFE
|
||||
if (!IsValid())
|
||||
if (!m_impl)
|
||||
{
|
||||
NazaraError("Texture must be valid");
|
||||
return 0;
|
||||
|
|
@ -715,7 +715,7 @@ unsigned int NzTexture::GetHeight() const
|
|||
nzImageType NzTexture::GetType() const
|
||||
{
|
||||
#if NAZARA_RENDERER_SAFE
|
||||
if (!IsValid())
|
||||
if (!m_impl)
|
||||
{
|
||||
NazaraError("Texture must be valid");
|
||||
return nzImageType_2D;
|
||||
|
|
@ -728,7 +728,7 @@ nzImageType NzTexture::GetType() const
|
|||
unsigned int NzTexture::GetWidth() const
|
||||
{
|
||||
#if NAZARA_RENDERER_SAFE
|
||||
if (!IsValid())
|
||||
if (!m_impl)
|
||||
{
|
||||
NazaraError("Texture must be valid");
|
||||
return 0;
|
||||
|
|
@ -741,7 +741,7 @@ unsigned int NzTexture::GetWidth() const
|
|||
nzTextureWrap NzTexture::GetWrapMode() const
|
||||
{
|
||||
#if NAZARA_RENDERER_SAFE
|
||||
if (!IsValid())
|
||||
if (!m_impl)
|
||||
{
|
||||
NazaraError("Texture must be valid");
|
||||
return nzTextureWrap_Unknown;
|
||||
|
|
@ -773,7 +773,7 @@ nzTextureWrap NzTexture::GetWrapMode() const
|
|||
bool NzTexture::IsCompressed() const
|
||||
{
|
||||
#if NAZARA_RENDERER_SAFE
|
||||
if (!IsValid())
|
||||
if (!m_impl)
|
||||
{
|
||||
NazaraError("Texture must be valid");
|
||||
return false;
|
||||
|
|
@ -786,7 +786,7 @@ bool NzTexture::IsCompressed() const
|
|||
bool NzTexture::IsCubemap() const
|
||||
{
|
||||
#if NAZARA_RENDERER_SAFE
|
||||
if (!IsValid())
|
||||
if (!m_impl)
|
||||
{
|
||||
NazaraError("Texture must be valid");
|
||||
return false;
|
||||
|
|
@ -799,7 +799,7 @@ bool NzTexture::IsCubemap() const
|
|||
bool NzTexture::IsTarget() const
|
||||
{
|
||||
#if NAZARA_RENDERER_SAFE
|
||||
if (!IsValid())
|
||||
if (!m_impl)
|
||||
{
|
||||
NazaraError("Texture must be valid");
|
||||
return false;
|
||||
|
|
@ -915,7 +915,7 @@ bool NzTexture::LoadFromStream(NzInputStream& stream, const NzImageParams& param
|
|||
bool NzTexture::Lock()
|
||||
{
|
||||
#if NAZARA_RENDERER_SAFE
|
||||
if (!IsValid())
|
||||
if (!m_impl)
|
||||
{
|
||||
NazaraError("Texture must be valid");
|
||||
return false;
|
||||
|
|
@ -930,7 +930,7 @@ bool NzTexture::Lock()
|
|||
bool NzTexture::SetAnisotropyLevel(unsigned int anistropyLevel)
|
||||
{
|
||||
#if NAZARA_RENDERER_SAFE
|
||||
if (!IsValid())
|
||||
if (!m_impl)
|
||||
{
|
||||
NazaraError("Texture must be valid");
|
||||
return false;
|
||||
|
|
@ -955,7 +955,7 @@ bool NzTexture::SetAnisotropyLevel(unsigned int anistropyLevel)
|
|||
bool NzTexture::SetFilterMode(nzTextureFilter filter)
|
||||
{
|
||||
#if NAZARA_RENDERER_SAFE
|
||||
if (!IsValid())
|
||||
if (!m_impl)
|
||||
{
|
||||
NazaraError("Texture must be valid");
|
||||
return false;
|
||||
|
|
@ -1008,7 +1008,7 @@ bool NzTexture::SetFilterMode(nzTextureFilter filter)
|
|||
bool NzTexture::SetMipmapRange(nzUInt8 minLevel, nzUInt8 maxLevel)
|
||||
{
|
||||
#if NAZARA_RENDERER_SAFE
|
||||
if (!IsValid())
|
||||
if (!m_impl)
|
||||
{
|
||||
NazaraError("Texture must be valid");
|
||||
return false;
|
||||
|
|
@ -1038,7 +1038,7 @@ bool NzTexture::SetMipmapRange(nzUInt8 minLevel, nzUInt8 maxLevel)
|
|||
bool NzTexture::SetWrapMode(nzTextureWrap wrap)
|
||||
{
|
||||
#if NAZARA_RENDERER_SAFE
|
||||
if (!IsValid())
|
||||
if (!m_impl)
|
||||
{
|
||||
NazaraError("Texture must be valid");
|
||||
return false;
|
||||
|
|
@ -1175,7 +1175,7 @@ bool NzTexture::Update(const NzImage& image, const NzCubeui& cube, nzUInt8 level
|
|||
bool NzTexture::Update(const nzUInt8* pixels, nzUInt8 level)
|
||||
{
|
||||
#if NAZARA_RENDERER_SAFE
|
||||
if (!IsValid())
|
||||
if (!m_impl)
|
||||
{
|
||||
NazaraError("Texture must be valid");
|
||||
return false;
|
||||
|
|
@ -1191,7 +1191,7 @@ bool NzTexture::Update(const nzUInt8* pixels, nzUInt8 level)
|
|||
bool NzTexture::Update(const nzUInt8* pixels, const NzRectui& rect, unsigned int z, nzUInt8 level)
|
||||
{
|
||||
#if NAZARA_RENDERER_SAFE
|
||||
if (!IsValid())
|
||||
if (!m_impl)
|
||||
{
|
||||
NazaraError("Texture must be valid");
|
||||
return false;
|
||||
|
|
@ -1292,7 +1292,7 @@ bool NzTexture::Update(const nzUInt8* pixels, const NzRectui& rect, unsigned int
|
|||
bool NzTexture::Update(const nzUInt8* pixels, const NzCubeui& cube, nzUInt8 level)
|
||||
{
|
||||
#if NAZARA_RENDERER_SAFE
|
||||
if (!IsValid())
|
||||
if (!m_impl)
|
||||
{
|
||||
NazaraError("Texture must be valid");
|
||||
return false;
|
||||
|
|
@ -1436,7 +1436,7 @@ bool NzTexture::UpdateFace(nzCubemapFace face, const NzImage& image, const NzRec
|
|||
bool NzTexture::UpdateFace(nzCubemapFace face, const nzUInt8* pixels, nzUInt8 level)
|
||||
{
|
||||
#if NAZARA_RENDERER_SAFE
|
||||
if (!IsValid())
|
||||
if (!m_impl)
|
||||
{
|
||||
NazaraError("Texture must be valid");
|
||||
return false;
|
||||
|
|
@ -1449,7 +1449,7 @@ bool NzTexture::UpdateFace(nzCubemapFace face, const nzUInt8* pixels, nzUInt8 le
|
|||
bool NzTexture::UpdateFace(nzCubemapFace face, const nzUInt8* pixels, const NzRectui& rect, nzUInt8 level)
|
||||
{
|
||||
#if NAZARA_RENDERER_SAFE
|
||||
if (!IsValid())
|
||||
if (!m_impl)
|
||||
{
|
||||
NazaraError("Texture must be valid");
|
||||
return false;
|
||||
|
|
@ -1527,7 +1527,7 @@ bool NzTexture::UpdateFace(nzCubemapFace face, const nzUInt8* pixels, const NzRe
|
|||
void NzTexture::Unlock()
|
||||
{
|
||||
#if NAZARA_RENDERER_SAFE
|
||||
if (!IsValid())
|
||||
if (!m_impl)
|
||||
{
|
||||
NazaraError("Texture must be valid");
|
||||
return;
|
||||
|
|
@ -1619,7 +1619,7 @@ bool NzTexture::IsTypeSupported(nzImageType type)
|
|||
void NzTexture::SetTarget(bool isTarget)
|
||||
{
|
||||
#if NAZARA_RENDERER_SAFE
|
||||
if (!IsValid())
|
||||
if (!m_impl)
|
||||
{
|
||||
NazaraInternalError("Texture must be valid");
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@
|
|||
#include <Nazara/Utility/Animation.hpp>
|
||||
#include <Nazara/Core/Error.hpp>
|
||||
#include <Nazara/Utility/Config.hpp>
|
||||
#include <map>
|
||||
#include <vector>
|
||||
#include <Nazara/Utility/Debug.hpp>
|
||||
|
||||
|
|
@ -313,6 +314,4 @@ void NzAnimation::RemoveSequence(unsigned int index)
|
|||
m_impl->sequences.erase(it);
|
||||
}
|
||||
|
||||
std::list<NzAnimationLoader::MemoryLoader> NzAnimation::s_memoryLoaders;
|
||||
std::list<NzAnimationLoader::StreamLoader> NzAnimation::s_streamLoaders;
|
||||
std::multimap<NzString, NzAnimationLoader::LoadFileFunction> NzAnimation::s_fileLoaders;
|
||||
NzAnimationLoader::LoaderList NzAnimation::s_loaders;
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@
|
|||
#include <Nazara/Core/Error.hpp>
|
||||
#include <Nazara/Utility/Config.hpp>
|
||||
#include <cmath>
|
||||
#include <stdexcept>
|
||||
#include <Nazara/Utility/Debug.hpp>
|
||||
|
||||
namespace
|
||||
|
|
@ -31,6 +32,20 @@ m_sharedImage(&emptyImage)
|
|||
{
|
||||
}
|
||||
|
||||
NzImage::NzImage(nzImageType type, nzPixelFormat format, unsigned int width, unsigned int height, unsigned int depth, nzUInt8 levelCount) :
|
||||
m_sharedImage(&emptyImage)
|
||||
{
|
||||
Create(type, format, width, height, depth, levelCount);
|
||||
|
||||
#ifdef NAZARA_DEBUG
|
||||
if (!m_sharedImage)
|
||||
{
|
||||
NazaraError("Failed to create image");
|
||||
throw std::runtime_error("Constructor failed");
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
NzImage::NzImage(const NzImage& image) :
|
||||
NzResource(image),
|
||||
m_sharedImage(image.m_sharedImage)
|
||||
|
|
@ -57,7 +72,7 @@ NzImage::~NzImage()
|
|||
bool NzImage::Convert(nzPixelFormat format)
|
||||
{
|
||||
#if NAZARA_UTILITY_SAFE
|
||||
if (!IsValid())
|
||||
if (!m_sharedImage)
|
||||
{
|
||||
NazaraError("Image must be valid");
|
||||
return false;
|
||||
|
|
@ -162,7 +177,7 @@ bool NzImage::Copy(const NzImage& source, const NzCubeui& srcCube, const NzVecto
|
|||
Correctif temporaire : Update veut de la mémoire contigüe
|
||||
Il est donc nécessaire de prendre la partie de la texture que nous voulons mettre à jour
|
||||
|
||||
FIXME: Trouver une interface pour gérer ce genre de problème (Façon OpenGL?)
|
||||
///FIXME: Trouver une interface pour gérer ce genre de problème (Façon OpenGL?)
|
||||
(Appliquer l'interface à NzTexture également)
|
||||
*/
|
||||
nzUInt8 bpp = NzPixelFormat::GetBPP(m_sharedImage->format);
|
||||
|
|
@ -311,7 +326,7 @@ void NzImage::Destroy()
|
|||
bool NzImage::Fill(const NzColor& color)
|
||||
{
|
||||
#if NAZARA_UTILITY_SAFE
|
||||
if (!IsValid())
|
||||
if (!m_sharedImage)
|
||||
{
|
||||
NazaraError("Image must be valid");
|
||||
return false;
|
||||
|
|
@ -369,7 +384,7 @@ bool NzImage::Fill(const NzColor& color)
|
|||
bool NzImage::Fill(const NzColor& color, const NzRectui& rect, unsigned int z)
|
||||
{
|
||||
#if NAZARA_UTILITY_SAFE
|
||||
if (!IsValid())
|
||||
if (!m_sharedImage)
|
||||
{
|
||||
NazaraError("Image must be valid");
|
||||
return false;
|
||||
|
|
@ -432,7 +447,7 @@ bool NzImage::Fill(const NzColor& color, const NzRectui& rect, unsigned int z)
|
|||
bool NzImage::Fill(const NzColor& color, const NzCubeui& cube)
|
||||
{
|
||||
#if NAZARA_UTILITY_SAFE
|
||||
if (!IsValid())
|
||||
if (!m_sharedImage)
|
||||
{
|
||||
NazaraError("Image must be valid");
|
||||
return false;
|
||||
|
|
@ -495,7 +510,7 @@ bool NzImage::Fill(const NzColor& color, const NzCubeui& cube)
|
|||
bool NzImage::FlipHorizontally()
|
||||
{
|
||||
#if NAZARA_UTILITY_SAFE
|
||||
if (!IsValid())
|
||||
if (!m_sharedImage)
|
||||
{
|
||||
NazaraError("Image must be valid");
|
||||
return false;
|
||||
|
|
@ -534,7 +549,7 @@ bool NzImage::FlipHorizontally()
|
|||
bool NzImage::FlipVertically()
|
||||
{
|
||||
#if NAZARA_UTILITY_SAFE
|
||||
if (!IsValid())
|
||||
if (!m_sharedImage)
|
||||
{
|
||||
NazaraError("Image must be valid");
|
||||
return false;
|
||||
|
|
@ -577,7 +592,7 @@ nzUInt8 NzImage::GetBPP() const
|
|||
const nzUInt8* NzImage::GetConstPixels(unsigned int x, unsigned int y, unsigned int z, nzUInt8 level) const
|
||||
{
|
||||
#if NAZARA_UTILITY_SAFE
|
||||
if (!IsValid())
|
||||
if (!m_sharedImage)
|
||||
{
|
||||
NazaraError("Image must be valid");
|
||||
return nullptr;
|
||||
|
|
@ -656,7 +671,7 @@ nzUInt8 NzImage::GetMaxLevel() const
|
|||
NzColor NzImage::GetPixelColor(unsigned int x, unsigned int y, unsigned int z) const
|
||||
{
|
||||
#if NAZARA_UTILITY_SAFE
|
||||
if (!IsValid())
|
||||
if (!m_sharedImage)
|
||||
{
|
||||
NazaraError("Image must be valid");
|
||||
return NzColor();
|
||||
|
|
@ -700,7 +715,7 @@ NzColor NzImage::GetPixelColor(unsigned int x, unsigned int y, unsigned int z) c
|
|||
nzUInt8* NzImage::GetPixels(unsigned int x, unsigned int y, unsigned int z, nzUInt8 level)
|
||||
{
|
||||
#if NAZARA_UTILITY_SAFE
|
||||
if (!IsValid())
|
||||
if (!m_sharedImage)
|
||||
{
|
||||
NazaraError("Image must be valid");
|
||||
return nullptr;
|
||||
|
|
@ -832,7 +847,7 @@ bool NzImage::LoadFromStream(NzInputStream& stream, const NzImageParams& params)
|
|||
bool NzImage::SetLevelCount(nzUInt8 levelCount)
|
||||
{
|
||||
#if NAZARA_UTILITY_SAFE
|
||||
if (!IsValid())
|
||||
if (!m_sharedImage)
|
||||
{
|
||||
NazaraError("Image must be valid");
|
||||
return false;
|
||||
|
|
@ -877,7 +892,7 @@ bool NzImage::SetLevelCount(nzUInt8 levelCount)
|
|||
bool NzImage::SetPixelColor(const NzColor& color, unsigned int x, unsigned int y, unsigned int z)
|
||||
{
|
||||
#if NAZARA_UTILITY_SAFE
|
||||
if (!IsValid())
|
||||
if (!m_sharedImage)
|
||||
{
|
||||
NazaraError("Image must be valid");
|
||||
return false;
|
||||
|
|
@ -923,7 +938,7 @@ bool NzImage::SetPixelColor(const NzColor& color, unsigned int x, unsigned int y
|
|||
bool NzImage::Update(const nzUInt8* pixels, nzUInt8 level)
|
||||
{
|
||||
#if NAZARA_UTILITY_SAFE
|
||||
if (!IsValid())
|
||||
if (!m_sharedImage)
|
||||
{
|
||||
NazaraError("Image must be valid");
|
||||
return false;
|
||||
|
|
@ -952,7 +967,7 @@ bool NzImage::Update(const nzUInt8* pixels, nzUInt8 level)
|
|||
bool NzImage::Update(const nzUInt8* pixels, const NzRectui& rect, unsigned int z, nzUInt8 level)
|
||||
{
|
||||
#if NAZARA_UTILITY_SAFE
|
||||
if (!IsValid())
|
||||
if (!m_sharedImage)
|
||||
{
|
||||
NazaraError("Image must be valid");
|
||||
return false;
|
||||
|
|
@ -990,7 +1005,7 @@ bool NzImage::Update(const nzUInt8* pixels, const NzRectui& rect, unsigned int z
|
|||
unsigned int depth = (m_sharedImage->type == nzImageType_Cubemap) ? 6 : GetLevelSize(m_sharedImage->depth, level);
|
||||
if (z >= depth)
|
||||
{
|
||||
NazaraError("Z value exceeds depth (" + NzString::Number(z) + " >= (" + NzString::Number(depth) + ')');
|
||||
NazaraError("Z value exceeds depth (" + NzString::Number(z) + " >= " + NzString::Number(depth) + ')');
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
|
@ -1015,7 +1030,7 @@ bool NzImage::Update(const nzUInt8* pixels, const NzCubeui& cube, nzUInt8 level)
|
|||
{
|
||||
///FIXME: Vérifier que ça fonctionne correctement
|
||||
#if NAZARA_UTILITY_SAFE
|
||||
if (!IsValid())
|
||||
if (!m_sharedImage)
|
||||
{
|
||||
NazaraError("Image must be valid");
|
||||
return false;
|
||||
|
|
@ -1152,6 +1167,4 @@ void NzImage::ReleaseImage()
|
|||
}
|
||||
|
||||
NzImage::SharedImage NzImage::emptyImage(0, nzImageType_2D, nzPixelFormat_Undefined, 1, nullptr, 0, 0, 0);
|
||||
std::list<NzImageLoader::MemoryLoader> NzImage::s_memoryLoaders;
|
||||
std::list<NzImageLoader::StreamLoader> NzImage::s_streamLoaders;
|
||||
std::multimap<NzString, NzImageLoader::LoadFileFunction> NzImage::s_fileLoaders;
|
||||
NzImageLoader::LoaderList NzImage::s_loaders;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (C) 2011 Jérôme Leclercq
|
||||
// Copyright (C) 2012 Jérôme Leclercq
|
||||
// This file is part of the "Nazara Engine - Utility module"
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
|
||||
|
|
@ -18,27 +18,23 @@
|
|||
|
||||
namespace
|
||||
{
|
||||
bool NzLoader_MD2_LoadStream(NzMesh* mesh, NzInputStream& stream, const NzMeshParams& parameters);
|
||||
|
||||
bool NzLoader_MD2_LoadFile(NzMesh* mesh, const NzString& filePath, const NzMeshParams& parameters)
|
||||
bool NzLoader_MD2_Check(NzInputStream& stream, const NzMeshParams& parameters)
|
||||
{
|
||||
NzFile file(filePath);
|
||||
if (!file.Open(NzFile::ReadOnly))
|
||||
{
|
||||
NazaraError("Failed to open file");
|
||||
NazaraUnused(parameters);
|
||||
|
||||
nzUInt32 magic[2];
|
||||
if (stream.Read(&magic[0], 2*sizeof(nzUInt32)) != 2*sizeof(nzUInt32))
|
||||
return false;
|
||||
}
|
||||
|
||||
return NzLoader_MD2_LoadStream(mesh, file, parameters);
|
||||
#if defined(NAZARA_BIG_ENDIAN)
|
||||
NzByteSwap(&magic[0], sizeof(nzUInt32));
|
||||
NzByteSwap(&magic[1], sizeof(nzUInt32));
|
||||
#endif
|
||||
|
||||
return magic[0] == md2Ident && magic[1] == 8;
|
||||
}
|
||||
|
||||
bool NzLoader_MD2_LoadMemory(NzMesh* mesh, const void* data, unsigned int size, const NzMeshParams& parameters)
|
||||
{
|
||||
NzMemoryStream stream(data, size);
|
||||
return NzLoader_MD2_LoadStream(mesh, stream, parameters);
|
||||
}
|
||||
|
||||
bool NzLoader_MD2_LoadStream(NzMesh* mesh, NzInputStream& stream, const NzMeshParams& parameters)
|
||||
bool NzLoader_MD2_Load(NzMesh* mesh, NzInputStream& stream, const NzMeshParams& parameters)
|
||||
{
|
||||
md2_header header;
|
||||
if (stream.Read(&header, sizeof(md2_header)) != sizeof(md2_header))
|
||||
|
|
@ -208,60 +204,18 @@ namespace
|
|||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool NzLoader_MD2_IdentifyMemory(const void* data, unsigned int size, const NzMeshParams& parameters)
|
||||
{
|
||||
NazaraUnused(parameters);
|
||||
|
||||
if (size < sizeof(md2_header))
|
||||
return false;
|
||||
|
||||
const md2_header* header = reinterpret_cast<const md2_header*>(data);
|
||||
|
||||
#if defined(NAZARA_BIG_ENDIAN)
|
||||
nzUInt32 ident = header->ident;
|
||||
nzUInt32 version = header->version;
|
||||
|
||||
NzByteSwap(&ident, sizeof(nzUInt32));
|
||||
NzByteSwap(&version, sizeof(nzUInt32));
|
||||
|
||||
return ident == md2Ident && version == 8;
|
||||
#else
|
||||
return header->ident == md2Ident && header->version == 8;
|
||||
#endif
|
||||
}
|
||||
|
||||
bool NzLoader_MD2_IdentifyStream(NzInputStream& stream, const NzMeshParams& parameters)
|
||||
{
|
||||
NazaraUnused(parameters);
|
||||
|
||||
nzUInt32 magic[2];
|
||||
if (stream.Read(&magic[0], 2*sizeof(nzUInt32)) != 2*sizeof(nzUInt32))
|
||||
return false;
|
||||
|
||||
#if defined(NAZARA_BIG_ENDIAN)
|
||||
NzByteSwap(&magic[0], sizeof(nzUInt32));
|
||||
NzByteSwap(&magic[1], sizeof(nzUInt32));
|
||||
#endif
|
||||
|
||||
return magic[0] == md2Ident && magic[1] == 8;
|
||||
}
|
||||
}
|
||||
|
||||
void NzLoaders_MD2_Register()
|
||||
{
|
||||
NzMD2Mesh::Initialize();
|
||||
|
||||
NzMeshLoader::RegisterFileLoader("md2", NzLoader_MD2_LoadFile);
|
||||
NzMeshLoader::RegisterMemoryLoader(NzLoader_MD2_IdentifyMemory, NzLoader_MD2_LoadMemory);
|
||||
NzMeshLoader::RegisterStreamLoader(NzLoader_MD2_IdentifyStream, NzLoader_MD2_LoadStream);
|
||||
NzMeshLoader::RegisterLoader("md2", NzLoader_MD2_Check, NzLoader_MD2_Load);
|
||||
}
|
||||
|
||||
void NzLoaders_MD2_Unregister()
|
||||
{
|
||||
NzMeshLoader::UnregisterStreamLoader(NzLoader_MD2_IdentifyStream, NzLoader_MD2_LoadStream);
|
||||
NzMeshLoader::UnregisterMemoryLoader(NzLoader_MD2_IdentifyMemory, NzLoader_MD2_LoadMemory);
|
||||
NzMeshLoader::UnregisterFileLoader("md2", NzLoader_MD2_LoadFile);
|
||||
NzMeshLoader::UnregisterLoader("md2", NzLoader_MD2_Check, NzLoader_MD2_Load);
|
||||
|
||||
NzMD2Mesh::Uninitialize();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (C) 2011 Jérôme Leclercq
|
||||
// Copyright (C) 2012 Jérôme Leclercq
|
||||
// This file is part of the "Nazara Engine - Utility module"
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
|
||||
|
|
|
|||
|
|
@ -37,27 +37,18 @@ namespace
|
|||
nzUInt8 padding[54];
|
||||
};
|
||||
|
||||
bool NzLoader_PCX_LoadStream(NzImage* image, NzInputStream& stream, const NzImageParams& parameters);
|
||||
|
||||
bool NzLoader_PCX_LoadFile(NzImage* image, const NzString& filePath, const NzImageParams& parameters)
|
||||
bool NzLoader_PCX_Check(NzInputStream& stream, const NzImageParams& parameters)
|
||||
{
|
||||
NzFile file(filePath);
|
||||
if (!file.Open(NzFile::ReadOnly))
|
||||
{
|
||||
NazaraError("Failed to open file");
|
||||
NazaraUnused(parameters);
|
||||
|
||||
nzUInt8 manufacturer;
|
||||
if (stream.Read(&manufacturer, 1) != 1)
|
||||
return false;
|
||||
}
|
||||
|
||||
return NzLoader_PCX_LoadStream(image, file, parameters);
|
||||
return manufacturer == 0x0a;
|
||||
}
|
||||
|
||||
bool NzLoader_PCX_LoadMemory(NzImage* image, const void* data, unsigned int size, const NzImageParams& parameters)
|
||||
{
|
||||
NzMemoryStream stream(data, size);
|
||||
return NzLoader_PCX_LoadStream(image, stream, parameters);
|
||||
}
|
||||
|
||||
bool NzLoader_PCX_LoadStream(NzImage* image, NzInputStream& stream, const NzImageParams& parameters)
|
||||
bool NzLoader_PCX_Load(NzImage* image, NzInputStream& stream, const NzImageParams& parameters)
|
||||
{
|
||||
NazaraUnused(parameters);
|
||||
|
||||
|
|
@ -348,39 +339,14 @@ namespace
|
|||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool NzLoader_PCX_IdentifyMemory(const void* data, unsigned int size, const NzImageParams& parameters)
|
||||
{
|
||||
NazaraUnused(parameters);
|
||||
|
||||
if (size < sizeof(pcx_header))
|
||||
return false;
|
||||
|
||||
return *reinterpret_cast<const nzUInt8*>(data) == 0x0a;
|
||||
}
|
||||
|
||||
bool NzLoader_PCX_IdentifyStream(NzInputStream& stream, const NzImageParams& parameters)
|
||||
{
|
||||
NazaraUnused(parameters);
|
||||
|
||||
nzUInt8 manufacturer;
|
||||
if (stream.Read(&manufacturer, 1) != 1)
|
||||
return false;
|
||||
|
||||
return manufacturer == 0x0a;
|
||||
}
|
||||
}
|
||||
|
||||
void NzLoaders_PCX_Register()
|
||||
{
|
||||
NzImageLoader::RegisterFileLoader("pcx", NzLoader_PCX_LoadFile);
|
||||
NzImageLoader::RegisterMemoryLoader(NzLoader_PCX_IdentifyMemory, NzLoader_PCX_LoadMemory);
|
||||
NzImageLoader::RegisterStreamLoader(NzLoader_PCX_IdentifyStream, NzLoader_PCX_LoadStream);
|
||||
NzImageLoader::RegisterLoader("pcx", NzLoader_PCX_Check, NzLoader_PCX_Load);
|
||||
}
|
||||
|
||||
void NzLoaders_PCX_Unregister()
|
||||
{
|
||||
NzImageLoader::UnregisterStreamLoader(NzLoader_PCX_IdentifyStream, NzLoader_PCX_LoadStream);
|
||||
NzImageLoader::UnregisterMemoryLoader(NzLoader_PCX_IdentifyMemory, NzLoader_PCX_LoadMemory);
|
||||
NzImageLoader::UnregisterFileLoader("pcx", NzLoader_PCX_LoadFile);
|
||||
NzImageLoader::UnregisterLoader("pcx", NzLoader_PCX_Check, NzLoader_PCX_Load);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (C) 2011 Jérôme Leclercq
|
||||
// Copyright (C) 2012 Jérôme Leclercq
|
||||
// This file is part of the "Nazara Engine - Utility module"
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
|
||||
|
|
@ -37,30 +37,16 @@ namespace
|
|||
|
||||
static stbi_io_callbacks callbacks = {Read, Skip, Eof};
|
||||
|
||||
bool NzLoader_STB_LoadStream(NzImage* image, NzInputStream& stream, const NzImageParams& parameters);
|
||||
|
||||
bool NzLoader_STB_LoadFile(NzImage* image, const NzString& filePath, const NzImageParams& parameters)
|
||||
{
|
||||
NzFile file(filePath);
|
||||
if (!file.Open(NzFile::ReadOnly))
|
||||
{
|
||||
NazaraError("Failed to open file");
|
||||
return false;
|
||||
}
|
||||
|
||||
return NzLoader_STB_LoadStream(image, file, parameters);
|
||||
}
|
||||
|
||||
bool NzLoader_STB_LoadMemory(NzImage* image, const void* data, unsigned int size, const NzImageParams& parameters)
|
||||
{
|
||||
NzMemoryStream stream(data, size);
|
||||
return NzLoader_STB_LoadStream(image, stream, parameters);
|
||||
}
|
||||
|
||||
bool NzLoader_STB_LoadStream(NzImage* image, NzInputStream& stream, const NzImageParams& parameters)
|
||||
bool NzLoader_STB_Check(NzInputStream& stream, const NzImageParams& parameters)
|
||||
{
|
||||
NazaraUnused(parameters);
|
||||
|
||||
int width, height, bpp;
|
||||
return stbi_info_from_callbacks(&callbacks, &stream, &width, &height, &bpp);
|
||||
}
|
||||
|
||||
bool NzLoader_STB_Load(NzImage* image, NzInputStream& stream, const NzImageParams& parameters)
|
||||
{
|
||||
static const nzPixelFormat formats[4] =
|
||||
{
|
||||
nzPixelFormat_L8,
|
||||
|
|
@ -127,34 +113,14 @@ namespace
|
|||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool NzLoader_STB_IdentifyMemory(const void* data, unsigned int size, const NzImageParams& parameters)
|
||||
{
|
||||
NazaraUnused(parameters);
|
||||
|
||||
int width, height, bpp;
|
||||
return stbi_info_from_memory(reinterpret_cast<const stbi_uc*>(data), size, &width, &height, &bpp);
|
||||
}
|
||||
|
||||
bool NzLoader_STB_IdentifyStream(NzInputStream& stream, const NzImageParams& parameters)
|
||||
{
|
||||
NazaraUnused(parameters);
|
||||
|
||||
int width, height, bpp;
|
||||
return stbi_info_from_callbacks(&callbacks, &stream, &width, &height, &bpp);
|
||||
}
|
||||
}
|
||||
|
||||
void NzLoaders_STB_Register()
|
||||
{
|
||||
NzImageLoader::RegisterFileLoader("bmp, gif, hdr, jpg, jpeg, pic, png, psd, tga", NzLoader_STB_LoadFile);
|
||||
NzImageLoader::RegisterMemoryLoader(NzLoader_STB_IdentifyMemory, NzLoader_STB_LoadMemory);
|
||||
NzImageLoader::RegisterStreamLoader(NzLoader_STB_IdentifyStream, NzLoader_STB_LoadStream);
|
||||
NzImageLoader::RegisterLoader("bmp,gif,hdr,jpg,jpeg,pic,png,psd,tga", NzLoader_STB_Check, NzLoader_STB_Load);
|
||||
}
|
||||
|
||||
void NzLoaders_STB_Unregister()
|
||||
{
|
||||
NzImageLoader::UnregisterStreamLoader(NzLoader_STB_IdentifyStream, NzLoader_STB_LoadStream);
|
||||
NzImageLoader::UnregisterMemoryLoader(NzLoader_STB_IdentifyMemory, NzLoader_STB_LoadMemory);
|
||||
NzImageLoader::UnregisterFileLoader("bmp, gif, hdr, jpg, jpeg, pic, png, psd, tga", NzLoader_STB_LoadFile);
|
||||
NzImageLoader::UnregisterLoader("bmp,gif,hdr,jpg,jpeg,pic,png,psd,tga", NzLoader_STB_Check, NzLoader_STB_Load);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@
|
|||
#include <Nazara/Utility/SubMesh.hpp>
|
||||
#include <cstring>
|
||||
#include <deque>
|
||||
#include <map>
|
||||
#include <Nazara/Utility/Debug.hpp>
|
||||
|
||||
bool NzMeshParams::IsValid() const
|
||||
|
|
@ -619,6 +620,4 @@ bool NzMesh::SetAnimation(const NzAnimation* animation)
|
|||
return true;
|
||||
}
|
||||
|
||||
std::list<NzMeshLoader::MemoryLoader> NzMesh::s_memoryLoaders;
|
||||
std::list<NzMeshLoader::StreamLoader> NzMesh::s_streamLoaders;
|
||||
std::multimap<NzString, NzMeshLoader::LoadFileFunction> NzMesh::s_fileLoaders;
|
||||
NzMeshLoader::LoaderList NzMesh::s_loaders;
|
||||
|
|
|
|||
Loading…
Reference in New Issue