# semmu/sdl_universe architecture

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

- Interactive diagram: https://gitdiagram.com/semmu/sdl_universe
- Repository: https://github.com/semmu/sdl_universe

## Overview

##### Main Components

a) Core Rendering System
- Primitive rendering components (points, lines, triangles)
- Pixel manipulation system

b) Object Management System
- Model management
- Object hierarchy system
- Transformation pipeline

c) Camera System
- Camera management component
- View transformation pipeline

d) SDL Interface Layer
- Surface management
- Pipeline (SDL1/SDL2 compatibility layer)

##### Component Relationships

**[Application Layer]**
- ↓
**[SDL_Universe Core (SU)]**
- ↓
**[SDL Interface Layer]**
- ↓
**[SDL Library]**

##### Detailed Component Breakdown

**Core Components (SU namespace):**

- SU::Model     |←----+
- Primitives    |     |
- Transform     |     |

- ↓              |

- SU::Object     |----+
- Hierarchy      |
- Transformations|

**Rendering Pipeline:**

- Primitive System |
- Points         |
- Lines          |
- Triangles      |

- ↓

- Pixel Management |
- Z-buffer       |

- SDL Interface  |

- SDL1   |  |

- SDL2   |  |

- SU::Math      |
- Transformations|
- Calculations   |

##### Implementation Details

- SU.h/cpp: Core functionality
- SU_primitives.h/cpp: Primitive rendering
- SU_pixelmanip.h/cpp: Pixel manipulation
- SU_math.h/cpp: Mathematical operations
- SU_etc.h/cpp: Utility functions

##### Additional Notes

- Double lines: Data flow

- Notes about performance considerations:
- SDL1 vs SDL2 performance characteristics
- Surface management optimization points

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Application
        APP[Main Application]:::app
    end

    subgraph SDL_Universe_Core
        SU[SU Core]:::core
        PRIM[Primitive System]:::core
        PIXEL[Pixel Management]:::core
        MATH[Mathematical Components]:::core
        OBJ[Object Management]:::core
        UTIL[Utility Functions]:::core
    end

    subgraph SDL_Interface
        SDL_IF[SDL Interface Layer]:::sdl
        subgraph SDL_Backends
            SDL1[SDL1 Backend]:::sdl
            SDL2[SDL2 Backend]:::sdl
        end
    end

    subgraph External
        SDL[SDL Library]:::external
    end

    %% Relationships
    APP --> SU
    SU --> PRIM
    SU --> PIXEL
    SU --> MATH
    SU --> OBJ
    SU --> UTIL
    PRIM --> PIXEL
    OBJ --> MATH
    SU --> SDL_IF
    SDL_IF --> SDL1
    SDL_IF --> SDL2
    SDL1 & SDL2 --> SDL

    %% Click Events
    click APP "https://github.com/Semmu/sdl_universe/blob/master/src/main.cpp"
    click SU "https://github.com/Semmu/sdl_universe/blob/master/include/SDL_Universe/SU.h"
    click PRIM "https://github.com/Semmu/sdl_universe/blob/master/include/SDL_Universe/SU_primitives.h"
    click PIXEL "https://github.com/Semmu/sdl_universe/blob/master/include/SDL_Universe/SU_pixelmanip.h"
    click MATH "https://github.com/Semmu/sdl_universe/blob/master/include/SDL_Universe/SU_math.h"
    click UTIL "https://github.com/Semmu/sdl_universe/blob/master/include/SDL_Universe/SU_etc.h"
    click SDL_IF "https://github.com/Semmu/sdl_universe/blob/master/include/SDL_Universe/SU.h"

    %% Styles
    classDef core fill:#3498db,stroke:#2980b9,color:white
    classDef sdl fill:#f1c40f,stroke:#f39c12,color:black
    classDef external fill:#95a5a6,stroke:#7f8c8d,color:white
    classDef app fill:#2ecc71,stroke:#27ae60,color:white

    %% Legend
    subgraph Legend
        L1[Core Components]:::core
        L2[SDL Components]:::sdl
        L3[External Dependencies]:::external
        L4[Application]:::app
    end
```
