# christt105/elit3d architecture

> Architecture diagram of the GitHub repository christt105/elit3d, 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/christt105/elit3d
- Repository: https://github.com/christt105/elit3d

## Overview

##### Main Components
- Core Application – Represent the “Core” directory (Application.cpp, Main.cpp, Globals.h) as the engine’s entry point and management of the overall application lifecycle.
- Editor Panels – These are the UI components located in the “Panels” directory (with panels such as p1About, p1Configuration, p1Console, p1DebugResources, p1Inspector, p1Layers, p1ObjectEditor, p1Objects, p1Resources, p1Scene, p1Tileset, and p1Tools) and form the graphical front end through which the user interacts with the tool.
- Objects/Components – The “Objects” directory (with Components like c1Material, c1Mesh, c1Transform, etc.) to represent the editable entities within the scene.
- Resources – Managed in the “Resources” folder (r1Map, r1Mesh, r1Model, r1Object, r1Shader, r1Texture, r1Tileset, r1Tileset3d). These components load and manage the data assets used in the editor.
- External Tools/Third-Party Libraries – Group the “ExternalTools” subdirectories (SDL2, Assimp, DevIL, GLEW, ImGui, JSON, MathGeoLib, etc.) into one section that represents dependencies for rendering, UI, file importing, image processing, and math operations.
- Tools Subsystem – Another layer for “Tools” (FileSystem, Importers, Map, OpenGL helpers, System information, Logger, Timer, etc.) which provide utility functions and services that support the core modules.

- Arrowed links from the UI panels (editor front-end) to modules such as m1Events and m1GUI—indicating that user inputs are captured and forwarded to the core engine.
- Interaction flows between the “Tools” subsystem (like FileSystem, Logger, OSUtils, Profiler) and the Core/Modules. For instance, the FileSystem is used by both the Core and the Importers when loading map or model data.

##### Architectural Patterns / Design Principles
- Layered Architecture: The editor naturally fits a layered structure—from the low-level External Libraries (hardware and OS abstraction, graphical rendering, asset loading) up to the Tools subsystem, then the Engine Core and Its Modules, with the Editor Panels sitting at the top as the user interface layer.
- Event and Input Flow: Show how user interaction flows from the Panels (UI) to modules (m1Events, m1Input) and then into updating the scene or triggering rendering.

