# adlansadou/3d-vulkan-renderer architecture

> Architecture diagram of the GitHub repository adlansadou/3d-vulkan-renderer, 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/adlansadou/3d-vulkan-renderer
- Repository: https://github.com/adlansadou/3d-vulkan-renderer

## Overview

##### Main Components
- Framework Module – Contains the core rendering engine implementation with Vulkan objects (e.g., VKDevice, VKRenderer, VKImage), helper and math utilities, and integration of ImGUI for immediate GUI support. It’s also where the cross-cutting concerns of graphics (shader compilation, buffer management, etc.) are developed.
- Game Module – Holds the game-specific logic and any tie-ins that connect the framework to the actual game content. It acts as the consumer of the Framework functionalities.
- Platform Module – Provides the entry point (main.cpp) and any platform-specific initialization or wrappers (possibly for SDL2 or similar libraries) which allow the engine to run on a specific operating system or hardware platform.
- Assets and Shaders – Represent external data that the engine uses, including models (GLTF files), textures (KTX images), lighting assets, and compiled shaders. There are build scripts (e.g., compile_shaders.bat) to preprocess these assets.
- Vendors and Third Party Libraries – Although not expanded in the architecture, components like SDL2, cgltf, stb_image, GLM, and ImGUI are integral and should be noted as external dependencies that integrate with the core engine.

##### Relationships and Interactions
- The Platform component initializes the application (via main.cpp) and sets up the runtime environment. It then invokes the Game module.
- The Game module leverages the Framework for rendering, manages game states, and handles high-level logic. It interacts with the Framework API functions and possibly uses assets from the assets directory.
- The Framework interacts with Vulkan and encapsulates low-level rendering operations. It manages devices, buffers, textures, and even integrates ImGUI for debugging or immediate GUI rendering.
- Assets and Shaders are loaded by the Framework (or Game) at startup, and any precompiled shaders are integrated into the Vulkan pipeline via files found in the shaders directory.
- External libraries (SDL2, etc.) are used across these modules to provide windowing, input, and other utilities even if not used directly for rendering.

##### Architectural Patterns and Design Principles
- Modularity: The separation into Framework, Game, and Platform allows for clear boundaries—decoupling low-level rendering details from game logic and platform management.
- Dependency Inversion/Abstraction: The game code likely calls abstracted interfaces from the Framework (instead of direct Vulkan calls), facilitating easier testing and extension.
- Integration of Third-Party Libraries: Clearly identify points where these libraries are injected or used (for example, ImGUI integration is visible in the Framework, and SDL2 might be used in the Platform layer).

##### Final Recommendations
- Every component is clearly labeled with its role (e.g., “Vulkan Renderer (Framework)”, “Game Logic”, “Platform Initialization”, “Asset Loader”).

## Diagram (Mermaid)

```mermaid
graph TD
    subgraph "Platform Layer"
        P["Platform Initialization<br/>(Platform/main.cpp)"]:::platform
    end

    subgraph "Game Layer"
        G["Game Module<br/>(game.cpp)"]:::game
    end

    subgraph "Framework Layer"
        F["Framework Module<br/>(VKRenderer, VKDevice, ImGUI)"]:::framework
    end

    subgraph "Assets & External"
        A["Assets & Shaders<br/>(assets/, shaders/)"]:::assets
        V["Third Party Libraries<br/>(vendor/)"]:::vendor
    end

    %% Connections
    P -->|"initializes"| G
    G -->|"calls"| F
    F -->|"loads"| A
    F -->|"integrates"| V
    G -->|"utilizes"| A

    %% Click Events
    click P "https://github.com/adlansadou/3d-vulkan-renderer/blob/main/Platform/main.cpp"
    click G "https://github.com/adlansadou/3d-vulkan-renderer/tree/main/Game/"
    click F "https://github.com/adlansadou/3d-vulkan-renderer/tree/main/Framework/"
    click A "https://github.com/adlansadou/3d-vulkan-renderer/tree/main/assets/"
    click V "https://github.com/adlansadou/3d-vulkan-renderer/tree/main/vendor/"

    %% Styles
    classDef platform fill:#ffcc00,stroke:#333,stroke-width:2px;
    classDef game fill:#99ff99,stroke:#333,stroke-width:2px;
    classDef framework fill:#99ccff,stroke:#333,stroke-width:2px;
    classDef assets fill:#ff9999,stroke:#333,stroke-width:2px;
    classDef vendor fill:#cc99ff,stroke:#333,stroke-width:2px;
```
