# nokturnusmf/rasteriser architecture

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

- Interactive diagram: https://gitdiagram.com/nokturnusmf/rasteriser
- Repository: https://github.com/nokturnusmf/rasteriser

## Overview

##### Main Components

a) Input Processing Layer:
- Model Loading (model.h/cpp)
- Texture Loading (texture.h)
- Window Management (window.h/cpp)

b) Core Rendering Pipeline:
- Vertex Processing Stage
- Rasterization Stage
- Fragment/Pixel Processing Stage
- Framebuffer Management (framebuffer.h)

c) Supporting Systems:
- Shader System
- Lighting System (lighting.h/cpp, phong.h/cpp)
- Concurrency Management (concurrency.h)
- Scene Management (scene.h/cpp)

**[Input Layer]**

- ▼
**[Shader System] ←→ [Core Pipeline]**

- ▼
- [Vertex Processing]

- ▼
- [Rasterization]

- ▼
- [Fragment Processing]

- ▼                    ▼
**[Supporting Systems] → [Framebuffer]**

- ▼
- [Display Output]

##### Key Relationships to Highlight

a) Data Flow:
- How model data flows from input through the rendering pipeline
- Texture sampling flow into the fragment processing stage
- Demonstrate framebuffer output to display

b) Control Flow:
- How the shader system interfaces with vertex and pixel processing
- Concurrent execution paths in the pipeline
- How scene management controls the rendering process

##### Technical Details

- GLM integration points for mathematical operations
- GLFW window management interface
- OpenGL interaction for final display
- OpenMP parallel processing regions

##### Implementation Notes

- Use clear, readable fonts for labels
- Brief notes explaining key optimizations
- Version or build information
- Performance-critical paths

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Define styles
    classDef input fill:#a8d1f0,stroke:#333
    classDef processing fill:#90EE90,stroke:#333
    classDef shader fill:#FFB347,stroke:#333
    classDef support fill:#DDA0DD,stroke:#333
    classDef output fill:#FFB6C1,stroke:#333
    classDef system fill:#E6E6FA,stroke:#333

    subgraph Input
        ModelLoader["Model Loading"]:::input
        TextureLoader["Texture Loading"]:::input
        WindowMgr["Window Management"]:::input
    end

    subgraph ShaderSystem
        Shaders["Shader Programs"]:::shader
        MatrixOps["Matrix Operations"]:::shader
        VectorOps["Vector Operations"]:::shader
    end

    subgraph CorePipeline
        VertexProc["Vertex Processing"]:::processing
        Raster["Rasterization Engine"]:::processing
        FragProc["Fragment Processing"]:::processing
    end

    subgraph SupportSystems
        Concurrency["Concurrency Manager"]:::support
        SceneMgr["Scene Management"]:::support
        Lighting["Lighting System"]:::support
        ImageProc["Image Processing"]:::support
        IO["I/O Operations"]:::support
    end

    subgraph Output
        Framebuffer["Framebuffer"]:::output
        Display["Display Output"]:::output
    end

    %% Connections
    ModelLoader --> VertexProc
    TextureLoader --> FragProc
    WindowMgr --> Display

    Shaders <--> VertexProc
    Shaders <--> FragProc
    MatrixOps --> VertexProc
    VectorOps --> FragProc

    VertexProc --> Raster
    Raster --> FragProc
    FragProc --> Framebuffer
    Framebuffer --> Display

    Lighting --> FragProc
    SceneMgr --> VertexProc
    Concurrency --> Raster
    ImageProc --> Framebuffer
    IO --> ModelLoader

    %% Click events
    click ModelLoader "https://github.com/nokturnusmf/Rasteriser/blob/master/src/model.h"
    click TextureLoader "https://github.com/nokturnusmf/Rasteriser/blob/master/src/texture.h"
    click WindowMgr "https://github.com/nokturnusmf/Rasteriser/blob/master/src/window.h"
    click Framebuffer "https://github.com/nokturnusmf/Rasteriser/blob/master/src/framebuffer.h"
    click Raster "https://github.com/nokturnusmf/Rasteriser/blob/master/src/draw.h"
    click Lighting "https://github.com/nokturnusmf/Rasteriser/blob/master/src/lighting.h"
    click Concurrency "https://github.com/nokturnusmf/Rasteriser/blob/master/src/concurrency.h"
    click SceneMgr "https://github.com/nokturnusmf/Rasteriser/blob/master/src/scene.h"
    click MatrixOps "https://github.com/nokturnusmf/Rasteriser/blob/master/src/matrix.h"
    click ImageProc "https://github.com/nokturnusmf/Rasteriser/blob/master/src/bmp.h"
    click IO "https://github.com/nokturnusmf/Rasteriser/blob/master/src/io.h"
    click VectorOps "https://github.com/nokturnusmf/Rasteriser/blob/master/src/tuple.h"

    %% Legend
    subgraph Legend
        L1["Input Components"]:::input
        L2["Processing Stages"]:::processing
        L3["Shader Components"]:::shader
        L4["Support Systems"]:::support
        L5["Output Components"]:::output
    end
```
