Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use Magnum's builtin text rendering instead of ImGui; expose it in Python #1853

Merged
merged 4 commits into from
Sep 8, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,6 @@
[submodule "docs/m.css"]
path = docs/m.css
url = https://github.com/mosra/m.css
[submodule "src/deps/imgui"]
path = src/deps/imgui
url = https://github.com/ocornut/imgui.git
[submodule "src/deps/tinyobjloader"]
path = src/deps/tinyobjloader
url = https://github.com/syoyo/tinyobjloader.git
Expand Down
231 changes: 0 additions & 231 deletions src/cmake/FindImGui.cmake

This file was deleted.

14 changes: 7 additions & 7 deletions src/cmake/dependencies.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,6 @@ else()
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${DEPS_DIR}/eigen/cmake")
endif()

if(NOT IMGUI_DIR)
set(IMGUI_DIR "${DEPS_DIR}/imgui")
endif()

# tinyxml2
include_directories("${DEPS_DIR}/tinyxml2")
add_subdirectory("${DEPS_DIR}/tinyxml2")
Expand Down Expand Up @@ -194,10 +190,12 @@ if(NOT USE_SYSTEM_MAGNUM)
set(MAGNUM_BUILD_STATIC ON CACHE BOOL "" FORCE)
set(MAGNUM_BUILD_STATIC_PIC ON CACHE BOOL "" FORCE)

# These are enabled by default but we don't need them right now -- disabling
# for slightly faster builds. If you need any of these, simply delete a line.
# These are enabled by default but we don't need them if not building GUI
# viewers -- disabling for slightly faster builds. If you need any of these
# always, simply delete a line.
set(MAGNUM_WITH_TEXT OFF CACHE BOOL "" FORCE)
set(MAGNUM_WITH_TEXTURETOOLS OFF CACHE BOOL "" FORCE)
set(MAGNUM_WITH_STBTRUETYPEFONT OFF CACHE BOOL "" FORCE)

# These are not enabled by default but we need them
set(MAGNUM_WITH_ANYSCENEIMPORTER ON CACHE BOOL "" FORCE)
Expand All @@ -215,7 +213,6 @@ if(NOT USE_SYSTEM_MAGNUM)
set(MAGNUM_WITH_EMSCRIPTENAPPLICATION OFF CACHE BOOL "" FORCE)
set(MAGNUM_WITH_GLFWAPPLICATION OFF CACHE BOOL "" FORCE)
set(MAGNUM_WITH_EIGEN ON CACHE BOOL "" FORCE) # Eigen integration
set(MAGNUM_WITH_IMGUI ON CACHE BOOL "" FORCE) # ImGui integration
# GltfSceneConverter and KtxImageConverter are needed only by
# BatchRendererTest and are optional
#set(MAGNUM_WITH_GLTFSCENECONVERTER ON CACHE BOOL "" FORCE)
Expand Down Expand Up @@ -298,6 +295,9 @@ if(NOT USE_SYSTEM_MAGNUM)
endif()

if(BUILD_GUI_VIEWERS)
set(MAGNUM_WITH_TEXT ON CACHE BOOL "" FORCE)
set(MAGNUM_WITH_STBTRUETYPEFONT ON CACHE BOOL "" FORCE)

