# nidalone29/tesselatior architecture

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

- Interactive diagram: https://gitdiagram.com/nidalone29/tesselatior
- Repository: https://github.com/nidalone29/tesselatior

## Overview

##### Main Components

a) Core Application Layer:
- Application Controller (application.cpp)
- Scene Management (scene.cpp)
- Camera System (camera.cpp)
- Input Handling (integrated in application)

b) Rendering Pipeline:
- Renderer (renderer.cpp)
- Framebuffer Management (framebuffer.cpp)
- Shader System (shader.cpp)
- Lighting System (light.cpp)

c) Mesh Processing Systems:
- Halfedge Data Structure (mesh/halfedge.cpp)
- Model Import System (mesh/model_importer.cpp)
- Subdivision Algorithms
- Catmull-Clark (subdiv/catmullclark.cpp)
- Loop (subdiv/loop.cpp)
- Sqrt3 (subdiv/sqrt3.cpp)

d) Resource Management:
- Texture System (texture.cpp)
- Material System (material.cpp)
- Model Loading (mesh/model_importer.cpp)

**Top Layer: User Interface & Input**
**↓**
**Middle Layer: Application Logic & Scene Management**
**↓**
**Bottom Layer: Rendering & Graphics Pipeline**

##### Key Relationships to Highlight

- How the Mesh Processing System feeds into the Rendering Pipeline
- Relationship between Shader System and Tessellation
- Demonstrate how the Subdivision Algorithms interact with the Halfedge Data Structure
- Resource loading flow from files to runtime structures

##### Technical Details

- OpenGL context and shader pipeline
- Mesh data flow through subdivision processes
- Texture and material management system
- Camera and transform hierarchies

## Diagram (Mermaid)

```mermaid
graph TB
    %% Styles
    classDef core fill:#a8d1f0,stroke:#333
    classDef rendering fill:#90caf9,stroke:#333
    classDef mesh fill:#a5d6a7,stroke:#333
    classDef resource fill:#ffe082,stroke:#333
    classDef shader fill:#ce93d8,stroke:#333
    classDef utility fill:#e0e0e0,stroke:#333

    %% Core Application Layer
    subgraph CoreLayer["Core Application Layer"]
        App[Application Controller]:::core
        Scene[Scene Management]:::core
        Camera[Camera System]:::core
        Transform[Transform System]:::core
    end

    %% Rendering Pipeline
    subgraph RenderLayer["Rendering Pipeline"]
        Renderer[Renderer]:::rendering
        Framebuffer[Framebuffer Management]:::rendering
        ShaderSys[Shader System]:::rendering
        Light[Lighting System]:::rendering
    end

    %% Mesh Processing Systems
    subgraph MeshLayer["Mesh Processing Systems"]
        Halfedge[Halfedge Data Structure]:::mesh
        ModelImport[Model Import System]:::mesh
        
        subgraph SubdivAlgos["Subdivision Algorithms"]
            CatmullClark[Catmull-Clark]:::mesh
            Loop[Loop]:::mesh
            Sqrt3[Sqrt3]:::mesh
        end
    end

    %% Resource Management
    subgraph ResourceLayer["Resource Management"]
        Texture[Texture System]:::resource
        Material[Material System]:::resource
    end

    %% Shader Pipeline
    subgraph ShaderLayer["Shader Pipeline"]
        subgraph TessControl["Tessellation Control"]
            CameraLOD["Camera LOD"]:::shader
            PassThroughQuad["Pass Through Quad"]:::shader
            PassThroughTri["Pass Through Tri"]:::shader
        end

        subgraph TessEval["Tessellation Evaluation"]
            PhongTess["Phong Tessellation"]:::shader
            Terrain["Terrain"]:::shader
        end

        PhongFrag["Phong Fragment"]:::shader
        PassVertex["Pass Through Vertex"]:::shader
    end

    %% Relationships
    App --> Scene
    App --> Camera
    Scene --> Transform
    Scene --> Light
    Scene --> Renderer
    
    Renderer --> Framebuffer
    Renderer --> ShaderSys
    ShaderSys --> TessControl
    ShaderSys --> TessEval
    ShaderSys --> PhongFrag
    ShaderSys --> PassVertex
    
    ModelImport --> Halfedge
    Halfedge --> SubdivAlgos
    CatmullClark --> Renderer
    Loop --> Renderer
    Sqrt3 --> Renderer
    
    Material --> Renderer
    Texture --> Material

    %% Click Events
    click App "https://github.com/Nidalone29/Tesselatior/blob/master/src/application.cpp"
    click Scene "https://github.com/Nidalone29/Tesselatior/blob/master/src/scene.cpp"
    click Camera "https://github.com/Nidalone29/Tesselatior/blob/master/src/camera.cpp"
    click Transform "https://github.com/Nidalone29/Tesselatior/blob/master/src/transform.cpp"
    click Renderer "https://github.com/Nidalone29/Tesselatior/blob/master/src/renderer.cpp"
    click Framebuffer "https://github.com/Nidalone29/Tesselatior/blob/master/src/framebuffer.cpp"
    click ShaderSys "https://github.com/Nidalone29/Tesselatior/blob/master/src/shader.cpp"
    click Light "https://github.com/Nidalone29/Tesselatior/blob/master/src/light.cpp"
    click Halfedge "https://github.com/Nidalone29/Tesselatior/blob/master/src/mesh/halfedge.cpp"
    click ModelImport "https://github.com/Nidalone29/Tesselatior/blob/master/src/mesh/model_importer.cpp"
    click CatmullClark "https://github.com/Nidalone29/Tesselatior/blob/master/src/subdiv/catmullclark.cpp"
    click Loop "https://github.com/Nidalone29/Tesselatior/blob/master/src/subdiv/loop.cpp"
    click Sqrt3 "https://github.com/Nidalone29/Tesselatior/blob/master/src/subdiv/sqrt3.cpp"
    click Texture "https://github.com/Nidalone29/Tesselatior/blob/master/src/texture.cpp"
    click Material "https://github.com/Nidalone29/Tesselatior/blob/master/src/material.cpp"
    click CameraLOD "https://github.com/Nidalone29/Tesselatior/blob/master/src/shaders/cameraLOD.tesc"
    click PassThroughQuad "https://github.com/Nidalone29/Tesselatior/blob/master/src/shaders/pass_through_quad.tesc"
    click PassThroughTri "https://github.com/Nidalone29/Tesselatior/blob/master/src/shaders/pass_through_tri.tesc"
    click PhongTess "https://github.com/Nidalone29/Tesselatior/blob/master/src/shaders/phong_tessellation.tese"
    click Terrain "https://github.com/Nidalone29/Tesselatior/blob/master/src/shaders/terrain.tese"
    click PhongFrag "https://github.com/Nidalone29/Tesselatior/blob/master/src/shaders/phong.frag"
    click PassVertex "https://github.com/Nidalone29/Tesselatior/blob/master/src/shaders/pass_through.vert"
```
