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;
// 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
virtual const TextureRef& attachment(int index) const = 0;
const TextureRef& attachment(int index) const;
// Gets the width of the FrameBuffer
virtual int width() const = 0;
virtual int width() const;
// Gets the height of the FrameBuffer
virtual int height() const = 0;
virtual int height() const;
// Clears the FrameBuffer
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;
}
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
{
return App::draw_width();

View File

@ -1090,4 +1090,4 @@ void Batch::str(const SpriteFont& font, const String& text, const Vec2& pos, Tex
}
pop_matrix();
}
}

View File

@ -22,4 +22,4 @@ const BlendMode BlendMode::Subtract = BlendMode(
BlendFactor::One,
BlendMask::RGBA,
0xffffffff
);
);

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());
}
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

@ -38,4 +38,4 @@ VertexFormat::VertexFormat(std::initializer_list<VertexAttribute> attributes, in
}
this->stride = stride;
}
}

View File

@ -91,4 +91,4 @@ void RenderPass::perform()
// perform render
GraphicsBackend::render(pass);
}
}

View File

@ -36,4 +36,4 @@ ShaderRef Shader::create(const ShaderData& data)
}
return shader;
}
}

View File

@ -296,4 +296,4 @@ const SpriteFont::Character& SpriteFont::operator[](Codepoint codepoint) const
if (it != m_characters.end())
return it->second;
return empty;
}
}

View File

@ -61,4 +61,4 @@ Subtexture Subtexture::crop(const Rect& clip) const
crop_info(clip, &dst.source, &dst.frame);
dst.update();
return dst;
}
}

View File

@ -32,4 +32,4 @@ TextureRef Texture::create(Stream& stream)
TextureRef Texture::create(const FilePath& file)
{
return create(Image(file));
}
}

View File

@ -332,26 +332,6 @@ namespace Blah
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
{
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;
}
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
{

View File

@ -729,26 +729,6 @@ namespace Blah
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
{
int clear = 0;