render.h 1.11 KB
Newer Older
TheNumbat's avatar
TheNumbat committed
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

#pragma once

#include <mutex>
#include <SDL2/SDL.h>

#include "../util/camera.h"
#include "../scene/scene.h"
#include "../platform/gl.h"
#include "../rays/pathtracer.h"

#include "widgets.h"

namespace Gui {

enum class Mode;
class Manager;

class Render {
public:
    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;

    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);
    
    void update_dim(Vec2 dim);
    void load_cam(Vec3 pos, Vec3 front, float ar, float fov);
    const Camera& get_cam() const;

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;
};

}