# metaltrack/sdf_playground architecture

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

- Interactive diagram: https://gitdiagram.com/metaltrack/sdf_playground
- Repository: https://github.com/metaltrack/sdf_playground

## Overview

SDF_PlayGround is a small interactive signed-distance-field playground. The visible workflow initializes a window and OpenGL, creates a scene shape, sends shape attributes to a shader, and draws a fullscreen pair of triangles; the shader source files themselves are not present in the supplied tree. ImGui integration is imported, but its UI calls are outside the excerpts, so that branch is shown as unverified. The graph focuses on the application runtime rather than vendored library internals.

Main entry points: [`Source.cpp`](https://github.com/metaltrack/sdf_playground/blob/master/Source.cpp) (App Loop), [`Scene.h`](https://github.com/metaltrack/sdf_playground/blob/master/Scene.h) (Shape Scene), [`Shaders/Shader.h`](https://github.com/metaltrack/sdf_playground/blob/master/Shaders/Shader.h) (Shader Program), [`dependencies/include/GLFW/glfw3.h`](https://github.com/metaltrack/sdf_playground/blob/master/dependencies/include/GLFW/glfw3.h) (GLFW Windowing)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Application"]
  node_main["App Loop<br/>[Source.cpp]"]
  node_scene["Shape Scene<br/>[Scene.h]"]
end

subgraph group_render["Rendering"]
  node_shader["Shader Program<br/>[Shader.h]"]
  node_glfw["GLFW Windowing<br/>[glfw3.h]"]
  node_glad["GLAD Loader<br/>[glad.h]"]
end

subgraph group_ui["User Interface"]
  node_imgui["ImGui Controls<br/>[imgui.h]"]
  node_imgui_glfw["GLFW Backend"]
  node_imgui_gl["OpenGL Backend"]
end

node_user(("Operator"))
node_opengl(("OpenGL"))

node_user -->|"operates"| node_main
node_main -->|"creates window"| node_glfw
node_main -->|"loads GL"| node_glad
node_main -->|"adds shape"| node_scene
node_main -->|"reads shape"| node_scene
node_main -->|"sets uniforms"| node_shader
node_shader -->|"reads attributes"| node_scene
node_main -->|"draws triangles"| node_opengl
node_main -.->|"builds controls"| node_imgui
node_main -.->|"uses backend"| node_imgui_glfw
node_main -.->|"uses backend"| node_imgui_gl

click node_main "https://github.com/metaltrack/sdf_playground/blob/master/Source.cpp"
click node_scene "https://github.com/metaltrack/sdf_playground/blob/master/Scene.h"
click node_shader "https://github.com/metaltrack/sdf_playground/blob/master/Shaders/Shader.h"
click node_glfw "https://github.com/metaltrack/sdf_playground/blob/master/dependencies/include/GLFW/glfw3.h"
click node_glad "https://github.com/metaltrack/sdf_playground/blob/master/dependencies/include/glad/glad.h"
click node_imgui "https://github.com/metaltrack/sdf_playground/blob/master/dependencies/include/IMGUI/imgui.h"
click node_imgui_glfw "https://github.com/metaltrack/sdf_playground/blob/master/dependencies/imgui_impl_glfw.cpp"
click node_imgui_gl "https://github.com/metaltrack/sdf_playground/blob/master/dependencies/imgui_impl_opengl3.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_scene toneBlue
class node_shader,node_glfw,node_glad toneAmber
class node_imgui,node_imgui_glfw,node_imgui_gl toneMint
class node_user,node_opengl toneIndigo
```

## Components

### Application

- [App Loop](https://github.com/metaltrack/sdf_playground/blob/master/Source.cpp): `Source.cpp`
- [Shape Scene](https://github.com/metaltrack/sdf_playground/blob/master/Scene.h): `Scene.h`

### Rendering

- [Shader Program](https://github.com/metaltrack/sdf_playground/blob/master/Shaders/Shader.h): `Shaders/Shader.h`
- [GLFW Windowing](https://github.com/metaltrack/sdf_playground/blob/master/dependencies/include/GLFW/glfw3.h): `dependencies/include/GLFW/glfw3.h`
- [GLAD Loader](https://github.com/metaltrack/sdf_playground/blob/master/dependencies/include/glad/glad.h): `dependencies/include/glad/glad.h`

### User Interface

- [ImGui Controls](https://github.com/metaltrack/sdf_playground/blob/master/dependencies/include/IMGUI/imgui.h): `dependencies/include/IMGUI/imgui.h`
- [GLFW Backend](https://github.com/metaltrack/sdf_playground/blob/master/dependencies/imgui_impl_glfw.cpp): `dependencies/imgui_impl_glfw.cpp`
- [OpenGL Backend](https://github.com/metaltrack/sdf_playground/blob/master/dependencies/imgui_impl_opengl3.cpp): `dependencies/imgui_impl_opengl3.cpp`

### Other components

- **Operator**
- **OpenGL**

## Connections

- Operator → App Loop: operates
- App Loop → GLFW Windowing: creates window (evidence: `Source.cpp`)
- App Loop → GLAD Loader: loads GL (evidence: `Source.cpp`)
- App Loop → Shape Scene: adds shape (evidence: `Source.cpp`)
- App Loop → Shape Scene: reads shape (evidence: `Source.cpp`)
- App Loop → Shader Program: sets uniforms (evidence: `Source.cpp`)
- Shader Program → Shape Scene: reads attributes (evidence: `Shaders/Shader.h`)
- App Loop → OpenGL: draws triangles (evidence: `Source.cpp`)
- App Loop → ImGui Controls: builds controls (evidence: `Source.cpp`)
- App Loop → GLFW Backend: uses backend
- App Loop → OpenGL Backend: uses backend
