Made Resource copying/moving impossible

It is still possible to copy some Resource-based classes though


Former-commit-id: bbb6066f736c210015ff9fdfded7d95eb9695359
This commit is contained in:
Lynix
2015-01-16 16:28:38 +01:00
parent ff7cfa226e
commit cd5399459d
7 changed files with 18 additions and 91 deletions

View File

@@ -23,6 +23,8 @@ class NAZARA_API NzResource
{
public:
NzResource(bool persistent = true);
NzResource(const NzResource& resource) = delete;
NzResource(NzResource&& resource) = delete;
virtual ~NzResource();
void AddResourceListener(NzResourceListener* listener, int index = 0) const;
@@ -37,6 +39,9 @@ class NAZARA_API NzResource
bool SetPersistent(bool persistent = true, bool checkReferenceCount = false);
NzResource& operator=(const NzResource& resource) = delete;
NzResource& operator=(NzResource&& resource) = delete;
protected:
void NotifyCreated();
void NotifyDestroy();

View File

@@ -46,7 +46,6 @@ class NAZARA_API NzMaterial : public NzResource
public:
NzMaterial();
NzMaterial(const NzMaterial& material);
NzMaterial(NzMaterial&& material);
~NzMaterial();
const NzShader* Apply(nzUInt32 shaderFlags = 0, nzUInt8 textureUnit = 0, nzUInt8* lastUsedUnit = nullptr) const;
@@ -127,7 +126,6 @@ class NAZARA_API NzMaterial : public NzResource
void SetSrcBlend(nzBlendFunc func);
NzMaterial& operator=(const NzMaterial& material);
NzMaterial& operator=(NzMaterial&& material);
static NzMaterial* GetDefault();

View File

@@ -31,7 +31,6 @@ class NAZARA_API NzTexture : public NzAbstractImage, public NzResource, NzNonCop
NzTexture() = default;
NzTexture(nzImageType type, nzPixelFormat format, unsigned int width, unsigned int height, unsigned int depth = 1, nzUInt8 levelCount = 1);
explicit NzTexture(const NzImage& image);
NzTexture(NzTexture&& texture);
~NzTexture();
bool Create(nzImageType type, nzPixelFormat format, unsigned int width, unsigned int height, unsigned int depth = 1, nzUInt8 levelCount = 1);
@@ -94,8 +93,6 @@ class NAZARA_API NzTexture : public NzAbstractImage, public NzResource, NzNonCop
// Fonctions OpenGL
unsigned int GetOpenGLID() const;
NzTexture& operator=(NzTexture&& texture);
static unsigned int GetValidSize(unsigned int size);
static bool IsFormatSupported(nzPixelFormat format);
static bool IsMipmappingSupported();

View File

@@ -46,7 +46,6 @@ class NAZARA_API NzImage : public NzAbstractImage, public NzResource
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);
~NzImage();
@@ -105,7 +104,6 @@ class NAZARA_API NzImage : public NzAbstractImage, public NzResource
bool Update(const nzUInt8* pixels, const NzRectui& rect, unsigned int z = 0, unsigned int srcWidth = 0, unsigned int srcHeight = 0, nzUInt8 level = 0);
NzImage& operator=(const NzImage& image);
NzImage& operator=(NzImage&& image) noexcept;
static void Copy(nzUInt8* destination, const nzUInt8* source, nzUInt8 bpp, 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 nzUInt8 GetMaxLevel(unsigned int width, unsigned int height, unsigned int depth = 1);