Renderer/Texture: Implement Update of a region + inherit AbstractImage

This commit is contained in:
Jérôme Leclercq
2021-09-07 18:42:53 +02:00
parent b6745b2906
commit 879b2f7aa6
11 changed files with 122 additions and 73 deletions

View File

@@ -27,23 +27,17 @@ namespace Nz
virtual ~AbstractImage();
UInt8 GetBytesPerPixel() const;
virtual unsigned int GetDepth(UInt8 level = 0) const = 0;
virtual PixelFormat GetFormat() const = 0;
virtual unsigned int GetHeight(UInt8 level = 0) const = 0;
virtual UInt8 GetLevelCount() const = 0;
virtual UInt8 GetMaxLevel() const = 0;
virtual std::size_t GetMemoryUsage() const = 0;
virtual std::size_t GetMemoryUsage(UInt8 level) const = 0;
virtual Vector3ui GetSize(UInt8 level = 0) const = 0;
virtual ImageType GetType() const = 0;
virtual unsigned int GetWidth(UInt8 level = 0) const = 0;
bool IsCompressed() const;
bool IsCubemap() const;
virtual bool Update(const UInt8* pixels, unsigned int srcWidth = 0, unsigned int srcHeight = 0, UInt8 level = 0) = 0;
virtual bool Update(const UInt8* pixels, const Boxui& box, unsigned int srcWidth = 0, unsigned int srcHeight = 0, UInt8 level = 0) = 0;
virtual bool Update(const UInt8* pixels, const Rectui& rect, unsigned int z = 0, unsigned int srcWidth = 0, unsigned int srcHeight = 0, UInt8 level = 0) = 0;
inline bool Update(const void* pixels, unsigned int srcWidth = 0, unsigned int srcHeight = 0, UInt8 level = 0);
virtual bool Update(const void* pixels, const Boxui& box, unsigned int srcWidth = 0, unsigned int srcHeight = 0, UInt8 level = 0) = 0;
inline bool Update(const void* pixels, const Rectui& rect, unsigned int z = 0, unsigned int srcWidth = 0, unsigned int srcHeight = 0, UInt8 level = 0);
AbstractImage& operator=(const AbstractImage&) = default;
AbstractImage& operator=(AbstractImage&&) noexcept = default;

View File

@@ -2,10 +2,20 @@
// 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/AbstractImage.hpp>
#include <Nazara/Utility/Debug.hpp>
namespace Nz
{
inline bool AbstractImage::Update(const void* pixels, unsigned int srcWidth, unsigned int srcHeight, UInt8 level)
{
return Update(pixels, GetSize(level), srcWidth, srcHeight, level);
}
inline bool AbstractImage::Update(const void* pixels, const Rectui& rect, unsigned int z, unsigned int srcWidth, unsigned int srcHeight, UInt8 level)
{
return Update(pixels, Boxui(rect.x, rect.y, z, rect.width, rect.height, 1), srcWidth, srcHeight, level);
}
}
#include <Nazara/Utility/DebugOff.hpp>