# 3dsage/opengl-doom_tutorial_part_2 architecture

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

- Interactive diagram: https://gitdiagram.com/3dsage/opengl-doom_tutorial_part_2
- Repository: https://github.com/3dsage/opengl-doom_tutorial_part_2

## Overview

This tree contains two small, separate C/OpenGL programs: a first-person 3D rendering demo and a 2D sector editor. Their user workflow is keyboard/mouse input into movement or level-editing state, followed by rendered output; the editor also has a save operation. The texture headers are embedded pixel data, and level.h is a level-data file. The README is empty and the source excerpts are partial, so uncertain file loading and connections between the programs are omitted.

Main entry points: [`Grid2D.c`](https://github.com/3dsage/opengl-doom_tutorial_part_2/blob/main/Grid2D.c) (Edit Controls), [`Doom_Part_1.c`](https://github.com/3dsage/opengl-doom_tutorial_part_2/blob/main/Doom_Part_1.c) (Doom Runtime), [`textures/T_01.h`](https://github.com/3dsage/opengl-doom_tutorial_part_2/blob/main/textures/T_01.h) (Texture Pixels), [`textures/T_NUMBERS.h`](https://github.com/3dsage/opengl-doom_tutorial_part_2/blob/main/textures/T_NUMBERS.h) (Number Pixels)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_doom["3D Demo"]
  node_doom_app["Doom Runtime<br/>[Doom_Part_1.c]"]
  node_doom_input["Movement Input<br/>[Doom_Part_1.c]"]
  node_player_motion["Player Motion<br/>[Doom_Part_1.c]"]
  node_sector_render["Sector Renderer<br/>[Doom_Part_1.c]"]
  node_doom_pixels["Pixel Output<br/>[Doom_Part_1.c]"]
end

subgraph group_editor["2D Editor"]
  node_grid_app["Editor Runtime<br/>[Grid2D.c]"]
  node_grid_input["Edit Controls<br/>[Grid2D.c]"]
  node_sector_edit["Sector Editing<br/>[Grid2D.c]"]
  node_grid_render["Grid Renderer<br/>[Grid2D.c]"]
  node_level_save["Level Save<br/>[Grid2D.c]"]
end

subgraph group_assets["Level Assets"]
  node_level_data["Level Data<br/>[level.h]"]
  node_texture_data["Texture Pixels<br/>[T_01.h]"]
  node_number_data["Number Pixels<br/>[T_NUMBERS.h]"]
  node_view_data["View Pixels<br/>[T_VIEW2D.h]"]
end

node_player(("Player"))
node_grid_user(("Editor User"))

node_player -->|"presses keys"| node_doom_input
node_doom_input -->|"sets controls"| node_player_motion
node_doom_app -->|"updates player"| node_player_motion
node_doom_app -->|"draws sectors"| node_sector_render
node_sector_render -->|"draws pixels"| node_doom_pixels
node_grid_user -->|"uses controls"| node_grid_input
node_grid_app -->|"registers callbacks"| node_grid_input
node_grid_input -->|"updates sectors"| node_sector_edit
node_grid_app -->|"draws editor"| node_grid_render
node_grid_input -->|"saves level"| node_level_save
node_grid_render -->|"reads pixels"| node_texture_data
node_grid_render -->|"reads digits"| node_number_data

click node_doom_app "https://github.com/3dsage/opengl-doom_tutorial_part_2/blob/main/Doom_Part_1.c"
click node_doom_input "https://github.com/3dsage/opengl-doom_tutorial_part_2/blob/main/Doom_Part_1.c"
click node_player_motion "https://github.com/3dsage/opengl-doom_tutorial_part_2/blob/main/Doom_Part_1.c"
click node_sector_render "https://github.com/3dsage/opengl-doom_tutorial_part_2/blob/main/Doom_Part_1.c"
click node_doom_pixels "https://github.com/3dsage/opengl-doom_tutorial_part_2/blob/main/Doom_Part_1.c"
click node_grid_app "https://github.com/3dsage/opengl-doom_tutorial_part_2/blob/main/Grid2D.c"
click node_grid_input "https://github.com/3dsage/opengl-doom_tutorial_part_2/blob/main/Grid2D.c"
click node_sector_edit "https://github.com/3dsage/opengl-doom_tutorial_part_2/blob/main/Grid2D.c"
click node_grid_render "https://github.com/3dsage/opengl-doom_tutorial_part_2/blob/main/Grid2D.c"
click node_level_save "https://github.com/3dsage/opengl-doom_tutorial_part_2/blob/main/Grid2D.c"
click node_level_data "https://github.com/3dsage/opengl-doom_tutorial_part_2/blob/main/level.h"
click node_texture_data "https://github.com/3dsage/opengl-doom_tutorial_part_2/blob/main/textures/T_01.h"
click node_number_data "https://github.com/3dsage/opengl-doom_tutorial_part_2/blob/main/textures/T_NUMBERS.h"
click node_view_data "https://github.com/3dsage/opengl-doom_tutorial_part_2/blob/main/textures/T_VIEW2D.h"

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_doom_app,node_doom_input,node_player_motion,node_sector_render,node_doom_pixels,node_grid_user toneBlue
class node_grid_app,node_grid_input,node_sector_edit,node_grid_render,node_level_save toneAmber
class node_level_data,node_texture_data,node_number_data,node_view_data toneMint
class node_player toneIndigo
```

## Components

### 3D Demo

- [Doom Runtime](https://github.com/3dsage/opengl-doom_tutorial_part_2/blob/main/Doom_Part_1.c): `Doom_Part_1.c`
- [Movement Input](https://github.com/3dsage/opengl-doom_tutorial_part_2/blob/main/Doom_Part_1.c): `Doom_Part_1.c`
- [Player Motion](https://github.com/3dsage/opengl-doom_tutorial_part_2/blob/main/Doom_Part_1.c): `Doom_Part_1.c`
- [Sector Renderer](https://github.com/3dsage/opengl-doom_tutorial_part_2/blob/main/Doom_Part_1.c): `Doom_Part_1.c`
- [Pixel Output](https://github.com/3dsage/opengl-doom_tutorial_part_2/blob/main/Doom_Part_1.c): `Doom_Part_1.c`

### 2D Editor

- [Editor Runtime](https://github.com/3dsage/opengl-doom_tutorial_part_2/blob/main/Grid2D.c): `Grid2D.c`
- [Edit Controls](https://github.com/3dsage/opengl-doom_tutorial_part_2/blob/main/Grid2D.c): `Grid2D.c`
- [Sector Editing](https://github.com/3dsage/opengl-doom_tutorial_part_2/blob/main/Grid2D.c): `Grid2D.c`
- [Grid Renderer](https://github.com/3dsage/opengl-doom_tutorial_part_2/blob/main/Grid2D.c): `Grid2D.c`
- [Level Save](https://github.com/3dsage/opengl-doom_tutorial_part_2/blob/main/Grid2D.c): `Grid2D.c`

### Level Assets

- [Level Data](https://github.com/3dsage/opengl-doom_tutorial_part_2/blob/main/level.h): `level.h`
- [Texture Pixels](https://github.com/3dsage/opengl-doom_tutorial_part_2/blob/main/textures/T_01.h): `textures/T_01.h`
- [Number Pixels](https://github.com/3dsage/opengl-doom_tutorial_part_2/blob/main/textures/T_NUMBERS.h): `textures/T_NUMBERS.h`
- [View Pixels](https://github.com/3dsage/opengl-doom_tutorial_part_2/blob/main/textures/T_VIEW2D.h): `textures/T_VIEW2D.h`

### Other components

- **Player**
- **Editor User**

## Connections

- Player → Movement Input: presses keys
- Movement Input → Player Motion: sets controls
- Doom Runtime → Player Motion: updates player
- Doom Runtime → Sector Renderer: draws sectors
- Sector Renderer → Pixel Output: draws pixels
- Editor User → Edit Controls: uses controls
- Editor Runtime → Edit Controls: registers callbacks
- Edit Controls → Sector Editing: updates sectors
- Editor Runtime → Grid Renderer: draws editor
- Edit Controls → Level Save: saves level
- Grid Renderer → Texture Pixels: reads pixels
- Grid Renderer → Number Pixels: reads digits
