# icosa-foundation/gallery-viewer architecture

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

- Interactive diagram: https://gitdiagram.com/icosa-foundation/gallery-viewer
- Repository: https://github.com/icosa-foundation/gallery-viewer

## Overview

##### Main Components

a. Core Viewer Component
- Role in rendering different 3D file formats
- Viewer.ts as the entry point

b. Format Handlers
- GLTF 1.0 (Legacy)
- GLTF 2.0
- Tilt files
- GLB files

c. Helper Systems
- Navigation system (from src/helpers/Navigation.ts)
- Legacy support system (from src/legacy/)

##### Component Relationships

**File Input → Format Handlers → Core Viewer → Rendered Output**
- ↑
- Legacy Support System

##### Technical Stack Elements

Key technical aspects:
- TypeScript (evident from tsconfig.json)
- Three.js (implied by 3D visualization)
- CSS styling layer (from src/css)

**┌─ Input Layer ─────┐    ┌─ Processing Layer ─┐    ┌─ Output Layer ──┐**
- GLTF 1.0       │    │ - Core Viewer      │    │ - Rendered 3D  │
- GLTF 2.0       │ → │ - Format Handlers  │ → │   Scene        │
- Tilt Files     │    │ - Navigation       │    │ - Interactive  │
- GLB Files      │    │ - Legacy Support   │    │   Controls    │
- ┘    └─────────────────┘    └───────────────┘

##### Important Details

a. File Format Support:
- Clear separation between modern and legacy format support
- Format conversion flows
- Supported file extensions (.tilt, .gltf, .glb)

b. Integration Points:
- How it integrates with Icosa Gallery
- Potential integration points for other systems

c. Asset Management:
- How different assets (models, textures) are handled

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph Input["Input Layer"]
        GLTF1[GLTF 1.0]
        GLTF2[GLTF 2.0]
        TILT[Tilt Files]
        GLB[GLB Files]
    end

    subgraph Process["Processing Layer"]
        direction TB
        CV[Core Viewer]:::core
        
        subgraph FH["Format Handlers"]
            direction TB
            LG[Legacy GLTF Handler]:::legacy
            LM[Legacy Material Handler]:::legacy
            MF[Modern Format Handler]:::modern
        end
        
        subgraph Help["Helper Systems"]
            direction TB
            NAV[Navigation System]:::helper
            LS[Legacy Support System]:::legacy
        end
    end

    subgraph Output["Output Layer"]
        R3D[Rendered 3D Scene]
        IC[Interactive Controls]
    end

    %% Connections
    GLTF1 --> LG
    GLTF2 --> MF
    TILT --> MF
    GLB --> MF
    
    LG --> CV
    LM --> CV
    MF --> CV
    
    NAV --> CV
    LS --> LG
    LS --> LM
    
    CV --> R3D
    CV --> IC

    %% Styling
    classDef core fill:#3498db
    classDef legacy fill:#e74c3c
    classDef modern fill:#2ecc71
    classDef helper fill:#f1c40f
    
    %% Click Events
    click CV "https://github.com/icosa-foundation/gallery-viewer/blob/main/src/viewer.ts"
    click LG "https://github.com/icosa-foundation/gallery-viewer/blob/main/src/legacy/LegacyGLTFLoader.js"
    click LM "https://github.com/icosa-foundation/gallery-viewer/blob/main/src/legacy/ReplaceLegacyMaterials.ts"
    click NAV "https://github.com/icosa-foundation/gallery-viewer/blob/main/src/helpers/Navigation.ts"
    click LS "https://github.com/icosa-foundation/gallery-viewer/tree/main/src/legacy/"
    click GLTF1 "https://github.com/icosa-foundation/gallery-viewer/tree/main/dist/formats/gltf1/"
    click GLTF2 "https://github.com/icosa-foundation/gallery-viewer/tree/main/dist/formats/gltf2/"
    click TILT "https://github.com/icosa-foundation/gallery-viewer/tree/main/dist/formats/tilt/"

    %% Legend
    subgraph Legend
        C1[Core Component]:::core
        L1[Legacy Component]:::legacy
        M1[Modern Component]:::modern
        H1[Helper Component]:::helper
    end
```
