Commit d6cea42b authored by Sreekanth Arikatla's avatar Sreekanth Arikatla
Browse files

REFAC: Remove vulkan references, glm and imgui

parent 229fa509
......@@ -95,14 +95,12 @@ ExternalProject_Add( ${PROJECT_NAME}
-D${PROJECT_NAME}_BUILD_EXAMPLES:BOOL=${${PROJECT_NAME}_BUILD_EXAMPLES}
-D${PROJECT_NAME}_BUILD_TESTING:BOOL=${${PROJECT_NAME}_BUILD_TESTING}
-D${PROJECT_NAME}_USE_OpenHaptics:BOOL=${${PROJECT_NAME}_USE_OpenHaptics}
-D${PROJECT_NAME}_USE_MODEL_REDUCTION:BOOL=${${PROJECT_NAME}_USE_MODEL_REDUCTION}
-D${PROJECT_NAME}_USE_Vulkan:BOOL=${${PROJECT_NAME}_USE_Vulkan}
-D${PROJECT_NAME}_USE_MODEL_REDUCTION:BOOL=${${PROJECT_NAME}_USE_MODEL_REDUCTION}
-D${PROJECT_NAME}_ENABLE_AUDIO:BOOL=${${PROJECT_NAME}_ENABLE_AUDIO}
-D${PROJECT_NAME}_USE_VRPN:BOOL=${${PROJECT_NAME}_USE_VRPN}
-D${PROJECT_NAME}_COLOR_OUTPUT:BOOL=${${PROJECT_NAME}_COLOR_OUTPUT}
# External Libraries
-DEigen3_DIR:PATH=${Eigen3_DIR}
-Dglm_DIR:PATH=${glm_DIR}
-DEigen3_DIR:PATH=${Eigen3_DIR}
-DGTest_DIR:PATH=${GTest_DIR}
-DVegaFEM_DIR:PATH=${VegaFEM_DIR}
-DVTK_DIR:PATH=${VTK_DIR}
......
#-----------------------------------------------------------------------------
# Add External Project
#-----------------------------------------------------------------------------
include(imstkAddExternalProject)
imstk_add_external_project( glm
URL https://gitlab.kitware.com/iMSTK/glm/-/archive/0.9.8.3/glm-0.9.8.3.zip
URL_MD5 a95fae241b7ff3ba7d6e614cfd87df02
RELATIVE_INCLUDE_PATH ""
DEPENDENCIES ""
#VERBOSE
)
#-----------------------------------------------------------------------------
# Add External Project
#-----------------------------------------------------------------------------
include(imstkAddExternalProject)
imstk_define_external_dirs( imgui )
# Gather up headers for install
set(imgui_H_FILES ${imgui_SOURCE_DIR}/imconfig.h
${imgui_SOURCE_DIR}/imgui.h
${imgui_SOURCE_DIR}/imstb_rectpack.h
${imgui_SOURCE_DIR}/imstb_textedit.h
${imgui_SOURCE_DIR}/imstb_truetype.h
)
set(make_imgui_dir_command
${CMAKE_COMMAND} -E make_directory
${CMAKE_INSTALL_PREFIX}/include/imgui/
)
set(copy_imgui_headers_command
${CMAKE_COMMAND} -E copy
${imgui_H_FILES}
${CMAKE_INSTALL_PREFIX}/include/imgui/
)
imstk_add_external_project( imgui
URL https://gitlab.kitware.com/iMSTK/imgui/-/archive/v1.65/imgui-v1.65.zip
URL_MD5 e255a471fa1cc4f2be931659c253956a
CONFIGURE_COMMAND ${SKIP_STEP_COMMAND}
BUILD_COMMAND ${SKIP_STEP_COMMAND}
INSTALL_COMMAND
COMMAND ${make_imgui_dir_command}
COMMAND ${copy_imgui_headers_command}
RELATIVE_INCLUDE_PATH ""
DEPENDENCIES ""
#VERBOSE
)
include(imstkFind)
#-----------------------------------------------------------------------------
# Find All Headers for imgui
#-----------------------------------------------------------------------------
imstk_find_header(imgui imgui.h imgui)
imstk_find_header_package(imgui)
#message(STATUS "imgui includes : ${IMGUI_INCLUDE_DIRS}")
if(FIND_IMGUI_SOURCE)
#-----------------------------------------------------------------------------
# Find Source
# Since imgui has no CMake, code is pulled into an iMSTK component directly
#-----------------------------------------------------------------------------
find_path(IMGUI_SOURCE_DIR
NAMES
imgui.cpp
PATHS
${CMAKE_BINARY_DIR}/../External/imgui/src
NO_DEFAULT_PATH
)
mark_as_advanced(IMGUI_SOURCE_DIR)
#message(STATUS "imgui source : ${IMGUI_SOURCE_DIR}")
#-----------------------------------------------------------------------------
# Find package
#-----------------------------------------------------------------------------
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(imgui
REQUIRED_VARS
IMGUI_SOURCE_DIR)
endif()
......@@ -10,7 +10,6 @@ include(CMakeFindDependencyMacro)
# iMSTK settings
set(iMSTK_ROOT ${PACKAGE_PREFIX_DIR})
set(iMSTK_DATA_DIR ${PACKAGE_PREFIX_DIR}/data)
set(iMSTK_USE_Vulkan @iMSTK_USE_Vulkan@)
set(iMSTK_USE_OpenHaptics @iMSTK_USE_OpenHaptics@)
set(iMSTK_BUILD_TESTING @iMSTK_BUILD_TESTING@)
......@@ -35,19 +34,12 @@ endif()
# g3log
find_package( g3log REQUIRED )
# glm
set(glm_DIR "@glm_DIR@")
find_dependency( glm REQUIRED )
# GTest
if(iMSTK_BUILD_TESTING)
set(GTest_DIR "@GTest_DIR@")
find_dependency( GTest REQUIRED NO_DEFAULT_PATH )
endif()
# imgui
find_package( imgui REQUIRED )
# LibNiFalcon
find_package( LibNiFalcon REQUIRED)
......
......@@ -139,8 +139,6 @@ if(${PROJECT_NAME}_SUPERBUILD)
imstk_define_dependency(Assimp)
imstk_define_dependency(Eigen3)
imstk_define_dependency(g3log)
imstk_define_dependency(glm)
imstk_define_dependency(imgui)
imstk_define_dependency(LibNiFalcon)
imstk_define_dependency(openvr)
imstk_define_dependency(PhysX)
......@@ -216,14 +214,6 @@ if(WIN32)
endif()
# g3log
find_package( g3log REQUIRED )
# glm
find_package( glm REQUIRED)
# imgui
# iMSTK actually includes and compiles imgui code
# As imgui does not have any cmake support
# So tell our find_package to also find the imgui source directory
set(FIND_IMGUI_SOURCE ON)
find_package( imgui REQUIRED )
# LibNiFalcon
find_package( LibNiFalcon REQUIRED)
# Libusb
......@@ -349,7 +339,6 @@ add_subdirectory(Source/DataStructures)
add_subdirectory(Source/Constraint)
add_subdirectory(Source/Devices)
add_subdirectory(Source/Rendering/Materials)
add_subdirectory(Source/Rendering/GUIOverlay)
add_subdirectory(Source/Rendering)
add_subdirectory(Source/Solvers)
add_subdirectory(Source/DynamicalModels)
......
......@@ -147,8 +147,6 @@ public:
virtual void update();
protected:
friend class VulkanParticleRenderDelegate;
///
/// \brief Initialize particles
///
......
......@@ -54,7 +54,6 @@ public:
void updateDecal(Mat4d& viewMatrix);
protected:
friend class VulkanDecalRenderDelegate;
// Hide these functions
using AnalyticalGeometry::getFunctionValue;
......
......@@ -38,27 +38,27 @@ DecalPool::DecalPool(unsigned int maxNumDecals /*= 128*/, const std::string& nam
LOG(WARNING) << "The maximum number of decals is 128";
}
m_vertexPositions[0] = glm::vec3(0.5, 0.5, 0.5);
m_vertexPositions[1] = glm::vec3(0.5, 0.5, -0.5);
m_vertexPositions[2] = glm::vec3(0.5, -0.5, 0.5);
m_vertexPositions[3] = glm::vec3(0.5, -0.5, -0.5);
m_vertexPositions[4] = glm::vec3(-0.5, 0.5, 0.5);
m_vertexPositions[5] = glm::vec3(-0.5, 0.5, -0.5);
m_vertexPositions[6] = glm::vec3(-0.5, -0.5, 0.5);
m_vertexPositions[7] = glm::vec3(-0.5, -0.5, -0.5);
m_triangles[0] = glm::ivec3(2, 1, 0);
m_triangles[1] = glm::ivec3(1, 2, 3);
m_triangles[2] = glm::ivec3(4, 5, 6);
m_triangles[3] = glm::ivec3(7, 6, 5);
m_triangles[4] = glm::ivec3(0, 1, 4);
m_triangles[5] = glm::ivec3(5, 4, 1);
m_triangles[6] = glm::ivec3(6, 3, 2);
m_triangles[7] = glm::ivec3(3, 6, 7);
m_triangles[8] = glm::ivec3(4, 2, 0);
m_triangles[9] = glm::ivec3(2, 4, 6);
m_triangles[10] = glm::ivec3(1, 3, 5);
m_triangles[11] = glm::ivec3(7, 5, 3);
m_vertexPositions[0] = Vec3d(0.5, 0.5, 0.5);
m_vertexPositions[1] = Vec3d(0.5, 0.5, -0.5);
m_vertexPositions[2] = Vec3d(0.5, -0.5, 0.5);
m_vertexPositions[3] = Vec3d(0.5, -0.5, -0.5);
m_vertexPositions[4] = Vec3d(-0.5, 0.5, 0.5);
m_vertexPositions[5] = Vec3d(-0.5, 0.5, -0.5);
m_vertexPositions[6] = Vec3d(-0.5, -0.5, 0.5);
m_vertexPositions[7] = Vec3d(-0.5, -0.5, -0.5);
m_triangles[0] = Vec3i(2, 1, 0);
m_triangles[1] = Vec3i(1, 2, 3);
m_triangles[2] = Vec3i(4, 5, 6);
m_triangles[3] = Vec3i(7, 6, 5);
m_triangles[4] = Vec3i(0, 1, 4);
m_triangles[5] = Vec3i(5, 4, 1);
m_triangles[6] = Vec3i(6, 3, 2);
m_triangles[7] = Vec3i(3, 6, 7);
m_triangles[8] = Vec3i(4, 2, 0);
m_triangles[9] = Vec3i(2, 4, 6);
m_triangles[10] = Vec3i(1, 3, 5);
m_triangles[11] = Vec3i(7, 5, 3);
for (unsigned int i = 0; i < maxNumDecals; i++)
{
......
......@@ -22,6 +22,7 @@
#pragma once
#include "imstkGeometry.h"
#include "imstkMath.h"
#include <array>
#include <queue>
......@@ -30,7 +31,7 @@
#pragma warning( push )
#pragma warning( disable : 4201 )
#endif
#include "glm/glm.hpp"
#ifdef WIN32
#pragma warning( pop )
#endif
......@@ -90,7 +91,6 @@ public:
unsigned int getMaxNumDecals();
protected:
friend class VulkanDecalRenderDelegate;
std::deque<std::shared_ptr<Decal>> m_orderedDecals;
std::deque<std::shared_ptr<Decal>> m_freeDecals;
......@@ -102,7 +102,7 @@ protected:
unsigned int m_numDecals = 0;
bool m_recycle = true;
glm::vec3 m_vertexPositions[8];
glm::ivec3 m_triangles[12];
Vec3d m_vertexPositions[8];
Vec3i m_triangles[12];
};
}
......@@ -37,23 +37,23 @@ RenderParticles::RenderParticles(const unsigned int maxNumParticles /*=128*/, co
LOG(WARNING) << "The maximum number of decals is 128";
}
m_vertexPositions[0] = glm::vec3(0.5, 0.5, 0);
m_vertexPositions[1] = glm::vec3(0.5, -0.5, 0);
m_vertexPositions[2] = glm::vec3(-0.5, 0.5, 0);
m_vertexPositions[3] = glm::vec3(-0.5, -0.5, 0);
m_vertexNormals[0] = glm::vec3(0.0, 0.0, 1.0);
m_vertexNormals[1] = glm::vec3(0.0, 0.0, 1.0);
m_vertexNormals[2] = glm::vec3(0.0, 0.0, 1.0);
m_vertexNormals[3] = glm::vec3(0.0, 0.0, 1.0);
m_vertexUVs[0] = glm::vec2(1.0, 1.0);
m_vertexUVs[1] = glm::vec2(1.0, 0);
m_vertexUVs[2] = glm::vec2(0, 1.0);
m_vertexUVs[3] = glm::vec2(0, 0);
m_triangles[0] = glm::ivec3(1, 0, 3);
m_triangles[1] = glm::ivec3(0, 2, 3);
m_vertexPositions[0] = Vec3d(0.5, 0.5, 0);
m_vertexPositions[1] = Vec3d(0.5, -0.5, 0);
m_vertexPositions[2] = Vec3d(-0.5, 0.5, 0);
m_vertexPositions[3] = Vec3d(-0.5, -0.5, 0);
m_vertexNormals[0] = Vec3d(0.0, 0.0, 1.0);
m_vertexNormals[1] = Vec3d(0.0, 0.0, 1.0);
m_vertexNormals[2] = Vec3d(0.0, 0.0, 1.0);
m_vertexNormals[3] = Vec3d(0.0, 0.0, 1.0);
m_vertexUVs[0] = Vec2d(1.0, 1.0);
m_vertexUVs[1] = Vec2d(1.0, 0);
m_vertexUVs[2] = Vec2d(0, 1.0);
m_vertexUVs[3] = Vec2d(0, 0);
m_triangles[0] = Vec3i(1, 0, 3);
m_triangles[1] = Vec3i(0, 2, 3);
}
void
......
......@@ -28,7 +28,7 @@
#pragma warning( push )
#pragma warning( disable : 4201 )
#endif
#include <glm/glm.hpp>
#ifdef WIN32
#pragma warning( pop )
#endif
......@@ -117,11 +117,11 @@ protected:
float m_particleSize = 0.1f;
std::vector<std::unique_ptr<RenderParticle>> m_particles; ///< Particle objects
glm::vec3 m_vertexPositions[4];
glm::vec3 m_vertexNormals[4];
glm::vec3 m_vertexTangents[4];
glm::vec2 m_vertexUVs[4];
glm::ivec3 m_triangles[2];
Vec3d m_vertexPositions[4];
Vec3d m_vertexNormals[4];
Vec3d m_vertexTangents[4];
Vec2d m_vertexUVs[4];
Vec3i m_triangles[2];
void applyTransform(const Mat4d& m) override;
......
......@@ -210,11 +210,6 @@ protected:
friend class VTKRenderer;
friend class VTKRenderDelegate;
friend class VulkanSurfaceMeshRenderDelegate;
friend class VulkanLineMeshRenderDelegate;
friend class VulkanRenderDelegate;
friend class VulkanRenderer;
///
/// \brief Directly apply transform to data
///
......
......@@ -5,8 +5,7 @@ include(imstkAddLibrary)
imstk_add_library( MeshIO
DEPENDS
Common
Geometry
glm
Geometry
Assimp
VegaFEM::volumetricMesh
${VTK_LIBRARIES}
......
......@@ -53,8 +53,7 @@ set(RENDERING_CPP_FILES ${VTK_CPP_FILES})
set(RENDERING_SUBDIR
VTKRenderer
VTKRenderer/RenderDelegate)
set(RENDERING_DEPENDENCIES
#GUIOverlay
set(RENDERING_DEPENDENCIES
Materials
openvr)
......@@ -70,8 +69,7 @@ imstk_add_library( Rendering
DEPENDS
${RENDERING_DEPENDENCIES}
Scene
Animation
glm
Animation
${VTK_LIBRARIES}
${RENDERING_LIBRARIES})
#VERBOSE)
......
#-----------------------------------------------------------------------------
# Create target
#-----------------------------------------------------------------------------
if( NOT iMSTK_USE_Vulkan )
else()
include(imstkAddLibrary)
file (GLOB_RECURSE GUI_h_files "${CMAKE_CURRENT_SOURCE_DIR}/imstk*.h")
file (GLOB_RECURSE GUI_cpp_files "${CMAKE_CURRENT_SOURCE_DIR}/imstk*.cpp")
if( iMSTK_USE_Vulkan )
set (IMPLEMENTATION_H_FILES
imgui_impl_vulkan.h
imgui_impl_glfw.h)
set (IMPLEMENTATION_CPP_FILES
imgui_impl_vulkan.cpp
imgui_impl_glfw.cpp)
endif()
imstk_add_library( GUIOverlay
H_FILES
${IMGUI_SOURCE_DIR}/imconfig.h
${IMGUI_SOURCE_DIR}/imgui.h
${IMGUI_SOURCE_DIR}/imgui_internal.h
${IMGUI_SOURCE_DIR}/imstb_rectpack.h
${IMGUI_SOURCE_DIR}/imstb_textedit.h
${IMGUI_SOURCE_DIR}/imstb_truetype.h
${IMPLEMENTATION_H_FILES}
${GUI_h_files}
CPP_FILES
${IMGUI_SOURCE_DIR}/imgui.cpp
${IMGUI_SOURCE_DIR}/imgui_draw.cpp
${IMGUI_SOURCE_DIR}/imgui_widgets.cpp
${IMPLEMENTATION_CPP_FILES}
${GUI_cpp_files}
DEPENDS
Common
imgui
${Vulkan_Dependency}
)
endif()
#-----------------------------------------------------------------------------
# Testing
#-----------------------------------------------------------------------------
#if( ${PROJECT_NAME}_BUILD_TESTING )
# add_subdirectory( Testing )
#endif()
// ImGui Platform Binding for: GLFW
// This needs to be used along with a Renderer (e.g. OpenGL3, Vulkan..)
// (Info: GLFW is a cross-platform general purpose library for handling windows, inputs, OpenGL/Vulkan graphics context creation, etc.)
// Implemented features:
// [X] Platform: Clipboard support.
// [X] Platform: Gamepad navigation mapping. Enable with 'io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad'.
// [x] Platform: Mouse cursor shape and visibility. Disable with 'io.ConfigFlags |= ImGuiConfigFlags_NoMouseCursorChange'. FIXME: 3 cursors types are missing from GLFW.
// [X] Platform: Keyboard arrays indexed using GLFW_KEY_* codes, e.g. ImGui::IsKeyPressed(GLFW_KEY_SPACE).
// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
// If you are new to dear imgui, read examples/README.txt and read the documentation at the top of imgui.cpp.
// https://github.com/ocornut/imgui
// CHANGELOG
// (minor and older changes stripped away, please see git history for details)
// 2018-08-01: Inputs: Workaround for Emscripten which doesn't seem to handle focus related calls.
// 2018-06-29: Inputs: Added support for the ImGuiMouseCursor_Hand cursor.
// 2018-06-08: Misc: Extracted imgui_impl_glfw.cpp/.h away from the old combined GLFW+OpenGL/Vulkan examples.
// 2018-03-20: Misc: Setup io.BackendFlags ImGuiBackendFlags_HasMouseCursors flag + honor ImGuiConfigFlags_NoMouseCursorChange flag.
// 2018-02-20: Inputs: Added support for mouse cursors (ImGui::GetMouseCursor() value, passed to glfwSetCursor()).
// 2018-02-06: Misc: Removed call to ImGui::Shutdown() which is not available from 1.60 WIP, user needs to call CreateContext/DestroyContext themselves.
// 2018-02-06: Inputs: Added mapping for ImGuiKey_Space.
// 2018-01-25: Inputs: Added gamepad support if ImGuiConfigFlags_NavEnableGamepad is set.
// 2018-01-25: Inputs: Honoring the io.WantSetMousePos by repositioning the mouse (when using navigation and ImGuiConfigFlags_NavMoveMouse is set).
// 2018-01-20: Inputs: Added Horizontal Mouse Wheel support.
// 2018-01-18: Inputs: Added mapping for ImGuiKey_Insert.
// 2017-08-25: Inputs: MousePos set to -FLT_MAX,-FLT_MAX when mouse is unavailable/missing (instead of -1,-1).
// 2016-10-15: Misc: Added a void* user_data parameter to Clipboard function handlers.
#include "imgui.h"
#include "imgui_impl_glfw.h"
// GLFW
#include <GLFW/glfw3.h>
#ifdef _WIN32
#undef APIENTRY
#define GLFW_EXPOSE_NATIVE_WIN32
#include <GLFW/glfw3native.h> // for glfwGetWin32Window
#endif
#define GLFW_HAS_WINDOW_TOPMOST (GLFW_VERSION_MAJOR * 1000 + GLFW_VERSION_MINOR * 100 >= 3200) // 3.2+ GLFW_FLOATING
#define GLFW_HAS_WINDOW_HOVERED (GLFW_VERSION_MAJOR * 1000 + GLFW_VERSION_MINOR * 100 >= 3300) // 3.3+ GLFW_HOVERED
#define GLFW_HAS_WINDOW_ALPHA (GLFW_VERSION_MAJOR * 1000 + GLFW_VERSION_MINOR * 100 >= 3300) // 3.3+ glfwSetWindowOpacity
#define GLFW_HAS_PER_MONITOR_DPI (GLFW_VERSION_MAJOR * 1000 + GLFW_VERSION_MINOR * 100 >= 3300) // 3.3+ glfwGetMonitorContentScale
#define GLFW_HAS_VULKAN (GLFW_VERSION_MAJOR * 1000 + GLFW_VERSION_MINOR * 100 >= 3200) // 3.2+ glfwCreateWindowSurface
// Data
enum GlfwClientApi
{
GlfwClientApi_Unknown,
GlfwClientApi_OpenGL,
GlfwClientApi_Vulkan
};
static GLFWwindow* g_Window = NULL;
static GlfwClientApi g_ClientApi = GlfwClientApi_Unknown;
static double g_Time = 0.0;
static bool g_MouseJustPressed[5] = { false, false, false, false, false };
static GLFWcursor* g_MouseCursors[ImGuiMouseCursor_COUNT] = { 0 };
static const char*
ImGui_ImplGlfw_GetClipboardText(void* user_data)
{
return glfwGetClipboardString((GLFWwindow*)user_data);
}
static void
ImGui_ImplGlfw_SetClipboardText(void* user_data, const char* text)
{
glfwSetClipboardString((GLFWwindow*)user_data, text);
}
void
ImGui_ImplGlfw_MouseButtonCallback(GLFWwindow*, int button, int action, int /*mods*/)
{
if (action == GLFW_PRESS && button >= 0 && button < IM_ARRAYSIZE(g_MouseJustPressed))
{
g_MouseJustPressed[button] = true;
}
}
void
ImGui_ImplGlfw_ScrollCallback(GLFWwindow*, double xoffset, double yoffset)
{
ImGuiIO& io = ImGui::GetIO();
io.MouseWheelH += (float)xoffset;
io.MouseWheel += (float)yoffset;
}
void
ImGui_ImplGlfw_KeyCallback(GLFWwindow*, int key, int, int action, int mods)
{
ImGuiIO& io = ImGui::GetIO();
if (action == GLFW_PRESS)
{
io.KeysDown[key] = true;
}
if (action == GLFW_RELEASE)
{
io.KeysDown[key] = false;
}
(void)mods; // Modifiers are not reliable across systems
io.KeyCtrl = io.KeysDown[GLFW_KEY_LEFT_CONTROL] || io.KeysDown[GLFW_KEY_RIGHT_CONTROL];
io.KeyShift = io.KeysDown[GLFW_KEY_LEFT_SHIFT] || io.KeysDown[GLFW_KEY_RIGHT_SHIFT];
io.KeyAlt = io.KeysDown[GLFW_KEY_LEFT_ALT] || io.KeysDown[GLFW_KEY_RIGHT_ALT];
io.KeySuper = io.KeysDown[GLFW_KEY_LEFT_SUPER] || io.KeysDown[GLFW_KEY_RIGHT_SUPER];
}
void
ImGui_ImplGlfw_CharCallback(GLFWwindow*, unsigned int c)
{
ImGuiIO& io = ImGui::GetIO();
if (c > 0 && c < 0x10000)
{
io.AddInputCharacter((unsigned short)c);
}
}
void
ImGui_ImplGlfw_InstallCallbacks(GLFWwindow* window)
{
glfwSetMouseButtonCallback(window, ImGui_ImplGlfw_MouseButtonCallback);
glfwSetScrollCallback(window, ImGui_ImplGlfw_ScrollCallback);
glfwSetKeyCallback(window, ImGui_ImplGlfw_KeyCallback);
glfwSetCharCallback(window, ImGui_ImplGlfw_CharCallback);
}
static bool
ImGui_ImplGlfw_Init(GLFWwindow* window, bool install_callbacks, GlfwClientApi client_api)
{
g_Window = window;
g_Time = 0.0;
// Setup back-end capabilities flags
ImGuiIO& io = ImGui::GetIO();
io.BackendFlags |= ImGuiBackendFlags_HasMouseCursors; // We can honor GetMouseCursor() values (optional)
io.BackendFlags |= ImGuiBackendFlags_HasSetMousePos; // We can honor io.WantSetMousePos requests (optional, rarely used)
// Keyboard mapping. ImGui will use those indices to peek into the io.KeysDown[] array.
io.KeyMap[ImGuiKey_Tab] = GLFW_KEY_TAB;
io.KeyMap[ImGuiKey_LeftArrow] = GLFW_KEY_LEFT;
io.KeyMap[ImGuiKey_RightArrow] = GLFW_KEY_RIGHT;
io.KeyMap[ImGuiKey_UpArrow] = GLFW_KEY_UP;
io.KeyMap[ImGuiKey_DownArrow] = GLFW_KEY_DOWN;
io.KeyMap[ImGuiKey_PageUp] = GLFW_KEY_PAGE_UP;
io.KeyMap[ImGuiKey_PageDown] = GLFW_KEY_PAGE_DOWN;
io.KeyMap[ImGuiKey_Home] = GLFW_KEY_HOME;
io.KeyMap[ImGuiKey_End] = GLFW_KEY_END;
io.KeyMap[ImGuiKey_Insert] = GLFW_KEY_INSERT;
io.KeyMap[ImGuiKey_Delete] = GLFW_KEY_DELETE;
io.KeyMap[ImGuiKey_Backspace] = GLFW_KEY_BACKSPACE;
io.KeyMap[ImGuiKey_Space] = GLFW_KEY_SPACE;
io.KeyMap[ImGuiKey_Enter] = GLFW_KEY_ENTER;
io.KeyMap[ImGuiKey_Escape] = GLFW_KEY_ESCAPE;
io.KeyMap[ImGuiKey_A] = GLFW_KEY_A;
io.KeyMap[ImGuiKey_C] = GLFW_KEY_C;
io.KeyMap[ImGuiKey_V] = GLFW_KEY_V;
io.KeyMap[ImGuiKey_X] = GLFW_KEY_X;
io.KeyMap[ImGuiKey_Y] = GLFW_KEY_Y;
io.KeyMap[ImGuiKey_Z] = GLFW_KEY_Z;
io.SetClipboardTextFn = ImGui_ImplGlfw_SetClipboardText;
io.GetClipboardTextFn = ImGui_ImplGlfw_GetClipboardText;
io.ClipboardUserData = g_Window;
#if defined(_WIN32)
io.ImeWindowHandle = (void*)glfwGetWin32Window(g_Window);
#endif
g_MouseCursors[ImGuiMouseCursor_Arrow] = glfwCreateStandardCursor(GLFW_ARROW_CURSOR);
g_MouseCursors[ImGuiMouseCursor_TextInput] = glfwCreateStandardCursor(GLFW_IBEAM_CURSOR);
g_MouseCursors[ImGuiMouseCursor_ResizeAll] = glfwCreateStandardCursor(GLFW_ARROW_CURSOR); // FIXME: GLFW doesn't have this.
g_MouseCursors[ImGuiMouseCursor_ResizeNS] = glfwCreateStandardCursor(GLFW_VRESIZE_CURSOR);
g_MouseCursors[ImGuiMouseCursor_ResizeEW] = glfwCreateStandardCursor(GLFW_HRESIZE_CURSOR);
g_MouseCursors[ImGuiMouseCursor_ResizeNESW] = glfwCreateStandardCursor(GLFW_ARROW_CURSOR); // FIXME: GLFW doesn't have this.
g_MouseCursors[ImGuiMouseCursor_ResizeNWSE] = glfwCreateStandardCursor(GLFW_ARROW_CURSOR); // FIXME: GLFW doesn't have this.