# 2a3s4d/3d-cube architecture

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

- Interactive diagram: https://gitdiagram.com/2a3s4d/3d-cube
- Repository: https://github.com/2a3s4d/3d-cube

## Overview

##### Input Processing Layer
- User Input (mouse/keyboard controls if any)
- Screen Resolution/Viewport Parameters
- Time Uniforms

##### Shader Pipeline
- Fragment Shader (scene.frag)
- Rendering Techniques:
- New Version: Linear Algebra-based Approach
- Old Version: Ray Marching Technique

##### Rendering Components
- Camera System
- Geometry Processing
- Lighting System

##### Specific Elements

- [Input Layer]
- ↓
- [Shader Pipeline]
- ↓
- [Geometry Processing]
- ↓
- [Lighting & Output]

Key Relationships to Highlight:

##### Input Processing → Shader Pipeline
- How viewport and uniform data feed into the shader

##### Shader Pipeline → Geometry Processing
- Demonstrate the mathematical approach (linear algebra vs. ray marching)

##### Geometry → Lighting
- How the final image is composed

##### A clear distinction between the two versions
- New Version (Linear Algebra): Faster, sharper lines

##### Adding a small viewport representation showing
- Camera position
- Rendering space
- Object placement

- All symbols used
- Different line styles (if used to distinguish between versions)
- Performance characteristics of each approach

## Diagram (Mermaid)

```mermaid
graph TB
    %% Define styles
    classDef input fill:#a8d1f0,stroke:#333
    classDef shader fill:#90EE90,stroke:#333
    classDef geometry fill:#FFE5B4,stroke:#333
    classDef output fill:#FFB6C1,stroke:#333
    classDef decision fill:#E6E6FA,stroke:#333
    classDef legend fill:none,stroke:#333

    %% Input Layer
    subgraph InputLayer["Input Processing Layer"]
        UI[User Input]:::input
        VP[Viewport Parameters]:::input
        TU[Time Uniforms]:::input
    end

    %% Shader Pipeline
    subgraph ShaderPipeline["Shader Pipeline"]
        FS[Fragment Shader]:::shader
        click FS "https://github.com/2a3s4d/3d-cube/blob/main/scene.frag"
        
        subgraph RenderingApproach["Rendering Approach"]
            LA[Linear Algebra Approach]:::shader
            RM[Ray Marching Technique]:::shader
        end
    end

    %% Geometry Processing
    subgraph GeometryProcessing["Geometry Processing"]
        CS[Camera System]:::geometry
        GP[Geometry Processing]:::geometry
    end

    %% Lighting and Output
    subgraph LightingOutput["Lighting & Output"]
        LS[Lighting System]:::output
        FO[Final Output]:::output
    end

    %% Connections
    UI --> FS
    VP --> FS
    TU --> FS
    FS --> RenderingApproach
    LA --> GP
    RM --> GP
    CS --> GP
    GP --> LS
    LS --> FO

    %% Legend
    subgraph Legend["Legend"]
        L1[Input Components]:::input
        L2[Shader Operations]:::shader
        L3[Geometry Components]:::geometry
        L4[Output Components]:::output
    end
```
