How cedricguillemet/imguizmo works
Main Components
• Library Core:
• The central part of the project consists of the core API functions (e.g., Manipulate, DecomposeMatrixToComponents, RecomposeMatrixFromComponents) that handle the main wizardry behind the gizmos.
• Files such as ImGuizmo.cpp/h and accompanying header files (including ImCurveEdit, ImGradient, ImSequencer, GraphEditor) form the core functionality.
• Widget Components:
• Individual widgets, like GraphEditor, ImCurveEdit, ImGradient, and ImSequencer, each provide specialized UI controls or manipulation capabilities.
• External Dependencies:
• Integration with Dear ImGui is a key dependency.
• The sample applications (in the example folder and the vcpkg-example) show how this library is meant to be used within an application context.
• Sample/Demo Applications:
• The “example” directory contains a full demo (with main.cpp and various ImGui source files) illustrating use cases.
• The “bin” directory also holds precompiled binaries for demonstration.
• Build & Configuration Tools:
• Makefile for building the project.
• Additional configuration files (e.g., .editorconfig, .gitignore, vcpkg.json, and CMakeLists.txt in the vcpkg-example) that define build and dependency management.
Relationships and Interactions
• The core library components (gizmos, widgets) are layered on top of the Dear ImGui framework.
• The API calls (like Manipulate, Enable, BeginFrame) provide a bridge between the user’s application code and the underlying ImGui rendering loop.
• The sample applications illustrate how the library functions are integrated with the main UI loop.
• The build scripts (Makefile, CMake files) demonstrate the dependency management and compilation steps, particularly when integrating with vcpkg.
Architectural Patterns and Design Principles
• Immediate Mode UI Paradigm:
• The library follows the immediate mode philosophy inherent to Dear ImGui, with the external API calls triggering rendering and state management from frame to frame.
• Modularity:
• Each widget (such as the GraphEditor, ImSequencer, etc.) is implemented as separate components, making it easy to update or extend specific functionalities.
• Extensibility:
• There are clear extension points for custom drawing or custom manipulation within the nodes and other controls (especially seen in the GraphEditor).
• Separation of Concerns:
• The core logic for matrix manipulation is separated from sample/demo code. The library is built as a collection of widgets, while the demo serves as an example of integration with the broader UI framework.
Specific Technologies and Frameworks
• C++ as the main programming language.
• Dear ImGui as the underlying UI library.
• OpenGL and Win32 (in the sample usage) for rendering and window management.
• CMake and vcpkg for dependency management and build configuration.
Additional Advice
• Separation between the reusable library components (headers, cpp implementations) and the demo/integration examples.
• Immediate mode design that is critical for understanding how this library interacts with the UI framework (Dear ImGui).