-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmain.cpp
More file actions
74 lines (67 loc) · 2.23 KB
/
Copy pathmain.cpp
File metadata and controls
74 lines (67 loc) · 2.23 KB
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
65
66
67
68
69
70
71
72
73
74
#include <filesystem>
#include <print>
#include <source_location>
#include <VkBootstrap.h>
import ddge.prelude;
import ddge.deprecated;
import ddge.modules;
import ddge.utility.Size;
import examples.base.DemoBase;
import demos.gltf.DemoApp;
import demos.gltf;
[[nodiscard]]
static auto require_vulkan_version(const uint32_t major, const uint32_t minor)
-> ddge::renderer::Requirement
{
return { .enable_instance_settings = [=](const vkb::SystemInfo&,
vkb::InstanceBuilder& instance_builder) {
instance_builder.require_api_version(major, minor);
} };
}
auto main() -> int
try {
const std::filesystem::path model_filepath{
std::filesystem::path{ std::source_location::current().file_name() }
.parent_path()
.parent_path()
.parent_path()
/ "assets"
/ "models"
// / "BoxVertexColors/glTF-Binary/BoxVertexColors.glb",
// / "Avocado/glTF/Avocado.gltf",
// / "PrimitiveModeNormalsTest/glTF/PrimitiveModeNormalsTest.gltf",
// / "FlightHelmet/FlightHelmetUastc.gltf",
/ "DamagedHelmet.glb",
// / "Sponza/glTF/Sponza.gltf"
// / "StainedGlassLamp/glTF-KTX-BasisU/StainedGlassLamp.gltf",
};
constexpr static float movement_speed{ 10 };
ddge::app::create()
.plug_in(ddge::app::FunctionalPlugin{})
.plug_in(ddge::resources::Plugin{})
.plug_in(ddge::app::RunnablePlugin{})
.insert_resource(ddge::cache::Cache{})
.insert_resource(
ddge::window::Window(ddge::util::Size2i{ 1'280, 720 }, "My window")
)
.transform(ddge::renderer::setup.require(::require_vulkan_version(1, 1)))
.inject_resource(
examples::base::DemoBasePlugin{ .movement_speed = movement_speed }
)
.inject_resource(
demo::DemoPlugin{
.model_filepath = model_filepath,
.use_virtual_images = false,
}
)
.run(demo::run);
} catch (const std::exception& error) {
try {
std::println("{}", error.what());
return -1;
} catch (...) {
return -3;
}
} catch (...) {
return -2;
}