##### Relevant Technologies, Frameworks, or Libraries
- SDL2 – For window management, input handling, and cross-platform compatibility.
- OpenGL/GLEW – For rendering; m1Render3D interacts closely with these libraries.
- ImGui – For immediate mode GUI drawing in the editor panels.
- Assimp – For importing 3D model assets.
- DevIL – For image and texture management.
- MathGeoLib – To support geometric calculations and collision detection.
- Other utilities, such as PCG (random engine), JSON (data handling), and pugiXML for configuration or resource files.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Core & Modules
    subgraph "Core & Modules"
        CA["Core Application"]:::core
        subgraph "Modules"
            M1["m1Camera3D"]:::module
            M2["m1Events"]:::module
            M3["m1GUI"]:::module
            M4["m1Importer"]:::module
            M5["m1Input"]:::module
            M6["m1MapEditor"]:::module
            M7["m1Objects"]:::module
            M8["m1Render3D"]:::module
            M9["m1Resources"]:::module
            M10["m1Scene"]:::module
            M11["m1UndoRedo"]:::module
            M12["m1Window"]:::module
        end
        CA -->|"connects"| M1
        CA -->|"connects"| M2
        CA -->|"connects"| M3
        CA -->|"connects"| M4
        CA -->|"connects"| M5
        CA -->|"connects"| M6
        CA -->|"connects"| M7
        CA -->|"connects"| M8
        CA -->|"connects"| M9
        CA -->|"connects"| M10
        CA -->|"connects"| M11
        CA -->|"connects"| M12
    end

    %% Editor Panels
    subgraph "Editor Panels"
        P1["p1About"]:::panel
        P2["p1Configuration"]:::panel
        P3["p1Console"]:::panel
        P4["p1DebugResources"]:::panel
        P5["p1Inspector"]:::panel
        P6["p1Layers"]:::panel
        P7["p1ObjectEditor"]:::panel
        P8["p1Objects"]:::panel
        P9["p1Resources"]:::panel
        P10["p1Scene"]:::panel
        P11["p1Tileset"]:::panel
        P12["p1Tools"]:::panel
    end

    %% Objects/Components
    subgraph "Objects/Components"
        O1["Components (c1Material, c1Mesh, c1Transform, ...)"]:::object
    end

    %% Resources
    subgraph "Resources"
        R1["Resource Management (r1Map, r1Mesh, r1Model, r1Object, r1Shader, r1Texture, r1Tileset, r1Tileset3d)"]:::resource
    end

    %% Tools Subsystem
    subgraph "Tools Subsystem"
        T1["Tools (FileSystem, Importers, Map, OpenGL helpers, Logger, Timer, etc.)"]:::tool
    end

    %% External Tools/Third-Party Libraries
    subgraph "External Tools"
        E1["Third-Party Libraries (SDL2, OpenGL/GLEW, ImGui, Assimp, DevIL, MathGeoLib, JSON, PCG)"]:::external
    end

    %% Interconnections
    %% Editor Panels interacting with Modules
    P1 -->|"UIEvent"| M2
    P1 -->|"UIUpdate"| M3

    %% Modules interacting with Objects/Components and Resources
    M7 -->|"manages"| O1
    M10 -->|"utilizes"| O1

    M7 -->|"loads"| R1
    M8 -->|"renders"| R1
    M10 -->|"loads"| R1

    %% Core and Modules using Tools Subsystem
    CA -->|"usesTools"| T1
    M4 -->|"importerUtil"| T1

    %% Modules and Tools using External Tools
    M8 -->|"usesLib"| E1
    M5 -->|"usesLib"| E1
    M3 -->|"usesLib"| E1
    T1 -->|"callsLib"| E1

    %% Click Events
    click CA "https://github.com/christt105/elit3d/tree/main/Elit3d/src/Core"
    click M1 "https://github.com/christt105/elit3d/tree/main/Elit3d/src/Modules"
    click M2 "https://github.com/christt105/elit3d/tree/main/Elit3d/src/Modules"
    click M3 "https://github.com/christt105/elit3d/tree/main/Elit3d/src/Modules"
    click M4 "https://github.com/christt105/elit3d/tree/main/Elit3d/src/Modules"
    click M5 "https://github.com/christt105/elit3d/tree/main/Elit3d/src/Modules"
    click M6 "https://github.com/christt105/elit3d/tree/main/Elit3d/src/Modules"
    click M7 "https://github.com/christt105/elit3d/tree/main/Elit3d/src/Modules"
    click M8 "https://github.com/christt105/elit3d/tree/main/Elit3d/src/Modules"
    click M9 "https://github.com/christt105/elit3d/tree/main/Elit3d/src/Modules"
    click M10 "https://github.com/christt105/elit3d/tree/main/Elit3d/src/Modules"
    click M11 "https://github.com/christt105/elit3d/tree/main/Elit3d/src/Modules"
    click M12 "https://github.com/christt105/elit3d/tree/main/Elit3d/src/Modules"
    click P1 "https://github.com/christt105/elit3d/tree/main/Elit3d/src/Panels"
    click P2 "https://github.com/christt105/elit3d/tree/main/Elit3d/src/Panels"
    click P3 "https://github.com/christt105/elit3d/tree/main/Elit3d/src/Panels"
    click P4 "https://github.com/christt105/elit3d/tree/main/Elit3d/src/Panels"
    click P5 "https://github.com/christt105/elit3d/tree/main/Elit3d/src/Panels"
    click P6 "https://github.com/christt105/elit3d/tree/main/Elit3d/src/Panels"
    click P7 "https://github.com/christt105/elit3d/tree/main/Elit3d/src/Panels"
    click P8 "https://github.com/christt105/elit3d/tree/main/Elit3d/src/Panels"
    click P9 "https://github.com/christt105/elit3d/tree/main/Elit3d/src/Panels"
    click P10 "https://github.com/christt105/elit3d/tree/main/Elit3d/src/Panels"
    click P11 "https://github.com/christt105/elit3d/tree/main/Elit3d/src/Panels"
    click P12 "https://github.com/christt105/elit3d/tree/main/Elit3d/src/Panels"
    click O1 "https://github.com/christt105/elit3d/tree/main/Elit3d/src/Objects/Components"
    click R1 "https://github.com/christt105/elit3d/tree/main/Elit3d/src/Resources"
    click T1 "https://github.com/christt105/elit3d/tree/main/Elit3d/src/Tools"
    click E1 "https://github.com/christt105/elit3d/tree/main/Elit3d/src/ExternalTools"

    %% Styles
    classDef core fill:#FAD7A0,stroke:#E67E22,stroke-width:2px;
    classDef module fill:#D5F5E3,stroke:#28B463,stroke-width:2px;
    classDef panel fill:#D6EAF8,stroke:#3498DB,stroke-width:2px;
    classDef object fill:#F9E79F,stroke:#F1C40F,stroke-width:2px;
    classDef resource fill:#FADBD8,stroke:#E74C3C,stroke-width:2px;
    classDef tool fill:#E8DAEF,stroke:#8E44AD,stroke-width:2px;
    classDef external fill:#D2B4DE,stroke:#9B59B6,stroke-width:2px;
```
