2022-03-08 21:19:19 +03:30
|
|
|
#pragma once
|
|
|
|
|
2025-07-17 10:44:00 +03:30
|
|
|
#include <math/vec2.hpp>
|
|
|
|
#include <math/vec4.hpp>
|
2022-03-08 21:19:19 +03:30
|
|
|
|
2025-07-11 00:05:48 +03:30
|
|
|
namespace lt {
|
2022-03-08 21:19:19 +03:30
|
|
|
|
|
|
|
class SharedContext;
|
|
|
|
|
|
|
|
struct FramebufferSpecification
|
|
|
|
{
|
2025-07-11 14:05:59 +03:30
|
|
|
unsigned int width {};
|
2025-07-06 14:02:50 +03:30
|
|
|
|
2025-07-11 14:05:59 +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-11 14:05:59 +03:30
|
|
|
virtual ~Framebuffer() = default;
|
2025-07-06 14:02:50 +03:30
|
|
|
static auto create(
|
|
|
|
const FramebufferSpecification &specification,
|
2025-07-11 14:05:59 +03:30
|
|
|
const Ref<SharedContext> &sharedContext
|
2025-07-06 14:02:50 +03:30
|
|
|
) -> Ref<Framebuffer>;
|
|
|
|
|
2025-07-17 10:44:00 +03:30
|
|
|
virtual void bind_as_target(const math::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-17 10:44:00 +03:30
|
|
|
virtual void resize(const math::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
|