app.h 1.09 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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64

#pragma once

#include <map>
#include <string>
#include <SDL2/SDL.h>

#include "util/camera.h"
#include "lib/mathlib.h"
#include "gui/manager.h"

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

class Platform;

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

	App(Settings set, Platform* plt = nullptr);
	~App();

	void render();
	void event(SDL_Event e);

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