35 lines
916 B
C++
35 lines
916 B
C++
#pragma once
|
|
#include "types.h"
|
|
#include "pipelines.h"
|
|
#include <SDL3/SDL_gpu.h>
|
|
#include <SDL3/SDL_video.h>
|
|
|
|
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<Vertex> 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);
|
|
};
|