Refactor the way resources are loaded (#191)
* WIP * WIP * Font works * WIP: Only Music remains * Looks like it's working * Fix oopsie * Core/ObjectRef: Add cast functions * Update ChangeLog.md * Audio/SoundStream: Make sound stream thread-safe
This commit is contained in:
@@ -83,15 +83,15 @@ namespace Nz
|
||||
bool IsLoopPointInterpolationEnabled() const;
|
||||
bool IsValid() const;
|
||||
|
||||
bool LoadFromFile(const String& filePath, const AnimationParams& params = AnimationParams());
|
||||
bool LoadFromMemory(const void* data, std::size_t size, const AnimationParams& params = AnimationParams());
|
||||
bool LoadFromStream(Stream& stream, const AnimationParams& params = AnimationParams());
|
||||
|
||||
void RemoveSequence(const String& sequenceName);
|
||||
void RemoveSequence(UInt32 index);
|
||||
|
||||
template<typename... Args> static AnimationRef New(Args&&... args);
|
||||
|
||||
static AnimationRef LoadFromFile(const String& filePath, const AnimationParams& params = AnimationParams());
|
||||
static AnimationRef LoadFromMemory(const void* data, std::size_t size, const AnimationParams& params = AnimationParams());
|
||||
static AnimationRef LoadFromStream(Stream& stream, const AnimationParams& params = AnimationParams());
|
||||
|
||||
// Signals:
|
||||
NazaraSignal(OnAnimationDestroy, const Animation* /*animation*/);
|
||||
NazaraSignal(OnAnimationRelease, const Animation* /*animation*/);
|
||||
|
||||
@@ -76,11 +76,6 @@ namespace Nz
|
||||
bool Precache(unsigned int characterSize, UInt32 style, char32_t character) const;
|
||||
bool Precache(unsigned int characterSize, UInt32 style, const String& characterSet) const;
|
||||
|
||||
// Open
|
||||
bool OpenFromFile(const String& filePath, const FontParams& params = FontParams());
|
||||
bool OpenFromMemory(const void* data, std::size_t size, const FontParams& params = FontParams());
|
||||
bool OpenFromStream(Stream& stream, const FontParams& params = FontParams());
|
||||
|
||||
void SetAtlas(const std::shared_ptr<AbstractAtlas>& atlas);
|
||||
void SetGlyphBorder(unsigned int borderSize);
|
||||
void SetMinimumStepSize(unsigned int minimumStepSize);
|
||||
@@ -93,6 +88,10 @@ namespace Nz
|
||||
static unsigned int GetDefaultGlyphBorder();
|
||||
static unsigned int GetDefaultMinimumStepSize();
|
||||
|
||||
static FontRef OpenFromFile(const String& filePath, const FontParams& params = FontParams());
|
||||
static FontRef OpenFromMemory(const void* data, std::size_t size, const FontParams& params = FontParams());
|
||||
static FontRef OpenFromStream(Stream& stream, const FontParams& params = FontParams());
|
||||
|
||||
template<typename... Args> static FontRef New(Args&&... args);
|
||||
|
||||
static void SetDefaultAtlas(const std::shared_ptr<AbstractAtlas>& atlas);
|
||||
|
||||
@@ -63,7 +63,7 @@ namespace Nz
|
||||
|
||||
bool Convert(PixelFormatType format);
|
||||
|
||||
void Copy(const Image& source, const Boxui& srcBox, const Vector3ui& dstPos);
|
||||
void Copy(const Image* source, const Boxui& srcBox, const Vector3ui& dstPos);
|
||||
|
||||
bool Create(ImageType type, PixelFormatType format, unsigned int width, unsigned int height, unsigned int depth = 1, UInt8 levelCount = 1);
|
||||
void Destroy();
|
||||
@@ -93,23 +93,6 @@ namespace Nz
|
||||
|
||||
bool IsValid() const;
|
||||
|
||||
// Load
|
||||
bool LoadFromFile(const String& filePath, const ImageParams& params = ImageParams());
|
||||
bool LoadFromMemory(const void* data, std::size_t size, const ImageParams& params = ImageParams());
|
||||
bool LoadFromStream(Stream& stream, const ImageParams& params = ImageParams());
|
||||
|
||||
// LoadArray
|
||||
bool LoadArrayFromFile(const String& filePath, const ImageParams& imageParams = ImageParams(), const Vector2ui& atlasSize = Vector2ui(2, 2));
|
||||
bool LoadArrayFromImage(const Image& image, const Vector2ui& atlasSize = Vector2ui(2, 2));
|
||||
bool LoadArrayFromMemory(const void* data, std::size_t size, const ImageParams& imageParams = ImageParams(), const Vector2ui& atlasSize = Vector2ui(2, 2));
|
||||
bool LoadArrayFromStream(Stream& stream, const ImageParams& imageParams = ImageParams(), const Vector2ui& atlasSize = Vector2ui(2, 2));
|
||||
|
||||
// LoadCubemap
|
||||
bool LoadCubemapFromFile(const String& filePath, const ImageParams& imageParams = ImageParams(), const CubemapParams& cubemapParams = CubemapParams());
|
||||
bool LoadCubemapFromImage(const Image& image, const CubemapParams& params = CubemapParams());
|
||||
bool LoadCubemapFromMemory(const void* data, std::size_t size, const ImageParams& imageParams = ImageParams(), const CubemapParams& cubemapParams = CubemapParams());
|
||||
bool LoadCubemapFromStream(Stream& stream, const ImageParams& imageParams = ImageParams(), const CubemapParams& cubemapParams = CubemapParams());
|
||||
|
||||
// LoadFace
|
||||
bool LoadFaceFromFile(CubemapFace face, const String& filePath, const ImageParams& params = ImageParams());
|
||||
bool LoadFaceFromMemory(CubemapFace face, const void* data, std::size_t size, const ImageParams& params = ImageParams());
|
||||
@@ -133,6 +116,24 @@ namespace Nz
|
||||
static void Copy(UInt8* destination, const UInt8* source, PixelFormatType format, unsigned int width, unsigned int height, unsigned int depth = 1, unsigned int dstWidth = 0, unsigned int dstHeight = 0, unsigned int srcWidth = 0, unsigned int srcHeight = 0);
|
||||
static UInt8 GetMaxLevel(unsigned int width, unsigned int height, unsigned int depth = 1);
|
||||
static UInt8 GetMaxLevel(ImageType type, unsigned int width, unsigned int height, unsigned int depth = 1);
|
||||
|
||||
// Load
|
||||
static ImageRef LoadFromFile(const String& filePath, const ImageParams& params = ImageParams());
|
||||
static ImageRef LoadFromMemory(const void* data, std::size_t size, const ImageParams& params = ImageParams());
|
||||
static ImageRef LoadFromStream(Stream& stream, const ImageParams& params = ImageParams());
|
||||
|
||||
// LoadArray
|
||||
static ImageRef LoadArrayFromFile(const String& filePath, const ImageParams& imageParams = ImageParams(), const Vector2ui& atlasSize = Vector2ui(2, 2));
|
||||
static ImageRef LoadArrayFromImage(const Image* image, const Vector2ui& atlasSize = Vector2ui(2, 2));
|
||||
static ImageRef LoadArrayFromMemory(const void* data, std::size_t size, const ImageParams& imageParams = ImageParams(), const Vector2ui& atlasSize = Vector2ui(2, 2));
|
||||
static ImageRef LoadArrayFromStream(Stream& stream, const ImageParams& imageParams = ImageParams(), const Vector2ui& atlasSize = Vector2ui(2, 2));
|
||||
|
||||
// LoadCubemap
|
||||
static ImageRef LoadCubemapFromFile(const String& filePath, const ImageParams& imageParams = ImageParams(), const CubemapParams& cubemapParams = CubemapParams());
|
||||
static ImageRef LoadCubemapFromImage(const Image* image, const CubemapParams& params = CubemapParams());
|
||||
static ImageRef LoadCubemapFromMemory(const void* data, std::size_t size, const ImageParams& imageParams = ImageParams(), const CubemapParams& cubemapParams = CubemapParams());
|
||||
static ImageRef LoadCubemapFromStream(Stream& stream, const ImageParams& imageParams = ImageParams(), const CubemapParams& cubemapParams = CubemapParams());
|
||||
|
||||
template<typename... Args> static ImageRef New(Args&&... args);
|
||||
|
||||
struct SharedImage
|
||||
|
||||
@@ -128,10 +128,6 @@ namespace Nz
|
||||
bool IsAnimable() const;
|
||||
bool IsValid() const;
|
||||
|
||||
bool LoadFromFile(const String& filePath, const MeshParams& params = MeshParams());
|
||||
bool LoadFromMemory(const void* data, std::size_t size, const MeshParams& params = MeshParams());
|
||||
bool LoadFromStream(Stream& stream, const MeshParams& params = MeshParams());
|
||||
|
||||
void Recenter();
|
||||
|
||||
void RemoveSubMesh(const String& identifier);
|
||||
@@ -149,6 +145,10 @@ namespace Nz
|
||||
Mesh& operator=(const Mesh&) = delete;
|
||||
Mesh& operator=(Mesh&&) = delete;
|
||||
|
||||
static MeshRef LoadFromFile(const String& filePath, const MeshParams& params = MeshParams());
|
||||
static MeshRef LoadFromMemory(const void* data, std::size_t size, const MeshParams& params = MeshParams());
|
||||
static MeshRef LoadFromStream(Stream& stream, const MeshParams& params = MeshParams());
|
||||
|
||||
template<typename... Args> static MeshRef New(Args&&... args);
|
||||
|
||||
// Signals:
|
||||
|
||||
Reference in New Issue
Block a user