hachem.wtf
aboutsummaryrefslogtreecommitdiff
path: root/src/rendering/renderer_backend.h
blob: 51da214669b773e2b16194feadbc3e941d15186f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#pragma once

#include <glm/glm.hpp>
#include <functional>
#include <string>
#include <vector>

namespace Donut
{
    struct SceneObject
    {
        glm::vec3 position = { 0.0f, 2.0f, 0.0f };
        float     radius   = 2.0f;
        glm::vec3 color    = { 0.85f, 0.35f, 0.2f };
    };

    struct BlackHoleParams
    {
        float disk_inner_rs = 3.0f;
        float disk_outer_rs = 12.0f;
        float temperature   = 4800.0f;
        float brightness    = 0.9f;
        float turbulence    = 0.4f;
        int   quality_steps = 15000;
        float fov_degrees   = 60.0f;
    };

    class RendererBackend
    {
    public:
        virtual ~RendererBackend() = default;

        virtual auto init(void* glfwWindow, int width, int height) -> bool = 0;

        virtual auto init_ui() -> bool = 0;
        virtual auto shutdown() -> void = 0;
        virtual auto resize(int width, int height) -> void = 0;

        virtual auto draw_frame(const glm::vec4& clear_color,
                                const std::function<void()>& build_ui) -> void = 0;

        virtual auto set_scene_mode(bool enabled) -> void = 0;
        virtual auto is_scene_mode() const -> bool = 0;
        virtual auto set_free_fly(bool enabled) -> void = 0;
        virtual auto is_free_fly() const -> bool = 0;
        virtual auto reset_camera() -> void = 0;

        virtual auto set_hdri(const std::string& path) -> void = 0;
        virtual auto current_hdri() const -> const std::string& = 0;
        virtual auto scene_objects() -> std::vector<SceneObject>& = 0;
        virtual auto set_selected_object(int index) -> void = 0;
        virtual auto black_hole_params() -> BlackHoleParams& = 0;

        virtual auto device_name() const -> const std::string& = 0;
    };
}