feat: add gfx pipeline abstraction with render targets
Add cbt/gfx layer (pipeline + render_target) inspired by Sokol but C++-friendly with RAII and pipeline_desc. Supports building full graphics pipelines (VS/IA/raster/PS/OM), render-to-texture (FBO), and post-processing steps (scene -> RT -> fullscreen quad with sampler + vignette). - Depth/state/viewport/texture cleanup for reliable scene switching. - Updated cube/sphere to demonstrate (sphere uses RT+post). - Vulkan backend easy via PIMPL in impl (same public API). - Fixed depth test, viewport restore, and state leakage on switch. Followed coding conventions (snake_case, trailing returns, east const, include order, no ; after ns/class, etc.).
This commit is contained in:
+6
-15
@@ -5,9 +5,7 @@
|
||||
#include "glm/glm.hpp"
|
||||
|
||||
#include "cbt/scene.hpp"
|
||||
#include "cbt/opengl/buffer.hpp"
|
||||
#include "cbt/opengl/shader.hpp"
|
||||
#include "cbt/opengl/vao.hpp"
|
||||
#include "cbt/gfx.hpp"
|
||||
|
||||
namespace cbt::scenes {
|
||||
|
||||
@@ -19,21 +17,14 @@ public:
|
||||
auto render(int width, int height) -> void override;
|
||||
|
||||
private:
|
||||
opengl::shader m_prog;
|
||||
opengl::buffer m_vbo;
|
||||
opengl::buffer m_ebo{opengl::buffer_type::index};
|
||||
opengl::vao m_vao;
|
||||
|
||||
GLint m_loc_proj = -1;
|
||||
GLint m_loc_view = -1;
|
||||
GLint m_loc_model = -1;
|
||||
|
||||
GLsizei m_index_count = 0;
|
||||
gfx::pipeline m_scene_pipeline;
|
||||
gfx::pipeline m_post_pipeline;
|
||||
gfx::render_target m_rt{0, 0};
|
||||
|
||||
std::chrono::steady_clock::time_point m_start;
|
||||
|
||||
auto build_mesh() -> void;
|
||||
auto build_shader() -> bool;
|
||||
auto build_pipeline() -> bool;
|
||||
auto build_post_pipeline() -> bool;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user