# thegameengineers/primal architecture

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

- Interactive diagram: https://gitdiagram.com/thegameengineers/primal
- Repository: https://github.com/thegameengineers/primal

## Overview

Primal Engine is a native C++ 3D engine with a WPF editor and native asset-processing tools. The principal workflow is authoring a project and scene in the editor, editing entities and assets, then crossing the Engine DLL boundary to update or run the native engine and render through Direct3D 12. Asset import and project serialization are distinct authoring stages; runtime content conversion and renderer resource handling form an internal engine layer. Arrows follow README descriptions or source-index references; unsampled implementation details are not inferred.

Main entry points: [`PrimalEditor/GameProject/Project.cs`](https://github.com/thegameengineers/primal/blob/master/PrimalEditor/GameProject/Project.cs) (Project and scenes), [`EngineDLL/EngineAPI.cpp`](https://github.com/thegameengineers/primal/blob/master/EngineDLL/EngineAPI.cpp) (Engine DLL), [`Engine/Core/EngineWin32.cpp`](https://github.com/thegameengineers/primal/blob/master/Engine/Core/EngineWin32.cpp) (Engine lifecycle), [`PrimalEditor/Content/AssetRegistry.cs`](https://github.com/thegameengineers/primal/blob/master/PrimalEditor/Content/AssetRegistry.cs) (Asset registry)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_editor["Editor authoring"]
  node_project["Project and scenes<br/>[Project.cs]"]
  node_chef["Project cooking<br/>[Chef.cs]"]
  node_entities["Scene entities<br/>[GameEntity.cs]"]
  node_components["Entity components<br/>[Script.cs]"]
end

subgraph group_assets["Asset pipeline"]
  node_assetregistry["Asset registry<br/>[AssetRegistry.cs]"]
  node_assetbrowser["Asset browser"]
  node_geometryasset["Geometry assets<br/>[Geometry.cs]"]
  node_defaultassets["Default assets<br/>[DefaultAssets.cs]"]
  node_contenttools["Asset import tools<br/>[ContentTools.cpp]"]
  node_fbx["FBX processing<br/>[FbxImporter.cpp]"]
  node_textureimport["Texture processing"]
end

subgraph group_bridge["Native interface"]
  node_editorapi["Editor API<br/>[EditorAPI.cpp]"]
  node_managedapi["Managed API wrapper<br/>[EngineAPI.cs]"]
  node_enginedll["Engine DLL<br/>[EngineAPI.cpp]"]
end

subgraph group_engine["Engine runtime"]
  node_enginecore["Engine lifecycle<br/>[EngineWin32.cpp]"]
  node_contentruntime["Runtime content"]
  node_input["Platform and input<br/>[PlatformWin32.cpp]"]
end

subgraph group_graphics["Graphics backend"]
  node_renderer["Renderer<br/>[Renderer.cpp]"]
  node_d3d12["Direct3D 12<br/>[D3D12Core.cpp]"]
  node_shadercompile["Shader compilation"]
end

node_user(("Editor user"))

node_user -->|"authors"| node_project
node_project -->|"edits scenes"| node_entities
node_entities -->|"contains data"| node_components
node_project -->|"cooks project"| node_chef
node_project -->|"uses engine API"| node_managedapi
node_entities -->|"updates engine"| node_managedapi
node_user -->|"browses assets"| node_assetbrowser
node_assetbrowser -.->|"manages assets"| node_assetregistry
node_assetregistry -->|"tracks geometry"| node_geometryasset
node_defaultassets -->|"registers assets"| node_assetregistry
node_assetbrowser -->|"imports assets"| node_contenttools
node_contenttools -.->|"processes models"| node_fbx
node_contenttools -.->|"processes textures"| node_textureimport
node_managedapi -->|"calls native API"| node_enginedll
node_enginedll -->|"exposes editor API"| node_editorapi
node_enginedll -->|"initializes runtime"| node_enginecore
node_enginecore -->|"loads content"| node_contentruntime
node_enginecore -->|"initializes input"| node_input
node_enginecore -->|"initializes graphics"| node_renderer
node_renderer -->|"uses backend"| node_d3d12
node_enginedll -->|"compiles shaders"| node_shadercompile
node_chef -->|"serializes assets"| node_assetregistry

click node_project "https://github.com/thegameengineers/primal/blob/master/PrimalEditor/GameProject/Project.cs"
click node_chef "https://github.com/thegameengineers/primal/blob/master/PrimalEditor/GameProject/Chef.cs"
click node_entities "https://github.com/thegameengineers/primal/blob/master/PrimalEditor/Components/GameEntity.cs"
click node_components "https://github.com/thegameengineers/primal/blob/master/PrimalEditor/Components/Script.cs"
click node_assetregistry "https://github.com/thegameengineers/primal/blob/master/PrimalEditor/Content/AssetRegistry.cs"
click node_assetbrowser "https://github.com/thegameengineers/primal/blob/master/PrimalEditor/Content/ContentBrowser/ContentBrowserView.xaml.cs"
click node_geometryasset "https://github.com/thegameengineers/primal/blob/master/PrimalEditor/Content/Geometry.cs"
click node_defaultassets "https://github.com/thegameengineers/primal/blob/master/PrimalEditor/Content/DefaultAssets.cs"
click node_contenttools "https://github.com/thegameengineers/primal/blob/master/ContentTools/ContentTools.cpp"
click node_fbx "https://github.com/thegameengineers/primal/blob/master/ContentTools/FbxImporter.cpp"
click node_textureimport "https://github.com/thegameengineers/primal/blob/master/ContentTools/TextureImporter.cpp"
click node_editorapi "https://github.com/thegameengineers/primal/blob/master/Engine/EditorAPI/EditorAPI.cpp"
click node_managedapi "https://github.com/thegameengineers/primal/blob/master/PrimalEditor/DllWrappers/EngineAPI.cs"
click node_enginedll "https://github.com/thegameengineers/primal/blob/master/EngineDLL/EngineAPI.cpp"
click node_enginecore "https://github.com/thegameengineers/primal/blob/master/Engine/Core/EngineWin32.cpp"
click node_contentruntime "https://github.com/thegameengineers/primal/blob/master/Engine/Content/ContentToEngine.cpp"
click node_input "https://github.com/thegameengineers/primal/blob/master/Engine/Platform/PlatformWin32.cpp"
click node_renderer "https://github.com/thegameengineers/primal/blob/master/Engine/Graphics/Renderer.cpp"
click node_d3d12 "https://github.com/thegameengineers/primal/blob/master/Engine/Graphics/Direct3D12/D3D12Core.cpp"
click node_shadercompile "https://github.com/thegameengineers/primal/blob/master/EngineDLL/ShaderCompilation.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_project,node_chef,node_entities,node_components,node_user toneBlue
class node_assetregistry,node_assetbrowser,node_geometryasset,node_defaultassets,node_contenttools,node_fbx,node_textureimport toneAmber
class node_editorapi,node_managedapi,node_enginedll toneMint
class node_enginecore,node_contentruntime,node_input toneRose
class node_renderer,node_d3d12,node_shadercompile toneIndigo
```

## Components

### Editor authoring

- [Project and scenes](https://github.com/thegameengineers/primal/blob/master/PrimalEditor/GameProject/Project.cs): `PrimalEditor/GameProject/Project.cs`
- [Project cooking](https://github.com/thegameengineers/primal/blob/master/PrimalEditor/GameProject/Chef.cs): `PrimalEditor/GameProject/Chef.cs`
- [Scene entities](https://github.com/thegameengineers/primal/blob/master/PrimalEditor/Components/GameEntity.cs): `PrimalEditor/Components/GameEntity.cs`
- [Entity components](https://github.com/thegameengineers/primal/blob/master/PrimalEditor/Components/Script.cs): `PrimalEditor/Components/Script.cs`

### Asset pipeline

- [Asset registry](https://github.com/thegameengineers/primal/blob/master/PrimalEditor/Content/AssetRegistry.cs): `PrimalEditor/Content/AssetRegistry.cs`
- [Asset browser](https://github.com/thegameengineers/primal/blob/master/PrimalEditor/Content/ContentBrowser/ContentBrowserView.xaml.cs): `PrimalEditor/Content/ContentBrowser/ContentBrowserView.xaml.cs`
- [Geometry assets](https://github.com/thegameengineers/primal/blob/master/PrimalEditor/Content/Geometry.cs): `PrimalEditor/Content/Geometry.cs`
- [Default assets](https://github.com/thegameengineers/primal/blob/master/PrimalEditor/Content/DefaultAssets.cs): `PrimalEditor/Content/DefaultAssets.cs`
- [Asset import tools](https://github.com/thegameengineers/primal/blob/master/ContentTools/ContentTools.cpp): `ContentTools/ContentTools.cpp`
- [FBX processing](https://github.com/thegameengineers/primal/blob/master/ContentTools/FbxImporter.cpp): `ContentTools/FbxImporter.cpp`
- [Texture processing](https://github.com/thegameengineers/primal/blob/master/ContentTools/TextureImporter.cpp): `ContentTools/TextureImporter.cpp`

### Native interface

- [Editor API](https://github.com/thegameengineers/primal/blob/master/Engine/EditorAPI/EditorAPI.cpp): `Engine/EditorAPI/EditorAPI.cpp`
- [Managed API wrapper](https://github.com/thegameengineers/primal/blob/master/PrimalEditor/DllWrappers/EngineAPI.cs): `PrimalEditor/DllWrappers/EngineAPI.cs`
- [Engine DLL](https://github.com/thegameengineers/primal/blob/master/EngineDLL/EngineAPI.cpp): `EngineDLL/EngineAPI.cpp`

### Engine runtime

- [Engine lifecycle](https://github.com/thegameengineers/primal/blob/master/Engine/Core/EngineWin32.cpp): `Engine/Core/EngineWin32.cpp`
- [Runtime content](https://github.com/thegameengineers/primal/blob/master/Engine/Content/ContentToEngine.cpp): `Engine/Content/ContentToEngine.cpp`
- [Platform and input](https://github.com/thegameengineers/primal/blob/master/Engine/Platform/PlatformWin32.cpp): `Engine/Platform/PlatformWin32.cpp`

### Graphics backend

- [Renderer](https://github.com/thegameengineers/primal/blob/master/Engine/Graphics/Renderer.cpp): `Engine/Graphics/Renderer.cpp`
- [Direct3D 12](https://github.com/thegameengineers/primal/blob/master/Engine/Graphics/Direct3D12/D3D12Core.cpp): `Engine/Graphics/Direct3D12/D3D12Core.cpp`
- [Shader compilation](https://github.com/thegameengineers/primal/blob/master/EngineDLL/ShaderCompilation.cpp): `EngineDLL/ShaderCompilation.cpp`

### Other components

- **Editor user**

## Connections

- Editor user → Project and scenes: authors
- Project and scenes → Scene entities: edits scenes (evidence: `PrimalEditor/GameProject/Project.cs`)
- Scene entities → Entity components: contains data (evidence: `PrimalEditor/Components/GameEntity.cs`)
- Project and scenes → Project cooking: cooks project (evidence: `PrimalEditor/GameProject/Project.cs`)
- Project and scenes → Managed API wrapper: uses engine API (evidence: `PrimalEditor/GameProject/Project.cs`)
- Scene entities → Managed API wrapper: updates engine (evidence: `PrimalEditor/Components/GameEntity.cs`)
- Editor user → Asset browser: browses assets
- Asset browser → Asset registry: manages assets
- Asset registry → Geometry assets: tracks geometry (evidence: `PrimalEditor/Content/Geometry.cs`)
- Default assets → Asset registry: registers assets (evidence: `PrimalEditor/Content/DefaultAssets.cs`)
- Asset browser → Asset import tools: imports assets
- Asset import tools → FBX processing: processes models
- Asset import tools → Texture processing: processes textures
- Managed API wrapper → Engine DLL: calls native API
- Engine DLL → Editor API: exposes editor API (evidence: `EngineDLL/EngineAPI.cpp`)
- Engine DLL → Engine lifecycle: initializes runtime (evidence: `EngineDLL/EngineAPI.cpp`)
- Engine lifecycle → Runtime content: loads content (evidence: `Engine/Core/EngineWin32.cpp`)
- Engine lifecycle → Platform and input: initializes input (evidence: `Engine/Core/EngineWin32.cpp`)
- Engine lifecycle → Renderer: initializes graphics (evidence: `Engine/Core/EngineWin32.cpp`)
- Renderer → Direct3D 12: uses backend
- Engine DLL → Shader compilation: compiles shaders (evidence: `EngineDLL/EngineAPI.cpp`)
- Project cooking → Asset registry: serializes assets (evidence: `PrimalEditor/GameProject/Chef.cs`)
