voxelcore/src/graphics/core/Framebuffer.hpp
2026-05-12 18:41:14 +03:00

45 lines
1 KiB
C++

#pragma once
#include "typedefs.hpp"
#include "commons.hpp"
#include <memory>
class Texture;
class Framebuffer : public Bindable {
uint fbo;
uint depth;
uint width;
uint height;
std::shared_ptr<Texture> texture;
public:
Framebuffer(uint fbo, uint depth, std::unique_ptr<Texture> texture);
Framebuffer(uint width, uint height, bool alpha=false);
~Framebuffer();
void setTexture(std::unique_ptr<Texture> texture);
/// @brief Use framebuffer
void bind() const override;
/// @brief Stop using framebuffer
void unbind() const override;
/// @brief Update framebuffer texture size
/// @param width new width
/// @param height new height
void resize(uint width, uint height);
/// @brief Get framebuffer color attachment
Texture* getTexture() const;
std::shared_ptr<Texture> getSharedTexture() const;
/// @brief Get framebuffer width
uint getWidth() const;
/// @brief Get framebuffer height
uint getHeight() const;
uint getFBO() const;
};