# cschied/q2vkpt architecture

> Architecture diagram of the GitHub repository cschied/q2vkpt, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2024-12-27). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/cschied/q2vkpt
- Repository: https://github.com/cschied/q2vkpt

## Overview

##### Main Components

a) Core Engine Layer:
- Client System
- Server System
- Common Systems
- Refresh/Rendering Systems

b) Platform-Specific Implementations:
- Windows Implementation
- Unix Implementation

c) Rendering Pipeline:
- VKPT (Vulkan Path Tracing)
- GL (OpenGL)
- SW (Software Rendering)

**[Platform Layer (Windows/Unix)]**
- ↕
**[Core Engine Layer]**
- ↕
**[Rendering Systems]**
- ↕
**[Graphics API Layer (Vulkan/OpenGL)]**

##### Component Details

a) Core Engine Components:
- Client (src/client/)
- Server (src/server/)
- Common (src/common/)
- Input Systems
- Sound Systems

b) VKPT Rendering Pipeline:
- Path Tracer
- ASVGF (Adaptive Spatiotemporal Variance-Guided Filtering)
- Shader Pipeline
- Vulkan Interface

c) Resource Management:
- Connections to:
- Model Management
- Texture Systems
- Sound Systems
- BSP Processing

##### Implementation Details

- Shader Pipeline (src/refresh/vkpt/shader/)
- Sound System (src/client/sound/)
- Network Layer (src/common/net/)

##### Notes

Annotations for:
- Vulkan requirements
- Platform-specific considerations
- Performance-critical paths
- Real-time path tracing specifics

This system design should clearly show how the modern path tracing capabilities are integrated into the classic Quake II engine architecture, highlighting both the original engine components and the new VKPT-specific elements.

## Diagram (Mermaid)

```mermaid
graph TB
    %% Style Definitions
    classDef core fill:#b3d1ff,stroke:#333,stroke-width:2px
    classDef platform fill:#ffeb99,stroke:#333,stroke-width:2px
    classDef rendering fill:#90EE90,stroke:#333,stroke-width:2px
    classDef pathtracing fill:#ff9999,stroke:#333,stroke-width:2px
    classDef support fill:#e6e6e6,stroke:#333,stroke-width:2px

    %% Platform Layer
    subgraph PlatformLayer
        WinImpl["Windows Implementation"]:::platform
        UnixImpl["Unix Implementation"]:::platform
        PlatformAbs["Platform Abstraction"]:::platform
    end

    %% Core Engine Layer
    subgraph CoreEngine
        Client["Client System"]:::core
        Server["Server System"]:::core
        Common["Common Systems"]:::core
        Input["Input Systems"]:::core
        Sound["Sound System"]:::core
        Network["Network Layer"]:::core
        Protocol["Client/Server Protocol"]:::core
    end

    %% Rendering Systems
    subgraph RenderingSystems
        VKPT["VKPT Renderer"]:::rendering
        GL["OpenGL Renderer"]:::rendering
        SW["Software Renderer"]:::rendering
    end

    %% Path Tracing Components
    subgraph PathTracingSystem
        PathTracer["Path Tracer"]:::pathtracing
        ASVGF["ASVGF Filter"]:::pathtracing
        ShaderPipe["Shader Pipeline"]:::pathtracing
        VulkanInt["Vulkan Interface"]:::pathtracing
        LightHier["Light Hierarchy"]:::pathtracing
    end

    %% Resource Management
    subgraph ResourceManagement
        ModelMgmt["Model Management"]:::support
        BSP["BSP Processing"]:::support
    end

    %% Relationships
    WinImpl & UnixImpl --> PlatformAbs
    PlatformAbs --> CoreEngine
    Client --> Protocol
    Server --> Protocol
    Client --> Input
    Client --> Sound
    Common --> Network
    CoreEngine --> RenderingSystems
    VKPT --> PathTracingSystem
    PathTracer --> ASVGF
    PathTracer --> LightHier
    VKPT --> VulkanInt
    VKPT --> ShaderPipe
    RenderingSystems --> ResourceManagement

    %% Click Events
    click Client "https://github.com/cschied/q2vkpt/tree/master/src/client/"
    click Server "https://github.com/cschied/q2vkpt/tree/master/src/server/"
    click Common "https://github.com/cschied/q2vkpt/tree/master/src/common/"
    click VKPT "https://github.com/cschied/q2vkpt/tree/master/src/refresh/vkpt/"
    click GL "https://github.com/cschied/q2vkpt/tree/master/src/refresh/gl/"
    click SW "https://github.com/cschied/q2vkpt/tree/master/src/refresh/sw/"
    click WinImpl "https://github.com/cschied/q2vkpt/tree/master/src/windows/"
    click UnixImpl "https://github.com/cschied/q2vkpt/tree/master/src/unix/"
    click PathTracer "https://github.com/cschied/q2vkpt/blob/master/src/refresh/vkpt/path_tracer.c"
    click ASVGF "https://github.com/cschied/q2vkpt/blob/master/src/refresh/vkpt/asvgf.c"
    click ShaderPipe "https://github.com/cschied/q2vkpt/tree/master/src/refresh/vkpt/shader/"
    click Sound "https://github.com/cschied/q2vkpt/tree/master/src/client/sound/"
    click Network "https://github.com/cschied/q2vkpt/tree/master/src/common/net/"
    click LightHier "https://github.com/cschied/q2vkpt/blob/master/src/refresh/vkpt/light_hierarchy.c"
    click VulkanInt "https://github.com/cschied/q2vkpt/blob/master/src/refresh/vkpt/vk_util.c"
    click BSP "https://github.com/cschied/q2vkpt/blob/master/src/common/bsp.c"
    click ModelMgmt "https://github.com/cschied/q2vkpt/blob/master/src/refresh/models.c"
    click Protocol "https://github.com/cschied/q2vkpt/blob/master/inc/common/protocol.h"
    click Input "https://github.com/cschied/q2vkpt/blob/master/inc/client/input.h"
    click PlatformAbs "https://github.com/cschied/q2vkpt/blob/master/inc/shared/platform.h"

    %% Legend
    subgraph Legend
        L1["Core Components"]:::core
        L2["Platform Layer"]:::platform
        L3["Rendering Systems"]:::rendering
        L4["Path Tracing"]:::pathtracing
        L5["Support Systems"]:::support
    end
```
