render.h 1.17 KB
Newer Older
TheNumbat's avatar
TheNumbat committed
1
2
3
4

#pragma once

#include <SDL2/SDL.h>
TheNumbat's avatar
TheNumbat committed
5
#include <mutex>
TheNumbat's avatar
TheNumbat committed
6
7
8

#include "../platform/gl.h"
#include "../rays/pathtracer.h"
TheNumbat's avatar
TheNumbat committed
9
10
#include "../scene/scene.h"
#include "../util/camera.h"
TheNumbat's avatar
TheNumbat committed
11
12
13
14
15
16
17
18
19
20

#include "widgets.h"

namespace Gui {

enum class Mode;
class Manager;

class Render {
public:
TheNumbat's avatar
TheNumbat committed
21
22
23
24
25
    Render(Scene &scene, Vec2 dim);

    std::string headless_render(Animate &animate, Scene &scene, std::string output, bool a, int w,
                                int h, int s, int ls, int d, float exp, bool w_from_ar);
    std::pair<float, float> completion_time() const;
TheNumbat's avatar
TheNumbat committed
26

TheNumbat's avatar
TheNumbat committed
27
28
29
30
    bool keydown(Widgets &widgets, SDL_Keysym key);
    Mode UIsidebar(Manager &manager, Undo &undo, Scene &scene, Scene_Maybe selected,
                   Camera &user_cam);
    void render(Scene_Maybe obj, Widgets &widgets, Camera &user_cam);
TheNumbat's avatar
TheNumbat committed
31
32
33

    void update_dim(Vec2 dim);
    void load_cam(Vec3 pos, Vec3 front, float ar, float fov);
TheNumbat's avatar
TheNumbat committed
34
    const Camera &get_cam() const;
TheNumbat's avatar
TheNumbat committed
35
36
37
38
39
40
41
42
43
44
45
46
47
48

private:
    GL::Lines bvh_viz, bvh_active;
    Widget_Camera ui_camera;
    Widget_Render ui_render;
    Pose old_pose;

    // GUI Data
    bool render_ray_log = false;
    bool visualize_bvh = false;
    int bvh_level = 0;
    size_t bvh_levels = 0;
};

TheNumbat's avatar
TheNumbat committed
49
} // namespace Gui