# p-rer/nodevideoeffects architecture

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

- Interactive diagram: https://gitdiagram.com/p-rer/nodevideoeffects
- Repository: https://github.com/p-rer/nodevideoeffects

## Overview

##### Project type and purpose
- NodeVideoEffects is a modular, node-based video-effects editor and runtime built with C# and WPF.
- It provides an API for defining “ports” and “nodes,” a Core engine to load and execute nodes, WPF controls and an editor UI, sets of built-in video-processing nodes (including HLSL shaders), a test harness (UITest), and an auto-updater.

##### Top-level components
A. API Layer
– Project: NodeVideoEffects.API
– Contains base abstractions: PortControlBase, PortValueBase, ShaderEffectNodeBase, etc.
B. Core Engine
– Project: NodeVideoEffects.Core
– Manages NodeInfo, NodeLogic, NodesManager, VideoEffectsLoader (discovers and loads nodes/shaders).
C. Node Definitions
– Project: NodeVideoEffects.Nodes (subfolders: Basic, Composite, Effect, Math)
– Concrete node implementations; each compiles against the API.
D. Shader Assets
– Folder: NodeVideoEffects.Shader
– HLSL files and ShaderCompiler.bat to generate .cso files used by Effect nodes.
E. UI Controls
– Project: NodeVideoEffects.Control
– WPF UserControls for each port type (BoolPort, ColorPort, NumberPort, etc.).
F. Node Editor
– Project: NodeVideoEffects.Editor
– WPF canvas, Node.xaml, Connector.xaml, NodeExplorer; follows MVVM-ish pattern.
G. Host Application
– Project: NodeVideoEffects (MainWindow, dockable panels, log viewer, menu, plugin bootstrap).
H. Utility Services
– Project: NodeVideoEffects.Utility
– Logger, ResourceLoader, TaskTracker, Text resources.
I. Updater Service
– Project: NodeVideoEffects.Updater
– WPF front-end for checking/download/install updates; calls NodeVideoEffects.UpdaterService.
J. UI Test Harness
– Project: NodeVideoEffects.UITest
– Simplified WPF app to test controls and editor in isolation.

##### Relationships and interactions
- The Host Application references Core, Editor, Control, Utility, API, and Updater.
- The Editor UI uses Control (port controls) and Core (to enumerate available nodes, execute logic).
- Core loads Node modules dynamically (reflection) and pulls in compiled shaders from the Shader folder.
- Node modules depend on API definitions only.
- Utility classes are injected or statically consumed by Core, Editor, and Host for logging and resource loading.
- The Updater communicates over HTTP (external service) to check for new versions; triggers Host restart.
- The UITest app references Control, Core, Editor, API to sandbox the editor/controls without the full Host.

##### Architectural patterns and principles
- Modular, plugin-style architecture (loose coupling via API interfaces, dynamic loading).
- Layered separation: API → Core → Host/UI → External (shaders, network).
- MVVM influences in Editor (XAML views, code-behind partially MVVM).
- Single Responsibility per project.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Layers
    subgraph "API Layer"
        API["NodeVideoEffects.API"]:::library
    end

    subgraph "Core Engine"
        CORE["NodeVideoEffects.Core"]:::library
    end

    subgraph "Node Definitions"
        NODES["NodeVideoEffects.Nodes"]:::library
    end

    subgraph "Shader Assets"
        SHADER["NodeVideoEffects.Shader"]:::assets
    end

    subgraph "UI Controls"
        CONTROL["NodeVideoEffects.Control"]:::ui
    end

    subgraph "Node Editor"
        EDITOR["NodeVideoEffects.Editor"]:::ui
    end

    subgraph "Host Application"
        HOST["NodeVideoEffects"]:::ui
    end

    subgraph "Utility Services"
        UTIL["NodeVideoEffects.Utility"]:::service
    end

    subgraph "Updater Service"
        UPDATER["NodeVideoEffects.Updater"]:::service
    end

    subgraph "UI Test Harness"
        UITEST["NodeVideoEffects.UITest"]:::ui
    end

    %% External Systems
    GPU["GPU (DirectX)"]:::external
    UPDATE_SERVER["Update Server"]:::external

    %% Relationships
    EDITOR -->|"uses controls"| CONTROL
    EDITOR -->|"executes logic"| CORE
    CORE -->|"depends on"| API
    NODES -->|"implements API"| API
    CORE -->|"dynamic load"| NODES
    CORE -->|"renders shaders"| SHADER
    CORE -->|"dispatch to GPU"| GPU
    HOST -->|"hosts editor"| EDITOR
    HOST -->|"hosts core"| CORE
    HOST -->|"logs via Logger"| UTIL
    HOST -->|"invokes updater"| UPDATER
    UPDATER -->|"checks updates"| UPDATE_SERVER
    UITEST -->|"tests UI controls"| CONTROL
    UITEST -->|"tests core & editor"| CORE
    UITEST -->|"references editor"| EDITOR
    UITEST -->|"references API"| API

    %% Click Events
    click API "https://github.com/p-rer/nodevideoeffects/blob/main/NodeVideoEffects.API/NodeVideoEffects.API.csproj"
    click CORE "https://github.com/p-rer/nodevideoeffects/blob/main/NodeVideoEffects.Core/NodeVideoEffects.Core.csproj"
    click NODES "https://github.com/p-rer/nodevideoeffects/blob/main/NodeVideoEffects.Nodes/NodeVideoEffects.Nodes.csproj"
    click SHADER "https://github.com/p-rer/nodevideoeffects/blob/main/NodeVideoEffects.Shader/ShaderCompiler.bat"
    click CONTROL "https://github.com/p-rer/nodevideoeffects/blob/main/NodeVideoEffects.Control/NodeVideoEffects.Control.csproj"
    click EDITOR "https://github.com/p-rer/nodevideoeffects/blob/main/NodeVideoEffects.Editor/NodeVideoEffects.Editor.csproj"
    click HOST "https://github.com/p-rer/nodevideoeffects/blob/main/NodeVideoEffects/NodeVideoEffects.csproj"
    click UTIL "https://github.com/p-rer/nodevideoeffects/blob/main/NodeVideoEffects.Utility/NodeVideoEffects.Utility.csproj"
    click UPDATER "https://github.com/p-rer/nodevideoeffects/blob/main/NodeVideoEffects.Updater/NodeVideoEffects.Updater.csproj"
    click UITEST "https://github.com/p-rer/nodevideoeffects/blob/main/NodeVideoEffects.UITest/NodeVideoEffects.UITest.csproj"

    %% Styles
    classDef library fill:#D6EAF8,stroke:#2980B9,color:#1B4F72
    classDef ui fill:#D5F5E3,stroke:#27AE60,color:#145A32
    classDef assets fill:#FCF3CF,stroke:#B7950B,color:#7D6608
    classDef service fill:#F5B7B1,stroke:#C0392B,color:#78281F
    classDef external fill:#E8DAEF,stroke:#8E44AD,color:#4A235A
```
