mirror of
https://github.com/slendidev/lunar.git
synced 2025-12-08 10:29:52 +02:00
3
.gitmodules
vendored
3
.gitmodules
vendored
@@ -4,3 +4,6 @@
|
|||||||
[submodule "thirdparty/smath"]
|
[submodule "thirdparty/smath"]
|
||||||
path = thirdparty/smath
|
path = thirdparty/smath
|
||||||
url = https://github.com/slendidev/smath.git
|
url = https://github.com/slendidev/smath.git
|
||||||
|
[submodule "subprojects/fastgltf"]
|
||||||
|
path = subprojects/fastgltf
|
||||||
|
url = https://github.com/spnda/fastgltf.git
|
||||||
|
|||||||
14
meson.build
14
meson.build
@@ -4,9 +4,18 @@ project('vr-compositor', 'cpp',
|
|||||||
'cpp_std=c++26',
|
'cpp_std=c++26',
|
||||||
'warning_level=everything',
|
'warning_level=everything',
|
||||||
'werror=true',
|
'werror=true',
|
||||||
]
|
],
|
||||||
|
subproject_dir: 'subprojects',
|
||||||
)
|
)
|
||||||
|
|
||||||
|
cmake = import('cmake')
|
||||||
|
|
||||||
|
fastgltf_opts = cmake.subproject_options()
|
||||||
|
fastgltf_opts.set_override_option('cpp_std', 'c++23')
|
||||||
|
fastgltf_opts.set_override_option('warning_level', '0')
|
||||||
|
fastgltf_opts.set_override_option('werror', 'false')
|
||||||
|
fastgltf = cmake.subproject('fastgltf', options: fastgltf_opts)
|
||||||
|
|
||||||
cc = meson.get_compiler('cpp')
|
cc = meson.get_compiler('cpp')
|
||||||
|
|
||||||
wayland_dep = dependency('wayland-server')
|
wayland_dep = dependency('wayland-server')
|
||||||
@@ -22,6 +31,7 @@ imgui_src = files(
|
|||||||
'thirdparty/imgui/backends/imgui_impl_vulkan.cpp',
|
'thirdparty/imgui/backends/imgui_impl_vulkan.cpp',
|
||||||
'thirdparty/imgui/backends/imgui_impl_sdl3.cpp',
|
'thirdparty/imgui/backends/imgui_impl_sdl3.cpp',
|
||||||
)
|
)
|
||||||
|
fastgltf_dep = fastgltf.dependency('fastgltf')
|
||||||
|
|
||||||
vkbootstrap_dev = get_option('vkbootstrap_dev')
|
vkbootstrap_dev = get_option('vkbootstrap_dev')
|
||||||
vkbootstrap_lib = get_option('vkbootstrap_lib')
|
vkbootstrap_lib = get_option('vkbootstrap_lib')
|
||||||
@@ -49,6 +59,7 @@ add_project_arguments(
|
|||||||
'-Wno-old-style-cast',
|
'-Wno-old-style-cast',
|
||||||
'-Wno-implicit-int-float-conversion',
|
'-Wno-implicit-int-float-conversion',
|
||||||
'-Wno-implicit-float-conversion',
|
'-Wno-implicit-float-conversion',
|
||||||
|
'-Wno-c++98-compat',
|
||||||
],
|
],
|
||||||
language : 'cpp'
|
language : 'cpp'
|
||||||
)
|
)
|
||||||
@@ -104,6 +115,7 @@ exe = executable('vr-compositor',
|
|||||||
vkbootstrap_dep,
|
vkbootstrap_dep,
|
||||||
zlib_dep,
|
zlib_dep,
|
||||||
sdl3_dep,
|
sdl3_dep,
|
||||||
|
fastgltf_dep,
|
||||||
],
|
],
|
||||||
cpp_args: [
|
cpp_args: [
|
||||||
'--embed-dir=' + join_paths(meson.project_build_root(), 'shaders')
|
'--embed-dir=' + join_paths(meson.project_build_root(), 'shaders')
|
||||||
|
|||||||
@@ -33,6 +33,8 @@ Application::Application()
|
|||||||
|
|
||||||
m_renderer = std::make_unique<VulkanRenderer>(m_window, m_logger);
|
m_renderer = std::make_unique<VulkanRenderer>(m_window, m_logger);
|
||||||
|
|
||||||
|
mouse_captured(true);
|
||||||
|
|
||||||
m_logger.info("App init done!");
|
m_logger.info("App init done!");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -71,6 +73,11 @@ auto Application::run() -> void
|
|||||||
SDL_GetWindowSize(m_window, &width, &height);
|
SDL_GetWindowSize(m_window, &width, &height);
|
||||||
m_renderer->resize(static_cast<uint32_t>(width),
|
m_renderer->resize(static_cast<uint32_t>(width),
|
||||||
static_cast<uint32_t>(height));
|
static_cast<uint32_t>(height));
|
||||||
|
} else if (e.type == SDL_EVENT_KEY_DOWN && e.key.repeat == false) {
|
||||||
|
if (e.key.key == SDLK_F11 && e.key.mod & SDL_KMOD_LCTRL) {
|
||||||
|
mouse_captured(!mouse_captured());
|
||||||
|
m_show_imgui = mouse_captured();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGui_ImplSDL3_ProcessEvent(&e);
|
ImGui_ImplSDL3_ProcessEvent(&e);
|
||||||
@@ -81,6 +88,7 @@ auto Application::run() -> void
|
|||||||
|
|
||||||
ImGui::NewFrame();
|
ImGui::NewFrame();
|
||||||
|
|
||||||
|
if (m_show_imgui) {
|
||||||
ImGui::ShowDemoWindow();
|
ImGui::ShowDemoWindow();
|
||||||
|
|
||||||
ImGui::SetNextWindowSize({ 100, 50 });
|
ImGui::SetNextWindowSize({ 100, 50 });
|
||||||
@@ -93,6 +101,7 @@ auto Application::run() -> void
|
|||||||
ImGui::Text("%s", std::format("FPS: {:.2f}", fps).c_str());
|
ImGui::Text("%s", std::format("FPS: {:.2f}", fps).c_str());
|
||||||
}
|
}
|
||||||
ImGui::PopStyleColor();
|
ImGui::PopStyleColor();
|
||||||
|
}
|
||||||
|
|
||||||
ImGui::Render();
|
ImGui::Render();
|
||||||
|
|
||||||
@@ -100,4 +109,11 @@ auto Application::run() -> void
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
auto Application::mouse_captured(bool new_state) -> void
|
||||||
|
{
|
||||||
|
SDL_CaptureMouse(new_state);
|
||||||
|
|
||||||
|
m_mouse_captured = new_state;
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace Lunar
|
} // namespace Lunar
|
||||||
|
|||||||
@@ -17,6 +17,9 @@ struct Application {
|
|||||||
~Application();
|
~Application();
|
||||||
|
|
||||||
auto run() -> void;
|
auto run() -> void;
|
||||||
|
auto mouse_captured(bool new_state) -> void;
|
||||||
|
auto mouse_captured() const -> bool { return m_mouse_captured; }
|
||||||
|
auto toggle_mouse_captured() -> void { mouse_captured(!m_mouse_captured); }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
SDL_Window *m_window { nullptr };
|
SDL_Window *m_window { nullptr };
|
||||||
@@ -24,6 +27,8 @@ private:
|
|||||||
std::unique_ptr<VulkanRenderer> m_renderer;
|
std::unique_ptr<VulkanRenderer> m_renderer;
|
||||||
|
|
||||||
bool m_running { true };
|
bool m_running { true };
|
||||||
|
bool m_mouse_captured { false };
|
||||||
|
bool m_show_imgui { false };
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Lunar
|
} // namespace Lunar
|
||||||
|
|||||||
0
subprojects/.wraplock
Normal file
0
subprojects/.wraplock
Normal file
1
subprojects/fastgltf
Submodule
1
subprojects/fastgltf
Submodule
Submodule subprojects/fastgltf added at d3d6ee651f
0
thirdparty/.wraplock
vendored
Normal file
0
thirdparty/.wraplock
vendored
Normal file
Reference in New Issue
Block a user