# coka/webgl-editor architecture

> Architecture diagram of the GitHub repository coka/webgl-editor, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-09-03). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/coka/webgl-editor
- Repository: https://github.com/coka/webgl-editor

## Overview

##### Project type and purpose
- This is a browser‐based 3D modeling editor built as a single‐page application (SPA) with a minimal Node.js/Express static server.
- It uses Polymer web components for the UI and three.js for 3D scene rendering.

##### File structure
- Top‐level files:
- app.js – Node/Express app serving static assets
- index.html – entry HTML for the SPA
- gulpfile.js – build tasks (bundling, minification, live reload)
- package.json & bower.json – dependency definitions (npm & Bower)
- elements/ – custom Polymer elements folder
– editor-attribute-view/ – UI for editing object properties
– editor-viewport/ – WebGL canvas for rendering the scene
– webgl-editor/ – container component orchestrating viewport & attributes
- No separate “backend” business logic or database directories—purely front-end with a simple static‐file server.

##### README for additional insights
- Confirms focus on simplifying 3D content creation in the browser.
- Emphasizes Polymer + three.js stack and quick start via npm scripts.

##### Detail
- Versioned dependencies (e.g., three.js vX, Polymer vX) if known.
- Config files (gulpfile.js, bower.json, package.json) as part of Build/CI.
- Event bus or direct method calls between editor-attribute-view and webgl-editor.
- That editor-viewport is purely rendering while editor-attribute-view is purely input.
- Don’t over-complicate—represent every folder and file group only if it contributes to runtime or build.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Build & CI Layer
    subgraph "Build & CI Layer"
        npm["npm (package management & scripts)"]:::build
        bower["Bower (frontend dependencies)"]:::build
        gulp["Gulp (build system)"]:::build
        jscs["JSCS (linting)"]:::build
        semCI["SemaphoreCI"]:::build
        pkgjson["package.json"]:::build
        bwrjson["bower.json"]:::build
        gulpfile["gulpfile.js"]:::build
        jscsrc[".jscsrc"]:::build
    end

    %% Server Layer
    subgraph "Server Layer"
        app["app.js (Express static server)"]:::server
    end

    %% Client Layer (Browser)
    subgraph "Client Layer"
        entry["index.html + Polymer loader"]:::client
        threejs["three.js (3D library)"]:::client
        subgraph "Web Components"
            webgl["<webgl-editor>"]:::client
            viewport["<editor-viewport>"]:::client
            attributes["<editor-attribute-view>"]:::client
        end
    end

    %% Connections
    npm -->|"runs"| gulp
    gulp -->|"lint code"| jscs
    gulp -->|"bundles assets"| bower
    gulp -->|"deploys static assets"| app
    app -->|"serves via HTTP"| entry
    entry -->|"bootstraps Polymer"| webgl
    webgl -->|"contains"| viewport
    webgl -->|"contains"| attributes
    attributes -->|"dispatches events to"| webgl
    webgl -->|"updates scene in"| viewport
    viewport -->|"renders scene via"| threejs

    %% Click Events
    click gulp "https://github.com/coka/webgl-editor/blob/master/gulpfile.js"
    click npm "https://github.com/coka/webgl-editor/blob/master/package.json"
    click bower "https://github.com/coka/webgl-editor/blob/master/bower.json"
    click jscs "https://github.com/coka/webgl-editor/blob/master/.jscsrc"
    click app "https://github.com/coka/webgl-editor/blob/master/app.js"
    click entry "https://github.com/coka/webgl-editor/blob/master/index.html"
    click webgl "https://github.com/coka/webgl-editor/blob/master/elements/webgl-editor/webgl-editor.html"
    click viewport "https://github.com/coka/webgl-editor/blob/master/elements/editor-viewport/editor-viewport.html"
    click attributes "https://github.com/coka/webgl-editor/blob/master/elements/editor-attribute-view/editor-attribute-view.html"

    %% Styles
    classDef build fill:#ffb366,stroke:#cc6600,color:#000
    classDef server fill:#b3ffb3,stroke:#33cc33,color:#000
    classDef client fill:#b3d9ff,stroke:#0066cc,color:#000
```
