mirror of
https://github.com/open-goal/jak-project
synced 2026-08-09 02:49:19 -04:00
ffb04ddd10
* ci: switch to codacy for coverage * docs: update badges * decomp: allow overriding config flags via CLI * cleanup: top level file cleanup * docs: big README overhaul Attempt to close #1128 and #1086 * decomp: attempt to detect if `iso_data` is missing or wrongly extracted * game: switch to `fpng` for screenshots, allow for compression closes #1035 * game: switch vsync control to a checkbox * lint: format cpp files * lint: format json files * docs/scripts: organize taskfile
55 lines
1.6 KiB
C++
55 lines
1.6 KiB
C++
#pragma once
|
|
|
|
#include <array>
|
|
#include <memory>
|
|
|
|
#include "common/dma/dma_chain_read.h"
|
|
#include "game/graphics/opengl_renderer/Shader.h"
|
|
#include "game/graphics/opengl_renderer/BucketRenderer.h"
|
|
#include "game/graphics/opengl_renderer/Profiler.h"
|
|
|
|
struct RenderOptions {
|
|
int window_height_px = 0;
|
|
int window_width_px = 0;
|
|
int lbox_height_px = 0;
|
|
int lbox_width_px = 0;
|
|
bool draw_render_debug_window = false;
|
|
bool draw_profiler_window = false;
|
|
bool playing_from_dump = false;
|
|
|
|
bool save_screenshot = false;
|
|
bool screenshot_should_compress = false;
|
|
std::string screenshot_path;
|
|
};
|
|
|
|
class OpenGLRenderer {
|
|
public:
|
|
OpenGLRenderer(std::shared_ptr<TexturePool> texture_pool);
|
|
void render(DmaFollower dma, const RenderOptions& settings);
|
|
void serialize(Serializer& ser);
|
|
|
|
private:
|
|
void setup_frame(int window_width_px, int window_height_px, int offset_x, int offset_y);
|
|
void draw_test_triangle();
|
|
void dispatch_buckets(DmaFollower dma, ScopedProfilerNode& prof);
|
|
void init_bucket_renderers();
|
|
void draw_renderer_selection_window();
|
|
|
|
void finish_screenshot(const std::string& output_name,
|
|
int px,
|
|
int py,
|
|
int x,
|
|
int y,
|
|
bool compress);
|
|
|
|
template <typename T, class... Args>
|
|
void init_bucket_renderer(const std::string& name, BucketId id, Args&&... args) {
|
|
m_bucket_renderers.at((int)id) = std::make_unique<T>(name, id, std::forward<Args>(args)...);
|
|
}
|
|
|
|
SharedRenderState m_render_state;
|
|
Profiler m_profiler;
|
|
|
|
std::array<std::unique_ptr<BucketRenderer>, (int)BucketId::MAX_BUCKETS> m_bucket_renderers;
|
|
};
|