# dyd-dev/dy_engine architecture

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

- Interactive diagram: https://gitdiagram.com/dyd-dev/dy_engine
- Repository: https://github.com/dyd-dev/dy_engine

## Overview

dy_engine is a data-oriented graphics framework: applications build scenes and submit them through a renderer, which records render work through a thin RHI to a selected graphics backend. The README also documents model/texture loading, binding-mode experiments, shadows, and progressively lower-level RHI access. The graph preserves those capabilities and the main internal layers. Backend and extension links are based on README descriptions and the source index; unsampled implementations are not claimed to have been inspected.

Main entry points: [`src/dyf/Renderer.cpp`](https://github.com/dyd-dev/dy_engine/blob/main/src/dyf/Renderer.cpp) (Renderer), [`src/Public/dyf/RHI`](https://github.com/dyd-dev/dy_engine/tree/main/src/Public/dyf/RHI) (RHI contracts), [`src/RHI/RenderGraph.cpp`](https://github.com/dyd-dev/dy_engine/blob/main/src/RHI/RenderGraph.cpp) (Render graph), [`src/RHI/ICommandList.cpp`](https://github.com/dyd-dev/dy_engine/blob/main/src/RHI/ICommandList.cpp) (Command recording)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Render front end"]
  node_renderer["Renderer<br/>[Renderer.cpp]"]
  node_scene["Scene and materials<br/>[Scene.cpp]"]
  node_drawdata["Draw packet building<br/>[DrawData.cpp]"]
  node_lighting["Lighting and shadows<br/>[Lighting.cpp]"]
end

subgraph group_rhi["RHI and render path"]
  node_rendergraph["Render graph<br/>[RenderGraph.cpp]"]
  node_rhi_contracts["RHI contracts"]
  node_rhi_resources["Resource management<br/>[Resources.cpp]"]
  node_commands["Command recording<br/>[ICommandList.cpp]"]
end

subgraph group_backends["Graphics backends"]
  node_vulkan["Vulkan backend<br/>[VulkanDevice.cpp]"]
  node_d3d12["D3D12 backend<br/>[D3D12Device.cpp]"]
  node_metal["Metal backend<br/>[MetalDevice.h]"]
  node_null["Null backend<br/>[NullDevice.cpp]"]
end

subgraph group_support["Platform and extensions"]
  node_models["Model loading"]
  node_modelrender["Model rendering<br/>[ModelRenderer.cpp]"]
  node_window["Window and input<br/>[Window.cpp]"]
  node_math["Math foundation<br/>[Math.h]"]
  node_imgui["ImGui extension<br/>[ImGui.cpp]"]
end

node_application(("Application"))

node_application -->|"creates and uses"| node_renderer
node_application -->|"builds"| node_scene
node_renderer -->|"renders"| node_scene
node_renderer -->|"builds packets"| node_drawdata
node_renderer -.->|"renders shadows"| node_lighting
node_renderer -->|"records passes"| node_rendergraph
node_renderer -->|"uses interfaces"| node_rhi_contracts
node_rendergraph -->|"executes passes"| node_commands
node_rhi_resources -->|"implements resource APIs"| node_rhi_contracts
node_commands -->|"implements command API"| node_rhi_contracts
node_rhi_contracts -.->|"implemented by"| node_vulkan
node_rhi_contracts -.->|"implemented by"| node_d3d12
node_rhi_contracts -.->|"implemented by"| node_metal
node_rhi_contracts -.->|"implemented by"| node_null
node_models -.->|"provides model data"| node_modelrender
node_modelrender -.->|"feeds rendering"| node_renderer
node_window -.->|"provides window"| node_renderer
node_imgui -->|"uses rendering APIs"| node_rhi_contracts
node_math -.->|"supports transforms"| node_renderer

click node_renderer "https://github.com/dyd-dev/dy_engine/blob/main/src/dyf/Renderer.cpp"
click node_scene "https://github.com/dyd-dev/dy_engine/blob/main/src/dyf/Scene.cpp"
click node_drawdata "https://github.com/dyd-dev/dy_engine/blob/main/src/dyf/DrawData.cpp"
click node_lighting "https://github.com/dyd-dev/dy_engine/blob/main/src/dyf/Lighting.cpp"
click node_models "https://github.com/dyd-dev/dy_engine/tree/main/src/Extend/Model"
click node_modelrender "https://github.com/dyd-dev/dy_engine/blob/main/src/Extend/Model/ModelRenderer.cpp"
click node_rendergraph "https://github.com/dyd-dev/dy_engine/blob/main/src/RHI/RenderGraph.cpp"
click node_rhi_contracts "https://github.com/dyd-dev/dy_engine/tree/main/src/Public/dyf/RHI"
click node_rhi_resources "https://github.com/dyd-dev/dy_engine/blob/main/src/RHI/Resources.cpp"
click node_commands "https://github.com/dyd-dev/dy_engine/blob/main/src/RHI/ICommandList.cpp"
click node_vulkan "https://github.com/dyd-dev/dy_engine/blob/main/src/Backends/Vulkan/VulkanDevice.cpp"
click node_d3d12 "https://github.com/dyd-dev/dy_engine/blob/main/src/Backends/D3D12/D3D12Device.cpp"
click node_metal "https://github.com/dyd-dev/dy_engine/blob/main/src/Backends/Metal/MetalDevice.h"
click node_null "https://github.com/dyd-dev/dy_engine/blob/main/src/Backends/Null/NullDevice.cpp"
click node_window "https://github.com/dyd-dev/dy_engine/blob/main/src/Platform/Window.cpp"
click node_math "https://github.com/dyd-dev/dy_engine/blob/main/src/Public/dyf/Math/Math.h"
click node_imgui "https://github.com/dyd-dev/dy_engine/blob/main/src/Extend/ImGui/ImGui.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_renderer,node_scene,node_drawdata,node_lighting toneBlue
class node_rendergraph,node_rhi_contracts,node_rhi_resources,node_commands toneAmber
class node_vulkan,node_d3d12,node_metal,node_null toneMint
class node_models,node_modelrender,node_window,node_math,node_imgui toneRose
class node_application toneIndigo
```

## Components

### Render front end

- [Renderer](https://github.com/dyd-dev/dy_engine/blob/main/src/dyf/Renderer.cpp): `src/dyf/Renderer.cpp`
- [Scene and materials](https://github.com/dyd-dev/dy_engine/blob/main/src/dyf/Scene.cpp): `src/dyf/Scene.cpp`
- [Draw packet building](https://github.com/dyd-dev/dy_engine/blob/main/src/dyf/DrawData.cpp): `src/dyf/DrawData.cpp`
- [Lighting and shadows](https://github.com/dyd-dev/dy_engine/blob/main/src/dyf/Lighting.cpp): `src/dyf/Lighting.cpp`

### RHI and render path

- [Render graph](https://github.com/dyd-dev/dy_engine/blob/main/src/RHI/RenderGraph.cpp): `src/RHI/RenderGraph.cpp`
- [RHI contracts](https://github.com/dyd-dev/dy_engine/tree/main/src/Public/dyf/RHI): `src/Public/dyf/RHI`
- [Resource management](https://github.com/dyd-dev/dy_engine/blob/main/src/RHI/Resources.cpp): `src/RHI/Resources.cpp`
- [Command recording](https://github.com/dyd-dev/dy_engine/blob/main/src/RHI/ICommandList.cpp): `src/RHI/ICommandList.cpp`

### Graphics backends

- [Vulkan backend](https://github.com/dyd-dev/dy_engine/blob/main/src/Backends/Vulkan/VulkanDevice.cpp): `src/Backends/Vulkan/VulkanDevice.cpp`
- [D3D12 backend](https://github.com/dyd-dev/dy_engine/blob/main/src/Backends/D3D12/D3D12Device.cpp): `src/Backends/D3D12/D3D12Device.cpp`
- [Metal backend](https://github.com/dyd-dev/dy_engine/blob/main/src/Backends/Metal/MetalDevice.h): `src/Backends/Metal/MetalDevice.h`
- [Null backend](https://github.com/dyd-dev/dy_engine/blob/main/src/Backends/Null/NullDevice.cpp): `src/Backends/Null/NullDevice.cpp`

### Platform and extensions

- [Model loading](https://github.com/dyd-dev/dy_engine/tree/main/src/Extend/Model): `src/Extend/Model`
- [Model rendering](https://github.com/dyd-dev/dy_engine/blob/main/src/Extend/Model/ModelRenderer.cpp): `src/Extend/Model/ModelRenderer.cpp`
- [Window and input](https://github.com/dyd-dev/dy_engine/blob/main/src/Platform/Window.cpp): `src/Platform/Window.cpp`
- [Math foundation](https://github.com/dyd-dev/dy_engine/blob/main/src/Public/dyf/Math/Math.h): `src/Public/dyf/Math/Math.h`
- [ImGui extension](https://github.com/dyd-dev/dy_engine/blob/main/src/Extend/ImGui/ImGui.cpp): `src/Extend/ImGui/ImGui.cpp`

### Other components

- **Application**

## Connections

- Application → Renderer: creates and uses
- Application → Scene and materials: builds
- Renderer → Scene and materials: renders (evidence: `src/dyf/Renderer.cpp`)
- Renderer → Draw packet building: builds packets (evidence: `src/dyf/DrawData.cpp`)
- Renderer → Lighting and shadows: renders shadows
- Renderer → Render graph: records passes (evidence: `src/dyf/Renderer.cpp`)
- Renderer → RHI contracts: uses interfaces (evidence: `src/dyf/Renderer.cpp`)
- Render graph → Command recording: executes passes
- Resource management → RHI contracts: implements resource APIs (evidence: `src/RHI/Resources.cpp`)
- Command recording → RHI contracts: implements command API (evidence: `src/RHI/ICommandList.cpp`)
- RHI contracts → Vulkan backend: implemented by
- RHI contracts → D3D12 backend: implemented by
- RHI contracts → Metal backend: implemented by
- RHI contracts → Null backend: implemented by
- Model loading → Model rendering: provides model data
- Model rendering → Renderer: feeds rendering
- Window and input → Renderer: provides window
- ImGui extension → RHI contracts: uses rendering APIs (evidence: `src/Extend/ImGui/ImGui.cpp`)
- Math foundation → Renderer: supports transforms (evidence: `src/dyf/Renderer.cpp`)
