Initial engine repository
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
#pragma once
|
||||
|
||||
#include <frostbite2D/base/RefObject.h>
|
||||
#include <frostbite2D/graphics/texture.h>
|
||||
|
||||
namespace frostbite2D {
|
||||
|
||||
class Renderer;
|
||||
|
||||
/// @brief 2D 离屏渲染目标,封装颜色纹理和对应的 framebuffer。
|
||||
class RenderTexture : public RefObject {
|
||||
public:
|
||||
RenderTexture() = default;
|
||||
~RenderTexture() override;
|
||||
|
||||
bool Init(int width, int height);
|
||||
bool Resize(int width, int height);
|
||||
void Reset();
|
||||
|
||||
bool IsValid() const { return framebufferID_ != 0 && texture_ != nullptr; }
|
||||
int GetWidth() const { return width_; }
|
||||
int GetHeight() const { return height_; }
|
||||
Ptr<Texture> GetTexture() const { return texture_; }
|
||||
|
||||
private:
|
||||
Ptr<Texture> texture_ = nullptr;
|
||||
uint32 framebufferID_ = 0;
|
||||
int width_ = 0;
|
||||
int height_ = 0;
|
||||
|
||||
friend class Renderer;
|
||||
};
|
||||
|
||||
} // namespace frostbite2D
|
||||
Reference in New Issue
Block a user