From f8ce503a4082bcf140ed95a8c151f1b49bb7b99c Mon Sep 17 00:00:00 2001 From: Nettika Date: Wed, 28 Jan 2026 14:36:34 -0800 Subject: [PATCH] Add web port research --- research/index.md | 1 + research/web-port-feasibility.md | 546 +++++++++++++++++++++++++++++++ 2 files changed, 547 insertions(+) create mode 100644 research/web-port-feasibility.md diff --git a/research/index.md b/research/index.md index 5a86bca90..c5ef011f6 100644 --- a/research/index.md +++ b/research/index.md @@ -49,6 +49,7 @@ MatterControl is a comprehensive 3D printing workflow application built by Matte | Document | Description | | -------- | ----------- | | [Design-Only Fork](design-only-fork.md) | Plan to strip MatterControl down to a pure 3D design/modeling application, removing all printing, slicing, and cloud features. | +| [Web Port Feasibility](web-port-feasibility.md) | Analysis of porting design features to a web app (JavaScript, WASM, WebGL). Includes technology mapping and timeline estimates. | | [Linux Migration](linux-migration.md) | Feasibility of migrating the project from its many Windows-only dependencies to cross platform alternatives to fully support Linux. | ## Key Entry Points diff --git a/research/web-port-feasibility.md b/research/web-port-feasibility.md new file mode 100644 index 000000000..780770998 --- /dev/null +++ b/research/web-port-feasibility.md @@ -0,0 +1,546 @@ +# Feasibility Analysis: Porting MatterControl Design Features to Web + +**Goal:** Evaluate porting the design-only features of MatterControl to a web application using JavaScript, WebAssembly, and WebGL. + +## Executive Summary + +| Component | Porting Difficulty | Recommended Approach | +|-----------|-------------------|---------------------| +| **3D Rendering** | Medium | WebGL 2.0 + three.js | +| **UI Framework** | High | React/Vue + custom Canvas widgets | +| **Mesh Operations** | Medium-High | WASM (C# via Blazor or manual port) | +| **File Formats** | Medium | JS parsers + pako for compression | +| **Persistence** | Low | IndexedDB + File API | + +**Overall Assessment:** Feasible but substantial effort (4-6 months for MVP) + +--- + +## Technology Stack Comparison + +| Desktop (Current) | Web Equivalent | +|-------------------|----------------| +| .NET 6.0 (C#) | TypeScript + WASM | +| OpenGL 3.3 | WebGL 2.0 | +| agg-sharp (2D) | Canvas 2D API | +| GuiWidget (UI) | React/Vue components | +| SQLite | IndexedDB | +| File System | File API + virtual FS | +| Typography module | Web Fonts + Canvas text | + +--- + +## 1. 3D Rendering (WebGL) + +### Current Implementation +- OpenGL 3.3 with VAO/VBO/EBO +- GLSL 330 shaders (simple vertex → fragment) +- Custom `IOpenGL` abstraction layer +- Features: textures, lighting (2 directional), depth testing, face culling + +### Web Porting Options + +**Option A: three.js (Recommended)** +- Mature WebGL abstraction +- Built-in: cameras, raycasting, materials, scene graph +- Large ecosystem and documentation +- Handles WebGL 1.0/2.0 fallback + +**Option B: Custom WebGL 2.0** +- More control, smaller bundle +- Requires implementing: shader management, buffer handling, picking +- Similar to current `IOpenGL` abstraction + +**Option C: Babylon.js** +- Full game engine, heavier than three.js +- Excellent tooling and inspector +- May be overkill for CAD-style app + +### Porting Complexity + +| Feature | Desktop | Web Equivalent | Effort | +|---------|---------|----------------|--------| +| Mesh rendering | GLMeshTrianglePlugin | three.js BufferGeometry | Low | +| Camera control | TrackballTumbleWidget | three.js OrbitControls | Low | +| Picking/selection | Ray + BVH | three.js Raycaster | Low | +| Transform gizmos | Custom implementation | three.js TransformControls | Low | +| Wireframe overlay | GLMeshWirePlugin | three.js EdgesGeometry | Low | +| Texture mapping | ImageGlPlugin | three.js Texture | Low | +| **Total 3D rendering** | | | **2-3 weeks** | + +--- + +## 2. UI Framework + +### Current Implementation +- **GuiWidget**: Custom widget system with 2500+ line base class +- **Layout**: HAnchor/VAnchor enum-based positioning, FlowLayout +- **Widgets**: Button, TextEdit, Slider, Menu, ScrollableWidget, TreeView, etc. +- **Theming**: JSON-based ThemeConfig +- **Rendering**: agg-sharp software rasterization to ImageBuffer + +### Web Porting Options + +**Option A: React + CSS (Recommended)** +``` +GuiWidget hierarchy → React component tree +HAnchor/VAnchor → CSS Flexbox +FlowLayoutWidget → flex-direction +ThemeConfig → CSS Custom Properties +Events → React synthetic events +``` + +**Option B: Vue + CSS** +- Similar mapping to React +- Reactive state management built-in + +**Option C: Canvas-based (like current)** +- Port GuiWidget directly to Canvas 2D +- High effort, poor accessibility +- Not recommended + +### Widget Mapping + +| MatterControl Widget | Web Equivalent | +|---------------------|----------------| +| GuiWidget | React.Component + div | +| FlowLayoutWidget | Flexbox container | +| Button | `