# sotsf/canopy-unity architecture

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

## Overview

##### Main System Components
- Create distinct sections for these key components:
a. Node Editor Framework (Core)
b. Texture Synthesis Engine
c. Visualization System
d. I/O Systems (MIDI, DMX/ArtNet)
e. Unity Runtime Environment

##### Layer Organization

Top Layer (User Interface):
- Node Editor Interface
- Canvas Management
- Pattern Preview Windows

Middle Layer (Processing):
- Node Graph Execution Engine
- Texture Synthesis Pipeline
- Pattern Generation System
- Real-time Compute Shader Processing

Bottom Layer (I/O & Hardware):
- MIDI Input Processing
- ArtNet/DMX Output
- Hardware Rendering Pipeline

##### Key Relationships to Highlight

a. Data Flow:
- How processed textures are output to the visualization system
- Real-time feedback loops for interactive patterns

b. Component Integration:
- How the Node Editor framework connects to the Texture Synthesis engine
- Relationship between compute shaders and the rendering pipeline
- Demonstrate how MIDI input affects pattern parameters

##### Specific Implementation Details

- Blue: Core Unity components (Rendering, Input System)
- Green: Custom node processing systems
- Orange: External I/O systems (MIDI, ArtNet)
- Purple: Compute shader resources

##### Important Subsystems to Detail

Create insets or detailed views for:
- Node Graph Execution Pipeline
- Texture Processing Chain
- Pattern Generation System
- Hardware Output Pipeline

##### Technical Elements

- Compute Shaders (located in NodeShaders directory)
- Pattern Nodes (showing inheritance from base Node class)
- Resource Management System
- Canvas Save/Load System

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph "User Interface Layer"
        NE["Node Editor Interface"]
        CM["Canvas Management"]
        PPW["Pattern Preview Windows"]
    end

    subgraph "Processing Layer"
        NGE["Node Graph Execution"]
        TSP["Texture Synthesis Pipeline"]
        PGS["Pattern Generation System"]
        CSP["Compute Shader Processing"]
    end

    subgraph "I/O & Hardware Layer"
        MIDI["MIDI Processing"]
        DMXO["DMX/ArtNet Output"]
        HRP["Hardware Rendering"]
    end

    subgraph "Core Components"
        NC["Node Core"]
        NCanvas["Node Canvas"]
        TNM["Ticking Node Manager"]
    end

    subgraph "Resource Components"
        CShaders["Compute Shaders"]
        CanopyMat["Canopy Material"]
        VFX["VFX Effects"]
    end

    %% Relationships
    NE --> NC
    NE --> NCanvas
    CM --> NCanvas
    NC --> NGE
    NGE --> TSP
    TSP --> PGS
    PGS --> CSP
    CSP --> HRP
    MIDI --> PGS
    CSP --> DMXO
    TNM --> PGS

    %% Styling
    classDef core fill:#blue
    classDef processing fill:#green
    classDef io fill:#orange
    classDef compute fill:#purple

    class NC,NCanvas core
    class NGE,TSP,PGS processing
    class MIDI,DMXO io
    class CSP,HRP compute

    %% Click events
    click NE "https://github.com/sotsf/canopy-unity/blob/main/Assets/Plugins/Node_Editor/Framework/Interface/NodeEditorInterface.cs"
    click NC "https://github.com/sotsf/canopy-unity/blob/main/Assets/Plugins/Node_Editor/Framework/Core/Node.cs"
    click NCanvas "https://github.com/sotsf/canopy-unity/blob/main/Assets/Plugins/Node_Editor/Framework/Core/NodeCanvas.cs"
    click CM "https://github.com/sotsf/canopy-unity/blob/main/Assets/Plugins/Node_Editor/Framework/Interface/CanvasManager.cs"
    click TNM "https://github.com/sotsf/canopy-unity/blob/main/Assets/Scripts/TextureSynthesis/Components/TickingNodeManager.cs"
    click PGS "https://github.com/sotsf/canopy-unity/blob/main/Assets/Scripts/TextureSynthesis/Components/PatternManager.cs"
    click MIDI "https://github.com/sotsf/canopy-unity/blob/main/Assets/MidiJack/MidiMaster.cs"
    click DMXO "https://github.com/sotsf/canopy-unity/blob/main/Assets/eDmx.ArtNet/Sockets/ArtNetSocket.cs"
    click CShaders "https://github.com/sotsf/canopy-unity/tree/main/Assets/Scripts/TextureSynthesis/Resources/NodeShaders"
    click CanopyMat "https://github.com/sotsf/canopy-unity/blob/main/Assets/TextureSynthesis/Display/CanopyMaterial.mat"
    click VFX "https://github.com/sotsf/canopy-unity/tree/main/Assets/VFX/VFXWork/Effects"
    click HRP "https://github.com/sotsf/canopy-unity/blob/main/Assets/Scripts/Simulation/Canopy.cs"
```
