Skip to content

Commit bdb4d45

Browse files
committed
misc: moved imgui and imguizmo to overlay ports
1 parent b536ea7 commit bdb4d45

35 files changed

Lines changed: 306 additions & 68019 deletions

CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -382,12 +382,12 @@ target_compile_definitions(Cyph3D PRIVATE BS_THREAD_POOL_NATIVE_EXTENSIONS)
382382

383383
# ---- Dependency: ocornut/imgui ----
384384

385-
add_subdirectory("vendor/imgui/v1.90-docking")
385+
find_package(imgui CONFIG REQUIRED)
386386
target_link_libraries(Cyph3D PRIVATE imgui)
387387

388388
# ---- Dependency: CedricGuillemet/ImGuizmo ----
389389

390-
add_subdirectory("vendor/imguizmo/fbc3614abcc642de7f3868cc0d68a35503ca9a4e")
390+
find_package(imguizmo CONFIG REQUIRED)
391391
target_link_libraries(Cyph3D PRIVATE imguizmo)
392392

393393
# ---- Dependency: palacaze/sigslot ----

vcpkg.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
"ispc",
1919
"half",
2020
"palsigslot",
21+
"imgui",
22+
"imguizmo",
2123
{
2224
"name": "glslang",
2325
"features": [
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
cmake_minimum_required(VERSION 3.28)
2+
3+
project(imgui)
4+
5+
add_library(imgui)
6+
7+
target_sources(imgui PRIVATE
8+
"imgui.cpp"
9+
"imgui_demo.cpp"
10+
"imgui_draw.cpp"
11+
"imgui_tables.cpp"
12+
"imgui_widgets.cpp"
13+
"imgui_impl_glfw.cpp"
14+
"imgui_stdlib.cpp"
15+
"imgui_freetype.cpp"
16+
)
17+
18+
target_sources(imgui PUBLIC FILE_SET HEADERS FILES
19+
"imconfig.h"
20+
"imgui.h"
21+
"imgui_internal.h"
22+
"imstb_rectpack.h"
23+
"imstb_textedit.h"
24+
"imstb_truetype.h"
25+
"imgui_impl_glfw.h"
26+
"imgui_stdlib.h"
27+
"imgui_freetype.h"
28+
)
29+
30+
find_package(glfw3 CONFIG REQUIRED)
31+
target_link_libraries(imgui PUBLIC glfw)
32+
target_compile_definitions(imgui PUBLIC GLFW_INCLUDE_NONE)
33+
34+
find_package(Freetype REQUIRED)
35+
target_link_libraries(imgui PRIVATE Freetype::Freetype)
36+
37+
find_package(glm CONFIG REQUIRED)
38+
target_link_libraries(imgui PUBLIC glm::glm)
39+
40+
install(
41+
TARGETS imgui
42+
EXPORT imguiTargets
43+
FILE_SET HEADERS
44+
)
45+
46+
install(
47+
EXPORT imguiTargets
48+
DESTINATION "lib/cmake/imgui"
49+
)
50+
51+
include(CMakePackageConfigHelpers)
52+
configure_package_config_file(
53+
"${CMAKE_CURRENT_SOURCE_DIR}/config.cmake.in"
54+
"${CMAKE_CURRENT_BINARY_DIR}/imguiConfig.cmake"
55+
INSTALL_DESTINATION "lib/cmake/imgui"
56+
)
57+
58+
install(
59+
FILES
60+
"${CMAKE_CURRENT_BINARY_DIR}/imguiConfig.cmake"
61+
DESTINATION "lib/cmake/imgui"
62+
)
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
@PACKAGE_INIT@
2+
3+
include(CMakeFindDependencyMacro)
4+
5+
find_dependency(glfw3)
6+
find_dependency(Freetype)
7+
find_dependency(glm)
8+
9+
include("${CMAKE_CURRENT_LIST_DIR}/imguiTargets.cmake")
10+
11+
check_required_components(imgui)
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
diff --git a/imconfig.h b/imconfig.h
2+
index e09dff0..9ebe738 100644
3+
--- a/imconfig.h
4+
+++ b/imconfig.h
5+
@@ -14,6 +14,8 @@
6+
7+
#pragma once
8+
9+
+#include <glm/glm.hpp>
10+
+
11+
//---- Define assertion handler. Defaults to calling assert().
12+
// If your macro uses multiple statements, make sure is enclosed in a 'do { .. } while (0)' block so it can be used as a single statement.
13+
//#define IM_ASSERT(_EXPR) MyAssert(_EXPR)
14+
@@ -27,8 +29,8 @@
15+
//#define IMGUI_API __declspec( dllimport )
16+
17+
//---- Don't define obsolete functions/enums/behaviors. Consider enabling from time to time after updating to clean your code of obsolete function/names.
18+
-//#define IMGUI_DISABLE_OBSOLETE_FUNCTIONS
19+
-//#define IMGUI_DISABLE_OBSOLETE_KEYIO // 1.87+ disable legacy io.KeyMap[]+io.KeysDown[] in favor io.AddKeyEvent(). This is automatically done by IMGUI_DISABLE_OBSOLETE_FUNCTIONS.
20+
+#define IMGUI_DISABLE_OBSOLETE_FUNCTIONS
21+
+#define IMGUI_DISABLE_OBSOLETE_KEYIO // 1.87+ disable legacy io.KeyMap[]+io.KeysDown[] in favor io.AddKeyEvent(). This is automatically done by IMGUI_DISABLE_OBSOLETE_FUNCTIONS.
22+
23+
//---- Disable all of Dear ImGui or don't implement standard windows/tools.
24+
// It is very strongly recommended to NOT disable the demo windows and debug tool during development. They are extremely useful in day to day work. Please read comments in imgui_demo.cpp.
25+
@@ -74,7 +76,7 @@
26+
//---- Use FreeType to build and rasterize the font atlas (instead of stb_truetype which is embedded by default in Dear ImGui)
27+
// Requires FreeType headers to be available in the include path. Requires program to be compiled with 'misc/freetype/imgui_freetype.cpp' (in this repository) + the FreeType library (not provided).
28+
// On Windows you may use vcpkg with 'vcpkg install freetype --triplet=x64-windows' + 'vcpkg integrate install'.
29+
-//#define IMGUI_ENABLE_FREETYPE
30+
+#define IMGUI_ENABLE_FREETYPE
31+
32+
//---- Use FreeType+lunasvg library to render OpenType SVG fonts (SVGinOT)
33+
// Requires lunasvg headers to be available in the include path + program to be linked with the lunasvg library (not provided).
34+
@@ -88,15 +90,15 @@
35+
36+
//---- Define constructor and implicit cast operators to convert back<>forth between your math types and ImVec2/ImVec4.
37+
// This will be inlined as part of ImVec2 and ImVec4 class declarations.
38+
-/*
39+
-#define IM_VEC2_CLASS_EXTRA \
40+
- constexpr ImVec2(const MyVec2& f) : x(f.x), y(f.y) {} \
41+
- operator MyVec2() const { return MyVec2(x,y); }
42+
43+
-#define IM_VEC4_CLASS_EXTRA \
44+
- constexpr ImVec4(const MyVec4& f) : x(f.x), y(f.y), z(f.z), w(f.w) {} \
45+
- operator MyVec4() const { return MyVec4(x,y,z,w); }
46+
-*/
47+
+#define IM_VEC2_CLASS_EXTRA \
48+
+ constexpr ImVec2(const glm::vec2& f) : x(f.x), y(f.y) {} \
49+
+ operator glm::vec2() const { return glm::vec2(x,y); }
50+
+
51+
+#define IM_VEC4_CLASS_EXTRA \
52+
+ constexpr ImVec4(const glm::vec4& f) : x(f.x), y(f.y), z(f.z), w(f.w) {} \
53+
+ operator glm::vec4() const { return glm::vec4(x,y,z,w); }
54+
+
55+
//---- ...Or use Dear ImGui's own very basic math operators.
56+
//#define IMGUI_DEFINE_MATH_OPERATORS
57+
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
diff --git a/imgui_draw.cpp b/imgui_draw.cpp
2+
index d7e70c5..aead2fd 100644
3+
--- a/imgui_draw.cpp
4+
+++ b/imgui_draw.cpp
5+
@@ -34,7 +34,7 @@ Index of this file:
6+
#ifndef IMGUI_DISABLE
7+
#include "imgui_internal.h"
8+
#ifdef IMGUI_ENABLE_FREETYPE
9+
-#include "misc/freetype/imgui_freetype.h"
10+
+#include "imgui_freetype.h"
11+
#endif
12+
13+
#include <stdio.h> // vsnprintf, sscanf, printf
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
vcpkg_from_github(
2+
OUT_SOURCE_PATH SOURCE_PATH
3+
REPO ocornut/imgui
4+
REF "v${VERSION}-docking"
5+
SHA512 50953097ff809bca0e1cee55268eaa8dad001cf8fae85ae7623f484752d16bdf8e63c04227786361f27e73f7aeda5a8d1f9b0cee83c2aca108ce2712a21b74d9
6+
HEAD_REF docking
7+
PATCHES include-path.patch imconfig.patch splitter-color.patch
8+
)
9+
10+
file(COPY "${CMAKE_CURRENT_LIST_DIR}/config.cmake.in" DESTINATION "${SOURCE_PATH}")
11+
file(COPY "${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt" DESTINATION "${SOURCE_PATH}")
12+
13+
file(RENAME "${SOURCE_PATH}/backends/imgui_impl_glfw.h" "${SOURCE_PATH}/imgui_impl_glfw.h")
14+
file(RENAME "${SOURCE_PATH}/backends/imgui_impl_glfw.cpp" "${SOURCE_PATH}/imgui_impl_glfw.cpp")
15+
file(RENAME "${SOURCE_PATH}/misc/cpp/imgui_stdlib.h" "${SOURCE_PATH}/imgui_stdlib.h")
16+
file(RENAME "${SOURCE_PATH}/misc/cpp/imgui_stdlib.cpp" "${SOURCE_PATH}/imgui_stdlib.cpp")
17+
file(RENAME "${SOURCE_PATH}/misc/freetype/imgui_freetype.h" "${SOURCE_PATH}/imgui_freetype.h")
18+
file(RENAME "${SOURCE_PATH}/misc/freetype/imgui_freetype.cpp" "${SOURCE_PATH}/imgui_freetype.cpp")
19+
20+
vcpkg_cmake_configure(
21+
SOURCE_PATH "${SOURCE_PATH}"
22+
)
23+
24+
vcpkg_cmake_install()
25+
vcpkg_copy_pdbs()
26+
vcpkg_cmake_config_fixup(CONFIG_PATH "lib/cmake/imgui")
27+
28+
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
29+
30+
vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE.txt")
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
diff --git a/imgui.cpp b/imgui.cpp
2+
index a1bde6e..6547f3a 100644
3+
--- a/imgui.cpp
4+
+++ b/imgui.cpp
5+
@@ -16772,11 +16772,12 @@ static void ImGui::DockNodeUpdate(ImGuiDockNode* node)
6+
if (node->IsRootNode() && host_window)
7+
{
8+
DockNodeTreeUpdatePosSize(node, host_window->Pos, host_window->Size);
9+
- PushStyleColor(ImGuiCol_Separator, g.Style.Colors[ImGuiCol_Border]);
10+
- PushStyleColor(ImGuiCol_SeparatorActive, g.Style.Colors[ImGuiCol_ResizeGripActive]);
11+
- PushStyleColor(ImGuiCol_SeparatorHovered, g.Style.Colors[ImGuiCol_ResizeGripHovered]);
12+
+ // custom change: disabled this
13+
+ // PushStyleColor(ImGuiCol_Separator, g.Style.Colors[ImGuiCol_Border]);
14+
+ // PushStyleColor(ImGuiCol_SeparatorActive, g.Style.Colors[ImGuiCol_ResizeGripActive]);
15+
+ // PushStyleColor(ImGuiCol_SeparatorHovered, g.Style.Colors[ImGuiCol_ResizeGripHovered]);
16+
DockNodeTreeUpdateSplitter(node);
17+
- PopStyleColor(3);
18+
+ // PopStyleColor(3);
19+
}
20+
21+
// Draw empty node background (currently can only be the Central Node)
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"name": "imgui",
3+
"version": "1.90",
4+
"description": "Dear ImGui: Bloat-free Graphical User interface for C++ with minimal dependencies",
5+
"homepage": "https://github.com/ocornut/imgui",
6+
"license": "MIT",
7+
"dependencies": [
8+
"glfw3",
9+
"freetype",
10+
"glm",
11+
{
12+
"name": "vcpkg-cmake",
13+
"host": true
14+
},
15+
{
16+
"name": "vcpkg-cmake-config",
17+
"host": true
18+
}
19+
]
20+
}
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
cmake_minimum_required(VERSION 3.28)
2+
3+
project(imguizmo)
4+
5+
add_library(imguizmo)
6+
7+
target_sources(imguizmo PRIVATE
8+
"ImGuizmo.cpp"
9+
)
10+
11+
target_sources(imguizmo PUBLIC FILE_SET HEADERS FILES
12+
"ImGuizmo.h"
13+
)
14+
15+
find_package(imgui CONFIG REQUIRED)
16+
target_link_libraries(imguizmo PUBLIC imgui)
17+
18+
install(
19+
TARGETS imguizmo
20+
EXPORT imguizmoTargets
21+
FILE_SET HEADERS
22+
)
23+
24+
install(
25+
EXPORT imguizmoTargets
26+
DESTINATION "lib/cmake/imguizmo"
27+
)
28+
29+
include(CMakePackageConfigHelpers)
30+
configure_package_config_file(
31+
"${CMAKE_CURRENT_SOURCE_DIR}/config.cmake.in"
32+
"${CMAKE_CURRENT_BINARY_DIR}/imguizmoConfig.cmake"
33+
INSTALL_DESTINATION "lib/cmake/imguizmo"
34+
)
35+
36+
install(
37+
FILES
38+
"${CMAKE_CURRENT_BINARY_DIR}/imguizmoConfig.cmake"
39+
DESTINATION "lib/cmake/imguizmo"
40+
)

0 commit comments

Comments
 (0)