app.h 1.2 KB
Newer Older
TheNumbat's avatar
TheNumbat committed
1
2
3

#pragma once

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

#include "gui/manager.h"
TheNumbat's avatar
TheNumbat committed
9
10
#include "lib/mathlib.h"
#include "util/camera.h"
TheNumbat's avatar
TheNumbat committed
11
12
13
14
15
16
17
18

#include "scene/scene.h"
#include "scene/undo.h"

class Platform;

class App {
public:
TheNumbat's avatar
TheNumbat committed
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
    struct Settings {

        std::string scene_file;
        std::string env_map_file;
        bool headless = false;

        // If headless is true, use all of these
        std::string output_file = "out.png";
        int w = 640;
        int h = 360;
        int s = 128;
        int ls = 16;
        int d = 4;
        bool animate = false;
        float exp = 1.0f;
        bool w_from_ar = false;
    };
TheNumbat's avatar
TheNumbat committed
36

TheNumbat's avatar
TheNumbat committed
37
38
    App(Settings set, Platform *plt = nullptr);
    ~App();
TheNumbat's avatar
TheNumbat committed
39

TheNumbat's avatar
TheNumbat committed
40
41
    void render();
    void event(SDL_Event e);
TheNumbat's avatar
TheNumbat committed
42
43

private:
TheNumbat's avatar
TheNumbat committed
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
    void apply_window_dim(Vec2 new_dim);
    Vec3 screen_to_world(Vec2 mouse);

    // Camera data
    enum class Camera_Control { none, orbit, move };
    Vec2 window_dim, mouse_press;
    bool selection_changed = false;
    Camera_Control cam_mode = Camera_Control::none;
    Camera camera;
    Mat4 view, proj, iviewproj;

    // Systems
    Platform *plt = nullptr;
    Scene scene;
    Gui::Manager gui;
    Undo undo;

    bool gui_capture = false;
TheNumbat's avatar
TheNumbat committed
62
};