Improved RenderTexture class

Former-commit-id: 0126eeefce5512a504024e1c0ef2e5f1345003b3
This commit is contained in:
Lynix
2013-09-29 09:53:13 +02:00
parent a410e8856a
commit 8ce5f879a8
6 changed files with 266 additions and 87 deletions

View File

@@ -24,10 +24,10 @@ class NAZARA_API NzRenderTexture : public NzRenderTarget, NzResourceListener, Nz
NzRenderTexture() = default;
~NzRenderTexture();
bool AttachBuffer(nzAttachmentPoint attachmentPoint, nzUInt8 index, nzPixelFormat format);
bool AttachBuffer(nzAttachmentPoint attachmentPoint, nzUInt8 index, nzPixelFormat format, unsigned int width, unsigned int height);
bool AttachTexture(nzAttachmentPoint attachmentPoint, nzUInt8 index, NzTexture* texture, unsigned int z = 0);
bool Create(unsigned int width, unsigned int height, bool lock = false);
bool Create(bool lock = false);
void Destroy();
void Detach(nzAttachmentPoint attachmentPoint, nzUInt8 index);
@@ -41,6 +41,11 @@ class NAZARA_API NzRenderTexture : public NzRenderTarget, NzResourceListener, Nz
bool IsValid() const;
bool Lock() const;
void SetColorTarget(nzUInt8 target);
void SetColorTargets(const nzUInt8* targets, unsigned int targetCount);
void SetColorTargets(const std::initializer_list<nzUInt8>& targets);
void Unlock() const;
// Fonctions OpenGL
@@ -51,9 +56,12 @@ class NAZARA_API NzRenderTexture : public NzRenderTarget, NzResourceListener, Nz
protected:
bool Activate() const override;
void Desactivate() const override;
void EnsureTargetUpdated() const override;
private:
bool OnResourceDestroy(const NzResource* resource, int index) override;
void UpdateDrawBuffers() const;
void UpdateTargets() const;
NzRenderTextureImpl* m_impl = nullptr;
};