5ec8cfc735
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.).
28 lines
462 B
C++
28 lines
462 B
C++
#pragma once
|
|
|
|
#include <chrono>
|
|
|
|
#include "glm/glm.hpp"
|
|
|
|
#include "cbt/scene.hpp"
|
|
#include "cbt/gfx.hpp"
|
|
|
|
namespace cbt::scenes {
|
|
|
|
class cube final : public scene {
|
|
public:
|
|
cube();
|
|
auto init() -> bool override;
|
|
auto update(float delta_time) -> void override;
|
|
auto render(int width, int height) -> void override;
|
|
|
|
private:
|
|
gfx::pipeline m_pipeline;
|
|
|
|
std::chrono::steady_clock::time_point m_start;
|
|
|
|
auto build_pipeline() -> bool;
|
|
};
|
|
|
|
}
|