# nicholasgallina/nemesis architecture

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

- Interactive diagram: https://gitdiagram.com/nicholasgallina/nemesis
- Repository: https://github.com/nicholasgallina/nemesis

## Overview

Nemesis is a Rust/Vulkan molecular visualization engine. The main workflow is launching the windowed app, loading PDB atom and bond data into GPU-ready molecule objects, then drawing them interactively with camera controls. The graph also preserves the separate OBJ game-object path and the Vulkan resource/rendering layers. Evidence is limited to the README and sampled source/index references; relationships not directly shown are omitted.

Main entry points: [`src/first_app.rs`](https://github.com/nicholasgallina/nemesis/blob/master/src/first_app.rs) (App Orchestration), [`src/nre_device.rs`](https://github.com/nicholasgallina/nemesis/blob/master/src/nre_device.rs) (Vulkan Device), [`src/nre_pipeline.rs`](https://github.com/nicholasgallina/nemesis/blob/master/src/nre_pipeline.rs) (Graphics Pipelines), [`src/nre_renderer.rs`](https://github.com/nicholasgallina/nemesis/blob/master/src/nre_renderer.rs) (Frame Renderer)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Application"]
  node_entry["App Entry<br/>[main.rs]"]
  node_app_flow["App Orchestration<br/>[first_app.rs]"]
  node_window["Window Events<br/>[nre_window.rs]"]
  node_commands["Load Commands<br/>[nre_file.rs]"]
end

subgraph group_domain["Molecule and Scene"]
  node_pdb["PDB Parsing<br/>[nre_model.rs]"]
  node_molecule["Molecule GPU Model<br/>[nre_model.rs]"]
  node_scene_object["Scene Objects<br/>[nre_game_object.rs]"]
end

subgraph group_gpu["Vulkan Rendering"]
  node_device["Vulkan Device<br/>[nre_device.rs]"]
  node_descriptors["Uniform Descriptors<br/>[nre_descriptor.rs]"]
  node_pipeline["Graphics Pipelines<br/>[nre_pipeline.rs]"]
  node_swapchain["Swap Chain<br/>[nre_swap_chain.rs]"]
  node_renderer["Frame Renderer<br/>[nre_renderer.rs]"]
  node_shaders["Atom and Bond Shaders"]
end

subgraph group_input["View Controls"]
  node_controller["Camera Controller<br/>[nre_controller.rs]"]
  node_camera["Perspective Camera<br/>[nre_camera.rs]"]
end

node_user(("Viewer"))
node_pdb_file["PDB Structure<br/>[molecule.pdb]"]
node_obj_file["OBJ Model<br/>[character.obj]"]

node_user -->|"launches"| node_entry
node_entry -->|"starts"| node_app_flow
node_app_flow -.->|"creates"| node_window
node_app_flow -->|"initializes"| node_device
node_app_flow -->|"loads structure"| node_pdb
node_pdb_file -->|"default input"| node_app_flow
node_app_flow -->|"builds molecule"| node_molecule
node_app_flow -->|"builds OBJ object"| node_scene_object
node_obj_file -->|"default model"| node_app_flow
node_app_flow -->|"handles load command"| node_commands
node_app_flow -.->|"updates controls"| node_controller
node_controller -->|"updates pose"| node_camera
node_app_flow -.->|"reads matrices"| node_camera
node_app_flow -.->|"sets uniforms"| node_descriptors
node_app_flow -->|"records frames"| node_renderer
node_app_flow -->|"binds pipelines"| node_pipeline
node_molecule -->|"allocates buffers"| node_device
node_descriptors -->|"allocates resources"| node_device
node_pipeline -->|"creates pipeline"| node_device
node_renderer -->|"acquires and presents"| node_swapchain
node_renderer -->|"recreates pipeline"| node_pipeline
node_swapchain -->|"creates render resources"| node_device
node_pipeline -.->|"loads shader modules"| node_shaders
node_app_flow -->|"draws instances"| node_molecule

click node_entry "https://github.com/nicholasgallina/nemesis/blob/master/src/main.rs"
click node_app_flow "https://github.com/nicholasgallina/nemesis/blob/master/src/first_app.rs"
click node_window "https://github.com/nicholasgallina/nemesis/blob/master/src/nre_window.rs"
click node_commands "https://github.com/nicholasgallina/nemesis/blob/master/src/nre_file.rs"
click node_controller "https://github.com/nicholasgallina/nemesis/blob/master/src/nre_controller.rs"
click node_camera "https://github.com/nicholasgallina/nemesis/blob/master/src/nre_camera.rs"
click node_pdb "https://github.com/nicholasgallina/nemesis/blob/master/src/nre_model.rs"
click node_molecule "https://github.com/nicholasgallina/nemesis/blob/master/src/nre_model.rs"
click node_scene_object "https://github.com/nicholasgallina/nemesis/blob/master/src/nre_game_object.rs"
click node_device "https://github.com/nicholasgallina/nemesis/blob/master/src/nre_device.rs"
click node_descriptors "https://github.com/nicholasgallina/nemesis/blob/master/src/nre_descriptor.rs"
click node_pipeline "https://github.com/nicholasgallina/nemesis/blob/master/src/nre_pipeline.rs"
click node_swapchain "https://github.com/nicholasgallina/nemesis/blob/master/src/nre_swap_chain.rs"
click node_renderer "https://github.com/nicholasgallina/nemesis/blob/master/src/nre_renderer.rs"
click node_shaders "https://github.com/nicholasgallina/nemesis/tree/master/shaders"
click node_pdb_file "https://github.com/nicholasgallina/nemesis/blob/master/models/molecule.pdb"
click node_obj_file "https://github.com/nicholasgallina/nemesis/blob/master/models/character.obj"

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_entry,node_app_flow,node_window,node_commands,node_user toneBlue
class node_pdb,node_molecule,node_scene_object toneAmber
class node_device,node_descriptors,node_pipeline,node_swapchain,node_renderer,node_shaders toneMint
class node_controller,node_camera toneRose
class node_pdb_file toneTeal
class node_obj_file toneIndigo
```

## Components

### Application

- [App Entry](https://github.com/nicholasgallina/nemesis/blob/master/src/main.rs): `src/main.rs`
- [App Orchestration](https://github.com/nicholasgallina/nemesis/blob/master/src/first_app.rs): `src/first_app.rs`
- [Window Events](https://github.com/nicholasgallina/nemesis/blob/master/src/nre_window.rs): `src/nre_window.rs`
- [Load Commands](https://github.com/nicholasgallina/nemesis/blob/master/src/nre_file.rs): `src/nre_file.rs`

### Molecule and Scene

- [PDB Parsing](https://github.com/nicholasgallina/nemesis/blob/master/src/nre_model.rs): `src/nre_model.rs`
- [Molecule GPU Model](https://github.com/nicholasgallina/nemesis/blob/master/src/nre_model.rs): `src/nre_model.rs`
- [Scene Objects](https://github.com/nicholasgallina/nemesis/blob/master/src/nre_game_object.rs): `src/nre_game_object.rs`

### Vulkan Rendering

- [Vulkan Device](https://github.com/nicholasgallina/nemesis/blob/master/src/nre_device.rs): `src/nre_device.rs`
- [Uniform Descriptors](https://github.com/nicholasgallina/nemesis/blob/master/src/nre_descriptor.rs): `src/nre_descriptor.rs`
- [Graphics Pipelines](https://github.com/nicholasgallina/nemesis/blob/master/src/nre_pipeline.rs): `src/nre_pipeline.rs`
- [Swap Chain](https://github.com/nicholasgallina/nemesis/blob/master/src/nre_swap_chain.rs): `src/nre_swap_chain.rs`
- [Frame Renderer](https://github.com/nicholasgallina/nemesis/blob/master/src/nre_renderer.rs): `src/nre_renderer.rs`
- [Atom and Bond Shaders](https://github.com/nicholasgallina/nemesis/tree/master/shaders): `shaders`

### View Controls

- [Camera Controller](https://github.com/nicholasgallina/nemesis/blob/master/src/nre_controller.rs): `src/nre_controller.rs`
- [Perspective Camera](https://github.com/nicholasgallina/nemesis/blob/master/src/nre_camera.rs): `src/nre_camera.rs`

### Other components

- **Viewer**
- [PDB Structure](https://github.com/nicholasgallina/nemesis/blob/master/models/molecule.pdb): `models/molecule.pdb`
- [OBJ Model](https://github.com/nicholasgallina/nemesis/blob/master/models/character.obj): `models/character.obj`

## Connections

- Viewer → App Entry: launches (evidence: `README.md`)
- App Entry → App Orchestration: starts (evidence: `src/main.rs`)
- App Orchestration → Window Events: creates (evidence: `src/first_app.rs`)
- App Orchestration → Vulkan Device: initializes (evidence: `src/first_app.rs`)
- App Orchestration → PDB Parsing: loads structure (evidence: `src/first_app.rs`)
- PDB Structure → App Orchestration: default input (evidence: `src/first_app.rs`)
- App Orchestration → Molecule GPU Model: builds molecule (evidence: `src/first_app.rs`)
- App Orchestration → Scene Objects: builds OBJ object (evidence: `src/first_app.rs`)
- OBJ Model → App Orchestration: default model (evidence: `src/first_app.rs`)
- App Orchestration → Load Commands: handles load command (evidence: `src/first_app.rs`)
- App Orchestration → Camera Controller: updates controls (evidence: `src/first_app.rs`)
- Camera Controller → Perspective Camera: updates pose (evidence: `src/nre_controller.rs`)
- App Orchestration → Perspective Camera: reads matrices (evidence: `src/first_app.rs`)
- App Orchestration → Uniform Descriptors: sets uniforms (evidence: `src/first_app.rs`)
- App Orchestration → Frame Renderer: records frames (evidence: `src/first_app.rs`)
- App Orchestration → Graphics Pipelines: binds pipelines (evidence: `src/first_app.rs`)
- Molecule GPU Model → Vulkan Device: allocates buffers (evidence: `src/nre_model.rs`)
- Uniform Descriptors → Vulkan Device: allocates resources (evidence: `src/nre_descriptor.rs`)
- Graphics Pipelines → Vulkan Device: creates pipeline (evidence: `src/nre_pipeline.rs`)
- Frame Renderer → Swap Chain: acquires and presents (evidence: `src/nre_renderer.rs`)
- Frame Renderer → Graphics Pipelines: recreates pipeline (evidence: `src/nre_renderer.rs`)
- Swap Chain → Vulkan Device: creates render resources (evidence: `src/nre_swap_chain.rs`)
- Graphics Pipelines → Atom and Bond Shaders: loads shader modules
- App Orchestration → Molecule GPU Model: draws instances (evidence: `src/first_app.rs`)
