light/modules/renderer/include/renderer/framebuffer.hpp

41 lines
662 B
C++
Raw Normal View History

2022-03-08 21:19:19 +03:30
#pragma once
2022-03-08 21:19:19 +03:30
#include <glm/glm.hpp>
2025-07-11 00:05:48 +03:30
namespace lt {
2022-03-08 21:19:19 +03:30
class SharedContext;
struct FramebufferSpecification
{
2025-07-06 16:52:50 +03:30
unsigned int width{};
2025-07-06 14:02:50 +03:30
2025-07-06 16:52:50 +03:30
unsigned int height{};
2025-07-06 14:02:50 +03:30
2022-03-08 21:19:19 +03:30
unsigned int samples = 1;
};
class Framebuffer
{
public:
2025-07-06 16:52:50 +03:30
virtual ~Framebuffer() = default;
2025-07-06 14:02:50 +03:30
static auto create(
const FramebufferSpecification &specification,
2025-07-06 16:52:50 +03:30
const Ref<SharedContext>& sharedContext
2025-07-06 14:02:50 +03:30
) -> Ref<Framebuffer>;
virtual void bind_as_target(const glm::vec4 &clearColor) = 0;
2022-03-08 21:19:19 +03:30
2025-07-06 14:02:50 +03:30
virtual void bind_as_resource() = 0;
2022-03-08 21:19:19 +03:30
2025-07-06 14:02:50 +03:30
virtual void resize(const glm::uvec2 &size) = 0;
2022-03-08 21:19:19 +03:30
2025-07-06 14:02:50 +03:30
virtual auto get_color_attachment() -> void * = 0;
2022-03-08 21:19:19 +03:30
protected:
Framebuffer() = default;
};
2025-07-11 00:05:48 +03:30
} // namespace lt