# scrtwpns/mixbox architecture

> Architecture diagram of the GitHub repository scrtwpns/mixbox, 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/scrtwpns/mixbox
- Repository: https://github.com/scrtwpns/mixbox

## Overview

##### Main Components

a. Core Engine Layer:
- Kubelka & Munk Theory Implementation
- LUT (Look-Up Table) Data Storage

b. Language-Specific Implementations:
- C/C++ Core Implementation
- Java/Android Implementation
- JavaScript/WebGL Implementation
- Python Implementation
- Rust Implementation
- C# Implementation

c. Graphics Engine Integrations:
- Unity Integration
- Godot Integration
- Shader Implementations (GLSL, HLSL, Metal)

**┌─────────────────────────────────────────────┐**
- Application Layer              │
- (Examples, Demos, Integration Samples)     │
- ┤
- Framework Integrations            │
- Unity │ Godot │ WebGL │ Graphics APIs    │
- ┤
- Language-Specific Bindings          │
- C++ │ Java │ JavaScript │ Python │ Others   │
- ┤
- Core Mixbox Engine             │
- ┘

##### Component Relationships

- Data flow between components
- Dependency relationships
- Integration points
- API calls

##### Implementation Details

Technical specifications:
- Input/Output formats (RGB values)
- Performance considerations
- Memory management

##### Notes Section

Important implementation details:
- LUT usage requirements
- Platform-specific considerations
- Performance optimization tips
- Integration guidelines

##### Integration flexibility

This system design should help developers understand how to integrate Mixbox into their projects while maintaining a clear view of the internal architecture and cross-platform support.

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Core["Core Engine Layer"]
        direction TB
        Algorithm["Mixbox Color Mixing Algorithm"]
        KM["Kubelka & Munk Theory"]
        LUT["LUT Data Storage"]:::data
        ColorUtils["Color Space Conversion"]
        
        Algorithm --> KM
        KM --> LUT
        Algorithm --> ColorUtils
    end

    subgraph Lang["Language-Specific Implementations"]
        direction TB
        CPP["C/C++ Implementation"]:::impl
        Java["Java Implementation"]:::impl
        JS["JavaScript Implementation"]:::impl
        Python["Python Implementation"]:::impl
        Rust["Rust Implementation"]:::impl
        CSharp["C# Implementation"]:::impl
    end

    subgraph Graphics["Graphics Engine & Shader Integration"]
        direction TB
        Unity["Unity Integration"]:::graphics
        Godot["Godot Integration"]:::graphics
        
        subgraph Shaders["Shader Implementations"]
            direction TB
            GLSL["GLSL"]:::shader
            HLSL["HLSL"]:::shader
            Metal["Metal"]:::shader
            OSL["OSL"]:::shader
        end
    end

    subgraph Apps["Application Layer"]
        direction TB
        JSEx["JavaScript Examples"]:::example
        PyEx["Python Examples"]:::example
        JavaEx["Java Examples"]:::example
        CSEx["C# Examples"]:::example
        UnityEx["Unity Samples"]:::example
        WebGLEx["WebGL Examples"]:::example
    end

    Core --> Lang
    Lang --> Graphics
    Graphics --> Apps

    %% Component Mappings
    click CPP "https://github.com/scrtwpns/mixbox/blob/master/cpp/mixbox.cpp"
    click Java "https://github.com/scrtwpns/mixbox/blob/master/java/src/main/java/com/scrtwpns/Mixbox.java"
    click JS "https://github.com/scrtwpns/mixbox/blob/master/javascript/mixbox.js"
    click Python "https://github.com/scrtwpns/mixbox/blob/master/python/mixbox.py"
    click Rust "https://github.com/scrtwpns/mixbox/blob/master/rust/src/lib.rs"
    click CSharp "https://github.com/scrtwpns/mixbox/blob/master/csharp/Mixbox.cs"
    click Unity "https://github.com/scrtwpns/mixbox/blob/master/unity/Runtime/Mixbox.cs"
    click Godot "https://github.com/scrtwpns/mixbox/blob/master/godot/addons/mixbox/mixbox.gd"
    click GLSL "https://github.com/scrtwpns/mixbox/blob/master/shaders/mixbox.glsl"
    click HLSL "https://github.com/scrtwpns/mixbox/blob/master/shaders/mixbox.hlsl"
    click Metal "https://github.com/scrtwpns/mixbox/blob/master/shaders/mixbox.metal"
    click OSL "https://github.com/scrtwpns/mixbox/blob/master/shaders/mixbox.osl"
    click LUT "https://github.com/scrtwpns/mixbox/blob/master/java/src/main/resources/com/scrtwpns/mixbox_lut.dat"
    click JSEx "https://github.com/scrtwpns/mixbox/tree/master/javascript/examples"
    click PyEx "https://github.com/scrtwpns/mixbox/tree/master/python/examples"
    click JavaEx "https://github.com/scrtwpns/mixbox/tree/master/java/examples"
    click CSEx "https://github.com/scrtwpns/mixbox/tree/master/csharp/examples"
    click UnityEx "https://github.com/scrtwpns/mixbox/tree/master/unity/Samples~"
    click WebGLEx "https://github.com/scrtwpns/mixbox/blob/master/webgl/example.html"

    %% Styling
    classDef core fill:#2b4b6b,stroke:#1a2d40,color:#fff
    classDef impl fill:#2d632f,stroke:#1a3a1b,color:#fff
    classDef graphics fill:#bf6000,stroke:#733a00,color:#fff
    classDef shader fill:#8c4500,stroke:#542900,color:#fff
    classDef example fill:#5c3d5c,stroke:#372337,color:#fff
    classDef data fill:#ab9b00,stroke:#665d00,color:#fff

    class Algorithm,KM,ColorUtils core
    class CPP,Java,JS,Python,Rust,CSharp impl
    class Unity,Godot graphics
    class GLSL,HLSL,Metal,OSL shader
    class JSEx,PyEx,JavaEx,CSEx,UnityEx,WebGLEx example
```
