# ttddee/cascade architecture

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

- Interactive diagram: https://gitdiagram.com/ttddee/cascade
- Repository: https://github.com/ttddee/cascade

## Overview

##### Main Components
- User Interface Layer – Represented by the Qt-driven GUI. This includes components such as menus, dialogs (like the About and Preferences dialogs), widgets, and other UI entities (see the “src/ui” and “src/uientities” directories).
- Node Graph System – The core of the image editor. This subsystem (under “src/nodegraph”) is responsible for managing nodes, connections, and their graphical representation. It encapsulates node data models, node geometry, connection logic, and node-rendering.
- Rendering Engine – This layer is driven by Vulkan. It includes rendering tasks, command buffers, and image processing pipelines. Files in “src/renderer” and “src/vulkan*” clearly outline the responsibilities for GPU operations.
- Shader Handling & Compiler – The project supports GLSL and ISF shader effects. The “src/shadercompiler” directory, along with numerous shader files in the “shaders” directory, hint at the compilation and management of shaders for image processing.
- Project and Preferences Management – Modules such as “src/projectmanager.cpp” and “src/preferencesmanager.cpp” indicate management of user settings, projects, and application state.

##### Understand the Relationships and Interactions
- The Qt GUI (user interface layer) interacts directly with the node graph system to allow users to build and edit image processing workflows.
- The node graph system sends processing instructions to the Vulkan-based rendering engine, which may involve compiling and executing shaders.
- The shader management component interprets user-provided shaders (or pre-defined ISF shaders) and compiles them (possibly using SpvShaderCompiler) to produce SPIR-V binaries for Vulkan.
- Multithreading aspects (via TBB) allow for performance-optimized processing in parts such as benchmarking, image processing, and rendering tasks.

##### Architectural Patterns and Design Principles
- Separation of Concerns: Each major component (UI, node graph, renderer, shader compiler, I/O handling) is modularized in separate directories.
- Data Flow: The node graph functions as the central integration point, with a directional flow from user interactions (GUI) to processing (shader compilation and rendering) and output (image display/export).

##### Technologies and Frameworks
- C++ as the core programming language.
- Vulkan for GPU-based rendering.
- GLSL and ISF for shader programming.
- Qt for the graphical user interface.
- TBB for multithreaded computations.
- GitHub workflows (as seen in the “.github” directory) for CI/CD and testing, which could be added as a secondary aspect showing build and test automation.

##### Essential Elements
– From GUI to Node Graph.
– From Node Graph to Rendering Engine.
– From Node Graph to Shader Compiler, and then to the Rendering Engine.

##### Final Advice
- Be as detailed as possible – capture all subsystems, and where applicable subdivide major components (for example, within the Node Graph, indicate the parts related to connections, nodes, and properties).

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "User Interface Layer"
        UI1["UI Directories (Qt): src/ui, src/uientities"]:::frontend
        UI2["Main Window (Qt): UI files & code"]:::frontend
        UI3["Main Menu (Qt)"]:::frontend
    end

    subgraph "Node Graph System"
        NG1["Node Graph Core (nodes, connections)"]:::node
    end

    subgraph "Shader Handling & Compiler"
        SH1["Shader Compiler (GLSL/ISF)"]:::compiler
        SH2["Shaders Library"]:::compiler
    end

    subgraph "Rendering Engine"
        REN1["Vulkan Renderer (GPU Pipeline)"]:::backend
    end

    subgraph "I/O & Color Management"
        IO1["I/O & Color Management"]:::io
    end

    subgraph "Project & Preferences Management"
        PM1["Project Manager"]:::misc
        PM2["Preferences Manager"]:::misc
    end

    subgraph "CI/CD"
        CICD1["GitHub Workflows"]:::ci
    end

    %% Connections
    UI2 -->|"user_actions"| NG1
    UI3 -->|"menu_commands"| NG1
    NG1 -->|"render_instructions"| REN1
    NG1 -->|"shader_request"| SH1
    SH1 -->|"compiled_shaders"| REN1
    IO1 -->|"file_input"| NG1
    IO1 -->|"color_profiles"| REN1
    PM1 -->|"project_state"| NG1
    PM2 -->|"UI_settings"| UI2
    CICD1 -->|"build_trigger"| UI1
    CICD1 -->|"build_trigger"| REN1
    CICD1 -->|"build_trigger"| SH1

    %% Click Events
    click UI1 "https://github.com/ttddee/cascade/tree/master/src/ui"
    click UI1 "https://github.com/ttddee/cascade/tree/master/src/uientities"
    click UI2 "https://github.com/ttddee/cascade/blob/master/src/mainwindow.cpp"
    click UI2 "https://github.com/ttddee/cascade/blob/master/src/mainwindow.h"
    click UI2 "https://github.com/ttddee/cascade/blob/master/src/mainwindow.ui"
    click UI3 "https://github.com/ttddee/cascade/blob/master/src/mainmenu.cpp"
    click NG1 "https://github.com/ttddee/cascade/tree/master/src/nodegraph"
    click NG1 "https://github.com/ttddee/cascade/blob/master/src/nodegraph/node.cpp"
    click SH1 "https://github.com/ttddee/cascade/tree/master/src/shadercompiler"
    click SH1 "https://github.com/ttddee/cascade/blob/master/src/shadercompiler/SpvShaderCompiler.cpp"
    click SH2 "https://github.com/ttddee/cascade/tree/master/shaders"
    click REN1 "https://github.com/ttddee/cascade/tree/master/src/renderer"
    click REN1 "https://github.com/ttddee/cascade/blob/master/src/renderer/vulkanrenderer.cpp"
    click IO1 "https://github.com/ttddee/cascade/tree/master/ocio"
    click IO1 "https://github.com/ttddee/cascade/blob/master/ocio/config.ocio"
    click PM1 "https://github.com/ttddee/cascade/blob/master/src/projectmanager.cpp"
    click PM2 "https://github.com/ttddee/cascade/blob/master/src/preferencesmanager.cpp"
    click CICD1 "https://github.com/ttddee/cascade/blob/master/.github"

    %% Styles
    classDef frontend fill:#AED6F1,stroke:#1F618D,stroke-width:2px;
    classDef node fill:#A9DFBF,stroke:#1D8348,stroke-width:2px;
    classDef compiler fill:#D2B4DE,stroke:#6C3483,stroke-width:2px;
    classDef backend fill:#F9E79F,stroke:#B7950B,stroke-width:2px;
    classDef io fill:#FAD7A0,stroke:#D68910,stroke-width:2px;
    classDef misc fill:#F5B7B1,stroke:#C0392B,stroke-width:2px;
    classDef ci fill:#D6EAF8,stroke:#2874A6,stroke-width:2px;
```
