# timothesandt/proceduralgeneration architecture

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

- Interactive diagram: https://gitdiagram.com/timothesandt/proceduralgeneration
- Repository: https://github.com/timothesandt/proceduralgeneration

## Overview

Orosmo is a C++23 2D/3D game engine whose documented product workflow includes procedural terrain generation/viewing and rendering, plus a declarative UI compiled from `.cui` into C++. The graph separates platform, rendering, world, and UI/compiler responsibilities. The README documents the broad product links; sampled source confirms selected compiler, shader/pipeline, and application behavior. Several implementation files were not sampled, so undocumented internal call relationships are omitted.

Main entry points: [`src/world/terrain.cpp`](https://github.com/timothesandt/proceduralgeneration/blob/main/src/world/terrain.cpp) (Terrain Data), [`include/orosmo/rhi/device.hpp`](https://github.com/timothesandt/proceduralgeneration/blob/main/include/orosmo/rhi/device.hpp) (Graphics Device API), [`tools/cui-rs/src/main.rs`](https://github.com/timothesandt/proceduralgeneration/blob/main/tools/cui-rs/src/main.rs) (CUI Compiler), [`apps/terrain_viewer/src/viewer.cpp`](https://github.com/timothesandt/proceduralgeneration/blob/main/apps/terrain_viewer/src/viewer.cpp) (Terrain Viewer)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_platform["Platform and Core"]
  node_platform_window["Window and Input<br/>[window.cpp]"]
  node_task_system["Task System<br/>[tasks.cpp]"]
end

subgraph group_render["Rendering and RHI"]
  node_terrain_renderer["Terrain Renderer"]
  node_scene_renderer["Scene Renderer<br/>[scene_renderer.cpp]"]
  node_draw_list["Draw Lists<br/>[draw_list.hpp]"]
  node_shader_library["Shader Library<br/>[shader_library.hpp]"]
  node_shader_compiler["Shader Compiler"]
  node_pipeline_cache["Pipeline Cache<br/>[pipeline_cache.hpp]"]
  node_rhi_device["Graphics Device API<br/>[device.hpp]"]
  node_opengl["OpenGL Backend<br/>[gl_device.cpp]"]
end

subgraph group_world["Procedural World"]
  node_terrain_gen["Terrain Generator<br/>[main.cpp]"]
  node_terrain_viewer["Terrain Viewer<br/>[viewer.cpp]"]
  node_world_terrain["Terrain Data<br/>[terrain.cpp]"]
  node_world_noise["Noise Generation<br/>[noise.cpp]"]
  node_gpu_noise["GPU Noise<br/>[gpu_noise.cpp]"]
  node_world_lod["Terrain LOD<br/>[lod.cpp]"]
  node_world_stream["World Streaming<br/>[streaming.cpp]"]
  node_world_raycast["Terrain Raycast<br/>[raycast.cpp]"]
  node_world_export["Terrain Export<br/>[export.cpp]"]
end

subgraph group_ui["UI and Compiler"]
  node_cui_compiler["CUI Compiler<br/>[main.rs]"]
  node_cui_lexer["Lexer<br/>[lexer.rs]"]
  node_cui_parser["Parser and AST<br/>[parser.rs]"]
  node_cui_codegen["CUI Code Generator<br/>[engine.rs]"]
  node_ui_runtime["UI Runtime<br/>[ui.cpp]"]
  node_text_renderer["UI Text Renderer<br/>[text_renderer.hpp]"]
end

node_user(("User"))

node_user -->|"generates terrain"| node_terrain_gen
node_user -->|"views terrain"| node_terrain_viewer
node_terrain_gen -->|"uses world module"| node_world_terrain
node_terrain_viewer -->|"uses world module"| node_world_terrain
node_terrain_viewer -->|"uses renderer"| node_terrain_renderer
node_world_terrain -.->|"uses noise"| node_world_noise
node_world_terrain -.->|"supports LOD"| node_world_lod
node_world_terrain -.->|"supports streaming"| node_world_stream
node_world_terrain -.->|"supports raycasting"| node_world_raycast
node_world_terrain -.->|"exports terrain"| node_world_export
node_gpu_noise -->|"uses device API"| node_rhi_device
node_gpu_noise -->|"uses shaders"| node_shader_compiler
node_terrain_renderer -.->|"renders terrain"| node_world_terrain
node_scene_renderer -.->|"renders via RHI"| node_rhi_device
node_draw_list -->|"feeds text rendering"| node_text_renderer
node_shader_library -->|"uses device API"| node_rhi_device
node_shader_library -->|"compiles shaders"| node_shader_compiler
node_pipeline_cache -->|"caches program pipelines"| node_shader_library
node_pipeline_cache -->|"creates pipelines"| node_rhi_device
node_opengl -->|"implements API"| node_rhi_device
node_platform_window -->|"provides window surface"| node_rhi_device
node_user -->|"compiles UI"| node_cui_compiler
node_cui_compiler -->|"tokenizes source"| node_cui_lexer
node_cui_compiler -->|"parses tokens"| node_cui_parser
node_cui_parser -->|"consumes tokens"| node_cui_lexer
node_cui_compiler -->|"generates C++"| node_cui_codegen
node_cui_codegen -->|"targets UI runtime"| node_ui_runtime
node_ui_runtime -.->|"renders text"| node_text_renderer

click node_terrain_gen "https://github.com/timothesandt/proceduralgeneration/blob/main/apps/terrain_gen/main.cpp"
click node_terrain_viewer "https://github.com/timothesandt/proceduralgeneration/blob/main/apps/terrain_viewer/src/viewer.cpp"
click node_world_terrain "https://github.com/timothesandt/proceduralgeneration/blob/main/src/world/terrain.cpp"
click node_world_noise "https://github.com/timothesandt/proceduralgeneration/blob/main/src/world/noise.cpp"
click node_gpu_noise "https://github.com/timothesandt/proceduralgeneration/blob/main/src/world/gpu/gpu_noise.cpp"
click node_world_lod "https://github.com/timothesandt/proceduralgeneration/blob/main/src/world/lod.cpp"
click node_world_stream "https://github.com/timothesandt/proceduralgeneration/blob/main/src/world/streaming.cpp"
click node_world_raycast "https://github.com/timothesandt/proceduralgeneration/blob/main/src/world/raycast.cpp"
click node_world_export "https://github.com/timothesandt/proceduralgeneration/blob/main/src/world/export.cpp"
click node_terrain_renderer "https://github.com/timothesandt/proceduralgeneration/blob/main/src/renderer/terrain_renderer.cpp"
click node_scene_renderer "https://github.com/timothesandt/proceduralgeneration/blob/main/src/renderer/scene_renderer.cpp"
click node_draw_list "https://github.com/timothesandt/proceduralgeneration/blob/main/include/orosmo/renderer/draw_list.hpp"
click node_shader_library "https://github.com/timothesandt/proceduralgeneration/blob/main/include/orosmo/renderer/shader_library.hpp"
click node_shader_compiler "https://github.com/timothesandt/proceduralgeneration/blob/main/include/orosmo/rhi/shader_compiler.hpp"
click node_pipeline_cache "https://github.com/timothesandt/proceduralgeneration/blob/main/include/orosmo/renderer/pipeline_cache.hpp"
click node_rhi_device "https://github.com/timothesandt/proceduralgeneration/blob/main/include/orosmo/rhi/device.hpp"
click node_opengl "https://github.com/timothesandt/proceduralgeneration/blob/main/src/rhi/opengl/gl_device.cpp"
click node_platform_window "https://github.com/timothesandt/proceduralgeneration/blob/main/src/platform/window.cpp"
click node_task_system "https://github.com/timothesandt/proceduralgeneration/blob/main/src/core/tasks.cpp"
click node_cui_compiler "https://github.com/timothesandt/proceduralgeneration/blob/main/tools/cui-rs/src/main.rs"
click node_cui_lexer "https://github.com/timothesandt/proceduralgeneration/blob/main/tools/cui-rs/src/lexer.rs"
click node_cui_parser "https://github.com/timothesandt/proceduralgeneration/blob/main/tools/cui-rs/src/parser.rs"
click node_cui_codegen "https://github.com/timothesandt/proceduralgeneration/blob/main/tools/cui-rs/src/engine.rs"
click node_ui_runtime "https://github.com/timothesandt/proceduralgeneration/blob/main/src/ui/ui.cpp"
click node_text_renderer "https://github.com/timothesandt/proceduralgeneration/blob/main/include/orosmo/ui/text_renderer.hpp"

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_platform_window,node_task_system,node_user toneBlue
class node_terrain_renderer,node_scene_renderer,node_draw_list,node_shader_library,node_shader_compiler,node_pipeline_cache,node_rhi_device,node_opengl toneAmber
class node_terrain_gen,node_terrain_viewer,node_world_terrain,node_world_noise,node_gpu_noise,node_world_lod,node_world_stream,node_world_raycast,node_world_export toneMint
class node_cui_compiler,node_cui_lexer,node_cui_parser,node_cui_codegen,node_ui_runtime,node_text_renderer toneRose
```

## Components

### Platform and Core

- [Window and Input](https://github.com/timothesandt/proceduralgeneration/blob/main/src/platform/window.cpp): `src/platform/window.cpp`
- [Task System](https://github.com/timothesandt/proceduralgeneration/blob/main/src/core/tasks.cpp): `src/core/tasks.cpp`

### Rendering and RHI

- [Terrain Renderer](https://github.com/timothesandt/proceduralgeneration/blob/main/src/renderer/terrain_renderer.cpp): `src/renderer/terrain_renderer.cpp`
- [Scene Renderer](https://github.com/timothesandt/proceduralgeneration/blob/main/src/renderer/scene_renderer.cpp): `src/renderer/scene_renderer.cpp`
- [Draw Lists](https://github.com/timothesandt/proceduralgeneration/blob/main/include/orosmo/renderer/draw_list.hpp): `include/orosmo/renderer/draw_list.hpp`
- [Shader Library](https://github.com/timothesandt/proceduralgeneration/blob/main/include/orosmo/renderer/shader_library.hpp): `include/orosmo/renderer/shader_library.hpp`
- [Shader Compiler](https://github.com/timothesandt/proceduralgeneration/blob/main/include/orosmo/rhi/shader_compiler.hpp): `include/orosmo/rhi/shader_compiler.hpp`
- [Pipeline Cache](https://github.com/timothesandt/proceduralgeneration/blob/main/include/orosmo/renderer/pipeline_cache.hpp): `include/orosmo/renderer/pipeline_cache.hpp`
- [Graphics Device API](https://github.com/timothesandt/proceduralgeneration/blob/main/include/orosmo/rhi/device.hpp): `include/orosmo/rhi/device.hpp`
- [OpenGL Backend](https://github.com/timothesandt/proceduralgeneration/blob/main/src/rhi/opengl/gl_device.cpp): `src/rhi/opengl/gl_device.cpp`

### Procedural World

- [Terrain Generator](https://github.com/timothesandt/proceduralgeneration/blob/main/apps/terrain_gen/main.cpp): `apps/terrain_gen/main.cpp`
- [Terrain Viewer](https://github.com/timothesandt/proceduralgeneration/blob/main/apps/terrain_viewer/src/viewer.cpp): `apps/terrain_viewer/src/viewer.cpp`
- [Terrain Data](https://github.com/timothesandt/proceduralgeneration/blob/main/src/world/terrain.cpp): `src/world/terrain.cpp`
- [Noise Generation](https://github.com/timothesandt/proceduralgeneration/blob/main/src/world/noise.cpp): `src/world/noise.cpp`
- [GPU Noise](https://github.com/timothesandt/proceduralgeneration/blob/main/src/world/gpu/gpu_noise.cpp): `src/world/gpu/gpu_noise.cpp`
- [Terrain LOD](https://github.com/timothesandt/proceduralgeneration/blob/main/src/world/lod.cpp): `src/world/lod.cpp`
- [World Streaming](https://github.com/timothesandt/proceduralgeneration/blob/main/src/world/streaming.cpp): `src/world/streaming.cpp`
- [Terrain Raycast](https://github.com/timothesandt/proceduralgeneration/blob/main/src/world/raycast.cpp): `src/world/raycast.cpp`
- [Terrain Export](https://github.com/timothesandt/proceduralgeneration/blob/main/src/world/export.cpp): `src/world/export.cpp`

### UI and Compiler

- [CUI Compiler](https://github.com/timothesandt/proceduralgeneration/blob/main/tools/cui-rs/src/main.rs): `tools/cui-rs/src/main.rs`
- [Lexer](https://github.com/timothesandt/proceduralgeneration/blob/main/tools/cui-rs/src/lexer.rs): `tools/cui-rs/src/lexer.rs`
- [Parser and AST](https://github.com/timothesandt/proceduralgeneration/blob/main/tools/cui-rs/src/parser.rs): `tools/cui-rs/src/parser.rs`
- [CUI Code Generator](https://github.com/timothesandt/proceduralgeneration/blob/main/tools/cui-rs/src/engine.rs): `tools/cui-rs/src/engine.rs`
- [UI Runtime](https://github.com/timothesandt/proceduralgeneration/blob/main/src/ui/ui.cpp): `src/ui/ui.cpp`
- [UI Text Renderer](https://github.com/timothesandt/proceduralgeneration/blob/main/include/orosmo/ui/text_renderer.hpp): `include/orosmo/ui/text_renderer.hpp`

### Other components

- **User**

## Connections

- User → Terrain Generator: generates terrain (evidence: `README.md`)
- User → Terrain Viewer: views terrain (evidence: `README.md`)
- Terrain Generator → Terrain Data: uses world module (evidence: `README.md`)
- Terrain Viewer → Terrain Data: uses world module (evidence: `README.md`)
- Terrain Viewer → Terrain Renderer: uses renderer (evidence: `README.md`)
- Terrain Data → Noise Generation: uses noise
- Terrain Data → Terrain LOD: supports LOD
- Terrain Data → World Streaming: supports streaming
- Terrain Data → Terrain Raycast: supports raycasting
- Terrain Data → Terrain Export: exports terrain
- GPU Noise → Graphics Device API: uses device API
- GPU Noise → Shader Compiler: uses shaders (evidence: `src/world/gpu/gpu_noise.cpp`)
- Terrain Renderer → Terrain Data: renders terrain
- Scene Renderer → Graphics Device API: renders via RHI
- Draw Lists → UI Text Renderer: feeds text rendering (evidence: `include/orosmo/ui/text_renderer.hpp`)
- Shader Library → Graphics Device API: uses device API (evidence: `include/orosmo/renderer/shader_library.hpp`)
- Shader Library → Shader Compiler: compiles shaders (evidence: `include/orosmo/renderer/shader_library.hpp`)
- Pipeline Cache → Shader Library: caches program pipelines (evidence: `include/orosmo/renderer/pipeline_cache.hpp`)
- Pipeline Cache → Graphics Device API: creates pipelines (evidence: `include/orosmo/renderer/pipeline_cache.hpp`)
- OpenGL Backend → Graphics Device API: implements API
- Window and Input → Graphics Device API: provides window surface (evidence: `include/orosmo/rhi/device.hpp`)
- User → CUI Compiler: compiles UI (evidence: `README.md`)
- CUI Compiler → Lexer: tokenizes source (evidence: `tools/cui-rs/src/main.rs`)
- CUI Compiler → Parser and AST: parses tokens (evidence: `tools/cui-rs/src/main.rs`)
- Parser and AST → Lexer: consumes tokens (evidence: `tools/cui-rs/src/parser.rs`)
- CUI Compiler → CUI Code Generator: generates C++ (evidence: `tools/cui-rs/src/main.rs`)
- CUI Code Generator → UI Runtime: targets UI runtime (evidence: `tools/cui-rs/src/engine.rs`)
- UI Runtime → UI Text Renderer: renders text
