removing redundant framebuffer virtual methods

This commit is contained in:
Noel Berry 2021-03-24 01:07:49 -07:00
parent bd9736df03
commit 94f25cea88
14 changed files with 32 additions and 84 deletions

View File

@ -54,16 +54,16 @@ namespace Blah
virtual const Attachments& attachments() const = 0; virtual const Attachments& attachments() const = 0;
// Gets the Attachment at a given index from the FrameBuffer // Gets the Attachment at a given index from the FrameBuffer
virtual TextureRef& attachment(int index) = 0; TextureRef& attachment(int index);
// Gets the Attachment at a given index from the FrameBuffer // Gets the Attachment at a given index from the FrameBuffer
virtual const TextureRef& attachment(int index) const = 0; const TextureRef& attachment(int index) const;
// Gets the width of the FrameBuffer // Gets the width of the FrameBuffer
virtual int width() const = 0; virtual int width() const;
// Gets the height of the FrameBuffer // Gets the height of the FrameBuffer
virtual int height() const = 0; virtual int height() const;
// Clears the FrameBuffer // Clears the FrameBuffer
virtual void clear(Color color = Color::black, float depth = 1.0f, u8 stencil = 0, ClearMask mask = ClearMask::All) = 0; virtual void clear(Color color = Color::black, float depth = 1.0f, u8 stencil = 0, ClearMask mask = ClearMask::All) = 0;

View File

@ -278,18 +278,6 @@ namespace
return empty_attachments; return empty_attachments;
} }
virtual TextureRef& attachment(int index) override
{
BLAH_ASSERT(false, "Backbuffer doesn't have any attachments");
return empty_texture;
}
virtual const TextureRef& attachment(int index) const override
{
BLAH_ASSERT(false, "Backbuffer doesn't have any attachments");
return empty_texture;
}
virtual int width() const override virtual int width() const override
{ {
return App::draw_width(); return App::draw_width();

View File

@ -31,3 +31,23 @@ FrameBufferRef FrameBuffer::create(int width, int height, const AttachmentFormat
return GraphicsBackend::create_framebuffer(width, height, attachments.data(), attachments.size()); return GraphicsBackend::create_framebuffer(width, height, attachments.data(), attachments.size());
} }
TextureRef& FrameBuffer::attachment(int index)
{
return attachments()[index];
}
const TextureRef& FrameBuffer::attachment(int index) const
{
return attachments()[index];
}
int FrameBuffer::width() const
{
return attachments()[0]->width();
}
int FrameBuffer::height() const
{
return attachments()[0]->height();
}

View File

@ -332,26 +332,6 @@ namespace Blah
return m_attachments; return m_attachments;
} }
virtual TextureRef& attachment(int index) override
{
return m_attachments[index];
}
virtual const TextureRef& attachment(int index) const override
{
return m_attachments[index];
}
virtual int width() const override
{
return m_attachments[0]->width();
}
virtual int height() const override
{
return m_attachments[0]->height();
}
virtual void clear(Color color, float depth, u8 stencil, ClearMask mask) override virtual void clear(Color color, float depth, u8 stencil, ClearMask mask) override
{ {
float col[4] = { color.r / 255.0f, color.g / 255.0f, color.b / 255.0f, color.a / 255.0f }; float col[4] = { color.r / 255.0f, color.g / 255.0f, color.b / 255.0f, color.a / 255.0f };

View File

@ -83,26 +83,6 @@ namespace Blah
return m_attachments; return m_attachments;
} }
virtual TextureRef& attachment(int index) override
{
return m_attachments[index];
}
virtual const TextureRef& attachment(int index) const override
{
return m_attachments[index];
}
virtual int width() const override
{
return m_attachments[0]->width();
}
virtual int height() const override
{
return m_attachments[0]->height();
}
virtual void clear(Color color) override virtual void clear(Color color) override
{ {

View File

@ -729,26 +729,6 @@ namespace Blah
return m_attachments; return m_attachments;
} }
virtual TextureRef& attachment(int index) override
{
return m_attachments[index];
}
virtual const TextureRef& attachment(int index) const override
{
return m_attachments[index];
}
virtual int width() const override
{
return m_width;
}
virtual int height() const override
{
return m_height;
}
virtual void clear(Color color, float depth, u8 stencil, ClearMask mask) override virtual void clear(Color color, float depth, u8 stencil, ClearMask mask) override
{ {
int clear = 0; int clear = 0;