# j-cowsert/so-so-engine architecture

> Architecture diagram of the GitHub repository j-cowsert/so-so-engine, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-03-29). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/j-cowsert/so-so-engine
- Repository: https://github.com/j-cowsert/so-so-engine

## Overview

##### Main Components
- So-so Engine Core (located primarily in the so-so directory):
- Core: This includes Application, Window, Input, Layer management, Logging, and other utility functions.
- Renderer: Contains implementations for rendering such as Mesh, Shader, Texture, Vertex Array, and abstraction of the rendering API.
- RendererAPI: Specifically your OpenGL abstraction (e.g., OpenGLRendererAPI, OpenGLBuffer, OpenGLShader, etc.).
- Events: Modules for application, key, and mouse events.
- Asset Management: Components like TextureImporter.
- ImGui Integration: Contains files to integrate ImGui for UI (ImGuiLayer, ImGuiBuild.cpp).
- Sandbox Application (located in the Sandbox directory):
- Demo Layers: EditorLayer, ShaderToyLayer, and TestLayer.
- Asset Resources: Models, Shaders, Textures that are used by the Sandbox demo.
- Miscellaneous: Helper headers like Model.h and Skybox.h, plus the SandboxApp.cpp implementation.

##### Relationships and Interactions
- The Engine Core provides the foundation for the application’s execution (Application / Window / Input and Event management).
- Layers are stacked within the engine allowing the Sandbox to add different application layers such as the Editor and test layers.
- The Asset Management subsystem feeds the Renderer with textures and models, which are stored in the Sandbox’s assets directory.
- ImGui integration facilitates a graphical interface over the engine’s core functionality.

##### Architectural Patterns & Design Principles
- Modularity: Components are clearly separated (Core, Renderer, Assets, Events, etc.).
- Abstraction: The use of RendererAPI (with OpenGL specifics) abstracts away low-level details from engine users.
- Layered Architecture: The engine leverages a layered system to structure different application aspects (rendering, UI, input, etc.).
- Extensibility: The Sandbox provides a practical demo to extend or test engine functionalities.

## Diagram (Mermaid)

```mermaid
graph TD
    subgraph "So-so Engine Core"
        direction TB
        Core["Core System (Application, Window, LayerStack, Input, Log)"]:::core
        Events["Events (ApplicationEvent, KeyEvent, MouseEvent)"]:::events
        AssetMgmt["Asset Management (TextureImporter)"]:::asset
        Renderer["Renderer (Mesh, Shader, Texture, VertexArray)"]:::renderer
        RendererAPI["RendererAPI (OpenGL)"]:::renderer
        ImGui["ImGui Integration (ImGuiLayer, ImGuiBuild)"]:::core
    end

    subgraph "Sandbox Application"
        direction TB
        DemoLayers["Demo Layers (EditorLayer, ShaderToyLayer, TestLayer)"]:::sandbox
        Assets["Asset Resources (Models, Shaders, Textures)"]:::sandbox
        Misc["Miscellaneous Helpers/Main (Model, Skybox, SandboxApp)"]:::sandbox
    end

    %% Relationships and Data Flow
    Core -->|"handles"| Events
    AssetMgmt -->|"supplies"| Renderer
    Renderer -->|"uses"| RendererAPI
    Assets -->|"provides"| AssetMgmt
    Assets -->|"supplies"| Renderer
    DemoLayers -->|"renders"| Renderer
    Core -->|"manages"| DemoLayers
    Misc -->|"initializes"| Core
    Core -->|"integrates"| ImGui

    %% Click Events
    click Core "https://github.com/j-cowsert/so-so-engine/tree/main/so-so/src/so-so/Core"
    click Renderer "https://github.com/j-cowsert/so-so-engine/tree/main/so-so/src/so-so/Renderer"
    click RendererAPI "https://github.com/j-cowsert/so-so-engine/tree/main/so-so/src/so-so/RendererAPI/OpenGL"
    click Events "https://github.com/j-cowsert/so-so-engine/tree/main/so-so/src/so-so/Events"
    click AssetMgmt "https://github.com/j-cowsert/so-so-engine/blob/main/so-so/src/so-so/Asset/TextureImporter.cpp"
    click ImGui "https://github.com/j-cowsert/so-so-engine/tree/main/so-so/src/so-so/ImGui"
    click DemoLayers "https://github.com/j-cowsert/so-so-engine/tree/main/Sandbox/src"
    click Assets "https://github.com/j-cowsert/so-so-engine/tree/main/Sandbox/assets"
    click Misc "https://github.com/j-cowsert/so-so-engine/tree/main/Sandbox/src/Misc"

    %% Styles
    classDef core fill:#B3E5FC,stroke:#0277BD,stroke-width:2px;
    classDef renderer fill:#C8E6C9,stroke:#2E7D32,stroke-width:2px;
    classDef events fill:#FFCDD2,stroke:#C62828,stroke-width:2px;
    classDef asset fill:#FFF9C4,stroke:#F9A825,stroke-width:2px;
    classDef sandbox fill:#D1C4E9,stroke:#512DA8,stroke-width:2px;
```
