# mrsinho/sidera architecture

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

- Interactive diagram: https://gitdiagram.com/mrsinho/sidera
- Repository: https://github.com/mrsinho/sidera

## Overview

##### Main Components
- Data Input & Configuration:
- Core Engine & Simulation:
- The “sidera/src” files (gaia-sim.c and sidera.c) implement the logic for simulation and management of celestial bodies.
- Graphics Rendering:
- The rendering pipeline is encapsulated in the “sidera/shaders” directory. There are shader sources (GLSL) that are compiled to SPIR-V for the Vulkan API.
- Integration with external libraries (shvulkan, shengine, glfw, cglm) is used to interface with the Vulkan API and manage windowing, math operations, and other engine functionalities.
- Build and Cross-Platform Support:
- The “.shci” folder contains continuous integration/build scripts for different platforms (Linux and Windows), ensuring consistent builds and logging.
- Documentation & External Dependencies:
- The “docs” directory contains developer documentation (using Doxygen) that outlines API details and build instructions.
- The “externals” directory includes repositories such as gaia-archive-tools and shengine used to further support Sidera’s functionality.

##### Relationships and Interactions
- Data Flow:
- Configuration files (.smd) → Configuration Loader → Core Engine.
- Gaia data (loaded separately via gaia-archive-tools and possibly fetched using scripts or external utilities) → Core Engine.
- Rendering Pipeline:
- Core engine modules (sidera.c, gaia-sim.c) process simulation data and interact with the graphics rendering pipeline.
- Shader code (under sidera/shaders) is compiled and fed into the Vulkan-based renderer (via shvulkan) to produce the actual 3D graphics.
- External Dependencies Integration:
- Incorporate libraries such as glfw (for window management), cglm (for math operations), and shengine (for additional engine logic) as supportive layers that interact with the core engine.
- Build & Deployment:
- Continuous integration (under .shci) ensures builds for both Linux and Windows are carried out through separate scripts, feeding into the overall release process.

##### Architectural Patterns and Design Principles
- Separation of Concerns:
- Clear separation between data/configuration loading, simulation logic, and rendering.
- Modularity:
- The structure supports replacing or updating individual components (for example, swapping out shader modules or updating the graphics engine via shengine).
- Cross-Platform Build Strategy:
- The presence of platform-specific build scripts under .shci demonstrates a modular and maintainable build system.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Data Input & Configuration Layer
    subgraph "Data Input & Configuration"
        direction TB
        Config["Configuration Files (.smd)"]:::input
        Gaia["Gaia Data Loader"]:::input
    end

    %% Core Processing Layer
    subgraph "Core Processing"
        direction TB
        Simulation["Simulation Engine"]:::core
    end

    %% Rendering Layer
    subgraph "Rendering"
        direction TB
        Shader["Graphics Rendering Pipeline"]:::render
        Vulkan["Vulkan API Renderer (shvulkan)"]:::render
    end

    %% Support & External Dependencies Layer
    subgraph "Support & External"
        direction TB
        CI["CI/CD Build Scripts"]:::build
        Docs["Documentation"]:::docs
        ExtLib["External Libraries"]:::external
    end

    %% Data Flow Connections
    Config -->|"load"| Simulation
    Gaia -->|"ingest"| Simulation

    Simulation -->|"process"| Shader

    Shader -->|"compileFeed"| Vulkan

    ExtLib -->|"support"| Simulation
    ExtLib -->|"support"| Shader

    CI -->|"buildDeploy"| Simulation
    CI -->|"buildDeploy"| Shader

    Docs -->|"referTo"| Simulation
    Docs -->|"referTo"| Shader

    %% Click Events
    click Config "https://github.com/mrsinho/sidera/tree/main/sidera/smd"
    click Simulation "https://github.com/mrsinho/sidera/tree/main/sidera/src"
    click Shader "https://github.com/mrsinho/sidera/tree/main/sidera/shaders"
    click CI "https://github.com/mrsinho/sidera/blob/main/.shci"
    click Docs "https://github.com/mrsinho/sidera/tree/main/docs"
    click ExtLib "https://github.com/mrsinho/sidera/tree/main/externals"

    %% Styles
    classDef input fill:#FFD700,stroke:#333,stroke-width:2px;
    classDef core fill:#87CEEB,stroke:#333,stroke-width:2px;
    classDef render fill:#90EE90,stroke:#333,stroke-width:2px;
    classDef build fill:#FFB6C1,stroke:#333,stroke-width:2px;
    classDef docs fill:#DDA0DD,stroke:#333,stroke-width:2px;
    classDef external fill:#FFA07A,stroke:#333,stroke-width:2px;
```
