# cedricguillemet/imguizmo architecture

> Architecture diagram of the GitHub repository cedricguillemet/imguizmo, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-03-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/cedricguillemet/imguizmo
- Repository: https://github.com/cedricguillemet/imguizmo

## Overview

##### 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).

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Build & Configuration Tools
    subgraph "Build & Configuration"
        BM("Makefile"):::build
        VCP("vcpkg-example"):::build
    end

    %% Sample/Demo Applications
    subgraph "Sample/Demo Applications"
        EX("Win32/OpenGL Example"):::demo
        BIN("Precompiled Binaries"):::demo
    end

    %% Library Components (Core API and Widgets)
    subgraph "Library Components"
        CORE("Core ImGuizmo API"):::core
        subgraph "Widget Modules"
            GE("GraphEditor"):::widget
            CE("ImCurveEdit"):::widget
            GR("ImGradient"):::widget
            SE("ImSequencer"):::widget
        end
    end

    %% External Dependency
    DEP("Dear ImGui Framework"):::dep

    %% Connections
    EX -->|"calls"| CORE
    BIN -->|"demonstrates"| CORE

    CORE -->|"provides_functions_to"| GE
    CORE -->|"provides_functions_to"| CE
    CORE -->|"provides_functions_to"| GR
    CORE -->|"provides_functions_to"| SE

    CORE -->|"renders_via"| DEP
    GE -->|"renders_via"| DEP
    CE -->|"renders_via"| DEP
    GR -->|"renders_via"| DEP
    SE -->|"renders_via"| DEP

    BM -.->|"builds"| CORE
    BM -.->|"builds"| EX
    VCP -.->|"configures"| CORE
    VCP -.->|"configures"| EX

    %% Click Events for Component Mapping
    click CORE "https://github.com/cedricguillemet/imguizmo/blob/master/ImGuizmo.cpp"
    click CORE "https://github.com/cedricguillemet/imguizmo/blob/master/ImGuizmo.h"

    click GE "https://github.com/cedricguillemet/imguizmo/blob/master/GraphEditor.cpp"
    click GE "https://github.com/cedricguillemet/imguizmo/blob/master/GraphEditor.h"

    click CE "https://github.com/cedricguillemet/imguizmo/blob/master/ImCurveEdit.cpp"
    click CE "https://github.com/cedricguillemet/imguizmo/blob/master/ImCurveEdit.h"

    click GR "https://github.com/cedricguillemet/imguizmo/blob/master/ImGradient.cpp"
    click GR "https://github.com/cedricguillemet/imguizmo/blob/master/ImGradient.h"

    click SE "https://github.com/cedricguillemet/imguizmo/blob/master/ImSequencer.cpp"
    click SE "https://github.com/cedricguillemet/imguizmo/blob/master/ImSequencer.h"

    click EX "https://github.com/cedricguillemet/imguizmo/tree/master/example/"
    click BIN "https://github.com/cedricguillemet/imguizmo/tree/master/bin/"

    click BM "https://github.com/cedricguillemet/imguizmo/tree/master/Makefile"
    click VCP "https://github.com/cedricguillemet/imguizmo/blob/master/vcpkg-example/CMakeLists.txt"
    click VCP "https://github.com/cedricguillemet/imguizmo/blob/master/vcpkg-example/vcpkg.json"

    %% Style Definitions
    classDef core fill:#fce4ec,stroke:#ad1457,stroke-width:2px;
    classDef widget fill:#e3f2fd,stroke:#1565c0,stroke-width:2px;
    classDef dep fill:#e8f5e9,stroke:#2e7d32,stroke-width:2px;
    classDef demo fill:#fffde7,stroke:#f9a825,stroke-width:2px;
    classDef build fill:#f3e5f5,stroke:#6a1b9a,stroke-width:2px;
```
