# orurh/metasimultor architecture

> Architecture diagram of the GitHub repository orurh/metasimultor, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-04). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/orurh/metasimultor
- Repository: https://github.com/orurh/metasimultor

## Overview

METASim is a desktop scene editor and simulation application centered on fire, terrain, agents, and rendered particle effects. The main workflow starts in the application loop: it updates and renders the scene, while an editor extension builds the UI and tools that let users modify it; scene files and recordings provide persistence and capture. The scene combines domain systems with graphics and prefab data. Several subsystem connections are based on declarations or the source index rather than implementation excerpts, so those links are marked unverified.

Main entry points: [`src/core/scene/Scene.cc`](https://github.com/orurh/metasimultor/blob/main/src/core/scene/Scene.cc) (Scene runtime), [`src/core/Application.cc`](https://github.com/orurh/metasimultor/blob/main/src/core/Application.cc) (Application loop), [`src/app/EditorExtension.cc`](https://github.com/orurh/metasimultor/blob/main/src/app/EditorExtension.cc) (Editor extension), [`src/ui/panels`](https://github.com/orurh/metasimultor/tree/main/src/ui/panels) (Editor panels)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Application"]
  node_main["Program entry<br/>[main.cc]"]
  node_application["Application loop<br/>[Application.cc]"]
  node_window["Window and input<br/>[Window.cc]"]
end

subgraph group_editor["Editor UI"]
  node_extension["Editor extension<br/>[EditorExtension.cc]"]
  node_editor_core["Editor and tools<br/>[Editor.h]"]
  node_editor_modules["Editor modules"]
  node_editor_panels["Editor panels"]
  node_preview["Prefab preview"]
end

subgraph group_domain["Scene Simulation"]
  node_scene["Scene runtime<br/>[Scene.cc]"]
  node_ecs["Entity components<br/>[Components.h]"]
  node_fire["Fire simulation"]
  node_agents["Agent manager<br/>[AgentManager.cc]"]
  node_terrain["Terrain<br/>[Terrain.cc]"]
  node_heatmap["Heat map<br/>[heatMap.h]"]
  node_time["Simulation time<br/>[SimulationTime.h]"]
  node_entt["Entity registry<br/>[entt.hpp]"]
end

subgraph group_data["Scene Data"]
  node_recorder["Scene recording<br/>[SceneRecorder.h]"]
  node_snapshots["Snapshot system<br/>[SnapshotSystem.cc]"]
  node_serializer["Scene serialization<br/>[SceneSerializer.cc]"]
  node_prefabs["Prefab system<br/>[PrefabSystem.cc]"]
end

subgraph group_graphics["Rendering"]
  node_renderer["Scene renderer<br/>[Renderer.cc]"]
  node_particles["Particle systems<br/>[ParticleSystem.cc]"]
  node_compute["Compute shaders<br/>[ComputeShader.cc]"]
  node_models["Models and materials<br/>[Model.h]"]
end

node_user(("Editor user"))

node_user -->|"edits scene"| node_extension
node_main -->|"starts"| node_application
node_application -->|"polls events"| node_window
node_application -->|"updates and renders"| node_scene
node_application -->|"dispatches hooks"| node_extension
node_application -->|"updates recording"| node_recorder
node_application -->|"loads and saves"| node_serializer
node_extension -->|"builds UI"| node_editor_core
node_extension -->|"registers modules"| node_editor_modules
node_extension -.->|"draws editor"| node_editor_panels
node_editor_panels -.->|"renders preview"| node_preview
node_editor_panels -.->|"edits scene"| node_scene
node_scene -.->|"manages agents"| node_agents
node_scene -.->|"runs fire model"| node_fire
node_scene -.->|"uses terrain"| node_terrain
node_scene -.->|"exposes heat map"| node_heatmap
node_scene -.->|"tracks simulation time"| node_time
node_scene -.->|"creates prefab agents"| node_prefabs
node_scene -.->|"stores components"| node_ecs
node_scene -.->|"uses registry"| node_entt
node_scene -.->|"renders scene"| node_renderer
node_scene -.->|"uses particle systems"| node_particles
node_fire -.->|"dispatches compute"| node_compute
node_renderer -.->|"draws models"| node_models
node_recorder -.->|"uses snapshots"| node_snapshots
node_preview -->|"renders prefab model"| node_models

click node_main "https://github.com/orurh/metasimultor/blob/main/src/main.cc"
click node_application "https://github.com/orurh/metasimultor/blob/main/src/core/Application.cc"
click node_window "https://github.com/orurh/metasimultor/blob/main/src/core/Window.cc"
click node_extension "https://github.com/orurh/metasimultor/blob/main/src/app/EditorExtension.cc"
click node_editor_core "https://github.com/orurh/metasimultor/blob/main/src/ui/Editor.h"
click node_editor_modules "https://github.com/orurh/metasimultor/tree/main/src/ui/modules"
click node_editor_panels "https://github.com/orurh/metasimultor/tree/main/src/ui/panels"
click node_scene "https://github.com/orurh/metasimultor/blob/main/src/core/scene/Scene.cc"
click node_ecs "https://github.com/orurh/metasimultor/blob/main/src/core/scene/Components.h"
click node_fire "https://github.com/orurh/metasimultor/blob/main/src/core/fire/FireSimulationSystem.cc"
click node_agents "https://github.com/orurh/metasimultor/blob/main/src/core/AgentManager.cc"
click node_terrain "https://github.com/orurh/metasimultor/blob/main/src/core/scene/Terrain.cc"
click node_heatmap "https://github.com/orurh/metasimultor/blob/main/src/core/scene/heatMap.h"
click node_time "https://github.com/orurh/metasimultor/blob/main/src/core/scene/SimulationTime.h"
click node_recorder "https://github.com/orurh/metasimultor/blob/main/src/core/snapshot/SceneRecorder.h"
click node_snapshots "https://github.com/orurh/metasimultor/blob/main/src/core/snapshot/SnapshotSystem.cc"
click node_serializer "https://github.com/orurh/metasimultor/blob/main/src/data/SceneSerializer.cc"
click node_prefabs "https://github.com/orurh/metasimultor/blob/main/src/data/PrefabSystem.cc"
click node_entt "https://github.com/orurh/metasimultor/blob/main/libs/entt/entt.hpp"
click node_renderer "https://github.com/orurh/metasimultor/blob/main/src/graphics/Renderer.cc"
click node_particles "https://github.com/orurh/metasimultor/blob/main/src/graphics/ParticleSystem/ParticleSystem.cc"
click node_compute "https://github.com/orurh/metasimultor/blob/main/src/graphics/ComputeShader.cc"
click node_models "https://github.com/orurh/metasimultor/blob/main/src/graphics/Model.h"
click node_preview "https://github.com/orurh/metasimultor/blob/main/src/ui/panels/PrefabPreviewRenderer.cc"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_main,node_application,node_window,node_user toneBlue
class node_extension,node_editor_core,node_editor_modules,node_editor_panels,node_preview toneAmber
class node_scene,node_ecs,node_fire,node_agents,node_terrain,node_heatmap,node_time,node_entt toneMint
class node_recorder,node_snapshots,node_serializer,node_prefabs toneRose
class node_renderer,node_particles,node_compute,node_models toneIndigo
```

## Components

### Application

- [Program entry](https://github.com/orurh/metasimultor/blob/main/src/main.cc): `src/main.cc`
- [Application loop](https://github.com/orurh/metasimultor/blob/main/src/core/Application.cc): `src/core/Application.cc`
- [Window and input](https://github.com/orurh/metasimultor/blob/main/src/core/Window.cc): `src/core/Window.cc`

### Editor UI

- [Editor extension](https://github.com/orurh/metasimultor/blob/main/src/app/EditorExtension.cc): `src/app/EditorExtension.cc`
- [Editor and tools](https://github.com/orurh/metasimultor/blob/main/src/ui/Editor.h): `src/ui/Editor.h`
- [Editor modules](https://github.com/orurh/metasimultor/tree/main/src/ui/modules): `src/ui/modules`
- [Editor panels](https://github.com/orurh/metasimultor/tree/main/src/ui/panels): `src/ui/panels`
- [Prefab preview](https://github.com/orurh/metasimultor/blob/main/src/ui/panels/PrefabPreviewRenderer.cc): `src/ui/panels/PrefabPreviewRenderer.cc`

### Scene Simulation

- [Scene runtime](https://github.com/orurh/metasimultor/blob/main/src/core/scene/Scene.cc): `src/core/scene/Scene.cc`
- [Entity components](https://github.com/orurh/metasimultor/blob/main/src/core/scene/Components.h): `src/core/scene/Components.h`
- [Fire simulation](https://github.com/orurh/metasimultor/blob/main/src/core/fire/FireSimulationSystem.cc): `src/core/fire/FireSimulationSystem.cc`
- [Agent manager](https://github.com/orurh/metasimultor/blob/main/src/core/AgentManager.cc): `src/core/AgentManager.cc`
- [Terrain](https://github.com/orurh/metasimultor/blob/main/src/core/scene/Terrain.cc): `src/core/scene/Terrain.cc`
- [Heat map](https://github.com/orurh/metasimultor/blob/main/src/core/scene/heatMap.h): `src/core/scene/heatMap.h`
- [Simulation time](https://github.com/orurh/metasimultor/blob/main/src/core/scene/SimulationTime.h): `src/core/scene/SimulationTime.h`
- [Entity registry](https://github.com/orurh/metasimultor/blob/main/libs/entt/entt.hpp): `libs/entt/entt.hpp`

### Scene Data

- [Scene recording](https://github.com/orurh/metasimultor/blob/main/src/core/snapshot/SceneRecorder.h): `src/core/snapshot/SceneRecorder.h`
- [Snapshot system](https://github.com/orurh/metasimultor/blob/main/src/core/snapshot/SnapshotSystem.cc): `src/core/snapshot/SnapshotSystem.cc`
- [Scene serialization](https://github.com/orurh/metasimultor/blob/main/src/data/SceneSerializer.cc): `src/data/SceneSerializer.cc`
- [Prefab system](https://github.com/orurh/metasimultor/blob/main/src/data/PrefabSystem.cc): `src/data/PrefabSystem.cc`

### Rendering

- [Scene renderer](https://github.com/orurh/metasimultor/blob/main/src/graphics/Renderer.cc): `src/graphics/Renderer.cc`
- [Particle systems](https://github.com/orurh/metasimultor/blob/main/src/graphics/ParticleSystem/ParticleSystem.cc): `src/graphics/ParticleSystem/ParticleSystem.cc`
- [Compute shaders](https://github.com/orurh/metasimultor/blob/main/src/graphics/ComputeShader.cc): `src/graphics/ComputeShader.cc`
- [Models and materials](https://github.com/orurh/metasimultor/blob/main/src/graphics/Model.h): `src/graphics/Model.h`

### Other components

- **Editor user**

## Connections

- Editor user → Editor extension: edits scene (evidence: `src/app/EditorExtension.cc`)
- Program entry → Application loop: starts (evidence: `src/main.cc`)
- Application loop → Window and input: polls events (evidence: `src/core/Application.cc`)
- Application loop → Scene runtime: updates and renders (evidence: `src/core/Application.cc`)
- Application loop → Editor extension: dispatches hooks (evidence: `src/core/Application.cc`)
- Application loop → Scene recording: updates recording (evidence: `src/core/Application.cc`)
- Application loop → Scene serialization: loads and saves (evidence: `src/core/Application.cc`)
- Editor extension → Editor and tools: builds UI (evidence: `src/app/EditorExtension.cc`)
- Editor extension → Editor modules: registers modules (evidence: `src/app/EditorExtension.cc`)
- Editor extension → Editor panels: draws editor
- Editor panels → Prefab preview: renders preview (evidence: `src/ui/panels/PrefabPreviewRenderer.cc`)
- Editor panels → Scene runtime: edits scene
- Scene runtime → Agent manager: manages agents
- Scene runtime → Fire simulation: runs fire model
- Scene runtime → Terrain: uses terrain
- Scene runtime → Heat map: exposes heat map
- Scene runtime → Simulation time: tracks simulation time
- Scene runtime → Prefab system: creates prefab agents
- Scene runtime → Entity components: stores components
- Scene runtime → Entity registry: uses registry
- Scene runtime → Scene renderer: renders scene
- Scene runtime → Particle systems: uses particle systems
- Fire simulation → Compute shaders: dispatches compute
- Scene renderer → Models and materials: draws models
- Scene recording → Snapshot system: uses snapshots
- Prefab preview → Models and materials: renders prefab model
