# remyj4556/strata-voxel-engine architecture

> Architecture diagram of the GitHub repository remyj4556/strata-voxel-engine, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-26). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/remyj4556/strata-voxel-engine
- Repository: https://github.com/remyj4556/strata-voxel-engine

## Overview

Strata is a C++/OpenGL voxel terrain engine. The user enters through a GLFW window and controls the camera; the game streams chunks around it, generates terrain and meshes concurrently, then renders chunk geometry. Its major supporting capabilities include greedy meshing, compact vertex data, texture-array block materials, lighting, and debug UI. The README documents the streaming stages and concurrency model; only the entry point, resource setup, and light manager were sampled, so detailed runtime call ownership beyond those is not asserted.

Main entry points: [`Engine/src/World.cpp`](https://github.com/remyj4556/strata-voxel-engine/blob/master/Engine/src/World.cpp) (World streaming), [`Engine/src/Renderer.cpp`](https://github.com/remyj4556/strata-voxel-engine/blob/master/Engine/src/Renderer.cpp) (Renderer), [`Engine/src/Game.cpp`](https://github.com/remyj4556/strata-voxel-engine/blob/master/Engine/src/Game.cpp) (Game loop), [`Engine/src/ResourceManager.cpp`](https://github.com/remyj4556/strata-voxel-engine/blob/master/Engine/src/ResourceManager.cpp) (Resource manager)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Runtime and input"]
  node_main["Application entry<br/>[main.cpp]"]
  node_game["Game loop<br/>[Game.cpp]"]
  node_camera["Camera controls<br/>[Camera.cpp]"]
end

subgraph group_streaming["World streaming"]
  node_world["World streaming<br/>[World.cpp]"]
  node_chunkmap["Chunk map<br/>[ChunkMap.hpp]"]
  node_chunk["Chunk state<br/>[Chunk.cpp]"]
  node_pool["Worker pool<br/>[ThreadPool.cpp]"]
  node_taskqueue["Task queue"]
end

subgraph group_voxel["Voxel data and meshing"]
  node_mesher["Greedy mesher<br/>[ChunkMesher.cpp]"]
  node_vertex["Packed vertices<br/>[Vertex.cpp]"]
  node_blocks["Block registry<br/>[BlockRegistry.cpp]"]
  node_blockdefs["Block definitions"]
end

subgraph group_graphics["Rendering and resources"]
  node_renderer["Renderer<br/>[Renderer.cpp]"]
  node_mesh["GPU mesh<br/>[Mesh.cpp]"]
  node_resources["Resource manager"]
  node_textures["Texture library<br/>[TextureLibrary.cpp]"]
  node_shader["Shader programs<br/>[Shader.cpp]"]
  node_lighting["Lighting<br/>[LightManager.cpp]"]
end

node_player(("Player"))
node_opengl(("OpenGL"))
node_assets["Block assets"]

node_player -->|"starts application"| node_main
node_main -->|"creates and runs"| node_game
node_player -->|"movement and look"| node_camera
node_game -->|"updates controls"| node_camera
node_game -->|"streams nearby chunks"| node_world
node_world -->|"tracks chunks"| node_chunkmap
node_world -->|"schedules generation"| node_pool
node_world -->|"dispatches chunk tasks"| node_taskqueue
node_pool -->|"runs queued tasks"| node_taskqueue
node_world -->|"advances chunk state"| node_chunk
node_world -->|"schedules meshing"| node_mesher
node_mesher -->|"reads block data"| node_chunk
node_mesher -->|"packs face attributes"| node_vertex
node_game -->|"renders frame"| node_renderer
node_renderer -->|"uses streamed chunks"| node_world
node_renderer -->|"uploads and draws"| node_mesh
node_mesh -->|"uploads geometry"| node_opengl
node_renderer -->|"issues draw calls"| node_opengl
node_game -->|"initializes resources"| node_resources
node_resources -->|"loads definitions"| node_blocks
node_resources -->|"initializes texture array"| node_textures
node_blocks -->|"builds GPU definitions"| node_blockdefs
node_resources -->|"loads block JSON and textures"| node_assets
node_renderer -->|"uses shaders"| node_shader
node_renderer -->|"uses light state"| node_lighting

click node_main "https://github.com/remyj4556/strata-voxel-engine/blob/master/Engine/src/main.cpp"
click node_game "https://github.com/remyj4556/strata-voxel-engine/blob/master/Engine/src/Game.cpp"
click node_camera "https://github.com/remyj4556/strata-voxel-engine/blob/master/Engine/src/Camera.cpp"
click node_world "https://github.com/remyj4556/strata-voxel-engine/blob/master/Engine/src/World.cpp"
click node_chunkmap "https://github.com/remyj4556/strata-voxel-engine/blob/master/Engine/include/ChunkMap.hpp"
click node_chunk "https://github.com/remyj4556/strata-voxel-engine/blob/master/Engine/src/Chunk.cpp"
click node_pool "https://github.com/remyj4556/strata-voxel-engine/blob/master/Engine/src/ThreadPool.cpp"
click node_taskqueue "https://github.com/remyj4556/strata-voxel-engine/blob/master/Engine/include/ThreadSafeQueue.hpp"
click node_mesher "https://github.com/remyj4556/strata-voxel-engine/blob/master/Engine/src/ChunkMesher.cpp"
click node_vertex "https://github.com/remyj4556/strata-voxel-engine/blob/master/Engine/src/Vertex.cpp"
click node_blocks "https://github.com/remyj4556/strata-voxel-engine/blob/master/Engine/src/BlockRegistry.cpp"
click node_blockdefs "https://github.com/remyj4556/strata-voxel-engine/blob/master/Engine/include/BlockDefinition.hpp"
click node_renderer "https://github.com/remyj4556/strata-voxel-engine/blob/master/Engine/src/Renderer.cpp"
click node_mesh "https://github.com/remyj4556/strata-voxel-engine/blob/master/Engine/src/Mesh.cpp"
click node_resources "https://github.com/remyj4556/strata-voxel-engine/blob/master/Engine/src/ResourceManager.cpp"
click node_textures "https://github.com/remyj4556/strata-voxel-engine/blob/master/Engine/src/TextureLibrary.cpp"
click node_shader "https://github.com/remyj4556/strata-voxel-engine/blob/master/Engine/src/Shader.cpp"
click node_lighting "https://github.com/remyj4556/strata-voxel-engine/blob/master/Engine/src/LightManager.cpp"

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_game,node_camera toneBlue
class node_world,node_chunkmap,node_chunk,node_pool,node_taskqueue toneAmber
class node_mesher,node_vertex,node_blocks,node_blockdefs toneMint
class node_renderer,node_mesh,node_resources,node_textures,node_shader,node_lighting toneRose
class node_player,node_opengl,node_assets toneIndigo
```

## Components

### Runtime and input

- [Application entry](https://github.com/remyj4556/strata-voxel-engine/blob/master/Engine/src/main.cpp): `Engine/src/main.cpp`
- [Game loop](https://github.com/remyj4556/strata-voxel-engine/blob/master/Engine/src/Game.cpp): `Engine/src/Game.cpp`
- [Camera controls](https://github.com/remyj4556/strata-voxel-engine/blob/master/Engine/src/Camera.cpp): `Engine/src/Camera.cpp`

### World streaming

- [World streaming](https://github.com/remyj4556/strata-voxel-engine/blob/master/Engine/src/World.cpp): `Engine/src/World.cpp`
- [Chunk map](https://github.com/remyj4556/strata-voxel-engine/blob/master/Engine/include/ChunkMap.hpp): `Engine/include/ChunkMap.hpp`
- [Chunk state](https://github.com/remyj4556/strata-voxel-engine/blob/master/Engine/src/Chunk.cpp): `Engine/src/Chunk.cpp`
- [Worker pool](https://github.com/remyj4556/strata-voxel-engine/blob/master/Engine/src/ThreadPool.cpp): `Engine/src/ThreadPool.cpp`
- [Task queue](https://github.com/remyj4556/strata-voxel-engine/blob/master/Engine/include/ThreadSafeQueue.hpp): `Engine/include/ThreadSafeQueue.hpp`

### Voxel data and meshing

- [Greedy mesher](https://github.com/remyj4556/strata-voxel-engine/blob/master/Engine/src/ChunkMesher.cpp): `Engine/src/ChunkMesher.cpp`
- [Packed vertices](https://github.com/remyj4556/strata-voxel-engine/blob/master/Engine/src/Vertex.cpp): `Engine/src/Vertex.cpp`
- [Block registry](https://github.com/remyj4556/strata-voxel-engine/blob/master/Engine/src/BlockRegistry.cpp): `Engine/src/BlockRegistry.cpp`
- [Block definitions](https://github.com/remyj4556/strata-voxel-engine/blob/master/Engine/include/BlockDefinition.hpp): `Engine/include/BlockDefinition.hpp`

### Rendering and resources

- [Renderer](https://github.com/remyj4556/strata-voxel-engine/blob/master/Engine/src/Renderer.cpp): `Engine/src/Renderer.cpp`
- [GPU mesh](https://github.com/remyj4556/strata-voxel-engine/blob/master/Engine/src/Mesh.cpp): `Engine/src/Mesh.cpp`
- [Resource manager](https://github.com/remyj4556/strata-voxel-engine/blob/master/Engine/src/ResourceManager.cpp): `Engine/src/ResourceManager.cpp`
- [Texture library](https://github.com/remyj4556/strata-voxel-engine/blob/master/Engine/src/TextureLibrary.cpp): `Engine/src/TextureLibrary.cpp`
- [Shader programs](https://github.com/remyj4556/strata-voxel-engine/blob/master/Engine/src/Shader.cpp): `Engine/src/Shader.cpp`
- [Lighting](https://github.com/remyj4556/strata-voxel-engine/blob/master/Engine/src/LightManager.cpp): `Engine/src/LightManager.cpp`

### Other components

- **Player**
- **OpenGL**
- **Block assets**

## Connections

- Player → Application entry: starts application
- Application entry → Game loop: creates and runs
- Player → Camera controls: movement and look
- Game loop → Camera controls: updates controls
- Game loop → World streaming: streams nearby chunks
- World streaming → Chunk map: tracks chunks
- World streaming → Worker pool: schedules generation
- World streaming → Task queue: dispatches chunk tasks
- Worker pool → Task queue: runs queued tasks
- World streaming → Chunk state: advances chunk state
- World streaming → Greedy mesher: schedules meshing
- Greedy mesher → Chunk state: reads block data
- Greedy mesher → Packed vertices: packs face attributes
- Game loop → Renderer: renders frame
- Renderer → World streaming: uses streamed chunks
- Renderer → GPU mesh: uploads and draws
- GPU mesh → OpenGL: uploads geometry
- Renderer → OpenGL: issues draw calls
- Game loop → Resource manager: initializes resources
- Resource manager → Block registry: loads definitions
- Resource manager → Texture library: initializes texture array
- Block registry → Block definitions: builds GPU definitions
- Resource manager → Block assets: loads block JSON and textures
- Renderer → Shader programs: uses shaders
- Renderer → Lighting: uses light state
