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