if(CORRADE_TARGET_EMSCRIPTEN)
set(MAGNUM_WITH_EMSCRIPTENAPPLICATION ON CACHE BOOL "" FORCE)
else()
Expand Down
1 change: 0 additions & 1 deletion src/deps/imgui
Submodule imgui deleted from 9418dc
2 changes: 1 addition & 1 deletion src/deps/magnum
Submodule magnum updated 46 files
+5 −0 doc/changelog.dox
+10 −0 doc/file-formats.dox
+6 −2 package/ci/circleci.yml
+7 −4 src/Magnum/Audio/AbstractImporter.cpp
+21 −3 src/Magnum/Audio/Test/AbstractImporterTest.cpp
+4 −4 src/Magnum/DebugTools/CompareImage.h
+1 −1 src/Magnum/Math/Complex.h
+23 −23 src/Magnum/SceneTools/sceneconverter.cpp
+7 −4 src/Magnum/ShaderTools/AbstractConverter.cpp
+18 −0 src/Magnum/ShaderTools/Test/AbstractConverterTest.cpp
+7 −4 src/Magnum/Text/AbstractFont.cpp
+7 −4 src/Magnum/Text/AbstractFontConverter.cpp
+19 −1 src/Magnum/Text/Test/AbstractFontConverterTest.cpp
+19 −1 src/Magnum/Text/Test/AbstractFontTest.cpp
+102 −64 src/Magnum/Trade/AbstractImageConverter.cpp
+295 −279 src/Magnum/Trade/AbstractImageConverter.h
+7 −4 src/Magnum/Trade/AbstractImporter.cpp
+19 −16 src/Magnum/Trade/AbstractSceneConverter.cpp
+1 −1 src/Magnum/Trade/AbstractSceneConverter.h
+160 −85 src/Magnum/Trade/MaterialData.cpp
+152 −67 src/Magnum/Trade/MaterialData.h
+34 −0 src/Magnum/Trade/MaterialLayerData.h
+2 −1 src/Magnum/Trade/MeshData.h
+7 −0 src/Magnum/Trade/SceneData.cpp
+18 −1 src/Magnum/Trade/SceneData.h
+455 −121 src/Magnum/Trade/Test/AbstractImageConverterTest.cpp
+18 −0 src/Magnum/Trade/Test/AbstractImporterTest.cpp
+46 −12 src/Magnum/Trade/Test/AbstractSceneConverterTest.cpp
+133 −4 src/Magnum/Trade/Test/MaterialDataTest.cpp
+3 −0 src/Magnum/Trade/Test/SceneDataTest.cpp
+3 −5 src/Magnum/Trade/imageconverter.cpp
+2 −7 src/MagnumPlugins/AnyImageConverter/AnyImageConverter.cpp
+4 −0 src/MagnumPlugins/AnyImageConverter/AnyImageConverter.h
+35 −4 src/MagnumPlugins/AnyImageImporter/AnyImageImporter.cpp
+2 −1 src/MagnumPlugins/AnyImageImporter/AnyImageImporter.h
+112 −0 src/MagnumPlugins/AnyImageImporter/Test/AnyImageImporterTest.cpp
+2 −0 src/MagnumPlugins/AnyImageImporter/Test/CMakeLists.txt
+ src/MagnumPlugins/AnyImageImporter/Test/basis.ktx2
+8 −2 src/MagnumPlugins/AnySceneConverter/AnySceneConverter.cpp
+2 −0 src/MagnumPlugins/AnySceneConverter/AnySceneConverter.h
+4 −0 src/MagnumPlugins/AnySceneConverter/Test/AnySceneConverterTest.cpp
+1 −0 src/MagnumPlugins/AnySceneImporter/Test/AnySceneImporterTest.cpp
+4 −1 src/MagnumPlugins/TgaImageConverter/Test/TgaImageConverterTest.cpp
+13 −1 src/MagnumPlugins/TgaImageConverter/TgaImageConverter.cpp
+8 −2 src/MagnumPlugins/TgaImageConverter/TgaImageConverter.h
+6 −6 src/MagnumPlugins/TgaImporter/TgaImporter.h
2 changes: 1 addition & 1 deletion src/deps/magnum-plugins
Submodule magnum-plugins updated 120 files
7 changes: 7 additions & 0 deletions src/esp/bindings/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,13 @@ target_link_libraries(
sim
)

# Make Magnum text rendering (used by the native viewer) available for Python
# as well
if(BUILD_GUI_VIEWERS)
find_package(MagnumPlugins REQUIRED StbTrueTypeFont)
target_link_libraries(habitat_sim_bindings PRIVATE MagnumPlugins::StbTrueTypeFont)
endif()

if(BUILD_WITH_AUDIO)
add_custom_command(
TARGET habitat_sim_bindings POST_BUILD
Expand Down
12 changes: 7 additions & 5 deletions src/utils/viewer/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
find_package(Magnum REQUIRED DebugTools)

find_package(MagnumIntegration REQUIRED ImGui)
find_package(Magnum REQUIRED DebugTools Text)
find_package(MagnumPlugins REQUIRED StbTrueTypeFont)

set(viewer_SOURCES viewer.cpp ObjectPickingHelper.cpp ObjectPickingHelper.h)

corrade_add_resource(viewer_RESOURCES resources.conf)

#set_directory_properties(PROPERTIES CORRADE_USE_PEDANTIC_FLAGS ON)
add_executable(viewer ${viewer_SOURCES})
add_executable(viewer ${viewer_SOURCES} ${viewer_RESOURCES})

target_link_libraries(
viewer
Expand All @@ -16,7 +17,8 @@ target_link_libraries(
sim
geo
Magnum::DebugTools
MagnumIntegration::ImGui
Magnum::Text
MagnumPlugins::StbTrueTypeFont
)

# copy JS/HTML/CSS scaffolding for WebGL build
Expand Down
Binary file added src/utils/viewer/ProggyClean.ttf
Binary file not shown.
4 changes: 4 additions & 0 deletions src/utils/viewer/resources.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
group=fonts

[file]
filename=ProggyClean.ttf
Loading