Added Meshes and Animations (And many more)
Added NzTexture::IsMipmappingSupported Color::(FromTo)HSV now takes hue and saturation in degrees Fixed Context::EnsureContext Fixed COW thread-safety (String, Image, Matrix4) Fixed Quatenion<T>::operator*(const Vector3<T>&) Fixed ResourceLoader Fixed String::Resize with a size of 0 Fixed Texture mipmapping crash Fixed per-class thread-safety IndexBuffer and VertexBuffer are now resources It is now possible to use more than 8 texcoords per shader Moved all enumerations into separate files (Core/Enums.hpp, Utility/Enums.hpp, ..) Removed NzContextParameters::defaultWindow VertexDeclaration has been rewritten (New interface/COW)
This commit is contained in:
@@ -8,8 +8,6 @@
|
||||
#define NAZARA_RESOURCELOADER_HPP
|
||||
|
||||
#include <Nazara/Core/String.hpp>
|
||||
#include <list>
|
||||
#include <map>
|
||||
#include <utility>
|
||||
|
||||
class NzInputStream;
|
||||
@@ -18,30 +16,26 @@ template<typename Type, typename Parameters>
|
||||
class NzResourceLoader
|
||||
{
|
||||
public:
|
||||
typedef bool (*IsMemoryLoadingSupportedFunction)(const void* data, unsigned int size, const Parameters& parameters);
|
||||
typedef bool (*IsStreamLoadingSupportedFunction)(NzInputStream& stream, const Parameters& parameters);
|
||||
typedef bool (*LoadFileFunction)(Type* resource, const NzString& filePath, const Parameters& parameters);
|
||||
typedef bool (*LoadMemoryFunction)(Type* resource, const void* data, unsigned int size, const Parameters& parameters);
|
||||
typedef bool (*LoadStreamFunction)(Type* resource, NzInputStream& stream, const Parameters& parameters);
|
||||
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);
|
||||
|
||||
protected:
|
||||
static bool LoadResourceFromFile(Type* resource, const NzString& filePath, const Parameters& parameters);
|
||||
static bool LoadResourceFromMemory(Type* resource, const void* data, unsigned int size, const Parameters& parameters);
|
||||
static bool LoadResourceFromStream(Type* resource, NzInputStream& stream, const Parameters& parameters);
|
||||
static void RegisterResourceFileLoader(const NzString& extensions, LoadFileFunction loadFile);
|
||||
static void RegisterResourceMemoryLoader(IsMemoryLoadingSupportedFunction isLoadingSupported, LoadMemoryFunction loadMemory);
|
||||
static void RegisterResourceStreamLoader(IsStreamLoadingSupportedFunction isLoadingSupported, LoadStreamFunction loadStream);
|
||||
static void UnregisterResourceFileLoader(const NzString& extensions, LoadFileFunction loadFile);
|
||||
static void UnregisterResourceMemoryLoader(IsMemoryLoadingSupportedFunction isLoadingSupported, LoadMemoryFunction loadMemory);
|
||||
static void UnregisterResourceStreamLoader(IsStreamLoadingSupportedFunction isLoadingSupported, LoadStreamFunction loadStream);
|
||||
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());
|
||||
|
||||
private:
|
||||
typedef std::pair<IsMemoryLoadingSupportedFunction, LoadMemoryFunction> MemoryLoader;
|
||||
typedef std::pair<IsStreamLoadingSupportedFunction, LoadStreamFunction> StreamLoader;
|
||||
static void RegisterFileLoader(const NzString& extensions, LoadFileFunction loadFile);
|
||||
static void RegisterMemoryLoader(IdentifyMemoryFunction identifyMemory, LoadMemoryFunction loadMemory);
|
||||
static void RegisterStreamLoader(IdentifyStreamFunction identifyStream, LoadStreamFunction loadStream);
|
||||
|
||||
static std::list<MemoryLoader> s_memoryLoaders;
|
||||
static std::list<StreamLoader> s_streamLoaders;
|
||||
static std::multimap<NzString, LoadFileFunction> s_fileLoaders;
|
||||
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>
|
||||
|
||||
Reference in New Issue
Block a user