# jonaslindemann/ivf2 architecture

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

- Interactive diagram: https://gitdiagram.com/jonaslindemann/ivf2
- Repository: https://github.com/jonaslindemann/ivf2

## Overview

##### Project Type and Purpose
- This is a C++ cross-platform library (Ivf++ 2) providing a modern OpenGL wrapper built around a scene graph.
- It also includes several sub-libraries for mesh generation (`generator`), math utilities (`ivfmath`), UI integration (`ivfui`), and the OpenGL loader (`glad`), plus a unified CMake target (`ivf2::ivf2`).
- A set of example applications demonstrate use-cases: animation, lighting, physics, UI, procedural geometry.

##### High-Level Components
a. Build System & Package Manager
- CMake + vcpkg detection → orchestrates builds of all subprojects and examples.
b. Core Libraries
- `glad` – OpenGL loader
- `ivf` – core scene graph, node hierarchy, resource managers (textures, shaders, meshes), post-processing, lights, cameras
- `ivfmath` – keyframe data/interpolator, vector/sphere/spline math utilities
- `ivfui` – UI layer on top of `ivf` and ImGui, window management, inspectors, controls
c. Unified Export
- `ivf2::ivf2` target aggregates all above libs and external dependencies (GLM, GLFW, ImGui, ReactPhysics3D, etc.)
d. Examples & Assets
- Executables (under `examples/`) link against `ivf2::ivf2`
- Asset folders (`bin/shaders`, `bin/fonts`, `bin/assets`) auto-copied at build time
e. External Services/Dependencies
- vcpkg-managed libraries (GLFW, ImGui, Boost, etc.)
- GPU / OpenGL driver

##### Interactions and Data Flows
- Examples → Link → `ivf2::ivf2` → calls into sub-libraries
- `ivf` calls into `glad` to issue OpenGL calls to the GPU
- `ivf` uses `ivfmath` for interpolation and advanced math
- `ivfui` uses `ivf` to render UI controls and scene overlays
- `generator` is either used standalone or by `ivf` for procedural meshes
- Build System coordinates CMake targets and copies assets into example output directories

##### Architectural Patterns & Principles
- Layered Architecture
- Bootstrapping & build configuration at the bottom
- Loader (`glad`) → Math (`ivfmath`) & Generator (`generator`) → Core Scene Graph (`ivf`) → UI (`ivfui`) → Examples
- Modular Design
- Each library is its own CMake target with public include directories and private implementation
- Unified CMake alias target hides individual dependencies
- Dependency Inversion
- Examples depend on abstract interface (`ivf2::ivf2`), not on individual libraries
- Automatic Resource Management
- CMake helper `add_ivf2_example` for copying assets and linking dependencies

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Layers
    subgraph "Examples Layer"
        EX["Examples"]:::examples
    end

    subgraph "Unified CMake Target"
        IVFTARGET["ivf2::ivf2"]:::composite
    end

    subgraph "Library Layer"
        GLAD["glad"]:::loader
        GEN["generator"]:::gen
        MATH["ivfmath"]:::math
        IVF["ivf"]:::core
        UIO["ivfui"]:::ui
    end

    subgraph "Runtime & Assets"
        GPU["GPU / OpenGL Driver"]:::hardware
        ASSETS[("Assets")]:::assets
    end

    BUILD["Build System / vcpkg"]:::build

    %% Dependencies & Flows
    EX -->|"link time"| IVFTARGET
    EX -.->|"asset copy"| ASSETS
    EX -->|"build time"| BUILD

    BUILD -->|"orchestrates builds"| IVFTARGET
    BUILD -->|"copies assets"| ASSETS

    IVFTARGET --> GLAD
    IVFTARGET --> GEN
    IVFTARGET --> MATH
    IVFTARGET --> IVF
    IVFTARGET --> UIO

    IVF -->|"calls into"| GLAD
    IVF -->|"uses"| MATH
    IVF -->|"uses"| GEN
    UIO -->|"renders via"| IVF
    GLAD -->|"OpenGL calls"| GPU

    %% External Deps
    EXTD["External Dependencies"]:::external
    IVFTARGET -.->|"aggregates"| EXTD

    %% Legend
    subgraph "Legend"
        A1["Rectangle: Components"]:::legend
        A2[("Cylinder: Assets")]:::legend
        A3["Hexagon: Build/Tools"]:::legend
    end

    %% Click Events
    click BUILD "https://github.com/jonaslindemann/ivf2/blob/main/CMakeLists.txt"
    click BUILD "https://github.com/jonaslindemann/ivf2/blob/main/vcpkg.json"
    click IVFTARGET "https://github.com/jonaslindemann/ivf2/blob/main/CMakeLists.txt"
    click GLAD "https://github.com/jonaslindemann/ivf2/blob/main/include/glad/glad.h"
    click GLAD "https://github.com/jonaslindemann/ivf2/blob/main/src/glad/glad.c"
    click GLAD "https://github.com/jonaslindemann/ivf2/blob/main/src/glad/CMakeLists.txt"
    click GEN "https://github.com/jonaslindemann/ivf2/tree/main/include/generator/"
    click GEN "https://github.com/jonaslindemann/ivf2/tree/main/src/generator/"
    click IVF "https://github.com/jonaslindemann/ivf2/tree/main/include/ivf/"
    click IVF "https://github.com/jonaslindemann/ivf2/tree/main/src/ivf/"
    click MATH "https://github.com/jonaslindemann/ivf2/tree/main/include/ivfmath/"
    click MATH "https://github.com/jonaslindemann/ivf2/tree/main/src/ivfmath/"
    click UIO "https://github.com/jonaslindemann/ivf2/tree/main/include/ivfui/"
    click UIO "https://github.com/jonaslindemann/ivf2/tree/main/src/ivfui/"
    click EX "https://github.com/jonaslindemann/ivf2/tree/main/examples/"
    click ASSETS "https://github.com/jonaslindemann/ivf2/tree/main/bin/assets/"
    click ASSETS "https://github.com/jonaslindemann/ivf2/tree/main/bin/shaders/"
    click ASSETS "https://github.com/jonaslindemann/ivf2/tree/main/bin/fonts/"
    click EXTD "https://github.com/jonaslindemann/ivf2/tree/main/include/glm/"
    click EXTD "https://github.com/jonaslindemann/ivf2/tree/main/include/gml/"
    click EXTD "https://github.com/jonaslindemann/ivf2/blob/main/vcpkg.json"

    %% Styles
    classDef core fill:#1f497d,stroke:#000,color:#fff;
    classDef ui fill:#4f81bd,stroke:#000,color:#fff;
    classDef gen fill:#9bbb59,stroke:#000,color:#fff;
    classDef math fill:#f79646,stroke:#000,color:#fff;
    classDef loader fill:#7f7f7f,stroke:#000,color:#fff;
    classDef composite fill:#c0504d,stroke:#000,color:#fff;
    classDef examples fill:#8064a2,stroke:#000,color:#fff;
    classDef build fill:#fabf8f,stroke:#000,color:#000,shape:hexagon;
    classDef assets fill:#92d050,stroke:#000,color:#000;
    classDef external fill:#ffd966,stroke:#000,color:#000;
    classDef hardware fill:#d9d9d9,stroke:#000,color:#000;
    classDef legend fill:#ffffff,stroke:#000,color:#000;
    class BUILD,EXTD legend
    class A1,A2,A3 legend
```
