# krixtalx/nimbus architecture

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

- Interactive diagram: https://gitdiagram.com/krixtalx/nimbus
- Repository: https://github.com/krixtalx/nimbus

## Overview

##### Main Components
- Application Layer (the “App” directory): This is where the main executable resides. It includes:
- The UI system: With dedicated files for different GUI windows (e.g., Inspector, Debug, Stats, Settings) and popups. It also manages user interactions.
- Entry point and application initialization (e.g., main.cpp, Application.cpp/h).
- Core Engine (the “Core” folder): This contains the lower-level functionality and infrastructure:
- Graphics Subsystem: Rendering, shader management, texture and framebuffer handling.
- Data Management: Structures for point clouds, meshes (meshlets/pointlets), and geometry types.
- Managers and Utilities: Input, memory, file management, resource management, and utility functions (e.g., for base64, JSON, file dialogs, and progress bars).
- Camera and scene management: Handling camera projection and navigation through the virtualized scene.
- Assets & Shaders (inside “App/Assets”): These include shader programs for both compute and rendering (e.g., ComputeShaders for composing images, depth and point cloud processing; RenderShaders for drawing points, triangles, grids, etc.).
- External Dependencies & Build Scripts: The vcpkg.json file and project scripts for Windows and Linux setup determine how dependencies are managed and the build process is organized.

##### Relationships and Interactions
- Trace user inputs passing into the Core engine where the camera, scene rendering, and data management take over.
- How the Core graphics subsystem interacts with the GPU via:
- Compute shaders: Offloading tasks like point cloud culling, LoD subsampling, hole-filling.
- Rendering shaders: Drawing the visual result (meshes, grids, overlays) to the screen.
- Interaction between on-demand disk I/O (via the file manager and utilities) and graphics resource updates. This shows how point cloud data is fetched and moved into GPU memory as needed.

##### Architectural Patterns and Design Principles
- The system leverages modular design, separating UI from the rendering core for maintainability.
- There is a clear division between front-end (interactive application presentation and UI) and back-end (data management and graphics rendering).
- Data flow is highly specialized toward streaming large point cloud data, indicating asynchronous and demand-driven data fetching from disk to CPU and GPU.

## Diagram (Mermaid)

```mermaid
graph TD
  subgraph "Application Layer (UI)"
    entry["Entry Point\nmain.cpp"]:::ui
    uiSys["UI System\n(Inspector,Debug,Stats,Settings,Popups)"]:::ui
  end

  subgraph "Core Engine"
    camera["Camera & Scene Management"]:::core
    graphics["Graphics Subsystem\n(Rendering,Shader Management,Texture/Framebuffer)"]:::core
    dataMgt["Data Management\n(PointClouds,Meshlets,Geometry)"]:::core
    managers["Managers & Utilities\n(Input,Memory,File/Resource)"]:::core
    diskIO["Disk I/O\n(File Manager)"]:::core
  end

  subgraph "GPU Interaction Layer"
    compute["Compute Shader Pipeline\n(Culling,LoD,HoleFilling)"]:::gpu
    render["Rendering Shader Pipeline\n(DrawingPoints,Meshes,Grids)"]:::gpu
  end

  subgraph "External & Build"
    externalDep["External Dependencies\n(vcpkg.json)"]:::external
    buildScripts["Build Scripts\n(Setup-Linux.sh,Setup-Windows.bat)"]:::external
  end

  %% Connections
  entry --> uiSys
  uiSys --> camera
  uiSys --> graphics
  uiSys --> dataMgt
  uiSys --> managers
  diskIO --> managers
  graphics --> compute
  graphics --> render
  managers --> compute
  render -->|"RenderedOutput"| uiSys
  externalDep --- buildScripts
  externalDep --> managers
  externalDep --> uiSys
  externalDep --> graphics

  %% Click Events
  click entry "https://github.com/krixtalx/nimbus/tree/main/App/Source"
  click uiSys "https://github.com/krixtalx/nimbus/tree/main/App/Source/UI"
  click graphics "https://github.com/krixtalx/nimbus/tree/main/Core/Source/Graphics"
  click dataMgt "https://github.com/krixtalx/nimbus/tree/main/Core/Source/DataTypes"
  click managers "https://github.com/krixtalx/nimbus/tree/main/Core/Source/Managers"
  click camera "https://github.com/krixtalx/nimbus/tree/main/Core/Source/Camera"
  click diskIO "https://github.com/krixtalx/nimbus/tree/main/Core/Source/IO"
  click compute "https://github.com/krixtalx/nimbus/tree/main/App/Assets/Shaders/ComputeShaders"
  click render "https://github.com/krixtalx/nimbus/tree/main/App/Assets/Shaders/RenderShaders"
  click externalDep "https://github.com/krixtalx/nimbus/blob/main/vcpkg.json"
  click buildScripts "https://github.com/krixtalx/nimbus/tree/main/Project Scripts"

  %% Styles
  classDef ui fill:#f9c74f,stroke:#000,stroke-width:2px;
  classDef core fill:#90be6d,stroke:#000,stroke-width:2px;
  classDef gpu fill:#f9844a,stroke:#000,stroke-width:2px;
  classDef external fill:#577590,stroke:#000,stroke-width:2px;
```
