Voltray Engine Docs
Loading...
Searching...
No Matches
ViewportFramebuffer.h
Go to the documentation of this file.
1#pragma once
2
3#include <glad/gl.h>
4
5namespace Editor::Components
6{
11 {
12 public:
15
16 // Disable copying
19
23 void Initialize();
24
30 void Resize(int width, int height);
31
35 void Bind();
36
40 void Unbind();
41
49 void Clear(float r = 0.1f, float g = 0.1f, float b = 0.1f, float a = 1.0f);
50
55 GLuint GetColorTexture() const { return m_ColorTex; }
56
61 int GetWidth() const { return m_Width; }
62
67 int GetHeight() const { return m_Height; }
71 bool IsValid() const;
72
77 bool IsCreated() const;
78
79 private:
80 void createFramebuffer();
81 void cleanup();
82
83 GLuint m_FBO = 0;
84 GLuint m_ColorTex = 0;
85 GLuint m_DepthRbo = 0;
86 int m_Width = 0;
87 int m_Height = 0;
88 };
89}
Manages OpenGL framebuffer operations for viewport rendering.
Definition ViewportFramebuffer.h:11
bool IsCreated() const
Check if framebuffer objects are created.
Definition ViewportFramebuffer.cpp:88
ViewportFramebuffer()
Definition ViewportFramebuffer.cpp:9
int GetWidth() const
Get current framebuffer width.
Definition ViewportFramebuffer.h:61
GLuint GetColorTexture() const
Get the color texture ID for ImGui rendering.
Definition ViewportFramebuffer.h:55
int GetHeight() const
Get current framebuffer height.
Definition ViewportFramebuffer.h:67
void Clear(float r=0.1f, float g=0.1f, float b=0.1f, float a=1.0f)
Clear the framebuffer.
Definition ViewportFramebuffer.cpp:68
bool IsValid() const
Check if framebuffer is valid.
Definition ViewportFramebuffer.cpp:74
~ViewportFramebuffer()
Definition ViewportFramebuffer.cpp:14
void Resize(int width, int height)
Resize the framebuffer to new dimensions.
Definition ViewportFramebuffer.cpp:24
void Initialize()
Initialize the framebuffer.
Definition ViewportFramebuffer.cpp:19
ViewportFramebuffer & operator=(const ViewportFramebuffer &)=delete
ViewportFramebuffer(const ViewportFramebuffer &)=delete
void Unbind()
Unbind the framebuffer.
Definition ViewportFramebuffer.cpp:63
void Bind()
Bind the framebuffer for rendering.
Definition ViewportFramebuffer.cpp:56
Represents the Inspector panel component in the Editor.
Definition Console.cpp:7