# nikchouhan/spar architecture

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

- Interactive diagram: https://gitdiagram.com/nikchouhan/spar
- Repository: https://github.com/nikchouhan/spar

## Overview

##### Project Type Analysis
This is a graphics rendering engine project focusing on DirectX 11 implementation with various rendering techniques. The architecture should reflect a typical game engine's rendering pipeline.

##### Main Components

A. Core Layer:
- Buffer Management
- Camera System
- Logging System
- Model Loading
- Shader Management
- Texture Management
- Window Utilities

B. Renderer Layer:
- Above the Core layer
- Handles the main rendering pipeline
- Manages rendering techniques (current and planned)

C. Asset Management:
- Relationship with:
- Model loading (.gltf files)
- Shader management (HLSL files)
- Texture handling (DDS files)

D. Application Layer:
- Top-level component
- Manages the application lifecycle
- Interfaces with the renderer

**Rectangle: Core systems**
**Hexagon: Renderer components**
**Rounded Rectangle: Application layer**

**Blue: Core systems**
**Green: Renderer components**
**Yellow: Asset management**
**Purple: Application layer**

##### Detailed Component Relationships

**Application Layer**
- ↓↑
**Renderer Layer**
- ↓↑
**Core Systems → Asset Management**

##### Future Components
- Lighting system
- Shadow mapping
- Post-processing effects (HDR, Bloom)
- PBR pipeline
- Deferred rendering

##### Technical Details
- DirectX 11 as the graphics API
- GLTF model format support
- HLSL shader pipeline
- Texture formats (DDS)

##### Specific Implementation Notes
- Relationship between Model, Shader, and Texture classes
- Camera system's integration
- Demonstrate the rendering pipeline flow
- ImGui integration for debug/development tools

## Diagram (Mermaid)

```mermaid
graph TB
    %% Styles and Classes
    classDef core fill:#a8d1f0,stroke:#333
    classDef renderer fill:#98fb98,stroke:#333
    classDef asset fill:#fff59d,stroke:#333
    classDef app fill:#e1bee7,stroke:#333
    classDef planned fill:none,stroke:#999,stroke-dasharray: 5 5

    %% Application Layer
    AppLayer["Application Layer"]:::app
    EntryPoint["Entry Point"]:::app
    
    %% Renderer Layer
    RenderSystem["Rendering System"]:::renderer
    
    %% Core Systems
    subgraph CoreSystems["Core Systems"]
        BufferMgmt["Buffer Management"]:::core
        CameraSys["Camera System"]:::core
        LogSys["Logging System"]:::core
        ModelSys["Model System"]:::core
        ShaderMgmt["Shader Management"]:::core
        TextureMgmt["Texture Management"]:::core
        WinUtils["Windows Utilities"]:::core
    end
    
    %% Asset Management
    subgraph AssetMgmt["Asset Management"]
        ModelLoader["Model Loader (GLTF)"]:::asset
        TextureLoader["Texture Loader"]:::asset
        ShaderCompiler["Shader Compiler"]:::asset
    end
    
    %% Planned Features
    PBR["PBR System"]:::planned
    HDR["HDR Pipeline"]:::planned
    PostProcess["Post Processing"]:::planned
    
    %% Relationships
    AppLayer --> RenderSystem
    RenderSystem --> CoreSystems
    RenderSystem --> AssetMgmt
    
    ModelLoader --> ModelSys
    TextureLoader --> TextureMgmt
    ShaderCompiler --> ShaderMgmt
    
    RenderSystem -.-> PBR
    RenderSystem -.-> HDR
    RenderSystem -.-> PostProcess
    
    EntryPoint --> AppLayer
    
    %% Click Events
    click BufferMgmt "https://github.com/NikChouhan/Spar/blob/master/src/Core/Buffer.h"
    click CameraSys "https://github.com/NikChouhan/Spar/blob/master/src/Core/Camera.h"
    click LogSys "https://github.com/NikChouhan/Spar/blob/master/src/Core/Log.h"
    click ModelSys "https://github.com/NikChouhan/Spar/blob/master/src/Core/Model.h"
    click ShaderMgmt "https://github.com/NikChouhan/Spar/blob/master/src/Core/Shader.h"
    click TextureMgmt "https://github.com/NikChouhan/Spar/blob/master/src/Core/Texture.h"
    click WinUtils "https://github.com/NikChouhan/Spar/blob/master/src/Core/WinUtil.h"
    click RenderSystem "https://github.com/NikChouhan/Spar/blob/master/src/Renderer/renderer.h"
    click ModelLoader "https://github.com/NikChouhan/Spar/tree/master/assets/models/"
    click TextureLoader "https://github.com/NikChouhan/Spar/tree/master/assets/textures/"
    click ShaderCompiler "https://github.com/NikChouhan/Spar/tree/master/assets/shaders/"
    click AppLayer "https://github.com/NikChouhan/Spar/blob/master/Application.h"
    click EntryPoint "https://github.com/NikChouhan/Spar/blob/master/main.cpp"

    %% Legend
    subgraph Legend
        L1["Current Features"]:::core
        L2["Renderer Components"]:::renderer
        L3["Asset Management"]:::asset
        L4["Application Layer"]:::app
        L5["Planned Features"]:::planned
    end
```
