# r3v1z3/shadertoy2zge architecture

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

- Interactive diagram: https://gitdiagram.com/r3v1z3/shadertoy2zge
- Repository: https://github.com/r3v1z3/shadertoy2zge

## Overview

- User Input → Shadertoy Code
- User Input → Variable Definitions
- User Input → Metadata (Title, Author)

- Code Parser → Variable Extraction
- Template Engine → Code Integration
- Variable Processing → Uniform Generation

- Processed Code → ZGE Project File
- Download Generation → User Download

##### Key Processing Modules (Use nested components)

a. Variable Processor
- ZGE Prefix Detection
- Range Extraction
- Separator Detection

b. Shader Transformer
- Texture Call Replacement
- iChannel Mapping
- Uniform Declaration Generation

- Delta Time Processing
- Texture Handling
- Parameter Generation
- Range Normalization

##### Frontend interface at the top, showing the user interaction point.

2. Processing core in the center, with clear connections to both input and output.

##### Specific labels
- "Shadertoy Input"
- "ZGE Project Output"
- "Variable Processing"
- "Template Integration"

##### Technical details in notes
- GLSL shader support
- Texture2D mapping
- Uniform variable handling
- Parameter range processing

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Main Components
    subgraph Frontend
        UI[Frontend Interface]:::frontend
        HTML[index.html]:::frontend
        CSS[style.css]:::frontend
        JS[script.js]:::frontend
        UI --> HTML
        UI --> CSS
        UI --> JS
    end

    subgraph ProcessingCore
        Parser[Shader Code Parser]:::processing
        VarExtract[Variable Extractor]:::processing
        TempEngine[Template Engine]:::processing
    end

    subgraph TemplateSystem
        TD[Templates Directory]:::template
        BT[Basic Template]:::template
        TD --> BT
    end

    subgraph VariableProcessor
        Prefix[ZGE Prefix Detection]:::processing
        Range[Range Extraction]:::processing
        Sep[Separator Detection]:::processing
    end

    subgraph ShaderTransformer
        TexReplace[Texture Call Replacement]:::processing
        ChannelMap[iChannel Mapping]:::processing
        UniformGen[Uniform Declaration]:::processing
    end

    %% Data Flow
    Input[/"Shadertoy Input"/]:::input
    Output[\"ZGE Project Output"\]:::output
    
    Input -->|Code| Parser
    Parser --> VarExtract
    VarExtract --> Prefix
    Prefix --> Range
    Range --> Sep
    
    TD --> TempEngine
    TempEngine --> TexReplace
    TexReplace --> ChannelMap
    ChannelMap --> UniformGen
    UniformGen --> Output

    %% Special Features
    SpecialFeatures[Special Features]:::features
    DeltaTime[Delta Time Processing]:::features
    TextureHandle[Texture Handling]:::features
    ParamGen[Parameter Generation]:::features
    RangeNorm[Range Normalization]:::features
    
    SpecialFeatures --> DeltaTime
    SpecialFeatures --> TextureHandle
    SpecialFeatures --> ParamGen
    SpecialFeatures --> RangeNorm

    %% Styling
    classDef frontend fill:#a8d1ff,stroke:#333
    classDef processing fill:#90EE90,stroke:#333
    classDef template fill:#D3D3D3,stroke:#333
    classDef input fill:#FFB6C1,stroke:#333
    classDef output fill:#FFA500,stroke:#333
    classDef features fill:#DDA0DD,stroke:#333

    %% Click Events
    click HTML "https://github.com/R3V1Z3/shadertoy2zge/blob/main/index.html"
    click CSS "https://github.com/R3V1Z3/shadertoy2zge/blob/main/style.css"
    click JS "https://github.com/R3V1Z3/shadertoy2zge/blob/main/script.js"
    click Parser "https://github.com/R3V1Z3/shadertoy2zge/blob/main/script.js"
    click TD "https://github.com/R3V1Z3/shadertoy2zge/tree/main/templates"
    click BT "https://github.com/R3V1Z3/shadertoy2zge/blob/main/templates/basic.zgeproj"

    %% Legend
    subgraph Legend
        L1[Frontend Components]:::frontend
        L2[Processing Components]:::processing
        L3[Template Components]:::template
        L4[/"Input Components"/]:::input
        L5[\"Output Components"\]:::output
        L6[Special Features]:::features
    end
```
