Toast Engine
Toggle main menu visibility
Loading...
Searching...
No Matches
engine.hpp
1
4
5
#pragma once
6
#include <cstdint>
7
#include <glm/vec3.hpp>
8
#include <
toast/uid.hpp
>
9
10
namespace
assets {
11
class
Prefab
;
12
}
13
14
namespace
renderer {
15
class
VulkanCore
;
16
class
VulkanRenderer
;
17
class
SharedTextureOutputTarget
;
18
struct
ViewportFrameDesc
;
19
}
20
21
namespace
toast {
22
23
struct
EnginePimpl
;
24
25
class
Engine final {
26
public
:
27
Engine()
noexcept
;
28
~Engine()
noexcept
;
29
static
auto
get()
noexcept
-> Engine*;
30
31
Engine(Engine&) =
delete
;
32
Engine(Engine&&) =
delete
;
33
auto
operator=(
const
Engine&) -> Engine& =
delete
;
34
auto
operator=(
const
Engine&&) -> Engine& =
delete
;
35
36
void
init();
37
void
tick();
38
auto
shouldClose() -> bool;
39
void
test();
40
41
void
reloadSettings();
42
43
// window
44
void
createSDLWindow(
const
char
*);
45
void
createAvaloniaWindow();
46
47
auto
shootVoxel(
48
const
glm::vec3& origin,
const
glm::vec3& direction,
float
max_distance,
float
energy_density,
float
fracture_radius
49
) -> bool;
50
51
// nodes
52
auto
createWorkspace(std::string_view type) -> std::pair<UID, std::string>;
53
auto
openWorkspace(
UID
uid) -> std::pair<UID, std::string>;
55
auto
openWorkspace(
UID
uid, std::string_view source_uri) -> std::pair<UID, std::string>;
57
auto
playWorkspace
(
UID
source_handle) -> std::pair<UID, std::string>;
58
void
destroyWorkspace(
UID
handle);
59
60
void
requireTickThread(std::string_view what)
const
;
62
[[nodiscard]]
63
auto
onTickThread
()
const
-> bool;
64
65
auto
activeWorkspace() ->
UID
;
66
void
publishPrefab(
UID
uid,
const
assets::Prefab
& prefab);
67
69
void
refreshNodeInfos
();
70
73
auto
getViewportFrame
(
void
* dst, uint32_t dst_capacity,
renderer::ViewportFrameDesc
* out) -> int;
74
76
[[nodiscard]]
77
auto
viewportTarget
() ->
renderer::SharedTextureOutputTarget
*;
78
80
void
beginApplication
();
81
83
void
popApplication
();
84
87
void
startGame
();
88
89
private
:
90
void
syncOwnerListeners();
91
92
EnginePimpl
* m;
93
static
Engine* instance;
94
};
95
96
/*
97
* The order to call and initialize the engine on the Editor and the Player should be:
98
* - Create an engine -> toast_create()
99
* - Create a game -> game_create()
100
* - Set the working directories -> toast_set_working_directory()
101
* - Call Init() -> toast_init()
102
* - Create window -> toast_create_[...]_window()
103
*/
104
105
}
assets::Prefab
Definition
prefab.hpp:54
renderer::SharedTextureOutputTarget
Definition
shared_texture_output_target.hpp:44
renderer::VulkanCore
Definition
vulkan_core.hpp:48
renderer::VulkanRenderer
Definition
vulkan_renderer.hpp:88
toast::Engine::popApplication
void popApplication()
Destroys the active application layer and nulls the pointer.
Definition
engine.cpp:948
toast::Engine::beginApplication
void beginApplication()
Calls begin() on the currently registered application layer (if any).
Definition
engine.cpp:956
toast::Engine::startGame
void startGame()
Creates the World, then loads and activates the init_scene from project settings.
Definition
engine.cpp:962
toast::Engine::refreshNodeInfos
void refreshNodeInfos()
Re-resolves NodeInfo after a project reload.
Definition
engine.cpp:906
toast::Engine::playWorkspace
auto playWorkspace(UID source_handle) -> std::pair< UID, std::string >
Clones the given workspace's into a new ticking PlayWorkspace.
Definition
engine.cpp:850
toast::Engine::onTickThread
auto onTickThread() const -> bool
Before the first tick the thread that created the engine counts.
Definition
engine.cpp:418
toast::Engine::viewportTarget
auto viewportTarget() -> renderer::SharedTextureOutputTarget *
Editor viewport.
Definition
engine.cpp:920
toast::Engine::getViewportFrame
auto getViewportFrame(void *dst, uint32_t dst_capacity, renderer::ViewportFrameDesc *out) -> int
Copies the latest viewport frame into dst.
Definition
engine.cpp:913
renderer::ViewportFrameDesc
Definition
shared_texture_output_target.hpp:21
toast::EnginePimpl
Definition
engine.cpp:115
toast::UID
Definition
uid.hpp:20
uid.hpp
Unique identifier for everything that exists in our engine.
engine
src
toast
engine.hpp
Generated by
1.17.0