|
Estella 0.113.0
A fast 2D and 3D game engine powered by WebAssembly and ECS
|
Off-screen rendering target. More...
#include <Framebuffer.hpp>
Public Member Functions | |
| Framebuffer ()=default | |
| ~Framebuffer () | |
| Framebuffer (const Framebuffer &)=delete | |
| Framebuffer & | operator= (const Framebuffer &)=delete |
| Framebuffer (Framebuffer &&other) noexcept | |
| Framebuffer & | operator= (Framebuffer &&other) noexcept |
| void | bind () const |
| Binds the framebuffer for rendering. | |
| void | unbind () const |
| Unbinds the framebuffer. | |
| void | resize (u32 width, u32 height) |
| Resizes the framebuffer. | |
| TextureHandle | getColorAttachment () const |
| Gets the color attachment texture. | |
| TextureHandle | getGBufferAttachment () const |
| The second colour attachment, resolved like the first (Invalid when the target has none). | |
| TextureHandle | getAlbedoAttachment () const |
| The third colour attachment, the surface's diffuse colour (RGBA8, alpha 1 where a surface wrote it). | |
| TextureHandle | getDepthAttachment () const |
| Gets the depth attachment texture (Invalid if none). | |
| u32 | getWidth () const |
| Gets the framebuffer width in pixels. | |
| u32 | getHeight () const |
| Gets the framebuffer height in pixels. | |
| const FramebufferSpec & | getSpecification () const |
| Gets the framebuffer specification. | |
| FramebufferHandle | handle () const |
| Gets the device framebuffer handle. | |
Static Public Member Functions | |
| static Unique< Framebuffer > | create (GfxDevice &device, const FramebufferSpec &spec) |
| Creates a framebuffer from specification. | |
Off-screen rendering target.
Encapsulates an OpenGL/WebGL framebuffer object with color and optional depth attachments. Supports render-to-texture for scene views, post-processing, and shadow maps.
Definition at line 94 of file Framebuffer.hpp.
|
default |
Referenced by Framebuffer(), Framebuffer(), operator=(), and operator=().
| esengine::Framebuffer::~Framebuffer | ( | ) |
Definition at line 28 of file Framebuffer.cpp.
|
delete |
References Framebuffer().
|
noexcept |
Definition at line 32 of file Framebuffer.cpp.
References Framebuffer(), esengine::Default, and esengine::Invalid.
| void esengine::Framebuffer::bind | ( | ) | const |
Binds the framebuffer for rendering.
All subsequent draw calls will render to this framebuffer until unbind() is called.
Definition at line 103 of file Framebuffer.cpp.
|
static |
Creates a framebuffer from specification.
| spec | Framebuffer parameters |
Creates framebuffer with color attachment and optional depth/stencil attachment based on spec.
Definition at line 86 of file Framebuffer.cpp.
References ES_LOG_ERROR, and esengine::makeUnique().
Referenced by esengine::rg::TargetPool::acquire(), esengine::PostProcessPipeline::declareCover(), esengine::PostProcessPipeline::declareVelocity(), and esengine::RenderTarget::init().
|
inline |
The third colour attachment, the surface's diffuse colour (RGBA8, alpha 1 where a surface wrote it).
Definition at line 164 of file Framebuffer.hpp.
References esengine::Invalid.
|
inline |
Gets the color attachment texture.
What a shader samples. On a multisampled target this is the RESOLVED attachment, not the one drawn into — the caller never handles the multisampled side, which cannot be sampled at all.
Definition at line 154 of file Framebuffer.hpp.
References esengine::Invalid.
|
inline |
Gets the depth attachment texture (Invalid if none).
Definition at line 169 of file Framebuffer.hpp.
References esengine::Invalid.
|
inline |
The second colour attachment, resolved like the first (Invalid when the target has none).
Definition at line 159 of file Framebuffer.hpp.
References esengine::Invalid.
|
inline |
Gets the framebuffer height in pixels.
Definition at line 177 of file Framebuffer.hpp.
|
inline |
Gets the framebuffer specification.
Definition at line 180 of file Framebuffer.hpp.
|
inline |
Gets the framebuffer width in pixels.
Definition at line 174 of file Framebuffer.hpp.
|
inline |
Gets the device framebuffer handle.
Definition at line 183 of file Framebuffer.hpp.
|
delete |
References Framebuffer().
|
noexcept |
Definition at line 55 of file Framebuffer.cpp.
References Framebuffer(), esengine::Default, and esengine::Invalid.
Resizes the framebuffer.
| width | New width in pixels |
| height | New height in pixels |
Recreates all attachments with new dimensions. Existing content is lost.
Definition at line 111 of file Framebuffer.cpp.
References ES_LOG_ERROR, ES_LOG_WARN, and esengine::FramebufferSpec::width.
| void esengine::Framebuffer::unbind | ( | ) | const |
Unbinds the framebuffer.
Restores rendering to the default framebuffer (screen).
Definition at line 107 of file Framebuffer.cpp.