#pragma once #include "types.h" #include "pipelines.h" #include #include struct Renderer { SDL_GPUDevice* dev = nullptr; SDL_Window* win = nullptr; ScenePipeline scene; BlitPipeline blit; PostPipeline post; SDL_GPUBuffer* vert_buff = nullptr; SDL_GPUTexture* render_tex = nullptr; SDL_GPUTexture* post_tex = nullptr; SDL_GPUSampler* render_sampler = nullptr; uint32_t render_w = 0, render_h = 0; std::vector vertices; bool init(SDL_Window* win); void destroy(); void draw(const CameraUBO& ubo); private: bool load_obj(); void resize_render_texture(uint32_t w, uint32_t h); void pass_scene(SDL_GPUCommandBuffer* cmd, const CameraUBO& ubo); void pass_blit(SDL_GPUCommandBuffer* cmd, const CameraUBO& ubo); void pass_post(SDL_GPUCommandBuffer* cmd, SDL_GPUTexture* swapchain, const CameraUBO& ubo); };