# quelsolaar/hxa architecture

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

- Interactive diagram: https://gitdiagram.com/quelsolaar/hxa
- Repository: https://github.com/quelsolaar/hxa

## Overview

##### Core Components (Central Layer)
- Three main node types as sub-components:
- Meta-Only Node Handler
- Geometry Node Handler
- Image Node Handler

##### Data Structure Layer
- Layer Stacks
- Layers
- Meta Data

##### Processing Pipeline (Left to Right Flow)

a. Input Handlers:
- File Loading (hxa_load_save.c)
- FBX Conversion (hxa_fbx_convert.c)
- OBJ Handling (hxa_util_obj.c)
- PNG Processing (hxa_util_png.c)

b. Core Processing:
- Serialization (hxa_serialize.c)
- Type Conversion (hxa_util_type_conversion.c)
- Validation (hxa_util_validate.c)

c. Utility Processing:
- Normal Generation (hxa_util_normals.c)
- Triangulation (hxa_util_triangulate.c)
- GPU Optimization (hxa_util_gpu_optimize.c)
- Primitive Processing (hxa_util_primitive.c)

##### Plugin System (Top Layer)
- UPI (Universal Plugin Interface) system
- Components:
- UPI Host (hxa_upi_host.c)
- UPI Plugin (hxa_upi_plugin.c)
- Command Line Interface (hxa_upi_command_line_interface.c)

##### Data Flow Indicators
- File I/O operations
- Data transformations
- Plugin communications
- Validation flows

- Format version
- Endianness (Little Endian)
- Magic Number ("HxA")
- Maximum name length (256)

- The simplicity and modularity of the format
- Clear data flow paths
- The plugin architecture
- The relationship between different utility functions
- The convention-based nature of the format

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Legend
        L1[Core Component]:::core
        L2[Input Handler]:::input
        L3[Processing Component]:::processing
        L4[Plugin Component]:::plugin
        L5[Data Structure]:::data
    end

    subgraph "Plugin System"
        UPI_HOST[UPI Host]:::plugin
        UPI_PLUGIN[UPI Plugin]:::plugin
        CLI[Command Line Interface]:::plugin
        UPI_DEF[UPI Definitions]:::plugin
    end

    subgraph "Core Components"
        HXA[HxA File Format Core]:::core
        META[Meta-Only Node Handler]:::core
        GEO[Geometry Node Handler]:::core
        IMG[Image Node Handler]:::core
    end

    subgraph "Data Structures"
        LAYERS[Layer Stacks]:::data
        LAYER[Layers]:::data
        META_DATA[Meta Data]:::data
    end

    subgraph "Input Handlers"
        FILE_LOAD[File Loading]:::input
        FBX[FBX Conversion]:::input
        OBJ[OBJ Handling]:::input
        PNG[PNG Processing]:::input
    end

    subgraph "Core Processing"
        SERIAL[Serialization]:::processing
        TYPE_CONV[Type Conversion]:::processing
        VALID[Validation]:::processing
    end

    subgraph "Utility Processing"
        NORMAL[Normal Generation]:::processing
        TRIANG[Triangulation]:::processing
        GPU_OPT[GPU Optimization]:::processing
        PRIM[Primitive Processing]:::processing
        VERTEX[Vertex Management]:::processing
        META_UTIL[Meta Data Handling]:::processing
        MESH_OP[Mesh Operations]:::processing
        DEBUG[Debug/Print Functions]:::processing
    end

    subgraph "Technical Details"
        TECH[Format Version: HXA_VERSION_FORMAT<br>Endianness: Little Endian<br>Magic Number: 'HxA'<br>Max Name Length: 256]:::tech
    end

    HXA --> META & GEO & IMG
    META & GEO & IMG --> LAYERS
    LAYERS --> LAYER
    LAYER --> META_DATA

    FILE_LOAD & FBX & OBJ & PNG --> HXA
    HXA --> SERIAL & TYPE_CONV & VALID
    SERIAL & TYPE_CONV & VALID --> NORMAL & TRIANG & GPU_OPT & PRIM & VERTEX & META_UTIL & MESH_OP & DEBUG

    UPI_DEF --> UPI_HOST & UPI_PLUGIN
    UPI_HOST & UPI_PLUGIN --> CLI

    classDef core fill:#f9f,stroke:#333,stroke-width:2px
    classDef input fill:#bbf,stroke:#333,stroke-width:2px
    classDef processing fill:#bfb,stroke:#333,stroke-width:2px
    classDef plugin fill:#fbb,stroke:#333,stroke-width:2px
    classDef data fill:#ddd,stroke:#333,stroke-width:2px
    classDef tech fill:#fff,stroke:#333,stroke-width:1px

    click HXA "https://github.com/quelsolaar/HxA/blob/master/hxa.h"
    click FILE_LOAD "https://github.com/quelsolaar/HxA/blob/master/hxa_load_save.c"
    click FBX "https://github.com/quelsolaar/HxA/blob/master/hxa_fbx_convert.c"
    click OBJ "https://github.com/quelsolaar/HxA/blob/master/hxa_util_obj.c"
    click PNG "https://github.com/quelsolaar/HxA/blob/master/hxa_util_png.c"
    click SERIAL "https://github.com/quelsolaar/HxA/blob/master/hxa_serialize.c"
    click TYPE_CONV "https://github.com/quelsolaar/HxA/blob/master/hxa_util_type_conversion.c"
    click VALID "https://github.com/quelsolaar/HxA/blob/master/hxa_util_validate.c"
    click NORMAL "https://github.com/quelsolaar/HxA/blob/master/hxa_util_normals.c"
    click TRIANG "https://github.com/quelsolaar/HxA/blob/master/hxa_util_triangulate.c"
    click GPU_OPT "https://github.com/quelsolaar/HxA/blob/master/hxa_util_gpu_optimize.c"
    click PRIM "https://github.com/quelsolaar/HxA/blob/master/hxa_util_primitive.c"
    click UPI_HOST "https://github.com/quelsolaar/HxA/blob/master/hxa_upi_host.c"
    click UPI_PLUGIN "https://github.com/quelsolaar/HxA/blob/master/hxa_upi_plugin.c"
    click CLI "https://github.com/quelsolaar/HxA/blob/master/hxa_upi_command_line_interface.c"
    click UPI_DEF "https://github.com/quelsolaar/HxA/blob/master/hxa_upi.h"
    click VERTEX "https://github.com/quelsolaar/HxA/blob/master/hxa_util_vertex_purge.c"
    click META_UTIL "https://github.com/quelsolaar/HxA/blob/master/hxa_util_meta.c"
    click MESH_OP "https://github.com/quelsolaar/HxA/blob/master/hxa_util_merge_split.c"
    click DEBUG "https://github.com/quelsolaar/HxA/blob/master/hxa_print.c"
```
